summaryrefslogtreecommitdiffstats
path: root/usecaseui-portal/src/app/views
diff options
context:
space:
mode:
authorTao Shen <shentao@chinamobile.com>2019-09-20 10:40:10 +0000
committerGerrit Code Review <gerrit@onap.org>2019-09-20 10:40:10 +0000
commit2ad362ee42f5ef93186feb3a9d33f04bcec3a532 (patch)
tree5790be5455c28ecd8a89314cabe977a527c54c18 /usecaseui-portal/src/app/views
parenta711cb386553020a1348207c05ae597fcfb18212 (diff)
parenta6fc431622c2f9f5188dfcd00d1f73ec43bf5afb (diff)
Merge "feat:optimize loop call progress function for service-list page"
Diffstat (limited to 'usecaseui-portal/src/app/views')
-rw-r--r--usecaseui-portal/src/app/views/services/services-list/services-list.component.ts38
1 files changed, 20 insertions, 18 deletions
diff --git a/usecaseui-portal/src/app/views/services/services-list/services-list.component.ts b/usecaseui-portal/src/app/views/services/services-list/services-list.component.ts
index 5fc7e5a7..aed66631 100644
--- a/usecaseui-portal/src/app/views/services/services-list/services-list.component.ts
+++ b/usecaseui-portal/src/app/views/services/services-list/services-list.component.ts
@@ -41,7 +41,10 @@ export class ServicesListComponent implements OnInit {
this.width = document.documentElement.clientWidth
});
}
-
+ ngOnDestroy() {
+ clearInterval(this.progressOutTimer);
+ clearInterval(this.progressingTimer);
+ }
// customer servicetype
isSol005Interface = false;
orchestratorList = [];
@@ -84,6 +87,14 @@ export class ServicesListComponent implements OnInit {
}
];
+ requery;
+ progressOutTimer = setTimeout(() => {
+ this.requery();
+ }, 10000);
+ progressingTimer = setTimeout(() => {
+ this.requery();
+ }, 5000);
+
//The icon behind each row of data in the table expands
iconMoreShow(data, tableData) {
tableData.map((its) => {
@@ -1291,7 +1302,7 @@ export class ServicesListComponent implements OnInit {
let mypromise = new Promise((res, rej) => {
let operationTypeObj = {operationType:obj.operationType};
let errorNums = 180;
- let requery = () => {
+ this.requery = () => {
this.myhttp.getProgress(obj,operationTypeObj)
.subscribe((data) => {
if (data.status == "FAILED") {
@@ -1304,9 +1315,7 @@ export class ServicesListComponent implements OnInit {
callback({ progress: 255, status: "time over" });
return false;
}
- setTimeout(() => {
- requery();
- }, 10000)
+ this.progressOutTimer;
return false;
}
if (data.operationStatus.progress > 100) {
@@ -1315,15 +1324,13 @@ export class ServicesListComponent implements OnInit {
}
if (data.operationStatus.progress < 100) {
callback(data.operationStatus);
- setTimeout(() => {
- requery();
- }, 5000)
+ this.progressingTimer;
} else {
res(data.operationStatus);
}
})
}
- requery();
+ this.requery();
})
return mypromise;
}
@@ -1336,7 +1343,7 @@ export class ServicesListComponent implements OnInit {
"serviceInstanceId":id,
"operationType":operationType
}
- let requery = () => {
+ this.requery = () => {
this.myhttp.getNsProgress(jobid,paramsObj)
.subscribe((data) => {
if (data.status == "FAILED") {
@@ -1349,9 +1356,7 @@ export class ServicesListComponent implements OnInit {
callback({ progress: 255, status: "time over" });
return false;
}
- setTimeout(() => {
- requery();
- }, 10000)
+ this.progressOutTimer;
return false;
}
if (data.responseDescriptor.progress > 100 && data.responseDescriptor.status == "error") {
@@ -1360,17 +1365,14 @@ export class ServicesListComponent implements OnInit {
}
if (data.responseDescriptor.progress < 100) {
callback(data.responseDescriptor);
- setTimeout(() => {
- requery();
- }, 5000)
+ this.progressingTimer;
} else {
res(data);
}
})
};
- requery();
+ this.requery();
});
return mypromise;
}
-
}