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.
This commit is contained in:
Ricardo Wurmus 2019-06-19 09:38:08 +02:00
parent 11f888abb8
commit 372d47b326
No known key found for this signature in database
GPG Key ID: 197A5888235FACAC
2 changed files with 106 additions and 30 deletions

View File

@ -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))

View File

@ -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)