Bug 1952 - Uptime of running service instances not displayed correctly 74/11974/2 v11.0.3
authorharshini.r <harshini.r@tataelxsi.co.in>
Thu, 28 Apr 2022 07:13:12 +0000 (12:43 +0530)
committerramanathan <ramerama@tataelxsi.co.in>
Wed, 18 May 2022 10:53:57 +0000 (12:53 +0200)
*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 <harshini.r@tataelxsi.co.in>
src/app/dashboard/DashboardComponent.ts

index b7902a0..b3e48e4 100644 (file)
@@ -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 => {