]>
Commit | Line | Data |
---|---|---|
11fdf7f2 TL |
1 | import { HttpClient } from '@angular/common/http'; |
2 | import { Injectable } from '@angular/core'; | |
3 | ||
4 | import { of as observableOf } from 'rxjs'; | |
5 | import { mergeMap } from 'rxjs/operators'; | |
6 | ||
81eedcae | 7 | import { cdEncode } from '../decorators/cd-encode'; |
11fdf7f2 TL |
8 | import { ApiModule } from './api.module'; |
9 | ||
81eedcae | 10 | @cdEncode |
11fdf7f2 TL |
11 | @Injectable({ |
12 | providedIn: ApiModule | |
13 | }) | |
14 | export class PerformanceCounterService { | |
15 | private url = 'api/perf_counters'; | |
16 | ||
17 | constructor(private http: HttpClient) {} | |
18 | ||
19 | list() { | |
20 | return this.http.get(this.url); | |
21 | } | |
22 | ||
23 | get(service_type: string, service_id: string) { | |
81eedcae | 24 | return this.http.get(`${this.url}/${service_type}/${service_id}`).pipe( |
9f95a23c | 25 | mergeMap((resp: any) => { |
11fdf7f2 TL |
26 | return observableOf(resp['counters']); |
27 | }) | |
28 | ); | |
29 | } | |
30 | } |