Merge branch 'dev-3.4' of git.mesalab.cn:nezha/nezha-fronted into dev-3.4
This commit is contained in:
@@ -546,22 +546,24 @@ export default {
|
|||||||
},
|
},
|
||||||
variablesReplace (expression) {
|
variablesReplace (expression) {
|
||||||
let str = expression
|
let str = expression
|
||||||
let confirmReg = ''
|
let confirmReg = []
|
||||||
let confirmRegItem = ''
|
|
||||||
this.variablesArr.forEach(item => {
|
this.variablesArr.forEach(item => {
|
||||||
const reg = '$' + item.name // 后续需要考虑 item,name 使用特殊字符的问题
|
const reg = '$' + item.name // 后续需要考虑 item,name 使用特殊字符的问题
|
||||||
const index = expression.indexOf(reg)
|
const index = expression.indexOf(reg)
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
if (reg.length > confirmReg.length) {
|
confirmReg.push(item)
|
||||||
confirmReg = reg
|
|
||||||
confirmRegItem = item
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if (confirmReg) {
|
confirmReg = this.$loadsh.orderBy(confirmReg, function (item) { // 根据 匹配的name的长度排序 避免匹配的 $a 没匹配 $asset的问题
|
||||||
const index = expression.indexOf(confirmReg)
|
console.log(item.name.length)
|
||||||
const replaceStr = confirmRegItem.checked.map(label => label.replace(/\"/g, '\\"').replace(/\'/g, "\\'")).join('|')
|
return item.name.length
|
||||||
str = str.substring(0, index) + replaceStr + str.substring(index + confirmReg.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
|
return str
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="item.key === 'trbShot' && activeName === 'trbShot'">
|
<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>
|
||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
@@ -108,7 +108,7 @@ export default {
|
|||||||
this.cardNames.push(item)
|
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({
|
this.cardNames.push({
|
||||||
key: 'trbShot',
|
key: 'trbShot',
|
||||||
label: this.$t('alert.config.trbShot')
|
label: this.$t('alert.config.trbShot')
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<!-- title -->
|
<!-- title -->
|
||||||
<div class="alert-label-header-title">
|
<div class="alert-label-header-title">
|
||||||
<span>
|
<span>
|
||||||
{{$t('overall.version')}} :
|
Version :
|
||||||
</span>
|
</span>
|
||||||
<span class="alert-label-header-text">
|
<span class="alert-label-header-text">
|
||||||
{{ that && that.version ? that.version : "--" }}
|
{{ that && that.version ? that.version : "--" }}
|
||||||
@@ -19,27 +19,27 @@
|
|||||||
<!-- body -->
|
<!-- body -->
|
||||||
<div class="alert-label-box">
|
<div class="alert-label-box">
|
||||||
<span :class="that.auth ? 'green-bg' : 'red-bg'" class="active-icon"></span>
|
<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>
|
||||||
<div class="alert-label-box" v-if="that.prometheus">
|
<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="{'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>
|
||||||
<div class="alert-label-box" v-if="that.cortex">
|
<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="{'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>
|
||||||
<div class="alert-label-box" v-if="that.loki">
|
<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="{'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>
|
||||||
<div class="alert-label-box" v-if="that.snmp_exporter">
|
<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="{'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>
|
||||||
<div class="alert-label-box" v-if="that.blackbox_exporter">
|
<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="{'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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -124,7 +124,7 @@ export default {
|
|||||||
delete labelPosition.left
|
delete labelPosition.left
|
||||||
|
|
||||||
labelPosition.right =
|
labelPosition.right =
|
||||||
clientWidth - position.left - leftOffSetView - position.width * 3.5 + 'px'
|
clientWidth - position.left - leftOffSetView - position.width * 4 + 'px'
|
||||||
}
|
}
|
||||||
return labelPosition
|
return labelPosition
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -507,6 +507,9 @@ export default {
|
|||||||
method: this.editAlertRule.method.join(','),
|
method: this.editAlertRule.method.join(','),
|
||||||
type: this.editAlertRule.type
|
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) => {
|
this.$refs.alertRuleForm.validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
params.receiver = this.editAlertRule.receiverShow.join(',')
|
params.receiver = this.editAlertRule.receiverShow.join(',')
|
||||||
|
|||||||
@@ -150,7 +150,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<!-- visibility -->
|
<!-- visibility -->
|
||||||
<div>
|
<div v-if="params.type === 'group'">
|
||||||
<div class="form__sub-title">
|
<div class="form__sub-title">
|
||||||
<span>{{$t('dashboard.panel.showHidden')}}</span>
|
<span>{{$t('dashboard.panel.showHidden')}}</span>
|
||||||
<el-switch
|
<el-switch
|
||||||
|
|||||||
@@ -680,7 +680,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- visibility -->
|
<!-- visibility -->
|
||||||
<div>
|
<div v-if="params.type === 'group'">
|
||||||
<div class="form__sub-title">
|
<div class="form__sub-title">
|
||||||
<span>{{$t('dashboard.panel.showHidden')}}</span>
|
<span>{{$t('dashboard.panel.showHidden')}}</span>
|
||||||
<el-switch
|
<el-switch
|
||||||
|
|||||||
@@ -338,7 +338,7 @@ export default {
|
|||||||
{ key: 'Down', value: 0, name: 'Down' },
|
{ key: 'Down', value: 0, name: 'Down' },
|
||||||
{ key: 'Up', value: 1, name: 'Up' }
|
{ key: 'Up', value: 1, name: 'Up' }
|
||||||
],
|
],
|
||||||
show: true,
|
show: false,
|
||||||
showMore: false,
|
showMore: false,
|
||||||
width: 0,
|
width: 0,
|
||||||
index: -1
|
index: -1
|
||||||
@@ -404,7 +404,7 @@ export default {
|
|||||||
{ key: 'Down', id: 0, name: 'Down' },
|
{ key: 'Down', id: 0, name: 'Down' },
|
||||||
{ key: 'Up', id: 1, name: 'Up' }
|
{ key: 'Up', id: 1, name: 'Up' }
|
||||||
],
|
],
|
||||||
show: true,
|
show: false,
|
||||||
showMore: false,
|
showMore: false,
|
||||||
dropShow: false,
|
dropShow: false,
|
||||||
width: 0,
|
width: 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user