Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Commit

Permalink
fix bug of Add/Remove modal (#3491)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lijiaoa authored Apr 2, 2021
1 parent 45236e1 commit 4338bcb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
9 changes: 7 additions & 2 deletions ts/webui/src/components/modals/ChangeColumnComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ interface ChangeColumnProps {
onSelectedChange: (val: string[]) => void;
onHideDialog: () => void;
minSelected?: number;
whichComponent: string; // which component use this component
}

interface SimpleColumn {
Expand Down Expand Up @@ -57,10 +58,14 @@ class ChangeColumnComponent extends React.Component<ChangeColumnProps, ChangeCol

saveUserSelectColumn = (): void => {
const { currentSelected } = this.state;
const { allColumns, onSelectedChange } = this.props;
const { allColumns, onSelectedChange, whichComponent } = this.props;
const selectedColumns = allColumns.map(column => column.key).filter(key => currentSelected.includes(key));
localStorage.setItem('columns', JSON.stringify(selectedColumns));
onSelectedChange(selectedColumns);
if (whichComponent === 'table') {
localStorage.setItem('columns', JSON.stringify(selectedColumns));
} else {
localStorage.setItem('paraColumns', JSON.stringify(selectedColumns));
}
this.hideDialog();
};

Expand Down
7 changes: 6 additions & 1 deletion ts/webui/src/components/trial-detail/Para.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ class Para extends React.Component<ParaProps, ParaState> {
noChart: true,
customizeColumnsDialogVisible: false,
availableDimensions: [],
chosenDimensions: []
chosenDimensions:
localStorage.getItem('paraColumns') !== null
? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
JSON.parse(localStorage.getItem('paraColumns')!)
: []
};
}

Expand Down Expand Up @@ -130,6 +134,7 @@ class Para extends React.Component<ParaProps, ParaState> {
this.setState({ customizeColumnsDialogVisible: false });
}}
minSelected={2}
whichComponent='para'
/>
)}
<div className='parcoords' style={this.chartMulineStyle} ref={this.paraRef} />
Expand Down
1 change: 1 addition & 0 deletions ts/webui/src/components/trial-detail/TableList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,7 @@ class TableList extends React.Component<TableListProps, TableListState> {
onHideDialog={(): void => {
this.setState({ customizeColumnsDialogVisible: false });
}}
whichComponent='table'
/>
)}
{/* Clone a trial and customize a set of new parameters */}
Expand Down

0 comments on commit 4338bcb

Please sign in to comment.