diff --git a/mindinsight/ui/src/views/train-manage/operator.vue b/mindinsight/ui/src/views/train-manage/operator.vue index 3dba87074518bd26f52a7dd99eb7c6523f5aa930..8a05bd26d47a48ae4ff84a43925bb21cdde859e7 100644 --- a/mindinsight/ui/src/views/train-manage/operator.vue +++ b/mindinsight/ui/src/views/train-manage/operator.vue @@ -65,7 +65,9 @@ @@ -74,6 +76,7 @@
{ + const item = this.$refs['expandChild']; + if (item && this.curActiveRow.rowItem) { + item.sort(this.curActiveRow.childProp, this.curActiveRow.childOrder); + } + }); + }, /** * clear cpu data */ @@ -426,6 +441,15 @@ export default { }); this.opTypeList.push(object); }); + this.$nextTick(() => { + const elementItem = this.$refs['expandTable']; + if (elementItem) { + elementItem.sort( + this.op_sort_condition.name, + this.op_sort_condition.type, + ); + } + }); if ( !this.coreCharts.device_id || this.coreCharts.device_id !== this.currentCard @@ -486,6 +510,20 @@ export default { .then((res) => { if (res && res.data) { this.formatterDetailData(row, res.data); + this.$nextTick(() => { + const item = this.$refs['expandChild']; + if (item) { + this.curActiveRow = { + rowItem: row, + childProp: row.op_sort_condition.name, + childOrder: row.op_sort_condition.type, + }; + item.sort( + row.op_sort_condition.name, + row.op_sort_condition.type, + ); + } + }); } }) .catch(() => {}); @@ -580,6 +618,13 @@ export default { } else { this.op_filter_condition = {}; } + if (this.curActiveRow.rowItem) { + this.curActiveRow = { + rowItem: null, + childProp: null, + childOrder: null, + }; + } this.getCoreTypeList(); } }, @@ -653,12 +698,30 @@ export default { expandTypeItem(row) { row.isExpanded = !row.isExpanded; if (row.isExpanded) { + if (this.curActiveRow.rowItem) { + this.curActiveRow.rowItem.isExpanded = false; + const item = this.$refs['expandTable']; + if (item) { + item.toggleRowExpansion(this.curActiveRow.rowItem, false); + } + } + this.curActiveRow = { + rowItem: row, + childProp: null, + childOrder: null, + }; row.opDetailList = []; row.opDetailCol = []; row.opDetailPage.offset = 0; row.pageTotal = 0; row.op_sort_condition = {name: 'execution_time', type: 'descending'}; this.getCoreDetailList(row); + } else { + this.curActiveRow = { + rowItem: null, + childProp: null, + childOrder: null, + }; } }, /** @@ -949,11 +1012,16 @@ export default { }, mounted() { if (this.train_id) { - document.title = `${decodeURIComponent(this.train_id)}-${this.$t('profiling.operatorDetail')}-MindInsight`; + document.title = `${decodeURIComponent(this.train_id)}-${this.$t( + 'profiling.operatorDetail', + )}-MindInsight`; } else { document.title = `${this.$t('profiling.operatorDetail')}-MindInsight`; } window.addEventListener('resize', this.resizeCallback, false); + setTimeout(() => { + this.$bus.$on('collapse', this.resizeEchart); + }, 500); }, }; diff --git a/mindinsight/ui/src/views/train-manage/profiling-dashboard.vue b/mindinsight/ui/src/views/train-manage/profiling-dashboard.vue index 6f04c3b06631c50db456c2d8f17243ee2b72c3c4..616e010eee2d240ded7c5c8ead5aa3e57d4adbbe 100644 --- a/mindinsight/ui/src/views/train-manage/profiling-dashboard.vue +++ b/mindinsight/ui/src/views/train-manage/profiling-dashboard.vue @@ -195,10 +195,18 @@ export default { }, }; }, - mounted() {}, + mounted() { + setTimeout(() => { + this.$bus.$on('collapse', this.resizeTrace); + }, 500); + }, watch: { '$parent.curDashboardInfo': { handler(newValue, oldValue) { + if (newValue.curCardNum === '') { + this.pieChart.noData = true; + this.svg.noData = true; + } if (newValue.query.dir && newValue.query.id && newValue.query.path) { this.summaryPath = newValue.query.dir; this.trainingJobId = newValue.query.id; @@ -226,7 +234,6 @@ export default { this.queryTrainingTrace(); this.initPieChart(); window.addEventListener('resize', this.resizeTrace, false); - this.$bus.$on('resize', this.resizeTrace); }, viewDetail(path) { this.$router.push({ @@ -393,10 +400,13 @@ export default { svg.insertBefore(dashedLine, svg.querySelector('g')); row.forEach((i) => { if (i.duration) { - const tempDom = i.name - ? this.createRect(i, index) - : this.createArrow(i, index); - svg.insertBefore(tempDom, svg.querySelector('g')); + if (i.name) { + const tempDom = this.createRect(i, index); + svg.insertBefore(tempDom, svg.querySelector('g')); + } else { + const tempDom = this.createArrow(i, index); + svg.appendChild(tempDom); + } } }); } @@ -488,7 +498,13 @@ export default { const text = document.createElementNS(this.svg.namespaceURI, 'text'); text.textContent = `${data.duration.toFixed(4)}ms`; const textWidth = this.getTextWidth(text.textContent); - text.setAttribute('x', Math.max(0, (x2 - x1) / 2 + x1 - textWidth / 2)); + text.setAttribute( + 'x', + Math.min( + this.svg.svgPadding * 2 + this.svg.totalWidth - textWidth, + Math.max(0, (x2 - x1) / 2 + x1 - textWidth / 2), + ), + ); text.setAttribute('y', y - 6); text.setAttribute('font-size', 12); text.setAttribute('fill', '#6c7280'); @@ -555,7 +571,7 @@ export default { }, destroyed() { window.removeEventListener('resize', this.resizeTrace, false); - this.$bus.$off('resize'); + this.$bus.$off('collapse'); }, }; diff --git a/mindinsight/ui/src/views/train-manage/profiling.vue b/mindinsight/ui/src/views/train-manage/profiling.vue index d1de144bf91496240edbf4f03ee549ca585dfbc3..dfe7cf9162792f5107970a221337c6713e28a389 100644 --- a/mindinsight/ui/src/views/train-manage/profiling.vue +++ b/mindinsight/ui/src/views/train-manage/profiling.vue @@ -36,7 +36,8 @@ limitations under the License. {{$t("profiling.smartHelper")}}
-
@@ -121,9 +122,12 @@ export default { }, collapseLeft() { this.collapse = !this.collapse; - this.$bus.$emit('resize'); + this.$bus.$emit('collapse'); }, }, + destroyed() { + this.$bus.$off('collapse'); + }, };