From 2514a2df9ac10f69f75969ef07386a32dd4e5f70 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Thu, 1 Dec 2022 22:51:27 +0100 Subject: [PATCH] simplify adding manual resources --- frontend/src/lib/components/AppConnect.svelte | 69 ++++++++++--------- frontend/src/lib/components/ArgInput.svelte | 1 + 2 files changed, 36 insertions(+), 34 deletions(-) diff --git a/frontend/src/lib/components/AppConnect.svelte b/frontend/src/lib/components/AppConnect.svelte index da7bea1c30..2495c2c2c5 100644 --- a/frontend/src/lib/components/AppConnect.svelte +++ b/frontend/src/lib/components/AppConnect.svelte @@ -111,7 +111,7 @@ } async function next() { - if (step < 3 && manual) { + if (step == 1 && manual) { step += 1 } else if (step == 1 && !manual) { const url = new URL(`/api/oauth/connect/${resource_type}`, $page.url.origin) @@ -312,30 +312,34 @@ {/each} - {:else if step == 2} - {#if manual} - {#if apiTokenApps[resource_type]} -
Instructions
-
-
    - {#each apiTokenApps[resource_type].instructions as step} -
  1. - {@html step} -
  2. - {/each} -
-
- {#if apiTokenApps[resource_type].img} -
- connect -
- {/if} - {/if} - -
- + {:else if step == 2 && manual} + + {#if apiTokenApps[resource_type]} +
Instructions
+
+
    + {#each apiTokenApps[resource_type].instructions as step} +
  1. + {@html step} +
  2. + {/each} +
+ {#if apiTokenApps[resource_type].img} +
+ connect +
+ {/if} {/if} + +
+ +
{:else} {#if apiTokenApps[resource_type] || !manual} - {manual} - {apiTokenApps[resource_type]}
  • - 1. A secret variable containing the {apiTokenApps[resource_type]?.key ?? 'token'}{truncateRev(value, 5, '*****')} + 1. A secret variable containing the {apiTokenApps[resource_type]?.key ?? 'token'} + {truncateRev(value, 5, '*****')} will be stored a - {path}. + {path}.
  • - 2. The resource containing that token will be stored at the same path{path}{path}. The Variable and Resource will be "linked together", they will be deleted and renamed together.
{#if step == 1 && !manual} Connect - {:else if step == 3} - Add resource - {:else} + {:else if step == 1 && manual} Next + {:else} + Save {/if} {/if} diff --git a/frontend/src/lib/components/ArgInput.svelte b/frontend/src/lib/components/ArgInput.svelte index 65556ae98b..3949c7758c 100644 --- a/frontend/src/lib/components/ArgInput.svelte +++ b/frontend/src/lib/components/ArgInput.svelte @@ -61,6 +61,7 @@ if (rawValue) { try { value = JSON.parse(rawValue) + error = '' } catch (err) { error = err.toString() }