rename appwrite domain

This commit is contained in:
Arman
2025-03-13 15:51:50 +01:00
parent 34a0650ac8
commit c9bd00212f
6 changed files with 24 additions and 24 deletions
@@ -28,14 +28,14 @@
import SearchQuery from '$lib/components/searchQuery.svelte';
import { app } from '$lib/stores/app';
import { Click, trackEvent } from '$lib/actions/analytics';
import CreateAppwriteDomainModal from './createAppwriteDomainModal.svelte';
import CreatePreviewDomainModal from './createPreviewDomainModal.svelte';
export let data;
let showDelete = false;
let showRetry = false;
let selectedDomain: Models.ProxyRule = null;
let showAppwriteDomainModal = false;
let showPreviewDomainModal = false;
</script>
<Container>
@@ -58,8 +58,8 @@
href={`${base}/project-${$page.params.project}/functions/function-${$page.params.function}/domains/add-domain`}>
Custom domain
</ActionMenu.Item.Anchor>
<ActionMenu.Item.Button on:click={() => (showAppwriteDomainModal = true)}>
Appwrite domain
<ActionMenu.Item.Button on:click={() => (showPreviewDomainModal = true)}>
Preview domain
</ActionMenu.Item.Button>
</ActionMenu.Root>
</svelte:fragment>
@@ -193,6 +193,6 @@
<RetryDomainModal bind:show={showRetry} {selectedDomain} />
{/if}
{#if showAppwriteDomainModal}
<CreateAppwriteDomainModal bind:show={showAppwriteDomainModal} />
{#if showPreviewDomainModal}
<CreatePreviewDomainModal bind:show={showPreviewDomainModal} />
{/if}
@@ -74,12 +74,12 @@
});
async function addDomain() {
const isAppwriteDomain = domain.endsWith($consoleVariables._APP_DOMAIN_TARGET);
const isPreviewDomain = domain.endsWith($consoleVariables._APP_DOMAIN_TARGET);
const isNewDomain = data.domains.rules.findIndex((rule) => rule.domain === domain) === -1;
const isSubDomain = domain.split('.').length >= 2;
try {
if (behaviour === 'CREATE') {
if (isCloud && !isAppwriteDomain) {
if (isCloud && !isPreviewDomain) {
//Redirect if subdomain so user can choose how to proceed
if (isSubDomain) {
goto(
@@ -102,7 +102,7 @@
);
}
}
//if selfhosted or appwrite domain create function rule
//if selfhosted or preview domain create function rule
else {
await sdk.forProject.proxy.createFunctionRule(
domain,
@@ -117,7 +117,7 @@
await invalidate(Dependencies.FUNCTION_DOMAINS);
}
} else if (behaviour === 'REDIRECT') {
if (isCloud && !isAppwriteDomain) {
if (isCloud && !isPreviewDomain) {
//Redirect if subdomain so user can choose how to proceed
if (isSubDomain) {
goto(
@@ -30,7 +30,7 @@
show = false;
addNotification({
type: 'success',
message: 'Appwrite domain has been added'
message: 'Preview domain has been added'
});
trackEvent(Submit.DomainCreate);
} catch (e) {
@@ -79,7 +79,7 @@
}
</script>
<Modal title="Add Appwrite domain" bind:show {onSubmit} bind:error>
<Modal title="Add preview domain" bind:show {onSubmit} bind:error>
<span slot="description">
Get an auto-generated domain to quickly access your project. You can customize its prefix.
</span>
@@ -28,14 +28,14 @@
import SearchQuery from '$lib/components/searchQuery.svelte';
import { app } from '$lib/stores/app';
import { Click, trackEvent } from '$lib/actions/analytics';
import CreateAppwriteDomainModal from './createAppwriteDomainModal.svelte';
import CreatePreviewDomainModal from './createPreviewDomainModal.svelte';
export let data;
let showDelete = false;
let showRetry = false;
let selectedDomain: Models.ProxyRule = null;
let showAppwriteDomainModal = false;
let showPreviewDomainModal = false;
$: console.log(data.domains);
</script>
@@ -60,8 +60,8 @@
href={`${base}/project-${$page.params.project}/sites/site-${$page.params.site}/domains/add-domain`}>
Custom domain
</ActionMenu.Item.Anchor>
<ActionMenu.Item.Button on:click={() => (showAppwriteDomainModal = true)}>
Appwrite domain
<ActionMenu.Item.Button on:click={() => (showPreviewDomainModal = true)}>
Preview domain
</ActionMenu.Item.Button>
</ActionMenu.Root>
</svelte:fragment>
@@ -196,6 +196,6 @@
<RetryDomainModal bind:show={showRetry} {selectedDomain} />
{/if}
{#if showAppwriteDomainModal}
<CreateAppwriteDomainModal bind:show={showAppwriteDomainModal} />
{#if showPreviewDomainModal}
<CreatePreviewDomainModal bind:show={showPreviewDomainModal} />
{/if}
@@ -74,12 +74,12 @@
});
async function addDomain() {
const isAppwriteDomain = domain.endsWith($consoleVariables._APP_DOMAIN_SITES);
const isPreviewDomain = domain.endsWith($consoleVariables._APP_DOMAIN_SITES);
const isNewDomain = data.domains.rules.findIndex((rule) => rule.domain === domain) === -1;
const isSubDomain = domain.split('.').length >= 2;
try {
if (behaviour === 'CREATE') {
if (isCloud && !isAppwriteDomain) {
if (isCloud && !isPreviewDomain) {
//Redirect if subdomain so user can choose how to proceed
if (isSubDomain) {
goto(
@@ -102,7 +102,7 @@
);
}
}
//if selfhosted or appwrite domain create site rule
//if selfhosted or preview domain create site rule
else {
await sdk.forProject.proxy.createSiteRule(domain, $page.params.site, branch);
addNotification({
@@ -113,7 +113,7 @@
await invalidate(Dependencies.SITES_DOMAINS);
}
} else if (behaviour === 'REDIRECT') {
if (isCloud && !isAppwriteDomain) {
if (isCloud && !isPreviewDomain) {
//Redirect if subdomain so user can choose how to proceed
if (isSubDomain) {
goto(
@@ -30,7 +30,7 @@
show = false;
addNotification({
type: 'success',
message: 'Appwrite domain has been added'
message: 'Preview domain has been added'
});
trackEvent(Submit.DomainCreate);
} catch (e) {
@@ -79,7 +79,7 @@
}
</script>
<Modal title="Add Appwrite domain" bind:show {onSubmit} bind:error>
<Modal title="Add preview domain" bind:show {onSubmit} bind:error>
<span slot="description">
Get an auto-generated domain to quickly access your project. You can customize its prefix.
</span>