diff --git a/mindinsight/ui/src/views/train-manage/scalar.vue b/mindinsight/ui/src/views/train-manage/scalar.vue index 71553c52e993959ee565eb0168bb1cf1b890d76f..f6831f5b09d200261cb7fa267b7db57bec64a620 100644 --- a/mindinsight/ui/src/views/train-manage/scalar.vue +++ b/mindinsight/ui/src/views/train-manage/scalar.vue @@ -298,8 +298,8 @@ export default { thresholdErrorMsg: '', thresholdRelational: '', thresholdValue: [ - {filterCondition: this.$t('scalar.lessThan'), value: ''}, - {filterCondition: this.$t('scalar.lessThan'), value: ''}, + { filterCondition: this.$t('scalar.lessThan'), value: '' }, + { filterCondition: this.$t('scalar.lessThan'), value: '' }, ], filterOptions: [ { @@ -412,7 +412,7 @@ export default { return; } document.title = `${decodeURIComponent( - this.$route.query.train_id, + this.$route.query.train_id )}-${this.$t('scalar.titleText')}-MindInsight`; // Adding a Listener window.addEventListener('resize', this.resizeCallback, false); @@ -440,7 +440,7 @@ export default { if (localStorage.getItem('thresholdCache')) { try { this.thresholdLocal = JSON.parse( - localStorage.getItem('thresholdCache'), + localStorage.getItem('thresholdCache') ); this.clearCache(); } catch (e) { @@ -467,8 +467,8 @@ export default { ) { delete this.thresholdLocal[this.decodeTrainingJobId]; localStorage.setItem( - 'thresholdCache', - JSON.stringify(this.thresholdLocal), + 'thresholdCache', + JSON.stringify(this.thresholdLocal) ); } } @@ -484,81 +484,81 @@ export default { train_id: this.trainingJobId, }; RequestService.getSingleTrainJob(params, false) - .then((res) => { + .then((res) => { // error; - if ( - !res || + if ( + !res || !res.data || !res.data.train_jobs || !res.data.train_jobs.length - ) { - this.initOver = true; - return; - } - const tempTagList = []; - const dataList = []; - const propsList = []; - const data = res.data.train_jobs[0]; - const runNmeColor = CommonProperty.commonColorArr[0]; - data.tags.forEach((tagObj) => { - if (!this.oriDataDictionaries[tagObj]) { - this.oriDataDictionaries[tagObj] = true; - // Add the tag list - tempTagList.push({ - label: tagObj, - checked: true, - show: true, - }); - const sampleIndex = dataList.length; - // Adding Chart Data - dataList.push({ - tagName: tagObj, - runNames: data.name, - colors: runNmeColor, - show: false, - updateFlag: false, - dataRemove: false, - fullScreen: false, - sampleIndex: sampleIndex, - domId: 'prDom' + this.DomIdIndex, - charData: { - oriData: [], - charOption: {}, - }, - zoomData: [null, null], - zoomDataTimer: null, - charObj: null, - invalidData: false, - }); - - propsList.push({ - tagName: tagObj, - runNames: data.name, - colors: '', - }); - this.DomIdIndex++; - } - }); - this.tagOperateList = tempTagList; - this.tagPropsList = JSON.parse(JSON.stringify(tempTagList)); - if (dataList.length === 1) { - dataList[0].fullScreen = true; - } - this.originDataArr = dataList; - this.propsList = propsList; + ) { this.initOver = true; + return; + } + const tempTagList = []; + const dataList = []; + const propsList = []; + const data = res.data.train_jobs[0]; + const runNmeColor = CommonProperty.commonColorArr[0]; + data.tags.forEach((tagObj) => { + if (!this.oriDataDictionaries[tagObj]) { + this.oriDataDictionaries[tagObj] = true; + // Add the tag list + tempTagList.push({ + label: tagObj, + checked: true, + show: true, + }); + const sampleIndex = dataList.length; + // Adding Chart Data + dataList.push({ + tagName: tagObj, + runNames: data.name, + colors: runNmeColor, + show: false, + updateFlag: false, + dataRemove: false, + fullScreen: false, + sampleIndex: sampleIndex, + domId: 'prDom' + this.DomIdIndex, + charData: { + oriData: [], + charOption: {}, + }, + zoomData: [null, null], + zoomDataTimer: null, + charObj: null, + invalidData: false, + }); - this.$nextTick(() => { - this.multiSelectedTagNames = this.$refs.multiselectGroupComponents.updateSelectedDic(); - // Obtains data on the current page - this.updateTagInPage(); - this.resizeCallback(); - }); - }, this.requestErrorCallback) - .catch((e) => { - this.initOver = true; - this.$message.error(this.$t('public.dataError')); + propsList.push({ + tagName: tagObj, + runNames: data.name, + colors: '', + }); + this.DomIdIndex++; + } + }); + this.tagOperateList = tempTagList; + this.tagPropsList = JSON.parse(JSON.stringify(tempTagList)); + if (dataList.length === 1) { + dataList[0].fullScreen = true; + } + this.originDataArr = dataList; + this.propsList = propsList; + this.initOver = true; + + this.$nextTick(() => { + this.multiSelectedTagNames = this.$refs.multiselectGroupComponents.updateSelectedDic(); + // Obtains data on the current page + this.updateTagInPage(); + this.resizeCallback(); }); + }, this.requestErrorCallback) + .catch((e) => { + this.initOver = true; + this.$message.error(this.$t('public.dataError')); + }); }, /** @@ -606,108 +606,108 @@ export default { }; RequestService.getScalarsSample(params) - .then((res) => { + .then((res) => { // error - if (!res || !res.data || !res.data.metadatas) { + if (!res || !res.data || !res.data.metadatas) { // canceled - if (res.toString() === 'false') { - return; - } - if (sampleObject.charObj) { - sampleObject.charObj.clear(); - sampleObject.onePoint = false; - } + if (res.toString() === 'false') { return; } - let hasInvalidData = false; - if (sampleObject.charObj) { - sampleObject.charObj.showLoading(); + sampleObject.charObj.clear(); + sampleObject.onePoint = false; } + return; + } + let hasInvalidData = false; - const resData = res.data; + if (sampleObject.charObj) { + sampleObject.charObj.showLoading(); + } - const tempObject = { - valueData: { - stepData: [], - absData: [], - relativeData: [], - }, - logData: { - stepData: [], - absData: [], - relativeData: [], - }, - }; - let relativeTimeBench = 0; - if (resData.metadatas.length) { - relativeTimeBench = resData.metadatas[0].wall_time; - } + const resData = res.data; - // Initializing Chart Data - resData.metadatas.forEach((metaData) => { - if (metaData.value === null && !hasInvalidData) { - hasInvalidData = true; - } - tempObject.valueData.stepData.push([ - metaData.step, - metaData.value, - ]); - tempObject.valueData.absData.push([ - metaData.wall_time, - metaData.value, - ]); - tempObject.valueData.relativeData.push([ - metaData.wall_time - relativeTimeBench, - metaData.value, - ]); - const logValue = metaData.value >= 0 ? metaData.value : ''; - tempObject.logData.stepData.push([metaData.step, logValue]); - tempObject.logData.absData.push([metaData.wall_time, logValue]); - tempObject.logData.relativeData.push([ - metaData.wall_time - relativeTimeBench, - logValue, - ]); - }); - - sampleObject.charData.oriData[0] = tempObject; + const tempObject = { + valueData: { + stepData: [], + absData: [], + relativeData: [], + }, + logData: { + stepData: [], + absData: [], + relativeData: [], + }, + }; + let relativeTimeBench = 0; + if (resData.metadatas.length) { + relativeTimeBench = resData.metadatas[0].wall_time; + } - if (hasInvalidData) { - this.$set(sampleObject, 'invalidData', true); - } else { - this.$set(sampleObject, 'invalidData', false); + // Initializing Chart Data + resData.metadatas.forEach((metaData) => { + if (metaData.value === null && !hasInvalidData) { + hasInvalidData = true; } + tempObject.valueData.stepData.push([ + metaData.step, + metaData.value, + ]); + tempObject.valueData.absData.push([ + metaData.wall_time, + metaData.value, + ]); + tempObject.valueData.relativeData.push([ + metaData.wall_time - relativeTimeBench, + metaData.value, + ]); + const logValue = metaData.value >= 0 ? metaData.value : ''; + tempObject.logData.stepData.push([metaData.step, logValue]); + tempObject.logData.absData.push([metaData.wall_time, logValue]); + tempObject.logData.relativeData.push([ + metaData.wall_time - relativeTimeBench, + logValue, + ]); + }); - sampleObject.charData.charOption = this.formateCharOption( - sampleIndex, - ); - const tempOption = sampleObject.charData.charOption; - if ( - tempOption.series[0].data.length === 1 || + sampleObject.charData.oriData[0] = tempObject; + + if (hasInvalidData) { + this.$set(sampleObject, 'invalidData', true); + } else { + this.$set(sampleObject, 'invalidData', false); + } + + sampleObject.charData.charOption = this.formateCharOption( + sampleIndex + ); + const tempOption = sampleObject.charData.charOption; + if ( + tempOption.series[0].data.length === 1 || sampleObject.onePoint - ) { - tempOption.series[0].showSymbol = true; - } else { - tempOption.series[0].showSymbol = false; - } + ) { + tempOption.series[0].showSymbol = true; + } else { + tempOption.series[0].showSymbol = false; + } - this.$forceUpdate(); + this.$forceUpdate(); - this.$nextTick(() => { - if (sampleObject.charObj) { - sampleObject.charObj.hideLoading(); - } - // Draw chart - if (!this.compare) { - this.updateOrCreateChar(sampleIndex, true); - } - }); - }) - .catch((e) => { + this.$nextTick(() => { if (sampleObject.charObj) { - sampleObject.charObj.clear(); + sampleObject.charObj.hideLoading(); + } + // Draw chart + if (!this.compare) { + this.updateOrCreateChar(sampleIndex, true); } }); + }) + .catch((e) => { + if (sampleObject.charObj) { + sampleObject.charObj.clear(); + } + }); }); }, @@ -718,7 +718,7 @@ export default { setOnePoint(sampleObject) { const that = this; - sampleObject.charObj.on('datazoom', function(params) { + sampleObject.charObj.on('datazoom', function (params) { const xAxisObject = params.batch[0]; const yAxisObject = params.batch[1]; const charData = sampleObject.charData.charOption.series[0].data; @@ -777,7 +777,7 @@ export default { setRestore(sampleObject) { const that = this; - sampleObject.charObj.on('restore', function(params) { + sampleObject.charObj.on('restore', function (params) { const charData = sampleObject.charData.charOption.series[0].data; const tempCharOption = sampleObject.charData.charOption; @@ -846,12 +846,12 @@ export default { if (curOriData) { if (sampleObject.log) { dataObj.data = this.formateSmoothData( - curOriData.logData[this.curBenchX], + curOriData.logData[this.curBenchX] ); dataObjBackend.data = curOriData.logData[this.curBenchX]; } else { dataObj.data = this.formateSmoothData( - curOriData.valueData[this.curBenchX], + curOriData.valueData[this.curBenchX] ); dataObjBackend.data = curOriData.valueData[this.curBenchX]; } @@ -981,23 +981,23 @@ export default { position: (point, params, dom, rect, size) => { const curDom = document.getElementById(sampleObject.domId); if (!curDom) { - return {left: 0, bottom: '100%'}; + return { left: 0, bottom: '100%' }; } if (sampleObject.fullScreen) { if (point[0] + size.contentSize[0] <= size.viewSize[0]) { - return {left: point[0], bottom: '10%'}; + return { left: point[0], bottom: '10%' }; } else { - return {right: size.viewSize[0] - point[0], bottom: '10%'}; + return { right: size.viewSize[0] - point[0], bottom: '10%' }; } } else { const parentNode = curDom.parentNode; if (!parentNode) { - return {left: 0, bottom: '100%'}; + return { left: 0, bottom: '100%' }; } if (parentNode.offsetLeft > size.contentSize[0]) { - return {right: '100%', bottom: 0}; + return { right: '100%', bottom: 0 }; } else { - return {left: '100%', bottom: 0}; + return { left: '100%', bottom: 0 }; } } }, @@ -1082,16 +1082,16 @@ export default { `display:inline-block;">