summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzyh <[email protected]>2024-07-03 11:16:11 +0800
committerzyh <[email protected]>2024-07-03 11:16:11 +0800
commit06f915565da2ca751ca7a65458dcdb7e8726f444 (patch)
treeae6c0a4ebb2d90eabf0e5410b01320d7bf2d2bd8
parent4c5349ad83cb72fac993e93338bec182adb02a1d (diff)
NEZ-3495 fix: notebook 数据源为system时保存无效dev-3.9
-rw-r--r--nezha-fronted/src/components/common/bottomBox/tabs/notebookTab.vue28
1 files 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'
})