From ba2aaf87e761d887177511c98e9558e4e646aee4 Mon Sep 17 00:00:00 2001 From: Dean Date: Thu, 18 Aug 2022 14:58:22 +0100 Subject: [PATCH] UX feedback changes --- .../builder/portal/manage/auth/index.svelte | 207 ++++++------------ 1 file changed, 70 insertions(+), 137 deletions(-) diff --git a/packages/builder/src/pages/builder/portal/manage/auth/index.svelte b/packages/builder/src/pages/builder/portal/manage/auth/index.svelte index e6ed4eac68..cd5f28085e 100644 --- a/packages/builder/src/pages/builder/portal/manage/auth/index.svelte +++ b/packages/builder/src/pages/builder/portal/manage/auth/index.svelte @@ -210,7 +210,6 @@ providers[res.type]._id = res._id }) notifications.success(`Settings saved`) - scopesFields[0].editing = false }) .catch(() => { notifications.error("Failed to update auth settings") @@ -227,7 +226,7 @@ let scopesFields = [ { - editing: false, + editing: true, inputText: null, error: null, }, @@ -418,7 +417,19 @@ -
Advanced
+
+
Advanced
+ +
Changes to your authentication scopes will only take effect when you @@ -426,64 +437,59 @@ modification. -
- - {#if scopesFields[0].editing} - - { - if (!scopesFields[0].inputText) { +
+ + + { + if (!scopesFields[0].inputText) { + scopesFields[0].error = null + } + if ( + e.key === "Enter" || + e.keyCode === 13 || + e.code == "Space" || + e.keyCode == 32 + ) { + let scopes = providers.oidc.config.configs[0]["scopes"] + ? providers.oidc.config.configs[0]["scopes"] + : [...defaultScopes] + + let update = scopesFields[0].inputText.trim() + + if (/[\\"\s]/.test(update)) { + scopesFields[0].error = + "Auth scopes cannot contain spaces, double quotes or backslashes" + return + } else if (scopes.indexOf(update) > -1) { + scopesFields[0].error = "Auth scope already exists" + return + } else if (!update.length) { + scopesFields[0].inputText = null + scopesFields[0].error = null + return + } else { scopesFields[0].error = null } - if ( - e.key === "Enter" || - e.keyCode === 13 || - e.code == "Space" || - e.keyCode == 32 - ) { - let scopes = providers.oidc.config.configs[0]["scopes"] - ? providers.oidc.config.configs[0]["scopes"] - : [...defaultScopes] - let update = scopesFields[0].inputText.trim() - - if (/[\\"\s]/.test(update)) { - scopesFields[0].error = - "Auth scopes cannot contain spaces, double quotes or backslashes" - return - } else if (scopes.indexOf(update) > -1) { - scopesFields[0].error = "Auth scope already exists" - return - } else if (!update.length) { - scopesFields[0].inputText = null - scopesFields[0].error = null - return - } else { - scopesFields[0].error = null - } - - if (scopes.indexOf(update) == -1) { - scopes.push(update) - providers.oidc.config.configs[0]["scopes"] = scopes - } - scopesFields[0].inputText = null + if (scopes.indexOf(update) == -1) { + scopes.push(update) + providers.oidc.config.configs[0]["scopes"] = scopes } - }} - /> - - {/if} - + scopesFields[0].inputText = null + } + }} + /> +
+ - - openid - + openid {#each providers.oidc.config.configs[0]["scopes"] || [...defaultScopes] as tag, idx} { let idxScopes = providers.oidc.config.configs[0]["scopes"] @@ -498,57 +504,8 @@ {tag} {/each} - - {#if !scopesFields[0].editing} - { - if (!providers.oidc.config.configs[0]["scopes"]) { - providers.oidc.config.configs[0]["scopes"] = [ - ...defaultScopes, - ] - } - scopesFields[0].editing = !scopesFields[0].editing - }} - > - Edit - - {/if}
- - {#if scopesFields[0].editing} -
- - -
- {/if}
@@ -556,50 +513,26 @@