Commit 3d43937b authored by Lijiao's avatar Lijiao Committed by chicm-ms
Browse files

fix bug of table entries (#1032)

* fix bug of table entries
parent 58fd0c84
...@@ -23,7 +23,8 @@ interface TrialDetailState { ...@@ -23,7 +23,8 @@ interface TrialDetailState {
experimentStatus: string; experimentStatus: string;
experimentPlatform: string; experimentPlatform: string;
experimentLogCollection: boolean; experimentLogCollection: boolean;
entriesTable: number; entriesTable: number; // table components val
entriesInSelect: string;
searchSpace: string; searchSpace: string;
isMultiPhase: boolean; isMultiPhase: boolean;
} }
...@@ -68,6 +69,7 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> { ...@@ -68,6 +69,7 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> {
experimentPlatform: '', experimentPlatform: '',
experimentLogCollection: false, experimentLogCollection: false,
entriesTable: 20, entriesTable: 20,
entriesInSelect: '20',
isHasSearch: false, isHasSearch: false,
searchSpace: '', searchSpace: '',
isMultiPhase: false isMultiPhase: false
...@@ -82,7 +84,7 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> { ...@@ -82,7 +84,7 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> {
axios.get(`${MANAGER_IP}/metric-data`) axios.get(`${MANAGER_IP}/metric-data`)
]) ])
.then(axios.spread((res, res1) => { .then(axios.spread((res, res1) => {
if (res.status === 200) { if (res.status === 200 && res1.status === 200) {
const trialJobs = res.data; const trialJobs = res.data;
const metricSource = res1.data; const metricSource = res1.data;
const trialTable: Array<TableObj> = []; const trialTable: Array<TableObj> = [];
...@@ -149,7 +151,7 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> { ...@@ -149,7 +151,7 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> {
}); });
}); });
// update search data result // update search data result
const { searchResultSource } = this.state; const { searchResultSource, entriesInSelect } = this.state;
if (searchResultSource.length !== 0) { if (searchResultSource.length !== 0) {
const temp: Array<number> = []; const temp: Array<number> = [];
Object.keys(searchResultSource).map(index => { Object.keys(searchResultSource).map(index => {
...@@ -176,6 +178,11 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> { ...@@ -176,6 +178,11 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> {
tableListSource: trialTable tableListSource: trialTable
})); }));
} }
if (entriesInSelect === 'all' && this._isMounted) {
this.setState(() => ({
entriesTable: trialTable.length
}));
}
} }
})); }));
} }
...@@ -198,7 +205,7 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> { ...@@ -198,7 +205,7 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> {
const item = tableListSource[key]; const item = tableListSource[key];
if (item.sequenceId.toString() === targetValue if (item.sequenceId.toString() === targetValue
|| item.id.includes(targetValue) || item.id.includes(targetValue)
|| item.status.includes(targetValue) || item.status.toUpperCase().includes(targetValue.toUpperCase())
) { ) {
searchResultList.push(item); searchResultList.push(item);
} }
...@@ -244,7 +251,12 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> { ...@@ -244,7 +251,12 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> {
break; break;
case 'all': case 'all':
const { tableListSource } = this.state; const { tableListSource } = this.state;
this.setState(() => ({ entriesTable: tableListSource.length })); if (this._isMounted) {
this.setState(() => ({
entriesInSelect: 'all',
entriesTable: tableListSource.length
}));
}
break; break;
default: default:
} }
...@@ -270,7 +282,7 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> { ...@@ -270,7 +282,7 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> {
const logCollection = res.data.params.logCollection; const logCollection = res.data.params.logCollection;
let expLogCollection: boolean = false; let expLogCollection: boolean = false;
const isMultiy: boolean = res.data.params.multiPhase !== undefined const isMultiy: boolean = res.data.params.multiPhase !== undefined
? res.data.params.multiPhase : false; ? res.data.params.multiPhase : false;
if (logCollection !== undefined && logCollection !== 'none') { if (logCollection !== undefined && logCollection !== 'none') {
expLogCollection = true; expLogCollection = true;
} }
......
...@@ -182,7 +182,8 @@ class Para extends React.Component<ParaProps, ParaState> { ...@@ -182,7 +182,8 @@ class Para extends React.Component<ParaProps, ParaState> {
// need to cut down the data // need to cut down the data
if (percent !== 0) { if (percent !== 0) {
const linesNum = paraData.data.length; const linesNum = paraData.data.length;
const len = Math.floor(linesNum * percent); // Math.ceil rather than Math.floor to avoid lost lines
const len = Math.ceil(linesNum * percent);
paraData.data.length = len; paraData.data.length = len;
} }
// need to swap the yAxis // need to swap the yAxis
...@@ -236,6 +237,8 @@ class Para extends React.Component<ParaProps, ParaState> { ...@@ -236,6 +237,8 @@ class Para extends React.Component<ParaProps, ParaState> {
visualMapObj = { visualMapObj = {
type: 'continuous', type: 'continuous',
precision: 3, precision: 3,
min: 0,
max: max,
color: ['#CA0000', '#FFC400', '#90EE90'] color: ['#CA0000', '#FFC400', '#90EE90']
}; };
} else { } else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment