summaryrefslogtreecommitdiffstats
path: root/usecaseui-portal/src
diff options
context:
space:
mode:
authorcyuamber <xuranyjy@chinamobile.com>2019-12-09 12:11:36 +0800
committercyuamber <xuranyjy@chinamobile.com>2019-12-09 12:11:48 +0800
commit71934f9ecfedbe856da16bfcc28e30c658cad616 (patch)
tree56a55d5ed543634a3d2c4516a41a09731dc91cfa /usecaseui-portal/src
parent4abc9917d8d474b5bd3ba4f570e39e3e594de4b6 (diff)
feat: Optimize the selection box logic of the task processing component
Change-Id: Ic08e3f986f2d72ea2d90b7a80da57cf3ac4d25d2 Issue-ID: USECASEUI-368 Signed-off-by: cyuamber <xuranyjy@chinamobile.com>
Diffstat (limited to 'usecaseui-portal/src')
-rw-r--r--usecaseui-portal/src/app/core/services/slicingTaskServices.ts2
-rw-r--r--usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/slicing-task-model.component.ts46
2 files changed, 24 insertions, 24 deletions
diff --git a/usecaseui-portal/src/app/core/services/slicingTaskServices.ts b/usecaseui-portal/src/app/core/services/slicingTaskServices.ts
index 7c50e561..3f38a717 100644
--- a/usecaseui-portal/src/app/core/services/slicingTaskServices.ts
+++ b/usecaseui-portal/src/app/core/services/slicingTaskServices.ts
@@ -84,7 +84,7 @@ export class SlicingTaskServices {
getSubnetInContext (context: string, pageNo: string, pageSize: string) {
const url = this.url.subnetInContext
.replace('{environmentContext}', context)
- .replace('{pageNo', pageNo)
+ .replace('{pageNo}', pageNo)
.replace('{pageSize}', pageSize);
return this.http.get<any>(url);
}
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 {