From 372d47b32690a90276814e8fc4101f5fc5744586 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Wed, 19 Jun 2019 09:38:08 +0200 Subject: cuirass: Display builds in separate tabs. * src/cuirass/http.scm (url-handler): Split result for "eval" page in tabs. * src/cuirass/templates.scm (build-eval-table): Remove border from table head; Remove lead paragraph. --- src/cuirass/http.scm | 111 +++++++++++++++++++++++++++++++++++++++------- src/cuirass/templates.scm | 25 +++++------ 2 files changed, 106 insertions(+), 30 deletions(-) diff --git a/src/cuirass/http.scm b/src/cuirass/http.scm index dd9f3bf..00fd75f 100644 --- a/src/cuirass/http.scm +++ b/src/cuirass/http.scm @@ -198,7 +198,7 @@ Hydra format." (not (file-is-directory? file-path))) (respond `((content-type . ,(assoc-ref %file-mime-types (file-extension file-path)))) - #:body (call-with-input-file file-path get-bytevector-all)) + #:body (call-with-input-file file-path get-bytevector-all)) (respond-not-found file-name)))) (define (respond-build-not-found build-id) @@ -338,20 +338,101 @@ Hydra format." (respond-html (html-page "Evaluation" - (build-eval-table - id - (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))) - builds-id-min - builds-id-max - status) + `((p (@ (class "lead")) + ,(format #f "~@[~a~] ~:[B~;b~]uilds of evaluation #~a" + (and=> status string-capitalize) + status + id)) + (ul (@ (class "nav nav-tabs")) + (li (@ (class "nav-item")) + (a (@ (class ,(string-append "nav-link " + (match status + (#f "active") + (_ "")))) + (href "?all=")) + "All")) + (li (@ (class "nav-item")) + (a (@ (class ,(string-append "nav-link " + (match status + ("scheduled" "active") + (_ "")))) + (href "?status=scheduled")) + (span (@ (class "oi oi-clock text-warning") + (title "Scheduled") + (aria-hidden "true")) + "") + " Scheduled")) + (li (@ (class "nav-item")) + (a (@ (class ,(string-append "nav-link " + (match status + ("succeeded" "active") + (_ "")))) + (href "?status=succeeded")) + (span (@ (class "oi oi-check text-success") + (title "Succeeded") + (aria-hidden "true")) + "") + " Succeeded")) + (li (@ (class "nav-item")) + (a (@ (class ,(string-append "nav-link " + (match status + ("failed" "active") + (_ "")))) + (href "?status=failed")) + (span (@ (class "oi oi-x text-danger") + (title "Failed") + (aria-hidden "true")) + "") + " Failed")) + (li (@ (class "nav-item")) + (a (@ (class ,(string-append "nav-link " + (match status + ("failed-dependency" "active") + (_ "")))) + (href "?status=failed-dependency")) + (span (@ (class "oi oi-warning text-danger") + (title "Dependency failed") + (aria-hidden "true")) + "") + " Dependency failed")) + (li (@ (class "nav-item")) + (a (@ (class ,(string-append "nav-link " + (match status + ("failed-other" "active") + (_ "")))) + (href "?status=failed-other")) + (span (@ (class "oi oi-x text-danger") + (title "Failed") + (aria-hidden "true")) + "") + " Other failed")) + (li (@ (class "nav-item")) + (a (@ (class ,(string-append "nav-link " + (match status + ("canceled" "active") + (_ "")))) + (href "?status=canceled")) + (span (@ (class "oi oi-question-mark text-warning") + (title "Canceled") + (aria-hidden "true")) + "") + " Canceled"))) + (div (@ (class "tab-content pt-3")) + (div (@ (class "tab-pane show active")) + ,(build-eval-table + id + (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))) + builds-id-min + builds-id-max + status)))) `(((#:name . ,specification) (#:link . ,(string-append "/jobset/" specification))) ((#:name . ,(string-append "Evaluation " id)) diff --git a/src/cuirass/templates.scm b/src/cuirass/templates.scm index 8c71e18..989cbf9 100644 --- a/src/cuirass/templates.scm +++ b/src/cuirass/templates.scm @@ -317,14 +317,14 @@ and BUILD-MAX are global minimal and maximal (stoptime, rowid) pairs." (define (table-header) `(thead (tr - (th (@ (scope "col")) '()) - (th (@ (scope "col")) "ID") - (th (@ (scope "col")) "Specification") - (th (@ (scope "col")) "Completion time") - (th (@ (scope "col")) "Job") - (th (@ (scope "col")) "Name") - (th (@ (scope "col")) "System") - (th (@ (scope "col")) "Log")))) + (th (@ (scope "col") (class "border-0")) '()) + (th (@ (scope "col") (class "border-0")) "ID") + (th (@ (scope "col") (class "border-0")) "Specification") + (th (@ (scope "col") (class "border-0")) "Completion time") + (th (@ (scope "col") (class "border-0")) "Job") + (th (@ (scope "col") (class "border-0")) "Name") + (th (@ (scope "col") (class "border-0")) "System") + (th (@ (scope "col") (class "border-0")) "Log")))) (define (table-row build) (define status @@ -384,15 +384,10 @@ and BUILD-MAX are global minimal and maximal (stoptime, rowid) pairs." (match build ((stoptime id) stoptime))) - `((p (@ (class "lead")) - ,(format #f "~@[~a~] ~:[B~;b~]uilds of evaluation #~a" - (and=> status string-capitalize) - status - eval-id)) - (table + `((table (@ (class "table table-sm table-hover table-striped")) ,@(if (null? builds) - `((th (@ (scope "col")) "No elements here.")) + `((th (@ (scope "col") (class "border-0")) "No elements here.")) `(,(table-header) (tbody ,@(map table-row builds))))) ,(if (null? builds) -- cgit v1.2.3