Feature 10911-Vertical scaling of VM instances from OSM
[osm/NG-UI.git] / src / app / utilities / ns-instances-action / NSInstancesActionComponent.ts
index b5f7b01..751389b 100644 (file)
@@ -29,12 +29,16 @@ import { environment } from 'environment';
 import { NSDDetails } from 'NSDModel';
 import { NSDInstanceData } from 'NSInstanceModel';
 import { NSPrimitiveComponent } from 'NSPrimitiveComponent';
+import { NsUpdateComponent } from 'NsUpdateComponent';
 import { RestService } from 'RestService';
 import { forkJoin, Observable } from 'rxjs';
 import { ScalingComponent } from 'ScalingComponent';
 import { SharedService } from 'SharedService';
 import { ShowInfoComponent } from 'ShowInfoComponent';
+import { StartStopRebuildComponent } from 'StartStopRebuildComponent';
 import { isNullOrUndefined } from 'util';
+import { VerticalScalingComponent } from 'VerticalScalingComponent';
+import { VmMigrationComponent } from 'VmMigrationComponent';
 import { DF, VDU, VNFD } from 'VNFDModel';
 /**
  * Creating component
@@ -256,6 +260,66 @@ export class NSInstancesActionComponent {
     }).catch();
   }
 
+  /** To open VM Migration in NS Instances */
+  public openVmMigration(): void {
+    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();
+  }
+
+  /** To open the Ns Update pop-up */
+  public openNsUpdate(): void {
+    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();
+  }
+
+  /** To open the Start, Stop & Rebuild pop-up */
+  public openStart(actionType: string): void {
+    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();
+  }
+
+  /** To open the vertical Scaling pop-up */
+  public openVerticalScaling(): void {
+    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();
+  }
+
   /**
    * Check any changes in the child component @public
    */