src/app/shared/api/prometheus.service.ts
Properties |
|
Methods |
constructor(http: HttpClient, settingsService: SettingsService)
|
|||||||||
Defined in src/app/shared/api/prometheus.service.ts:14
|
|||||||||
Parameters :
|
getNotificationSince | ||||
getNotificationSince(notification)
|
||||
Defined in src/app/shared/api/prometheus.service.ts:26
|
||||
Parameters :
Returns :
Observable<PrometheusNotification[]>
|
ifAlertmanagerConfigured | ||||
ifAlertmanagerConfigured(fn)
|
||||
Defined in src/app/shared/api/prometheus.service.ts:18
|
||||
Parameters :
Returns :
void
|
list | ||||||||
list(params: object)
|
||||||||
Defined in src/app/shared/api/prometheus.service.ts:22
|
||||||||
Parameters :
Returns :
Observable<PrometheusAlert[]>
|
Private baseURL |
Type : string
|
Default value : 'api/prometheus'
|
Defined in src/app/shared/api/prometheus.service.ts:14
|
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { PrometheusAlert, PrometheusNotification } from '../models/prometheus-alerts';
import { ApiModule } from './api.module';
import { SettingsService } from './settings.service';
@Injectable({
providedIn: ApiModule
})
export class PrometheusService {
private baseURL = 'api/prometheus';
constructor(private http: HttpClient, private settingsService: SettingsService) {}
ifAlertmanagerConfigured(fn): void {
this.settingsService.ifSettingConfigured('api/settings/alertmanager-api-host', fn);
}
list(params = {}): Observable<PrometheusAlert[]> {
return this.http.get<PrometheusAlert[]>(this.baseURL, { params });
}
getNotificationSince(notification): Observable<PrometheusNotification[]> {
return this.http.post<PrometheusNotification[]>(
`${this.baseURL}/get_notifications_since`,
notification
);
}
}