From 40d1b694a2eb939c14de7ee9b6469a347dfab4be Mon Sep 17 00:00:00 2001 From: Arman Date: Mon, 20 Jan 2025 15:46:21 +0100 Subject: [PATCH] feat: re-enable domain check, disconect repo --- src/lib/actions/analytics.ts | 3 +- .../sites/create-site/domain.svelte | 30 ++--- .../template-[template]/+page.svelte | 105 ++++++++++-------- .../settings/disconnectRepo.svelte | 33 ++++-- 4 files changed, 99 insertions(+), 72 deletions(-) diff --git a/src/lib/actions/analytics.ts b/src/lib/actions/analytics.ts index 1144e11b1..8312bd08e 100644 --- a/src/lib/actions/analytics.ts +++ b/src/lib/actions/analytics.ts @@ -338,5 +338,6 @@ export enum Submit { SiteUpdateBuildSettings = 'submit_site_update_build_settings', SiteUpdateSinglePageApplication = 'submit_site_update_single_page_application', SiteConnectRepo = 'submit_site_connect_repo', - SiteRedeploy = 'submit_site_redeploy' + SiteRedeploy = 'submit_site_redeploy', + SiteDisconnectRepo = 'submit_site_disconnect_repo' } diff --git a/src/routes/(console)/project-[project]/sites/create-site/domain.svelte b/src/routes/(console)/project-[project]/sites/create-site/domain.svelte index 88120b29e..a29091845 100644 --- a/src/routes/(console)/project-[project]/sites/create-site/domain.svelte +++ b/src/routes/(console)/project-[project]/sites/create-site/domain.svelte @@ -1,26 +1,28 @@ @@ -36,8 +38,8 @@ + status={domainIsValid ? 'complete' : 'failed'} + label={domainIsValid ? 'Domain is available' : 'Domain is not available'}> @@ -49,7 +51,7 @@ showConfig = false; }}>Cancel - @@ -64,11 +66,9 @@ {domain}.{$consoleVariables._APP_DOMAIN_TARGET} - + { + async function handleSubmit() { try { - await invalidate(Dependencies.FUNCTION); + await sdk.forProject.sites.update( + site.$id, + site.name, + site.framework as Framework, + site.enabled || undefined, + site.timeout || undefined, + site.installCommand || undefined, + site.buildCommand || undefined, + site.outputDirectory || undefined, + (site?.buildRuntime as BuildRuntime) || undefined, + site.adapter, + site.fallbackFile || undefined, + '', + '', + '', + undefined, + '' + ); + await invalidate(Dependencies.SITE); dispatch('success'); addNotification({ type: 'success', - message: `Repository has been disconnected from your function` + message: `Repository has been disconnected from your site` }); - trackEvent(Submit.FunctionDisconnectRepo); + trackEvent(Submit.SiteDisconnectRepo); show = false; } catch (e) { error = e.message; - trackError(e, Submit.FunctionDisconnectRepo); + trackError(e, Submit.SiteDisconnectRepo); } - }; + } $: if (!show) { error = '';