feat: Added error prompt for task management page 44/99844/1
authorcyuamber <xuranyjy@chinamobile.com>
Fri, 20 Dec 2019 07:54:09 +0000 (15:54 +0800)
committercyuamber <xuranyjy@chinamobile.com>
Fri, 20 Dec 2019 07:54:19 +0000 (15:54 +0800)
Change-Id: I59b0785c5904033aa7dfe443330c7a75119ebff5
Issue-ID: USECASEUI-368
Signed-off-by: cyuamber <xuranyjy@chinamobile.com>
usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/check-process-model/check-process-model.component.ts
usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-management.component.html
usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-management.component.ts
usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/slicing-task-model.component.ts
usecaseui-portal/src/constants/constants.ts

index 797165f..181eaf7 100644 (file)
@@ -12,6 +12,7 @@ export class CheckProcessModelComponent implements OnInit {
        @Input() moduleTitle: string;
        @Input() showProcess: boolean;
        @Input() taskId: string;
+     @Input() moduleOperation: string;
 
        @Output() cancel = new EventEmitter<boolean>();
 
@@ -41,11 +42,6 @@ export class CheckProcessModelComponent implements OnInit {
 
        getInfo(): void {
                this.http.getSlicingBasicInfo(this.taskId).subscribe(res => {
-                       if (this.isGetData) {
-                               this.isSpinning = false;
-                       } else {
-                               this.isGetData = true;
-                       }
                        const { result_body, result_header: { result_code } } = res;
                        if (+result_code === 200) {
                                const {
@@ -73,19 +69,26 @@ export class CheckProcessModelComponent implements OnInit {
                                // 匹配NST信息
                                this.NSTinfo = [nst_info];
                        } else {
-                               const errorMessage = this.moduleTitle === '切片创建中' ? 'Failed to get data' : 'Viewing results failed';
-                               this.message.error(errorMessage)
+                               const errorMessage = this.moduleOperation === 'Creating' ? 'Failed to get data' : 'Viewing results failed';
+                               this.message.error(errorMessage);
                        }
+                       this.isLoadingShow();
+               }, ({status, statusText}) => {
+                       this.message.error(status + ' (' + statusText + ')');
+                       this.isLoadingShow();
                })
        }
 
+       isLoadingShow () {
+               if (this.isGetData) {
+                       this.isSpinning = false;
+               } else {
+                       this.isGetData = true;
+               }
+       }
+
        getProgress(): void {
                this.http.getSlicingCreateProgress(this.taskId).subscribe(res => {
-                       if (this.isGetData) {
-                               this.isSpinning = false;
-                       } else {
-                               this.isGetData = true;
-                       }
                        const { result_body, result_header: { result_code } } = res;
                        if (+result_code === 200) {
                                this.data = [];
@@ -115,6 +118,10 @@ export class CheckProcessModelComponent implements OnInit {
                        } else {
                                this.message.error('Failed to get progress')
                        }
+                       this.isLoadingShow();
+               }, ({status, statusText}) => {
+                       this.message.error(status + ' (' + statusText + ')');
+                       this.isLoadingShow();
                })
        }
 
index 4a69cf7..0fadf70 100644 (file)
@@ -76,6 +76,7 @@
        <app-check-process-model
                [moduleTitle]="moduleTitle"
                [showProcess]="showProcess"
+               [moduleOperation]="moduleOperation"
                [taskId]="taskId"
                (cancel)="showProcess = $event"
        >
index 66adf7b..1429ade 100644 (file)
@@ -17,6 +17,7 @@ export class SlicingTaskManagementComponent implements OnInit {
   selectedValue = 'all';
   taskId: string;
   moduleTitle: string = "";
+  moduleOperation: string;
   listOfData: any[] = [];
   statusOptions: any[] = TASK_PROCESSING_STATUS;
   loading: boolean = false;
@@ -38,9 +39,12 @@ export class SlicingTaskManagementComponent implements OnInit {
         this.dataFormatting(slicing_task_list);
         this.total = record_number;
       } else {
-        this.message.error('Failed to get form data')
+        this.message.error('Failed to get form data');
       }
       this.loading = false;
+    },({status, statusText}) => {
+                       this.message.error(status + ' (' + statusText + ')');
+      this.loading = false;
     })
   }
 
@@ -64,9 +68,13 @@ export class SlicingTaskManagementComponent implements OnInit {
         this.dataFormatting(slicing_task_list)
         this.total = record_number;
       } else {
-        this.message.error('Failed to get form data')
+        this.message.error('Failed to get form data');
       }
       this.loading = false;
+    }, ({status, statusText}) => {
+                       this.message.error(status + ' (' + statusText + ')');
+      this.listOfData = [];
+      this.loading = false;
     })
   }
 
@@ -120,6 +128,7 @@ export class SlicingTaskManagementComponent implements OnInit {
     if (data.processing_status === 'Waiting to Confirm') {
       this.showDetail = true;
     } else {
+      this.moduleOperation = data.operation;
       this.showProcess = true;
     }
   }
index 4bf55dd..bca8e75 100644 (file)
@@ -178,6 +178,9 @@ export class SlicingTaskModelComponent implements OnInit {
       } else {
         this.message.error('Failed to get data')
       }
+    },({status, statusText}) => {
+                       this.message.error(status + ' (' + statusText + ')');
+      this.isSpinning = false;
     })
   }
 
@@ -214,7 +217,10 @@ export class SlicingTaskModelComponent implements OnInit {
         this.slicingInstances.isLoading = false;
         this.slicingInstances.flag = false;
       },2000)
-
+    }, ({status, statusText}) => {
+                       this.message.error(status + ' (' + statusText + ')');
+      this.slicingInstances.isLoading = false;
+      this.slicingInstances.flag = false;
     })
   }
 
@@ -229,6 +235,8 @@ export class SlicingTaskModelComponent implements OnInit {
       } else {
         this.message.error('Failed to get slicing subnet instance ID')
       }
+    }, ({status, statusText}) => {
+                       this.message.error(status + ' (' + statusText + ')');
     }) 
     this.slicingInstances.list.forEach (item => {
       if (item.service_instance_id === this.selectedServiceId) {
@@ -305,16 +313,18 @@ export class SlicingTaskModelComponent implements OnInit {
         this.slicingSubnet.map (item => {
           if (item.context === context) {
             item.total = record_number;
-            setTimeout(() => {
-              item.instances.push(...nssi_service_instances);
-              item.isLoading = false;
-              item.flag = false;
-            },2000)
+            item.instances.push(...nssi_service_instances);
           }
         })
       } else {
         this.message.error('Failed to get slicing subnet instance ID');
       }
+      instance.isLoading = false;
+      instance.flag = false;
+    }, ({status, statusText}) => {
+                       this.message.error(status + ' (' + statusText + ')');
+      instance.isLoading = false;
+      instance.flag = false;
     })
   }
 
@@ -365,7 +375,6 @@ export class SlicingTaskModelComponent implements OnInit {
     delete businessRequirement[0].area
     let reqBody = {...checkDetail[0], business_demand_info: businessRequirement[0], nst_info: NSTinfo[0], nsi_nssi_info};
     delete reqBody.service_snssai;
-    // this.notification1.notificationStart('Task', 'Sumbit', this.taskId)
     this.http.submitSlicing(reqBody).subscribe (res => {
       const { result_header: { result_code } } = res;
       if (+result_code === 200) {
@@ -375,6 +384,9 @@ export class SlicingTaskModelComponent implements OnInit {
       }
       this.loading = false;
       this.handleCancel(true);
+    }, ({status, statusText}) => {
+                       this.message.error(status + ' (' + statusText + ')');
+      this.loading = false;
     })
   }
 }
index fa3c682..d35c4c7 100644 (file)
@@ -9,7 +9,7 @@ export const TASK_PROCESSING_STATUS = [
        },\r
        {\r
                title: 'Waiting to Confirm',\r
-               value: 'Waiting to Confirm'\r
+               value: 'WaitingtoConfirm'\r
        },\r
        {\r
                title: 'Creating',\r