+ 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 {
+ // eslint-disable-next-line security/detect-non-literal-fs-filename
+ 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((): void => {
+ // Catch Navigation Error
+ });
+ }
+
+ /** To open VM Migration in NS Instances */
+ public openVmMigration(): void {
+ // eslint-disable-next-line security/detect-non-literal-fs-filename
+ const modalRef: NgbModalRef = this.modalService.open(VmMigrationComponent, { backdrop: 'static' });
+ modalRef.componentInstance.params = {
+ id: this.instanceID
+ };
+ modalRef.result.then((result: MODALCLOSERESPONSEDATA): void => {
+ if (result) {
+ this.sharedService.callData();
+ }
+ }).catch((): void => {
+ // Catch Navigation Error
+ });
+ }
+
+ /** To open the Ns Update pop-up */
+ public openNsUpdate(): void {
+ // eslint-disable-next-line security/detect-non-literal-fs-filename
+ const modalRef: NgbModalRef = this.modalService.open(NsUpdateComponent, { backdrop: 'static' });
+ modalRef.componentInstance.params = {
+ id: this.instanceID
+ };
+ modalRef.result.then((result: MODALCLOSERESPONSEDATA): void => {
+ if (result) {
+ this.sharedService.callData();
+ }
+ }).catch((): void => {
+ // Catch Navigation Error
+ });
+ }
+
+ /** To open the Start, Stop & Rebuild pop-up */
+ public openStart(actionType: string): void {
+ // eslint-disable-next-line security/detect-non-literal-fs-filename
+ const modalRef: NgbModalRef = this.modalService.open(StartStopRebuildComponent, { backdrop: 'static' });
+ modalRef.componentInstance.params = {
+ id: this.instanceID
+ };
+ if (actionType === 'start') {
+ modalRef.componentInstance.instanceTitle = this.translateService.instant('START');
+ } else if (actionType === 'stop') {
+ modalRef.componentInstance.instanceTitle = this.translateService.instant('STOP');
+ } else {
+ modalRef.componentInstance.instanceTitle = this.translateService.instant('REBUILD');
+ }
+ modalRef.componentInstance.instanceType = actionType;
+ modalRef.result.then((result: MODALCLOSERESPONSEDATA): void => {
+ if (result) {
+ this.sharedService.callData();
+ }
+ }).catch((): void => {
+ // Catch Navigation Error
+ });
+ }
+
+ /** To open the vertical Scaling pop-up */
+ public openVerticalScaling(): void {
+ // eslint-disable-next-line security/detect-non-literal-fs-filename
+ const modalRef: NgbModalRef = this.modalService.open(VerticalScalingComponent, { backdrop: 'static' });
+ modalRef.componentInstance.params = {
+ id: this.instanceID
+ };
+ modalRef.result.then((result: MODALCLOSERESPONSEDATA): void => {
+ if (result) {
+ this.sharedService.callData();
+ }
+ }).catch((): void => {
+ // Catch Navigation Error
+ });
+ }
+
+ /**
+ * Check any changes in the child component @public
+ */
+ public doChanges(): void {
+ setTimeout((): void => {
+ this.cd.detectChanges();
+ }, this.timeOut);