From 4aff44c42e863adc6165b93269a6aa6bd3c549de Mon Sep 17 00:00:00 2001 From: Louis Garman <75728+leg100@users.noreply.github.com> Date: Wed, 26 Apr 2023 19:40:17 +0100 Subject: [PATCH] feat: queue destroy plan in UI (#410) --- auth/team_web_test.go | 6 +- http/html/static/css/main.css | 3 + .../templates/content/workspace_edit.tmpl | 7 ++ http/html/test_helpers.go | 15 --- integration/connect_repo_e2e_test.go | 7 +- integration/github_pr_test.go | 7 +- integration/module_e2e_test.go | 5 +- integration/start_run_ui_test.go | 68 ++++++++--- integration/test_helpers.go | 8 -- integration/ui_actions.go | 4 +- integration/webhook_test.go | 3 +- organization/web_test.go | 3 +- run/starter.go | 52 ++++++-- run/starter_test.go | 4 +- run/test_helpers.go | 75 ++++++++++++ run/web.go | 20 +--- run/web_test.go | 112 ++---------------- testutils/html.go | 15 ++- workspace/web.go | 2 + 19 files changed, 226 insertions(+), 190 deletions(-) delete mode 100644 http/html/test_helpers.go diff --git a/auth/team_web_test.go b/auth/team_web_test.go index e8d57010d..2581c5157 100644 --- a/auth/team_web_test.go +++ b/auth/team_web_test.go @@ -7,8 +7,8 @@ import ( "github.com/google/uuid" "github.com/leg100/otf" - "github.com/leg100/otf/http/html" "github.com/leg100/otf/http/html/paths" + "github.com/leg100/otf/testutils" "github.com/stretchr/testify/assert" ) @@ -64,7 +64,7 @@ func TestTeam_WebHandlers(t *testing.T) { r := httptest.NewRequest("GET", q, nil) w := httptest.NewRecorder() app.updateTeam(w, r) - html.AssertRedirect(t, w, paths.Team(team.ID)) + testutils.AssertRedirect(t, w, paths.Team(team.ID)) }) t.Run("list", func(t *testing.T) { @@ -89,7 +89,7 @@ func TestTeam_WebHandlers(t *testing.T) { r := httptest.NewRequest("POST", q, nil) w := httptest.NewRecorder() app.deleteTeam(w, r) - html.AssertRedirect(t, w, paths.Teams("acme-org")) + testutils.AssertRedirect(t, w, paths.Teams("acme-org")) }) } diff --git a/http/html/static/css/main.css b/http/html/static/css/main.css index 299b5362b..1e43e26c5 100644 --- a/http/html/static/css/main.css +++ b/http/html/static/css/main.css @@ -331,6 +331,9 @@ a.show-underline { display: flex; flex-direction: column; gap: 1em; + /* Add some white space between bottom of content and footer otherwise it + * looks wierd */ + margin-bottom: 5em; } /* center content e.g. the login prompt */ diff --git a/http/html/static/templates/content/workspace_edit.tmpl b/http/html/static/templates/content/workspace_edit.tmpl index ddd3ee9da..715f9c10f 100644 --- a/http/html/static/templates/content/workspace_edit.tmpl +++ b/http/html/static/templates/content/workspace_edit.tmpl @@ -17,6 +17,7 @@ {{ $canDelete := $.CurrentUser.CanAccessWorkspace .DeleteWorkspaceAction .Policy }} {{ $canSetPermission := $.CurrentUser.CanAccessWorkspace .SetWorkspacePermissionAction .Policy }} {{ $canUnsetPermission := $.CurrentUser.CanAccessWorkspace .UnsetWorkspacePermissionAction .Policy }} + {{ $canCreateRun := $.CurrentUser.CanAccessWorkspace .CreateRunAction .Policy }}
{{ with .Workspace.Connection }}
@@ -139,6 +140,12 @@

Advanced

+ + + +