diff --git a/nezha-fronted/src/components/common/rightBox/batchAddEndpoint.vue b/nezha-fronted/src/components/common/rightBox/batchAddEndpoint.vue index 2833bdb19..7bb5cad36 100644 --- a/nezha-fronted/src/components/common/rightBox/batchAddEndpoint.vue +++ b/nezha-fronted/src/components/common/rightBox/batchAddEndpoint.vue @@ -283,7 +283,8 @@ export default { show: true, width: 150 } - ] + ], + endpointIndex: '' } }, methods: { @@ -383,7 +384,7 @@ export default { this.rightBox.show = false if (!isEdit) { return } this.batchEndpoint.tableData.forEach((item, index) => { - if (item.id === endpoint.id) { + if (index === this.endpointIndex) { this.batchEndpoint.tableData[index] = { ...endpoint } } }) @@ -392,7 +393,8 @@ export default { del (index) { this.batchEndpoint.tableData.splice(index, 1) }, - edit (row) { + edit (row, endpointIndex) { + this.endpointIndex = endpointIndex this.object = row // this.object.configs = JSON.parse(this.object.configs) this.object.projectId = this.object.project.id @@ -423,6 +425,17 @@ export default { } pipeline.labels = labelsArr } + if (pipeline.type === 'json') { + const expressionsArr = [] + if (JSON.stringify(pipeline.expressions) !== '{}' && pipeline.expressions) { + Object.keys(pipeline.expressions).forEach(key => { + expressionsArr.push({ key, value: pipeline.expressions[key] }) + }) + } else { + expressionsArr.push({ key: '', value: '' }) + } + pipeline.expressions = expressionsArr + } }) if (!item.pipeline) { item.pipeline = [] diff --git a/nezha-fronted/src/components/common/rightBox/editEndpointBoxNew.vue b/nezha-fronted/src/components/common/rightBox/editEndpointBoxNew.vue index 1cbc699c8..b7aad8fda 100644 --- a/nezha-fronted/src/components/common/rightBox/editEndpointBoxNew.vue +++ b/nezha-fronted/src/components/common/rightBox/editEndpointBoxNew.vue @@ -851,15 +851,16 @@ export default { }) } else if (this.optionType === 'batchAdd') { this.prevent_opt.save = true - this.$emit('close', true, this.editEndpoint, false) + params.configs = JSON.parse(params.configs) + this.$emit('close', true, params, false) this.prevent_opt.save = false } else if (this.optionType === 'batch') { this.prevent_opt.save = true if (this.editEndpoint.assetId) { - this.$emit('close', true, this.editEndpoint, false) + this.$emit('close', true, params, false) this.prevent_opt.save = false } else { - this.$emit('close', true, this.editEndpoint, true) + this.$emit('close', true, params, true) this.prevent_opt.save = false } } else if (this.optionType === 'edit') {