Skip to content

Commit

Permalink
Merge pull request #50 from MichaelPesce/update-value-multiple-cells
Browse files Browse the repository at this point in the history
Update value for multiple cells
  • Loading branch information
MichaelPesce authored Nov 6, 2023
2 parents 530f1bc + 560b97d commit 9c07aae
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 21 deletions.
10 changes: 5 additions & 5 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:
- "build"
- "update-value-multiple-cells"

defaults:
run:
Expand Down Expand Up @@ -49,7 +49,7 @@ jobs:

- 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.9.0rc0 && 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.0rc1 && pip install --progress-bar off .

- name: Install numpy 1.24.3
run: |
Expand All @@ -69,15 +69,15 @@ jobs:

- 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-23.10.06-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.11.02-win64.exe
- name: Upload artifact for windows build
uses: actions/upload-artifact@v3
if: always()
with:
name: windows-pareto-dist
path: |
electron/dist/ParetoUI-23.10.06-win64.exe
electron/dist/ParetoUI-23.11.02-win64.exe
# windows-build:
# name: Windows Build

Expand Down Expand Up @@ -126,4 +126,4 @@ jobs:
# with:
# name: windows-pareto-dist
# path: |
# electron/dist/ParetoUI-23.10.06-win64.exe
# electron/dist/ParetoUI-23.11.02-win64.exe
10 changes: 5 additions & 5 deletions electron/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pareto-ui",
"version": "23.10.06",
"version": "23.11.02",
"author": "Michael Pesce",
"private": true,
"main": "build/main.js",
Expand Down Expand Up @@ -74,10 +74,10 @@
"nsis": {
"oneClick": false,
"allowToChangeInstallationDirectory": true,
"artifactName": "ParetoUI-23.10.06-win64.exe"
"artifactName": "ParetoUI-23.11.02-win64.exe"
},
"dmg": {
"artifactName": "ParetoUI-23.10.06-arm64.dmg"
"artifactName": "ParetoUI-23.11.02-arm64.dmg"
},
"deb": {
"depends": [
Expand All @@ -86,7 +86,7 @@
"liblapack3",
"libblas3"
],
"artifactName": "ParetoUI-23.10.06-amd64.deb"
"artifactName": "ParetoUI-23.11.02-amd64.deb"
},
"directories": {
"buildResources": "assets"
Expand All @@ -106,7 +106,7 @@
"win": {
"target": "nsis",
"icon": "build/pareto-logo.ico",
"artifactName": "ParetoUI-23.10.06-win64.exe"
"artifactName": "ParetoUI-23.11.02-win64.exe"
},
"linux": {
"target": "Deb",
Expand Down
3 changes: 2 additions & 1 deletion electron/ui/public/notarize.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ module.exports = async function (params) {
appPath: appPath,
appleId: process.env.APPLE_ID,
appleIdPassword: process.env.APPLE_ID_PASSWORD,
tool: "notarytool",
tool: process.env.NOTARIZE_TOOL,
teamId: process.env.TEAM_ID,
})
} catch (error) {
console.error(error)
Expand Down
51 changes: 42 additions & 9 deletions electron/ui/src/components/DataTable/DataTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@ import { Table, TableBody, TableCell, TableHead, TableRow, TableContainer, TextF
import OverrideTable from '../OverrideTable/OverrideTable';
import ParetoDictionary from '../../assets/ParetoDictionary.json'
import CategoryNames from '../../assets/CategoryNames.json'
import PopupModal from '../../components/PopupModal/PopupModal'

export default function DataTable(props) {
const [showOverrideTables, setShowOverrideTables] = useState(false)
const [ rowValue, setRowValue ] = useState(0)
const [ doubleClickIndex, setDoubleClickIndex ] = useState(null)
const [ showRowValueInput, setShowRowValueInput ] = useState(false)

useEffect(()=>{
if(props.scenario.override_values === undefined) {
console.log('override values were not defined')
Expand Down Expand Up @@ -66,16 +71,10 @@ const handleDoubleClick = (ind, index) => {
index: column number, starting at 0
*/
if (['Optimized','Draft','failure', 'Not Optimized'].includes(props.scenario.results.status)) {
if(index === 0) //when double clicking column index, set all numerical values in that row to 0
if(index === 0) //when double clicking column index, allow user to input value to apply to that entire row
{
let tempScenario = {...props.scenario}
Object.entries(props.scenario.data_input.df_parameters[props.category]).map(([key, value], i) => {
if (i > 0 && value[ind] !== "" && !isNaN(value[ind])) {
value[ind] = 0
}
})
props.handleEditInput(true)
props.setScenario(tempScenario)
setShowRowValueInput(true)
setDoubleClickIndex(ind)
}else {
if(!props.editDict[""+ind+":"+index]) {
let tempEditDict = {...props.editDict}
Expand All @@ -91,6 +90,27 @@ const handleDoubleClick = (ind, index) => {
}
}

const handleEditRowValue = (event) => {
if (isNaN(event.target.value)) {
setRowValue(event.target.value)
}else {
setRowValue(Number(event.target.value))
}
}

const handleUpdateRowValues = () => {
let tempScenario = {...props.scenario}
Object.entries(props.scenario.data_input.df_parameters[props.category]).map(([key, value], i) => {
if (i > 0 && !isNaN(value[doubleClickIndex])) {
value[doubleClickIndex] = rowValue
}
})
props.handleEditInput(true)
props.setScenario(tempScenario)
setShowRowValueInput(false)
setRowValue(0)
}

const handleKeyDown = (e) => {
if (e.key === "Enter") {
e.preventDefault();
Expand Down Expand Up @@ -353,6 +373,19 @@ const renderInputDeltaTable = () => {
{props.section === "input" && renderInputTable()}
{props.section === "output" && renderOutputTable()}
{props.section === "compare" && renderInputDeltaTable()}
<PopupModal
input
open={showRowValueInput}
handleClose={() => setShowRowValueInput(false)}
text={rowValue}
textLabel='Update all values in this row'
handleEditText={handleEditRowValue}
handleSave={handleUpdateRowValues}
buttonText='Update'
buttonColor='primary'
buttonVariant='contained'
width={400}
/>
</>
);

Expand Down
2 changes: 1 addition & 1 deletion electron/ui/src/views/LandingPage/LandingPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default function LandingPage(props) {
<Grid item xs={3}> </Grid>
<Grid item xs={6}>
<Box>
<p style={{paddingTop:0, marginTop: 0, color:"#9c9c9c"}}>v23.10.06 (PARETO v0.9.0)</p>
<p style={{paddingTop:0, marginTop: 0, color:"#9c9c9c"}}>v23.11.02 (PARETO v0.9.0)</p>
</Box>
</Grid>
<Grid item xs={3}> </Grid>
Expand Down

0 comments on commit 9c07aae

Please sign in to comment.