diff --git a/src/webui/src/components/Para.tsx b/src/webui/src/components/Para.tsx index bdd8757a98..738f7ad974 100644 --- a/src/webui/src/components/Para.tsx +++ b/src/webui/src/components/Para.tsx @@ -99,7 +99,7 @@ class Para extends React.Component<{}, ParaState> { speDimName.push(tem); } if (accParaData[item].status === 'SUCCEEDED') { - if (accParaData[item].finalMetricData !== undefined) { + if (accParaData[item].finalMetricData && accParaData[item].hyperParameters) { // get acc array accPara.push(parseFloat(accParaData[item].finalMetricData.data)); // get dim and every line specific number diff --git a/src/webui/src/components/Sessionpro.tsx b/src/webui/src/components/Sessionpro.tsx index 126f4e5e7c..5ab64df0ce 100644 --- a/src/webui/src/components/Sessionpro.tsx +++ b/src/webui/src/components/Sessionpro.tsx @@ -7,6 +7,10 @@ import JSONTree from 'react-json-tree'; require('../style/sessionpro.css'); require('../style/logPath.css'); +interface ErrorPara { + error?: string; +} + interface TableObj { key: number; id: string; @@ -19,7 +23,7 @@ interface TableObj { } interface Parameters { - parameters: object; + parameters: ErrorPara; logPath?: string; isLink?: boolean; } @@ -189,7 +193,11 @@ class Sessionpro extends React.Component<{}, SessionState> { if (tableData[item].finalMetricData) { acc = parseFloat(tableData[item].finalMetricData.data); } - desJobDetail.parameters = JSON.parse(tableData[item].hyperParameters).parameters; + if (tableData[item].hyperParameters) { + desJobDetail.parameters = JSON.parse(tableData[item].hyperParameters).parameters; + } else { + desJobDetail.parameters = { error: 'This trial\'s parameters are not available.' }; + } if (tableData[item].logPath !== undefined) { desJobDetail.logPath = tableData[item].logPath; const isSessionLink = /^http/gi.test(tableData[item].logPath); @@ -344,6 +352,10 @@ class Sessionpro extends React.Component<{}, SessionState> { }]; const openRow = (record: TableObj) => { + let isHasParameters = true; + if (record.description.parameters.error) { + isHasParameters = false; + } const openRowDataSource = { parameters: record.description.parameters }; @@ -354,12 +366,21 @@ class Sessionpro extends React.Component<{}, SessionState> { } return (
-true} // default expandNode - getItemString={() => ()} // remove the {} items - data={openRowDataSource} - /> + { + isHasParameters + ? + true} // default expandNode + getItemString={() => ()} // remove the {} items + data={openRowDataSource} + /> + : + + Error: + 'This trial's parameters are not available.' ++ } { isLogLink ? diff --git a/src/webui/src/components/TrialStatus.tsx b/src/webui/src/components/TrialStatus.tsx index d0e0980ee2..7f8d4fccf5 100644 --- a/src/webui/src/components/TrialStatus.tsx +++ b/src/webui/src/components/TrialStatus.tsx @@ -17,8 +17,12 @@ echarts.registerTheme('my_theme', { color: '#3c8dbc' }); +interface ErrorPara { + error?: string; +} + interface DescObj { - parameters: Object; + parameters: ErrorPara; logPath?: string; isLink?: boolean; } @@ -237,6 +241,8 @@ class TrialStatus extends React.Component<{}, TabState> { : ''; if (trialJobs[item].hyperParameters !== undefined) { desc.parameters = JSON.parse(trialJobs[item].hyperParameters).parameters; + } else { + desc.parameters = { error: 'This trial\'s parameters are not available.' }; } if (trialJobs[item].logPath !== undefined) { desc.logPath = trialJobs[item].logPath; @@ -478,6 +484,10 @@ class TrialStatus extends React.Component<{}, TabState> { ]; const openRow = (record: TableObj) => { + let isHasParameters = true; + if (record.description.parameters.error) { + isHasParameters = false; + } const parametersRow = { parameters: record.description.parameters }; @@ -488,12 +498,21 @@ class TrialStatus extends React.Component<{}, TabState> { } return (-true} // default expandNode - getItemString={() => ()} // remove the {} items - data={parametersRow} - /> + { + isHasParameters + ? + < JSONTree + hideRoot={true} + shouldExpandNode={() => true} // default expandNode + getItemString={() => ()} // remove the {} items + data={parametersRow} + /> + : + + Error: + 'This trial's parameters are not available.' ++ } { isLogLink ? diff --git a/src/webui/src/style/logPath.css b/src/webui/src/style/logPath.css index 12b834e2e2..3e600171fb 100644 --- a/src/webui/src/style/logPath.css +++ b/src/webui/src/style/logPath.css @@ -12,3 +12,6 @@ color: blue; text-decoration: underline; } +.error{ + color: #CB4B16; +}