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

fix bug of Add/Remove modal #3491

Merged
merged 2 commits into from
Apr 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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