aboutsummaryrefslogtreecommitdiffhomepage
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/src/app/admin/requests/request-stats/request-stats.component.html4
-rw-r--r--client/src/app/admin/requests/request-stats/request-stats.component.ts10
-rw-r--r--client/src/app/admin/requests/shared/request-stats.model.ts31
-rw-r--r--client/src/app/admin/requests/shared/request.service.ts1
4 files changed, 30 insertions, 16 deletions
diff --git a/client/src/app/admin/requests/request-stats/request-stats.component.html b/client/src/app/admin/requests/request-stats/request-stats.component.html
index 114fd371f..04e5937f8 100644
--- a/client/src/app/admin/requests/request-stats/request-stats.component.html
+++ b/client/src/app/admin/requests/request-stats/request-stats.component.html
@@ -3,12 +3,12 @@
3<div *ngIf="stats !== null"> 3<div *ngIf="stats !== null">
4 <div> 4 <div>
5 <span class="label-description">Interval seconds between requests:</span> 5 <span class="label-description">Interval seconds between requests:</span>
6 {{ secondsInterval }} 6 {{ stats.secondsInterval }}
7 </div> 7 </div>
8 8
9 <div> 9 <div>
10 <span class="label-description">Remaining time before the scheduled request:</span> 10 <span class="label-description">Remaining time before the scheduled request:</span>
11 {{ remainingSeconds }} 11 {{ stats.remainingSeconds }}
12 </div> 12 </div>
13 13
14 <div> 14 <div>
diff --git a/client/src/app/admin/requests/request-stats/request-stats.component.ts b/client/src/app/admin/requests/request-stats/request-stats.component.ts
index 8ff4eb540..6a9739bbf 100644
--- a/client/src/app/admin/requests/request-stats/request-stats.component.ts
+++ b/client/src/app/admin/requests/request-stats/request-stats.component.ts
@@ -19,19 +19,11 @@ export class RequestStatsComponent implements OnInit, OnDestroy {
19 } 19 }
20 20
21 ngOnDestroy() { 21 ngOnDestroy() {
22 if (this.secondsInterval !== null) { 22 if (this.stats.secondsInterval !== null) {
23 clearInterval(this.interval); 23 clearInterval(this.interval);
24 } 24 }
25 } 25 }
26 26
27 get remainingSeconds() {
28 return Math.floor(this.stats.remainingMilliSeconds / 1000);
29 }
30
31 get secondsInterval() {
32 return Math.floor(this.stats.milliSecondsInterval / 1000);
33 }
34
35 getStats() { 27 getStats() {
36 this.requestService.getStats().subscribe( 28 this.requestService.getStats().subscribe(
37 stats => { 29 stats => {
diff --git a/client/src/app/admin/requests/shared/request-stats.model.ts b/client/src/app/admin/requests/shared/request-stats.model.ts
index 7e4b26bca..dfa956f10 100644
--- a/client/src/app/admin/requests/shared/request-stats.model.ts
+++ b/client/src/app/admin/requests/shared/request-stats.model.ts
@@ -1,8 +1,29 @@
1export interface RequestStats { 1export interface Request {
2 request: any;
3 to: any;
4}
5
6export class RequestStats {
2 milliSecondsInterval: number; 7 milliSecondsInterval: number;
3 remainingMilliSeconds: number; 8 remainingMilliSeconds: number;
4 requests: { 9 requests: Request[];
5 request: any, 10
6 to: any 11 constructor(hash: {
7 }[]; 12 milliSecondsInterval: number,
13 remainingMilliSeconds: number,
14 requests: Request[];
15 }) {
16 this.milliSecondsInterval = hash.milliSecondsInterval;
17 this.remainingMilliSeconds = hash.remainingMilliSeconds;
18 this.requests = hash.requests;
19 }
20
21 get remainingSeconds() {
22 return Math.floor(this.remainingMilliSeconds / 1000);
23 }
24
25 get secondsInterval() {
26 return Math.floor(this.milliSecondsInterval / 1000);
27 }
28
8} 29}
diff --git a/client/src/app/admin/requests/shared/request.service.ts b/client/src/app/admin/requests/shared/request.service.ts
index 59d138039..aeec37448 100644
--- a/client/src/app/admin/requests/shared/request.service.ts
+++ b/client/src/app/admin/requests/shared/request.service.ts
@@ -16,6 +16,7 @@ export class RequestService {
16 getStats(): Observable<RequestStats> { 16 getStats(): Observable<RequestStats> {
17 return this.authHttp.get(RequestService.BASE_REQUEST_URL + 'stats') 17 return this.authHttp.get(RequestService.BASE_REQUEST_URL + 'stats')
18 .map(this.restExtractor.extractDataGet) 18 .map(this.restExtractor.extractDataGet)
19 .map((data) => new RequestStats(data))
19 .catch((res) => this.restExtractor.handleError(res)); 20 .catch((res) => this.restExtractor.handleError(res));
20 } 21 }
21} 22}