From be2a972badc974cd00a303377ab7b4e17d11a657 Mon Sep 17 00:00:00 2001 From: likexuan Date: Wed, 23 Nov 2022 11:09:05 +0800 Subject: [PATCH] =?UTF-8?q?NEZ-2413=20feat=20:=20module=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=94=AF=E6=8C=81=20dashboard=20template?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rightBox/administration/modelBox.vue | 8 +-- .../components/common/rightBox/moduleBox.vue | 50 +++++++++---------- .../page/monitor/module/moduleList.vue | 2 +- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/nezha-fronted/src/components/common/rightBox/administration/modelBox.vue b/nezha-fronted/src/components/common/rightBox/administration/modelBox.vue index b5d3e9036..0bd39f6e2 100644 --- a/nezha-fronted/src/components/common/rightBox/administration/modelBox.vue +++ b/nezha-fronted/src/components/common/rightBox/administration/modelBox.vue @@ -52,7 +52,7 @@ :data="dashboardList" :tb-columns="DashboardSearchShowFields" :params="{ - varType: 1,}" + varType: 1,type: 'template'}" :multiple="false" :language="language" title="DashboardSearch" @@ -167,7 +167,7 @@ export default { this.getBrandList() this.modelTypeList() // this.ChartTemplateList() - this.DashboardTemplateList () + this.DashboardTemplateList() }, methods: { clickOutside () { @@ -183,7 +183,7 @@ export default { if (valid) { const params = { ...this.editModel, - panelId: Number(this.editModel.panelId), + panelId: Number(this.editModel.panelId) } if (this.editModel.id) { this.$put(this.url, params).then(res => { @@ -264,7 +264,7 @@ export default { // }, /* 获取Dashboard列表数据 */ DashboardTemplateList () { - this.$get('visual/panel', { pageSize: -1, varType: 1}).then(res => { + this.$get('visual/panel', { pageSize: -1, varType: 1, type: 'template' }).then(res => { this.dashboardList = res.data.list }) }, diff --git a/nezha-fronted/src/components/common/rightBox/moduleBox.vue b/nezha-fronted/src/components/common/rightBox/moduleBox.vue index 91e7854cd..93a6e7e52 100644 --- a/nezha-fronted/src/components/common/rightBox/moduleBox.vue +++ b/nezha-fronted/src/components/common/rightBox/moduleBox.vue @@ -60,24 +60,23 @@ size="small" > - - + + @@ -738,7 +737,7 @@ export default { requirdRelabel (rule, value, callback) { callback() }, - chartTempList: [], + dashboardList: [], // dashboard 列表数据 activeName: 'Basic', activeNameLogs: ['Basic'], pipelineOptionValue: '', @@ -749,7 +748,7 @@ export default { { value: '{{module.name}}-{{asset.name}}' }, { value: '{{module.name}}-{{asset.manageIp}}' } ], - ChartSearchShowFields: [ // ChartSearch 下拉搜索表头 + DashboardSearchShowFields: [ // DashboardSearch 下拉搜索表头 { title: 'ID', data: 'id' }, { title: this.$t('overall.name'), @@ -761,7 +760,6 @@ export default { }, key: 'name' }, - { title: this.$t('overall.type'), data: 'type', key: 'type' }, { title: this.$t('overall.remark'), data: function (row) { @@ -1111,6 +1109,7 @@ export default { } if (valid) { this.prevent_opt.save = true + params.panelId = Number(this.editModule.panelId) if (this.editModule.id) { this.$put('monitor/module', params).then(response => { if (response.code === 200) { @@ -1501,10 +1500,10 @@ export default { return assetData } }, - /* 获取chart列表数据 */ - ChartTemplateList () { - this.$get('visual/panel/chart', { pageSize: -1, varType: 2, panelId: 0, returnChildren: 0, groupId: 0 }).then(res => { - this.chartTempList = res.data.list + /* 获取Dashboard列表数据 */ + DashboardTemplateList () { + this.$get('visual/panel', { pageSize: -1, varType: 2, type: 'template' }).then(res => { + this.dashboardList = res.data.list }) }, // 添加pipeline @@ -1563,7 +1562,7 @@ export default { this.getProjectList() this.getCredential() this.getWalkData() - this.ChartTemplateList() + this.DashboardTemplateList() }, computed: { mibName () { @@ -1580,6 +1579,7 @@ export default { handler (n, o) { this.isEdit = true this.editModule = JSON.parse(JSON.stringify(n)) + this.editModule.panelId = n.panelId ? n.panelId + '' : '' this.activeName = 'Basic' this.activeNameLogs = this.editModule.configs[1].config.map(() => 'Basic') this.logsCopyValue = this.editModule.configs[1].config.map(() => '') diff --git a/nezha-fronted/src/components/page/monitor/module/moduleList.vue b/nezha-fronted/src/components/page/monitor/module/moduleList.vue index bcf87e4eb..9adce7d57 100644 --- a/nezha-fronted/src/components/page/monitor/module/moduleList.vue +++ b/nezha-fronted/src/components/page/monitor/module/moduleList.vue @@ -194,7 +194,7 @@ export default { name: '', endpointNameTmpl: '{{module.name}}-{{asset.name}}', port: '', - chartIds: '', + panelId: '', metricsEnable: 1, configs: [ {