From 06f915565da2ca751ca7a65458dcdb7e8726f444 Mon Sep 17 00:00:00 2001 From: zyh Date: Wed, 3 Jul 2024 11:16:11 +0800 Subject: [PATCH] =?UTF-8?q?NEZ-3495=20fix:=20notebook=20=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=BA=90=E4=B8=BAsystem=E6=97=B6=E4=BF=9D=E5=AD=98=E6=97=A0?= =?UTF-8?q?=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/bottomBox/tabs/notebookTab.vue | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/notebookTab.vue b/nezha-fronted/src/components/common/bottomBox/tabs/notebookTab.vue index d6b6ba416..56fd85e0e 100644 --- a/nezha-fronted/src/components/common/bottomBox/tabs/notebookTab.vue +++ b/nezha-fronted/src/components/common/bottomBox/tabs/notebookTab.vue @@ -173,9 +173,11 @@ export default { let charts = this.$lodash.cloneDeep(this.$refs.notebookList.copyDataList) charts = charts.filter(item => item.name !== 'groupTemp') charts.forEach(item => { - item.elements.forEach((subItem, subIndex) => { - subItem.expression = item.oldElements[subIndex].expression - }) + if (item.datasource == 'metrics' || item.datasource == 'log') { + item.elements.forEach((subItem, subIndex) => { + subItem.expression = item.oldElements[subIndex].expression + }) + } delete item.x delete item.y delete item.modifiedName @@ -250,14 +252,10 @@ export default { this.chart.position = { position: 'after', id: data.id } this.chart.panelName = this.showPanel.name this.chart.id = '' - this.chart.elements.forEach((item, index) => { - item.expression = this.chart.oldElements[index].expression - item.id = '' - item.chartId = '' - delete item.seq - }) - if (this.chart.datasource !== 'metrics' && this.chart.datasource !== 'log') { - delete this.chart.elements + if (this.chart.datasource == 'metrics' || this.chart.datasource == 'log') { + this.chart.elements.forEach((item, index) => { + item.expression = this.chart.oldElements[index].expression + }) } this.$nextTick(() => { this.$refs.addChartModal.isStable = 'stable' @@ -265,9 +263,11 @@ export default { } else { this.chart = JSON.parse(JSON.stringify(data)) this.chart.panelName = this.showPanel.name - this.chart.elements.forEach((item, index) => { - item.expression = this.chart.oldElements[index].expression - }) + if (this.chart.datasource == 'metrics' || this.chart.datasource == 'log') { + this.chart.elements.forEach((item, index) => { + item.expression = this.chart.oldElements[index].expression + }) + } this.$nextTick(() => { this.$refs.addChartModal.isStable = 'stable' })