[web-app]i18n for alert setting
This commit is contained in:
@@ -3,14 +3,14 @@
|
||||
<nz-breadcrumb-item>
|
||||
<a [routerLink]="['/']">
|
||||
<i nz-icon nzType="home"></i>
|
||||
<span>仪表盘</span>
|
||||
<span>{{ 'menu.dashboard' | i18n }}</span>
|
||||
</a>
|
||||
</nz-breadcrumb-item>
|
||||
<nz-breadcrumb-item>
|
||||
<i nz-icon nzType="alert"></i>
|
||||
<span>告警阈值配置</span>
|
||||
<span>{{ 'menu.alert.setting' | i18n }}</span>
|
||||
<a href="https://tancloud.cn/docs/help/alert_threshold" target="_blank" style="float: right; margin-right: 5%">
|
||||
<span>帮助 </span>
|
||||
<span>{{ 'common.button.help' | i18n }} </span>
|
||||
<i nz-icon nzType="question-circle" nzTheme="outline"></i>
|
||||
</a>
|
||||
</nz-breadcrumb-item>
|
||||
@@ -19,17 +19,17 @@
|
||||
|
||||
<button nz-button nzType="primary" (click)="onNewAlertDefine()">
|
||||
<i nz-icon nzType="appstore-add" nzTheme="outline"></i>
|
||||
新增阈值
|
||||
{{ 'alert.setting.new' | i18n }}
|
||||
</button>
|
||||
<button nz-button nzType="primary" (click)="onEditAlertDefine()">
|
||||
<i nz-icon nzType="edit" nzTheme="outline"></i>
|
||||
编辑
|
||||
{{ 'common.button.edit' | i18n }}
|
||||
</button>
|
||||
<button nz-button nzType="primary" (click)="onDeleteAlertDefines()">
|
||||
<i nz-icon nzType="delete" nzTheme="outline"></i>
|
||||
删除
|
||||
{{ 'common.button.delete' | i18n }}
|
||||
</button>
|
||||
<button nz-button nzType="primary" (click)="sync()" nz-tooltip nzTooltipTitle="刷新">
|
||||
<button nz-button nzType="primary" (click)="sync()" nz-tooltip [nzTooltipTitle]="'common.refresh' | i18n">
|
||||
<i nz-icon nzType="sync" nzTheme="outline"></i>
|
||||
</button>
|
||||
|
||||
@@ -51,14 +51,14 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th nzAlign="center" nzLeft nzWidth="4%" [(nzChecked)]="checkedAll" (nzCheckedChange)="onAllChecked($event)"></th>
|
||||
<th nzAlign="center" nzLeft>指标对象</th>
|
||||
<th nzAlign="center">阈值触发表达式</th>
|
||||
<th nzAlign="center">告警级别</th>
|
||||
<th nzAlign="center">触发次数</th>
|
||||
<th nzAlign="center">通知模版</th>
|
||||
<th nzAlign="center">全局默认</th>
|
||||
<th nzAlign="center">最新修改时间</th>
|
||||
<th nzAlign="center">操作</th>
|
||||
<th nzAlign="center" nzLeft>{{ 'alert.setting.target' | i18n }}</th>
|
||||
<th nzAlign="center">{{ 'alert.setting.expr' | i18n }}</th>
|
||||
<th nzAlign="center">{{ 'alert.priority' | i18n }}</th>
|
||||
<th nzAlign="center">{{ 'alert.setting.times' | i18n }}</th>
|
||||
<th nzAlign="center">{{ 'alert.setting.template' | i18n }}</th>
|
||||
<th nzAlign="center">{{ 'alert.setting.default' | i18n }}</th>
|
||||
<th nzAlign="center">{{ 'common.edit-time' | i18n }}</th>
|
||||
<th nzAlign="center">{{ 'common.edit' | i18n }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -73,36 +73,54 @@
|
||||
<td nzAlign="center">
|
||||
<nz-tag *ngIf="data.priority == 0" nzColor="red">
|
||||
<i nz-icon nzType="bell" nzTheme="outline"></i>
|
||||
<span>紧急告警</span>
|
||||
<span>{{ 'alert.priority.0' | i18n }}</span>
|
||||
</nz-tag>
|
||||
<nz-tag *ngIf="data.priority == 1" nzColor="orange">
|
||||
<i nz-icon nzType="bell" nzTheme="outline"></i>
|
||||
<span>严重告警</span>
|
||||
<span>{{ 'alert.priority.1' | i18n }}</span>
|
||||
</nz-tag>
|
||||
<nz-tag *ngIf="data.priority == 2" nzColor="yellow">
|
||||
<i nz-icon nzType="bell" nzTheme="outline"></i>
|
||||
<span>警告告警</span>
|
||||
<span>{{ 'alert.priority.2' | i18n }}</span>
|
||||
</nz-tag>
|
||||
</td>
|
||||
<td nzAlign="center">{{ data.times }}</td>
|
||||
<td nzAlign="center">{{ data.template }}</td>
|
||||
<td nzAlign="center">
|
||||
<nz-tag *ngIf="data.preset" nzColor="green">
|
||||
<span>是</span>
|
||||
<span>{{ 'common.yes' | i18n }}</span>
|
||||
</nz-tag>
|
||||
<nz-tag *ngIf="!data.preset" nzColor="orange">
|
||||
<span>否</span>
|
||||
<span>{{ 'common.no' | i18n }}</span>
|
||||
</nz-tag>
|
||||
</td>
|
||||
<td nzAlign="center">{{ (data.gmtUpdate ? data.gmtUpdate : data.gmtCreate) | date: 'YYYY-MM-dd HH:mm:ss' }}</td>
|
||||
<td nzAlign="center">
|
||||
<button nz-button nzType="primary" (click)="onOpenConnectModal(data.id, data.app)" nz-tooltip nzTooltipTitle="配置关联监控">
|
||||
<button
|
||||
nz-button
|
||||
nzType="primary"
|
||||
(click)="onOpenConnectModal(data.id, data.app)"
|
||||
nz-tooltip
|
||||
[nzTooltipTitle]="'alert.setting.connect' | i18n"
|
||||
>
|
||||
<i nz-icon nzType="link" nzTheme="outline"></i>
|
||||
</button>
|
||||
<button nz-button nzType="primary" (click)="onEditOneAlertDefine(data.id)" nz-tooltip nzTooltipTitle="修改告警配置">
|
||||
<button
|
||||
nz-button
|
||||
nzType="primary"
|
||||
(click)="onEditOneAlertDefine(data.id)"
|
||||
nz-tooltip
|
||||
[nzTooltipTitle]="'alert.setting.edit' | i18n"
|
||||
>
|
||||
<i nz-icon nzType="edit" nzTheme="outline"></i>
|
||||
</button>
|
||||
<button nz-button nzType="primary" (click)="onDeleteOneAlertDefine(data.id)" nz-tooltip nzTooltipTitle="删除告警配置">
|
||||
<button
|
||||
nz-button
|
||||
nzType="primary"
|
||||
(click)="onDeleteOneAlertDefine(data.id)"
|
||||
nz-tooltip
|
||||
[nzTooltipTitle]="'alert.setting.delete' | i18n"
|
||||
>
|
||||
<i nz-icon nzType="delete" nzTheme="outline"></i>
|
||||
</button>
|
||||
</td>
|
||||
@@ -110,12 +128,12 @@
|
||||
</tbody>
|
||||
</nz-table>
|
||||
|
||||
<ng-template #rangeTemplate> 总量 {{ total }} </ng-template>
|
||||
<ng-template #rangeTemplate> {{ 'common.total' | i18n }} {{ total }} </ng-template>
|
||||
|
||||
<!-- 新增或修改告警定义弹出框 -->
|
||||
<nz-modal
|
||||
[(nzVisible)]="isManageModalVisible"
|
||||
[nzTitle]="isManageModalAdd ? '新增告警阈值' : '修改告警阈值'"
|
||||
[nzTitle]="isManageModalAdd ? ('alert.setting.new' | i18n) : ('alert.setting.edit' | i18n)"
|
||||
(nzOnCancel)="onManageModalCancel()"
|
||||
(nzOnOk)="onManageModalOk()"
|
||||
nzMaskClosable="false"
|
||||
@@ -125,7 +143,7 @@
|
||||
<div *nzModalContent class="-inner-content">
|
||||
<form nz-form #defineForm="ngForm">
|
||||
<nz-form-item>
|
||||
<nz-form-label [nzSpan]="7" nzFor="target" nzRequired="true">指标对象</nz-form-label>
|
||||
<nz-form-label [nzSpan]="7" nzFor="target" nzRequired="true">{{ 'alert.setting.target' | i18n }}</nz-form-label>
|
||||
<nz-form-control [nzSpan]="8" [nzErrorTip]="'validation.required' | i18n">
|
||||
<nz-cascader
|
||||
required
|
||||
@@ -140,19 +158,19 @@
|
||||
<nz-form-item>
|
||||
<nz-col [nzSpan]="8" nzOffset="7">
|
||||
<nz-collapse>
|
||||
<nz-collapse-panel [nzActive]="isManageModalAdd" nzHeader="支持的阈值触发表达式环境变量与操作符">
|
||||
<nz-collapse-panel [nzActive]="isManageModalAdd" [nzHeader]="'alert.setting.expr.tip' | i18n">
|
||||
<nz-list nzSize="small" nzSplit="false">
|
||||
<nz-list-item *ngIf="cascadeValues.length == 3">
|
||||
<code>{{ cascadeValues[2] }} : 选中的指标对象</code>
|
||||
<code>{{ cascadeValues[2] }} : {{ 'alert.setting.target.tip' | i18n }}</code>
|
||||
</nz-list-item>
|
||||
<nz-list-item *ngFor="let item of otherMetrics">
|
||||
<code>{{ item }} : 所属行其它指标对象</code>
|
||||
<code>{{ item }} : {{ 'alert.setting.target.other' | i18n }}</code>
|
||||
</nz-list-item>
|
||||
<nz-list-item *ngIf="otherMetrics.length != 0">
|
||||
<code>instance : 所属行实例</code>
|
||||
<code>instance : {{ 'alert.setting.target.instance' | i18n }}</code>
|
||||
</nz-list-item>
|
||||
<nz-list-item>
|
||||
<code>支持操作符函数 : equals(str1,str2), ==, <, <=, >, >=, !=, ( ), +, -, &&, ||</code>
|
||||
<code>{{ 'alert.setting.operator' | i18n }} : equals(str1,str2), ==, <, <=, >, >=, !=, ( ), +, -, &&, ||</code>
|
||||
</nz-list-item>
|
||||
</nz-list>
|
||||
</nz-collapse-panel>
|
||||
@@ -160,13 +178,8 @@
|
||||
</nz-col>
|
||||
</nz-form-item>
|
||||
<nz-form-item>
|
||||
<nz-form-label
|
||||
[nzSpan]="7"
|
||||
nzFor="expr"
|
||||
nzRequired="true"
|
||||
nzTooltipTitle="根据此表达式来计算判断是否触发阈值,表达式环境变量和操作符见上方"
|
||||
>
|
||||
阈值触发表达式
|
||||
<nz-form-label [nzSpan]="7" nzFor="expr" nzRequired="true" [nzTooltipTitle]="'alert.setting.expr.label' | i18n">
|
||||
{{ 'alert.setting.expr' | i18n }}
|
||||
</nz-form-label>
|
||||
<nz-form-control [nzSpan]="8" [nzErrorTip]="'validation.required' | i18n">
|
||||
<nz-textarea-count [nzMaxCharacterCount]="100">
|
||||
@@ -177,32 +190,27 @@
|
||||
nz-input
|
||||
name="expr"
|
||||
id="expr"
|
||||
placeholder="根据此表达式计算判断是否触发阈值. 示例: responseTime>40"
|
||||
[placeholder]="('alert.setting.expr.example' | i18n) + ': responseTime>40'"
|
||||
>
|
||||
</textarea>
|
||||
</nz-textarea-count>
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
<nz-form-item>
|
||||
<nz-form-label
|
||||
nzSpan="7"
|
||||
nzRequired="true"
|
||||
nzFor="priority"
|
||||
nzTooltipTitle="触发阈值的告警级别,从低到高依次为:警告-warning,严重-critical,紧急-emergency"
|
||||
>
|
||||
告警级别
|
||||
<nz-form-label nzSpan="7" nzRequired="true" nzFor="priority" [nzTooltipTitle]="'alert.setting.priority.tip' | i18n">
|
||||
{{ 'alert.priority' | i18n }}
|
||||
</nz-form-label>
|
||||
<nz-form-control nzSpan="8" [nzErrorTip]="'validation.required' | i18n">
|
||||
<nz-select [(ngModel)]="define.priority" nzPlaceHolder="Choose" name="priority" id="priority">
|
||||
<nz-option [nzValue]="0" nzLabel="紧急告警"></nz-option>
|
||||
<nz-option [nzValue]="1" nzLabel="严重告警"></nz-option>
|
||||
<nz-option [nzValue]="2" nzLabel="警告告警"></nz-option>
|
||||
<nz-option [nzValue]="0" [nzLabel]="'alert.priority.0' | i18n"></nz-option>
|
||||
<nz-option [nzValue]="1" [nzLabel]="'alert.priority.1' | i18n"></nz-option>
|
||||
<nz-option [nzValue]="2" [nzLabel]="'alert.priority.2' | i18n"></nz-option>
|
||||
</nz-select>
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
<nz-form-item>
|
||||
<nz-form-label nzSpan="7" nzRequired="true" nzFor="duration" nzTooltipTitle="设置触发阈值多少次之后才会发送告警">
|
||||
触发次数
|
||||
<nz-form-label nzSpan="7" nzRequired="true" nzFor="duration" [nzTooltipTitle]="'alert.setting.times.tip' | i18n">
|
||||
{{ 'alert.setting.times' | i18n }}
|
||||
</nz-form-label>
|
||||
<nz-form-control nzSpan="8" [nzErrorTip]="'validation.required' | i18n">
|
||||
<nz-input-number [(ngModel)]="define.times" [nzMin]="1" [nzMax]="10" [nzStep]="1" required name="duration" id="duration">
|
||||
@@ -212,25 +220,25 @@
|
||||
<nz-form-item>
|
||||
<nz-col [nzSpan]="8" nzOffset="7">
|
||||
<nz-collapse>
|
||||
<nz-collapse-panel [nzActive]="isManageModalAdd" nzHeader="支持的通知模版环境变量">
|
||||
<nz-collapse-panel [nzActive]="isManageModalAdd" [nzHeader]="'alert.setting.template.tip' | i18n">
|
||||
<nz-list nzSize="small" nzSplit="false">
|
||||
<nz-list-item>
|
||||
<code>${app} : 监控类型名称</code>
|
||||
<code>${app} : {{ 'alert.setting.template.monitor-type' | i18n }}</code>
|
||||
</nz-list-item>
|
||||
<nz-list-item>
|
||||
<code>${metrics} : 监控指标集合名称</code>
|
||||
<code>${metrics} : {{ 'alert.setting.template.metrics-name' | i18n }}</code>
|
||||
</nz-list-item>
|
||||
<nz-list-item *ngIf="cascadeValues.length == 3">
|
||||
<code>${metric} : 监控指标名称</code>
|
||||
<code>${metric} : {{ 'alert.setting.template.metric-name' | i18n }}</code>
|
||||
</nz-list-item>
|
||||
<nz-list-item *ngIf="cascadeValues.length == 3">
|
||||
<code>${{ '{' + cascadeValues[2] + '}' }} : 监控指标对象值</code>
|
||||
<code>${{ '{' + cascadeValues[2] + '}' }} : {{ 'alert.setting.template.metric-value' | i18n }}</code>
|
||||
</nz-list-item>
|
||||
<nz-list-item *ngFor="let item of otherMetrics">
|
||||
<code>${{ '{' + item + '}' }} : 所属行其它指标值</code>
|
||||
<code>${{ '{' + item + '}' }} : {{ 'alert.setting.template.other-value' | i18n }}</code>
|
||||
</nz-list-item>
|
||||
<nz-list-item>
|
||||
<code>${instance} : 所属行实例值</code>
|
||||
<code>${instance} : {{ 'alert.setting.template.instance-value' | i18n }}</code>
|
||||
</nz-list-item>
|
||||
</nz-list>
|
||||
</nz-collapse-panel>
|
||||
@@ -238,8 +246,8 @@
|
||||
</nz-col>
|
||||
</nz-form-item>
|
||||
<nz-form-item>
|
||||
<nz-form-label [nzSpan]="7" nzFor="template" nzRequired="true" nzTooltipTitle="告警触发后发送的通知信息模版,模版环境变量见上方">
|
||||
通知模版
|
||||
<nz-form-label [nzSpan]="7" nzFor="template" nzRequired="true" [nzTooltipTitle]="'alert.setting.template.label' | i18n">
|
||||
{{ 'alert.setting.template' | i18n }}
|
||||
</nz-form-label>
|
||||
<nz-form-control [nzSpan]="8" [nzErrorTip]="'validation.required' | i18n">
|
||||
<nz-textarea-count [nzMaxCharacterCount]="200">
|
||||
@@ -250,20 +258,24 @@
|
||||
required
|
||||
name="template"
|
||||
id="template"
|
||||
placeholder="请输入告警的通知模版. 示例: ${app}.${metrics}.${metric}'s value is too high"
|
||||
[placeholder]="'alert.setting.template.example' | i18n"
|
||||
>
|
||||
</textarea>
|
||||
</nz-textarea-count>
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
<nz-form-item>
|
||||
<nz-form-label nzSpan="7" nzFor="preset" nzTooltipTitle="此告警阈值配置是否应用于全局所有此类型监控"> 全局默认 </nz-form-label>
|
||||
<nz-form-label nzSpan="7" nzFor="preset" [nzTooltipTitle]="'alert.setting.default.tip' | i18n">
|
||||
{{ 'alert.setting.default' | i18n }}
|
||||
</nz-form-label>
|
||||
<nz-form-control nzSpan="8">
|
||||
<nz-switch [(ngModel)]="define.preset" name="preset" id="preset"></nz-switch>
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
<nz-form-item>
|
||||
<nz-form-label nzSpan="7" nzRequired="true" nzFor="enable" nzTooltipTitle="此告警阈值配置开启生效或关闭"> 启用告警 </nz-form-label>
|
||||
<nz-form-label nzSpan="7" nzRequired="true" nzFor="enable" [nzTooltipTitle]="'alert.setting.enable.tip' | i18n">
|
||||
{{ 'alert.setting.enable' | i18n }}
|
||||
</nz-form-label>
|
||||
<nz-form-control nzSpan="8">
|
||||
<nz-switch [(ngModel)]="define.enable" [ngModelOptions]="{ standalone: true }" name="enable" id="enable"></nz-switch>
|
||||
</nz-form-control>
|
||||
@@ -276,7 +288,7 @@
|
||||
|
||||
<nz-modal
|
||||
[(nzVisible)]="isConnectModalVisible"
|
||||
nzTitle="告警定义关联监控"
|
||||
[nzTitle]="'alert.setting.connect' | i18n"
|
||||
(nzOnCancel)="onConnectModalCancel()"
|
||||
(nzOnOk)="onConnectModalOk()"
|
||||
nzMaskClosable="false"
|
||||
@@ -303,8 +315,8 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th [nzChecked]="stat.checkAll" [nzIndeterminate]="stat.checkHalf" (nzCheckedChange)="onItemSelectAll($event)"></th>
|
||||
<th *ngIf="direction == 'left'">未关联监控</th>
|
||||
<th *ngIf="direction == 'right'">已关联监控</th>
|
||||
<th *ngIf="direction == 'left'">{{ 'alert.setting.connect.left' | i18n }}</th>
|
||||
<th *ngIf="direction == 'right'">{{ 'alert.setting.connect.right' | i18n }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Component, Inject, OnInit } from '@angular/core';
|
||||
import { I18NService } from '@core';
|
||||
import { ALAIN_I18N_TOKEN } from '@delon/theme';
|
||||
import { NzModalService } from 'ng-zorro-antd/modal';
|
||||
import { NzNotificationService } from 'ng-zorro-antd/notification';
|
||||
import { NzTableQueryParams } from 'ng-zorro-antd/table';
|
||||
@@ -25,7 +27,8 @@ export class AlertSettingComponent implements OnInit {
|
||||
private notifySvc: NzNotificationService,
|
||||
private appDefineSvc: AppDefineService,
|
||||
private monitorSvc: MonitorService,
|
||||
private alertDefineSvc: AlertDefineService
|
||||
private alertDefineSvc: AlertDefineService,
|
||||
@Inject(ALAIN_I18N_TOKEN) private i18nSvc: I18NService
|
||||
) {}
|
||||
|
||||
pageIndex: number = 1;
|
||||
@@ -98,7 +101,7 @@ export class AlertSettingComponent implements OnInit {
|
||||
|
||||
onEditOneAlertDefine(alertDefineId: number) {
|
||||
if (alertDefineId == null) {
|
||||
this.notifySvc.warning('未选中任何待编辑项!', '');
|
||||
this.notifySvc.warning(this.i18nSvc.fanyi('common.notify.no-select-edit'), '');
|
||||
return;
|
||||
}
|
||||
this.editAlertDefine(alertDefineId);
|
||||
@@ -107,11 +110,11 @@ export class AlertSettingComponent implements OnInit {
|
||||
onEditAlertDefine() {
|
||||
// 编辑时只能选中一个
|
||||
if (this.checkedDefineIds == null || this.checkedDefineIds.size === 0) {
|
||||
this.notifySvc.warning('未选中任何待编辑项!', '');
|
||||
this.notifySvc.warning(this.i18nSvc.fanyi('common.notify.no-select-edit'), '');
|
||||
return;
|
||||
}
|
||||
if (this.checkedDefineIds.size > 1) {
|
||||
this.notifySvc.warning('只能对一个选中项进行编辑!', '');
|
||||
this.notifySvc.warning(this.i18nSvc.fanyi('common.notify.one-select-edit'), '');
|
||||
return;
|
||||
}
|
||||
let alertDefineId = 0;
|
||||
@@ -138,24 +141,24 @@ export class AlertSettingComponent implements OnInit {
|
||||
this.cascadeValues = [this.define.app, this.define.metric, this.define.field];
|
||||
this.cascadeOnChange(this.cascadeValues);
|
||||
} else {
|
||||
this.notifySvc.error('查询此监控定义详情失败!', message.msg);
|
||||
this.notifySvc.error(this.i18nSvc.fanyi('common.notify.monitor-fail'), message.msg);
|
||||
}
|
||||
},
|
||||
error => {
|
||||
this.notifySvc.error('查询此监控定义详情失败!', error.msg);
|
||||
this.notifySvc.error(this.i18nSvc.fanyi('common.notify.monitor-fail'), error.msg);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
onDeleteAlertDefines() {
|
||||
if (this.checkedDefineIds == null || this.checkedDefineIds.size === 0) {
|
||||
this.notifySvc.warning('未选中任何待删除项!', '');
|
||||
this.notifySvc.warning(this.i18nSvc.fanyi('common.notify.no-select-delete'), '');
|
||||
return;
|
||||
}
|
||||
this.modal.confirm({
|
||||
nzTitle: '请确认是否批量删除!',
|
||||
nzOkText: '确定',
|
||||
nzCancelText: '取消',
|
||||
nzTitle: this.i18nSvc.fanyi('common.confirm.delete-batch'),
|
||||
nzOkText: this.i18nSvc.fanyi('common.button.ok'),
|
||||
nzCancelText: this.i18nSvc.fanyi('common.button.cancel'),
|
||||
nzOkDanger: true,
|
||||
nzOkType: 'primary',
|
||||
nzOnOk: () => this.deleteAlertDefines(this.checkedDefineIds)
|
||||
@@ -166,9 +169,9 @@ export class AlertSettingComponent implements OnInit {
|
||||
let defineIds = new Set<number>();
|
||||
defineIds.add(alertDefineId);
|
||||
this.modal.confirm({
|
||||
nzTitle: '请确认是否删除!',
|
||||
nzOkText: '确定',
|
||||
nzCancelText: '取消',
|
||||
nzTitle: this.i18nSvc.fanyi('common.confirm.delete'),
|
||||
nzOkText: this.i18nSvc.fanyi('common.button.ok'),
|
||||
nzCancelText: this.i18nSvc.fanyi('common.button.cancel'),
|
||||
nzOkDanger: true,
|
||||
nzOkType: 'primary',
|
||||
nzOnOk: () => this.deleteAlertDefines(defineIds)
|
||||
@@ -177,7 +180,7 @@ export class AlertSettingComponent implements OnInit {
|
||||
|
||||
deleteAlertDefines(defineIds: Set<number>) {
|
||||
if (defineIds == null || defineIds.size == 0) {
|
||||
this.notifySvc.warning('未选中任何待删除项!', '');
|
||||
this.notifySvc.warning(this.i18nSvc.fanyi('common.notify.no-select-delete'), '');
|
||||
return;
|
||||
}
|
||||
this.tableLoading = true;
|
||||
@@ -185,17 +188,17 @@ export class AlertSettingComponent implements OnInit {
|
||||
message => {
|
||||
deleteDefines$.unsubscribe();
|
||||
if (message.code === 0) {
|
||||
this.notifySvc.success('删除成功!', '');
|
||||
this.notifySvc.success(this.i18nSvc.fanyi('common.notify.delete-success'), '');
|
||||
this.loadAlertDefineTable();
|
||||
} else {
|
||||
this.tableLoading = false;
|
||||
this.notifySvc.error('删除失败!', message.msg);
|
||||
this.notifySvc.error(this.i18nSvc.fanyi('common.notify.delete-fail'), message.msg);
|
||||
}
|
||||
},
|
||||
error => {
|
||||
this.tableLoading = false;
|
||||
deleteDefines$.unsubscribe();
|
||||
this.notifySvc.error('删除失败!', error.msg);
|
||||
this.notifySvc.error(this.i18nSvc.fanyi('common.notify.delete-fail'), error.msg);
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -242,7 +245,7 @@ export class AlertSettingComponent implements OnInit {
|
||||
}
|
||||
this.appHierarchies.forEach(hierarchy => {
|
||||
if (hierarchy.value == values[0]) {
|
||||
hierarchy.children.forEach((metrics: { value: string; children: any[]}) => {
|
||||
hierarchy.children.forEach((metrics: { value: string; children: any[] }) => {
|
||||
if (metrics.value == values[1]) {
|
||||
this.otherMetrics = [];
|
||||
metrics.children.forEach(item => {
|
||||
@@ -276,14 +279,14 @@ export class AlertSettingComponent implements OnInit {
|
||||
message => {
|
||||
if (message.code === 0) {
|
||||
this.isManageModalVisible = false;
|
||||
this.notifySvc.success('新增成功!', '');
|
||||
this.notifySvc.success(this.i18nSvc.fanyi('common.notify.new-success'), '');
|
||||
this.loadAlertDefineTable();
|
||||
} else {
|
||||
this.notifySvc.error('新增失败!', message.msg);
|
||||
this.notifySvc.error(this.i18nSvc.fanyi('common.notify.new-fail'), message.msg);
|
||||
}
|
||||
},
|
||||
error => {
|
||||
this.notifySvc.error('新增失败!', error.msg);
|
||||
this.notifySvc.error(this.i18nSvc.fanyi('common.notify.new-fail'), error.msg);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
@@ -299,14 +302,14 @@ export class AlertSettingComponent implements OnInit {
|
||||
message => {
|
||||
if (message.code === 0) {
|
||||
this.isManageModalVisible = false;
|
||||
this.notifySvc.success('修改成功!', '');
|
||||
this.notifySvc.success(this.i18nSvc.fanyi('common.notify.edit-success'), '');
|
||||
this.loadAlertDefineTable();
|
||||
} else {
|
||||
this.notifySvc.error('修改失败!', message.msg);
|
||||
this.notifySvc.error(this.i18nSvc.fanyi('common.notify.edit-fail'), message.msg);
|
||||
}
|
||||
},
|
||||
error => {
|
||||
this.notifySvc.error('修改失败!', error.msg);
|
||||
this.notifySvc.error(this.i18nSvc.fanyi('common.notify.edit-fail'), error.msg);
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -373,16 +376,16 @@ export class AlertSettingComponent implements OnInit {
|
||||
message => {
|
||||
this.isConnectModalOkLoading = false;
|
||||
if (message.code === 0) {
|
||||
this.notifySvc.success('应用成功!', '');
|
||||
this.notifySvc.success(this.i18nSvc.fanyi('common.notify.apply-success'), '');
|
||||
this.isConnectModalVisible = false;
|
||||
this.loadAlertDefineTable();
|
||||
} else {
|
||||
this.notifySvc.error('应用失败!', message.msg);
|
||||
this.notifySvc.error(this.i18nSvc.fanyi('common.notify.apply-fail'), message.msg);
|
||||
}
|
||||
},
|
||||
error => {
|
||||
this.isConnectModalOkLoading = false;
|
||||
this.notifySvc.error('应用失败!', error.msg);
|
||||
this.notifySvc.error(this.i18nSvc.fanyi('common.notify.apply-fail'), error.msg);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { NgModule, Type } from '@angular/core';
|
||||
import { SharedModule } from '@shared';
|
||||
import { NzBreadCrumbModule } from 'ng-zorro-antd/breadcrumb';
|
||||
import { NzCollapseModule } from 'ng-zorro-antd/collapse';
|
||||
import { NzDividerModule } from 'ng-zorro-antd/divider';
|
||||
import { NzLayoutModule } from 'ng-zorro-antd/layout';
|
||||
import { NzRadioModule } from 'ng-zorro-antd/radio';
|
||||
@@ -16,7 +17,6 @@ import { MonitorEditComponent } from './monitor-edit/monitor-edit.component';
|
||||
import { MonitorListComponent } from './monitor-list/monitor-list.component';
|
||||
import { MonitorNewComponent } from './monitor-new/monitor-new.component';
|
||||
import { MonitorRoutingModule } from './monitor-routing.module';
|
||||
import { NzCollapseModule } from 'ng-zorro-antd/collapse';
|
||||
|
||||
const COMPONENTS: Array<Type<void>> = [
|
||||
MonitorNewComponent,
|
||||
|
||||
@@ -93,6 +93,38 @@
|
||||
"2": "Warning"
|
||||
}
|
||||
},
|
||||
"alert.setting.new": "New Threshold",
|
||||
"alert.setting.edit": "Edit Threshold",
|
||||
"alert.setting.delete": "Delete Threshold",
|
||||
"alert.setting.target": "Metric Target",
|
||||
"alert.setting.expr": "Threshold Trigger Expr",
|
||||
"alert.setting.times": "Trigger Times",
|
||||
"alert.setting.times.tip": "Set how many times the threshold is triggered before sending an alert",
|
||||
"alert.setting.template": "Notice Template",
|
||||
"alert.setting.template.tip": "Supported notification template environment variables",
|
||||
"alert.setting.template.label": "The notification information template sent after the alarm is triggered, see the template environment variable above",
|
||||
"alert.setting.template.example": "Please input notice template.Eg: ${app}.${metrics}.${metric}'s value is too high",
|
||||
"alert.setting.template.monitor-type": "Monitor Type Name",
|
||||
"alert.setting.template.metrics-name": "Metrics Name",
|
||||
"alert.setting.template.metric-name": "Metric Name",
|
||||
"alert.setting.template.metric-value": "Metric Target Value",
|
||||
"alert.setting.template.other-value": "Other Metric Value",
|
||||
"alert.setting.template.instance-value": "Instance Value",
|
||||
"alert.setting.default": "Global Default",
|
||||
"alert.setting.default.tip": "Whether this alarm threshold configuration applies to all this type of monitoring globally",
|
||||
"alert.setting.enable": "Enable Alert",
|
||||
"alert.setting.enable.tip": "This alarm threshold configuration is enabled or disabled",
|
||||
"alert.setting.connect": "Alert Associate Monitors",
|
||||
"alert.setting.connect.left": "No Associate",
|
||||
"alert.setting.connect.right": "Associated",
|
||||
"alert.setting.expr.tip": "Supported Threshold Trigger Expression Environment Variables and Operators",
|
||||
"alert.setting.expr.label": "Calculate and judge whether the threshold is triggered according to this expression. The expression environment variables and operators are shown above.",
|
||||
"alert.setting.expr.example": "Calculate whether to trigger the threshold according to this expression.Eg",
|
||||
"alert.setting.priority.tip": "The alarm level that triggers the threshold, from low to high:Warning,Critical,Emergency",
|
||||
"alert.setting.target.tip": "The selected metric object",
|
||||
"alert.setting.target.other": "Other metric objects of the row",
|
||||
"alert.setting.target.instance": "Instance of the row",
|
||||
"alert.setting.operator": "Supported operator functions",
|
||||
"alert.center.delete": "Delete Alerts",
|
||||
"alert.center.deal": "Mark Processed",
|
||||
"alert.center.no-deal": "Mark Pending",
|
||||
@@ -214,6 +246,9 @@
|
||||
"common.notify.delete-fail": "Delete Failed!",
|
||||
"common.notify.new-success": "Add Success!",
|
||||
"common.notify.new-fail": "Add Failed!",
|
||||
"common.notify.apply-success": "Apply Success!",
|
||||
"common.notify.apply-fail": "Apply Failed!",
|
||||
"common.notify.monitor-fail": "Query Monitor Failed!",
|
||||
"common.notify.edit-success": "Edit Success!",
|
||||
"common.notify.edit-fail": "Edit Failed!",
|
||||
"common.notify.no-select-cancel": "No items selected for cancel!",
|
||||
@@ -231,6 +266,8 @@
|
||||
"common.button.ok": "OK",
|
||||
"common.button.cancel": "Cancel",
|
||||
"common.button.help": "Help",
|
||||
"common.button.edit": "Edit",
|
||||
"common.button.delete": "Delete",
|
||||
"common.button.detect": "Detect",
|
||||
"validation.email.invalid": "Invalid email!",
|
||||
"validation.phone.invalid": "Invalid phone number!",
|
||||
|
||||
@@ -93,6 +93,38 @@
|
||||
"2": "警告告警"
|
||||
}
|
||||
},
|
||||
"alert.setting.new": "新增阈值",
|
||||
"alert.setting.edit": "编辑阈值",
|
||||
"alert.setting.delete": "删除阈值",
|
||||
"alert.setting.target": "指标对象",
|
||||
"alert.setting.expr": "阈值触发表达式",
|
||||
"alert.setting.times": "触发次数",
|
||||
"alert.setting.times.tip": "设置触发阈值多少次之后才会发送告警",
|
||||
"alert.setting.template": "通知模版",
|
||||
"alert.setting.template.tip": "支持的通知模版环境变量",
|
||||
"alert.setting.template.label": "告警触发后发送的通知信息模版,模版环境变量见上方",
|
||||
"alert.setting.template.example": "请输入告警的通知模版.示例: ${app}.${metrics}.${metric}'s value is too high",
|
||||
"alert.setting.template.monitor-type": "监控类型名称",
|
||||
"alert.setting.template.metrics-name": "监控指标集合名称",
|
||||
"alert.setting.template.metric-name": "监控指标名称",
|
||||
"alert.setting.template.metric-value": "监控指标对象值",
|
||||
"alert.setting.template.other-value": "所属行其它指标值",
|
||||
"alert.setting.template.instance-value": "所属行实例值",
|
||||
"alert.setting.default": "全局默认",
|
||||
"alert.setting.default.tip": "此告警阈值配置是否应用于全局所有此类型监控",
|
||||
"alert.setting.enable": "启用告警",
|
||||
"alert.setting.enable.tip": "此告警阈值配置开启生效或关闭",
|
||||
"alert.setting.connect": "告警定义关联监控",
|
||||
"alert.setting.connect.left": "未关联监控",
|
||||
"alert.setting.connect.right": "已关联监控",
|
||||
"alert.setting.expr.tip": "支持的阈值触发表达式环境变量与操作符",
|
||||
"alert.setting.expr.label": "根据此表达式来计算判断是否触发阈值,表达式环境变量和操作符见上方",
|
||||
"alert.setting.expr.example": "根据此表达式计算判断是否触发阈值.示例",
|
||||
"alert.setting.priority.tip": "触发阈值的告警级别,从低到高依次为:警告-warning,严重-critical,紧急-emergency",
|
||||
"alert.setting.target.tip": "选中的指标对象",
|
||||
"alert.setting.target.other": "所属行其它指标对象",
|
||||
"alert.setting.target.instance": "所属行实例",
|
||||
"alert.setting.operator": "支持操作符函数",
|
||||
"alert.center.delete": "删除告警",
|
||||
"alert.center.deal": "标记已处理",
|
||||
"alert.center.no-deal": "标记未处理",
|
||||
@@ -214,6 +246,9 @@
|
||||
"common.notify.delete-fail": "删除失败!",
|
||||
"common.notify.new-success": "新增成功!",
|
||||
"common.notify.new-fail": "新增失败!",
|
||||
"common.notify.apply-success": "应用成功!",
|
||||
"common.notify.apply-fail": "应用失败!",
|
||||
"common.notify.monitor-fail": "查询此监控定义详情失败!",
|
||||
"common.notify.edit-success": "修改成功!",
|
||||
"common.notify.edit-fail": "修改失败!",
|
||||
"common.notify.mark-success": "标记成功!",
|
||||
@@ -232,6 +267,8 @@
|
||||
"common.button.detect": "测试",
|
||||
"common.button.cancel": "取消",
|
||||
"common.button.help": "帮助",
|
||||
"common.button.edit": "编辑",
|
||||
"common.button.delete": "删除",
|
||||
"app.role.admin": "管理员",
|
||||
"app.lock": "锁屏",
|
||||
"app.lock.placeholder": "输入任意解锁",
|
||||
|
||||
Reference in New Issue
Block a user