删除插件
@@ -164,18 +166,22 @@ export default {
),
onOk() {
deleteCITypeDiscovery(item.id).then(async () => {
- if (that.currentTab === item.adr_id) {
+ if (that.currentTab === item.id) {
that.currentTab = ''
}
- that.deletePlugin = false
that.$message.success('删除成功!')
that.getCITypeDiscovery()
if (that.deletePlugin) {
- await deleteDiscovery(item.adr_id)
+ await deleteDiscovery(item.adr_id).finally(() => {
+ that.deletePlugin = false
+ })
}
+ that.deletePlugin = false
})
},
- onCancel() {},
+ onCancel() {
+ that.deletePlugin = false
+ },
})
},
openEditDrawer(data, type, adType) {
@@ -183,12 +189,12 @@ export default {
},
async updateNotInner(adr) {
const _idx = this.adCITypeList.findIndex((item) => item.adr_id === adr.id)
+ let res
if (_idx < 0) {
- await postCITypeDiscovery(this.CITypeId, { adr_id: adr.id, interval: 300 })
+ res = await postCITypeDiscovery(this.CITypeId, { adr_id: adr.id, interval: 300 })
}
await this.getDiscovery()
- await this.getCITypeDiscovery()
- this.currentTab = adr.id
+ await this.getCITypeDiscovery(res?.id ?? undefined)
this.$nextTick(() => {
this.$refs[`attrAdTabpane_${this.currentTab}`][0].init()
})
diff --git a/cmdb-ui/src/modules/cmdb/views/ci_types/attrADTabpane.vue b/cmdb-ui/src/modules/cmdb/views/ci_types/attrADTabpane.vue
index 268cde8..7a2659c 100644
--- a/cmdb-ui/src/modules/cmdb/views/ci_types/attrADTabpane.vue
+++ b/cmdb-ui/src/modules/cmdb/views/ci_types/attrADTabpane.vue
@@ -14,6 +14,7 @@
编辑
+
Number(item.id) === Number(this.currentTab))
- const _findADT = this.adCITypeList.find((item) => Number(item.adr_id) === Number(this.currentTab))
+ const _find = this.adrList.find((item) => Number(item.id) === Number(this.adr_id))
+ const _findADT = this.adCITypeList.find((item) => Number(item.id) === Number(this.currentAdt.id))
+ this.alias = _findADT?.extra_option?.alias ?? ''
if (this.adrType === 'http') {
const { category = undefined, key = '', secret = '' } = _findADT?.extra_option ?? {}
this.form2 = {
@@ -294,7 +297,7 @@ export default {
this.cron = cron
},
handleSave() {
- const { currentAdt } = this
+ const { currentAdt, alias } = this
let params
if (this.adrType === 'http') {
params = {
@@ -360,9 +363,15 @@ export default {
return
}
}
-
+ if (params.extra_option) {
+ params.extra_option.alias = alias
+ } else {
+ params.extra_option = {}
+ params.extra_option.alias = alias
+ }
putCITypeDiscovery(currentAdt.id, params).then((res) => {
this.$message.success('保存成功')
+ this.$emit('handleSave')
})
},
handleOpenCmdb() {