Skip to content

Commit

Permalink
add model type upon file upload; if excel file has operational in its…
Browse files Browse the repository at this point in the history
… name, make it operational model
  • Loading branch information
MichaelPesce committed Oct 18, 2024
1 parent 4834c6a commit aa24c2a
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions electron/ui/src/components/FileUploadModal/FileUploadModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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',
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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 (
Expand Down

0 comments on commit aa24c2a

Please sign in to comment.