NEZ-2413 feat : module编辑页面支持 dashboard template配置项

This commit is contained in:
likexuan
2022-11-23 11:09:05 +08:00
parent 0b86d37b40
commit be2a972bad
3 changed files with 30 additions and 30 deletions

View File

@@ -52,7 +52,7 @@
:data="dashboardList" :data="dashboardList"
:tb-columns="DashboardSearchShowFields" :tb-columns="DashboardSearchShowFields"
:params="{ :params="{
varType: 1,}" varType: 1,type: 'template'}"
:multiple="false" :multiple="false"
:language="language" :language="language"
title="DashboardSearch" title="DashboardSearch"
@@ -183,7 +183,7 @@ export default {
if (valid) { if (valid) {
const params = { const params = {
...this.editModel, ...this.editModel,
panelId: Number(this.editModel.panelId), panelId: Number(this.editModel.panelId)
} }
if (this.editModel.id) { if (this.editModel.id) {
this.$put(this.url, params).then(res => { this.$put(this.url, params).then(res => {
@@ -264,7 +264,7 @@ export default {
// }, // },
/* 获取Dashboard列表数据 */ /* 获取Dashboard列表数据 */
DashboardTemplateList () { 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 this.dashboardList = res.data.list
}) })
}, },

View File

@@ -60,23 +60,22 @@
size="small" size="small"
></el-autocomplete> ></el-autocomplete>
</el-form-item> </el-form-item>
<!-- ChartTemplate --> <!-- DashboardTemplate -->
<el-form-item :label="$t('overall.chartTemplate')" prop="ChartTemplate"> <el-form-item :label="$t('model.dashboardtemplate')" prop="DashboardTemplate">
<v-selectpage <v-selectpage
:data="chartTempList" :data="dashboardList"
:tb-columns="ChartSearchShowFields" :tb-columns="DashboardSearchShowFields"
:params="{ :params="{
varType: 2, panelId: 0, varType: 2,type: 'template'}"
returnChildren:0,groupId:0, :multiple="false"
}"
:multiple="true"
:language="language" :language="language"
title="ChartSearch" title="DashboardSearch"
key-field="id" key-field="id"
:width="640"
v-model="editModule.panelId"
show-field="name" show-field="name"
:width="626"
v-model="editModule.chartIds"
class="form-control" class="form-control"
@values="(data) => {editModule.panelId = data.map(d => d.id).join(',')}"
:result-format="resultFormat" :result-format="resultFormat"
></v-selectpage> ></v-selectpage>
</el-form-item> </el-form-item>
@@ -738,7 +737,7 @@ export default {
requirdRelabel (rule, value, callback) { requirdRelabel (rule, value, callback) {
callback() callback()
}, },
chartTempList: [], dashboardList: [], // dashboard 列表数据
activeName: 'Basic', activeName: 'Basic',
activeNameLogs: ['Basic'], activeNameLogs: ['Basic'],
pipelineOptionValue: '', pipelineOptionValue: '',
@@ -749,7 +748,7 @@ export default {
{ value: '{{module.name}}-{{asset.name}}' }, { value: '{{module.name}}-{{asset.name}}' },
{ value: '{{module.name}}-{{asset.manageIp}}' } { value: '{{module.name}}-{{asset.manageIp}}' }
], ],
ChartSearchShowFields: [ // ChartSearch 下拉搜索表头 DashboardSearchShowFields: [ // DashboardSearch 下拉搜索表头
{ title: 'ID', data: 'id' }, { title: 'ID', data: 'id' },
{ {
title: this.$t('overall.name'), title: this.$t('overall.name'),
@@ -761,7 +760,6 @@ export default {
}, },
key: 'name' key: 'name'
}, },
{ title: this.$t('overall.type'), data: 'type', key: 'type' },
{ {
title: this.$t('overall.remark'), title: this.$t('overall.remark'),
data: function (row) { data: function (row) {
@@ -1111,6 +1109,7 @@ export default {
} }
if (valid) { if (valid) {
this.prevent_opt.save = true this.prevent_opt.save = true
params.panelId = Number(this.editModule.panelId)
if (this.editModule.id) { if (this.editModule.id) {
this.$put('monitor/module', params).then(response => { this.$put('monitor/module', params).then(response => {
if (response.code === 200) { if (response.code === 200) {
@@ -1501,10 +1500,10 @@ export default {
return assetData return assetData
} }
}, },
/* 获取chart列表数据 */ /* 获取Dashboard列表数据 */
ChartTemplateList () { DashboardTemplateList () {
this.$get('visual/panel/chart', { pageSize: -1, varType: 2, panelId: 0, returnChildren: 0, groupId: 0 }).then(res => { this.$get('visual/panel', { pageSize: -1, varType: 2, type: 'template' }).then(res => {
this.chartTempList = res.data.list this.dashboardList = res.data.list
}) })
}, },
// 添加pipeline // 添加pipeline
@@ -1563,7 +1562,7 @@ export default {
this.getProjectList() this.getProjectList()
this.getCredential() this.getCredential()
this.getWalkData() this.getWalkData()
this.ChartTemplateList() this.DashboardTemplateList()
}, },
computed: { computed: {
mibName () { mibName () {
@@ -1580,6 +1579,7 @@ export default {
handler (n, o) { handler (n, o) {
this.isEdit = true this.isEdit = true
this.editModule = JSON.parse(JSON.stringify(n)) this.editModule = JSON.parse(JSON.stringify(n))
this.editModule.panelId = n.panelId ? n.panelId + '' : ''
this.activeName = 'Basic' this.activeName = 'Basic'
this.activeNameLogs = this.editModule.configs[1].config.map(() => 'Basic') this.activeNameLogs = this.editModule.configs[1].config.map(() => 'Basic')
this.logsCopyValue = this.editModule.configs[1].config.map(() => '') this.logsCopyValue = this.editModule.configs[1].config.map(() => '')

View File

@@ -194,7 +194,7 @@ export default {
name: '', name: '',
endpointNameTmpl: '{{module.name}}-{{asset.name}}', endpointNameTmpl: '{{module.name}}-{{asset.name}}',
port: '', port: '',
chartIds: '', panelId: '',
metricsEnable: 1, metricsEnable: 1,
configs: [ configs: [
{ {