[web-app] bugfix-监控列表点击动作后选中未清除

This commit is contained in:
tomsun28
2021-12-04 20:45:23 +08:00
parent a1d6c530c7
commit c173500c22
2 changed files with 12 additions and 1 deletions

View File

@@ -46,7 +46,7 @@
nzShowPagination = "true" [nzScroll]="{ x: '1150px', y: '1240px' }"> nzShowPagination = "true" [nzScroll]="{ x: '1150px', y: '1240px' }">
<thead> <thead>
<tr> <tr>
<th nzAlign="center" nzLeft nzWidth="60px" [nzChecked]="checkedAll" (nzCheckedChange)="onAllChecked($event)"></th> <th nzAlign="center" nzLeft nzWidth="60px" [(nzChecked)]="checkedAll" (nzCheckedChange)="onAllChecked($event)"></th>
<th nzAlign="center">监控名称</th> <th nzAlign="center">监控名称</th>
<th nzAlign="center">监控状态</th> <th nzAlign="center">监控状态</th>
<th nzAlign="center">监控主机Host</th> <th nzAlign="center">监控主机Host</th>

View File

@@ -48,6 +48,8 @@ export class MonitorListComponent implements OnInit {
let monitorInit$ = this.monitorSvc.getMonitors(this.app, this.pageIndex - 1, this.pageSize) let monitorInit$ = this.monitorSvc.getMonitors(this.app, this.pageIndex - 1, this.pageSize)
.subscribe(message => { .subscribe(message => {
this.tableLoading = false; this.tableLoading = false;
this.checkedAll = false;
this.checkedMonitorIds.clear();
if (message.code === 0) { if (message.code === 0) {
this.pageMonitors = message.data; this.pageMonitors = message.data;
this.monitors = this.pageMonitors.content; this.monitors = this.pageMonitors.content;
@@ -123,6 +125,7 @@ export class MonitorListComponent implements OnInit {
this.notifySvc.warning("未选中任何待删除项!",""); this.notifySvc.warning("未选中任何待删除项!","");
return; return;
} }
this.tableLoading = true;
const deleteMonitors$ = this.monitorSvc.deleteMonitors(monitors) const deleteMonitors$ = this.monitorSvc.deleteMonitors(monitors)
.subscribe(message => { .subscribe(message => {
deleteMonitors$.unsubscribe(); deleteMonitors$.unsubscribe();
@@ -130,10 +133,12 @@ export class MonitorListComponent implements OnInit {
this.notifySvc.success("删除成功!", ""); this.notifySvc.success("删除成功!", "");
this.loadMonitorTable(); this.loadMonitorTable();
} else { } else {
this.tableLoading = false;
this.notifySvc.error("删除失败!", message.msg); this.notifySvc.error("删除失败!", message.msg);
} }
}, },
error => { error => {
this.tableLoading = false;
deleteMonitors$.unsubscribe(); deleteMonitors$.unsubscribe();
this.notifySvc.error("删除失败!", error.msg) this.notifySvc.error("删除失败!", error.msg)
} }
@@ -169,6 +174,7 @@ export class MonitorListComponent implements OnInit {
} }
cancelManageMonitors(monitors: Set<number>) { cancelManageMonitors(monitors: Set<number>) {
this.tableLoading = true;
const cancelManage$ = this.monitorSvc.cancelManageMonitors(monitors) const cancelManage$ = this.monitorSvc.cancelManageMonitors(monitors)
.subscribe(message => { .subscribe(message => {
cancelManage$.unsubscribe(); cancelManage$.unsubscribe();
@@ -176,10 +182,12 @@ export class MonitorListComponent implements OnInit {
this.notifySvc.success("取消纳管成功!", ""); this.notifySvc.success("取消纳管成功!", "");
this.loadMonitorTable(); this.loadMonitorTable();
} else { } else {
this.tableLoading = false;
this.notifySvc.error("取消纳管失败!", message.msg); this.notifySvc.error("取消纳管失败!", message.msg);
} }
}, },
error => { error => {
this.tableLoading = false;
cancelManage$.unsubscribe(); cancelManage$.unsubscribe();
this.notifySvc.error("取消纳管失败!", error.msg) this.notifySvc.error("取消纳管失败!", error.msg)
} }
@@ -215,6 +223,7 @@ export class MonitorListComponent implements OnInit {
} }
enableManageMonitors(monitors: Set<number>) { enableManageMonitors(monitors: Set<number>) {
this.tableLoading = true;
const enableManage$ = this.monitorSvc.enableManageMonitors(monitors) const enableManage$ = this.monitorSvc.enableManageMonitors(monitors)
.subscribe(message => { .subscribe(message => {
enableManage$.unsubscribe(); enableManage$.unsubscribe();
@@ -222,10 +231,12 @@ export class MonitorListComponent implements OnInit {
this.notifySvc.success("启用纳管成功!", ""); this.notifySvc.success("启用纳管成功!", "");
this.loadMonitorTable(); this.loadMonitorTable();
} else { } else {
this.tableLoading = false;
this.notifySvc.error("启用纳管失败!", message.msg); this.notifySvc.error("启用纳管失败!", message.msg);
} }
}, },
error => { error => {
this.tableLoading = false;
enableManage$.unsubscribe(); enableManage$.unsubscribe();
this.notifySvc.error("启用纳管失败!", error.msg) this.notifySvc.error("启用纳管失败!", error.msg)
} }