From 781309a418800725b2bde57236ae0c35f270e3d5 Mon Sep 17 00:00:00 2001 From: xiayifan Date: Sat, 30 May 2020 17:39:15 +0800 Subject: [PATCH] code optimization --- .../ui/src/views/train-manage/graph.vue | 2 +- .../ui/src/views/train-manage/profiler.vue | 12 +++-- .../views/train-manage/training-dashboard.vue | 45 ++++++++++++------- 3 files changed, 38 insertions(+), 21 deletions(-) diff --git a/mindinsight/ui/src/views/train-manage/graph.vue b/mindinsight/ui/src/views/train-manage/graph.vue index a9e08c5..6069bd8 100644 --- a/mindinsight/ui/src/views/train-manage/graph.vue +++ b/mindinsight/ui/src/views/train-manage/graph.vue @@ -2989,7 +2989,7 @@ export default { padding: 0; } #inside-box { - background-color: #c0d3ff; + background-color: #5b88f1; position: absolute; /* Transparency */ opacity: 0.3; diff --git a/mindinsight/ui/src/views/train-manage/profiler.vue b/mindinsight/ui/src/views/train-manage/profiler.vue index 31e91f8..93d12e7 100644 --- a/mindinsight/ui/src/views/train-manage/profiler.vue +++ b/mindinsight/ui/src/views/train-manage/profiler.vue @@ -121,6 +121,7 @@ { - const item = this.$refs['expandChild']; - if (item) { + let item = null; + if (this.statisticType) { + item = this.$refs['opAllTable']; + } else { + item = this.$refs['expandChild']; this.curActiveRow = { rowItem: row, childProp: row.op_sort_condition.name, childOrder: row.op_sort_condition.type, }; + } + if (item) { item.sort( row.op_sort_condition.name, row.op_sort_condition.type, @@ -1030,7 +1036,7 @@ export default { if (this.$route.query && this.$route.query.dir && this.$route.query.id) { this.profile_dir = this.$route.query.dir; this.train_id = this.$route.query.id; - document.title = `${ decodeURIComponent(this.train_id)}-${this.$t('profiler.titleText')}-MindInsight`; + document.title = `${decodeURIComponent(this.train_id)}-${this.$t('profiler.titleText')}-MindInsight`; } else { document.title = `${this.$t('profiler.titleText')}-MindInsight`; } diff --git a/mindinsight/ui/src/views/train-manage/training-dashboard.vue b/mindinsight/ui/src/views/train-manage/training-dashboard.vue index dfe5102..6d16add 100644 --- a/mindinsight/ui/src/views/train-manage/training-dashboard.vue +++ b/mindinsight/ui/src/views/train-manage/training-dashboard.vue @@ -292,9 +292,14 @@ export default { if (this.$route.query && this.$route.query.id) { this.trainingJobId = this.$route.query.id; this.summaryPath = decodeURIComponent(this.trainingJobId); - document.title = this.summaryPath + '-' + this.$t('trainingDashboard.trainingDashboardTitle') + '-MindInsight'; + document.title = + this.summaryPath + + '-' + + this.$t('trainingDashboard.trainingDashboardTitle') + + '-MindInsight'; } else { - document.title = this.$t('trainingDashboard.trainingDashboardTitle') + '-MindInsight'; + document.title = + this.$t('trainingDashboard.trainingDashboardTitle') + '-MindInsight'; this.trainingJobId = ''; this.$message.error(this.$t('trainingDashboard.invalidId')); } @@ -790,6 +795,7 @@ export default { histogramTag = this.histogramTag; } if (!histogramTag) { + this.histogramTag = histogramTag; return; } const params = { @@ -797,21 +803,26 @@ export default { tag: histogramTag, }; // tag - RequestService.getHistogramData(params).then((res) => { - if ( - !res || - !res.data || - !res.data.histograms || - !res.data.histograms.length - ) { - return; - } - const data = JSON.parse(JSON.stringify(res.data)); - this.histogramTag = histogramTag; - this.histogramData = this.formOriData(data); - this.formatDataToChar(); - this.updateHistogramSampleData(); - }); + RequestService.getHistogramData(params).then( + (res) => { + if ( + !res || + !res.data || + !res.data.histograms || + !res.data.histograms.length + ) { + return; + } + const data = JSON.parse(JSON.stringify(res.data)); + this.histogramTag = histogramTag; + this.histogramData = this.formOriData(data); + this.formatDataToChar(); + this.updateHistogramSampleData(); + }, + (e) => { + this.histogramTag = ''; + }, + ); }, formOriData(dataItem) { const chartData = []; -- GitLab