From c8a1d1e1f698fe8b18cf10cb68bd11086c47be23 Mon Sep 17 00:00:00 2001 From: ecrupper Date: Mon, 8 May 2023 16:54:16 -0500 Subject: [PATCH 1/2] enhance(build): add cancel button for pending builds --- docker-compose.yml | 3 +++ src/elm/Nav.elm | 14 +++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 61c19119b..efeb250b7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -50,7 +50,9 @@ services: VELA_ADDR: 'http://localhost:8080' VELA_WEBUI_ADDR: 'http://localhost:8888' VELA_LOG_LEVEL: trace + # comment the line below to use registration flow VELA_SECRET: 'zB7mrKDTZqNeNTD8z47yG4DHywspAh' + VELA_SERVER_PRIVATE_KEY: 'F534FF2A080E45F38E05DC70752E6787' VELA_REFRESH_TOKEN_DURATION: 90m VELA_ACCESS_TOKEN_DURATION: 60m VELA_DISABLE_WEBHOOK_VALIDATION: 'true' @@ -87,6 +89,7 @@ services: VELA_RUNTIME_DRIVER: docker VELA_RUNTIME_PRIVILEGED_IMAGES: 'target/vela-docker' VELA_SERVER_ADDR: 'http://server:8080' + # comment the line below to use registration flow VELA_SERVER_SECRET: 'zB7mrKDTZqNeNTD8z47yG4DHywspAh' WORKER_ADDR: 'http://worker:8080' WORKER_CHECK_IN: 5m diff --git a/src/elm/Nav.elm b/src/elm/Nav.elm index c0571af5d..414e29319 100644 --- a/src/elm/Nav.elm +++ b/src/elm/Nav.elm @@ -374,12 +374,11 @@ viewBuildTabs model org repo buildNumber currentPage = {-| cancelBuildButton : takes org repo and build number and renders button to cancel a build -} cancelBuildButton : Org -> Repo -> WebData Build -> (Org -> Repo -> BuildNumber -> msg) -> Html msg -cancelBuildButton org repo build cancelBuild = +cancelBuildButton org repo build cancelBuild = case build of RemoteData.Success b -> - case b.status of - Vela.Running -> - button + let + cancelButton = button [ classList [ ( "button", True ) , ( "-outline", True ) @@ -389,7 +388,12 @@ cancelBuildButton org repo build cancelBuild = ] [ text "Cancel Build" ] - + in + case b.status of + Vela.Running -> + cancelButton + Vela.Pending -> + cancelButton _ -> text "" From 286a3d50d9cd11f773ed4e3d531bc252c090bb05 Mon Sep 17 00:00:00 2001 From: ecrupper Date: Mon, 8 May 2023 16:56:24 -0500 Subject: [PATCH 2/2] format --- src/elm/Nav.elm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/elm/Nav.elm b/src/elm/Nav.elm index 414e29319..9ab92598f 100644 --- a/src/elm/Nav.elm +++ b/src/elm/Nav.elm @@ -374,11 +374,12 @@ viewBuildTabs model org repo buildNumber currentPage = {-| cancelBuildButton : takes org repo and build number and renders button to cancel a build -} cancelBuildButton : Org -> Repo -> WebData Build -> (Org -> Repo -> BuildNumber -> msg) -> Html msg -cancelBuildButton org repo build cancelBuild = +cancelBuildButton org repo build cancelBuild = case build of RemoteData.Success b -> let - cancelButton = button + cancelButton = + button [ classList [ ( "button", True ) , ( "-outline", True ) @@ -392,8 +393,10 @@ cancelBuildButton org repo build cancelBuild = case b.status of Vela.Running -> cancelButton + Vela.Pending -> cancelButton + _ -> text ""