[web-app] bugfix-新增探测异常时页面不恢复

This commit is contained in:
tomsun28
2021-12-03 13:53:36 +08:00
parent 4ae1145d19
commit f3788549f7
2 changed files with 19 additions and 8 deletions

View File

@@ -53,7 +53,7 @@ export class MonitorEditComponent implements OnInit {
this.params = message.data.params; this.params = message.data.params;
} else { } else {
console.warn(message.msg); console.warn(message.msg);
this.notifySvc.error("查询此监控异常", message.msg); this.notifySvc.error("查询异常,此监控不存在", message.msg);
return throwError("查询此监控异常"); return throwError("查询此监控异常");
} }
return this.appDefineSvc.getAppParamsDefine(this.monitor.app); return this.appDefineSvc.getAppParamsDefine(this.monitor.app);
@@ -98,13 +98,14 @@ export class MonitorEditComponent implements OnInit {
.subscribe(message => { .subscribe(message => {
this.isSpinning = false; this.isSpinning = false;
if (message.code === 0) { if (message.code === 0) {
this.notifySvc.success("新增监控成功", ""); this.notifySvc.success("修改监控成功", "");
this.router.navigateByUrl("/monitors") this.router.navigateByUrl("/monitors")
} else { } else {
this.notifySvc.error("新增监控失败", message.msg); this.notifySvc.error("修改监控失败", message.msg);
}}, }},
error => { error => {
this.isSpinning = false this.isSpinning = false;
this.notifySvc.error("修改监控失败", error.error.msg);
} }
) )
} }
@@ -122,7 +123,7 @@ export class MonitorEditComponent implements OnInit {
"params": this.params "params": this.params
}; };
this.isSpinning = true; this.isSpinning = true;
this.monitorSvc.newMonitor(detectMonitor) this.monitorSvc.editMonitor(detectMonitor)
.subscribe(message => { .subscribe(message => {
this.isSpinning = false; this.isSpinning = false;
if (message.code === 0) { if (message.code === 0) {
@@ -130,7 +131,12 @@ export class MonitorEditComponent implements OnInit {
} else { } else {
this.notifySvc.error("探测失败", message.msg); this.notifySvc.error("探测失败", message.msg);
} }
}) },
error => {
this.isSpinning = false;
this.notifySvc.error("探测异常", error.error.msg);
}
)
} }
onCancel() { onCancel() {

View File

@@ -84,7 +84,8 @@ export class MonitorNewComponent implements OnInit {
this.notifySvc.error("新增监控失败", message.msg); this.notifySvc.error("新增监控失败", message.msg);
}}, }},
error => { error => {
this.isSpinning = false this.isSpinning = false;
this.notifySvc.error("新增监控失败", error.error.msg);
} }
) )
} }
@@ -110,7 +111,11 @@ export class MonitorNewComponent implements OnInit {
} else { } else {
this.notifySvc.error("探测失败", message.msg); this.notifySvc.error("探测失败", message.msg);
} }
}) }, error => {
this.isSpinning = false;
this.notifySvc.error("探测异常", error.error.msg);
}
)
} }
onCancel() { onCancel() {