From 234b918fe652655670f4097a3fca06df345bced3 Mon Sep 17 00:00:00 2001 From: MichaelPesce Date: Mon, 5 Aug 2024 14:14:53 -0400 Subject: [PATCH 01/21] remove some logging --- electron/ui/src/App.js | 4 +--- electron/ui/src/components/SolveDialog/SolveDialog.js | 2 -- electron/ui/src/views/FlowsheetConfig/FlowsheetConfig.js | 6 ------ 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/electron/ui/src/App.js b/electron/ui/src/App.js index 74251b88..dcdb9a35 100644 --- a/electron/ui/src/App.js +++ b/electron/ui/src/App.js @@ -21,15 +21,13 @@ function App() { const [checkAgain, setCheckAgain] = useState(1) const WAIT_TIME = 2 - console.log("App hasTheme = ",hasTheme); - useEffect(() => { if (hasTheme && checkAgain !== 0) { // Get list of flowsheets getFlowsheetsList() .then((data) => { - console.log("got flowsheets list") + // console.log("got flowsheets list") setHasFlowsheetsList(true); setCheckAgain(0) }).catch((e) => { diff --git a/electron/ui/src/components/SolveDialog/SolveDialog.js b/electron/ui/src/components/SolveDialog/SolveDialog.js index 7d13d5e3..4f0d545f 100644 --- a/electron/ui/src/components/SolveDialog/SolveDialog.js +++ b/electron/ui/src/components/SolveDialog/SolveDialog.js @@ -10,11 +10,9 @@ export default function SolveDialog(props) { const { open, handleSolved, handleError, flowsheetData, id, isSweep } = props; useEffect(()=>{ - console.log("solve dialog use effect") try { if(open) { - console.log("open solve dialog is true") if(isSweep) { sweep(id, flowsheetData.inputData) .then(r => r.json().then(data => ({status: r.status, body: data}))) diff --git a/electron/ui/src/views/FlowsheetConfig/FlowsheetConfig.js b/electron/ui/src/views/FlowsheetConfig/FlowsheetConfig.js index e3c0ceaa..11ec6f05 100644 --- a/electron/ui/src/views/FlowsheetConfig/FlowsheetConfig.js +++ b/electron/ui/src/views/FlowsheetConfig/FlowsheetConfig.js @@ -87,10 +87,8 @@ export default function FlowsheetConfig(props) { const [isBuilt, setIsBuilt] = useState(false) const [showBuildOptions, setShowBuildOptions] = useState(false) const theme = props.theme; - console.log("flowsheet config theme=", theme); useEffect(() => { - console.log("params.id", params.id); if (!params.hasOwnProperty("id") || !params.id) return; // gotta find a way to figure out whether to build or not @@ -123,10 +121,8 @@ export default function FlowsheetConfig(props) { }, [params.id]); useEffect(() => { - console.info("Check/set whether flowsheet is built"); const inputs = getInputs(flowsheetData); if (!emptyOrNullObj(inputs)) { - console.log('flowsheet is indeed built'); setIsBuilt(true); } }, [flowsheetData]) @@ -304,8 +300,6 @@ export default function FlowsheetConfig(props) { } } - console.log("Returning container for FlowsheetConfig. build_options=", flowsheetData.inputData.build_options, "isBuilt=", isBuilt, - "loadingFlowsheetData=", loadingFlowsheetData); return ( {(loadingFlowsheetData) ? From 48fab757c02291cff33e28ea9c3875986a988910 Mon Sep 17 00:00:00 2001 From: MichaelPesce Date: Mon, 5 Aug 2024 14:34:12 -0400 Subject: [PATCH 02/21] convert output to table; needs styling, formatting --- .../components/SingleOutput/SingleOutput.js | 80 ++++++++++++++++++- 1 file changed, 78 insertions(+), 2 deletions(-) diff --git a/electron/ui/src/components/SingleOutput/SingleOutput.js b/electron/ui/src/components/SingleOutput/SingleOutput.js index e8b233e1..aab81c3d 100644 --- a/electron/ui/src/components/SingleOutput/SingleOutput.js +++ b/electron/ui/src/components/SingleOutput/SingleOutput.js @@ -1,4 +1,4 @@ -import React, {useState} from "react"; +import React, {useState, useEffect} from "react"; import {useParams} from "react-router-dom"; // MUI imports import Accordion from "@mui/material/Accordion"; @@ -14,6 +14,14 @@ import SaveIcon from '@mui/icons-material/Save'; import Stack from "@mui/material/Stack"; import TextField from "@mui/material/TextField"; import Toolbar from "@mui/material/Toolbar"; +import { + Table, + TableBody, + TableCell, + TableContainer, + TableHead, + TableRow, +} from '@mui/material' export default function SingleOutput(props) { let params = useParams(); @@ -21,10 +29,32 @@ export default function SingleOutput(props) { const [configName, setConfigName] = useState(outputData.name) const [openSaveConfig, setOpenSaveConfig] = React.useState(false); const [saved, setSaved] = React.useState(false); + const [outputTableData, setOutputTableData] = useState({}) const handleOpenSaveConfig = () => setOpenSaveConfig(true); const handleCloseSaveConfig = () => setOpenSaveConfig(false); + useEffect(()=> { + let export_variables = {...outputData.outputData.exports} + let rows = {} + for (let key of Object.keys(export_variables)) { + let export_variable = export_variables[key] + let category = export_variable.output_category + let category_rows + if (Object.keys(rows).includes(category)) category_rows = rows[category] + else { + category_rows = [] + rows[category] = category_rows + } + category_rows.push({ + key: key, + name: export_variable.name, + value: export_variable.value, + units: export_variable.display_units + }) + } + setOutputTableData(rows) + }, [outputData]) const modalStyle = { position: 'absolute', @@ -184,6 +214,42 @@ export default function SingleOutput(props) { return var_sections } + const renderRows = () => { + try { + return ( + + {Object.entries(outputTableData).map(([category, rows]) => ( + <> + + {category} + + {rows.map((row, idx) => ( + + + + {row.name} + + + {row.units} + + + {row.value} + + + ))} + + + ))} + + + ) + } catch(e) { + console.log("unable to render rows: ") + console.log(e) + } + + } + return ( <> @@ -228,7 +294,17 @@ export default function SingleOutput(props) { - {renderOutputAccordions()} + + + + Category + Variable + Units + Value + + + {renderRows()} +
); } \ No newline at end of file From fd729c65ef089c826da02ac69cd661069dad955c Mon Sep 17 00:00:00 2001 From: MichaelPesce Date: Tue, 13 Aug 2024 08:02:12 -0400 Subject: [PATCH 03/21] add 'smart' algorithm to sort input sections; make them two separate columns --- .../ConfigInput/ConfigInput.js | 109 ++++++++++++++---- 1 file changed, 85 insertions(+), 24 deletions(-) diff --git a/electron/ui/src/views/FlowsheetConfig/ConfigInput/ConfigInput.js b/electron/ui/src/views/FlowsheetConfig/ConfigInput/ConfigInput.js index 9bb983f2..d2de4181 100644 --- a/electron/ui/src/views/FlowsheetConfig/ConfigInput/ConfigInput.js +++ b/electron/ui/src/views/FlowsheetConfig/ConfigInput/ConfigInput.js @@ -229,36 +229,97 @@ export default function ConfigInput(props) { } - //sorting the keys of var_sections by amount of variables into object "items" - let items = Object.keys(var_sections).map(function (key) { - return [key, var_sections[key]['num_variables']]; - }); - items.sort(function (first, second) { - return second[1] - first[1]; - }); - // console.log(items) - return var_sections + // sort the keys of var_sections into two groups that have as close as possible to even amount of total variables + let var_sections_left = {} + let var_sections_right = {} + let total_variables_left = 0 + let total_variables_right = 0 + let next_section = "left" + try { + for (let category of Object.keys(var_sections)) { + let section = var_sections[category] + let input_data = section.input_variables + + // calculate variable amount - fixed variables take up about 45% as much space as free + // if variable is fixed, count it as 1 + // if variable is free, count it as 2 + let variable_amount = 0 + for (let input_variable_key of Object.keys(input_data)) { + let input_variable = input_data[input_variable_key] + if (input_variable.fixed) { + variable_amount += 1 + } + else { + variable_amount += 2 + } + } + + if (next_section === "left") { + total_variables_left+=variable_amount + var_sections_left[category] = section + if (total_variables_left > total_variables_right) next_section = "right" + } + else // if (next_section === "right") + { + total_variables_right+=variable_amount + var_sections_right[category] = section + if (total_variables_right > total_variables_left) next_section = "left" + } + } + } catch(e) { + console.log("error sorting: ") + console.log(e) + } + + return [var_sections_left, var_sections_right] } const renderInputAccordions = () => { try { if (Object.keys(displayData).length > 0) { let var_sections = organizeVariables(displayData.exports) - return Object.entries(var_sections).map(([key, value]) => { - let _key = key + Math.floor(Math.random() * 100001); - if (Object.keys(value.input_variables).length > 0) { - return ( - - ) - } - }) + let var_sections_left = var_sections[0] + let var_sections_right = var_sections[1] + + return + + {Object.entries(var_sections_left).map(([key, value]) => { + let _key = key + Math.floor(Math.random() * 100001); + if (Object.keys(value.input_variables).length > 0) { + return ( + ) + } + })} + + + + + {Object.entries(var_sections_right).map(([key, value]) => { + let _key = key + Math.floor(Math.random() * 100001); + if (Object.keys(value.input_variables).length > 0) { + return ( + ) + } + })} + + + } } catch (e) { // version of data is likely wrong From 77c80c30639d0db3c6b054922e9aa4fb919143ca Mon Sep 17 00:00:00 2001 From: MichaelPesce Date: Tue, 13 Aug 2024 08:05:32 -0400 Subject: [PATCH 04/21] remove unused code; use input category if outputcategory is not there --- .../components/SingleOutput/SingleOutput.js | 98 +------------------ 1 file changed, 1 insertion(+), 97 deletions(-) diff --git a/electron/ui/src/components/SingleOutput/SingleOutput.js b/electron/ui/src/components/SingleOutput/SingleOutput.js index aab81c3d..25042ee8 100644 --- a/electron/ui/src/components/SingleOutput/SingleOutput.js +++ b/electron/ui/src/components/SingleOutput/SingleOutput.js @@ -40,6 +40,7 @@ export default function SingleOutput(props) { for (let key of Object.keys(export_variables)) { let export_variable = export_variables[key] let category = export_variable.output_category + if (!category) category = export_variable.input_category let category_rows if (Object.keys(rows).includes(category)) category_rows = rows[category] else { @@ -117,103 +118,6 @@ export default function SingleOutput(props) { }); } - const renderOutputAccordions = () => { - let var_sections = organizeVariables(outputData.outputData.exports) - // console.log("var_sections",var_sections) - return Object.entries(var_sections).map(([key, value]) => { - let gridSize = 4; - let _key = key + Math.floor(Math.random() * 100001); - if (Object.keys(value.output_variables).length > 0) { - return ( - - }> - {value.display_name} - - - :not(style)': {m: 1}, - }} - autoComplete="off" - > - { - renderFields(value.output_variables) - } - - - - ) - } - else { - return null; - } - }) - }; - - // renders the data in output accordions - const renderFields = (fieldData) => { - // console.log("field data", fieldData) - return Object.keys(fieldData).map((key) => { - let _key = key + Math.floor(Math.random() * 100001); - - // handle rounding - let roundedValue - if (fieldData[key].rounding != null) { - if (fieldData[key].rounding > 0) { - roundedValue = parseFloat((fieldData[key].value).toFixed(fieldData[key].rounding)) - } else if (fieldData[key].rounding === 0) { - roundedValue = Math.round(fieldData[key].value) - } else // if rounding is negative - { - let factor = 1 - let tempRounding = fieldData[key].rounding - console.log('rounding is negative : ', fieldData[key].rounding) - while (tempRounding < 0) { - factor *= 10 - tempRounding += 1 - } - roundedValue = Math.round((fieldData[key].value / factor)) * factor - console.log("old value is: ", fieldData[key].value) - console.log('new value is: ', roundedValue) - } - } else // if rounding is not provided, just use given value - { - roundedValue = fieldData[key].value - } - return (
- {fieldData[key].name + " "} - {roundedValue} - {" " + fieldData[key].display_units} -
) - }) - }; - - const organizeVariables = (bvars) => { - let var_sections = {} - for (const [key, v] of Object.entries(bvars)) { - let catg = v.output_category - let is_input = v.is_input - let is_output = v.is_output - if (catg === null) { - catg = "" - } - if (!Object.hasOwn(var_sections, catg)) { - var_sections[catg] = { - display_name: catg, - variables: {}, - input_variables: {}, - output_variables: {} - } - } - var_sections[catg]["variables"][key] = v - if (is_input) var_sections[catg]["input_variables"][key] = v; - if (is_output) var_sections[catg]["output_variables"][key] = v - } - return var_sections - } - const renderRows = () => { try { return ( From 7c1a69cdfd76b8480bc83fcdb3096167eb5a5149 Mon Sep 17 00:00:00 2001 From: MichaelPesce Date: Tue, 13 Aug 2024 08:11:55 -0400 Subject: [PATCH 05/21] round and right align values in output --- .../components/SingleOutput/SingleOutput.js | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/electron/ui/src/components/SingleOutput/SingleOutput.js b/electron/ui/src/components/SingleOutput/SingleOutput.js index 25042ee8..4a851d76 100644 --- a/electron/ui/src/components/SingleOutput/SingleOutput.js +++ b/electron/ui/src/components/SingleOutput/SingleOutput.js @@ -1,13 +1,9 @@ -import React, {useState, useEffect} from "react"; +import React, {useState, useEffect, Fragment} from "react"; import {useParams} from "react-router-dom"; // MUI imports -import Accordion from "@mui/material/Accordion"; -import AccordionDetails from "@mui/material/AccordionDetails"; -import AccordionSummary from "@mui/material/AccordionSummary"; import Box from "@mui/material/Box"; import Button from "@mui/material/Button"; import DownloadIcon from '@mui/icons-material/Download'; -import ExpandMoreIcon from "@mui/icons-material/ExpandMore"; import Grid from "@mui/material/Grid"; import Modal from "@mui/material/Modal"; import SaveIcon from '@mui/icons-material/Save'; @@ -46,12 +42,13 @@ export default function SingleOutput(props) { else { category_rows = [] rows[category] = category_rows - } + } category_rows.push({ key: key, name: export_variable.name, value: export_variable.value, - units: export_variable.display_units + units: export_variable.display_units, + rounding: export_variable.rounding || 2 }) } setOutputTableData(rows) @@ -123,7 +120,7 @@ export default function SingleOutput(props) { return ( {Object.entries(outputTableData).map(([category, rows]) => ( - <> + {category} @@ -136,13 +133,14 @@ export default function SingleOutput(props) { {row.units} - - {row.value} + + {row.value.toLocaleString('en-US', {maximumFractionDigits:row.rounding})} + {/* {row.value} */} ))} - + ))} @@ -204,7 +202,7 @@ export default function SingleOutput(props) { Category Variable Units - Value + Value {renderRows()} From 400baa2ddf2189bfcdc460a1fb67aeceb2520fec Mon Sep 17 00:00:00 2001 From: MichaelPesce Date: Thu, 15 Aug 2024 08:24:52 -0400 Subject: [PATCH 06/21] add disabled color for run button in theme --- electron/ui/src/theme.js | 15 ++++++++++++--- .../FlowsheetConfig/ConfigInput/ConfigInput.js | 3 +-- .../src/views/FlowsheetConfig/FlowsheetConfig.js | 5 +---- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/electron/ui/src/theme.js b/electron/ui/src/theme.js index 52621142..404e4947 100644 --- a/electron/ui/src/theme.js +++ b/electron/ui/src/theme.js @@ -34,7 +34,10 @@ export const themes = { color: '#FFFFFF', background: '#67C3E4', logoBackground: '#F2F7F8' }, button: { - background: '#1976d2' + background: '#1976d2', + "&.Mui-disabled": { + background: '#E0E0E0' + } }, tabs: { background: '#F1F3F3', color: '#727272' @@ -62,7 +65,10 @@ export const themes = { color: '#000000', background: '#F6F4F4', logoBackground: '#F8F6F6' }, button: { - background: '#1669B6' + background: '#1669B6', + "&.Mui-disabled": { + background: '#E0E0E0' + } }, tabs: { background: '#F6F4F4', color: '#727272' @@ -87,7 +93,10 @@ export const themes = { color: '#FFFFFF', background: '#000000', logoBackground: '#333333' // FIXME? }, button: { - background: '#1669B6' + background: '#1669B6', + "&.Mui-disabled": { + background: '#E0E0E0' + } }, tabs: { background: '#F1F3F3', color: '#727272' diff --git a/electron/ui/src/views/FlowsheetConfig/ConfigInput/ConfigInput.js b/electron/ui/src/views/FlowsheetConfig/ConfigInput/ConfigInput.js index d2de4181..a2283e20 100644 --- a/electron/ui/src/views/FlowsheetConfig/ConfigInput/ConfigInput.js +++ b/electron/ui/src/views/FlowsheetConfig/ConfigInput/ConfigInput.js @@ -482,13 +482,12 @@ const RunButton = forwardRef(({...props}, ref) => { checkDisableRun })); - return (
diff --git a/electron/ui/src/views/FlowsheetConfig/FlowsheetConfig.js b/electron/ui/src/views/FlowsheetConfig/FlowsheetConfig.js index 11ec6f05..ef915f09 100644 --- a/electron/ui/src/views/FlowsheetConfig/FlowsheetConfig.js +++ b/electron/ui/src/views/FlowsheetConfig/FlowsheetConfig.js @@ -371,10 +371,7 @@ export default function FlowsheetConfig(props) { -
+
Date: Fri, 16 Aug 2024 07:46:38 -0400 Subject: [PATCH 07/21] use theme provider to handle button colors --- electron/ui/src/App.js | 25 ++++++++++++++----- electron/ui/src/theme.js | 11 +------- .../ConfigInput/ConfigInput.js | 1 - 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/electron/ui/src/App.js b/electron/ui/src/App.js index dcdb9a35..a78ab8e2 100644 --- a/electron/ui/src/App.js +++ b/electron/ui/src/App.js @@ -11,6 +11,8 @@ import {getProjectName} from './services/projectName.service'; import MainContent from "./components/MainContent/MainContent"; import WaitForProject from "./components/WaitForProject/WaitForProject"; import {themes} from './theme'; +import { ThemeProvider, createTheme } from '@mui/material/styles'; + function App() { let navigate = useNavigate(); @@ -21,6 +23,14 @@ function App() { const [checkAgain, setCheckAgain] = useState(1) const WAIT_TIME = 2 + const mui_theme = createTheme({ + palette: { + primary: { + main: theme?.button.background, + }, + }, + }); + useEffect(() => { if (hasTheme && checkAgain !== 0) { @@ -43,12 +53,15 @@ function App() { const subProcState = {value: numberOfSubprocesses, setValue: setNumberOfSubprocesses} return ( -
- - - -
+ + +
+ + + +
+
) } diff --git a/electron/ui/src/theme.js b/electron/ui/src/theme.js index b38213d8..287312e7 100644 --- a/electron/ui/src/theme.js +++ b/electron/ui/src/theme.js @@ -35,9 +35,6 @@ export const themes = { }, button: { background: '#1976d2', - "&.Mui-disabled": { - background: '#E0E0E0' - } }, tabs: { background: '#F1F3F3', color: '#727272' @@ -66,9 +63,6 @@ export const themes = { }, button: { background: '#1669B6', - "&.Mui-disabled": { - background: '#E0E0E0' - } }, tabs: { background: '#F6F4F4', color: '#727272' @@ -93,10 +87,7 @@ export const themes = { color: '#FFFFFF', background: '#000000', logoBackground: '#333333' // FIXME? }, button: { - background: '#1669B6', - "&.Mui-disabled": { - background: '#E0E0E0' - } + background: '#333333', }, tabs: { background: '#F1F3F3', color: '#727272' diff --git a/electron/ui/src/views/FlowsheetConfig/ConfigInput/ConfigInput.js b/electron/ui/src/views/FlowsheetConfig/ConfigInput/ConfigInput.js index a2283e20..392bbb77 100644 --- a/electron/ui/src/views/FlowsheetConfig/ConfigInput/ConfigInput.js +++ b/electron/ui/src/views/FlowsheetConfig/ConfigInput/ConfigInput.js @@ -487,7 +487,6 @@ const RunButton = forwardRef(({...props}, ref) => { title={disableRun ? "To run a sweep, at least one variable must be set to sweep" : ""}>
From 8903788fb5960235be4c46b68c61c9dd28e41f91 Mon Sep 17 00:00:00 2001 From: MichaelPesce Date: Fri, 16 Aug 2024 07:47:40 -0400 Subject: [PATCH 08/21] add key to table row --- electron/ui/src/components/SingleOutput/SingleOutput.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/electron/ui/src/components/SingleOutput/SingleOutput.js b/electron/ui/src/components/SingleOutput/SingleOutput.js index 4a851d76..b8603ecc 100644 --- a/electron/ui/src/components/SingleOutput/SingleOutput.js +++ b/electron/ui/src/components/SingleOutput/SingleOutput.js @@ -126,7 +126,7 @@ export default function SingleOutput(props) { {rows.map((row, idx) => ( - + {row.name} From 36ebaee711765ae8a474ff7d8db7909ec5a803aa Mon Sep 17 00:00:00 2001 From: MichaelPesce Date: Fri, 16 Aug 2024 09:35:07 -0400 Subject: [PATCH 09/21] try using separate job for checkout, conda incubator --- .github/workflows/main.yml | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d54827ab..ff525d22 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,24 +16,19 @@ env: PYTEST_ADDOPTS: --color=yes jobs: - component_e2e_testing: - name: E2E testing (${{ matrix.os }}) - + prepare-environment: runs-on: ${{ matrix.os-version }} - strategy: fail-fast: false matrix: os: - linux - win64 - # - macos include: - os: linux os-version: ubuntu-latest - os: win64 os-version: windows-latest - steps: - uses: actions/checkout@v4 - uses: conda-incubator/setup-miniconda@v3 @@ -42,6 +37,31 @@ jobs: activate-environment: watertap-ui-env miniforge-version: latest + component_e2e_testing: + name: E2E testing (${{ matrix.os }}) + + runs-on: ${{ matrix.os-version }} + needs: prepare-environment + strategy: + fail-fast: false + matrix: + os: + - linux + - win64 + include: + - os: linux + os-version: ubuntu-latest + - os: win64 + os-version: windows-latest + + steps: + # - uses: actions/checkout@v4 + # - uses: conda-incubator/setup-miniconda@v3 + # with: + # environment-file: environment.yml + # activate-environment: watertap-ui-env + # miniforge-version: latest + - name: Add theme to .env file working-directory: ./electron/ui run: | From 945788bf452f559c5f98a3492585f4f8282ae905 Mon Sep 17 00:00:00 2001 From: MichaelPesce Date: Fri, 16 Aug 2024 09:44:45 -0400 Subject: [PATCH 10/21] undo that --- .github/workflows/main.yml | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ff525d22..7fabe0d7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,7 +16,9 @@ env: PYTEST_ADDOPTS: --color=yes jobs: - prepare-environment: + component_e2e_testing: + name: E2E testing (${{ matrix.os }}) + runs-on: ${{ matrix.os-version }} strategy: fail-fast: false @@ -29,6 +31,7 @@ jobs: os-version: ubuntu-latest - os: win64 os-version: windows-latest + steps: - uses: actions/checkout@v4 - uses: conda-incubator/setup-miniconda@v3 @@ -37,31 +40,6 @@ jobs: activate-environment: watertap-ui-env miniforge-version: latest - component_e2e_testing: - name: E2E testing (${{ matrix.os }}) - - runs-on: ${{ matrix.os-version }} - needs: prepare-environment - strategy: - fail-fast: false - matrix: - os: - - linux - - win64 - include: - - os: linux - os-version: ubuntu-latest - - os: win64 - os-version: windows-latest - - steps: - # - uses: actions/checkout@v4 - # - uses: conda-incubator/setup-miniconda@v3 - # with: - # environment-file: environment.yml - # activate-environment: watertap-ui-env - # miniforge-version: latest - - name: Add theme to .env file working-directory: ./electron/ui run: | From 0568fac60e547ff59338e55fd37ac0fe3ef0fc21 Mon Sep 17 00:00:00 2001 From: MichaelPesce Date: Fri, 16 Aug 2024 09:46:29 -0400 Subject: [PATCH 11/21] add debugging --- .github/workflows/main.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7fabe0d7..2fdb5700 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -40,6 +40,11 @@ jobs: activate-environment: watertap-ui-env miniforge-version: latest + - name: Set up debug logging + run: | + echo "ACTIONS_RUNNER_DEBUG=true" >> $GITHUB_ENV + echo "ACTIONS_STEP_DEBUG=true" >> $GITHUB_ENV + - name: Add theme to .env file working-directory: ./electron/ui run: | From 859d3d078ff68890e0efefbf8b2472ae5162c370 Mon Sep 17 00:00:00 2001 From: MichaelPesce Date: Fri, 16 Aug 2024 10:03:54 -0400 Subject: [PATCH 12/21] add performance logging --- .github/workflows/main.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2fdb5700..60882ac6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -45,6 +45,13 @@ jobs: echo "ACTIONS_RUNNER_DEBUG=true" >> $GITHUB_ENV echo "ACTIONS_STEP_DEBUG=true" >> $GITHUB_ENV + - name: Set up performance monitoring (Windows) + if: runner.os == 'Windows' + run: | + logman create counter "MyPerfLog" -f bincirc -max 50 -c "\Processor(_Total)\% Processor Time" "\Memory\Available MBytes" -si 10 -o perf_log + logman start "MyPerfLog" + shell: pwsh + - name: Add theme to .env file working-directory: ./electron/ui run: | @@ -121,6 +128,13 @@ jobs: } shell: pwsh + - name: Stop performance monitoring and upload logs (Windows) + if: runner.os == 'Windows' + run: | + logman stop "MyPerfLog" + Compress-Archive -Path perf_log.blg -DestinationPath perf_log.zip + shell: pwsh + - name: Upload artifact for screenshots & videos uses: actions/upload-artifact@v4 if: always() @@ -130,6 +144,13 @@ jobs: electron/ui/cypress/screenshots/ electron/ui/cypress/videos/ + - name: Upload Performance Logs + if: runner.os == 'Windows' && always() + uses: actions/upload-artifact@v4 + with: + name: performance-logs-${{ matrix.os }} + path: perf_log.zip + pytest: name: pytest (${{ matrix.os }}) runs-on: ${{ matrix.os-version }} From ba16c7ebe464fb6b3261273e0b3b207767f04554 Mon Sep 17 00:00:00 2001 From: MichaelPesce Date: Fri, 16 Aug 2024 16:02:18 -0400 Subject: [PATCH 13/21] add .blg --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 60882ac6..e76669cd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -48,7 +48,7 @@ jobs: - name: Set up performance monitoring (Windows) if: runner.os == 'Windows' run: | - logman create counter "MyPerfLog" -f bincirc -max 50 -c "\Processor(_Total)\% Processor Time" "\Memory\Available MBytes" -si 10 -o perf_log + logman create counter "MyPerfLog" -f bincirc -max 50 -c "\Processor(_Total)\% Processor Time" "\Memory\Available MBytes" -si 10 -o perf_log.blg logman start "MyPerfLog" shell: pwsh From 18443932f052b14cbf2fbd8c546813ad3e4c6eef Mon Sep 17 00:00:00 2001 From: MichaelPesce Date: Mon, 19 Aug 2024 07:32:19 -0400 Subject: [PATCH 14/21] remove performance logging from workflow --- .github/workflows/main.yml | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e76669cd..2fdb5700 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -45,13 +45,6 @@ jobs: echo "ACTIONS_RUNNER_DEBUG=true" >> $GITHUB_ENV echo "ACTIONS_STEP_DEBUG=true" >> $GITHUB_ENV - - name: Set up performance monitoring (Windows) - if: runner.os == 'Windows' - run: | - logman create counter "MyPerfLog" -f bincirc -max 50 -c "\Processor(_Total)\% Processor Time" "\Memory\Available MBytes" -si 10 -o perf_log.blg - logman start "MyPerfLog" - shell: pwsh - - name: Add theme to .env file working-directory: ./electron/ui run: | @@ -128,13 +121,6 @@ jobs: } shell: pwsh - - name: Stop performance monitoring and upload logs (Windows) - if: runner.os == 'Windows' - run: | - logman stop "MyPerfLog" - Compress-Archive -Path perf_log.blg -DestinationPath perf_log.zip - shell: pwsh - - name: Upload artifact for screenshots & videos uses: actions/upload-artifact@v4 if: always() @@ -144,13 +130,6 @@ jobs: electron/ui/cypress/screenshots/ electron/ui/cypress/videos/ - - name: Upload Performance Logs - if: runner.os == 'Windows' && always() - uses: actions/upload-artifact@v4 - with: - name: performance-logs-${{ matrix.os }} - path: perf_log.zip - pytest: name: pytest (${{ matrix.os }}) runs-on: ${{ matrix.os-version }} From 35f411f6b1188e318d4648a571bc078d67557400 Mon Sep 17 00:00:00 2001 From: MichaelPesce Date: Thu, 5 Sep 2024 10:41:19 -0400 Subject: [PATCH 15/21] rename cache at the end of run for windows --- .github/workflows/main.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2fdb5700..235b41c6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -130,6 +130,13 @@ jobs: electron/ui/cypress/screenshots/ electron/ui/cypress/videos/ + ## post-run conda often fails for weird reasons. this is a potential solution + ## see https://github.com/conda-incubator/setup-miniconda/issues/277#issuecomment-1431458277 + - name: Rename conda package cache + if: runner.os == 'Windows' + shell: bash + run: mv "${CONDA_PKGS_DIR}" "${CONDA_PKGS_DIR}_do_not_cache" + pytest: name: pytest (${{ matrix.os }}) runs-on: ${{ matrix.os-version }} From f75848f847db526f2d5f1e1bd42f4d51d87836af Mon Sep 17 00:00:00 2001 From: MichaelPesce Date: Fri, 20 Sep 2024 07:22:43 -0400 Subject: [PATCH 16/21] add styling to output table - bold, outlines --- electron/ui/src/components/Graph/Graph.js | 1 - .../components/SingleOutput/SingleOutput.js | 34 ++++++++++++------- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/electron/ui/src/components/Graph/Graph.js b/electron/ui/src/components/Graph/Graph.js index 424e63fe..31d04a97 100644 --- a/electron/ui/src/components/Graph/Graph.js +++ b/electron/ui/src/components/Graph/Graph.js @@ -19,7 +19,6 @@ export default function Graph() { setGraphImage(URL.createObjectURL(data)) } else { - console.log("data.size is 0") if (tryAgain) setTryAgain(false) } }).catch((err)=>{ diff --git a/electron/ui/src/components/SingleOutput/SingleOutput.js b/electron/ui/src/components/SingleOutput/SingleOutput.js index b8603ecc..5b1b9d94 100644 --- a/electron/ui/src/components/SingleOutput/SingleOutput.js +++ b/electron/ui/src/components/SingleOutput/SingleOutput.js @@ -18,6 +18,7 @@ import { TableHead, TableRow, } from '@mui/material' +import Paper from '@mui/material/Paper'; export default function SingleOutput(props) { let params = useParams(); @@ -122,7 +123,12 @@ export default function SingleOutput(props) { {Object.entries(outputTableData).map(([category, rows]) => ( - {category} + + {category} + {rows.map((row, idx) => ( @@ -196,17 +202,21 @@ export default function SingleOutput(props) { - - - - Category - Variable - Units - Value - - - {renderRows()} -
+ + + + + + Category + Variable + Units + Value + + + {renderRows()} +
+
+
); } \ No newline at end of file From eb7313edde5c7b8f1bfed6b7a55317a095f7a14d Mon Sep 17 00:00:00 2001 From: MichaelPesce Date: Fri, 27 Sep 2024 03:36:22 -0400 Subject: [PATCH 17/21] realign table columns --- .../src/components/SingleOutput/SingleOutput.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/electron/ui/src/components/SingleOutput/SingleOutput.js b/electron/ui/src/components/SingleOutput/SingleOutput.js index 5b1b9d94..cca64754 100644 --- a/electron/ui/src/components/SingleOutput/SingleOutput.js +++ b/electron/ui/src/components/SingleOutput/SingleOutput.js @@ -133,16 +133,16 @@ export default function SingleOutput(props) { {rows.map((row, idx) => ( - + {row.name} - - {row.units} - - + {row.value.toLocaleString('en-US', {maximumFractionDigits:row.rounding})} {/* {row.value} */} + + {row.units} + ))} @@ -208,9 +208,9 @@ export default function SingleOutput(props) { Category - Variable - Units - Value + Variable + Value + Units {renderRows()} From b29d20e7b66a213918b815d705d8df9123bb17f1 Mon Sep 17 00:00:00 2001 From: MichaelPesce Date: Thu, 3 Oct 2024 09:01:26 -0400 Subject: [PATCH 18/21] expand comment on organizing variables function --- .../src/views/FlowsheetConfig/ConfigInput/ConfigInput.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/electron/ui/src/views/FlowsheetConfig/ConfigInput/ConfigInput.js b/electron/ui/src/views/FlowsheetConfig/ConfigInput/ConfigInput.js index 8ad6542e..32671306 100644 --- a/electron/ui/src/views/FlowsheetConfig/ConfigInput/ConfigInput.js +++ b/electron/ui/src/views/FlowsheetConfig/ConfigInput/ConfigInput.js @@ -179,7 +179,7 @@ export default function ConfigInput(props) { /** * Organize variables into sections by their 'category' attribute. * - * @returns Object {: [list, of, variable, objects]} + * @returns [Object(left) {: [list, of, variable, objects]}, Object(right) {: [list, of, variable, objects]}] */ const organizeVariables = (bvars) => { let var_sections = {} @@ -234,7 +234,10 @@ export default function ConfigInput(props) { } - // sort the keys of var_sections into two groups that have as close as possible to even amount of total variables + /** + * sort the keys of var_sections into two groups that have as close as possible to even amount of total variables + * we want the two columns to be roughly the same length if possible + **/ let var_sections_left = {} let var_sections_right = {} let total_variables_left = 0 From 3e3911d167b3491880457d30bfb8cac1bff74ce9 Mon Sep 17 00:00:00 2001 From: MichaelPesce Date: Thu, 3 Oct 2024 09:04:01 -0400 Subject: [PATCH 19/21] add comment for mui theme --- electron/ui/src/App.js | 1 + 1 file changed, 1 insertion(+) diff --git a/electron/ui/src/App.js b/electron/ui/src/App.js index a78ab8e2..fb4d376b 100644 --- a/electron/ui/src/App.js +++ b/electron/ui/src/App.js @@ -23,6 +23,7 @@ function App() { const [checkAgain, setCheckAgain] = useState(1) const WAIT_TIME = 2 + // use Material UI theme for styles to be consistent throughout app const mui_theme = createTheme({ palette: { primary: { From c0be5056b210cfefbe2a1ef5bbb47980a3850f51 Mon Sep 17 00:00:00 2001 From: MichaelPesce Date: Thu, 3 Oct 2024 09:04:10 -0400 Subject: [PATCH 20/21] add comment above useeffect --- electron/ui/src/components/SingleOutput/SingleOutput.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/electron/ui/src/components/SingleOutput/SingleOutput.js b/electron/ui/src/components/SingleOutput/SingleOutput.js index cca64754..0e97b469 100644 --- a/electron/ui/src/components/SingleOutput/SingleOutput.js +++ b/electron/ui/src/components/SingleOutput/SingleOutput.js @@ -31,6 +31,9 @@ export default function SingleOutput(props) { const handleOpenSaveConfig = () => setOpenSaveConfig(true); const handleCloseSaveConfig = () => setOpenSaveConfig(false); + /** + * organize output data into a list of dictionaries formatted for the output table + */ useEffect(()=> { let export_variables = {...outputData.outputData.exports} let rows = {} From 40cd4972db55d2813b724e4c95b9a43dde525be5 Mon Sep 17 00:00:00 2001 From: MichaelPesce Date: Thu, 3 Oct 2024 09:05:49 -0400 Subject: [PATCH 21/21] add comment explaining render rows --- electron/ui/src/components/SingleOutput/SingleOutput.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/electron/ui/src/components/SingleOutput/SingleOutput.js b/electron/ui/src/components/SingleOutput/SingleOutput.js index 0e97b469..496a06f8 100644 --- a/electron/ui/src/components/SingleOutput/SingleOutput.js +++ b/electron/ui/src/components/SingleOutput/SingleOutput.js @@ -119,6 +119,10 @@ export default function SingleOutput(props) { }); } + /** + * generate html for table + * @returns table body component containing table rows + */ const renderRows = () => { try { return ( @@ -141,7 +145,6 @@ export default function SingleOutput(props) { {row.value.toLocaleString('en-US', {maximumFractionDigits:row.rounding})} - {/* {row.value} */} {row.units}