diff --git a/unos-fe/src/app/watchdog/models/StatusIntMap.ts b/unos-fe/src/app/watchdog/models/StatusIntMap.ts new file mode 100644 index 0000000..936cac5 --- /dev/null +++ b/unos-fe/src/app/watchdog/models/StatusIntMap.ts @@ -0,0 +1,3 @@ +import {Status} from "./Status"; + +export type StatusIntMap = Record diff --git a/unos-fe/src/app/watchdog/services/fetch-metrics.service.ts b/unos-fe/src/app/watchdog/services/fetch-metrics.service.ts index 9f2ff02..0e0db47 100644 --- a/unos-fe/src/app/watchdog/services/fetch-metrics.service.ts +++ b/unos-fe/src/app/watchdog/services/fetch-metrics.service.ts @@ -3,6 +3,7 @@ import {Observable} from "rxjs"; import {HttpClient} from "@angular/common/http"; import {Metric} from "../models/Metric"; import {map} from 'rxjs/operators'; +import {StatusIntMap} from "../models/StatusIntMap"; @Injectable({ providedIn: 'root' @@ -31,4 +32,16 @@ export class FetchMetricsService { getOk():Observable{ return this.fetchMetrics("http://localhost:4200/api/v1/metrics/ok") } + + getUnknown():Observable { + return this.fetchMetrics("http://localhost:4200/api/v1/metrics/unknown") + } + + getNotGood():Observable { + return this.fetchMetrics("http://localhost:4200/api/v1/metrics/not-good") + } + + getCount():Observable{ + return this.http.get("http://localhost:4200/api/v1/metrics") + } } diff --git a/unos-fe/src/app/watchdog/watchdog-top/watchdog-top.component.html b/unos-fe/src/app/watchdog/watchdog-top/watchdog-top.component.html index 36c3e88..c5a25c2 100644 --- a/unos-fe/src/app/watchdog/watchdog-top/watchdog-top.component.html +++ b/unos-fe/src/app/watchdog/watchdog-top/watchdog-top.component.html @@ -1,5 +1,12 @@

Watch Dog

+
+

OK {{count.OK || 0}}

+

NOT GOOD {{count.NOT_GOOD || 0 }}

+

DEAD {{count.DEAD || 0 }}

+

UNKNOWN {{count.UNKNOWN || 0}}

+
+

{{ metric.name }}

diff --git a/unos-fe/src/app/watchdog/watchdog-top/watchdog-top.component.ts b/unos-fe/src/app/watchdog/watchdog-top/watchdog-top.component.ts index 5c2256f..d66b93b 100644 --- a/unos-fe/src/app/watchdog/watchdog-top/watchdog-top.component.ts +++ b/unos-fe/src/app/watchdog/watchdog-top/watchdog-top.component.ts @@ -4,6 +4,7 @@ import {Metric} from "../models/Metric"; import {NgForOf} from "@angular/common"; import {RouterOutlet} from "@angular/router"; import {HttpClientModule} from "@angular/common/http"; +import {StatusIntMap} from "../models/StatusIntMap"; @Component({ selector: 'app-watchdog-top', @@ -23,6 +24,7 @@ export class WatchdogTopComponent implements OnInit{ deads: Metric[] = [] ok: Metric[] = []; + count: StatusIntMap = {}; constructor(private fetchMetricsService: FetchMetricsService) { } @@ -30,6 +32,7 @@ export class WatchdogTopComponent implements OnInit{ ngOnInit(): void { this.getDead() this.getOk() + this.getCount() } @@ -43,4 +46,8 @@ export class WatchdogTopComponent implements OnInit{ getOk():void{ this.fetchMetricsService.getOk().subscribe(res =>{this.ok = res}) } + + getCount():void{ + this.fetchMetricsService.getCount().subscribe(res => (this.count = res)) + } }