diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-09-23 17:09:38 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-09-23 17:09:38 +0200 |
commit | eb4f957eca2a045ad0d5cf0c1e79b9c08494b088 (patch) | |
tree | 26b1cc77d20bf9e1ec76b2f2c9cfb8182ebbf064 /client/src/app/admin/requests/shared | |
parent | ccc64aa6790961d2af3524a78ff8506cbdbefb13 (diff) | |
download | PeerTube-eb4f957eca2a045ad0d5cf0c1e79b9c08494b088.tar.gz PeerTube-eb4f957eca2a045ad0d5cf0c1e79b9c08494b088.tar.zst PeerTube-eb4f957eca2a045ad0d5cf0c1e79b9c08494b088.zip |
Client: add requests stats page
Diffstat (limited to 'client/src/app/admin/requests/shared')
-rw-r--r-- | client/src/app/admin/requests/shared/index.ts | 2 | ||||
-rw-r--r-- | client/src/app/admin/requests/shared/request-stats.model.ts | 8 | ||||
-rw-r--r-- | client/src/app/admin/requests/shared/request.service.ts | 21 |
3 files changed, 31 insertions, 0 deletions
diff --git a/client/src/app/admin/requests/shared/index.ts b/client/src/app/admin/requests/shared/index.ts new file mode 100644 index 000000000..32ab5767b --- /dev/null +++ b/client/src/app/admin/requests/shared/index.ts | |||
@@ -0,0 +1,2 @@ | |||
1 | export * from './request-stats.model'; | ||
2 | export * from './request.service'; | ||
diff --git a/client/src/app/admin/requests/shared/request-stats.model.ts b/client/src/app/admin/requests/shared/request-stats.model.ts new file mode 100644 index 000000000..7e4b26bca --- /dev/null +++ b/client/src/app/admin/requests/shared/request-stats.model.ts | |||
@@ -0,0 +1,8 @@ | |||
1 | export interface RequestStats { | ||
2 | milliSecondsInterval: number; | ||
3 | remainingMilliSeconds: number; | ||
4 | requests: { | ||
5 | request: any, | ||
6 | to: any | ||
7 | }[]; | ||
8 | } | ||
diff --git a/client/src/app/admin/requests/shared/request.service.ts b/client/src/app/admin/requests/shared/request.service.ts new file mode 100644 index 000000000..59d138039 --- /dev/null +++ b/client/src/app/admin/requests/shared/request.service.ts | |||
@@ -0,0 +1,21 @@ | |||
1 | import { Injectable } from '@angular/core'; | ||
2 | import { Observable } from 'rxjs/Observable'; | ||
3 | |||
4 | import { RequestStats } from './request-stats.model'; | ||
5 | import { AuthHttp, RestExtractor } from '../../../shared'; | ||
6 | |||
7 | @Injectable() | ||
8 | export class RequestService { | ||
9 | private static BASE_REQUEST_URL: string = '/api/v1/requests/'; | ||
10 | |||
11 | constructor ( | ||
12 | private authHttp: AuthHttp, | ||
13 | private restExtractor: RestExtractor | ||
14 | ) {} | ||
15 | |||
16 | getStats(): Observable<RequestStats> { | ||
17 | return this.authHttp.get(RequestService.BASE_REQUEST_URL + 'stats') | ||
18 | .map(this.restExtractor.extractDataGet) | ||
19 | .catch((res) => this.restExtractor.handleError(res)); | ||
20 | } | ||
21 | } | ||