X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=src%2Fapp%2Futilities%2Fns-instances-action%2FNSInstancesActionComponent.ts;h=08e5e97272e8d4479100d591b9a3997af03f5c2c;hb=refs%2Fheads%2Fmaster;hp=1c3f1f293af926c65f8f7fbc06c497f4661e797f;hpb=3d81a28cd6df38cb070c6a6afbbd1528a766f16e;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 1c3f1f2..1582bc4 100644 --- a/src/app/utilities/ns-instances-action/NSInstancesActionComponent.ts +++ b/src/app/utilities/ns-instances-action/NSInstancesActionComponent.ts @@ -26,6 +26,7 @@ import { NotifierService } from 'angular-notifier'; import { ERRORDATA, MODALCLOSERESPONSEDATA } from 'CommonModel'; import { DeleteComponent } from 'DeleteComponent'; import { environment } from 'environment'; +import { HealingComponent } from 'HealingComponent'; import { NSDDetails } from 'NSDModel'; import { NSDInstanceData } from 'NSInstanceModel'; import { NSPrimitiveComponent } from 'NSPrimitiveComponent'; @@ -33,10 +34,10 @@ import { NsUpdateComponent } from 'NsUpdateComponent'; import { RestService } from 'RestService'; import { forkJoin, Observable } from 'rxjs'; import { ScalingComponent } from 'ScalingComponent'; -import { SharedService } from 'SharedService'; +import { SharedService, isNullOrUndefined } 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'; /** @@ -65,6 +66,9 @@ export class NSInstancesActionComponent { /** Operational Status Check @public */ public operationalStatus: string; + /** CNF Status Check @public */ + public k8sStatus: boolean = false; + /** get Admin Details @public */ public getAdminDetails: {}; @@ -105,6 +109,7 @@ export class NSInstancesActionComponent { private cd: ChangeDetectorRef; /** Set timeout @private */ + // eslint-disable-next-line @typescript-eslint/no-magic-numbers private timeOut: number = 100; constructor(injector: Injector) { @@ -126,12 +131,27 @@ export class NSInstancesActionComponent { this.operationalStatus = this.value.OperationalStatus; this.instanceID = this.value.identifier; this.getAdminDetails = this.value.adminDetails; + for (const key of Object.keys(this.getAdminDetails)) { + if (key === 'deployed') { + // eslint-disable-next-line security/detect-object-injection + const adminData: {} = this.getAdminDetails[key]; + for (const k8sData of Object.keys(adminData)) { + if (k8sData === 'K8s') { + // eslint-disable-next-line security/detect-object-injection + if (adminData[k8sData].length !== 0) { + this.k8sStatus = true; + } + } + } + } + } this.isShowOperationalDashboard = !isNullOrUndefined(this.value.vcaStatus) ? Object.keys(this.value.vcaStatus).length === 0 && typeof this.value.vcaStatus === 'object' : true; } /** Shows information using modalservice @public */ public infoNs(): void { + // eslint-disable-next-line security/detect-non-literal-fs-filename this.modalService.open(ShowInfoComponent, { backdrop: 'static' }).componentInstance.params = { id: this.instanceID, page: 'ns-instance', @@ -141,13 +161,16 @@ export class NSInstancesActionComponent { /** Delete NS Instanace @public */ public deleteNSInstance(forceAction: boolean): void { + // eslint-disable-next-line security/detect-non-literal-fs-filename const modalRef: NgbModalRef = this.modalService.open(DeleteComponent, { backdrop: 'static' }); modalRef.componentInstance.params = { forceDeleteType: forceAction }; modalRef.result.then((result: MODALCLOSERESPONSEDATA): void => { if (result) { this.sharedService.callData(); } - }).catch(); + }).catch((): void => { + // Catch Navigation Error + }); } /** History of operations for an Instanace @public */ @@ -166,10 +189,12 @@ export class NSInstancesActionComponent { /** Exec NS Primitive @public */ public execNSPrimitiveModal(): void { + // eslint-disable-next-line security/detect-non-literal-fs-filename this.modalService.open(NSPrimitiveComponent, { backdrop: 'static' }).componentInstance.params = { memberIndex: this.value.memberIndex, nsConfig: this.value.nsConfig, - name: this.value.NsdName + name: this.value.NsdName, + id: this.value.constituent }; } @@ -184,6 +209,7 @@ export class NSInstancesActionComponent { if (vduData['monitoring-parameter'] !== undefined && vduData['monitoring-parameter'].length > 0) { this.isLoadingNSInstanceAction = false; const location: string = environment.GRAFANA_URL + '/' + this.instanceID + '/osm-ns-metrics-metrics'; + // eslint-disable-next-line security/detect-non-literal-fs-filename window.open(location); } else { this.isLoadingNSInstanceAction = false; @@ -244,6 +270,7 @@ export class NSInstancesActionComponent { /** 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, @@ -256,11 +283,14 @@ export class NSInstancesActionComponent { if (result) { this.sharedService.callData(); } - }).catch(); + }).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 @@ -269,11 +299,14 @@ export class NSInstancesActionComponent { if (result) { this.sharedService.callData(); } - }).catch(); + }).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 @@ -282,11 +315,14 @@ export class NSInstancesActionComponent { if (result) { this.sharedService.callData(); } - }).catch(); + }).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 @@ -303,7 +339,41 @@ export class NSInstancesActionComponent { if (result) { this.sharedService.callData(); } - }).catch(); + }).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 + }); + } + + /** Open the Healing pop-up @public */ + public openHealing(): void { + // eslint-disable-next-line security/detect-non-literal-fs-filename + const modalRef: NgbModalRef = this.modalService.open(HealingComponent, { backdrop: 'static' }); + modalRef.componentInstance.params = { + id: this.instanceID + }; + modalRef.result.then((result: MODALCLOSERESPONSEDATA): void => { + if (result) { + this.sharedService.callData(); + } + }).catch((): void => { + // Catch Navigation Error + }); } /**