Commit 4b5b6876 authored by Lijiao's avatar Lijiao Committed by chicm-ms
Browse files

add search space key as table additional column (#1574)

add search space key as table additional column
parent 958efabf
...@@ -26,11 +26,12 @@ class Compare extends React.Component<CompareProps, {}> { ...@@ -26,11 +26,12 @@ class Compare extends React.Component<CompareProps, {}> {
const idsList: Array<string> = []; const idsList: Array<string> = [];
Object.keys(compareRows).map(item => { Object.keys(compareRows).map(item => {
const temp = compareRows[item]; const temp = compareRows[item];
const trial = TRIALS.getTrial(temp.id);
trialIntermediate.push({ trialIntermediate.push({
name: temp.id, name: temp.id,
data: temp.description.intermediate, data: trial.description.intermediate,
type: 'line', type: 'line',
hyperPara: temp.description.parameters hyperPara: trial.description.parameters
}); });
idsList.push(temp.id); idsList.push(temp.id);
}); });
...@@ -208,7 +209,7 @@ class Compare extends React.Component<CompareProps, {}> { ...@@ -208,7 +209,7 @@ class Compare extends React.Component<CompareProps, {}> {
> >
<Row className="compare-intermediate"> <Row className="compare-intermediate">
{this.intermediate()} {this.intermediate()}
<Row className="compare-yAxis"># Intermediate</Row> <Row className="compare-yAxis"># Intermediate result</Row>
</Row> </Row>
<Row>{this.initColumn()}</Row> <Row>{this.initColumn()}</Row>
</Modal> </Modal>
......
...@@ -117,7 +117,6 @@ class TrialsDetail extends React.Component<TrialsDetailProps, TrialDetailState> ...@@ -117,7 +117,6 @@ class TrialsDetail extends React.Component<TrialsDetailProps, TrialDetailState>
const { columnList, changeColumn } = this.props; const { columnList, changeColumn } = this.props;
const source = TRIALS.filter(this.state.searchFilter); const source = TRIALS.filter(this.state.searchFilter);
const trialIds = TRIALS.filter(this.state.searchFilter).map(trial => trial.id); const trialIds = TRIALS.filter(this.state.searchFilter).map(trial => trial.id);
return ( return (
<div> <div>
<div className="trial" id="tabsty"> <div className="trial" id="tabsty">
......
...@@ -86,7 +86,7 @@ class Progressed extends React.Component<ProgressProps, ProgressState> { ...@@ -86,7 +86,7 @@ class Progressed extends React.Component<ProgressProps, ProgressState> {
const percent = (EXPERIMENT.profile.execDuration / EXPERIMENT.profile.params.maxExecDuration) * 100; const percent = (EXPERIMENT.profile.execDuration / EXPERIMENT.profile.params.maxExecDuration) * 100;
const remaining = convertTime(EXPERIMENT.profile.params.maxExecDuration - EXPERIMENT.profile.execDuration); const remaining = convertTime(EXPERIMENT.profile.params.maxExecDuration - EXPERIMENT.profile.execDuration);
const maxDuration = convertTime(EXPERIMENT.profile.params.maxExecDuration); const maxDuration = convertTime(EXPERIMENT.profile.params.maxExecDuration);
const maxTrialNum = convertTime(EXPERIMENT.profile.params.maxTrialNum); const maxTrialNum = EXPERIMENT.profile.params.maxTrialNum;
const execDuration = convertTime(EXPERIMENT.profile.execDuration); const execDuration = convertTime(EXPERIMENT.profile.execDuration);
let errorContent; let errorContent;
......
...@@ -59,7 +59,6 @@ class OpenRow extends React.Component<OpenRowProps, OpenRowState> { ...@@ -59,7 +59,6 @@ class OpenRow extends React.Component<OpenRowProps, OpenRowState> {
const { isShowFormatModal, formatStr } = this.state; const { isShowFormatModal, formatStr } = this.state;
const trialId = this.props.trialId; const trialId = this.props.trialId;
const trial = TRIALS.getTrial(trialId); const trial = TRIALS.getTrial(trialId);
let isClick = false;
const trialLink: string = `${MANAGER_IP}/trial-jobs/${trialId}`; const trialLink: string = `${MANAGER_IP}/trial-jobs/${trialId}`;
const logPathRow = trial.info.logPath || 'This trial\'s log path is not available.'; const logPathRow = trial.info.logPath || 'This trial\'s log path is not available.';
const multiProgress = trial.info.hyperParameters === undefined ? 0 : trial.info.hyperParameters.length; const multiProgress = trial.info.hyperParameters === undefined ? 0 : trial.info.hyperParameters.length;
...@@ -76,7 +75,7 @@ class OpenRow extends React.Component<OpenRowProps, OpenRowState> { ...@@ -76,7 +75,7 @@ class OpenRow extends React.Component<OpenRowProps, OpenRowState> {
<br /> <br />
For the entire parameter set, please refer to the following " For the entire parameter set, please refer to the following "
<a href={trialLink} target="_blank">{trialLink}</a>". <a href={trialLink} target="_blank">{trialLink}</a>".
<br/> <br />
Current Phase: {multiProgress}. Current Phase: {multiProgress}.
</Row> </Row>
: :
...@@ -87,18 +86,12 @@ class OpenRow extends React.Component<OpenRowProps, OpenRowState> { ...@@ -87,18 +86,12 @@ class OpenRow extends React.Component<OpenRowProps, OpenRowState> {
? ?
<Row id="description"> <Row id="description">
<Row className="bgHyper"> <Row className="bgHyper">
{
isClick
?
<pre>{JSON.stringify(trial.info.hyperParameters, null, 4)}</pre>
:
<JSONTree <JSONTree
hideRoot={true} hideRoot={true}
shouldExpandNode={() => true} // default expandNode shouldExpandNode={() => true} // default expandNode
getItemString={() => (<span />)} // remove the {} items getItemString={() => (<span />)} // remove the {} items
data={trial.info.hyperParameters} data={trial.description.parameters}
/> />
}
</Row> </Row>
<Row className="copy"> <Row className="copy">
<Button <Button
......
...@@ -124,7 +124,7 @@ function generateScatterSeries(trials: Trial[]) { ...@@ -124,7 +124,7 @@ function generateScatterSeries(trials: Trial[]) {
const data = trials.map(trial => [ const data = trials.map(trial => [
trial.sequenceId, trial.sequenceId,
trial.accuracy, trial.accuracy,
trial.info.hyperParameters, trial.description.parameters,
]); ]);
return { return {
symbolSize: 6, symbolSize: 6,
......
...@@ -272,7 +272,7 @@ class Intermediate extends React.Component<IntermediateProps, IntermediateState> ...@@ -272,7 +272,7 @@ class Intermediate extends React.Component<IntermediateProps, IntermediateState>
isFilter isFilter
? ?
<span> <span>
<span className="filter-x"># Intermediate</span> <span className="filter-x"># Intermediate result</span>
<input <input
// placeholder="point" // placeholder="point"
ref={input => this.pointInput = input} ref={input => this.pointInput = input}
...@@ -307,7 +307,7 @@ class Intermediate extends React.Component<IntermediateProps, IntermediateState> ...@@ -307,7 +307,7 @@ class Intermediate extends React.Component<IntermediateProps, IntermediateState>
style={{ width: '100%', height: 418, margin: '0 auto' }} style={{ width: '100%', height: 418, margin: '0 auto' }}
notMerge={true} // update now notMerge={true} // update now
/> />
<div className="yAxis"># Intermediate</div> <div className="yAxis"># Intermediate result</div>
</Row> </Row>
</div> </div>
); );
......
...@@ -326,7 +326,7 @@ class Para extends React.Component<ParaProps, ParaState> { ...@@ -326,7 +326,7 @@ class Para extends React.Component<ParaProps, ParaState> {
} else { } else {
Object.keys(dataSource).map(item => { Object.keys(dataSource).map(item => {
const trial = dataSource[item]; const trial = dataSource[item];
eachTrialParams.push(trial.description.parameters.error || ''); eachTrialParams.push(trial.description.parameters || '');
// may be a succeed trial hasn't final result // may be a succeed trial hasn't final result
// all detail page may be break down if havn't if // all detail page may be break down if havn't if
if (trial.acc !== undefined) { if (trial.acc !== undefined) {
......
...@@ -7,6 +7,7 @@ const Option = Select.Option; ...@@ -7,6 +7,7 @@ const Option = Select.Option;
const CheckboxGroup = Checkbox.Group; const CheckboxGroup = Checkbox.Group;
import { MANAGER_IP, trialJobStatus, COLUMN_INDEX, COLUMNPro } from '../../static/const'; import { MANAGER_IP, trialJobStatus, COLUMN_INDEX, COLUMNPro } from '../../static/const';
import { convertDuration, formatTimestamp, intermediateGraphOption, killJob } from '../../static/function'; import { convertDuration, formatTimestamp, intermediateGraphOption, killJob } from '../../static/function';
import { TRIALS } from '../../static/datamodel';
import { TableRecord } from '../../static/interface'; import { TableRecord } from '../../static/interface';
import OpenRow from '../public-child/OpenRow'; import OpenRow from '../public-child/OpenRow';
import Compare from '../Modal/Compare'; import Compare from '../Modal/Compare';
...@@ -159,8 +160,9 @@ class TableList extends React.Component<TableListProps, TableListState> { ...@@ -159,8 +160,9 @@ class TableList extends React.Component<TableListProps, TableListState> {
// checkbox for coloumn // checkbox for coloumn
selectedColumn = (checkedValues: Array<string>) => { selectedColumn = (checkedValues: Array<string>) => {
// 7: because have seven common column, "Intermediate count" is hidden by default // 9: because have nine common column,
let count = 7; // [Intermediate count, Start Time, End Time] is hidden by default
let count = 9;
const want: Array<object> = []; const want: Array<object> = [];
const finalKeys: Array<string> = []; const finalKeys: Array<string> = [];
const wantResult: Array<string> = []; const wantResult: Array<string> = [];
...@@ -174,7 +176,7 @@ class TableList extends React.Component<TableListProps, TableListState> { ...@@ -174,7 +176,7 @@ class TableList extends React.Component<TableListProps, TableListState> {
case 'Status': case 'Status':
case 'Operation': case 'Operation':
case 'Default': case 'Default':
case 'Intermediate count': case 'Intermediate result':
break; break;
default: default:
finalKeys.push(checkedValues[m]); finalKeys.push(checkedValues[m]);
...@@ -237,7 +239,6 @@ class TableList extends React.Component<TableListProps, TableListState> { ...@@ -237,7 +239,6 @@ class TableList extends React.Component<TableListProps, TableListState> {
render() { render() {
const { pageSize, columnList } = this.props; const { pageSize, columnList } = this.props;
const tableSource: Array<TableRecord> = JSON.parse(JSON.stringify(this.props.tableSource)); const tableSource: Array<TableRecord> = JSON.parse(JSON.stringify(this.props.tableSource));
console.log('rerender table', tableSource);
const { intermediateOption, modalVisible, isShowColumn, const { intermediateOption, modalVisible, isShowColumn,
selectRows, isShowCompareModal, selectedRowKeys, intermediateOtherKeys } = this.state; selectRows, isShowCompareModal, selectedRowKeys, intermediateOtherKeys } = this.state;
const rowSelection = { const rowSelection = {
...@@ -248,6 +249,17 @@ class TableList extends React.Component<TableListProps, TableListState> { ...@@ -248,6 +249,17 @@ class TableList extends React.Component<TableListProps, TableListState> {
}; };
let showTitle = COLUMNPro; let showTitle = COLUMNPro;
const showColumn: Array<object> = []; const showColumn: Array<object> = [];
// parameter as table column
const trialMess = TRIALS.getTrial(tableSource[0].id);
const trial = trialMess.description.parameters;
const parameterColumn: Array<string> = Object.keys(trial);
const parameterStr: Array<string> = [];
parameterColumn.forEach(value => {
parameterStr.push(`${value} (search space)`);
});
showTitle = COLUMNPro.concat(parameterStr);
// only succeed trials have final keys // only succeed trials have final keys
if (tableSource.filter(record => record.status === 'SUCCEEDED').length >= 1) { if (tableSource.filter(record => record.status === 'SUCCEEDED').length >= 1) {
const temp = tableSource.filter(record => record.status === 'SUCCEEDED')[0].accuracy; const temp = tableSource.filter(record => record.status === 'SUCCEEDED')[0].accuracy;
...@@ -267,6 +279,11 @@ class TableList extends React.Component<TableListProps, TableListState> { ...@@ -267,6 +279,11 @@ class TableList extends React.Component<TableListProps, TableListState> {
} }
} }
for (const item of columnList) { for (const item of columnList) {
const paraColumn = item.match(/ \(search space\)$/);
let cc;
if (paraColumn !== null) {
cc = paraColumn.input;
}
switch (item) { switch (item) {
case 'Trial No.': case 'Trial No.':
showColumn.push(SequenceIdColumnConfig); showColumn.push(SequenceIdColumnConfig);
...@@ -286,7 +303,7 @@ class TableList extends React.Component<TableListProps, TableListState> { ...@@ -286,7 +303,7 @@ class TableList extends React.Component<TableListProps, TableListState> {
case 'Status': case 'Status':
showColumn.push(StatusColumnConfig); showColumn.push(StatusColumnConfig);
break; break;
case 'Intermediate count': case 'Intermediate result':
showColumn.push(IntermediateCountColumnConfig); showColumn.push(IntermediateCountColumnConfig);
break; break;
case 'Default': case 'Default':
...@@ -332,27 +349,22 @@ class TableList extends React.Component<TableListProps, TableListState> { ...@@ -332,27 +349,22 @@ class TableList extends React.Component<TableListProps, TableListState> {
}, },
}); });
break; break;
case (cc):
case 'Intermediate result': // remove SEARCH_SPACE title
const realItem = item.replace(' (search space)', '');
showColumn.push({ showColumn.push({
title: 'Intermediate result', title: realItem,
dataIndex: 'intermediate', dataIndex: item,
key: 'intermediate', key: item,
width: '16%', width: '6%',
render: (text: string, record: TableRecord) => { render: (text: string, record: TableRecord) => {
const eachTrial = TRIALS.getTrial(record.id);
return ( return (
<Button <span>{eachTrial.description.parameters[realItem]}</span>
type="primary"
className="tableButton"
onClick={this.showIntermediateModal.bind(this, record.id)}
>
Intermediate
</Button>
); );
}, },
}); });
break; break;
default: default:
// FIXME // FIXME
alert('Unexpected column type'); alert('Unexpected column type');
...@@ -369,6 +381,7 @@ class TableList extends React.Component<TableListProps, TableListState> { ...@@ -369,6 +381,7 @@ class TableList extends React.Component<TableListProps, TableListState> {
expandedRowRender={this.openRow} expandedRowRender={this.openRow}
dataSource={tableSource} dataSource={tableSource}
className="commonTableStyle" className="commonTableStyle"
scroll={{x: 'max-content'}}
pagination={pageSize > 0 ? { pageSize } : false} pagination={pageSize > 0 ? { pageSize } : false}
/> />
{/* Intermediate Result Modal */} {/* Intermediate Result Modal */}
...@@ -495,7 +508,7 @@ const StatusColumnConfig: ColumnProps<TableRecord> = { ...@@ -495,7 +508,7 @@ const StatusColumnConfig: ColumnProps<TableRecord> = {
}; };
const IntermediateCountColumnConfig: ColumnProps<TableRecord> = { const IntermediateCountColumnConfig: ColumnProps<TableRecord> = {
title: 'Intermediate count', title: 'Intermediate result',
dataIndex: 'intermediateCount', dataIndex: 'intermediateCount',
width: 86, width: 86,
render: (text, record) => ( render: (text, record) => (
......
...@@ -38,11 +38,11 @@ const COLUMN_INDEX = [ ...@@ -38,11 +38,11 @@ const COLUMN_INDEX = [
index: 2 index: 2
}, },
{ {
name: 'StartTime', name: 'Start Time',
index: 3 index: 3
}, },
{ {
name: 'EndTime', name: 'End Time',
index: 4 index: 4
}, },
{ {
...@@ -54,7 +54,7 @@ const COLUMN_INDEX = [ ...@@ -54,7 +54,7 @@ const COLUMN_INDEX = [
index: 6 index: 6
}, },
{ {
name: 'Intermediate count', name: 'Intermediate result',
index: 7 index: 7
}, },
{ {
...@@ -70,7 +70,7 @@ const COLUMN_INDEX = [ ...@@ -70,7 +70,7 @@ const COLUMN_INDEX = [
const COLUMN = ['Trial No.', 'ID', 'Duration', 'Status', 'Default', 'Operation']; const COLUMN = ['Trial No.', 'ID', 'Duration', 'Status', 'Default', 'Operation'];
// all choice column !dictory final // all choice column !dictory final
const COLUMNPro = ['Trial No.', 'ID', 'Start Time', 'End Time', 'Duration', 'Status', const COLUMNPro = ['Trial No.', 'ID', 'Start Time', 'End Time', 'Duration', 'Status',
'Intermediate count', 'Default', 'Operation']; 'Intermediate result', 'Default', 'Operation'];
export { export {
MANAGER_IP, DOWNLOAD_IP, trialJobStatus, COLUMNPro, MANAGER_IP, DOWNLOAD_IP, trialJobStatus, COLUMNPro,
CONTROLTYPE, MONACO, COLUMN, COLUMN_INDEX, DRAWEROPTION, CONTROLTYPE, MONACO, COLUMN, COLUMN_INDEX, DRAWEROPTION,
......
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