blob: a2b17578834e49c9de62ea7ffb4e5e6e23583ecc [file] [log] [blame]
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +03001import { Component, OnInit } from '@angular/core';
2import {ExternalComponentStatus} from "../shared/models/externalComponentStatus";
3import {HealthStatusService} from "../shared/server/healthStatusService/health-status.service";
4
5@Component({
6 selector: 'app-health-status',
7 templateUrl: './health-status.component.html',
8 styleUrls: ['./health-status.component.scss']
9})
10export class HealthStatusComponent implements OnInit {
Ittay Stern6f900cc2018-08-29 17:01:32 +030011 componentStatuses: Array<ExternalComponentStatus> = [];
12 dataIsReady: boolean;
13 lastUpdatedDate: Date;
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030014
15 constructor(private _healthStatusService: HealthStatusService) {
16 }
17
18
19 ngOnInit() {
20 this.refreshData();
21 }
22
23 refreshData(): void {
24 this.dataIsReady = false;
25 this._healthStatusService.getProbe()
26 .subscribe((res: Array<ExternalComponentStatus>) => {
27 this.componentStatuses = res;
28 this.dataIsReady = true;
29 this.lastUpdatedDate = new Date();
30 })
31 }
32
33 getMetadata(status : ExternalComponentStatus):string {
34 let metadata = status.metadata;
35 delete metadata.rawData;
36 return metadata;
37 }
38
39 isAvailable(componentStatus: ExternalComponentStatus) {
40 return componentStatus.available;
41 }
42}