feat: Modify the submission logic of the task management component 47/99547/1
authorcyuamber <xuranyjy@chinamobile.com>
Thu, 12 Dec 2019 06:57:26 +0000 (14:57 +0800)
committercyuamber <xuranyjy@chinamobile.com>
Thu, 12 Dec 2019 06:57:34 +0000 (14:57 +0800)
Change-Id: I80d28195efaaf54cdfb2b207fbf9a5c3c7bdcf58
Issue-ID: USECASEUI-368
Signed-off-by: cyuamber <xuranyjy@chinamobile.com>
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.html
usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/slicing-task-model.component.ts

index 81f4c96..4a69cf7 100644 (file)
@@ -70,7 +70,7 @@
                [moduleTitle]="moduleTitle"
                [showDetail]="showDetail"
                [taskId]="taskId"
-               (cancel)="showDetail = $event"
+               (cancel)="handelCancel($event)"
        >
        </app-slicing-task-model>
        <app-check-process-model
index e583290..66adf7b 100644 (file)
@@ -123,4 +123,15 @@ export class SlicingTaskManagementComponent implements OnInit {
       this.showProcess = true;
     }
   }
+
+  handelCancel(obj: any):void {
+    this.showDetail = obj.showDetail;
+    if (obj.bool) {
+      if (this.selectedValue && this.selectedValue !== 'all') {
+        this.getListOfProcessingStatus();
+      } else {
+        this.getTaskList();
+      }
+    }
+  }
 }
index a5aaeb7..62bec93 100644 (file)
@@ -1,5 +1,4 @@
-<nz-modal [nzVisible]="showDetail" nzWidth="85%" [nzTitle]="moduleTitle" (nzOnCancel)="handleCancel()"
-  (nzOnOk)="handleOk()">
+<nz-modal [nzVisible]="showDetail" nzWidth="85%" [nzTitle]="moduleTitle" [nzFooter]="modalFooter">
   <nz-spin [nzSpinning]="isSpinning">
     <app-basic-info
       [checkDetail]="checkDetail"
         </nz-list-item>
       </nz-list>
     </div>
-
   </nz-spin>
 </nz-modal>
+<ng-template #modalFooter>
+  <button nz-button (click)="handleCancel()">Cancel</button>
+  <button nz-button nzType="primary" [nzLoading]='loading' (click)="handleOk()">OK</button>
+</ng-template>
 <app-subnet-params-model 
   [showModel]="isShowParams" 
   [detailData]="params" 
index f6d548d..33dec99 100644 (file)
@@ -11,7 +11,7 @@ export class SlicingTaskModelComponent implements OnInit {
   @Input() showDetail: boolean;
   @Input() moduleTitle: string;
   @Input() taskId: string;
-  @Output() cancel = new EventEmitter<boolean>();
+  @Output() cancel = new EventEmitter<object>();
   @ViewChild('notification') notification1: any;
 
   constructor(private http: SlicingTaskServices, private message: NzMessageService) { }
@@ -72,6 +72,7 @@ export class SlicingTaskModelComponent implements OnInit {
   params: any;
   // 获取数据loading
   isSpinning: boolean = false;
+  loading: boolean = false;
   
 
   ngOnInit() { }
@@ -333,11 +334,12 @@ export class SlicingTaskModelComponent implements OnInit {
     this.slicingSubnet[index].params = params
   }
 
-  handleCancel() {
+  handleCancel(bool: boolean = false) {
     this.showDetail = false;
-    this.cancel.emit(this.showDetail);
+    this.cancel.emit({showDetail: this.showDetail, bool});
   }
   handleOk() {
+    this.loading = true;
     const { selectedServiceId, selectedServiceName, slicingSubnet, checkDetail, businessRequirement, NSTinfo } = this;
     const nsi_nssi_info: object = {
       suggest_nsi_id:  selectedServiceId,
@@ -355,15 +357,16 @@ 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.notification1.notificationStart('Task', 'Sumbit', this.taskId)
     this.http.submitSlicing(reqBody).subscribe (res => {
       const { result_header: { result_code } } = res;
       if (+result_code === 200) {
-        this.handleCancel();
         this.notification1.notificationSuccess('Task', 'Sumbit', this.taskId)
       } else {
         this.notification1.notificationFailed('Task', 'Sumbit', this.taskId)
       }
+      this.loading = false;
+      this.handleCancel(true);
     })
   }
 }