From 0b804a70e0e5b8f9a3c1860be9bf57aa597ac79e Mon Sep 17 00:00:00 2001 From: "harshini.r" Date: Thu, 28 Apr 2022 12:43:12 +0530 Subject: [PATCH] Bug 1952 - Uptime of running service instances not displayed correctly *Modified the uptime of running instances to show time value upto one decimal point. *Corrected the api for VNF instances to show its proper count. *Changed label of X axis from instances to NS instances in graph. Change-Id: Iaf339aaee175c39d528de5e0cf506e00316258ba Signed-off-by: harshini.r --- src/app/dashboard/DashboardComponent.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/app/dashboard/DashboardComponent.ts b/src/app/dashboard/DashboardComponent.ts index b7902a0..b3e48e4 100644 --- a/src/app/dashboard/DashboardComponent.ts +++ b/src/app/dashboard/DashboardComponent.ts @@ -57,7 +57,7 @@ export class DashboardComponent implements OnInit { /** Invoke service injectors @public */ public injector: Injector; - /** handle translate @public */ + /** Handle translate @public */ public translateService: TranslateService; /** Observable holds logined value @public */ @@ -177,6 +177,9 @@ export class DashboardComponent implements OnInit { /** Contians hour converter @private */ private hourConverter: number = 3600; + /** Converter used to round off time to one decimal point @private */ + private converter: number = 10; + /** Notifier service to popup notification @private */ private notifierService: NotifierService; @@ -310,7 +313,7 @@ export class DashboardComponent implements OnInit { const now: Date = new Date(); const currentTime: number = Number((now.getTime().toString().slice(0, this.sliceLimit))); this.createdTimes.forEach((createdTime: string): void => { - this.noOfHours.push((Math.round((currentTime - Number(createdTime)) / this.hourConverter))); + this.noOfHours.push(Math.floor(((currentTime - Number(createdTime)) / this.hourConverter) * (this.converter)) / this.converter); }); this.drawNsChart(); } @@ -353,7 +356,7 @@ export class DashboardComponent implements OnInit { display: true, scaleLabel: { display: true, - labelString: this.translateService.instant('INSTANCES') + labelString: this.translateService.instant('NSINSTANCES') } }], yAxes: [{ @@ -373,7 +376,7 @@ export class DashboardComponent implements OnInit { /** Get VNFD instance details @public */ public getVnfInstanceCount(): void { - this.vnfInstanceCountSub = this.restService.getResource(environment.NSDINSTANCES_URL) + this.vnfInstanceCountSub = this.restService.getResource(environment.VNFINSTANCES_URL) .subscribe((vnfInstanceData: VNFInstanceDetails[]): void => { this.vnfInstanceCount = vnfInstanceData.length; }, (error: ERRORDATA): void => { -- 2.17.1