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

View file

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