From 872a4c7cea861246cf84fa3686bd9d40c684535f Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 19 Jan 2017 22:38:34 +0100 Subject: [PATCH] Adapt requests controller/front to new informations --- .../request-stats.component.html | 38 ++++++++++++------- .../request-stats.component.scss | 15 +++++++- .../request-stats/request-stats.component.ts | 7 +--- .../requests/shared/request-stats.model.ts | 9 +++-- server/controllers/api/requests.js | 3 +- 5 files changed, 48 insertions(+), 24 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 6698eac48..9dbed1739 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 @@ -1,23 +1,33 @@

Requests stats

-
- Interval seconds between requests: - {{ stats.secondsInterval }} -
+
+
+ Remaining requests: + {{ stats.totalRequests }} +
-
- Remaining time before the scheduled request: - {{ stats.remainingSeconds }} -
+
+ Interval seconds between requests: + {{ stats.secondsInterval }} +
-
- Maximum number of requests per interval: - {{ stats.maxRequestsInParallel }} +
+ Remaining time before the scheduled request: + {{ stats.remainingSeconds }} +
-
- Remaining requests: - {{ stats.totalRequests }} +
+
+ Maximum number of different pods for a scheduled request: + {{ stats.requestsLimitPods }} +
+ +
+ Maximum number of requests per pod for a scheduled request: + {{ stats.requestsLimitPerPod }} +
+
diff --git a/client/src/app/admin/requests/request-stats/request-stats.component.scss b/client/src/app/admin/requests/request-stats/request-stats.component.scss index 92c28dc99..9c68fba99 100644 --- a/client/src/app/admin/requests/request-stats/request-stats.component.scss +++ b/client/src/app/admin/requests/request-stats/request-stats.component.scss @@ -1,6 +1,19 @@ .label-description { display: inline-block; - width: 350px; font-weight: bold; color: black; } + +.requests-general { + .label-description { + width: 320px; + } +} + +.requests-limit { + margin-top: 20px; + + .label-description { + width: 430px; + } +} 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 66075e4b5..23b836779 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 @@ -17,6 +17,7 @@ export class RequestStatsComponent implements OnInit, OnDestroy { ngOnInit() { this.getStats(); + this.runInterval(); } ngOnDestroy() { @@ -27,10 +28,7 @@ export class RequestStatsComponent implements OnInit, OnDestroy { getStats() { this.requestService.getStats().subscribe( - stats => { - this.stats = stats; - this.runInterval(); - }, + stats => this.stats = stats, err => alert(err.text) ); @@ -42,7 +40,6 @@ export class RequestStatsComponent implements OnInit, OnDestroy { if (this.stats.remainingMilliSeconds <= 0) { setTimeout(() => this.getStats(), this.stats.remainingMilliSeconds + 100); - clearInterval(this.interval); } }, 1000); } 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 49ecbc79e..f658c4682 100644 --- a/client/src/app/admin/requests/shared/request-stats.model.ts +++ b/client/src/app/admin/requests/shared/request-stats.model.ts @@ -4,18 +4,21 @@ export interface Request { } export class RequestStats { - maxRequestsInParallel: number; + requestsLimitPods: number; + requestsLimitPerPod: number; milliSecondsInterval: number; remainingMilliSeconds: number; totalRequests: number; constructor(hash: { - maxRequestsInParallel: number, + requestsLimitPods: number, + requestsLimitPerPod: number, milliSecondsInterval: number, remainingMilliSeconds: number, totalRequests: number; }) { - this.maxRequestsInParallel = hash.maxRequestsInParallel; + this.requestsLimitPods = hash.requestsLimitPods; + this.requestsLimitPerPod = hash.requestsLimitPerPod; this.milliSecondsInterval = hash.milliSecondsInterval; this.remainingMilliSeconds = hash.remainingMilliSeconds; this.totalRequests = hash.totalRequests; diff --git a/server/controllers/api/requests.js b/server/controllers/api/requests.js index 1f9193fc8..3e0d246d1 100644 --- a/server/controllers/api/requests.js +++ b/server/controllers/api/requests.js @@ -28,7 +28,8 @@ function getStatsRequests (req, res, next) { return res.json({ totalRequests: totalRequests, - maxRequestsInParallel: constants.REQUESTS_IN_PARALLEL, + requestsLimitPods: constants.REQUESTS_LIMIT_PODS, + requestsLimitPerPod: constants.REQUESTS_LIMIT_PER_POD, remainingMilliSeconds: db.Request.remainingMilliSeconds(), milliSecondsInterval: constants.REQUESTS_INTERVAL }) -- 2.25.1