From 39302d4c46455a9741e19d6c889e957c477e5e97 Mon Sep 17 00:00:00 2001 From: zhangyu Date: Thu, 6 Jan 2022 17:42:38 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=20chartTepm=E7=9A=84?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=20=E4=BB=A5=E5=8F=8A=20=E6=97=A7=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=20=E7=9A=84=20valueMapping=E6=97=A0=E6=B3=95=E5=B1=95?= =?UTF-8?q?=E5=BC=80=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/chart/panelChart.vue | 20 +++++++++++++++++++ .../common/rightBox/chart/chartRightBox.vue | 8 ++++++++ 2 files changed, 28 insertions(+) diff --git a/nezha-fronted/src/components/chart/panelChart.vue b/nezha-fronted/src/components/chart/panelChart.vue index 00d783cc0..9c8d5f904 100644 --- a/nezha-fronted/src/components/chart/panelChart.vue +++ b/nezha-fronted/src/components/chart/panelChart.vue @@ -161,6 +161,18 @@ export default { switch (this.chartInfo.datasource) { case 'metrics': case 'logs': { + if (this.from === fromRoute.chartTemp) { + setTimeout(() => { + this.chartData = [chartTempData.data.result] + this.chartData.forEach(item => { + item.forEach(children => { + children.elements = elements[0] + }) + }) + this.loading = false + }, 100) + return + } let urlPre = '' if (this.chartInfo.datasource === 'metrics') { urlPre += '/prom' @@ -210,6 +222,7 @@ export default { if (rIndex < elements.length) { if (r.status === 'success') { r.data.result.forEach(item => { + item.elements = elements[rIndex] this.allDataLength++ }) chartData.push(r.data.result) @@ -245,6 +258,13 @@ export default { } case 'system': { this.chartInfo.elements = this.chartInfo.param.datasource + if (this.from === fromRoute.chartTemp) { + setTimeout(() => { + this.chartData = [chartTempData.data.result] + this.loading = false + }, 100) + return + } if (this.chartInfo.type === 'assetInfo') { this.$get('asset/asset/' + this.chartDetailInfo.id).then(res => { this.chartData = res.data diff --git a/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue b/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue index b4861b05f..dfa796a9a 100644 --- a/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue +++ b/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue @@ -458,12 +458,20 @@ export default { valueMapping: false } } + // this.editChart.varType = 1 if (this.editChart.param.enable.legend && !this.editChart.param.legend) { this.editChart.param.legend = { placement: 'bottom', values: [], show: true } } if (this.editChart.param.datasource && !this.editChart.param.datasource[0].legend) { this.editChart.param.datasource[0].legend = '' } + if (this.editChart.param.valueMapping) { + this.editChart.param.valueMapping.forEach(item => { + if (!item.show) { + item.show = false + } + }) + } } } },