mirror of
git://git.savannah.gnu.org/guix/guix-cuirass.git
synced 2023-12-14 06:03:04 +01:00
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)
|
(status . ,(match (assq-ref filters 'status)
|
||||||
(#f #f)
|
(#f #f)
|
||||||
('done "Builds.status >= 0")
|
('done "Builds.status >= 0")
|
||||||
|
('started "Builds.status = -1")
|
||||||
('pending "Builds.status < 0")
|
('pending "Builds.status < 0")
|
||||||
('succeeded "Builds.status = 0")
|
('succeeded "Builds.status = 0")
|
||||||
('failed "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 "No build found.")))
|
||||||
(respond-json-with-error 500 "Query parameter not provided."))))
|
(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)
|
(('GET "download" id)
|
||||||
(let ((path (db-get-build-product-path id)))
|
(let ((path (db-get-build-product-path id)))
|
||||||
(respond-file path)))
|
(respond-file path)))
|
||||||
|
|
|
@ -38,7 +38,8 @@
|
||||||
build-eval-table
|
build-eval-table
|
||||||
build-search-results-table
|
build-search-results-table
|
||||||
build-details
|
build-details
|
||||||
evaluation-build-table))
|
evaluation-build-table
|
||||||
|
running-builds-table))
|
||||||
|
|
||||||
(define (navigation-items navigation)
|
(define (navigation-items navigation)
|
||||||
(match navigation
|
(match navigation
|
||||||
|
@ -112,15 +113,28 @@ system whose names start with " (code "guile-") ":" (br)
|
||||||
(href "/static/css/cuirass.css")))
|
(href "/static/css/cuirass.css")))
|
||||||
(title ,title))
|
(title ,title))
|
||||||
(body
|
(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")
|
(a (@ (class "navbar-brand pt-0")
|
||||||
(href "/"))
|
(href "/"))
|
||||||
(img (@ (src "/static/images/logo.png")
|
(img (@ (src "/static/images/logo.png")
|
||||||
(alt "logo")
|
(alt "logo")
|
||||||
(height "25")
|
(height "25")
|
||||||
(style "margin-top: -12px"))))
|
(style "margin-top: -12px"))))
|
||||||
(div (@ (class "navbar-collapse"))
|
(div (@ (class "collapse navbar-collapse"))
|
||||||
(ul (@ (class "navbar-nav"))
|
(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"))
|
(li (@ (class "nav-item"))
|
||||||
(a (@ (class "nav-link" ,(if (null? navigation)
|
(a (@ (class "nav-link" ,(if (null? navigation)
|
||||||
" active" ""))
|
" active" ""))
|
||||||
|
@ -748,3 +762,27 @@ and BUILD-MAX are global minimal and maximal row identifiers."
|
||||||
#f "?query=~a&border-low-id=~d"
|
#f "?query=~a&border-low-id=~d"
|
||||||
query
|
query
|
||||||
(1- (first build-min))))))))
|
(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 {
|
#search:focus-within #search-hints {
|
||||||
display: block;
|
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 a new issue