summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzyh <[email protected]>2024-07-03 16:41:05 +0800
committerzyh <[email protected]>2024-07-03 16:41:05 +0800
commit09d48656c91ee6975a32d5a0a3e1c62b46c80ffb (patch)
tree5cfd954b78e54f4f6f16387aa5b3d893c7c7c9ef
parentab0f42b8c8e69cd1079203fbc02d1b16cee98125 (diff)
NEZ-3496 fix: Notbook 删除后,二级页面依旧展示已删除的Notbook
-rw-r--r--nezha-fronted/src/components/common/bottomBox/nzBottomDataList.vue2
-rw-r--r--nezha-fronted/src/components/common/bottomBox/tabs/notebookTab.vue4
-rw-r--r--nezha-fronted/src/components/common/deleteButton.vue36
-rw-r--r--nezha-fronted/src/components/common/mixin/dataList.js11
-rw-r--r--nezha-fronted/src/components/common/mixin/routerPathParams.js48
-rw-r--r--nezha-fronted/src/components/common/table/settings/dcTable.vue2
-rw-r--r--nezha-fronted/src/components/page/config/dc.vue2
-rw-r--r--nezha-fronted/src/components/page/monitor/project/projectList.vue4
8 files changed, 52 insertions, 57 deletions
diff --git a/nezha-fronted/src/components/common/bottomBox/nzBottomDataList.vue b/nezha-fronted/src/components/common/bottomBox/nzBottomDataList.vue
index 53d89c3c2..7db72407b 100644
--- a/nezha-fronted/src/components/common/bottomBox/nzBottomDataList.vue
+++ b/nezha-fronted/src/components/common/bottomBox/nzBottomDataList.vue
@@ -172,7 +172,7 @@ export default {
},
showDeleteTableRel (n) {
if (!n) {
- this.$parent.getTableData()
+ this.$parent.getTableData && this.$parent.getTableData()
}
}
},
diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/notebookTab.vue b/nezha-fronted/src/components/common/bottomBox/tabs/notebookTab.vue
index fdc33a728..24816f525 100644
--- a/nezha-fronted/src/components/common/bottomBox/tabs/notebookTab.vue
+++ b/nezha-fronted/src/components/common/bottomBox/tabs/notebookTab.vue
@@ -590,14 +590,16 @@ export default {
this.notebookLoading = true
if (this.obj.id) {
this.$get('/visual/notebook/' + this.obj.id).then(response => {
+ this.notebookLoading = false
if (response.code === 200) {
- this.notebookLoading = false
this.dataList = response.data.charts.map(item => {
return {
...item,
loaded: false
}
})
+ } else {
+ this.$message.error(response.msg)
}
})
} else {
diff --git a/nezha-fronted/src/components/common/deleteButton.vue b/nezha-fronted/src/components/common/deleteButton.vue
index 96d57d7a6..b5426ec27 100644
--- a/nezha-fronted/src/components/common/deleteButton.vue
+++ b/nezha-fronted/src/components/common/deleteButton.vue
@@ -124,14 +124,14 @@ export default {
type: String,
default: 'project.topology.data'
},
- single: { // 是否需要强制删除
+ single: {
type: Boolean
}
},
inject: ['getTableData', 'delCallBack'],
methods: {
batchDelete: function () {
- if (!this.single) {
+ setTimeout(() => {
this.$emit('before')
if (this.deleteObjs.length < 1) return
if (this.clickFunction) {
@@ -149,32 +149,11 @@ export default {
})
this.checkAll = true
this.idStr = this.deleteData.map(item => item.id)
+ if (this.from == 'backup') {
+ this.backupName = this.deleteData.map(item => item.fileName)
+ }
this.dialogVisible = true
- } else {
- setTimeout(() => {
- this.$emit('before')
- if (this.deleteObjs.length < 1) return
- if (this.clickFunction) {
- this.clickFunction()
- return
- }
- this.idShow = true
- this.prepare = true
- this.process = false
- this.finish = false
- this.forceDelete = 0
- this.deleteData = this.$lodash.cloneDeep(this.deleteObjs).map(item => {
- item.type = this.from
- return item
- })
- this.checkAll = true
- this.idStr = this.deleteData.map(item => item.id)
- if (this.from == 'backup') {
- this.backupName = this.deleteData.map(item => item.fileName)
- }
- this.dialogVisible = true
- }, 50)
- }
+ }, 50)
},
handleClose () {
this.dialogVisible = false
@@ -213,7 +192,7 @@ export default {
})
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.deleteSuccess') })
if (this.delCallBack) {
- this.delCallBack(this.idStr)
+ this.delCallBack(this.idStr, this.from)
}
// this.$emit('after')
} else {
@@ -259,7 +238,6 @@ export default {
selectIcon (type) {
switch (type) {
case 'asset' : return 'nz-icon monitorColor nz-icon-overview-project'
- case 'datacenter' : return 'nz-icon monitorColor nz-icon-Datacenter2'
case 'dc' : return 'nz-icon monitorColor nz-icon-Datacenter2'
case 'project' : return 'nz-icon monitorColor nz-icon-project'
case 'module' : return 'nz-icon monitorColor nz-icon-overview-module'
diff --git a/nezha-fronted/src/components/common/mixin/dataList.js b/nezha-fronted/src/components/common/mixin/dataList.js
index 6d795d626..907c65b83 100644
--- a/nezha-fronted/src/components/common/mixin/dataList.js
+++ b/nezha-fronted/src/components/common/mixin/dataList.js
@@ -58,6 +58,17 @@ export default {
}
},
methods: {
+ // 打开底部二级页面时 若删除此数据 关闭底部二级页面
+ delCallBack (ids, from) {
+ const dataList = this.$refs.dataList
+ if ((dataList && dataList.from == from) && (dataList.bottomBox && dataList.bottomBox.showSubList)) {
+ console.log(dataList.bottomBox.object)
+ console.log(dataList.bottomBox.object.id)
+ if (ids.indexOf(dataList.bottomBox.object.id) !== -1) {
+ dataList.bottomBox.showSubList = false
+ }
+ }
+ },
sortableShow: tableSet.sortableShow,
propTitle: tableSet.propTitle,
asce: tableSet.asce,
diff --git a/nezha-fronted/src/components/common/mixin/routerPathParams.js b/nezha-fronted/src/components/common/mixin/routerPathParams.js
index 53fec37aa..ebe6f3a21 100644
--- a/nezha-fronted/src/components/common/mixin/routerPathParams.js
+++ b/nezha-fronted/src/components/common/mixin/routerPathParams.js
@@ -61,7 +61,7 @@ export default {
if (this.detailType) {
params.detailType = this.detailType
}
- if (this.detailType === 'list' && this.$refs[detailType] && this.$refs[detailType].bottomBox) {
+ if (this.detailType === 'list' && this.$refs[detailType] && this.$refs[detailType].bottomBox) {
params.bottomBox = this.$refs[detailType].bottomBox.showSubList
params.targetTab = this.$refs[detailType].bottomBox.targetTab
} else {
@@ -71,30 +71,34 @@ export default {
if (!params.targetTab) delete params.targetTab
if (!params.bottomBox) delete params.bottomBox
if (this.detailType === 'list' && this.$refs[detailType]) {
- const obj = {
- id: this.$refs[detailType].bottomBox.object.id,
- name: this.$refs[detailType].bottomBox.object.name,
- typeId: this.$refs[detailType].bottomBox.object.typeId,
- childrenNum: this.$refs[detailType].bottomBox.object.childrenNum || '',
- clientState: this.$refs[detailType].bottomBox.object.clientState || '',
- protocol: this.$refs[detailType].bottomBox.object.protocol || '',
- uuid: this.$refs[detailType].bottomBox.object.uuid || '',
- startTime: this.$refs[detailType].bottomBox.object.startTime || '',
- model: {
- tsgAppliance: this.$refs[detailType].bottomBox.object.model ? this.$refs[detailType].bottomBox.object.model.tsgAppliance : ''
+ if (params.bottomBox) {
+ const obj = {
+ id: this.$refs[detailType].bottomBox.object.id,
+ name: this.$refs[detailType].bottomBox.object.name,
+ typeId: this.$refs[detailType].bottomBox.object.typeId,
+ childrenNum: this.$refs[detailType].bottomBox.object.childrenNum || '',
+ clientState: this.$refs[detailType].bottomBox.object.clientState || '',
+ protocol: this.$refs[detailType].bottomBox.object.protocol || '',
+ uuid: this.$refs[detailType].bottomBox.object.uuid || '',
+ startTime: this.$refs[detailType].bottomBox.object.startTime || '',
+ model: {
+ tsgAppliance: this.$refs[detailType].bottomBox.object.model ? this.$refs[detailType].bottomBox.object.model.tsgAppliance : ''
+ }
}
- }
- if (this.$refs[detailType].bottomBox.object.configs) {
+ if (this.$refs[detailType].bottomBox.object.configs) {
// 判断是JSON字符串还是对象
- if (typeof (this.$refs[detailType].bottomBox.object.configs) == 'string') {
- obj.configs = JSON.parse(this.$refs[detailType].bottomBox.object.configs).map(item => { return { type: item.type, enable: item.enable } })
- } else {
- obj.configs = this.$refs[detailType].bottomBox.object.configs.map(item => { return { type: item.type, enable: item.enable } })
+ if (typeof (this.$refs[detailType].bottomBox.object.configs) == 'string') {
+ obj.configs = JSON.parse(this.$refs[detailType].bottomBox.object.configs).map(item => { return { type: item.type, enable: item.enable } })
+ } else {
+ obj.configs = this.$refs[detailType].bottomBox.object.configs.map(item => { return { type: item.type, enable: item.enable } })
+ }
}
- }
- this.removeEmpty(obj)
- if (JSON.stringify(obj) != '{}') {
- params.selectObj = JSON.stringify(obj)
+ this.removeEmpty(obj)
+ if (JSON.stringify(obj) != '{}') {
+ params.selectObj = JSON.stringify(obj)
+ }
+ } else {
+ delete params.targetTab
}
} else if (this.$refs[detailType] && this.$refs[detailType].detailViewRightObj) {
this.$nextTick(() => {
diff --git a/nezha-fronted/src/components/common/table/settings/dcTable.vue b/nezha-fronted/src/components/common/table/settings/dcTable.vue
index edbb78a6f..1c40ceb6e 100644
--- a/nezha-fronted/src/components/common/table/settings/dcTable.vue
+++ b/nezha-fronted/src/components/common/table/settings/dcTable.vue
@@ -118,7 +118,7 @@
<el-dropdown-item v-has="'dc_edit'" :command="['edit', scope.row]"><i class="nz-icon nz-icon-edit"></i><span class="operation-dropdown-text">{{$t('overall.edit')}}</span></el-dropdown-item>
<el-dropdown-item v-has="'dc_edit'" :command="['copy', scope.row]"><i class="nz-icon nz-icon-override"></i><span class="operation-dropdown-text">{{$t('overall.duplicate')}}</span></el-dropdown-item>
<el-dropdown-item v-has="'dc_delete'" :command="['delete-rel', scope.row, {forceDeleteShow:true, single:true,from:'dc'}]"><i class="nz-icon nz-icon-delete"></i><span class="operation-dropdown-text">{{$t('overall.delete')}}</span></el-dropdown-item>
- <el-dropdown-item v-has="'asset_add'" :command="['topology', scope.row, 'datacenter']"><i class="nz-icon nz-icon-Topology"></i><span class="operation-dropdown-text">{{$t('overall.topology')}}</span></el-dropdown-item>
+ <el-dropdown-item v-has="'asset_add'" :command="['topology', scope.row, 'dc']"><i class="nz-icon nz-icon-Topology"></i><span class="operation-dropdown-text">{{$t('overall.topology')}}</span></el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
diff --git a/nezha-fronted/src/components/page/config/dc.vue b/nezha-fronted/src/components/page/config/dc.vue
index 9ea15c5de..48f51cc8b 100644
--- a/nezha-fronted/src/components/page/config/dc.vue
+++ b/nezha-fronted/src/components/page/config/dc.vue
@@ -110,7 +110,7 @@
<delete-button
ref="deleteButton"
:single="false"
- :from="'datacenter'"
+ :from="'dc'"
:forceDeleteShow="true"
:deleteTitle="'overall.dc'"
:type="'link'"
diff --git a/nezha-fronted/src/components/page/monitor/project/projectList.vue b/nezha-fronted/src/components/page/monitor/project/projectList.vue
index fde3b187c..e7bea1dc2 100644
--- a/nezha-fronted/src/components/page/monitor/project/projectList.vue
+++ b/nezha-fronted/src/components/page/monitor/project/projectList.vue
@@ -195,8 +195,8 @@ export default {
}
})
},
- delCallBack (id) {
- if (id.indexOf(this.$store.state.currentProject.id) !== -1) {
+ delCallBack (ids) {
+ if (ids.indexOf(this.$store.state.currentProject.id) !== -1) {
this.$store.commit('currentProjectChange', {
id: '',
name: '',