From aa24c2a0f6f0d1945516ba08a37bb091cb6644f2 Mon Sep 17 00:00:00 2001 From: MichaelPesce Date: Fri, 18 Oct 2024 13:08:15 -0400 Subject: [PATCH] add model type upon file upload; if excel file has operational in its name, make it operational model --- .../components/FileUploadModal/FileUploadModal.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/electron/ui/src/components/FileUploadModal/FileUploadModal.js b/electron/ui/src/components/FileUploadModal/FileUploadModal.js index d49ec6b..1cbc0c5 100644 --- a/electron/ui/src/components/FileUploadModal/FileUploadModal.js +++ b/electron/ui/src/components/FileUploadModal/FileUploadModal.js @@ -17,6 +17,7 @@ export default function FileUploadModal(props) { const [ scenarioName, setScenarioName ] = useState("") const [ showWarning, setShowWarning ] = useState(false) const [ warningMessage, setWarningMessage ] = useState("") + const [ modelType, setModelType ] = useState("strategic") const [ file, setFile ] = useState(null) const fileTypes = ["xlsx", "kmz", "kml"]; const PARETO_VERSION = "main" @@ -28,11 +29,6 @@ export default function FileUploadModal(props) { const { port } = useApp() - useEffect(()=>{ - console.log('fileuploadmodal props: ') - console.log(props) - }, [props]); - const styles = { modalStyle: { position: 'absolute', @@ -115,8 +111,7 @@ export default function FileUploadModal(props) { setShowWarning(false) }, 5000) }else { - console.log('valid file entry') - props.handleFileUpload(file, scenarioName) + props.handleFileUpload(file, scenarioName, modelType) setShowWarning(false) props.setShowFileModal(false) } @@ -152,6 +147,10 @@ export default function FileUploadModal(props) { function DragDrop() { const handleChange = (file) => { console.log('setting file: '+file.name) + if (file.name.toLowerCase().includes("operational")) { + console.log("setting model type to operational") + setModelType("operational") + } setFile(file); }; return (