[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Ludovic Courtès |
Date: |
Sun, 29 Oct 2023 16:06:19 -0400 (EDT) |
branch: master
commit 299e95a7b60a119902c6e7cc6b13e4902c0de3af
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Sun Oct 29 17:34:10 2023 +0100
templates: Factorize the success rate bar.
* src/cuirass/templates.scm (success-rate-bar): New procedure.
(specifications-table): Use it.
---
src/cuirass/templates.scm | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/src/cuirass/templates.scm b/src/cuirass/templates.scm
index cca2b05..dedb801 100644
--- a/src/cuirass/templates.scm
+++ b/src/cuirass/templates.scm
@@ -265,6 +265,20 @@ system whose names start with " (code "guile-") ":" (br)
(else
"Invalid status")))
+(define (success-rate-bar percentage)
+ "Return HTML for a progress bar representing a success rate of PERCENTAGE."
+ (let ((style (format #f "width: ~a%" percentage)))
+ `(div (@ (class "progress job-abs")
+ (title "Success rate"))
+ (div (@ (class "progress-bar")
+ (role "progressbar")
+ (style ,style)
+ (aria-valuemin "0")
+ (aria-valuemax "100"))
+ (strong
+ (span (@ (class "text-dark"))
+ ,percentage "%"))))))
+
(define (specifications-table specs evaluations summaries latest-evaluations)
"Return HTML for the SPECS table."
(define (spec->latest-eval-ok name)
@@ -382,24 +396,10 @@ system whose names start with " (code "guile-") ":" (br)
(<= (evaluation-current-status last-eval)
(evaluation-status succeeded))))
(percentage
- (and summary (summary->percentage summary)))
- (style
- (format #f "width: ~a%" percentage)))
+ (and summary (summary->percentage summary))))
(cond
((and summary last-eval-status-ok?)
- `((div
- (@ (class "progress job-abs")
- (title "Percentage succeeded"))
- (div (@ (class "progress-bar")
- (role "progressbar")
- (style ,style)
- (aria-valuemin "0")
- (aria-valuemax "100"))
- (strong
- (span
- (@ (class "text-dark"))
- ,percentage
- "%"))))
+ `(,(success-rate-bar percentage)
" "
(div
(@ (class "job-rel d-none"))