From df330ced5130f7607679321e3e366daccac018aa Mon Sep 17 00:00:00 2001 From: Arman Date: Sun, 10 Dec 2023 18:44:35 +0100 Subject: [PATCH] fix: account preferences being overwritten, region notification, add autofocus to functions --- .../wizards/functions/steps/details.svelte | 1 + .../steps/functionConfiguration.svelte | 1 + .../steps/templateConfiguration.svelte | 1 + .../wizard/step1.svelte | 1 + .../wizard/step2.svelte | 30 +++++++++++++++++++ .../console/project-[project]/+layout.ts | 4 ++- .../functions/wizard/step1.svelte | 1 + .../register/invite/[slug]/+page.svelte | 4 ++- 8 files changed, 41 insertions(+), 2 deletions(-) diff --git a/src/lib/wizards/functions/steps/details.svelte b/src/lib/wizards/functions/steps/details.svelte index 42f7cb1aa..db5194d7c 100644 --- a/src/lib/wizards/functions/steps/details.svelte +++ b/src/lib/wizards/functions/steps/details.svelte @@ -27,6 +27,7 @@ label="Name" id="name" placeholder="Function name" + autofocus bind:value={$createFunction.name} required /> diff --git a/src/lib/wizards/functions/steps/functionConfiguration.svelte b/src/lib/wizards/functions/steps/functionConfiguration.svelte index ba201d88c..a0209dd8d 100644 --- a/src/lib/wizards/functions/steps/functionConfiguration.svelte +++ b/src/lib/wizards/functions/steps/functionConfiguration.svelte @@ -59,6 +59,7 @@ label="Name" id="name" placeholder="Function name" + autofocus bind:value={$createFunction.name} required /> {#if !showCustomId} diff --git a/src/lib/wizards/functions/steps/templateConfiguration.svelte b/src/lib/wizards/functions/steps/templateConfiguration.svelte index 49be494b6..71979b045 100644 --- a/src/lib/wizards/functions/steps/templateConfiguration.svelte +++ b/src/lib/wizards/functions/steps/templateConfiguration.svelte @@ -39,6 +39,7 @@ label="Name" id="name" placeholder="Function name" + autofocus bind:value={$templateConfig.name} required /> {#await loadRuntimes()} diff --git a/src/routes/console/organization-[organization]/wizard/step1.svelte b/src/routes/console/organization-[organization]/wizard/step1.svelte index c148d82a7..70bbc0050 100644 --- a/src/routes/console/organization-[organization]/wizard/step1.svelte +++ b/src/routes/console/organization-[organization]/wizard/step1.svelte @@ -16,6 +16,7 @@ id="name" placeholder="Project name" bind:value={$createProject.name} + autofocus required /> {#if !showCustomId} diff --git a/src/routes/console/organization-[organization]/wizard/step2.svelte b/src/routes/console/organization-[organization]/wizard/step2.svelte index 7eae737f7..39af0bf5a 100644 --- a/src/routes/console/organization-[organization]/wizard/step2.svelte +++ b/src/routes/console/organization-[organization]/wizard/step2.svelte @@ -32,6 +32,25 @@ console.log(error); } } + async function unNotifyRegion(selectedRegion: Region) { + try { + let newPrefs = { ...prefs }; + newPrefs.notifications = newPrefs.notifications ?? []; + newPrefs.notifications = [...newPrefs.notifications, selectedRegion.$id]; + newPrefs.notifications = newPrefs.notifications.filter( + (region: string) => region !== selectedRegion.$id + ); + const response = await sdk.forConsole.account.updatePrefs(newPrefs); + prefs = response.prefs; + addNotification({ + type: 'info', + isHtml: true, + message: `You won't be notified anymore when the ${selectedRegion.name} region is available` + }); + } catch (error) { + console.log(error); + } + } $: notifications = prefs?.notifications ?? []; @@ -72,6 +91,17 @@