From 797d9f3e02def5b00e4bbbf1190cfc6004e5655e Mon Sep 17 00:00:00 2001 From: "SANDHYA.JS" Date: Thu, 25 Aug 2022 08:19:13 +0530 Subject: [PATCH] Fix Bug 2148: VDU Id issue & Multivdu Count Index Error in VM Action - Resolved vduId dropdown issue by removing the duplicate values from the array - Resolved multivdu countIndex error by filtering count index with selected vduId Change-Id: I1231afb4bb3b013816cd8d7b8c50ae3decf5dbea Signed-off-by: SANDHYA.JS --- .../StartStopRebuildComponent.html | 6 +++--- .../StartStopRebuildComponent.ts | 17 ++++++++++++++++- .../VerticalScalingComponent.html | 6 +++--- .../VerticalScalingComponent.ts | 16 ++++++++++++++++ .../vm-migration/VmMigrationComponent.html | 6 +++--- .../vm-migration/VmMigrationComponent.ts | 16 ++++++++++++++++ 6 files changed, 57 insertions(+), 10 deletions(-) diff --git a/src/app/utilities/start-stop-rebuild/StartStopRebuildComponent.html b/src/app/utilities/start-stop-rebuild/StartStopRebuildComponent.html index b0bba96..2965ad4 100644 --- a/src/app/utilities/start-stop-rebuild/StartStopRebuildComponent.html +++ b/src/app/utilities/start-stop-rebuild/StartStopRebuildComponent.html @@ -44,8 +44,8 @@ Author: SANDHYA JS (sandhya.j@tataelxsi.co.in)
-
@@ -56,7 +56,7 @@ Author: SANDHYA JS (sandhya.j@tataelxsi.co.in)
diff --git a/src/app/utilities/start-stop-rebuild/StartStopRebuildComponent.ts b/src/app/utilities/start-stop-rebuild/StartStopRebuildComponent.ts index 18b6058..4b0afe0 100644 --- a/src/app/utilities/start-stop-rebuild/StartStopRebuildComponent.ts +++ b/src/app/utilities/start-stop-rebuild/StartStopRebuildComponent.ts @@ -68,6 +68,10 @@ export class StartStopRebuildComponent implements OnInit { public nsIdFilteredData: {}[] = []; /** Form valid on submit trigger @public */ public submitted: boolean = false; + /** Contains vduId @public */ + public vduId: {}; + /** Items for countIndex @public */ + public countIndex: {}[]; /** Input contains Modal dialog component Instance @public */ @Input() public instanceType: string; /** Input contains Modal dialog component Instance @public */ @@ -152,7 +156,6 @@ export class StartStopRebuildComponent implements OnInit { /** Getting vdu-id & count-index from VNFInstance API */ public getVdu(id: string): void { const vnfInstanceData: {}[] = []; - const vnfrDetails: {}[] = []; this.getFormControl('vduId').setValue(null); this.getFormControl('countIndex').setValue(null); if (!isNullOrUndefined(id)) { @@ -172,6 +175,12 @@ export class StartStopRebuildComponent implements OnInit { vnfInstanceData.push(vnfInstanceDataObj); }); this.vdu = vnfInstanceData; + const vduName: string = 'VDU'; + this.vduId = this.vdu.filter((vdu: {}, index: number, self: {}[]): {} => + index === self.findIndex((t: {}): {} => ( + t[vduName] === vdu[vduName] + )) + ); } this.checkDay12Operation(this.selectedvnfId); }, (error: ERRORDATA): void => { @@ -181,6 +190,12 @@ export class StartStopRebuildComponent implements OnInit { } } + /** Getting count-index by filtering id */ + public getCountIndex(id: string): void { + const VDU: string = 'VDU'; + this.countIndex = this.vdu.filter((vnfdData: {}[]): boolean => vnfdData[VDU] === id); + } + /** To check primitve actions from VNFR */ public checkDay12Operation(id: string): void { const apiUrl: string = environment.VNFPACKAGES_URL + '?id=' + id; diff --git a/src/app/utilities/vertical-scaling/VerticalScalingComponent.html b/src/app/utilities/vertical-scaling/VerticalScalingComponent.html index cef0ff2..5525871 100644 --- a/src/app/utilities/vertical-scaling/VerticalScalingComponent.html +++ b/src/app/utilities/vertical-scaling/VerticalScalingComponent.html @@ -44,8 +44,8 @@ Author: SANDHYA JS (sandhya.j@tataelxsi.co.in)
-
@@ -56,7 +56,7 @@ Author: SANDHYA JS (sandhya.j@tataelxsi.co.in)
diff --git a/src/app/utilities/vertical-scaling/VerticalScalingComponent.ts b/src/app/utilities/vertical-scaling/VerticalScalingComponent.ts index 69eb9eb..949506a 100644 --- a/src/app/utilities/vertical-scaling/VerticalScalingComponent.ts +++ b/src/app/utilities/vertical-scaling/VerticalScalingComponent.ts @@ -67,6 +67,10 @@ export class VerticalScalingComponent implements OnInit { public nsIdFilteredData: {}[] = []; /** Form valid on submit trigger @public */ public submitted: boolean = false; + /** Contains vduId @public */ + public vduId: {}; + /** Items for countIndex @public */ + public countIndex: {}[]; /** Input contains component objects @private */ @Input() private params: URLPARAMS; /** FormBuilder instance added to the formBuilder @private */ @@ -175,6 +179,12 @@ export class VerticalScalingComponent implements OnInit { vnfInstanceData.push(vnfInstanceDataObj); }); this.vdu = vnfInstanceData; + const vduName: string = 'VDU'; + this.vduId = this.vdu.filter((vdu: {}, index: number, self: {}[]): {} => + index === self.findIndex((t: {}): {} => ( + t[vduName] === vdu[vduName] + )) + ); } }, (error: ERRORDATA): void => { this.restService.handleError(error, 'get'); @@ -183,6 +193,12 @@ export class VerticalScalingComponent implements OnInit { } } + /** Getting count-index by filtering id */ + public getCountIndex(id: string): void { + const VDU: string = 'VDU'; + this.countIndex = this.vdu.filter((vnfdData: {}[]): boolean => vnfdData[VDU] === id); + } + /** Vertical Scaling on submit */ public triggerVerticalScaling(): void { this.submitted = true; diff --git a/src/app/utilities/vm-migration/VmMigrationComponent.html b/src/app/utilities/vm-migration/VmMigrationComponent.html index 343a6be..fa1cd14 100644 --- a/src/app/utilities/vm-migration/VmMigrationComponent.html +++ b/src/app/utilities/vm-migration/VmMigrationComponent.html @@ -44,8 +44,8 @@ Author: SANDHYA JS (sandhya.j@tataelxsi.co.in)
-
@@ -56,7 +56,7 @@ Author: SANDHYA JS (sandhya.j@tataelxsi.co.in)
diff --git a/src/app/utilities/vm-migration/VmMigrationComponent.ts b/src/app/utilities/vm-migration/VmMigrationComponent.ts index 0ec8bc4..7ac8af0 100644 --- a/src/app/utilities/vm-migration/VmMigrationComponent.ts +++ b/src/app/utilities/vm-migration/VmMigrationComponent.ts @@ -65,6 +65,10 @@ export class VmMigrationComponent implements OnInit { public instanceId: string; /** Form valid on submit trigger @public */ public submitted: boolean = false; + /** Contains vduId @public */ + public vduId: {}; + /** Items for countIndex @public */ + public countIndex: {}[]; /** Input contains component objects @private */ @Input() private params: URLPARAMS; /** FormBuilder instance added to the formBuilder @private */ @@ -166,6 +170,12 @@ export class VmMigrationComponent implements OnInit { vnfInstanceData.push(vnfInstanceDataObj); }); this.vdu = vnfInstanceData; + const vduName: string = 'VDU'; + this.vduId = this.vdu.filter((vdu: {}, index: number, self: {}[]): {} => + index === self.findIndex((t: {}): {} => ( + t[vduName] === vdu[vduName] + )) + ); } }, (error: ERRORDATA): void => { this.restService.handleError(error, 'get'); @@ -174,6 +184,12 @@ export class VmMigrationComponent implements OnInit { } } + /** Getting count-index by filtering id */ + public getCountIndex(id: string): void { + const VDU: string = 'VDU'; + this.countIndex = this.vdu.filter((vnfdData: {}[]): boolean => vnfdData[VDU] === id); + } + /** Trigger VM Migration on submit */ public triggerMigration(): void { this.submitted = true; -- 2.25.1