From 961eb4aa72c04a8898862a61607da422e8c0b906 Mon Sep 17 00:00:00 2001 From: cyuamber Date: Fri, 20 Dec 2019 15:54:09 +0800 Subject: feat: Added error prompt for task management page Change-Id: I59b0785c5904033aa7dfe443330c7a75119ebff5 Issue-ID: USECASEUI-368 Signed-off-by: cyuamber --- .../check-process-model.component.ts | 31 +++++++++++++--------- .../slicing-task-management.component.html | 1 + .../slicing-task-management.component.ts | 13 +++++++-- .../slicing-task-model.component.ts | 26 +++++++++++++----- 4 files changed, 50 insertions(+), 21 deletions(-) (limited to 'usecaseui-portal/src/app/views') diff --git a/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/check-process-model/check-process-model.component.ts b/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/check-process-model/check-process-model.component.ts index 797165f6..181eaf7a 100644 --- a/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/check-process-model/check-process-model.component.ts +++ b/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/check-process-model/check-process-model.component.ts @@ -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(); @@ -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(); }) } diff --git a/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-management.component.html b/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-management.component.html index 4a69cf7a..0fadf70a 100644 --- a/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-management.component.html +++ b/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-management.component.html @@ -76,6 +76,7 @@ diff --git a/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-management.component.ts b/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-management.component.ts index 66adf7b4..1429adec 100644 --- a/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-management.component.ts +++ b/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-management.component.ts @@ -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; } } diff --git a/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/slicing-task-model.component.ts b/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/slicing-task-model.component.ts index 4bf55dde..bca8e75c 100644 --- a/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/slicing-task-model.component.ts +++ b/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/slicing-task-model.component.ts @@ -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; }) } } -- cgit 1.2.3-korg