From: SANDHYA.JS Date: Tue, 11 Jun 2024 07:17:55 +0000 (+0530) Subject: Fix Bug 2048:The VCA Status for an NS with both a KNF and a VNF does not provide... X-Git-Tag: release-v16.0-start~2 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F20%2F14420%2F1;p=osm%2FNG-UI.git Fix Bug 2048:The VCA Status for an NS with both a KNF and a VNF does not provide the information of both - Added support to show both VNF & KNF together in operational dashboard Change-Id: I8150a059fc7d341f0a722cf256bdcb9347be2f8b Signed-off-by: SANDHYA.JS --- diff --git a/src/app/operational-view/OperationalViewComponent.ts b/src/app/operational-view/OperationalViewComponent.ts index 0484de8..22d4077 100644 --- a/src/app/operational-view/OperationalViewComponent.ts +++ b/src/app/operational-view/OperationalViewComponent.ts @@ -228,27 +228,33 @@ export class OperationalViewComponent implements OnInit { const assignVCADetails: VCADETAILS[] = []; const setModels: SETMODELS[] = []; Object.keys(list.vcaStatus).forEach((key: string): void => { - const vcaApplication: VCAAPPLICATIONS[] = this.appData(list.vcaStatus[key].applications); - const vcaUnits: VCAUNITS[] = this.unitsData(vcaApplication); - const vcaMachines: MACHINES[] = this.machinesData(list.vcaStatus[key].machines); - const assignNSInstancesID: string = key; - list.vcaStatus[key].units = vcaUnits; - list.vcaStatus[key].applications = vcaApplication; - list.vcaStatus[key].machines = vcaMachines; - // eslint-disable-next-line no-self-assign - list.vcaStatus[key].relations = list.vcaStatus[key].relations; - // eslint-disable-next-line no-self-assign - list.vcaStatus[key].model = list.vcaStatus[key].model; - const getEachModelData: SETMODELS = this.assignVCAStatusOfEachModel(list.vcaStatus[key]); - setModels.push(getEachModelData); - list.vcaStatus[assignNSInstancesID].vca_id = key; - list.vcaStatus[assignNSInstancesID].vca_name = list.name; - list.vcaStatus[assignNSInstancesID].ns_id = list.id; - list.vcaStatus[assignNSInstancesID].isLiveloading = liveData; - list.vcaStatus[assignNSInstancesID].timeOutSeconds = timeOutSeconds; - list.vcaStatus[assignNSInstancesID].vcaStatusModels = setModels; - const getAssignedData: VCADETAILS = this.formVCADetails(list.vcaStatus[assignNSInstancesID]); - assignVCADetails.push(getAssignedData); + let vcaStatus = []; + vcaStatus = Object.values(list.vcaStatus[key]); + if (!isNullOrUndefined(vcaStatus)) { + vcaStatus.forEach((data): void => { + const vcaApplication: VCAAPPLICATIONS[] = this.appData(data.applications); + const vcaUnits: VCAUNITS[] = this.unitsData(vcaApplication); + const vcaMachines: MACHINES[] = this.machinesData(data.machines); + const assignNSInstancesID: string = key; + data.units = vcaUnits; + data.applications = vcaApplication; + data.machines = vcaMachines; + // eslint-disable-next-line no-self-assign + data.relations = data.relations; + // eslint-disable-next-line no-self-assign + data.model = data.model; + const getEachModelData: SETMODELS = this.assignVCAStatusOfEachModel(data); + setModels.push(getEachModelData); + list.vcaStatus[assignNSInstancesID].vca_id = key; + list.vcaStatus[assignNSInstancesID].vca_name = list.name; + list.vcaStatus[assignNSInstancesID].ns_id = list.id; + list.vcaStatus[assignNSInstancesID].isLiveloading = liveData; + list.vcaStatus[assignNSInstancesID].timeOutSeconds = timeOutSeconds; + list.vcaStatus[assignNSInstancesID].vcaStatusModels = setModels; + const getAssignedData: VCADETAILS = this.formVCADetails(list.vcaStatus[assignNSInstancesID]); + assignVCADetails.push(getAssignedData); + }); + } }); return assignVCADetails[0]; } @@ -258,22 +264,24 @@ export class OperationalViewComponent implements OnInit { public appData(applicationData: VCAAPPLICATIONS): VCAAPPLICATIONS[] { const vcaApplication: VCAAPPLICATIONS[] = []; Object.keys(applicationData).forEach((applicationKey: string): void => { - const charmSplitlist: string[] = applicationData[applicationKey].charm.split('/'); - const status: string = applicationData[applicationKey].status.status; - // eslint-disable-next-line deprecation/deprecation - const charm: string = charmSplitlist[1].substr(0, charmSplitlist[1].lastIndexOf('-')); - // eslint-disable-next-line deprecation/deprecation - const store: string = charmSplitlist[0].substr(0, charmSplitlist[0].lastIndexOf(':')); - applicationData[applicationKey].app_id = applicationKey; - applicationData[applicationKey].charm = charm; - applicationData[applicationKey].status = status; - applicationData[applicationKey].scale = Object.keys(applicationData[applicationKey].units).length; - applicationData[applicationKey].store = store; - applicationData[applicationKey].configs = !isNullOrUndefined(applicationData[applicationKey].configs) ? - applicationData[applicationKey].configs : null; - applicationData[applicationKey].actions = !isNullOrUndefined(applicationData[applicationKey].actions) ? - applicationData[applicationKey].actions : null; - vcaApplication.push(applicationData[applicationKey]); + if (!isNullOrUndefined(applicationData[applicationKey].charm)) { + const charmSplitlist: string[] = applicationData[applicationKey].charm.split('/'); + const status: string = applicationData[applicationKey].status.status; + // eslint-disable-next-line deprecation/deprecation + const charm: string = charmSplitlist[1].substr(0, charmSplitlist[1].lastIndexOf('-')); + // eslint-disable-next-line deprecation/deprecation + const store: string = charmSplitlist[0].substr(0, charmSplitlist[0].lastIndexOf(':')); + applicationData[applicationKey].app_id = applicationKey; + applicationData[applicationKey].charm = charm; + applicationData[applicationKey].status = status; + applicationData[applicationKey].scale = Object.keys(applicationData[applicationKey].units).length; + applicationData[applicationKey].store = store; + applicationData[applicationKey].configs = !isNullOrUndefined(applicationData[applicationKey].configs) ? + applicationData[applicationKey].configs : null; + applicationData[applicationKey].actions = !isNullOrUndefined(applicationData[applicationKey].actions) ? + applicationData[applicationKey].actions : null; + vcaApplication.push(applicationData[applicationKey]); + } }); return vcaApplication; }