Skip to content

Commit

Permalink
added versions
Browse files Browse the repository at this point in the history
  • Loading branch information
hahahannes committed Jan 2, 2024
1 parent 1b31168 commit 972395e
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { HttpParams } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { Observable, map } from 'rxjs';
import { ApiService } from '../api/api.service';

@Injectable({
Expand All @@ -17,4 +17,13 @@ export class ContainerEngineManagerService {
queryParams = queryParams.set("max_lines", max_lines)
return <Observable<string>>this.http.get(url, queryParams, "text")
}

getVersion(): Observable<string> {
var url = this.logPath
return this.http.get(url, undefined, undefined, true).pipe(
map((response: any) => {
return response.headers.get("X-Api-Version")
})
)
}
}
11 changes: 10 additions & 1 deletion src/app/core/services/host-manager/host-manager.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { Observable, map } from 'rxjs';
import { HostResource } from 'src/app/host/models/models';
import { ApiService } from '../api/api.service';

Expand All @@ -16,4 +16,13 @@ export class HostManagerService {
getHostResources(): Observable<HostResource[]> {
return <Observable<HostResource[]>>this.http.get(this.hostManagerPath + "/host-resources")
}

getVersion(): Observable<string> {
var url = this.hostManagerPath + "/host-resources"
return this.http.get(url, undefined, undefined, true).pipe(
map((response: any) => {
return response.headers.get("X-Api-Version")
})
)
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { Observable, map } from 'rxjs';
import { CreateSecret, Secret, SecretRequest, SecretType } from 'src/app/secrets/models/secret_models';
import { ApiService } from '../../../core/services/api/api.service';

Expand Down Expand Up @@ -34,4 +34,13 @@ export class SecretManagerServiceService {
deleteSecret(secretID: string): Observable<any> {
return <Observable<any>>this.http.delete(this.secretManagerPath + "/secrets/" + secretID)
}

getVersion(): Observable<string> {
var url = this.secretManagerPath + "/health-check"
return this.http.get(url, undefined, undefined, true).pipe(
map((response: any) => {
return response.headers.get("X-Api-Version")
})
)
}
}
15 changes: 15 additions & 0 deletions src/app/info/version/version.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,19 @@
<mat-label>Module-Manager Version</mat-label>
<input matInput [readonly]="true" [value]="moduleManagerVersion">
</mat-form-field>

<mat-form-field appearance="fill">
<mat-label>Secret-Manager Version</mat-label>
<input matInput [readonly]="true" [value]="secretManagerVersion">
</mat-form-field>

<mat-form-field appearance="fill">
<mat-label>Host-Manager Version</mat-label>
<input matInput [readonly]="true" [value]="hostManagerVersion">
</mat-form-field>

<mat-form-field appearance="fill">
<mat-label>Container-Engine-Wrapper Version</mat-label>
<input matInput [readonly]="true" [value]="containerManagerVersion">
</mat-form-field>
</div>
40 changes: 39 additions & 1 deletion src/app/info/version/version.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { Component, OnInit } from '@angular/core';
import { ContainerEngineManagerService } from 'src/app/core/services/container-engine-manager/container-engine-manager.service';
import { HostManagerService } from 'src/app/core/services/host-manager/host-manager.service';
import { ModuleManagerService } from 'src/app/core/services/module-manager/module-manager-service.service';
import { SecretManagerServiceService } from 'src/app/core/services/secret-manager/secret-manager-service.service';
import { environment } from 'src/environments/environment';

@Component({
Expand All @@ -11,8 +14,16 @@ export class VersionComponent implements OnInit {
uiVersion: string = environment.uiVersion
ready: boolean = false
moduleManagerVersion: string = ""
secretManagerVersion: string = ""
hostManagerVersion: string = ""
containerManagerVersion: string = ""

constructor(private moduleManagerService: ModuleManagerService) {}
constructor(
private moduleManagerService: ModuleManagerService,
private secretManagerService: SecretManagerServiceService,
private hostManagerService: HostManagerService,
private containerManager: ContainerEngineManagerService
) {}

ngOnInit(): void {
this.ready = true
Expand All @@ -24,5 +35,32 @@ export class VersionComponent implements OnInit {
console.log(err)
}
})

this.secretManagerService.getVersion().subscribe({
next: (version) => {
this.secretManagerVersion = version
},
error: (err) => {
console.log(err)
}
})

this.containerManager.getVersion().subscribe({
next: (version) => {
this.containerManagerVersion = version
},
error: (err) => {
console.log(err)
}
})

this.hostManagerService.getVersion().subscribe({
next: (version) => {
this.hostManagerVersion = version
},
error: (err) => {
console.log(err)
}
})
}
}

0 comments on commit 972395e

Please sign in to comment.