diff options
Diffstat (limited to 'client/src/app/+admin/requests/shared/request.service.ts')
-rw-r--r-- | client/src/app/+admin/requests/shared/request.service.ts | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/client/src/app/+admin/requests/shared/request.service.ts b/client/src/app/+admin/requests/shared/request.service.ts index 55b28bcfc..915d192a6 100644 --- a/client/src/app/+admin/requests/shared/request.service.ts +++ b/client/src/app/+admin/requests/shared/request.service.ts | |||
@@ -15,10 +15,20 @@ export class RequestService { | |||
15 | private restExtractor: RestExtractor | 15 | private restExtractor: RestExtractor |
16 | ) {} | 16 | ) {} |
17 | 17 | ||
18 | getStats(): Observable<RequestStats> { | 18 | getStats(): Observable<{ [ id: string ]: RequestStats }> { |
19 | return this.authHttp.get(RequestService.BASE_REQUEST_URL + 'stats') | 19 | return this.authHttp.get(RequestService.BASE_REQUEST_URL + 'stats') |
20 | .map(this.restExtractor.extractDataGet) | 20 | .map(this.restExtractor.extractDataGet) |
21 | .map((data) => new RequestStats(data)) | 21 | .map(this.buildRequestObjects) |
22 | .catch((res) => this.restExtractor.handleError(res)); | 22 | .catch((res) => this.restExtractor.handleError(res)); |
23 | } | 23 | } |
24 | |||
25 | private buildRequestObjects(data: any) { | ||
26 | const requestSchedulers = {}; | ||
27 | |||
28 | Object.keys(data).forEach(requestSchedulerName => { | ||
29 | requestSchedulers[requestSchedulerName] = new RequestStats(data[requestSchedulerName]); | ||
30 | }); | ||
31 | |||
32 | return requestSchedulers; | ||
33 | } | ||
24 | } | 34 | } |