From 15908b43741996873e5c81258baddebde12d1278 Mon Sep 17 00:00:00 2001
From: Michael Breu <Michael.Breu@arctis.at>
Date: Thu, 30 Jun 2022 12:04:07 +0200
Subject: [PATCH] Fixed Problems with footer Info

---
 .../core/application/applicationInfo.service.ts    | 14 +++++++++++---
 .../webapp/app/layouts/footer/footer.component.ts  |  3 +++
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/main/webapp/app/core/application/applicationInfo.service.ts b/src/main/webapp/app/core/application/applicationInfo.service.ts
index d89b6d1bc..9504fb8b4 100644
--- a/src/main/webapp/app/core/application/applicationInfo.service.ts
+++ b/src/main/webapp/app/core/application/applicationInfo.service.ts
@@ -1,6 +1,6 @@
 import { Injectable } from '@angular/core';
 import { HttpClient } from '@angular/common/http';
-import { Observable } from 'rxjs';
+import { Observable, Subject } from 'rxjs';
 
 import { ApplicationConfigService } from 'app/core/config/application-config.service';
 
@@ -11,8 +11,11 @@ export class DeploymentInfo {
 }
 @Injectable({ providedIn: 'root' })
 export class ApplicationInfoService {
-  cachedDeploymentInfo: DeploymentInfo;
-  inLoading = false;
+  private cachedDeploymentInfo: DeploymentInfo;
+  private inLoading = false;
+  
+  private deploymentInfoBroker = new Subject<DeploymentInfo>();
+  
   constructor(private http: HttpClient, private applicationConfigService: ApplicationConfigService) {
     this.cachedDeploymentInfo = {} as DeploymentInfo;
   }
@@ -27,11 +30,16 @@ export class ApplicationInfoService {
       this.loadDeploymentInfo().subscribe(res => {
         this.cachedDeploymentInfo = res;
         this.inLoading = false;
+        this.deploymentInfoBroker.next(this.cachedDeploymentInfo);
       });
     }
     return this.cachedDeploymentInfo;
   }
 
+  onDeploymentInfoChanged(): Observable<DeploymentInfo> {
+    return this.deploymentInfoBroker;
+  }
+
   private loadDeploymentInfo(): Observable<DeploymentInfo> {
     return this.http.get<DeploymentInfo>(SERVER_API_URL + 'api/applicationInfo/deploymentInfo');
   }
diff --git a/src/main/webapp/app/layouts/footer/footer.component.ts b/src/main/webapp/app/layouts/footer/footer.component.ts
index 23ddecf0c..277785a4b 100644
--- a/src/main/webapp/app/layouts/footer/footer.component.ts
+++ b/src/main/webapp/app/layouts/footer/footer.component.ts
@@ -10,6 +10,9 @@ export class FooterComponent implements OnInit {
 
   constructor(public applicationInfoService: ApplicationInfoService) {}
   ngOnInit(): void {
+    this.applicationInfoService.onDeploymentInfoChanged().subscribe(
+      depInfo => { this.deploymentInfo = depInfo;}
+    )
     this.deploymentInfo = this.applicationInfoService.getDeploymentInfo();
   }
 }
-- 
GitLab