[webapp] 批量处理eslint格式告警
This commit is contained in:
@@ -22,58 +22,61 @@
|
||||
<button nz-button nzType="primary" (click)="syncReceiver()" nz-tooltip nzTooltipTitle="刷新">
|
||||
<i nz-icon nzType="sync" nzTheme="outline"></i>
|
||||
</button>
|
||||
<nz-table #fixedTable [nzData]="receivers"
|
||||
nzFrontPagination ="false"
|
||||
[nzLoading] = "receiverTableLoading"
|
||||
[nzScroll]="{ x: '1150px', y: '1240px' }">
|
||||
<nz-table
|
||||
#fixedTable
|
||||
[nzData]="receivers"
|
||||
nzFrontPagination="false"
|
||||
[nzLoading]="receiverTableLoading"
|
||||
[nzScroll]="{ x: '1150px', y: '1240px' }"
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th nzAlign="center">接收人</th>
|
||||
<th nzAlign="center">通知方式</th>
|
||||
<th nzAlign="center">配置</th>
|
||||
<th nzAlign="center">最新修改时间</th>
|
||||
<th nzAlign="center" nzRight>操作</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th nzAlign="center">接收人</th>
|
||||
<th nzAlign="center">通知方式</th>
|
||||
<th nzAlign="center">配置</th>
|
||||
<th nzAlign="center">最新修改时间</th>
|
||||
<th nzAlign="center" nzRight>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let data of fixedTable.data">
|
||||
<td nzAlign="center">
|
||||
<span>{{ data.name}}</span>
|
||||
</td>
|
||||
<td nzAlign="center">
|
||||
<nz-tag *ngIf="data.type == 0" nzColor="orange">
|
||||
<i nz-icon nzType="notification" nzTheme="outline"></i>
|
||||
<span>短信</span>
|
||||
</nz-tag>
|
||||
<nz-tag *ngIf="data.type == 1" nzColor="orange">
|
||||
<i nz-icon nzType="notification" nzTheme="outline"></i>
|
||||
<span>邮件</span>
|
||||
</nz-tag>
|
||||
<nz-tag *ngIf="data.type == 2" nzColor="orange">
|
||||
<i nz-icon nzType="notification" nzTheme="outline"></i>
|
||||
<span>WebHook</span>
|
||||
</nz-tag>
|
||||
<nz-tag *ngIf="data.type == 3" nzColor="orange">
|
||||
<i nz-icon nzType="notification" nzTheme="outline"></i>
|
||||
<span>微信公众号</span>
|
||||
</nz-tag>
|
||||
</td>
|
||||
<td nzAlign="center">
|
||||
<span *ngIf="data.type == 0">{{data.phone}}</span>
|
||||
<span *ngIf="data.type == 1">{{data.email}}</span>
|
||||
<span *ngIf="data.type == 2">{{data.hookUrl}}</span>
|
||||
<span *ngIf="data.type == 3">{{data.wechatId}}</span>
|
||||
</td>
|
||||
<td nzAlign="center">{{ data.gmtUpdate? data.gmtUpdate : data.gmtCreate }}</td>
|
||||
<td nzAlign="center" nzRight>
|
||||
<button nz-button nzType="primary" (click)="onEditOneNoticeReceiver(data)" nz-tooltip nzTooltipTitle="修改接收人">
|
||||
<i nz-icon nzType="edit" nzTheme="outline"></i>
|
||||
</button>
|
||||
<button nz-button nzType="primary" (click)="onDeleteOneNoticeReceiver(data.id)" nz-tooltip nzTooltipTitle="删除接收人">
|
||||
<i nz-icon nzType="delete" nzTheme="outline"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr *ngFor="let data of fixedTable.data">
|
||||
<td nzAlign="center">
|
||||
<span>{{ data.name }}</span>
|
||||
</td>
|
||||
<td nzAlign="center">
|
||||
<nz-tag *ngIf="data.type == 0" nzColor="orange">
|
||||
<i nz-icon nzType="notification" nzTheme="outline"></i>
|
||||
<span>短信</span>
|
||||
</nz-tag>
|
||||
<nz-tag *ngIf="data.type == 1" nzColor="orange">
|
||||
<i nz-icon nzType="notification" nzTheme="outline"></i>
|
||||
<span>邮件</span>
|
||||
</nz-tag>
|
||||
<nz-tag *ngIf="data.type == 2" nzColor="orange">
|
||||
<i nz-icon nzType="notification" nzTheme="outline"></i>
|
||||
<span>WebHook</span>
|
||||
</nz-tag>
|
||||
<nz-tag *ngIf="data.type == 3" nzColor="orange">
|
||||
<i nz-icon nzType="notification" nzTheme="outline"></i>
|
||||
<span>微信公众号</span>
|
||||
</nz-tag>
|
||||
</td>
|
||||
<td nzAlign="center">
|
||||
<span *ngIf="data.type == 0">{{ data.phone }}</span>
|
||||
<span *ngIf="data.type == 1">{{ data.email }}</span>
|
||||
<span *ngIf="data.type == 2">{{ data.hookUrl }}</span>
|
||||
<span *ngIf="data.type == 3">{{ data.wechatId }}</span>
|
||||
</td>
|
||||
<td nzAlign="center">{{ data.gmtUpdate ? data.gmtUpdate : data.gmtCreate }}</td>
|
||||
<td nzAlign="center" nzRight>
|
||||
<button nz-button nzType="primary" (click)="onEditOneNoticeReceiver(data)" nz-tooltip nzTooltipTitle="修改接收人">
|
||||
<i nz-icon nzType="edit" nzTheme="outline"></i>
|
||||
</button>
|
||||
<button nz-button nzType="primary" (click)="onDeleteOneNoticeReceiver(data.id)" nz-tooltip nzTooltipTitle="删除接收人">
|
||||
<i nz-icon nzType="delete" nzTheme="outline"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</nz-table>
|
||||
</nz-tab>
|
||||
@@ -85,90 +88,84 @@
|
||||
<button nz-button nzType="primary" (click)="syncRule()" nz-tooltip nzTooltipTitle="刷新">
|
||||
<i nz-icon nzType="sync" nzTheme="outline"></i>
|
||||
</button>
|
||||
<nz-table #ruleFixedTable [nzData]="rules"
|
||||
nzFrontPagination ="false"
|
||||
[nzLoading] = "ruleTableLoading"
|
||||
[nzScroll]="{ x: '1150px', y: '1240px' }">
|
||||
<nz-table
|
||||
#ruleFixedTable
|
||||
[nzData]="rules"
|
||||
nzFrontPagination="false"
|
||||
[nzLoading]="ruleTableLoading"
|
||||
[nzScroll]="{ x: '1150px', y: '1240px' }"
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th nzAlign="center">策略名称</th>
|
||||
<th nzAlign="center">接收人</th>
|
||||
<th nzAlign="center">转发所有</th>
|
||||
<th nzAlign="center">是否启用</th>
|
||||
<th nzAlign="center">最新修改时间</th>
|
||||
<th nzAlign="center" nzRight>操作</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th nzAlign="center">策略名称</th>
|
||||
<th nzAlign="center">接收人</th>
|
||||
<th nzAlign="center">转发所有</th>
|
||||
<th nzAlign="center">是否启用</th>
|
||||
<th nzAlign="center">最新修改时间</th>
|
||||
<th nzAlign="center" nzRight>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let data of ruleFixedTable.data">
|
||||
<td nzAlign="center">
|
||||
<span>{{ data.name}}</span>
|
||||
</td>
|
||||
<td nzAlign="center">
|
||||
<span>{{ data.receiverName}}</span>
|
||||
</td>
|
||||
<td nzAlign="center">
|
||||
<nz-tag *ngIf="data.filterAll" nzColor="green">
|
||||
<span>是</span>
|
||||
</nz-tag>
|
||||
<nz-tag *ngIf="!data.filterAll" nzColor="orange">
|
||||
<span>否</span>
|
||||
</nz-tag>
|
||||
</td>
|
||||
<td nzAlign="center">
|
||||
<nz-tag *ngIf="data.enable" nzColor="green">
|
||||
<span>开启</span>
|
||||
</nz-tag>
|
||||
<nz-tag *ngIf="!data.enable" nzColor="orange">
|
||||
<span>关闭</span>
|
||||
</nz-tag>
|
||||
</td>
|
||||
<td nzAlign="center">{{ data.gmtUpdate? data.gmtUpdate : data.gmtCreate }}</td>
|
||||
<td nzAlign="center" nzRight>
|
||||
<button nz-button nzType="primary" (click)="onEditOneNoticeRule(data)" nz-tooltip nzTooltipTitle="修改告警策略">
|
||||
<i nz-icon nzType="edit" nzTheme="outline"></i>
|
||||
</button>
|
||||
<button nz-button nzType="primary" (click)="onDeleteOneNoticeRule(data.id)" nz-tooltip nzTooltipTitle="删除告警策略">
|
||||
<i nz-icon nzType="delete" nzTheme="outline"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr *ngFor="let data of ruleFixedTable.data">
|
||||
<td nzAlign="center">
|
||||
<span>{{ data.name }}</span>
|
||||
</td>
|
||||
<td nzAlign="center">
|
||||
<span>{{ data.receiverName }}</span>
|
||||
</td>
|
||||
<td nzAlign="center">
|
||||
<nz-tag *ngIf="data.filterAll" nzColor="green">
|
||||
<span>是</span>
|
||||
</nz-tag>
|
||||
<nz-tag *ngIf="!data.filterAll" nzColor="orange">
|
||||
<span>否</span>
|
||||
</nz-tag>
|
||||
</td>
|
||||
<td nzAlign="center">
|
||||
<nz-tag *ngIf="data.enable" nzColor="green">
|
||||
<span>开启</span>
|
||||
</nz-tag>
|
||||
<nz-tag *ngIf="!data.enable" nzColor="orange">
|
||||
<span>关闭</span>
|
||||
</nz-tag>
|
||||
</td>
|
||||
<td nzAlign="center">{{ data.gmtUpdate ? data.gmtUpdate : data.gmtCreate }}</td>
|
||||
<td nzAlign="center" nzRight>
|
||||
<button nz-button nzType="primary" (click)="onEditOneNoticeRule(data)" nz-tooltip nzTooltipTitle="修改告警策略">
|
||||
<i nz-icon nzType="edit" nzTheme="outline"></i>
|
||||
</button>
|
||||
<button nz-button nzType="primary" (click)="onDeleteOneNoticeRule(data.id)" nz-tooltip nzTooltipTitle="删除告警策略">
|
||||
<i nz-icon nzType="delete" nzTheme="outline"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</nz-table>
|
||||
</nz-tab>
|
||||
</nz-tabset>
|
||||
|
||||
|
||||
<!-- 新增或修改通知接收人弹出框 -->
|
||||
<nz-modal
|
||||
[(nzVisible)]="isManageReceiverModalVisible"
|
||||
[nzTitle]="isManageReceiverModalAdd?'新增接收人' : '修改接收人'"
|
||||
[nzTitle]="isManageReceiverModalAdd ? '新增接收人' : '修改接收人'"
|
||||
(nzOnCancel)="onManageReceiverModalCancel()"
|
||||
(nzOnOk)="onManageReceiverModalOk()"
|
||||
nzMaskClosable="false"
|
||||
nzWidth="60%"
|
||||
[nzOkLoading]="isManageReceiverModalOkLoading"
|
||||
>
|
||||
<div *nzModalContent class = "-inner-content">
|
||||
<div *nzModalContent class="-inner-content">
|
||||
<form nz-form>
|
||||
<nz-form-item>
|
||||
<nz-form-label [nzSpan]="7" nzFor= 'name' nzRequired="true">接收人名称</nz-form-label>
|
||||
<nz-form-label [nzSpan]="7" nzFor="name" nzRequired="true">接收人名称</nz-form-label>
|
||||
<nz-form-control [nzSpan]="8">
|
||||
<input [(ngModel)]="receiver.name" nz-input name="name" type="text" id="name">
|
||||
<input [(ngModel)]="receiver.name" nz-input name="name" type="text" id="name" />
|
||||
</nz-form-control>
|
||||
</nz-form-item >
|
||||
</nz-form-item>
|
||||
<nz-form-item>
|
||||
<nz-form-label nzSpan="7"
|
||||
nzRequired="true"
|
||||
nzFor= "type">通知方式
|
||||
</nz-form-label>
|
||||
<nz-form-label nzSpan="7" nzRequired="true" nzFor="type">通知方式 </nz-form-label>
|
||||
<nz-form-control nzSpan="8">
|
||||
<nz-select
|
||||
[(ngModel)]="receiver.type"
|
||||
nzAllowClear
|
||||
nzPlaceHolder="Choose"
|
||||
name="type" id="type"
|
||||
>
|
||||
<nz-select [(ngModel)]="receiver.type" nzAllowClear nzPlaceHolder="Choose" name="type" id="type">
|
||||
<nz-option [nzValue]="0" nzDisabled nzLabel="短信"></nz-option>
|
||||
<nz-option [nzValue]="1" nzLabel="邮箱"></nz-option>
|
||||
<nz-option [nzValue]="2" nzLabel="WebHook"></nz-option>
|
||||
@@ -177,29 +174,29 @@
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
<nz-form-item *ngIf="receiver.type === 0">
|
||||
<nz-form-label [nzSpan]="7" nzFor= 'phone' [nzRequired]="receiver.type === 0">手机号</nz-form-label>
|
||||
<nz-form-label [nzSpan]="7" nzFor="phone" [nzRequired]="receiver.type === 0">手机号</nz-form-label>
|
||||
<nz-form-control [nzSpan]="8">
|
||||
<input [(ngModel)]="receiver.phone" nz-input name="phone" type="tel" id="phone">
|
||||
<input [(ngModel)]="receiver.phone" nz-input name="phone" type="tel" id="phone" />
|
||||
</nz-form-control>
|
||||
</nz-form-item >
|
||||
</nz-form-item>
|
||||
<nz-form-item *ngIf="receiver.type === 1">
|
||||
<nz-form-label [nzSpan]="7" nzFor= 'email' [nzRequired]="receiver.type === 1">邮箱</nz-form-label>
|
||||
<nz-form-label [nzSpan]="7" nzFor="email" [nzRequired]="receiver.type === 1">邮箱</nz-form-label>
|
||||
<nz-form-control [nzSpan]="8">
|
||||
<input [(ngModel)]="receiver.email" nz-input name="email" type="email" id="email">
|
||||
<input [(ngModel)]="receiver.email" nz-input name="email" type="email" id="email" />
|
||||
</nz-form-control>
|
||||
</nz-form-item >
|
||||
</nz-form-item>
|
||||
<nz-form-item *ngIf="receiver.type === 2">
|
||||
<nz-form-label [nzSpan]="7" nzFor= 'hookUrl' [nzRequired]="receiver.type === 2">URL地址</nz-form-label>
|
||||
<nz-form-label [nzSpan]="7" nzFor="hookUrl" [nzRequired]="receiver.type === 2">URL地址</nz-form-label>
|
||||
<nz-form-control [nzSpan]="8">
|
||||
<input [(ngModel)]="receiver.hookUrl" nz-input name="hookUrl" type="url" id="hookUrl">
|
||||
<input [(ngModel)]="receiver.hookUrl" nz-input name="hookUrl" type="url" id="hookUrl" />
|
||||
</nz-form-control>
|
||||
</nz-form-item >
|
||||
</nz-form-item>
|
||||
<nz-form-item *ngIf="receiver.type === 3">
|
||||
<nz-form-label [nzSpan]="7" nzFor= 'wechatId' [nzRequired]="receiver.type === 3">微信OPENID</nz-form-label>
|
||||
<nz-form-label [nzSpan]="7" nzFor="wechatId" [nzRequired]="receiver.type === 3">微信OPENID</nz-form-label>
|
||||
<nz-form-control [nzSpan]="8">
|
||||
<input [(ngModel)]="receiver.wechatId" nz-input name="wechatId" type="text" id="wechatId">
|
||||
<input [(ngModel)]="receiver.wechatId" nz-input name="wechatId" type="text" id="wechatId" />
|
||||
</nz-form-control>
|
||||
</nz-form-item >
|
||||
</nz-form-item>
|
||||
</form>
|
||||
</div>
|
||||
</nz-modal>
|
||||
@@ -207,29 +204,29 @@
|
||||
<!-- 新增或修改通知策略弹出框 -->
|
||||
<nz-modal
|
||||
[(nzVisible)]="isManageRuleModalVisible"
|
||||
[nzTitle]="isManageRuleModalAdd?'新增策略' : '修改策略'"
|
||||
[nzTitle]="isManageRuleModalAdd ? '新增策略' : '修改策略'"
|
||||
(nzOnCancel)="onManageRuleModalCancel()"
|
||||
(nzOnOk)="onManageRuleModalOk()"
|
||||
nzMaskClosable="false"
|
||||
nzWidth="60%"
|
||||
[nzOkLoading]="isManageRuleModalOkLoading"
|
||||
>
|
||||
<div *nzModalContent class = "-inner-content">
|
||||
<div *nzModalContent class="-inner-content">
|
||||
<form nz-form>
|
||||
<nz-form-item>
|
||||
<nz-form-label [nzSpan]="7" nzFor= 'rule_name' nzRequired="true">策略名称</nz-form-label>
|
||||
<nz-form-label [nzSpan]="7" nzFor="rule_name" nzRequired="true">策略名称</nz-form-label>
|
||||
<nz-form-control [nzSpan]="8">
|
||||
<input [(ngModel)]="rule.name" nz-input name="rule_name" type="text" id="rule_name">
|
||||
<input [(ngModel)]="rule.name" nz-input name="rule_name" type="text" id="rule_name" />
|
||||
</nz-form-control>
|
||||
</nz-form-item >
|
||||
</nz-form-item>
|
||||
<nz-form-item>
|
||||
<nz-form-label nzSpan="7" nzRequired="true" nzFor= "filterAll">转发所有</nz-form-label>
|
||||
<nz-form-label nzSpan="7" nzRequired="true" nzFor="filterAll">转发所有</nz-form-label>
|
||||
<nz-form-control nzSpan="8">
|
||||
<nz-switch [(ngModel)]="rule.filterAll" disabled name="filterAll" id="filterAll"></nz-switch>
|
||||
</nz-form-control>
|
||||
</nz-form-item >
|
||||
</nz-form-item>
|
||||
<nz-form-item>
|
||||
<nz-form-label nzSpan="7" nzRequired="true" nzFor= "receiver">接收人</nz-form-label>
|
||||
<nz-form-label nzSpan="7" nzRequired="true" nzFor="receiver">接收人</nz-form-label>
|
||||
<nz-form-control nzSpan="8">
|
||||
<nz-select
|
||||
[(ngModel)]="rule.receiverId"
|
||||
@@ -238,17 +235,18 @@
|
||||
nzShowSearch
|
||||
nzAllowClear
|
||||
nzPlaceHolder="Select a person"
|
||||
name="receiver" id="receiver"
|
||||
name="receiver"
|
||||
id="receiver"
|
||||
>
|
||||
</nz-select>
|
||||
</nz-form-control>
|
||||
</nz-form-item >
|
||||
</nz-form-item>
|
||||
<nz-form-item>
|
||||
<nz-form-label nzSpan="7" nzRequired="true" nzFor= "enable">是否启用</nz-form-label>
|
||||
<nz-form-label nzSpan="7" nzRequired="true" nzFor="enable">是否启用</nz-form-label>
|
||||
<nz-form-control nzSpan="8">
|
||||
<nz-switch [(ngModel)]="rule.enable" name="enable" id="enable"></nz-switch>
|
||||
</nz-form-control>
|
||||
</nz-form-item >
|
||||
</nz-form-item>
|
||||
</form>
|
||||
</div>
|
||||
</nz-modal>
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('AlertNoticeComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ AlertNoticeComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [AlertNoticeComponent]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import {NzNotificationService} from "ng-zorro-antd/notification";
|
||||
import {NoticeReceiverService} from "../../../service/notice-receiver.service";
|
||||
import {NoticeRuleService} from "../../../service/notice-rule.service";
|
||||
import {NoticeReceiver} from "../../../pojo/NoticeReceiver";
|
||||
import {finalize} from "rxjs/operators";
|
||||
import {NoticeRule} from "../../../pojo/NoticeRule";
|
||||
import {NzModalService} from "ng-zorro-antd/modal";
|
||||
import { NzModalService } from 'ng-zorro-antd/modal';
|
||||
import { NzNotificationService } from 'ng-zorro-antd/notification';
|
||||
import { finalize } from 'rxjs/operators';
|
||||
|
||||
import { NoticeReceiver } from '../../../pojo/NoticeReceiver';
|
||||
import { NoticeRule } from '../../../pojo/NoticeRule';
|
||||
import { NoticeReceiverService } from '../../../service/notice-receiver.service';
|
||||
import { NoticeRuleService } from '../../../service/notice-rule.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-alert-notice',
|
||||
templateUrl: './alert-notice.component.html',
|
||||
styles: [
|
||||
]
|
||||
styles: []
|
||||
})
|
||||
export class AlertNoticeComponent implements OnInit {
|
||||
|
||||
constructor(private notifySvc: NzNotificationService,
|
||||
private noticeReceiverSvc: NoticeReceiverService,
|
||||
private modal: NzModalService,
|
||||
private noticeRuleSvc : NoticeRuleService) { }
|
||||
constructor(
|
||||
private notifySvc: NzNotificationService,
|
||||
private noticeReceiverSvc: NoticeReceiverService,
|
||||
private modal: NzModalService,
|
||||
private noticeRuleSvc: NoticeRuleService
|
||||
) {}
|
||||
|
||||
receivers!: NoticeReceiver[];
|
||||
receiverTableLoading: boolean = true;
|
||||
@@ -38,8 +39,8 @@ export class AlertNoticeComponent implements OnInit {
|
||||
|
||||
loadReceiversTable() {
|
||||
this.receiverTableLoading = true;
|
||||
let receiverInit$ = this.noticeReceiverSvc.getReceivers()
|
||||
.subscribe(message => {
|
||||
let receiverInit$ = this.noticeReceiverSvc.getReceivers().subscribe(
|
||||
message => {
|
||||
this.receiverTableLoading = false;
|
||||
if (message.code === 0) {
|
||||
this.receivers = message.data;
|
||||
@@ -47,16 +48,18 @@ export class AlertNoticeComponent implements OnInit {
|
||||
console.warn(message.msg);
|
||||
}
|
||||
receiverInit$.unsubscribe();
|
||||
}, error => {
|
||||
},
|
||||
error => {
|
||||
console.error(error.msg);
|
||||
this.receiverTableLoading = false;
|
||||
receiverInit$.unsubscribe();
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
loadRulesTable() {
|
||||
this.ruleTableLoading = true;
|
||||
let rulesInit$ = this.noticeRuleSvc.getNoticeRules()
|
||||
.subscribe(message => {
|
||||
let rulesInit$ = this.noticeRuleSvc.getNoticeRules().subscribe(
|
||||
message => {
|
||||
this.ruleTableLoading = false;
|
||||
if (message.code === 0) {
|
||||
this.rules = message.data;
|
||||
@@ -64,71 +67,85 @@ export class AlertNoticeComponent implements OnInit {
|
||||
console.warn(message.msg);
|
||||
}
|
||||
rulesInit$.unsubscribe();
|
||||
}, error => {
|
||||
},
|
||||
error => {
|
||||
console.error(error.msg);
|
||||
this.ruleTableLoading = false;
|
||||
rulesInit$.unsubscribe();
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
onDeleteOneNoticeReceiver(receiveId : number) {
|
||||
onDeleteOneNoticeReceiver(receiveId: number) {
|
||||
this.modal.confirm({
|
||||
nzTitle: '请确认是否删除!',
|
||||
nzOkText: '确定',
|
||||
nzCancelText: '取消',
|
||||
nzOkDanger: true,
|
||||
nzOkType: "primary",
|
||||
nzOkType: 'primary',
|
||||
nzOnOk: () => this.deleteOneNoticeReceiver(receiveId)
|
||||
});
|
||||
}
|
||||
|
||||
deleteOneNoticeReceiver(receiveId : number) {
|
||||
const deleteReceiver$ = this.noticeReceiverSvc.deleteReceiver(receiveId)
|
||||
.pipe(finalize(() => {
|
||||
deleteReceiver$.unsubscribe();
|
||||
}))
|
||||
.subscribe(message => {
|
||||
if (message.code === 0) {
|
||||
this.notifySvc.success("删除成功!", "");
|
||||
this.loadReceiversTable();
|
||||
} else {
|
||||
this.notifySvc.error("删除失败!", message.msg);
|
||||
deleteOneNoticeReceiver(receiveId: number) {
|
||||
const deleteReceiver$ = this.noticeReceiverSvc
|
||||
.deleteReceiver(receiveId)
|
||||
.pipe(
|
||||
finalize(() => {
|
||||
deleteReceiver$.unsubscribe();
|
||||
})
|
||||
)
|
||||
.subscribe(
|
||||
message => {
|
||||
if (message.code === 0) {
|
||||
this.notifySvc.success('删除成功!', '');
|
||||
this.loadReceiversTable();
|
||||
} else {
|
||||
this.notifySvc.error('删除失败!', message.msg);
|
||||
}
|
||||
},
|
||||
error => {
|
||||
this.notifySvc.error('删除失败!', error.msg);
|
||||
}
|
||||
}, error => {
|
||||
this.notifySvc.error("删除失败!", error.msg);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
onDeleteOneNoticeRule(ruleId : number) {
|
||||
onDeleteOneNoticeRule(ruleId: number) {
|
||||
this.modal.confirm({
|
||||
nzTitle: '请确认是否删除!',
|
||||
nzOkText: '确定',
|
||||
nzCancelText: '取消',
|
||||
nzOkDanger: true,
|
||||
nzOkType: "primary",
|
||||
nzOkType: 'primary',
|
||||
nzOnOk: () => this.deleteOneNoticeRule(ruleId)
|
||||
});
|
||||
}
|
||||
|
||||
deleteOneNoticeRule(ruleId : number) {
|
||||
const deleteRule$ = this.noticeRuleSvc.deleteNoticeRule(ruleId)
|
||||
.pipe(finalize(() => {
|
||||
deleteRule$.unsubscribe();
|
||||
}))
|
||||
.subscribe(message => {
|
||||
if (message.code === 0) {
|
||||
this.notifySvc.success("删除成功!", "");
|
||||
this.loadRulesTable();
|
||||
} else {
|
||||
this.notifySvc.error("删除失败!", message.msg);
|
||||
deleteOneNoticeRule(ruleId: number) {
|
||||
const deleteRule$ = this.noticeRuleSvc
|
||||
.deleteNoticeRule(ruleId)
|
||||
.pipe(
|
||||
finalize(() => {
|
||||
deleteRule$.unsubscribe();
|
||||
})
|
||||
)
|
||||
.subscribe(
|
||||
message => {
|
||||
if (message.code === 0) {
|
||||
this.notifySvc.success('删除成功!', '');
|
||||
this.loadRulesTable();
|
||||
} else {
|
||||
this.notifySvc.error('删除失败!', message.msg);
|
||||
}
|
||||
},
|
||||
error => {
|
||||
this.notifySvc.error('删除失败!', error.msg);
|
||||
}
|
||||
}, error => {
|
||||
this.notifySvc.error("删除失败!", error.msg);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
// start 新增或修改通知接收人弹出框
|
||||
isManageReceiverModalVisible : boolean = false;
|
||||
isManageReceiverModalVisible: boolean = false;
|
||||
isManageReceiverModalAdd: boolean = true;
|
||||
isManageReceiverModalOkLoading: boolean = false;
|
||||
receiver!: NoticeReceiver;
|
||||
@@ -138,7 +155,7 @@ export class AlertNoticeComponent implements OnInit {
|
||||
this.isManageReceiverModalVisible = true;
|
||||
this.isManageReceiverModalAdd = true;
|
||||
}
|
||||
onEditOneNoticeReceiver(receiver : NoticeReceiver) {
|
||||
onEditOneNoticeReceiver(receiver: NoticeReceiver) {
|
||||
this.receiver = receiver;
|
||||
this.isManageReceiverModalVisible = true;
|
||||
this.isManageReceiverModalAdd = false;
|
||||
@@ -150,44 +167,56 @@ export class AlertNoticeComponent implements OnInit {
|
||||
onManageReceiverModalOk() {
|
||||
this.isManageReceiverModalOkLoading = true;
|
||||
if (this.isManageReceiverModalAdd) {
|
||||
const modalOk$ = this.noticeReceiverSvc.newReceiver(this.receiver)
|
||||
.pipe(finalize(() => {
|
||||
modalOk$.unsubscribe();
|
||||
this.isManageReceiverModalOkLoading = false;
|
||||
}))
|
||||
.subscribe(message => {
|
||||
if (message.code === 0) {
|
||||
this.isManageReceiverModalVisible = false;
|
||||
this.notifySvc.success("新增成功!", "");
|
||||
this.loadReceiversTable();
|
||||
} else {
|
||||
this.notifySvc.error("新增失败!", message.msg);
|
||||
const modalOk$ = this.noticeReceiverSvc
|
||||
.newReceiver(this.receiver)
|
||||
.pipe(
|
||||
finalize(() => {
|
||||
modalOk$.unsubscribe();
|
||||
this.isManageReceiverModalOkLoading = false;
|
||||
})
|
||||
)
|
||||
.subscribe(
|
||||
message => {
|
||||
if (message.code === 0) {
|
||||
this.isManageReceiverModalVisible = false;
|
||||
this.notifySvc.success('新增成功!', '');
|
||||
this.loadReceiversTable();
|
||||
} else {
|
||||
this.notifySvc.error('新增失败!', message.msg);
|
||||
}
|
||||
},
|
||||
error => {
|
||||
this.notifySvc.error('新增失败!', error.msg);
|
||||
}
|
||||
}, error => {
|
||||
this.notifySvc.error("新增失败!", error.msg);
|
||||
})
|
||||
);
|
||||
} else {
|
||||
const modalOk$ = this.noticeReceiverSvc.editReceiver(this.receiver)
|
||||
.pipe(finalize(() => {
|
||||
modalOk$.unsubscribe();
|
||||
this.isManageReceiverModalOkLoading = false;
|
||||
}))
|
||||
.subscribe(message => {
|
||||
if (message.code === 0) {
|
||||
this.isManageReceiverModalVisible = false;
|
||||
this.notifySvc.success("修改成功!", "");
|
||||
this.loadReceiversTable();
|
||||
} else {
|
||||
this.notifySvc.error("修改失败!", message.msg);
|
||||
const modalOk$ = this.noticeReceiverSvc
|
||||
.editReceiver(this.receiver)
|
||||
.pipe(
|
||||
finalize(() => {
|
||||
modalOk$.unsubscribe();
|
||||
this.isManageReceiverModalOkLoading = false;
|
||||
})
|
||||
)
|
||||
.subscribe(
|
||||
message => {
|
||||
if (message.code === 0) {
|
||||
this.isManageReceiverModalVisible = false;
|
||||
this.notifySvc.success('修改成功!', '');
|
||||
this.loadReceiversTable();
|
||||
} else {
|
||||
this.notifySvc.error('修改失败!', message.msg);
|
||||
}
|
||||
},
|
||||
error => {
|
||||
this.notifySvc.error('修改失败!', error.msg);
|
||||
}
|
||||
}, error => {
|
||||
this.notifySvc.error("修改失败!", error.msg);
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// start 新增或修改通知策略弹出框
|
||||
isManageRuleModalVisible : boolean = false;
|
||||
isManageRuleModalVisible: boolean = false;
|
||||
isManageRuleModalAdd: boolean = true;
|
||||
isManageRuleModalOkLoading: boolean = false;
|
||||
rule!: NoticeRule;
|
||||
@@ -199,43 +228,53 @@ export class AlertNoticeComponent implements OnInit {
|
||||
this.isManageRuleModalAdd = true;
|
||||
}
|
||||
|
||||
onEditOneNoticeRule(rule : NoticeRule) {
|
||||
onEditOneNoticeRule(rule: NoticeRule) {
|
||||
this.rule = rule;
|
||||
this.isManageRuleModalVisible = true;
|
||||
this.isManageRuleModalAdd = false;
|
||||
this.receiversOption.push({
|
||||
value: rule.receiverId,
|
||||
label: rule.receiverName
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
loadReceiversOption() {
|
||||
let receiverOption$ = this.noticeReceiverSvc.getReceivers()
|
||||
.subscribe(message => {
|
||||
let receiverOption$ = this.noticeReceiverSvc.getReceivers().subscribe(
|
||||
message => {
|
||||
if (message.code === 0) {
|
||||
let data = message.data;
|
||||
this.receiversOption = [];
|
||||
data.forEach(item => {
|
||||
let label = item.name + '-';
|
||||
let label = `${item.name}-`;
|
||||
switch (item.type) {
|
||||
case 0: label = label + 'Phone';break;
|
||||
case 1: label = label + 'Email';break;
|
||||
case 2: label = label + 'WebHook';break;
|
||||
case 3: label = label + 'WeChat';break;
|
||||
case 0:
|
||||
label = `${label}Phone`;
|
||||
break;
|
||||
case 1:
|
||||
label = `${label}Email`;
|
||||
break;
|
||||
case 2:
|
||||
label = `${label}WebHook`;
|
||||
break;
|
||||
case 3:
|
||||
label = `${label}WeChat`;
|
||||
break;
|
||||
}
|
||||
this.receiversOption.push({
|
||||
value: item.id,
|
||||
label: label
|
||||
});
|
||||
})
|
||||
});
|
||||
} else {
|
||||
console.warn(message.msg);
|
||||
}
|
||||
receiverOption$.unsubscribe();
|
||||
}, error => {
|
||||
},
|
||||
error => {
|
||||
console.error(error.msg);
|
||||
receiverOption$.unsubscribe();
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
onManageRuleModalCancel() {
|
||||
@@ -250,40 +289,51 @@ export class AlertNoticeComponent implements OnInit {
|
||||
});
|
||||
this.isManageRuleModalOkLoading = true;
|
||||
if (this.isManageRuleModalAdd) {
|
||||
const modalOk$ = this.noticeRuleSvc.newNoticeRule(this.rule)
|
||||
.pipe(finalize(() => {
|
||||
modalOk$.unsubscribe();
|
||||
this.isManageRuleModalOkLoading = false;
|
||||
}))
|
||||
.subscribe(message => {
|
||||
if (message.code === 0) {
|
||||
this.isManageRuleModalVisible = false;
|
||||
this.notifySvc.success("新增成功!", "");
|
||||
this.loadRulesTable();
|
||||
} else {
|
||||
this.notifySvc.error("新增失败!", message.msg);
|
||||
const modalOk$ = this.noticeRuleSvc
|
||||
.newNoticeRule(this.rule)
|
||||
.pipe(
|
||||
finalize(() => {
|
||||
modalOk$.unsubscribe();
|
||||
this.isManageRuleModalOkLoading = false;
|
||||
})
|
||||
)
|
||||
.subscribe(
|
||||
message => {
|
||||
if (message.code === 0) {
|
||||
this.isManageRuleModalVisible = false;
|
||||
this.notifySvc.success('新增成功!', '');
|
||||
this.loadRulesTable();
|
||||
} else {
|
||||
this.notifySvc.error('新增失败!', message.msg);
|
||||
}
|
||||
},
|
||||
error => {
|
||||
this.notifySvc.error('新增失败!', error.msg);
|
||||
}
|
||||
}, error => {
|
||||
this.notifySvc.error("新增失败!", error.msg);
|
||||
})
|
||||
);
|
||||
} else {
|
||||
const modalOk$ = this.noticeRuleSvc.editNoticeRule(this.rule)
|
||||
.pipe(finalize(() => {
|
||||
modalOk$.unsubscribe();
|
||||
this.isManageRuleModalOkLoading = false;
|
||||
}))
|
||||
.subscribe(message => {
|
||||
if (message.code === 0) {
|
||||
this.isManageRuleModalVisible = false;
|
||||
this.notifySvc.success("修改成功!", "");
|
||||
this.loadRulesTable();
|
||||
} else {
|
||||
this.notifySvc.error("修改失败!", message.msg);
|
||||
const modalOk$ = this.noticeRuleSvc
|
||||
.editNoticeRule(this.rule)
|
||||
.pipe(
|
||||
finalize(() => {
|
||||
modalOk$.unsubscribe();
|
||||
this.isManageRuleModalOkLoading = false;
|
||||
})
|
||||
)
|
||||
.subscribe(
|
||||
message => {
|
||||
if (message.code === 0) {
|
||||
this.isManageRuleModalVisible = false;
|
||||
this.notifySvc.success('修改成功!', '');
|
||||
this.loadRulesTable();
|
||||
} else {
|
||||
this.notifySvc.error('修改失败!', message.msg);
|
||||
}
|
||||
},
|
||||
error => {
|
||||
this.notifySvc.error('修改失败!', error.msg);
|
||||
}
|
||||
}, error => {
|
||||
this.notifySvc.error("修改失败!", error.msg);
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user