Bläddra i källkod

[web-app] 增加同步按钮

tomsun28 4 år sedan
förälder
incheckning
c8943133bd

+ 3 - 0
web-app/src/app/routes/alert/alert-center/alert-center.component.html

@@ -17,6 +17,9 @@
   <i nz-icon nzType="delete" nzTheme="outline"></i>
   删除告警
 </button>
+<button nz-button nzType="primary" (click)="sync()">
+  <i nz-icon nzType="sync" nzTheme="outline"></i>
+</button>
 
 <nz-table #fixedTable [nzData]="alerts"
           [nzPageIndex]="pageIndex" [nzPageSize]="pageSize" [nzTotal]="total"

+ 4 - 0
web-app/src/app/routes/alert/alert-center/alert-center.component.ts

@@ -28,6 +28,10 @@ export class AlertCenterComponent implements OnInit {
     this.loadAlertsTable();
   }
 
+  sync() {
+    this.loadAlertsTable();
+  }
+
   loadAlertsTable() {
     this.tableLoading = true;
     let alertsInit$ = this.alertSvc.getAlerts(this.pageIndex - 1, this.pageSize)

+ 9 - 3
web-app/src/app/routes/alert/alert-notice/alert-notice.component.html

@@ -19,6 +19,9 @@
       <i nz-icon nzType="appstore-add" nzTheme="outline"></i>
       新增接收人
     </button>
+    <button nz-button nzType="primary" (click)="syncReceiver()">
+      <i nz-icon nzType="sync" nzTheme="outline"></i>
+    </button>
     <nz-table #fixedTable [nzData]="receivers"
               nzFrontPagination ="false"
               [nzLoading] = "receiverTableLoading"
@@ -38,7 +41,7 @@
           <span>{{ data.name}}</span>
         </td>
         <td nzAlign="center">
-          <nz-tag *ngIf="data.type == 0" nzColor="red">
+          <nz-tag *ngIf="data.type == 0" nzColor="orange">
             <i nz-icon nzType="notification" nzTheme="outline"></i>
             <span>短信</span>
           </nz-tag>
@@ -46,11 +49,11 @@
             <i nz-icon nzType="notification" nzTheme="outline"></i>
             <span>邮件</span>
           </nz-tag>
-          <nz-tag *ngIf="data.type == 2" nzColor="yellow">
+          <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="yellow">
+          <nz-tag *ngIf="data.type == 3" nzColor="orange">
             <i nz-icon nzType="notification" nzTheme="outline"></i>
             <span>微信公众号</span>
           </nz-tag>
@@ -79,6 +82,9 @@
       <i nz-icon nzType="appstore-add" nzTheme="outline"></i>
       新增通知策略
     </button>
+    <button nz-button nzType="primary" (click)="syncRule()">
+      <i nz-icon nzType="sync" nzTheme="outline"></i>
+    </button>
     <nz-table #ruleFixedTable [nzData]="rules"
               nzFrontPagination ="false"
               [nzLoading] = "ruleTableLoading"

+ 6 - 0
web-app/src/app/routes/alert/alert-notice/alert-notice.component.ts

@@ -27,6 +27,12 @@ export class AlertNoticeComponent implements OnInit {
     this.loadReceiversTable();
     this.loadRulesTable();
   }
+  syncReceiver() {
+    this.loadReceiversTable();
+  }
+  syncRule() {
+    this.loadRulesTable();
+  }
 
   loadReceiversTable() {
     this.receiverTableLoading = true;

+ 3 - 0
web-app/src/app/routes/alert/alert-setting/alert-setting.component.html

@@ -25,6 +25,9 @@
   <i nz-icon nzType="delete" nzTheme="outline"></i>
   删除
 </button>
+<button nz-button nzType="primary" (click)="sync()">
+  <i nz-icon nzType="sync" nzTheme="outline"></i>
+</button>
 
 <nz-table #fixedTable [nzData]="defines"
           [nzPageIndex]="pageIndex" [nzPageSize]="pageSize" [nzTotal]="total"

+ 5 - 6
web-app/src/app/routes/alert/alert-setting/alert-setting.component.ts

@@ -1,9 +1,7 @@
 import { Component, OnInit } from '@angular/core';
 import {NzTableQueryParams} from "ng-zorro-antd/table";
-import {ActivatedRoute, Router} from "@angular/router";
 import {NzModalService} from "ng-zorro-antd/modal";
 import {NzNotificationService} from "ng-zorro-antd/notification";
-import {NzMessageService} from "ng-zorro-antd/message";
 import {AlertDefineService} from "../../../service/alert-define.service";
 import {AlertDefine} from "../../../pojo/AlertDefine";
 import {finalize, map} from "rxjs/operators";
@@ -23,11 +21,8 @@ import {Monitor} from "../../../pojo/Monitor";
 })
 export class AlertSettingComponent implements OnInit {
 
-  constructor(private route: ActivatedRoute,
-              private router: Router,
-              private modal: NzModalService,
+  constructor(private modal: NzModalService,
               private notifySvc: NzNotificationService,
-              private msg: NzMessageService,
               private appDefineSvc: AppDefineService,
               private monitorSvc: MonitorService,
               private alertDefineSvc: AlertDefineService) { }
@@ -59,6 +54,10 @@ export class AlertSettingComponent implements OnInit {
       })
   }
 
+  sync() {
+    this.loadAlertDefineTable();
+  }
+
   loadAlertDefineTable() {
     this.tableLoading = true;
     let alertDefineInit$ = this.alertDefineSvc.getAlertDefines(this.pageIndex - 1, this.pageSize)

+ 3 - 1
web-app/src/app/routes/monitor/monitor-list/monitor-list.component.html

@@ -12,7 +12,6 @@
   </nz-breadcrumb-item>
 </nz-breadcrumb>
 <nz-divider></nz-divider>
-
 <button nz-button nzType="primary">
   <a routerLink="/monitors/new" [queryParams]="{app: app}">
     <i nz-icon nzType="appstore-add" nzTheme="outline"></i>
@@ -35,6 +34,9 @@
   <i nz-icon nzType="down-circle" nzTheme="outline"></i>
   取消纳管
 </button>
+<button nz-button nzType="primary" (click)="sync()">
+  <i nz-icon nzType="sync" nzTheme="outline"></i>
+</button>
 
 <nz-table #fixedTable [nzData]="monitors"
           [nzPageIndex]="pageIndex" [nzPageSize]="pageSize" [nzTotal]="total"

+ 5 - 0
web-app/src/app/routes/monitor/monitor-list/monitor-list.component.ts

@@ -42,7 +42,12 @@ export class MonitorListComponent implements OnInit {
       });
   }
 
+  sync() {
+    this.loadMonitorTable();
+  }
+
   loadMonitorTable() {
+    this.tableLoading = true;
     let monitorInit$ = this.monitorSvc.getMonitors(this.app, this.pageIndex - 1, this.pageSize)
       .subscribe(message => {
         this.tableLoading = false;