Add "latest builds" support.
Add a "status" dropdown menu in the navigation bar. For now this menu only contains one item, a link to the "latest builds" page at "/status" location. * src/cuirass/database.scm (db-get-builds): Add support for 'started status. * src/cuirass/http.scm (url-handler): Add "/status" route. * src/cuirass/templates.scm (running-builds-table): New procedure, (html-page): add a dropdown menu containing one item, a link to "/status" route defined above. * src/static/css/cuirass.css: Add new class to allow bootstrap dropdown menus to work without javascript plugin.
This commit is contained in:
parent
882393dee0
commit
136a8295e4
|
@ -770,6 +770,7 @@ FILTERS is an assoc list whose possible keys are 'derivation | 'id | 'jobset |
|
|||
(status . ,(match (assq-ref filters 'status)
|
||||
(#f #f)
|
||||
('done "Builds.status >= 0")
|
||||
('started "Builds.status = -1")
|
||||
('pending "Builds.status < 0")
|
||||
('succeeded "Builds.status = 0")
|
||||
('failed "Builds.status > 0")))
|
||||
|
|
|
@ -570,6 +570,15 @@ Hydra format."
|
|||
(respond-json-with-error 500 "No build found.")))
|
||||
(respond-json-with-error 500 "Query parameter not provided."))))
|
||||
|
||||
(('GET "status")
|
||||
(respond-html
|
||||
(html-page
|
||||
"Running builds"
|
||||
(running-builds-table
|
||||
(db-get-builds `((status . started)
|
||||
(order . status+submission-time))))
|
||||
'())))
|
||||
|
||||
(('GET "download" id)
|
||||
(let ((path (db-get-build-product-path id)))
|
||||
(respond-file path)))
|
||||
|
|
|
@ -38,7 +38,8 @@
|
|||
build-eval-table
|
||||
build-search-results-table
|
||||
build-details
|
||||
evaluation-build-table))
|
||||
evaluation-build-table
|
||||
running-builds-table))
|
||||
|
||||
(define (navigation-items navigation)
|
||||
(match navigation
|
||||
|
@ -112,15 +113,28 @@ system whose names start with " (code "guile-") ":" (br)
|
|||
(href "/static/css/cuirass.css")))
|
||||
(title ,title))
|
||||
(body
|
||||
(nav (@ (class "navbar navbar-expand navbar-light bg-light"))
|
||||
(nav (@ (class "navbar navbar-expand-lg navbar-light bg-light"))
|
||||
(a (@ (class "navbar-brand pt-0")
|
||||
(href "/"))
|
||||
(img (@ (src "/static/images/logo.png")
|
||||
(alt "logo")
|
||||
(height "25")
|
||||
(style "margin-top: -12px"))))
|
||||
(div (@ (class "navbar-collapse"))
|
||||
(ul (@ (class "navbar-nav"))
|
||||
(div (@ (class "collapse navbar-collapse"))
|
||||
(ul (@ (class "navbar-nav mr-auto"))
|
||||
(li (@ (class "nav-item dropdown"))
|
||||
(a (@ (class "nav-link dropdown-toggle")
|
||||
(data-toggle "dropdown")
|
||||
(href "#")
|
||||
(role "button")
|
||||
(aria-haspopup "true")
|
||||
(aria-expanded "false"))
|
||||
"Status")
|
||||
(div (@ (class "dropdown-menu")
|
||||
(aria-labelledby "navbarDropdow"))
|
||||
(a (@ (class "dropdown-item")
|
||||
(href "/status"))
|
||||
"Latest builds")))
|
||||
(li (@ (class "nav-item"))
|
||||
(a (@ (class "nav-link" ,(if (null? navigation)
|
||||
" active" ""))
|
||||
|
@ -748,3 +762,27 @@ and BUILD-MAX are global minimal and maximal row identifiers."
|
|||
#f "?query=~a&border-low-id=~d"
|
||||
query
|
||||
(1- (first build-min))))))))
|
||||
|
||||
(define (running-builds-table builds)
|
||||
"Return HTML for the running builds table."
|
||||
(define (build-row build)
|
||||
`(tr
|
||||
(th (@ (scope "row"))
|
||||
(a (@ (href "/build/" ,(assq-ref build #:id) "/details"))
|
||||
,(assq-ref build #:id)))
|
||||
(td ,(assq-ref build #:job-name))
|
||||
(td ,(time->string
|
||||
(assq-ref build #:starttime)))
|
||||
(td ,(assq-ref build #:system))))
|
||||
|
||||
`((p (@ (class "lead")) "Running builds")
|
||||
(table
|
||||
(@ (class "table table-sm table-hover table-striped"))
|
||||
,@(if (null? builds)
|
||||
`((th (@ (scope "col")) "No elements here."))
|
||||
`((thead (tr (th (@ (scope "col")) "ID")
|
||||
(th (@ (scope "col")) "Job")
|
||||
(th (@ (scope "col")) "Queued at")
|
||||
(th (@ (scope "col")) "System")))
|
||||
(tbody
|
||||
,(map build-row builds)))))))
|
||||
|
|
|
@ -15,3 +15,25 @@
|
|||
#search:focus-within #search-hints {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/*
|
||||
This is taken from: https://gist.github.com/YushengLi/824d3317f36c31f3d3e9 to
|
||||
allow bootstrap dropdown menus to work without the associated javascript
|
||||
plugin.
|
||||
*/
|
||||
a.dropdown-toggle:focus {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
a.dropdown-toggle:focus + .dropdown-menu {
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
.dropdown-menu {
|
||||
opacity: 0;
|
||||
display: block;
|
||||
visibility: hidden;
|
||||
transition: visibility 0.5s;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue