This is the codeAbility Sharing Platform! Learn more about the codeAbility Sharing Platform.

Skip to content
Snippets Groups Projects
Commit 15908b43 authored by Michael Breu's avatar Michael Breu
Browse files

Fixed Problems with footer Info

parent 5ca3cfa9
Branches
2 merge requests!132Bringing July Release to production,!128Fixing #315 and #319
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs'; import { Observable, Subject } from 'rxjs';
import { ApplicationConfigService } from 'app/core/config/application-config.service'; import { ApplicationConfigService } from 'app/core/config/application-config.service';
...@@ -11,8 +11,11 @@ export class DeploymentInfo { ...@@ -11,8 +11,11 @@ export class DeploymentInfo {
} }
@Injectable({ providedIn: 'root' }) @Injectable({ providedIn: 'root' })
export class ApplicationInfoService { export class ApplicationInfoService {
cachedDeploymentInfo: DeploymentInfo; private cachedDeploymentInfo: DeploymentInfo;
inLoading = false; private inLoading = false;
private deploymentInfoBroker = new Subject<DeploymentInfo>();
constructor(private http: HttpClient, private applicationConfigService: ApplicationConfigService) { constructor(private http: HttpClient, private applicationConfigService: ApplicationConfigService) {
this.cachedDeploymentInfo = {} as DeploymentInfo; this.cachedDeploymentInfo = {} as DeploymentInfo;
} }
...@@ -27,11 +30,16 @@ export class ApplicationInfoService { ...@@ -27,11 +30,16 @@ export class ApplicationInfoService {
this.loadDeploymentInfo().subscribe(res => { this.loadDeploymentInfo().subscribe(res => {
this.cachedDeploymentInfo = res; this.cachedDeploymentInfo = res;
this.inLoading = false; this.inLoading = false;
this.deploymentInfoBroker.next(this.cachedDeploymentInfo);
}); });
} }
return this.cachedDeploymentInfo; return this.cachedDeploymentInfo;
} }
onDeploymentInfoChanged(): Observable<DeploymentInfo> {
return this.deploymentInfoBroker;
}
private loadDeploymentInfo(): Observable<DeploymentInfo> { private loadDeploymentInfo(): Observable<DeploymentInfo> {
return this.http.get<DeploymentInfo>(SERVER_API_URL + 'api/applicationInfo/deploymentInfo'); return this.http.get<DeploymentInfo>(SERVER_API_URL + 'api/applicationInfo/deploymentInfo');
} }
......
...@@ -10,6 +10,9 @@ export class FooterComponent implements OnInit { ...@@ -10,6 +10,9 @@ export class FooterComponent implements OnInit {
constructor(public applicationInfoService: ApplicationInfoService) {} constructor(public applicationInfoService: ApplicationInfoService) {}
ngOnInit(): void { ngOnInit(): void {
this.applicationInfoService.onDeploymentInfoChanged().subscribe(
depInfo => { this.deploymentInfo = depInfo;}
)
this.deploymentInfo = this.applicationInfoService.getDeploymentInfo(); this.deploymentInfo = this.applicationInfoService.getDeploymentInfo();
} }
} }
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment