X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=src%2Fapp%2Futilities%2Fns-instances-action%2FNSInstancesActionComponent.ts;h=751389b53224e3f0ef11f59e195cccec95b9816b;hb=017df364be742ba4d89013ae32572c2b300e2a29;hp=ed24a674e2440a0d70485256af098c79f49a5fde;hpb=07698abcf56f875e53734a29dd4092a53461cc1a;p=osm%2FNG-UI.git diff --git a/src/app/utilities/ns-instances-action/NSInstancesActionComponent.ts b/src/app/utilities/ns-instances-action/NSInstancesActionComponent.ts index ed24a67..751389b 100644 --- a/src/app/utilities/ns-instances-action/NSInstancesActionComponent.ts +++ b/src/app/utilities/ns-instances-action/NSInstancesActionComponent.ts @@ -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 @@ -77,15 +81,18 @@ export class NSInstancesActionComponent { /** Assign the VNF Details @public */ public vnfDetails: VNFD[] = []; + /** Contains instance ID @public */ + public instanceID: string; + + /** Contains operational dashboard view @public */ + public isShowOperationalDashboard: boolean = false; + /** Instance of the modal service @private */ private modalService: NgbModal; /** Holds teh instance of AuthService class of type AuthService @private */ private router: Router; - /** Contains instance ID @private */ - private instanceID: string; - /** Contains all methods related to shared @private */ private sharedService: SharedService; @@ -120,6 +127,8 @@ export class NSInstancesActionComponent { this.operationalStatus = this.value.OperationalStatus; this.instanceID = this.value.identifier; this.getAdminDetails = this.value.adminDetails; + this.isShowOperationalDashboard = !isNullOrUndefined(this.value.vcaStatus) ? + Object.keys(this.value.vcaStatus).length === 0 && typeof this.value.vcaStatus === 'object' : true; } /** Shows information using modalservice @public */ @@ -179,7 +188,7 @@ export class NSInstancesActionComponent { window.open(location); } else { this.isLoadingNSInstanceAction = false; - this.notifierService.notify('error', this.translateService.instant('GRAFANA.METRICSERROR')); + this.notifierService.notify('error', this.translateService.instant('PAGE.NSMETRIC.METRICERROR')); } }); this.doChanges(); @@ -251,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 */