From dd2d03c99b110944ba82279e82b58e09e8265f20 Mon Sep 17 00:00:00 2001 From: Arman Date: Mon, 31 Oct 2022 15:23:21 +0100 Subject: [PATCH] fix: fixes from PR review --- src/lib/components/permissions/team.svelte | 156 +++++++-------- src/lib/components/permissions/user.svelte | 184 +++++++++--------- src/lib/layout/wizard.svelte | 9 +- .../functions/createFunction.svelte | 2 +- .../functions/wizard/step1.svelte | 2 +- 5 files changed, 167 insertions(+), 186 deletions(-) diff --git a/src/lib/components/permissions/team.svelte b/src/lib/components/permissions/team.svelte index 79434e101..43d08d1a6 100644 --- a/src/lib/components/permissions/team.svelte +++ b/src/lib/components/permissions/team.svelte @@ -1,5 +1,5 @@ -{#if show} -
- - Select teams - - {#if results?.teams?.length} -
- - - {#each results.teams as team (team.$id)} - {@const role = `team:${team.$id}`} - {@const exists = $groups.has(role)} - - - - - {/each} - -
- onSelection(event, role)} /> - - -
+ + Select teams + + {#if results?.teams?.length} +
+ + + {#each results.teams as team (team.$id)} + {@const role = `team:${team.$id}`} + {@const exists = $groups.has(role)} + + + + + {/each} + +
+ onSelection(event, role)} /> + + +
+
+
+

Total results: {results?.total}

+ +
+ {:else if search} + +
+
+ Sorry we couldn't find "{search}" +

There are no Teams that match your search.

-
-

Total results: {results?.total}

- +
+ +
- {:else if search} - -
-
- Sorry we couldn't find "{search}" -

There are no Teams that match your search.

-
-
- - -
-
-
- {:else} - -
-
- Sorry we couldn't find "{search}" +
+ + {:else} + +
+
+ Sorry we couldn't find "{search}" -

You have no Teams. Create a user to see them here.

-

- Need a hand? Check out our - documentation. -

-
-
-
- {/if} +

You have no Teams. Create a user to see them here.

+

+ Need a hand? Check out our + documentation. +

+
+
+ + {/if} - - - - - -{/if} + + + + diff --git a/src/lib/components/permissions/user.svelte b/src/lib/components/permissions/user.svelte index fd7c43670..a01e85f1e 100644 --- a/src/lib/components/permissions/user.svelte +++ b/src/lib/components/permissions/user.svelte @@ -1,5 +1,5 @@ -
- - Select users - - {#if results?.users?.length} -
- - - {#each results.users as user (user.$id)} - {@const role = `user:${user.$id}`} - {@const exists = $groups.has(role)} - - - + + {/each} + +
- onSelection(event, role)} /> - -
+
+
+

Total results: {results?.total}

+ +
+ {:else if search} + +
+
+ Sorry we couldn't find "{search}" +

There are no Users that match your search.

- - {:else} - -
-
- Sorry we couldn't find "{search}" - -

You have no Users. Create a user to see them here.

-

- Need a hand? Check out our - documentation. -

-
+
+ +
- - {/if} +
+
+ {:else} + +
+
+ Sorry we couldn't find "{search}" - - - - - +

You have no Users. Create a user to see them here.

+

+ Need a hand? Check out our + documentation. +

+
+
+
+ {/if} + + + + + diff --git a/src/lib/layout/wizard.svelte b/src/lib/layout/wizard.svelte index 40871db40..c805a6d01 100644 --- a/src/lib/layout/wizard.svelte +++ b/src/lib/layout/wizard.svelte @@ -28,13 +28,8 @@ let showExitModal = false; function handleKeydown(event: KeyboardEvent) { - const dialogArray = document.getElementsByTagName['dialog']; - let isModalOpen = false; - dialogArray?.forEach((dialog: HTMLDialogElement) => { - if (dialog.open) { - isModalOpen = true; - } - }); + const isModalOpen = document.querySelectorAll('dialog[open]'); + if (event.key === 'Escape' && !showExitModal && isModalOpen) { event.preventDefault(); dispatch('exit'); diff --git a/src/routes/console/project-[project]/functions/createFunction.svelte b/src/routes/console/project-[project]/functions/createFunction.svelte index 07f00c7fb..9030bb5c2 100644 --- a/src/routes/console/project-[project]/functions/createFunction.svelte +++ b/src/routes/console/project-[project]/functions/createFunction.svelte @@ -37,7 +37,7 @@ await sdkForProject.functions.createVariable(response.$id, v.key, v.value) ); await invalidate(Dependencies.FUNCTIONS); - await goto(`${base}/console/project-${projectId}/functions/function/${response.$id}`); + goto(`${base}/console/project-${projectId}/functions/function-${response.$id}`); addNotification({ message: 'Function has been created', diff --git a/src/routes/console/project-[project]/functions/wizard/step1.svelte b/src/routes/console/project-[project]/functions/wizard/step1.svelte index 93ac297e8..2701dadec 100644 --- a/src/routes/console/project-[project]/functions/wizard/step1.svelte +++ b/src/routes/console/project-[project]/functions/wizard/step1.svelte @@ -14,7 +14,7 @@ onMount(async () => { let runtimes = await sdkForProject.functions.listRuntimes(); options = runtimes.runtimes.map((runtime) => ({ - label: runtime.name, + label: `${runtime.name} - ${runtime.version}`, value: runtime.$id })); });