From d5a4e913a05be98847d8284b98d0a8ba235560d2 Mon Sep 17 00:00:00 2001 From: MichaelPesce Date: Wed, 2 Aug 2023 12:27:29 -0400 Subject: [PATCH] added popup modal for rerun optimization with functionality for overwrite current scenario, still needs functionality for create new scenario; added prop to all instances of popupmodal --- .../ui/src/components/Bottombar/Bottombar.js | 29 ++++++++++++++++--- .../src/components/PopupModal/PopupModal.js | 8 ++--- .../ProcessToolbar/ProcessToolbar.js | 1 + electron/ui/src/components/Sidebar/Sidebar.js | 1 + electron/ui/src/views/Dashboard/Dashboard.js | 1 + .../ui/src/views/ScenarioList/ScenarioList.js | 2 ++ 6 files changed, 34 insertions(+), 8 deletions(-) diff --git a/electron/ui/src/components/Bottombar/Bottombar.js b/electron/ui/src/components/Bottombar/Bottombar.js index 0a385680..631db439 100644 --- a/electron/ui/src/components/Bottombar/Bottombar.js +++ b/electron/ui/src/components/Bottombar/Bottombar.js @@ -12,11 +12,13 @@ import PopupModal from '../../components/PopupModal/PopupModal'; export default function Bottombar(props) { const [ openSaveModal, setOpenSaveModal ] = useState(false) + const [ openRerunModal, setOpenRerunModal] = useState(false) // const [ disableOptimize, setDisableOptimize ] = useState(false) const [ key, setKey ] = useState(null) const [ hasOverride, setHasOverride ] = useState(false) const handleOpenSaveModal = () => setOpenSaveModal(true); const handleCloseSaveModal = () => setOpenSaveModal(false); + const handleCloseRerunModal = () => setOpenRerunModal(false); const styles = { filled: { backgroundColor: '#01678f', @@ -94,12 +96,15 @@ export default function Bottombar(props) { } const handleRunOptimize = () => { - // console.log('rerun with the following overrides: ') - // console.log(props.scenario.override_values) - + handleCloseRerunModal() props.handleRunModel() } + const reoptimizeNewScenario = () => { + // create function in app.js for this + // props.handleRunModel() + } + return ( @@ -116,7 +121,7 @@ export default function Bottombar(props) { {props.section === 0 && } {props.section === 1 && } - {(props.section === 2 && hasOverride) && } + {(props.section === 2 && hasOverride) && } @@ -137,6 +142,22 @@ export default function Bottombar(props) { buttonTwoText='Discard' buttonTwoColor='error' buttonTwoVariant='outlined' + width={400} + /> + ); diff --git a/electron/ui/src/components/PopupModal/PopupModal.js b/electron/ui/src/components/PopupModal/PopupModal.js index 3814d426..983e2900 100644 --- a/electron/ui/src/components/PopupModal/PopupModal.js +++ b/electron/ui/src/components/PopupModal/PopupModal.js @@ -9,7 +9,7 @@ export default function Dashboard(props) { top: '50%', left: '50%', transform: 'translate(-50%, -50%)', - width: 400, + width: props.width !== undefined ? props.width : 400, bgcolor: 'background.paper', border: '2px solid #000', boxShadow: 24, @@ -53,11 +53,11 @@ export default function Dashboard(props) { {props.hasTwoButtons ? <> - + - - + + diff --git a/electron/ui/src/components/ProcessToolbar/ProcessToolbar.js b/electron/ui/src/components/ProcessToolbar/ProcessToolbar.js index db26457a..c829b15e 100644 --- a/electron/ui/src/components/ProcessToolbar/ProcessToolbar.js +++ b/electron/ui/src/components/ProcessToolbar/ProcessToolbar.js @@ -104,6 +104,7 @@ export default function ProcessToolbar(props) { buttonTwoText='Discard' buttonTwoColor='error' buttonTwoVariant='outlined' + width={400} /> ); diff --git a/electron/ui/src/components/Sidebar/Sidebar.js b/electron/ui/src/components/Sidebar/Sidebar.js index d2910430..00817a73 100644 --- a/electron/ui/src/components/Sidebar/Sidebar.js +++ b/electron/ui/src/components/Sidebar/Sidebar.js @@ -310,6 +310,7 @@ export default function Sidebar(props) { buttonTwoText='Discard' buttonTwoColor='error' buttonTwoVariant='outlined' + width={400} /> ); diff --git a/electron/ui/src/views/Dashboard/Dashboard.js b/electron/ui/src/views/Dashboard/Dashboard.js index 878a35a9..6475a831 100644 --- a/electron/ui/src/views/Dashboard/Dashboard.js +++ b/electron/ui/src/views/Dashboard/Dashboard.js @@ -142,6 +142,7 @@ export default function Dashboard(props) { buttonText='Save' buttonColor='primary' buttonVariant='contained' + width={400} />
diff --git a/electron/ui/src/views/ScenarioList/ScenarioList.js b/electron/ui/src/views/ScenarioList/ScenarioList.js index d1473455..feec4139 100644 --- a/electron/ui/src/views/ScenarioList/ScenarioList.js +++ b/electron/ui/src/views/ScenarioList/ScenarioList.js @@ -253,6 +253,7 @@ export default function ScenarioList(props) { buttonText='Save' buttonColor='primary' buttonVariant='contained' + width={400} /> { showError &&