aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-01-19 22:38:34 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-01-19 22:38:34 +0100
commit872a4c7cea861246cf84fa3686bd9d40c684535f (patch)
treec4323e825a086cde30089e2118bf1fe59ff40dd8
parentc625a9560b0f98907c678015b673b6f82efd0c36 (diff)
downloadPeerTube-872a4c7cea861246cf84fa3686bd9d40c684535f.tar.gz
PeerTube-872a4c7cea861246cf84fa3686bd9d40c684535f.tar.zst
PeerTube-872a4c7cea861246cf84fa3686bd9d40c684535f.zip
Adapt requests controller/front to new informations
-rw-r--r--client/src/app/admin/requests/request-stats/request-stats.component.html38
-rw-r--r--client/src/app/admin/requests/request-stats/request-stats.component.scss15
-rw-r--r--client/src/app/admin/requests/request-stats/request-stats.component.ts7
-rw-r--r--client/src/app/admin/requests/shared/request-stats.model.ts9
-rw-r--r--server/controllers/api/requests.js3
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 @@
1<h3>Requests stats</h3> 1<h3>Requests stats</h3>
2 2
3<div *ngIf="stats !== null"> 3<div *ngIf="stats !== null">
4 <div> 4 <div class="requests-general">
5 <span class="label-description">Interval seconds between requests:</span> 5 <div>
6 {{ stats.secondsInterval }} 6 <span class="label-description">Remaining requests:</span>
7 </div> 7 {{ stats.totalRequests }}
8 </div>
8 9
9 <div> 10 <div>
10 <span class="label-description">Remaining time before the scheduled request:</span> 11 <span class="label-description">Interval seconds between requests:</span>
11 {{ stats.remainingSeconds }} 12 {{ stats.secondsInterval }}
12 </div> 13 </div>
13 14
14 <div> 15 <div>
15 <span class="label-description">Maximum number of requests per interval:</span> 16 <span class="label-description">Remaining time before the scheduled request:</span>
16 {{ stats.maxRequestsInParallel }} 17 {{ stats.remainingSeconds }}
18 </div>
17 </div> 19 </div>
18 20
19 <div> 21 <div class="requests-limit">
20 <span class="label-description">Remaining requests:</span> 22 <div>
21 {{ stats.totalRequests }} 23 <span class="label-description">Maximum number of different pods for a scheduled request:</span>
24 {{ stats.requestsLimitPods }}
25 </div>
26
27 <div>
28 <span class="label-description">Maximum number of requests per pod for a scheduled request:</span>
29 {{ stats.requestsLimitPerPod }}
30 </div>
22 </div> 31 </div>
32
23</div> 33</div>
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 @@
1.label-description { 1.label-description {
2 display: inline-block; 2 display: inline-block;
3 width: 350px;
4 font-weight: bold; 3 font-weight: bold;
5 color: black; 4 color: black;
6} 5}
6
7.requests-general {
8 .label-description {
9 width: 320px;
10 }
11}
12
13.requests-limit {
14 margin-top: 20px;
15
16 .label-description {
17 width: 430px;
18 }
19}
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 {
17 17
18 ngOnInit() { 18 ngOnInit() {
19 this.getStats(); 19 this.getStats();
20 this.runInterval();
20 } 21 }
21 22
22 ngOnDestroy() { 23 ngOnDestroy() {
@@ -27,10 +28,7 @@ export class RequestStatsComponent implements OnInit, OnDestroy {
27 28
28 getStats() { 29 getStats() {
29 this.requestService.getStats().subscribe( 30 this.requestService.getStats().subscribe(
30 stats => { 31 stats => this.stats = stats,
31 this.stats = stats;
32 this.runInterval();
33 },
34 32
35 err => alert(err.text) 33 err => alert(err.text)
36 ); 34 );
@@ -42,7 +40,6 @@ export class RequestStatsComponent implements OnInit, OnDestroy {
42 40
43 if (this.stats.remainingMilliSeconds <= 0) { 41 if (this.stats.remainingMilliSeconds <= 0) {
44 setTimeout(() => this.getStats(), this.stats.remainingMilliSeconds + 100); 42 setTimeout(() => this.getStats(), this.stats.remainingMilliSeconds + 100);
45 clearInterval(this.interval);
46 } 43 }
47 }, 1000); 44 }, 1000);
48 } 45 }
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 {
4} 4}
5 5
6export class RequestStats { 6export class RequestStats {
7 maxRequestsInParallel: number; 7 requestsLimitPods: number;
8 requestsLimitPerPod: number;
8 milliSecondsInterval: number; 9 milliSecondsInterval: number;
9 remainingMilliSeconds: number; 10 remainingMilliSeconds: number;
10 totalRequests: number; 11 totalRequests: number;
11 12
12 constructor(hash: { 13 constructor(hash: {
13 maxRequestsInParallel: number, 14 requestsLimitPods: number,
15 requestsLimitPerPod: number,
14 milliSecondsInterval: number, 16 milliSecondsInterval: number,
15 remainingMilliSeconds: number, 17 remainingMilliSeconds: number,
16 totalRequests: number; 18 totalRequests: number;
17 }) { 19 }) {
18 this.maxRequestsInParallel = hash.maxRequestsInParallel; 20 this.requestsLimitPods = hash.requestsLimitPods;
21 this.requestsLimitPerPod = hash.requestsLimitPerPod;
19 this.milliSecondsInterval = hash.milliSecondsInterval; 22 this.milliSecondsInterval = hash.milliSecondsInterval;
20 this.remainingMilliSeconds = hash.remainingMilliSeconds; 23 this.remainingMilliSeconds = hash.remainingMilliSeconds;
21 this.totalRequests = hash.totalRequests; 24 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) {
28 28
29 return res.json({ 29 return res.json({
30 totalRequests: totalRequests, 30 totalRequests: totalRequests,
31 maxRequestsInParallel: constants.REQUESTS_IN_PARALLEL, 31 requestsLimitPods: constants.REQUESTS_LIMIT_PODS,
32 requestsLimitPerPod: constants.REQUESTS_LIMIT_PER_POD,
32 remainingMilliSeconds: db.Request.remainingMilliSeconds(), 33 remainingMilliSeconds: db.Request.remainingMilliSeconds(),
33 milliSecondsInterval: constants.REQUESTS_INTERVAL 34 milliSecondsInterval: constants.REQUESTS_INTERVAL
34 }) 35 })