From d000a94ca0bc18d235b5ae8598b04a586e628be2 Mon Sep 17 00:00:00 2001 From: guochuyicmri Date: Fri, 16 Nov 2018 20:53:16 +0800 Subject: fix ns instance termination bug Change-Id: Ic02f873e3b9f3d03b9b9f074f5da7bdaed44d993 Issue-ID: USECASEUI-161 Signed-off-by: guochuyicmri --- .../services-list/services-list.component.ts | 38 +++++++++++++++------- 1 file changed, 26 insertions(+), 12 deletions(-) (limited to 'usecaseui-portal') diff --git a/usecaseui-portal/src/app/services/services-list/services-list.component.ts b/usecaseui-portal/src/app/services/services-list/services-list.component.ts index 4e0770a3..3b5202c6 100644 --- a/usecaseui-portal/src/app/services/services-list/services-list.component.ts +++ b/usecaseui-portal/src/app/services/services-list/services-list.component.ts @@ -175,7 +175,7 @@ export class ServicesListComponent implements OnInit { return child; } }) - if(item["serviceDomain"]=="Network Service"){ + if(item["serviceDomain"]=="Network Service" && item["vnfInfo"]){ item["childServiceInstances"] = item["vnfInfo"].map((vnf)=>{ vnf["serviceDomain"] = "vnf"; return vnf; @@ -617,7 +617,8 @@ export class ServicesListComponent implements OnInit { console.log(service); service.rate = 0; service.status = "Healing"; - this.myhttp.healNsService(service.nsInstanceId,requestBody) + let id = service.nsInstanceId || service["service-instance-id"]; + this.myhttp.healNsService(id,requestBody) .subscribe((data)=>{ if(data.status == "FAILED"){ console.log("heal nsvnf service failed :" + JSON.stringify(data)); @@ -686,7 +687,7 @@ export class ServicesListComponent implements OnInit { deleteNsService(service){ service.rate = 0; service.status = "Deleting"; - let id = service.nsInstanceId; + let id = service.nsInstanceId || service["service-instance-id"]; let requestBody = { terminationType : this.terminationType, gracefulTerminationTimeout : this.gracefulTerminationTimeout @@ -700,12 +701,13 @@ export class ServicesListComponent implements OnInit { this.myhttp.nsDeleteInstance(id) .subscribe((data)=>{ // console.log(data); + service.rate = 100; + service.status = "completed"; if(data.status == "FAILED"){ console.log("delete ns service failed :" + JSON.stringify(data)); + service.status = "Delete failed"; return false; } - service.rate = 100; - service.status = "completed"; let hasUndone = this.tableData.some((item)=>{ return item.rate < 100; }) @@ -746,14 +748,20 @@ export class ServicesListComponent implements OnInit { // "finishedAt": "" // } // } + let errorNums = 30; let requery = ()=>{ this.myhttp.getProgress(obj) .subscribe((data)=>{ - if(data.operationStatus.progress==undefined){ - console.log(data); + if(data.operationStatus == null || data.operationStatus.progress==undefined){ + // console.log(data); + errorNums--; + if(errorNums == 0){ + console.log("request over time"); + return false; + } setTimeout(()=>{ requery(); - },5000) + },10000) return false; } if(data.operationStatus.progress < 100){ @@ -802,14 +810,20 @@ export class ServicesListComponent implements OnInit { // ] // } // } + let errorNums = 30; let requery = (responseId)=>{ this.myhttp.getNsProgress(jobid,responseId) .subscribe((data)=>{ - if(data.responseDescriptor.progress==undefined){ - console.log(data); + if(data.responseDescriptor == null || data.responseDescriptor.progress==undefined){ + // console.log(data); + errorNums--; + if(errorNums == 0){ + console.log("request over time"); + return false; + } setTimeout(()=>{ - requery(data.responseDescriptor.responseId); - },5000) + requery(responseId); + },10000) return false; } if(data.responseDescriptor.progress < 100){ -- cgit 1.2.3-korg