Skip to content

Commit

Permalink
Merge pull request watertap-org#19 from watertap-org/UI-fix-0627
Browse files Browse the repository at this point in the history
put treatment and feed on top and disable output tab if no output data
  • Loading branch information
dangunter authored Jun 27, 2022
2 parents 049063f + c3f5a2b commit 733b036
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 6 deletions.
2 changes: 1 addition & 1 deletion electron/ui/src/components/InputWrapper/InputWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default function InputWrapper(props) {
// replace USD currency with simple '$'
u = u.replace(/USD_[^/]*/, "$")
u = u.replace(/USD/, "$")
console.log("displayUnits:", u)
//console.log("displayUnits:", u)
return {__html: u}
}

Expand Down
36 changes: 32 additions & 4 deletions electron/ui/src/views/FlowsheetConfig/ConfigInput/ConfigInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,35 @@ export default function ConfigInput(props) {
console.debug("calling extractVariables with root block:", flowsheetData.blocks.fs)
let variables = extractVariables(flowsheetData.blocks.fs)
let var_sections = organizeVariables(variables)
console.debug("var_sections:", var_sections)
console.log("var_sections:", var_sections);

//sort sections, put treatment and feed first
let sortedSectionKeys = [];
console.log("1sortedSectionKeys::",sortedSectionKeys);
for(let key of Object.keys(var_sections))
{
if(key.toLowerCase() === "feed")
{
sortedSectionKeys.unshift(key)
}
}
for(let key of Object.keys(var_sections))
{
if(key.toLowerCase() === "treatment specification")
{
sortedSectionKeys.unshift(key)
}
}
for(let key of Object.keys(var_sections))
{
if(key.toLowerCase() !== "feed" && key.toLowerCase() !== "treatment specification")
{
sortedSectionKeys.push(key)
}
}
console.log("2sortedSectionKeys::",sortedSectionKeys);
// let sectionBlocks = flowsheetData.blocks.fs.blocks
return Object.keys(var_sections).map((key)=>{
return sortedSectionKeys.map((key)=>{
let _key = key + Math.floor(Math.random() * 100001);
return (<Grid item xs={6} key={_key}>
<InputAccordion dataKey={key} data={var_sections[key]}></InputAccordion>
Expand Down Expand Up @@ -160,13 +186,15 @@ export default function ConfigInput(props) {

<Grid container spacing={2}>
<Grid item xs={6}>
{
{ /*
Object.keys(costingBlocks).map((key)=><InputAccordion key={key} dataKey={key} data={costingBlocks[key]}></InputAccordion>)
*/
}
</Grid>
<Grid item xs={6}>
{
{ /*
Object.keys(parametersBlocks).map((key)=><InputAccordion key={key} dataKey={key} data={parametersBlocks[key]}></InputAccordion>)
*/
}
</Grid>
</Grid>
Expand Down
2 changes: 1 addition & 1 deletion electron/ui/src/views/FlowsheetConfig/FlowsheetConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export default function FlowsheetConfig() {
<Box sx={{ width: '100%', border: '0px solid #ddd' }}>
<Tabs value={tabValue} onChange={handleTabChange} aria-label="basic tabs example">
<Tab label="Input" {...a11yProps(0)} />
<Tab label="Output" {...a11yProps(1)} />
<Tab label="Output" disabled={!outputData} {...a11yProps(1)} />
</Tabs>
<TabPanel value={tabValue} index={0}>
<ConfigInput flowsheetData={flowsheetData}
Expand Down

0 comments on commit 733b036

Please sign in to comment.