From edf19113159f8d31946cc40e2a86cff9b7a013c1 Mon Sep 17 00:00:00 2001 From: cyuamber Date: Thu, 26 Dec 2019 17:56:23 +0800 Subject: feat: Modified progress logic Change-Id: I06f2e78c8ffccfd4a0bd1eab723ea892b100af3c Issue-ID: USECASEUI-368 Signed-off-by: cyuamber --- .../check-process-model.component.ts | 26 ++++++++++++---------- 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/check-process-model/check-process-model.component.ts') 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; } }) -- cgit 1.2.3-korg