diff options
author | Arundathi Patil <arundpil@in.ibm.com> | 2018-07-27 16:03:14 +0530 |
---|---|---|
committer | Takamune Cho <tc012c@att.com> | 2018-08-09 12:13:41 +0000 |
commit | 6ba50cc051029760770442206b9c56b70c198bb9 (patch) | |
tree | 81826f5ef3f488bea007e045f2447b52063e1477 /src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.ts | |
parent | 8dfd16decdc478a2674c9f2ffa18b67c3cb7963e (diff) |
Template-configration-unsubscribed from observable
Unsubscribed from subscription in template-configuration component. This
will release any resources that the subscription holds when the
component is destroyed.
Issue-ID: APPC-1049
Change-Id: Icbf3575e034a693f7357782826690d079945faa7
Signed-off-by: Arundathi Patil <arundpil@in.ibm.com>
Diffstat (limited to 'src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.ts')
-rw-r--r-- | src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.ts | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.ts b/src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.ts index a3d55ba..6cae746 100644 --- a/src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.ts +++ b/src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.ts @@ -23,6 +23,7 @@ limitations under the License. */ import { Component, Input, OnInit, ViewChild } from '@angular/core'; +import { Subscription } from 'rxjs/Subscription'; import { HttpUtilService } from '../../../../shared/services/httpUtil/http-util.service'; import { MappingEditorService } from '../../../../shared/services/mapping-editor.service'; import { ArtifactRequest } from '../../../../shared/models/index'; @@ -59,7 +60,8 @@ export class GoldenConfigurationComponent implements OnInit { initialAction: any; public referenceData: Array<Object> = []; public scopeName: any; - public subscription: any; + public subscription: Subscription; + public templateSubscription : Subscription; public item: any = {}; public goldenActions: Array<string> = []; public refNameObj = {}; @@ -173,7 +175,7 @@ export class GoldenConfigurationComponent implements OnInit { this.item = { "action": "", "scope": { "vnf-type": "", "vnfc-type": "" }, "vm": [], "protocol": "", "download-dg-reference": "", "user-name": "", "port-number": "", "artifact-list": [], "deviceTemplate": "", "scopeType": "" }; } this.initialAction = this.item.action; - this.activeRoutes.url.subscribe(UrlSegment => { + this.subscription = this.activeRoutes.url.subscribe(UrlSegment => { this.actionType = UrlSegment[0].path }) this.mappingEditorService.fromScreen = 'MappingScreen'; @@ -190,6 +192,9 @@ export class GoldenConfigurationComponent implements OnInit { this.mappingEditorService.changeNavDownloadData(this.downloadDataObject); } } + + if(this.subscription) { this.subscription.unsubscribe(); } + if(this.templateSubscription) { this.templateSubscription.unsubscribe(); } } //========================== End of ngOnDestroy() Method============================================ ngAfterViewInit() { @@ -299,7 +304,7 @@ export class GoldenConfigurationComponent implements OnInit { let input = this.utilityService.createPayloadForRetrieve(false, this.item.action, this.vnfType, fileName); let artifactContent: any; this.ngProgress.start(); - this.httpUtil.post({ + this.templateSubscription = this.httpUtil.post({ url: environment.getDesigns, data: input }).subscribe(resp => { |