X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=src%2Fapp%2Futilities%2Fvertical-scaling%2FVerticalScalingComponent.ts;h=36ec2fcaada46463639a7b988b6223b1e22f1b90;hb=refs%2Fchanges%2F14%2F14414%2F3;hp=4d96f8aa897e3a1c49d2783b0e57a93c5aa1b8f8;hpb=0a34dfa32165036b380ec6ac493469b34007df0a;p=osm%2FNG-UI.git diff --git a/src/app/utilities/vertical-scaling/VerticalScalingComponent.ts b/src/app/utilities/vertical-scaling/VerticalScalingComponent.ts index 4d96f8a..36ec2fc 100644 --- a/src/app/utilities/vertical-scaling/VerticalScalingComponent.ts +++ b/src/app/utilities/vertical-scaling/VerticalScalingComponent.ts @@ -18,7 +18,6 @@ /** * @file VerticalScaling Component */ -import { isNullOrUndefined } from 'util'; import { HttpHeaders } from '@angular/common/http'; import { Component, Injector, Input, OnInit } from '@angular/core'; import { AbstractControl, FormBuilder, FormGroup, Validators } from '@angular/forms'; @@ -30,8 +29,8 @@ import { APIURLHEADER, ERRORDATA, MODALCLOSERESPONSEDATA, URLPARAMS } from 'Comm import { environment } from 'environment'; import { VerticalScaling } from 'NSInstanceModel'; import { RestService } from 'RestService'; -import { SharedService } from 'SharedService'; -import { VDUR, VNFInstanceDetails } from 'VNFInstanceModel'; +import { SharedService, isNullOrUndefined } from 'SharedService'; +import { InstanceData, VDUR, VNFInstanceDetails } from 'VNFInstanceModel'; /** * Creating component @@ -125,30 +124,35 @@ export class VerticalScalingComponent implements OnInit { /** Getting MemberVnfIndex using VNFInstances API @public */ public getMemberVnfIndex(): void { + this.isLoadingResults = true; const vnfInstanceData: {}[] = []; this.restService.getResource(environment.VNFINSTANCES_URL).subscribe((vnfInstancesData: VNFInstanceDetails[]): void => { vnfInstancesData.forEach((vnfData: VNFInstanceDetails): void => { + const vnfdRef: string = 'vnfd-ref'; + const memberIndex: string = 'member-vnf-index-ref'; + const nsrId: string = 'nsr-id-ref'; + const vnfId: string = 'vnfd-id'; const vnfDataObj: {} = { - VNFD: vnfData['vnfd-ref'], + // eslint-disable-next-line security/detect-object-injection + VNFD: vnfData[vnfdRef], VNFInstanceId: vnfData._id, - MemberIndex: vnfData['member-vnf-index-ref'], - NS: vnfData['nsr-id-ref'], - VNFID: vnfData['vnfd-id'] + // eslint-disable-next-line security/detect-object-injection + MemberIndex: vnfData[memberIndex], + // eslint-disable-next-line security/detect-object-injection + NS: vnfData[nsrId], + // eslint-disable-next-line security/detect-object-injection + VNFID: vnfData[vnfId] }; vnfInstanceData.push(vnfDataObj); }); const nsId: string = 'NS'; // eslint-disable-next-line security/detect-object-injection this.nsIdFilteredData = vnfInstanceData.filter((vnfdData: {}[]): boolean => vnfdData[nsId] === this.params.id); - this.nsIdFilteredData.forEach((resVNF: {}[]): void => { - const memberIndex: string = 'MemberIndex'; - const vnfinstanceID: string = 'VNFInstanceId'; + this.nsIdFilteredData.forEach((resVNF: InstanceData): void => { const assignMemberIndex: {} = { - // eslint-disable-next-line security/detect-object-injection - id: resVNF[memberIndex], - // eslint-disable-next-line security/detect-object-injection - vnfinstanceId: resVNF[vnfinstanceID] + id: resVNF.MemberIndex, + vnfinstanceId: resVNF.VNFInstanceId }; this.memberVnfIndex.push(assignMemberIndex); }); @@ -179,7 +183,6 @@ export class VerticalScalingComponent implements OnInit { { 'count-index': vdu['count-index'], VDU: vdu['vdu-id-ref'] - }; vnfInstanceData.push(vnfInstanceDataObj); });