+
+ /**
+ * Do the manual scaling
+ * Here we are going to get a list of VNFD ID used in the instances
+ * and have this in array with URL created then pass to checkscaling method for forkjoin to get the data @public
+ */
+ public manualScaling(): void {
+ this.isLoadingNSInstanceAction = true;
+ const tempURL: Observable<{}>[] = [];
+ this.value.vnfID.forEach((id: string): void => {
+ const apiUrl: string = environment.VNFPACKAGESCONTENT_URL + '/' + id;
+ tempURL.push(this.restService.getResource(apiUrl));
+ });
+ this.checkScaling(tempURL);
+ }
+
+ /**
+ * Used to forkjoin to all the request to send parallely, get the data and check 'scaling-aspect' key is present @public
+ */
+ public checkScaling(URLS: Observable<{}>[]): void {
+ forkJoin(URLS).subscribe((data: VNFD[]): void => {
+ this.vnfDetails = data;
+ if (this.vnfDetails.length > 0) {
+ this.vnfDetails.forEach((vnfdData: VNFD): void => {
+ vnfdData.df.forEach((dfData: DF): void => {
+ if (!isNullOrUndefined(dfData['scaling-aspect']) && dfData['scaling-aspect'].length > 0) {
+ this.isScalingPresent = true;
+ }
+ });
+ });
+ }
+ this.isLoadingNSInstanceAction = false;
+ if (this.isScalingPresent) {
+ this.openScaling();
+ } else {
+ this.notifierService.notify('error', this.translateService.instant('SCALINGNOTFOUND'));
+ }
+ this.doChanges();
+ });
+ }
+
+ /** Open the scaling pop-up @public */
+ public openScaling(): void {
+ const modalRef: NgbModalRef = this.modalService.open(ScalingComponent, { backdrop: 'static' });
+ modalRef.componentInstance.params = {
+ id: this.instanceID,
+ vnfID: this.value.vnfID,
+ nsID: this.value['nsd-id'],
+ nsd: this.value.nsd,
+ data: this.vnfDetails
+ };
+ modalRef.result.then((result: MODALCLOSERESPONSEDATA): void => {
+ if (result) {
+ this.sharedService.callData();
+ }
+ }).catch();
+ }
+
+ /**
+ * Check any changes in the child component @public
+ */
+ public doChanges(): void {
+ setTimeout((): void => {
+ this.cd.detectChanges();
+ }, this.timeOut);
+ }