Fix Bug 2344: OSM Version is not showing while refreshing the UI dashboard 46/14346/1
authorSANDHYA.JS <sandhya.j@tataelxsi.co.in>
Fri, 8 Mar 2024 06:44:11 +0000 (12:14 +0530)
committerjssan <sandhya.j@tataelxsi.co.in>
Tue, 7 May 2024 11:23:00 +0000 (12:23 +0100)
- Fix to show the version

Change-Id: I32cd425b88e6eb95f34b04e47a459b7382b952a2
Signed-off-by: SANDHYA.JS <sandhya.j@tataelxsi.co.in>
(cherry picked from commit 60f0a51c47cca2eaff2e9cf55deacf0c90548f04)

src/app/layouts/header/HeaderComponent.ts
src/services/AuthenticationService.ts
src/services/SharedService.ts

index 13e2129..fa932b8 100644 (file)
@@ -19,6 +19,7 @@
 /**
  * @file Header Component
  */
+import { isNullOrUndefined } from 'util';
 import { Component, Injector, OnInit } from '@angular/core';
 import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
 import { TranslateService } from '@ngx-translate/core';
@@ -75,6 +76,9 @@ export class HeaderComponent implements OnInit {
     /** handle translate @public */
     public translateService: TranslateService;
 
+    /** Version holds version @public */
+    public getLocalStorageVersion: string;
+
     /** Utilizes auth service for any auth operations @private */
     private authService: AuthenticationService;
 
@@ -101,14 +105,19 @@ export class HeaderComponent implements OnInit {
         this.authService.ProjectName.subscribe((projectNameFinal: string): void => {
             this.getSelectedProject = projectNameFinal;
         });
+        this.sharedService.fetchOSMVersion();
         this.username$ = this.authService.username;
         this.projectService.setHeaderProjects();
         this.projectList$ = this.projectService.projectList;
         this.PACKAGEVERSION = environment.packageVersion;
-        const getLocalStorageVersion: string = sessionStorage.getItem('osmVersion');
-        if (getLocalStorageVersion === null) {
+        if (!isNullOrUndefined(sessionStorage.getItem('version'))) {
+            this.getLocalStorageVersion = sessionStorage.getItem('version');
+        } else if (!isNullOrUndefined(this.sharedService.osmVersion)) {
+            this.getLocalStorageVersion = this.sharedService.osmVersion;
+        }
+        if (this.getLocalStorageVersion === null) {
             this.showNewVersion();
-        } else if (getLocalStorageVersion !== this.sharedService.osmVersion) {
+        } else if (this.getLocalStorageVersion !== sessionStorage.getItem('osmVersion')) {
             this.showNewVersion();
         }
     }
index a8950e5..d01eec6 100644 (file)
@@ -199,7 +199,7 @@ export class AuthenticationService {
         this.changePassword.next(false);
         const langCode: string = sessionStorage.getItem('languageCode');
         const redirecturl: string = isNullOrUndefined(sessionStorage.getItem('returnUrl')) ? '/' : sessionStorage.getItem('returnUrl');
-        const osmVersion: string = isNullOrUndefined(sessionStorage.getItem('osmVersion')) ? '' : sessionStorage.getItem('osmVersion');
+        const osmVersion: string = isNullOrUndefined(sessionStorage.getItem('version')) ? '' : sessionStorage.getItem('version');
         sessionStorage.clear();
         sessionStorage.setItem('languageCode', langCode);
         sessionStorage.setItem('returnUrl', redirecturl);
index e8eac94..2a5f50f 100644 (file)
@@ -414,6 +414,7 @@ export class SharedService {
             const version: string[] = res.version.split('+');
             if (!isNullOrUndefined(version[0])) {
                 this.osmVersion = version[0];
+                sessionStorage.setItem('version', version[0]);
             } else {
                 this.osmVersion = null;
             }