diff --git a/nezha-fronted/src/components/common/language/cn.js b/nezha-fronted/src/components/common/language/cn.js index 886643e1f..ae931fd84 100644 --- a/nezha-fronted/src/components/common/language/cn.js +++ b/nezha-fronted/src/components/common/language/cn.js @@ -604,7 +604,8 @@ const cn = { confirmDuplicate: '确认复制吗?', confirmCancel: '您所做的修改将不会被保存?', copySuccess: '复制成功', - lnglatError: '经纬度格式错误' + lnglatError: '经纬度格式错误', + tagError: '不符合正则 /^[a-zA-Z_][a-zA-Z0-9_]*/!' }, asset: { asset: '资产', diff --git a/nezha-fronted/src/components/common/language/en.js b/nezha-fronted/src/components/common/language/en.js index e1c6f1852..d57c98ec4 100644 --- a/nezha-fronted/src/components/common/language/en.js +++ b/nezha-fronted/src/components/common/language/en.js @@ -611,7 +611,8 @@ const en = { confirmDuplicate: 'Are you sure to duplicate this chart?', confirmCancel: 'Changes you made are not saved?', copySuccess: 'Copy success', - lnglatError: 'Wrong format of latitude and longitude' + lnglatError: 'Wrong format of latitude and longitude', + tagError: 'Does not conform to regular expressions /^[a-zA-Z_][a-zA-Z0-9_]*/!' }, asset: { asset: 'Asset ', diff --git a/nezha-fronted/src/components/common/rightBox/editEndpointBoxNew.vue b/nezha-fronted/src/components/common/rightBox/editEndpointBoxNew.vue index c9207f465..1f1b04d70 100644 --- a/nezha-fronted/src/components/common/rightBox/editEndpointBoxNew.vue +++ b/nezha-fronted/src/components/common/rightBox/editEndpointBoxNew.vue @@ -245,33 +245,57 @@
- - - - - + + - + + + +
- - + + - - + +
@@ -1120,6 +1144,19 @@ export default { tagsChange (newTags, index) { this.editEndpoint.paramObj[index].value = newTags.map(item => item.text) }, + beforeAddingTag (tag) { + const regx = /[a-zA-Z_:][a-zA-Z0-9_:]*/ + if (regx.test(tag.tag.text)) { + tag.addTag() + } else { + this.$message.error(this.$t('tip.tagError')) + } + }, + relabelTabBlur (tag) { + this.$nextTick(() => { + this.$refs.relabelTag[0].newTag = '' + }) + }, // 将param转为json字符串格式 paramToJson (param) { const tempParam = {} @@ -1412,6 +1449,9 @@ export default { }, actionChange (index) { this.$refs.moduleForm.clearValidate('configs.0.config.relabel_config.' + index + '.target_label') + this.$refs.moduleForm.clearValidate('configs.0.config.relabel_config.' + index + '.source_labels') + this.$refs.moduleForm.clearValidate('configs.0.config.relabel_config.' + index + '.regex') + this.$refs.moduleForm.clearValidate('configs.0.config.relabel_config.' + index + '.replacement') }, addRelabel () { this.editEndpoint.configs[0].config.relabel_config.push({ diff --git a/nezha-fronted/src/components/common/rightBox/moduleBox.vue b/nezha-fronted/src/components/common/rightBox/moduleBox.vue index 8afec7e92..397ca3526 100644 --- a/nezha-fronted/src/components/common/rightBox/moduleBox.vue +++ b/nezha-fronted/src/components/common/rightBox/moduleBox.vue @@ -226,21 +226,37 @@
- - - - - + + - + + + +
@@ -248,11 +264,19 @@
- + - +
@@ -536,7 +560,7 @@