[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Mathieu Othacehe |
Date: |
Thu, 11 Mar 2021 04:27:28 -0500 (EST) |
branch: master
commit 2841bf3ba016d521ca11c44ff787f9e3da30fedc
Author: Mathieu Othacehe <othacehe@gnu.org>
AuthorDate: Tue Mar 9 21:21:19 2021 +0100
Remove admin section.
* src/cuirass/http.scm (url-handler): Remove admin section.
* src/cuirass/templates.scm (specifications-table): Remove optional admin
argument.
---
src/cuirass/http.scm | 13 +---------
src/cuirass/templates.scm | 62 ++++++++++++++---------------------------------
2 files changed, 19 insertions(+), 56 deletions(-)
diff --git a/src/cuirass/http.scm b/src/cuirass/http.scm
index 2e28e79..07f92ad 100644
--- a/src/cuirass/http.scm
+++ b/src/cuirass/http.scm
@@ -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
diff --git a/src/cuirass/templates.scm b/src/cuirass/templates.scm
index 5918bcc..32448cd 100644
--- a/src/cuirass/templates.scm
+++ b/src/cuirass/templates.scm
@@ -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."