From c6082adbce934d2cb9eeda0dfc574d83e45f23c5 Mon Sep 17 00:00:00 2001
From: Xiao Bai <2835066049@qq.com>
Date: Mon, 14 Nov 2022 12:27:07 +0800
Subject: [PATCH] =?UTF-8?q?NEZ-2380=20feat=20=EF=BC=9AAPM=20setting?=
=?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=A2=9E=E5=8A=A0=20interface=20name=20?=
=?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
---
.../common/mixin/system/systemMixin.js | 16 +++++++++++++-
.../src/components/page/config/monitor.vue | 22 ++++++++++++++++++-
2 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/nezha-fronted/src/components/common/mixin/system/systemMixin.js b/nezha-fronted/src/components/common/mixin/system/systemMixin.js
index fd725c7a0..615ae875f 100644
--- a/nezha-fronted/src/components/common/mixin/system/systemMixin.js
+++ b/nezha-fronted/src/components/common/mixin/system/systemMixin.js
@@ -81,7 +81,8 @@ export default {
metrics_storage_s3_endpoint: '',
metrics_storage_s3_secret_access_key: '',
metrics_storage_type: '',
- prometheus_federation_enabled: ''
+ prometheus_federation_enabled: '',
+ interface_name: []
},
monitorRules: {
// alert_api: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
@@ -253,6 +254,13 @@ export default {
this.$refs.emailForm.clearValidate()
}
if (type == 'monitor') {
+ if(response.data.interface_name){
+ let arr = response.data.interface_name.split(',')
+ this.monitor.interface_name = arr.map(item=>{
+ return {text: item}
+
+ })
+ }
localStorage.setItem('nz-prometheus-federation-enabled', this.monitor.prometheus_federation_enabled)
}
this[type + 'Copy'] = Object.assign({}, this[type])
@@ -270,6 +278,12 @@ export default {
param.map_center_config = JSON.stringify(mapConfig)
param.pin_policy = JSON.stringify(this.basic.pin_policy)
}
+ if(type == 'monitor') {
+ let str = this.monitor.interface_name.map(item=>{
+ return item.text
+ })
+ param.interface_name = str.join(',')
+ }
const postParam = Object.assign({}, param)
for (const key in postParam[type]) {
postParam[type][key] = postParam[type][key] + ''
diff --git a/nezha-fronted/src/components/page/config/monitor.vue b/nezha-fronted/src/components/page/config/monitor.vue
index d47506631..f5265aa0c 100644
--- a/nezha-fronted/src/components/page/config/monitor.vue
+++ b/nezha-fronted/src/components/page/config/monitor.vue
@@ -27,6 +27,15 @@