[web-app,manager] 监控启动取消纳管功能

This commit is contained in:
tomsun28
2021-12-03 21:25:26 +08:00
parent 5d94fc2f0d
commit 6d7926c020
6 changed files with 206 additions and 8 deletions

View File

@@ -26,11 +26,11 @@
<i nz-icon nzType="delete" nzTheme="outline"></i>
删除
</button>
<button nz-button nzType="primary">
<button nz-button nzType="primary" (click)="onEnableManageMonitors()">
<i nz-icon nzType="up-circle" nzTheme="outline"></i>
纳管
纳管
</button>
<button nz-button nzType="primary">
<button nz-button nzType="primary" (click)="onCancelManageMonitors()">
<i nz-icon nzType="down-circle" nzTheme="outline"></i>
取消纳管
</button>
@@ -93,13 +93,13 @@
<button nz-button nzType="primary" (click)="onEditOneMonitor(data.id)">
<i nz-icon nzType="edit" nzTheme="outline"></i>
</button>
<button nz-button nzType="primary"(click)="onDeleteOneMonitor(data.id)">
<button nz-button nzType="primary" (click)="onDeleteOneMonitor(data.id)">
<i nz-icon nzType="delete" nzTheme="outline"></i>
</button>
<button nz-button nzType="primary">
<button nz-button nzType="primary" (click)="onEnableManageOneMonitor(data.id)">
<i nz-icon nzType="up-circle" nzTheme="outline"></i>
</button>
<button nz-button nzType="primary">
<button nz-button nzType="primary" (click)="onCancelManageOneMonitor(data.id)">
<i nz-icon nzType="down-circle" nzTheme="outline"></i>
</button>
</td>

View File

@@ -38,6 +38,8 @@ export class MonitorListComponent implements OnInit {
this.app = paramMap.get("app") || '';
this.pageIndex = 1;
this.pageSize = 8;
this.checkedMonitorIds = new Set<number>();
this.tableLoading = true;
this.loadMonitorTable();
});
}
@@ -138,6 +140,97 @@ export class MonitorListComponent implements OnInit {
);
}
onCancelManageMonitors() {
if (this.checkedMonitorIds == null || this.checkedMonitorIds.size === 0) {
this.notifySvc.warning("未选中任何待取消项!","");
return;
}
this.modal.confirm({
nzTitle: '请确认是否批量取消纳管!',
nzOkText: '确定',
nzCancelText: '取消',
nzOkDanger: true,
nzOkType: "primary",
nzOnOk: () => this.cancelManageMonitors(this.checkedMonitorIds)
});
}
onCancelManageOneMonitor(monitorId: number) {
let monitors = new Set<number>();
monitors.add(monitorId);
this.modal.confirm({
nzTitle: '请确认是否取消纳管!',
nzOkText: '确定',
nzCancelText: '取消',
nzOkDanger: true,
nzOkType: "primary",
nzOnOk: () => this.cancelManageMonitors(monitors)
});
}
cancelManageMonitors(monitors: Set<number>) {
const cancelManage$ = this.monitorSvc.cancelManageMonitors(monitors)
.subscribe(message => {
cancelManage$.unsubscribe();
if (message.code === 0) {
this.notifySvc.success("取消纳管成功!", "");
this.loadMonitorTable();
} else {
this.notifySvc.error("取消纳管失败!", message.msg);
}
},
error => {
cancelManage$.unsubscribe();
this.notifySvc.error("取消纳管失败!", error.msg)
}
);
}
onEnableManageMonitors() {
if (this.checkedMonitorIds == null || this.checkedMonitorIds.size === 0) {
this.notifySvc.warning("未选中任何待启用纳管项!","");
return;
}
this.modal.confirm({
nzTitle: '请确认是否批量启用纳管!',
nzOkText: '确定',
nzCancelText: '取消',
nzOkDanger: true,
nzOkType: "primary",
nzOnOk: () => this.enableManageMonitors(this.checkedMonitorIds)
});
}
onEnableManageOneMonitor(monitorId: number) {
let monitors = new Set<number>();
monitors.add(monitorId);
this.modal.confirm({
nzTitle: '请确认是否启用纳管!',
nzOkText: '确定',
nzCancelText: '取消',
nzOkDanger: true,
nzOkType: "primary",
nzOnOk: () => this.enableManageMonitors(monitors)
});
}
enableManageMonitors(monitors: Set<number>) {
const enableManage$ = this.monitorSvc.enableManageMonitors(monitors)
.subscribe(message => {
enableManage$.unsubscribe();
if (message.code === 0) {
this.notifySvc.success("启用纳管成功!", "");
this.loadMonitorTable();
} else {
this.notifySvc.error("启用纳管失败!", message.msg);
}
},
error => {
enableManage$.unsubscribe();
this.notifySvc.error("启用纳管失败!", error.msg)
}
);
}
// begin: 列表多选逻辑
checkedAll: boolean = false;