Skip to content

Commit

Permalink
Merge pull request #46 from MichaelPesce/build
Browse files Browse the repository at this point in the history
0.9.0rc0 build updates
  • Loading branch information
MichaelPesce authored Oct 17, 2023
2 parents b9f03bd + b693db0 commit 25a227d
Show file tree
Hide file tree
Showing 19 changed files with 255 additions and 62 deletions.
19 changes: 13 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: App build
on:
push:
branches:
- "september-updates"
- "build"

defaults:
run:
Expand Down Expand Up @@ -45,11 +45,15 @@ jobs:

# - name: Install Pareto locally
# working-directory: ../
# run: git clone https://github.com/MichaelPesce/project-pareto.git && cd project-pareto && git fetch --all && git checkout 0.5.0_release && pip install --progress-bar off .
# run: git clone https://github.com/MichaelPesce/project-pareto.git && cd project-pareto && pip install --progress-bar off .

- name: Install Pareto locally
working-directory: ../
run: git clone https://github.com/project-pareto/project-pareto.git && cd project-pareto && git fetch --all --tags && git checkout 0.8.0 && pip install --progress-bar off .
run: git clone https://github.com/project-pareto/project-pareto.git && cd project-pareto && git fetch --all --tags && git checkout 0.9.0rc0 && pip install --progress-bar off .

- name: Install numpy 1.24.3
run: |
pip uninstall -y numpy && pip install numpy==1.24.3
- name: Build Backend
run: npm --prefix electron run build-backend
Expand All @@ -60,17 +64,20 @@ jobs:
- name: Build Windows Distribution
run: npm --prefix electron run electron-build-win

- name: Display file names
run: cd electron && cd dist && ls

- name: Sign Windows Distribution
run: |
AzureSignTool sign -kvu "${{ secrets.AZURE_KEY_VAULT_URI }}" -kvi "${{ secrets.AZURE_CLIENT_ID }}" -kvt "${{ secrets.AZURE_TENANT_ID }}" -kvs "${{ secrets.AZURE_CLIENT_SECRET }}" -kvc ${{ secrets.AZURE_CERT_NAME }} -tr http://timestamp.digicert.com -v electron/dist/ParetoUI-09.19.23-win64.exe
AzureSignTool sign -kvu "${{ secrets.AZURE_KEY_VAULT_URI }}" -kvi "${{ secrets.AZURE_CLIENT_ID }}" -kvt "${{ secrets.AZURE_TENANT_ID }}" -kvs "${{ secrets.AZURE_CLIENT_SECRET }}" -kvc ${{ secrets.AZURE_CERT_NAME }} -tr http://timestamp.digicert.com -v electron/dist/ParetoUI-23.10.06-win64.exe
- name: Upload artifact for windows build
uses: actions/upload-artifact@v3
if: always()
with:
name: windows-pareto-dist
path: |
electron/dist/ParetoUI-09.19.23-win64.exe
electron/dist/ParetoUI-23.10.06-win64.exe
# windows-build:
# name: Windows Build

Expand Down Expand Up @@ -119,4 +126,4 @@ jobs:
# with:
# name: windows-pareto-dist
# path: |
# electron/dist/ParetoUI-09.19.23-win64.exe
# electron/dist/ParetoUI-23.10.06-win64.exe
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pip uninstall -y numpy pandas
Install arm64 versions of numpy and pandas:

```sh
conda install -y -c conda-forge/osx-arm64 numpy pandas=1.5.3
conda install -y -c conda-forge/osx-arm64 numpy pandas=1.4.0
```


Expand Down
8 changes: 8 additions & 0 deletions backend/app/extra-hooks/hook-pareto.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,12 @@
datas.append(('internal/assets/DisposalOverrideInput.png', 'app/internal/assets'))
datas.append(('internal/assets/SRAInput.png', 'app/internal/assets'))

# add workshop pngs
datas.append(('internal/assets/workshop_baseline_input.png', 'app/internal/assets'))
datas.append(('internal/assets/workshop_baseline_output.png', 'app/internal/assets'))
datas.append(('internal/assets/workshop_SRA_input.png', 'app/internal/assets'))
datas.append(('internal/assets/workshop_SRA_output.png', 'app/internal/assets'))
datas.append(('internal/assets/workshop_beneficial_reuse_input.png', 'app/internal/assets'))
datas.append(('internal/assets/workshop_beneficial_reuse_output.png', 'app/internal/assets'))

print(datas)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 36 additions & 10 deletions backend/app/internal/scenario_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,24 @@ def update_scenario(self, updatedScenario):
new_input_diagram_path = f"{self.input_diagrams_path}/{id_}.{input_diagramFileType}"
shutil.copyfile(original_input_diagram_path, new_input_diagram_path)
updatedScenario[f'inputDiagramExtension'] = 'png'
if newName.upper() == "WORKSHOP BASELINE" and oldName.upper() != "WORKSHOP BASELINE":
input_diagramFileType = 'png'
original_input_diagram_path = f'{os.path.dirname(os.path.abspath(__file__))}/assets/workshop_baseline_input.png'
new_input_diagram_path = f"{self.input_diagrams_path}/{id_}.{input_diagramFileType}"
shutil.copyfile(original_input_diagram_path, new_input_diagram_path)
updatedScenario[f'inputDiagramExtension'] = 'png'
if newName.upper() == "WORKSHOP SRA" and oldName.upper() != "WORKSHOP SRA":
input_diagramFileType = 'png'
original_input_diagram_path = f'{os.path.dirname(os.path.abspath(__file__))}/assets/workshop_SRA_input.png'
new_input_diagram_path = f"{self.input_diagrams_path}/{id_}.{input_diagramFileType}"
shutil.copyfile(original_input_diagram_path, new_input_diagram_path)
updatedScenario[f'inputDiagramExtension'] = 'png'
if newName.upper() == "WORKSHOP BENEFICIAL REUSE" and oldName.upper() != "WORKSHOP BENEFICIAL REUSE":
input_diagramFileType = 'png'
original_input_diagram_path = f'{os.path.dirname(os.path.abspath(__file__))}/assets/workshop_beneficial_reuse_input.png'
new_input_diagram_path = f"{self.input_diagrams_path}/{id_}.{input_diagramFileType}"
shutil.copyfile(original_input_diagram_path, new_input_diagram_path)
updatedScenario[f'inputDiagramExtension'] = 'png'
except:
_log.error('unable to check and/or replace input diagram for SRA')

Expand Down Expand Up @@ -264,15 +282,21 @@ def check_for_diagram(self, id, filename = None):
diagramIdentifier = scenario['name']
scenario_diagram_path = f"{self.output_diagrams_path}/{id}.{extension}"
try:
diagram_path = files('pareto').parent.joinpath(f"docs/img/{diagramIdentifier}.{extension}")
if scenario['name'].upper() == "WORKSHOP BASELINE":
diagram_path = f'{os.path.dirname(os.path.abspath(__file__))}/assets/workshop_baseline_{diagramType}.png'
elif scenario['name'].upper() == "WORKSHOP SRA":
diagram_path = f'{os.path.dirname(os.path.abspath(__file__))}/assets/workshop_sra_{diagramType}.png'
elif scenario['name'].upper() == "WORKSHOP BENEFICIAL REUSE":
diagram_path = f'{os.path.dirname(os.path.abspath(__file__))}/assets/workshop_beneficial_reuse_{diagramType}.png'
else:
diagram_path = files('pareto').parent.joinpath(f"docs/img/{diagramIdentifier}.{extension}")
_log.info(f'diagram_path is : {diagram_path}')
shutil.copyfile(diagram_path, scenario_diagram_path)
scenario[f"{diagramType}DiagramExtension"] = extension
return self.update_scenario(scenario)
except Exception as e:
_log.info(f'unable to find diagram_path: {e}')
return scenario



def copy_scenario(self, id, new_scenario_name):
Expand Down Expand Up @@ -523,6 +547,7 @@ def update_excel(self, id, table_key, updatedTable):
# for column in scenario["data_input"]["df_parameters"][table_key]:

# update excel sheet
_log.info(f'updating table: {updatedTable}')
for column in updatedTable:
y = 3
for cellValue in updatedTable[column]:
Expand All @@ -531,15 +556,16 @@ def update_excel(self, id, table_key, updatedTable):
if cellValue == "":
newValue = None
else:
try:
newValue = int(cellValue)
except ValueError:
try:
newValue = float(cellValue)
except:
newValue = cellValue
newValue = cellValue
# try:
# newValue = int(cellValue)
# except ValueError:
# try:
# newValue = float(cellValue)
# except:
# newValue = cellValue
if originalValue != newValue:
print('updating value')
# print('updating value')
ws[cellLocation] = newValue
y+=1
x+=1
Expand Down
11 changes: 6 additions & 5 deletions electron/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pareto-ui",
"version": "09.19.23",
"version": "23.10.06",
"author": "Michael Pesce",
"private": true,
"main": "build/main.js",
Expand Down Expand Up @@ -74,10 +74,10 @@
"nsis": {
"oneClick": false,
"allowToChangeInstallationDirectory": true,
"artifactName": "ParetoUI-09.19.23-win64.exe"
"artifactName": "ParetoUI-23.10.06-win64.exe"
},
"dmg": {
"artifactName": "ParetoUI-09.19.23-arm64.dmg"
"artifactName": "ParetoUI-23.10.06-arm64.dmg"
},
"deb": {
"depends": [
Expand All @@ -86,7 +86,7 @@
"liblapack3",
"libblas3"
],
"artifactName": "ParetoUI-09.19.23-amd64.deb"
"artifactName": "ParetoUI-23.10.06-amd64.deb"
},
"directories": {
"buildResources": "assets"
Expand All @@ -105,7 +105,8 @@
},
"win": {
"target": "nsis",
"icon": "build/pareto-logo.ico"
"icon": "build/pareto-logo.ico",
"artifactName": "ParetoUI-23.10.06-win64.exe"
},
"linux": {
"target": "Deb",
Expand Down
6 changes: 6 additions & 0 deletions electron/ui/src/assets/CategoryNames.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
"v_S_DisposalCapacity_dict":"Slack Disposal Capacity",
"v_S_TreatmentCapacity_dict":"Slack reatment Capacity",
"v_S_ReuseCapacity_dict":"Slack Reuse Capacity",
"v_S_BeneficialReuseCapacity_dict": "Slack Beneficial Reuse Capacity",
"hydraulics.v_PumpHead_dict": "Hydraulics Pump Head",
"hydraulics.vb_Y_Pump_dict": "Hydraulics New Pump",
"hydraulics.v_ValveHead_dict": "Hydraulics Valve Head",
Expand All @@ -106,10 +107,15 @@
"hydraulics.v_Z_HydrualicsCost": "Hydraulics Cost",
"v_Z": "Objective",
"v_R_TotalStorage": "Credit Total Storage",
"v_R_BeneficialReuse_dict": "Credit Beneficial Reuse",
"vb_y_BeneficialReuse_dict": "Beneficial Reuse Usage",
"reuse_WaterKPI": "Produced Water Recycle Rate",
"disposal_WaterKPI": "Produced Water Disposal Rate",
"fresh_CompletionsDemandKPI": "Completions Demand Freshwater Rate",
"reuse_CompletionsDemandKPI": "Recycle Rate",
"ReuseCapacity": "Reuse Capacity",
"ReuseMinimum": "Reuse Minimum",
"BeneficialReuseCredit": "Beneficial Reuse Credit",

"Solver_Stats_dict": "Solver Stats"
}
6 changes: 4 additions & 2 deletions electron/ui/src/assets/Subcategories.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
"InitialStorageCapacity","StorageCapacityIncrements","TreatmentCapacityIncrements","TreatmentEfficiency",
"DisposalExpansionCost","StorageExpansionCost","TreatmentExpansionCost","PipelineCapexDistanceBased",
"PipelineCapexCapacityBased","PipelineCapacityIncrements","PipelineExpansionDistance","WellPressure", "Hydraulics","Elevation",
"Economics","PadWaterQuality","StorageInitialWaterQuality","PadStorageInitialWaterQuality","DisposalOperatingCapacity", "RemovalEfficiency"
"Economics","PadWaterQuality","StorageInitialWaterQuality","PadStorageInitialWaterQuality","DisposalOperatingCapacity", "RemovalEfficiency",
"ReuseCapacity", "ReuseMinimum", "BeneficialReuseCredit"
],
"Static": [
"PNA","CNA","CCA","NNA","NCA","NKA","NRA","NSA","FCA","RCA","RNA","RSA","SCA","SNA","PCT","PKT","FCT","CST","CCT","CKT"
"PNA","CNA","CCA","NNA","NCA","NKA","NRA","NSA","FCA","RCA","RNA","RSA","SCA","SNA",
"PCT","PKT","FCT","CST","CCT","CKT","NOA","SOA","ROA","RST","ROT","SOT"
]
}
21 changes: 7 additions & 14 deletions electron/ui/src/components/CustomChart/CustomChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ export default function AreaChart(props) {
return 1
})
let tempAreaChartData = []
// Object.entries(tempData).map(([key, value] ) => {
// tempAreaChartData.push({x: value.x, y: value.y, stackgroup: 'one', name: key})
// })

let keys = Object.keys(tempData).sort().reverse()
keys.map((key, ind) => {
let value = tempData[key]
Expand All @@ -46,35 +44,31 @@ export default function AreaChart(props) {
} else {
let tempData = {}
// organize area chart data
// console.log('setting chart data for '+props.title+': ')
// console.log(props.data)
for (var index = 1; index < props.data.length; index++) {
let item = props.data[index]
let key = item[props.labelIndex]
// if(key.length > 4) {
// key=key.substring(0,4)
// console.log(key)
// }
key = key.replace('PostTreatmentTreatedWaterNode',"PTTWN").replace("PostTreatmentResidualNode","PTRN").replace('intermediate','I')
let x = item[props.xindex]
x = parseInt(x.substring(1))
let y = item[props.yindex]
if (key in tempData){
tempData[key].x.push(parseInt(x.substring(1)))
tempData[key].x.push(x)
tempData[key].y.push(y)
}else {
tempData[key] = {x: [x], y: [y]}
}
}
let tempAreaChartData = []
// Object.entries(tempData).map(([key, value] ) => {
// tempAreaChartData.push({x: value.x, y: value.y, stackgroup: 'one', name: key})
// })

// let keys = Object.keys(tempData).sort().reverse()
let keys = Object.keys(tempData).sort()
keys.map((key, ind) => {
let value = tempData[key]
tempAreaChartData.push({x: value.x, y: value.y, stackgroup: props.stackgroup, name: key})
tempAreaChartData.push({x: value.x, y: value.y, stackgroup: props.stackgroup, name: key, mode: "lines"})
return 1
})
// console.log(tempAreaChartData)
setAreaChartData(tempAreaChartData)
}

Expand All @@ -85,7 +79,6 @@ export default function AreaChart(props) {
/*
x values are T values
y values are bbl/week
where does K value go? needs to be a label of some sort
*/
data={areaChartData}
layout={{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import React from 'react';
import {useState} from 'react';
import Grid from '@mui/material/Grid';
import Accordion from '@mui/material/Accordion';
import AccordionSummary from '@mui/material/AccordionSummary';
import AccordionDetails from '@mui/material/AccordionDetails';
import ListItemText from '@mui/material/ListItemText';
import Checkbox from '@mui/material/Checkbox';
import ListItemIcon from '@mui/material/ListItemIcon';
import Button from '@mui/material/Button';
import MenuItem from '@mui/material/MenuItem';
import Typography from '@mui/material/Typography';


export default function FilterDropdown(props) {
const styles = {
iconSelected: {
backgroundColor:'#6094bc',
color: 'white',
borderRadius: 10,
},
iconUnselected: {
borderRadius: 10,
color:'black',
}
}


return (
<Accordion style={{minWidth:props.width }} sx={{minWidth:props.width, zIndex: 2}}>
<AccordionSummary sx={{marginBottom: 0, paddingBottom:0}} style={{justifyContent:"center"}}>
<Typography noWrap align="center" sx={{width: '100%',fontWeight: "bold", color: "#0884b4"}}>Node Filters</Typography>
</AccordionSummary>
<AccordionDetails sx={{ maxHeight:props.maxHeight, overflow: "scroll", marginTop:0, paddingTop:0}}>
<MenuItem value="all" onClick={()=> props.handleFilter("all")}>
<ListItemIcon>
<Checkbox
checked={props.isAllSelected}
indeterminate={
props.filtered.length > 0 && props.filtered.length < props.total.length
}
/>
</ListItemIcon>
<ListItemText
primary="Select All"
/>
</MenuItem>
{
Object.entries(props.filtered).map(([key,value]) => (
<MenuItem key={key} value={key} onClick={()=> props.handleFilter(key)}>
<ListItemIcon>
<Checkbox checked={value} />
</ListItemIcon>
<ListItemText primary={key} />
</MenuItem>
))}



</AccordionDetails>
</Accordion>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export default function NetworkDiagram(props) {
<IconButton onClick={() => handleDelete()}><CloseIcon/></IconButton>
</Grid>
<Grid item xs ={11.5}>
<img alt="network diagram" style={{height:"500px"}} src={`file://${diagramImage}`}></img>
<img alt="network diagram" style={{width: "100%"}} src={`file://${diagramImage}`}></img>
</Grid>
</Grid>

Expand Down
8 changes: 4 additions & 4 deletions electron/ui/src/views/LandingPage/LandingPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ export default function LandingPage(props) {
</Grid>
<Grid item xs={2}> </Grid>

<Grid item xs={5}> </Grid>
<Grid item xs={2}>
<Grid item xs={3}> </Grid>
<Grid item xs={6}>
<Box>
<p style={{paddingTop:0, marginTop: 0, color:"#9c9c9c"}}>v 1.0.0</p>
<p style={{paddingTop:0, marginTop: 0, color:"#9c9c9c"}}>v23.10.06 (PARETO v0.9.0)</p>
</Box>
</Grid>
<Grid item xs={5}> </Grid>
<Grid item xs={3}> </Grid>

<Grid item xs={1}> </Grid>
<Grid item xs={10}>
Expand Down
Loading

0 comments on commit 25a227d

Please sign in to comment.