From eee7fab68219af2c969d23d0a8d7b88063544f55 Mon Sep 17 00:00:00 2001 From: John <51100181+jwmza@users.noreply.github.com> Date: Fri, 15 Oct 2021 14:35:49 -0400 Subject: [PATCH 01/11] Improve styling and layout in Add Vault page --- gui/src/components/Icon.svelte | 4 ++++ gui/src/components/icon/glyphs/Add.svelte | 3 +-- gui/src/components/icon/glyphs/Lock.svelte | 12 ++++++++++++ gui/src/pages/WorkspaceAddVault.svelte | 11 +++++++---- 4 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 gui/src/components/icon/glyphs/Lock.svelte diff --git a/gui/src/components/Icon.svelte b/gui/src/components/Icon.svelte index ae35130a2..b796dddea 100644 --- a/gui/src/components/Icon.svelte +++ b/gui/src/components/Icon.svelte @@ -16,6 +16,7 @@ | 'Home' | 'Layers' | 'LeftUp' + | 'Lock' | 'LogoDeno' | 'LogoDiscord' | 'LogoDjango' @@ -60,6 +61,7 @@ import HomeGlyph from './icon/glyphs/Home.svelte'; import LayersGlyph from './icon/glyphs/Layers.svelte'; import LeftUpGlyph from './icon/glyphs/LeftUp.svelte'; + import LockGlyph from './icon/glyphs/Lock.svelte'; import LogoDenoGlyph from './icon/glyphs/LogoDeno.svelte'; import LogoDiscordGlyph from './icon/glyphs/LogoDiscord.svelte'; import LogoDjangoGlyph from './icon/glyphs/LogoDjango.svelte'; @@ -117,6 +119,8 @@ {:else if glyph === 'LeftUp'} +{:else if glyph === 'Lock'} + {:else if glyph === 'LogoDeno'} {:else if glyph === 'LogoDiscord'} diff --git a/gui/src/components/icon/glyphs/Add.svelte b/gui/src/components/icon/glyphs/Add.svelte index 22b76a956..64c033713 100644 --- a/gui/src/components/icon/glyphs/Add.svelte +++ b/gui/src/components/icon/glyphs/Add.svelte @@ -1,5 +1,5 @@ diff --git a/gui/src/components/icon/glyphs/Lock.svelte b/gui/src/components/icon/glyphs/Lock.svelte new file mode 100644 index 000000000..fc66604ed --- /dev/null +++ b/gui/src/components/icon/glyphs/Lock.svelte @@ -0,0 +1,12 @@ + + + diff --git a/gui/src/pages/WorkspaceAddVault.svelte b/gui/src/pages/WorkspaceAddVault.svelte index f1ed554fe..46a1fd357 100644 --- a/gui/src/pages/WorkspaceAddVault.svelte +++ b/gui/src/pages/WorkspaceAddVault.svelte @@ -1,9 +1,11 @@ - + diff --git a/gui/src/pages/WorkspaceVariables.svelte b/gui/src/pages/WorkspaceVariables.svelte index d55ae3a2a..033b610b4 100644 --- a/gui/src/pages/WorkspaceVariables.svelte +++ b/gui/src/pages/WorkspaceVariables.svelte @@ -63,11 +63,11 @@ {vault.url} {#if vault.connected} - Create secret + + Create secret + {:else if vault.needsAuth} - Authenticate + Authenticate {:else} Bad vault URL {/if} From a07371eeaaafd43cb415842867d871b09d1d1288 Mon Sep 17 00:00:00 2001 From: John <51100181+jwmza@users.noreply.github.com> Date: Fri, 15 Oct 2021 15:04:10 -0400 Subject: [PATCH 06/11] Use `href` in Button to add new vault --- gui/src/pages/WorkspaceVariables.svelte | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/gui/src/pages/WorkspaceVariables.svelte b/gui/src/pages/WorkspaceVariables.svelte index 033b610b4..0e090d985 100644 --- a/gui/src/pages/WorkspaceVariables.svelte +++ b/gui/src/pages/WorkspaceVariables.svelte @@ -13,7 +13,7 @@ const workspaceId = params.workspace; const workspace = api.workspace(workspaceId); - const workspaceRoute = `/workspaces/${encodeURIComponent(workspaceId)}`; + const workspaceRoute = `#/workspaces/${encodeURIComponent(workspaceId)}`; const makeRequests = () => Promise.all([workspace.describeEnvironment(), workspace.describeVaults()]); @@ -39,12 +39,7 @@ {:then [variables, vaults]} Vaults - router.push(`${workspaceRoute}/add-vault`)} - small - > - Add vault - + Add vault {#if vaults.length} From 9c82a93a1d062f35bcdc43dced4332064a2558af Mon Sep 17 00:00:00 2001 From: John <51100181+jwmza@users.noreply.github.com> Date: Fri, 15 Oct 2021 16:41:10 -0400 Subject: [PATCH 07/11] Use intuitive ">" to handle empty lists in WorkspaceVariables --- gui/src/pages/WorkspaceVariables.svelte | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/gui/src/pages/WorkspaceVariables.svelte b/gui/src/pages/WorkspaceVariables.svelte index 0e090d985..a874793c2 100644 --- a/gui/src/pages/WorkspaceVariables.svelte +++ b/gui/src/pages/WorkspaceVariables.svelte @@ -1,5 +1,4 @@ @@ -7,7 +8,7 @@ { - if (href.startsWith('#')) { + if (!absoluteUrl.test(href)) { router.push(href); event.preventDefault(); } diff --git a/gui/src/lib/regex.ts b/gui/src/lib/regex.ts new file mode 100644 index 000000000..cc3081206 --- /dev/null +++ b/gui/src/lib/regex.ts @@ -0,0 +1 @@ +export const absoluteUrl = /^https?:\/\//i; diff --git a/gui/src/pages/WorkspaceVariables.svelte b/gui/src/pages/WorkspaceVariables.svelte index 9859bbea1..0086b3264 100644 --- a/gui/src/pages/WorkspaceVariables.svelte +++ b/gui/src/pages/WorkspaceVariables.svelte @@ -12,7 +12,7 @@ const workspaceId = params.workspace; const workspace = api.workspace(workspaceId); - const workspaceRoute = `#/workspaces/${encodeURIComponent(workspaceId)}`; + const workspaceRoute = `/workspaces/${encodeURIComponent(workspaceId)}`; const makeRequests = () => Promise.all([workspace.describeEnvironment(), workspace.describeVaults()]);