[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: Add pagination button on evaluation page.
From: |
Mathieu Othacehe |
Subject: |
branch master updated: Add pagination button on evaluation page. |
Date: |
Thu, 25 Mar 2021 06:49:02 -0400 |
This is an automated email from the git hooks/post-receive script.
mothacehe pushed a commit to branch master
in repository guix-cuirass.
The following commit(s) were added to refs/heads/master by this push:
new c3a9e9c Add pagination button on evaluation page.
c3a9e9c is described below
commit c3a9e9c79f09521b324179d3d5aad3e67066f114
Author: Mathieu Othacehe <othacehe@gnu.org>
AuthorDate: Thu Mar 25 11:48:42 2021 +0100
Add pagination button on evaluation page.
---
src/cuirass/http.scm | 18 ++++++++++++------
src/cuirass/templates.scm | 27 +++++++++++++++++++++++++--
2 files changed, 37 insertions(+), 8 deletions(-)
diff --git a/src/cuirass/http.scm b/src/cuirass/http.scm
index 739eca2..2a5df10 100644
--- a/src/cuirass/http.scm
+++ b/src/cuirass/http.scm
@@ -220,6 +220,7 @@ Hydra format."
(define* (evaluation-html-page evaluation
#:key
status
+ (paginate? #t)
border-high-time border-low-time
border-high-id border-low-id)
"Return the HTML page representing EVALUATION."
@@ -236,12 +237,14 @@ Hydra format."
(handle-builds-request
`((evaluation . ,id)
(status . ,(and=> status string->symbol))
- (nr . ,%page-size)
- (order . finish-time+build-id)
- (border-high-time . ,border-high-time)
- (border-low-time . ,border-low-time)
- (border-high-id . ,border-high-id)
- (border-low-id . ,border-low-id)))))
+ ,@(if paginate?
+ `((nr . ,%page-size)
+ (border-high-time . ,border-high-time)
+ (border-low-time . ,border-low-time)
+ (border-high-id . ,border-high-id)
+ (border-low-id . ,border-low-id))
+ '())
+ (order . finish-time+build-id)))))
(html-page
"Evaluation"
@@ -760,6 +763,8 @@ into a specification record and return it."
(('GET "eval" id)
(let* ((params (request-parameters request))
(status (assq-ref params 'status))
+ (paginate? (let ((arg (assq-ref params 'paginate)))
+ (if arg (string=? arg "1") #t)))
(border-high-time (assq-ref params 'border-high-time))
(border-low-time (assq-ref params 'border-low-time))
(border-high-id (assq-ref params 'border-high-id))
@@ -769,6 +774,7 @@ into a specification record and return it."
(if specification
(respond-html (evaluation-html-page evaluation
#:status status
+ #:paginate? paginate?
#:border-high-time
border-high-time
#:border-low-time
diff --git a/src/cuirass/templates.scm b/src/cuirass/templates.scm
index 9733c72..997a53c 100644
--- a/src/cuirass/templates.scm
+++ b/src/cuirass/templates.scm
@@ -1087,7 +1087,24 @@ evaluation."
(define duration (- evaltime timestamp))
- `((p (@ (class "lead"))
+ `((script "
+$(document).ready(function() {
+ var url = new URL(window.location.href);
+ var params = url.searchParams;
+ var paginate = params.get('paginate');
+ var href;
+ console.log(paginate);
+ if (!paginate || paginate == '1') {
+ params.set('paginate', 0);
+ $('#paginate').attr('href', url.toString());
+ } else if (paginate == '0') {
+ params.set('paginate', 1);
+ $('#paginate').attr('class', 'oi oi-collapse-up');
+ $('#paginate').attr('href', url.toString());
+ }
+});
+")
+ (p (@ (class "lead"))
,(format #f "Evaluation #~a" id))
,@(if (= timestamp 0)
'()
@@ -1122,7 +1139,13 @@ evaluation."
,(format #f "~@[~a~] ~:[B~;b~]uilds of evaluation #~a"
(and=> status string-capitalize)
status
- id))
+ id)
+ " "
+ (a (@ (id "paginate")
+ (class "oi oi-collapse-down")
+ (style "font-size:0.7em")
+ (href "")
+ (role "button"))))
(ul (@ (class "nav nav-tabs"))
(li (@ (class "nav-item"))
(a (@ (class ,(string-append "nav-link "
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: Add pagination button on evaluation page.,
Mathieu Othacehe <=