diff options
author | Arundathi Patil <arundpil@in.ibm.com> | 2018-07-18 16:49:11 +0530 |
---|---|---|
committer | Patrick Brady <pb071s@att.com> | 2018-07-20 11:26:20 -0700 |
commit | 99570c5a235b60989100ba9d0fbce630797164e6 (patch) | |
tree | dc30d18b2482c9fc4b3a4acd1f7990a9412b9375 | |
parent | e17f312c141bcc0dae918f42b897945a9b81e7bb (diff) |
Unsubscribed observables
Unsubscribed from observables in param-name-value component. This will
release any resources that the subscription holds.
Issue-ID: APPC-1049
Change-Id: Ie3aa18bfa9d5129a26abb2f33dd2f80e1cfc8bba
Signed-off-by: Arundathi Patil <arundpil@in.ibm.com>
-rw-r--r-- | src/app/vnfs/build-artifacts/template-holder/param-name-value/param-name-value.component.ts | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/app/vnfs/build-artifacts/template-holder/param-name-value/param-name-value.component.ts b/src/app/vnfs/build-artifacts/template-holder/param-name-value/param-name-value.component.ts index e49140d..bdf0b29 100644 --- a/src/app/vnfs/build-artifacts/template-holder/param-name-value/param-name-value.component.ts +++ b/src/app/vnfs/build-artifacts/template-holder/param-name-value/param-name-value.component.ts @@ -3,7 +3,7 @@ =================================================================== Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. =================================================================== -Copyright (C) 2018 IBM. +Copyright (C) 2018 IBM Intellectual Property. All rights reserved. =================================================================== Unless otherwise specified, all software contained herein is licensed @@ -23,8 +23,9 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property. ============LICENSE_END============================================ */ -import { Component, ContentChildren, OnInit, QueryList, ViewChild } from '@angular/core'; +import { Component, ContentChildren, OnInit, QueryList, ViewChild, OnDestroy } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; +import { Subscription } from 'rxjs/Subscription'; import { MappingEditorService } from '../../../../shared/services/mapping-editor.service'; import { HttpUtilService } from '../../../../shared/services/httpUtil/http-util.service'; import { GoldenConfigurationComponent } from '../template-configuration/template-configuration.component'; @@ -50,7 +51,7 @@ declare var $: any; templateUrl: './param-name-value.component.html', styleUrls: ['./param-name-value.component.css'] }) -export class GoldenConfigurationMappingComponent implements OnInit { +export class GoldenConfigurationMappingComponent implements OnInit, OnDestroy { enableMappingSave: boolean = false; aceText: string = ''; fileName: string = ''; @@ -99,13 +100,14 @@ export class GoldenConfigurationMappingComponent implements OnInit { @ViewChild('myInputParam') myInputParam: any; @ViewChild(ModalComponent) modalComponent: ModalComponent; @ContentChildren(Tab) tabs: QueryList<Tab>; - public subscription: any; + public subscription: Subscription; public item: any = {}; vnfType: any = ''; vnfcType: any = ''; protocol: any = ''; refObj: any; public paramsContent = localStorage['paramsContent']; + nameValueSubscription: Subscription; constructor( private buildDesignComponent: BuildDesignComponent, @@ -167,7 +169,7 @@ export class GoldenConfigurationMappingComponent implements OnInit { }; } this.initialAction = this.item.action; - this.activeRoutes.url.subscribe(UrlSegment => { + this.subscription = this.activeRoutes.url.subscribe(UrlSegment => { this.actionType = UrlSegment[0].path; }); @@ -189,6 +191,8 @@ export class GoldenConfigurationMappingComponent implements OnInit { ngOnDestroy() { this.prepareFileName(); + if( this.subscription ) { this.subscription.unsubscribe(); } + if( this.nameValueSubscription ) { this.nameValueSubscription.unsubscribe(); } } //========================== End of ngOnDestroy() Method============================================ @@ -329,7 +333,7 @@ export class GoldenConfigurationMappingComponent implements OnInit { console.log('Retrieve name value from appc payload===>>' + payload); let artifactContent: any; this.ngProgress.start(); - this.httpUtil.post({ + this.nameValueSubscription = this.httpUtil.post({ url: environment.getDesigns, data: input }).subscribe(resp => { @@ -481,4 +485,4 @@ export class GoldenConfigurationMappingComponent implements OnInit { } } -}
\ No newline at end of file +} |