diff options
author | Tao Shen <shentao@chinamobile.com> | 2019-12-26 10:10:31 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-12-26 10:10:31 +0000 |
commit | 6f871653cde9c4579527bddf65fd9684f22eff60 (patch) | |
tree | 5f3324f333c3e357d0a7a9c4c81ced29a559eb52 /usecaseui-portal/src | |
parent | 21dbd718fa1e9f7c8312f87b5b4168777a38fbc3 (diff) | |
parent | edf19113159f8d31946cc40e2a86cff9b7a013c1 (diff) |
Merge "feat: Modified progress logic"
Diffstat (limited to 'usecaseui-portal/src')
3 files changed, 27 insertions, 25 deletions
diff --git a/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/check-process-model/check-process-model.component.html b/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/check-process-model/check-process-model.component.html index ecba2cdf..00a63057 100644 --- a/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/check-process-model/check-process-model.component.html +++ b/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/check-process-model/check-process-model.component.html @@ -30,10 +30,10 @@ <nz-step [nzTitle]="item.title"></nz-step> <nz-step [nzTitle]="item.currentProgress > 1 ? null : 'in progress'" - [nzStatus]="item.status" [nzIcon]="item.status === 'process'? 'anticon anticon-spin anticon-loading' : null" + [nzStatus]="item.status" [nzIcon]="item.status === 'processing'? 'anticon anticon-spin anticon-loading' : null" > </nz-step> - <nz-step [nzStatus]="item.status === 'finish' ? 'finish' : 'wait'" [nzIcon]="item.status === 'process'?'loading': null"> </nz-step> + <nz-step [nzStatus]="item.status === 'finish' ? 'finish' : 'wait'" [nzIcon]="item.status === 'processing' ? 'loading': null"> </nz-step> </nz-steps> <p *ngIf="!data[0].length" [ngStyle]="{marginBottom: 0}">No data</p> </nz-list-item> 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 8a0ef970..95106050 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 @@ -92,23 +92,25 @@ export class CheckProcessModelComponent implements OnInit { const { result_body, result_header: { result_code } } = res; if (+result_code === 200) { this.data = []; - Object.keys(result_body).forEach(item => { - let currentProgress = 1 - let status = 'process'; - if (+result_body[item] === 100) { - currentProgress = 3; - status = 'finish' - } - const title = item === 'an_progress' ? 'An' : (item === 'tn_progress' ? 'Tn' : 'Cn') - let obj = { [item]: result_body[item], currentProgress, title, status }; - if (result_body[item]) { + const nssiList: string[] = ['an', 'tn', 'cn']; + nssiList.forEach( item => { + const progress: number = +result_body[item +'_progress']; + const title: string = item.charAt(0).toUpperCase() + item.slice(1); + let status: string = result_body[item +'_status']; + if ((progress || progress === 0) && status) { + let currentProgress = 1 + if (progress === 100 && status === 'finished') { + currentProgress = 3; + status = 'finish' + } + const obj = { progress, currentProgress, title, status }; this.data.push(obj) } }) this.data = [this.data]; let flag: boolean = false; - Object.values(result_body).forEach(item => { - if (+item !== 100 && typeof item !== 'object') { + nssiList.forEach(item => { + if (result_body[item +'_status'] === 'processing' && result_body[item +'_progress'] !== 0) { flag = 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 f3024586..101b48b8 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 @@ -87,8 +87,8 @@ export class SlicingTaskModelComponent implements OnInit { } getautidInfo(): void { - this.http.getAuditInfo(this.taskId).subscribe(res => { - const { result_header: { result_code } } = res; + this.http.getAuditInfo(this.taskId).subscribe( res => { + const { result_header: { result_code, result_message } } = res; this.isSpinning = false; if (+result_code === 200) { const { @@ -179,7 +179,7 @@ export class SlicingTaskModelComponent implements OnInit { cn_area_traffic_cap_ul }; } else { - this.message.error('Failed to get data') + this.message.error(result_message || 'Failed to get data') } }, ({ status, statusText }) => { this.message.error(status + ' (' + statusText + ')'); @@ -208,14 +208,14 @@ export class SlicingTaskModelComponent implements OnInit { getSlicingInstances(pageNo: string, pageSize: string): void { this.slicingInstances.isLoading = true; this.http.getSlicingInstance(pageNo, pageSize).subscribe(res => { - const { result_header: { result_code }, result_body } = res; + const { result_header: { result_code, result_message }, result_body } = res; setTimeout(() => { if (+result_code === 200) { const { nsi_service_instances, record_number } = result_body; this.slicingInstances.total = record_number; this.slicingInstances.list.push(...nsi_service_instances); } else { - this.message.error('Failed to get slicing instance ID') + this.message.error(result_message || 'Failed to get slicing instance ID') } this.slicingInstances.isLoading = false; this.slicingInstances.flag = false; @@ -233,12 +233,12 @@ export class SlicingTaskModelComponent implements OnInit { this.selectedServiceName = ''; // 获取切片子网实例数据 this.http.getSlicingSubnetInstance(this.selectedServiceId).subscribe(res => { - const { result_header: { result_code }, result_body, record_number } = res; + const { result_header: { result_code, result_message }, result_body, record_number} = res; if (+result_code === 200) { - this.subnetDataFormatting(result_body, record_number); + this.subnetDataFormatting(result_body, record_number) } else { this.subnetDataFormatting({}, 1); - this.message.error('Failed to get slicing subnet instance ID'); + this.message.error(result_message || 'Failed to get slicing subnet instance ID') } }, ({ status, statusText }) => { this.message.error(status + ' (' + statusText + ')'); @@ -250,7 +250,7 @@ export class SlicingTaskModelComponent implements OnInit { }) } - subnetDataFormatting(subnetData: any, total: number): void { + subnetDataFormatting ( subnetData?: any, total?: number): void{ const { an_suggest_nssi_id, an_suggest_nssi_name, tn_suggest_nssi_id, tn_suggest_nssi_name, cn_suggest_nssi_id, cn_suggest_nssi_name } = subnetData; this.slicingSubnet[0].slicingId = an_suggest_nssi_id; this.slicingSubnet[0].slicingName = an_suggest_nssi_name; @@ -312,7 +312,7 @@ export class SlicingTaskModelComponent implements OnInit { instance.isLoading = true; const { context, currentPage, pageSize } = instance; this.http.getSubnetInContext(context, currentPage, pageSize).subscribe(res => { - const { result_header: { result_code }, result_body } = res; + const { result_header: { result_code, result_message }, result_body } = res; if (+result_code === 200) { const { nssi_service_instances, record_number } = result_body; this.slicingSubnet.map(item => { @@ -322,7 +322,7 @@ export class SlicingTaskModelComponent implements OnInit { } }) } else { - this.message.error('Failed to get slicing subnet instance ID'); + this.message.error(result_message || 'Failed to get slicing subnet instance ID'); } instance.isLoading = false; instance.flag = false; |