2
0
Fork 0
mirror of git://git.savannah.gnu.org/guix/guix-cuirass.git synced 2023-12-14 06:03:04 +01:00

Remove admin section.

* src/cuirass/http.scm (url-handler): Remove admin section.
* src/cuirass/templates.scm (specifications-table): Remove optional admin
argument.
This commit is contained in:
Mathieu Othacehe 2021-03-09 21:21:19 +01:00
parent 88f3cf65e0
commit 2841bf3ba0
No known key found for this signature in database
GPG key ID: 8354763531769CA6
2 changed files with 19 additions and 56 deletions

View file

@ -476,18 +476,13 @@ Hydra format."
`((location . ,(string->uri-reference
"/admin/specifications"))))
#:body ""))))
(('POST "admin" "specifications" "delete" name)
(('GET "admin" "specifications" "delete" name)
(db-remove-specification name)
(respond (build-response #:code 302
#:headers
`((location . ,(string->uri-reference
"/admin/specifications"))))
#:body ""))
(('GET "admin" "specifications" . rest)
(respond-html (html-page
"Cuirass [Admin]"
(specifications-table (db-get-specifications) 'admin)
'())))
(('GET "admin" "build" id "restart")
(db-restart-build! (string->number id))
(respond
@ -533,12 +528,6 @@ Hydra format."
(string-append "/jobset/" specification)))))
#:body "")))
(('GET "admin")
(respond-html (html-page
"Cuirass [Admin]"
`(ul (li (a (@ (href "/admin/specifications"))
"Edit specifications")))
'())))
(('GET (or "jobsets" "specifications") . rest)
(respond-json (object->json-string
(list->vector

View file

@ -204,7 +204,7 @@ system whose names start with " (code "guile-") ":" (br)
(else
"Invalid status")))
(define* (specifications-table specs #:optional admin?)
(define (specifications-table specs)
"Return HTML for the SPECS table."
`((p (@ (class "lead")) "Specifications"
(a (@ (href "/events/rss/"))
@ -220,9 +220,7 @@ system whose names start with " (code "guile-") ":" (br)
`((th (@ (scope "col")) "No elements here."))
`((thead (tr (th (@ (scope "col")) Name)
(th (@ (scope "col")) Channels)
,@(if admin?
'((th (@ (scope "col")) Action))
'())))
(th (@ (scope "col")) Action)))
(tbody
,@(map
(lambda (spec)
@ -235,46 +233,22 @@ system whose names start with " (code "guile-") ":" (br)
(channel-name channel)
(channel-branch channel)))
(specification-channels spec)) ", "))
,@(if admin?
`((form
(@ (class "form")
(action
,(string-append
"/admin/specifications/delete/"
(specification-name spec)))
(method "POST")
(onsubmit
,(string-append
"return confirm('Please confirm deletion of specification "
(specification-name spec) ".');")))
`((div
(@ (class "input-group"))
(span
(@ (class "input-group-append"))
(button
(@ (type "submit")
(class "btn"))
"Remove"))))))
'())))
specs))))
,@(if admin?
`((form (@ (id "add-specification")
(class "form")
(action "/admin/specifications/add/")
(method "POST"))
(div
(@ (class "input-group"))
(input (@ (type "text")
(class "form-control")
(id "spec-name")
(name "spec-name")
(placeholder "specification / branch name")))
(span (@ (class "input-group-append"))
(button
(@ (type "submit")
(class "btn btn-primary"))
"Add")))))
'()))))
(td
(div
(@ (class "dropdown"))
(a (@ (class "oi oi-menu dropdown-toggle no-dropdown-arrow")
(href "#")
(data-toggle "dropdown")
(role "button")
(aria-haspopup "true")
(aria-expanded "false"))
" ")
(div (@ (class "dropdown-menu"))
(a (@ (class "oi oi-lock-locked dropdown-item")
(href "/admin/specifications/delete/"
,(specification-name spec)))
" Delete"))))))
specs)))))))
(define (build-details build products history)
"Return HTML showing details for the BUILD."