diff options
author | Tao Shen <shentao@chinamobile.com> | 2019-12-09 07:06:00 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-12-09 07:06:00 +0000 |
commit | 6a253751b055f4b9ece51d58b94880ce14f22e83 (patch) | |
tree | 0edf4f3275f858833f5aba981f9f6bf6b7b3e119 /usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/slicing-task-model.component.ts | |
parent | 0b0f8e4644bdfc110558d055ca2e01b878809b5c (diff) | |
parent | 71934f9ecfedbe856da16bfcc28e30c658cad616 (diff) |
Merge "feat: Optimize the selection box logic of the task processing component"
Diffstat (limited to 'usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/slicing-task-model.component.ts')
-rw-r--r-- | usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/slicing-task-model.component.ts | 46 |
1 files changed, 23 insertions, 23 deletions
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 b55844bc..f9ef1511 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 @@ -26,7 +26,6 @@ export class SlicingTaskModelComponent implements OnInit { selectedServiceId: string; selectedServiceName: string; slicingInstances: any; - loading: boolean = false; // 子网实例 slicingSubnet: any[] = [ { @@ -180,27 +179,27 @@ export class SlicingTaskModelComponent implements OnInit { const { total, currentPage, pageSize} = this.slicingInstances; if (total - (+currentPage * +pageSize) > 0 ) { if (this.slicingInstances.flag) return; - this.slicingInstances.isLoading = true; this.slicingInstances.flag = true - setTimeout( () => { - this.getSlicingInstances(currentPage, pageSize) - }, 2000) - this.slicingInstances.currentPage ++ ; + this.getSlicingInstances(currentPage, pageSize) + this.slicingInstances.currentPage = (+this.slicingInstances.currentPage +1).toString(); } } 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; - 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.slicingInstances.isLoading = false; - this.slicingInstances.flag = false; + 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.slicingInstances.isLoading = false; + this.slicingInstances.flag = false; + },2000) }) } @@ -275,16 +274,15 @@ export class SlicingTaskModelComponent implements OnInit { const { total, currentPage, pageSize} = instance; if(total - (+currentPage * +pageSize) > 0 ){ if (instance.flag) return; - instance.isLoading = true; instance.flag = true; - setTimeout( () => { - this.getSubnetInstances(instance); - }, 2000) - instance.currentPage ++; + this.getSubnetInstances(instance); + let count = +instance.currentPage; + instance.currentPage = (++count).toString(); } } getSubnetInstances (instance: any): void { + instance.isLoading = true; const { context, currentPage, pageSize } = instance; this.http.getSubnetInContext(context, currentPage, pageSize).subscribe( res => { const { result_header: { result_code }, result_body } = res; @@ -293,9 +291,11 @@ export class SlicingTaskModelComponent implements OnInit { this.slicingSubnet.map (item => { if (item.context === context) { item.total = record_number; - item.instances.push(...nssi_service_instances); - item.isLoading = false; - item.flag = false; + setTimeout(() => { + item.instances.push(...nssi_service_instances); + item.isLoading = false; + item.flag = false; + },2000) } }) } else { |