Merge branch 'dev-3.4' of git.mesalab.cn:nezha/nezha-fronted into dev-3.4

This commit is contained in:
zyh
2022-07-21 19:39:30 +08:00
8 changed files with 30 additions and 25 deletions

View File

@@ -546,22 +546,24 @@ export default {
},
variablesReplace (expression) {
let str = expression
let confirmReg = ''
let confirmRegItem = ''
let confirmReg = []
this.variablesArr.forEach(item => {
const reg = '$' + item.name // 后续需要考虑 item,name 使用特殊字符的问题
const index = expression.indexOf(reg)
if (index !== -1) {
if (reg.length > confirmReg.length) {
confirmReg = reg
confirmRegItem = item
}
confirmReg.push(item)
}
})
if (confirmReg) {
const index = expression.indexOf(confirmReg)
const replaceStr = confirmRegItem.checked.map(label => label.replace(/\"/g, '\\"').replace(/\'/g, "\\'")).join('|')
str = str.substring(0, index) + replaceStr + str.substring(index + confirmReg.length)
confirmReg = this.$loadsh.orderBy(confirmReg, function (item) { // 根据 匹配的name的长度排序 避免匹配的 $a 没匹配 $asset的问题
console.log(item.name.length)
return item.name.length
}, 'desc')
console.log(confirmReg)
if (confirmReg.length) {
confirmReg.forEach(item => {
const reg = new RegExp('\\$' + item.name, 'g') // 后续需要考虑 item,name 使用特殊字符的问题
str = str.replace(reg, item.checked.map(label => label.replace(/\"/g, '\\"').replace(/\'/g, "\\'")).join('|'))
})
}
return str
},

View File

@@ -23,7 +23,7 @@
/>
</div>
<div v-else-if="item.key === 'trbShot' && activeName === 'trbShot'">
<div v-html="infoData.alertRule.trbShot">
<div v-html="infoData.alertRule.trbShot" v-if="infoData.alertRule.trbShot">
</div>
</div>
</el-tab-pane>
@@ -108,7 +108,7 @@ export default {
this.cardNames.push(item)
}
})
if (n.alertRule && n.alertRule.trbShot) {
if (n.alertRule && n.alertRule.trbShot && n.alertRule.trbShot != '<div class="editor-core ql-container ql-snow"><div class="ql-editor"><p><br></p></div></div>') {
this.cardNames.push({
key: 'trbShot',
label: this.$t('alert.config.trbShot')

View File

@@ -10,7 +10,7 @@
<!-- title -->
<div class="alert-label-header-title">
<span>
{{$t('overall.version')}} :
Version :
</span>
<span class="alert-label-header-text">
{{ that && that.version ? that.version : "--" }}
@@ -19,27 +19,27 @@
<!-- body -->
<div class="alert-label-box">
<span :class="that.auth ? 'green-bg' : 'red-bg'" class="active-icon"></span>
<span class="alert-label-value">{{$t('overall.auth')}}</span>
<span class="alert-label-value">Auth</span>
</div>
<div class="alert-label-box" v-if="that.prometheus">
<span :class="{'green-bg': that.prometheus == 'UP','red-bg': that.prometheus == 'DOWN'}" class="active-icon"></span>
<span class="alert-label-value">{{$t('dashboard.overview.mapTooltip.prometheus')}}</span>
<span class="alert-label-value">Prometheus</span>
</div>
<div class="alert-label-box" v-if="that.cortex">
<span :class="{'green-bg': that.cortex == 'UP','red-bg': that.cortex == 'DOWN', 'gray-bg': that.cortex == 'UNAVAILABLE'}" class="active-icon"></span>
<span class="alert-label-value">{{$t('overall.cortex')}}</span>
<span class="alert-label-value">Cortex</span>
</div>
<div class="alert-label-box" v-if="that.loki">
<span :class="{'green-bg': that.loki == 'UP','red-bg': that.loki == 'DOWN','gray-bg': that.loki == 'UNAVAILABLE'}" class="active-icon"></span>
<span class="alert-label-value">{{$t('overall.loki')}}</span>
<span class="alert-label-value">Loki</span>
</div>
<div class="alert-label-box" v-if="that.snmp_exporter">
<span :class="{'green-bg': that.snmp_exporter == 'UP','red-bg': that.snmp_exporter == 'DOWN'}" class="active-icon"></span>
<span class="alert-label-value">{{$t('overall.snmp_exporter')}}</span>
<span class="alert-label-value">SNMP exporter</span>
</div>
<div class="alert-label-box" v-if="that.blackbox_exporter">
<span :class="{'green-bg': that.blackbox_exporter == 'UP','red-bg': that.blackbox_exporter == 'DOWN'}" class="active-icon"></span>
<span class="alert-label-value">{{$t('overall.blackbox_exporter')}}</span>
<span class="alert-label-value">Blackbox exporter</span>
</div>
</div>
</div>
@@ -124,7 +124,7 @@ export default {
delete labelPosition.left
labelPosition.right =
clientWidth - position.left - leftOffSetView - position.width * 3.5 + 'px'
clientWidth - position.left - leftOffSetView - position.width * 4 + 'px'
}
return labelPosition
}

View File

@@ -1,6 +1,6 @@
<template>
<div class="info-content pop-data-info-content" v-if="showInfo">
<div class="info-box"v-my-loading="loading">
<div class="info-box" v-my-loading="loading">
<div class="info-box-title">{{$t('overall.module')}} {{$t('project.topo.icon.info')}}</div>
<div class="info-box-content">
<div class="content-box">

View File

@@ -507,6 +507,9 @@ export default {
method: this.editAlertRule.method.join(','),
type: this.editAlertRule.type
}
if (this.editAlertRule.trbShot && this.editAlertRule.trbShot == '<div class="editor-core ql-container ql-snow"><div class="ql-editor"><p><br></p></div></div>') {
this.editAlertRule.trbShot = ''
}
this.$refs.alertRuleForm.validate((valid) => {
if (valid) {
params.receiver = this.editAlertRule.receiverShow.join(',')

View File

@@ -150,7 +150,7 @@
</el-form-item>
<!-- visibility -->
<div>
<div v-if="params.type === 'group'">
<div class="form__sub-title">
<span>{{$t('dashboard.panel.showHidden')}}</span>
<el-switch

View File

@@ -680,7 +680,7 @@
</div>
<!-- visibility -->
<div>
<div v-if="params.type === 'group'">
<div class="form__sub-title">
<span>{{$t('dashboard.panel.showHidden')}}</span>
<el-switch

View File

@@ -338,7 +338,7 @@ export default {
{ key: 'Down', value: 0, name: 'Down' },
{ key: 'Up', value: 1, name: 'Up' }
],
show: true,
show: false,
showMore: false,
width: 0,
index: -1
@@ -404,7 +404,7 @@ export default {
{ key: 'Down', id: 0, name: 'Down' },
{ key: 'Up', id: 1, name: 'Up' }
],
show: true,
show: false,
showMore: false,
dropShow: false,
width: 0,