Skip to content

Commit 555a485

Browse files
committed
feat: add application version info retrieval functionality
Signed-off-by: Manuel Abascal <mjabascal10@gmail.com>
1 parent 2b4b256 commit 555a485

7 files changed

Lines changed: 19 additions & 14 deletions

File tree

frontend/src/app/app-module/module-integration/module-integration.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class ModuleIntegrationComponent implements OnInit {
2323

2424
getVersionInfo() {
2525
this.checkForUpdatesService.getVersion().subscribe(response => {
26-
this.currentVersion = response.body.build.version;
26+
this.currentVersion = response.body.version;
2727
});
2828
}
2929

frontend/src/app/app-module/shared/components/app-module-card/app-module-card.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {UtmModuleType} from '../../type/utm-module.type';
1919
export class AppModuleCardComponent implements OnInit, OnDestroy {
2020

2121
constructor(private versionTypeService: VersionTypeService,
22-
private modalService: NgbModal,) {
22+
private modalService: NgbModal) {
2323
}
2424
@Input() module: UtmModuleType;
2525
@Output() showModuleIntegration = new EventEmitter<UtmModuleType>();
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<ng-container *ngIf="versionInfo as currentVersion">
2-
<span *ngIf="currentVersion.build"
2+
<span *ngIf="currentVersion.version"
33
[ngClass]="'badge-success-800'"
44
class="badge badge-pill version-info cursor-pointer text-white">
5-
{{currentVersion.build.version}}
5+
{{currentVersion.version + '-' + currentVersion.edition}}
66
</span>
77
</ng-container>

frontend/src/app/shared/components/layout/header/shared/components/utm-version-info/utm-version-info.component.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ import {catchError, map, tap} from 'rxjs/operators';
44
import {UtmToastService} from '../../../../../../alert/utm-toast.service';
55
import {CheckForUpdatesService} from '../../../../../../services/updates/check-for-updates.service';
66
import {VersionType, VersionTypeService} from '../../../../../../services/util/version-type.service';
7-
import {VersionInfo} from '../../../../../../types/updates/updates.type';
7+
import {AppVersionInfo, VersionInfo} from '../../../../../../types/updates/updates.type';
88

99
@Component({
1010
selector: 'app-utm-version-info',
1111
templateUrl: './utm-version-info.component.html',
1212
styleUrls: ['./utm-version-info.component.css']
1313
})
1414
export class UtmVersionInfoComponent implements OnInit {
15-
versionInfo: VersionInfo;
15+
versionInfo: AppVersionInfo;
1616

1717
constructor(private checkForUpdatesService: CheckForUpdatesService,
1818
private utmToastService: UtmToastService,
@@ -23,9 +23,9 @@ export class UtmVersionInfoComponent implements OnInit {
2323
this.checkForUpdatesService.getVersion()
2424
.pipe(
2525
map(response => response.body || null),
26-
tap((versionInfo: VersionInfo) => {
27-
const version = versionInfo && versionInfo.build && versionInfo.build.version || '';
28-
const versionType = version.includes('community') || version === ''
26+
tap((versionInfo: AppVersionInfo) => {
27+
const version = versionInfo && versionInfo.version || '';
28+
const versionType = versionInfo.edition.includes('community') || version === ''
2929
? VersionType.COMMUNITY
3030
: VersionType.ENTERPRISE;
3131

frontend/src/app/shared/services/updates/check-for-updates.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {HttpClient, HttpResponse} from '@angular/common/http';
22
import {Injectable} from '@angular/core';
33
import {Observable} from 'rxjs';
44
import {SERVER_API_URL} from '../../../app.constants';
5-
import {VersionInfo} from '../../types/updates/updates.type';
5+
import {AppVersionInfo, VersionInfo} from '../../types/updates/updates.type';
66

77

88
@Injectable({
@@ -15,8 +15,8 @@ export class CheckForUpdatesService {
1515
constructor(private http: HttpClient) {
1616
}
1717

18-
getVersion(): Observable<HttpResponse<VersionInfo>> {
19-
return this.http.get<VersionInfo>(this.resourceInfo + 'info', {observe: 'response'});
18+
getVersion(): Observable<HttpResponse<AppVersionInfo>> {
19+
return this.http.get<AppVersionInfo>(this.resourceUrl + 'info/version', {observe: 'response'});
2020
}
2121

2222
getMode(): Observable<HttpResponse<boolean>> {

frontend/src/app/shared/types/updates/updates.type.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,9 @@ export class VersionInfo {
1818
activeProfiles: string[];
1919
}
2020

21+
export interface AppVersionInfo {
22+
version: string;
23+
edition: string;
24+
}
25+
2126

frontend/src/environments/environment.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
export const environment = {
66
production: false,
7-
SERVER_API_URL: 'https://192.168.1.18/',
8-
// SERVER_API_URL: 'http://localhost:8080/',
7+
//SERVER_API_URL: 'https://192.168.1.18/',
8+
SERVER_API_URL: 'http://localhost:8080/',
99
SERVER_API_CONTEXT: '',
1010
SESSION_AUTH_TOKEN: window.location.host.split(':')[0].toLocaleUpperCase(),
1111
WEBSOCKET_URL: '//localhost:8080',

0 commit comments

Comments
 (0)