diff --git a/src/main/webapp/app/core/application/applicationInfo.service.ts b/src/main/webapp/app/core/application/applicationInfo.service.ts index d89b6d1bc966bbe3a8e301bf952e352fb0095ea2..9504fb8b471950ef28572ccd85cd423df455cd85 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 23ddecf0cf20926cd11c6ae48fff28186fe0193d..277785a4b0fef93acbbba9d6de02a3cc96025af2 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(); } }