[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: Add a build restart button.
From: |
Mathieu Othacehe |
Subject: |
branch master updated: Add a build restart button. |
Date: |
Thu, 18 Feb 2021 08:55:17 -0500 |
This is an automated email from the git hooks/post-receive script.
mothacehe pushed a commit to branch master
in repository guix-cuirass.
The following commit(s) were added to refs/heads/master by this push:
new 4e0152f Add a build restart button.
4e0152f is described below
commit 4e0152f7a45b353a5936aa6b42f115306ebde011
Author: Mathieu Othacehe <othacehe@gnu.org>
AuthorDate: Thu Feb 18 14:53:52 2021 +0100
Add a build restart button.
* src/cuirass/http.scm (url-handler): New route "/admin/build/<id>/restart".
* src/cuirass/template.scm (build-details): Add a "restart" button.
---
src/cuirass/http.scm | 8 ++++++++
src/cuirass/templates.scm | 17 ++++++++++++++++-
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/src/cuirass/http.scm b/src/cuirass/http.scm
index f80311f..afd5410 100644
--- a/src/cuirass/http.scm
+++ b/src/cuirass/http.scm
@@ -483,6 +483,14 @@ Hydra format."
"Cuirass [Admin]"
(specifications-table (db-get-specifications) 'admin)
'())))
+ (('GET "admin" "build" id "restart")
+ (db-restart-build! (string->number id))
+ (respond
+ (build-response
+ #:code 302
+ #:headers `((location . ,(string->uri-reference
+ (string-append "/build/" id "/details")))))
+ #:body ""))
(('GET "admin")
(respond-html (html-page
"Cuirass [Admin]"
diff --git a/src/cuirass/templates.scm b/src/cuirass/templates.scm
index 29d9bae..1ff0689 100644
--- a/src/cuirass/templates.scm
+++ b/src/cuirass/templates.scm
@@ -292,7 +292,22 @@ system whose names start with " (code "guile-") ":" (br)
(td ,(assq-ref build #:nix-name))
(td ,(time->string (assq-ref build #:stoptime)))))
- `((p (@ (class "lead")) "Build details")
+ `((p (@ (class "lead")) "Build details"
+ ,@(if (>= status 0)
+ `((div (@ (class "dropdown float-right"))
+ (a (@ (class "btn btn-warning dropdown-toggle")
+ (href "#")
+ (data-toggle "dropdown")
+ (role "button")
+ (aria-haspopup "true")
+ (aria-expanded "false"))
+ "Action")
+ (div (@ (class "dropdown-menu"))
+ (a (@ (class "dropdown-item")
+ (href "/admin/build/"
+ ,(assq-ref build #:id) "/restart"))
+ "Restart"))))
+ '()))
(table
(@ (class "table table-sm table-hover"))
(tbody
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: Add a build restart button.,
Mathieu Othacehe <=