diff --git a/nezha-fronted/src/assets/css/font/iconfont.ttf b/nezha-fronted/src/assets/css/font/iconfont.ttf index 7743389f9..c92c1b537 100644 Binary files a/nezha-fronted/src/assets/css/font/iconfont.ttf and b/nezha-fronted/src/assets/css/font/iconfont.ttf differ diff --git a/nezha-fronted/src/assets/css/font/iconfont.woff b/nezha-fronted/src/assets/css/font/iconfont.woff index b892d136e..55b1b1e4b 100644 Binary files a/nezha-fronted/src/assets/css/font/iconfont.woff and b/nezha-fronted/src/assets/css/font/iconfont.woff differ diff --git a/nezha-fronted/src/assets/css/font/iconfont.woff2 b/nezha-fronted/src/assets/css/font/iconfont.woff2 index 5f053954d..de1a81430 100644 Binary files a/nezha-fronted/src/assets/css/font/iconfont.woff2 and b/nezha-fronted/src/assets/css/font/iconfont.woff2 differ diff --git a/nezha-fronted/src/assets/css/nzIcon.css b/nezha-fronted/src/assets/css/nzIcon.css index 586246232..8465d7ff6 100644 --- a/nezha-fronted/src/assets/css/nzIcon.css +++ b/nezha-fronted/src/assets/css/nzIcon.css @@ -1,8 +1,8 @@ @font-face { font-family: "nz-icon"; /* Project id 2030432 */ - src: url('./font/iconfont.woff2?t=1620354698424') format('woff2'), - url('./font/iconfont.woff?t=1620354698424') format('woff'), - url('./font/iconfont.ttf?t=1620354698424') format('truetype'); + src: url('./font/iconfont.woff2?t=1620386069576') format('woff2'), + url('./font/iconfont.woff?t=1620386069576') format('woff'), + url('./font/iconfont.ttf?t=1620386069576') format('truetype'); } .nz-icon { @@ -13,6 +13,10 @@ -moz-osx-font-smoothing: grayscale; } +.nz-icon-circle:before { + content: "\e62f"; +} + .nz-icon-guide:before { content: "\e725"; } diff --git a/nezha-fronted/src/components/common/language/cn.js b/nezha-fronted/src/components/common/language/cn.js index 458b106df..6a573e676 100644 --- a/nezha-fronted/src/components/common/language/cn.js +++ b/nezha-fronted/src/components/common/language/cn.js @@ -1112,7 +1112,7 @@ const cn = { create: '创建告警静默', edit: '修改告警静默', time: '时间', - matcher: 'Matcher', + matchers: 'matchers', reason: '描述', selectTime: '请选择时间', selectMather: '必填项', diff --git a/nezha-fronted/src/components/common/language/en.js b/nezha-fronted/src/components/common/language/en.js index ebea6191b..08ed86b1f 100644 --- a/nezha-fronted/src/components/common/language/en.js +++ b/nezha-fronted/src/components/common/language/en.js @@ -1074,7 +1074,7 @@ const en = { rule: 'Rule', // '规则' alertMessage: 'Alert message', // "告警信息" alertRule: 'Alert rule', // "告警规则" - alertName: 'Alert name', // "告警名称" + alertName: 'Name', // "告警名称" severity: 'Priority', // "等级" description: 'Description', // "描述" summary: 'Summary', // "概要" @@ -1132,7 +1132,7 @@ const en = { create: 'New alert silence', edit: 'Edit alert silence', time: 'Time', - matcher: 'Matcher', + matchers: 'matchers', reason: 'Description', selectTime: 'Please select time', selectMather: 'Required', diff --git a/nezha-fronted/src/components/common/rightBox/alertRuleBox.vue b/nezha-fronted/src/components/common/rightBox/alertRuleBox.vue index 5d35a228d..89a3e0a61 100644 --- a/nezha-fronted/src/components/common/rightBox/alertRuleBox.vue +++ b/nezha-fronted/src/components/common/rightBox/alertRuleBox.vue @@ -57,24 +57,16 @@ - - - - - - + + + + + {{item.name}} + -
- -
-

{{$t('alert.P1Rule')}}

-

{{$t('alert.P2Rule')}}

-

{{$t('alert.P3Rule')}}

-
-
+ + + + + + + @@ -150,7 +149,7 @@ export default { { required: true, message: this.$t('validate.required'), trigger: 'blur' }, { type: 'number', message: this.$t('validate.number') } ], - severity: [ + severityId: [ { required: true, message: this.$t('validate.required'), trigger: 'change' } ], summary: [ @@ -195,7 +194,9 @@ export default { ], unitOptions: chartDataFormat.unitOptions(), - userData: [] + userData: [], + severityData: [], + notifyData: [] } }, methods: { @@ -210,11 +211,15 @@ export default { if (this.prevent_opt.save) { return } ; this.prevent_opt.save = true this.editAlertRule.expr = this.expressions[0] + const params = { + ...this.editAlertRule, + method: this.editAlertRule.method.join(',') + } this.$refs.alertRuleForm.validate((valid) => { if (valid) { this.editAlertRule.receiver = this.editAlertRule.receiverShow.join(',') if (this.editAlertRule.id) { - this.$put('alert/rule', this.editAlertRule).then(response => { + this.$put('alert/rule', params).then(response => { this.prevent_opt.save = false if (response.code === 200) { this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') }) @@ -224,7 +229,7 @@ export default { } }) } else { - this.$post('alert/rule', this.editAlertRule).then(response => { + this.$post('alert/rule', params).then(response => { this.prevent_opt.save = false if (response.code === 200) { this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') }) @@ -270,10 +275,26 @@ export default { }, metricChange (val) { this.editAlertRule.expr = val + }, + getSeverityData () { + this.$get('alert/severity', { pageNo: 1, pageSize: -1 }).then(response => { + if (response.code == 200) { + this.severityData = response.data.list + } + }) + }, + getNotifyData () { + this.$get('alert/notify/method', { pageNo: 1, pageSize: -1 }).then(response => { + if (response.code == 200) { + this.notifyData = response.data.list + } + }) } }, mounted () { this.getUserList() + this.getSeverityData() + this.getNotifyData() }, watch: { alertRule: { @@ -335,7 +356,7 @@ export default { /deep/ .metric-selector-title{ margin-left: 0 !important; } - /* 标题样式 */ + /* 标题样式 */ .right-box-title{ font-size: 16px; font-weight: 700; @@ -361,4 +382,15 @@ export default { box-sizing: border-box; margin: -13px 30px 18px 30px; } + .severity-circle{ + position: absolute; + left: 10px; + top: 0; + } + .severity-box{ + position: relative; + } + .severity-box /deep/ .el-select .el-input__inner{ + padding-left: 25px; + } diff --git a/nezha-fronted/src/components/common/rightBox/alertSilenceBox.vue b/nezha-fronted/src/components/common/rightBox/alertSilenceBox.vue index 3d2b8aeb1..2715614f7 100644 --- a/nezha-fronted/src/components/common/rightBox/alertSilenceBox.vue +++ b/nezha-fronted/src/components/common/rightBox/alertSilenceBox.vue @@ -61,20 +61,20 @@ - -
- + +
+ = - - - Regex + + + Regex - +
- +
@@ -162,7 +162,7 @@ export default { linkId: '', reason: '', time: [], - matcher: [ + matchers: [ { name: '', value: '', regex: 0 } ], name: '' @@ -223,7 +223,7 @@ export default { }) return } - const params = { ...this.editAlertSilence } + const params = { ...this.editAlertSilence, matchers: JSON.stringify(this.editAlertSilence.matchers) } if (valid) { if (this.editAlertSilence.id) { this.$put('/alert/silence', params).then(response => { @@ -308,15 +308,15 @@ export default { this.editAlertSilence.linkId = '' }, // 新增label - addMatcher () { - this.editAlertSilence.matcher.push({ name: '', value: '', regex: 0 }) + addmatchers () { + this.editAlertSilence.matchers.push({ name: '', value: '', regex: 0 }) }, // 移除单个Label - removeMatcher (index) { - if (this.editAlertSilence.matcher.length === 1) { - this.editAlertSilence.matcher = [{ name: '', value: '', regex: 0 }] + removematchers (index) { + if (this.editAlertSilence.matchers.length === 1) { + this.editAlertSilence.matchers = [{ name: '', value: '', regex: 0 }] } - this.editAlertSilence.matcher.splice(index, 1) + this.editAlertSilence.matchers.splice(index, 1) } } } @@ -358,7 +358,7 @@ export default { } } } - .matcher{ + .matchers{ /deep/ .el-input__prefix{ left: 0; } @@ -366,11 +366,11 @@ export default { left: 126px; padding-top: 10px; } - .matcher-type{ + .matchers-type{ display: flex; justify-content: space-between; margin-top: 20px; - .matcher-type-title{ + .matchers-type-title{ width: 125px; background:#E7EAED; font-family: ArialMT; @@ -380,7 +380,7 @@ export default { font-weight: 400; text-align: center; } - /deep/ .matcher-type-title.el-select--small .el-input__inner{ + /deep/ .matchers-type-title.el-select--small .el-input__inner{ background:#E7EAED; font-family: ArialMT; font-size: 14px; @@ -390,15 +390,15 @@ export default { text-align: center; border: none; } - .matcher-type-content{ + .matchers-type-content{ flex: 1; } } } - /deep/ .silence-matcher-value{ + /deep/ .silence-matchers-value{ width: calc(100% - 100px); } - .silence-matcher-regex{ + .silence-matchers-regex{ margin-left: 10px; } /deep/ .param-box-row-key{ diff --git a/nezha-fronted/src/components/common/table/alert/alertMessageTable.vue b/nezha-fronted/src/components/common/table/alert/alertMessageTable.vue index a0ba92f80..0b4c855c8 100644 --- a/nezha-fronted/src/components/common/table/alert/alertMessageTable.vue +++ b/nezha-fronted/src/components/common/table/alert/alertMessageTable.vue @@ -57,10 +57,8 @@ - - - P1 - P2 - P3 + + {{scope.row[item.prop].name}} {{utcTimeToTimezoneStr(scope.row[item.prop])}}