Sfoglia il codice sorgente

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

tomsun28 4 anni fa
parent
commit
34cfcc0f9f

+ 12 - 6
web-app/src/app/routes/monitor/monitor-edit/monitor-edit.component.ts

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

+ 7 - 2
web-app/src/app/routes/monitor/monitor-new/monitor-new.component.ts

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