]> git.apps.os.sepia.ceph.com Git - ceph.git/blob
b6ac5d5fe3e67ef6b29c7e3da79cf9158fb9654a
[ceph.git] /
1 import { HttpClient } from '@angular/common/http';
2 import { Injectable } from '@angular/core';
3
4 @Injectable()
5 export class TablePerformanceCounterService {
6
7   private url = 'api/perf_counters';
8
9   constructor(private http: HttpClient) { }
10
11   list() {
12     return this.http.get(this.url)
13       .toPromise()
14       .then((resp: object): object => {
15         return resp;
16       });
17   }
18
19   get(service_type: string, service_id: string) {
20     const serviceType = service_type.replace('-', '_');
21
22     return this.http.get(`${this.url}/${serviceType}/${service_id}`)
23       .toPromise()
24       .then((resp: object): Array<object> => {
25         return resp['counters'];
26       });
27   }
28 }