mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
Merge pull request #1879 from appwrite/update-domain-type
Update domain types
This commit is contained in:
@@ -1,23 +1,21 @@
|
||||
import { StatusCode } from '@appwrite.io/console';
|
||||
|
||||
export const statusCodeOptions = [
|
||||
{
|
||||
label: '301 Moved permanently',
|
||||
value: 301
|
||||
value: StatusCode.MovedPermanently301
|
||||
},
|
||||
{
|
||||
label: '302 Found',
|
||||
value: 302
|
||||
},
|
||||
{
|
||||
label: '303 See other',
|
||||
value: 303
|
||||
value: StatusCode.Found302
|
||||
},
|
||||
{
|
||||
label: '307 Temporary redirect',
|
||||
value: 307
|
||||
value: StatusCode.TemporaryRedirect307
|
||||
},
|
||||
{
|
||||
label: '308 Permanent redirect',
|
||||
value: 308
|
||||
value: StatusCode.PermanentRedirect308
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
+6
-6
@@ -18,7 +18,7 @@
|
||||
|
||||
let showDelete = $state(false);
|
||||
let showRetry = $state(false);
|
||||
let selectedDomain: Models.ProxyRule = null;
|
||||
let selectedProxyRule: Models.ProxyRule = null;
|
||||
</script>
|
||||
|
||||
<Container>
|
||||
@@ -35,14 +35,14 @@
|
||||
Add domain
|
||||
</Button>
|
||||
</Layout.Stack>
|
||||
{#if data.domains.total}
|
||||
<Table domains={data.domains} />
|
||||
{#if data.proxyRules.total}
|
||||
<Table proxyRules={data.proxyRules} />
|
||||
|
||||
<PaginationWithLimit
|
||||
name="Domains"
|
||||
limit={data.limit}
|
||||
offset={data.offset}
|
||||
total={data.domains.total} />
|
||||
total={data.proxyRules.total} />
|
||||
{:else if data?.search}
|
||||
<EmptySearch hidePages bind:search={data.search} target="domains" hidePagination>
|
||||
<svelte:fragment slot="actions">
|
||||
@@ -83,9 +83,9 @@
|
||||
</Container>
|
||||
|
||||
{#if showDelete}
|
||||
<DeleteDomainModal bind:show={showDelete} {selectedDomain} />
|
||||
<DeleteDomainModal bind:show={showDelete} {selectedProxyRule} />
|
||||
{/if}
|
||||
|
||||
{#if showRetry}
|
||||
<RetryDomainModal bind:show={showRetry} {selectedDomain} />
|
||||
<RetryDomainModal bind:show={showRetry} {selectedProxyRule} />
|
||||
{/if}
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ export const load: PageLoad = async ({ depends, params, url, route }) => {
|
||||
limit,
|
||||
query,
|
||||
search,
|
||||
domains: await sdk
|
||||
proxyRules: await sdk
|
||||
.forProject(params.region, params.project)
|
||||
.proxy.listRules(
|
||||
[
|
||||
|
||||
+6
-5
@@ -11,15 +11,16 @@
|
||||
import { page } from '$app/state';
|
||||
|
||||
export let show = false;
|
||||
export let selectedDomain: Models.ProxyRule;
|
||||
let confirm = false;
|
||||
export let selectedProxyRule: Models.ProxyRule;
|
||||
|
||||
let error = '';
|
||||
let confirm = false;
|
||||
|
||||
async function deleteDomain() {
|
||||
try {
|
||||
await sdk
|
||||
.forProject(page.params.region, page.params.project)
|
||||
.proxy.deleteRule(selectedDomain.$id);
|
||||
.proxy.deleteRule(selectedProxyRule.$id);
|
||||
await invalidate(Dependencies.FUNCTION_DOMAINS);
|
||||
show = false;
|
||||
addNotification({
|
||||
@@ -35,13 +36,13 @@
|
||||
</script>
|
||||
|
||||
<Confirm title="Delete domain" bind:open={show} onSubmit={deleteDomain} bind:error>
|
||||
{#if selectedDomain}
|
||||
{#if selectedProxyRule}
|
||||
<Typography.Text variant="m-400">
|
||||
Are you sure you want to delete this domain? You will no longer be able to execute your
|
||||
function by visiting:
|
||||
</Typography.Text>
|
||||
<Typography.Text variant="m-500">
|
||||
{selectedDomain.domain}
|
||||
{selectedProxyRule.domain}
|
||||
</Typography.Text>
|
||||
{/if}
|
||||
<InputCheckbox
|
||||
|
||||
+3
-4
@@ -1,6 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { Link } from '$lib/elements';
|
||||
import type { Domain } from '$lib/sdk/domains';
|
||||
import { IconInfo } from '@appwrite.io/pink-icons-svelte';
|
||||
import {
|
||||
Badge,
|
||||
@@ -14,7 +13,7 @@
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
import { consoleVariables } from '$routes/(console)/store';
|
||||
|
||||
export let domain: Domain | Models.ProxyRule;
|
||||
export let proxyRule: Models.ProxyRule;
|
||||
</script>
|
||||
|
||||
<Fieldset legend="Verification">
|
||||
@@ -22,7 +21,7 @@
|
||||
<Layout.Stack gap="xl">
|
||||
<Layout.Stack gap="s">
|
||||
<Layout.Stack gap="s" direction="row" alignItems="center">
|
||||
<Typography.Text variant="l-500">{domain?.domain}</Typography.Text>
|
||||
<Typography.Text variant="l-500">{proxyRule?.domain}</Typography.Text>
|
||||
<Badge variant="secondary" type="warning" content="Pending verification" />
|
||||
</Layout.Stack>
|
||||
<Typography.Text variant="m-400">
|
||||
@@ -39,7 +38,7 @@
|
||||
</svelte:fragment>
|
||||
<Table.Row.Base {root}>
|
||||
<Table.Cell {root}>CNAME</Table.Cell>
|
||||
<Table.Cell {root}>{domain?.domain}</Table.Cell>
|
||||
<Table.Cell {root}>{proxyRule?.domain}</Table.Cell>
|
||||
<Table.Cell {root}>
|
||||
<InteractiveText
|
||||
variant="copy"
|
||||
|
||||
+7
-8
@@ -7,24 +7,23 @@
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import RecordsCard from './recordsCard.svelte';
|
||||
import type { Domain } from '$lib/sdk/domains';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
import { page } from '$app/state';
|
||||
|
||||
export let show = false;
|
||||
export let selectedDomain: Domain | Models.ProxyRule;
|
||||
export let selectedProxyRule: Models.ProxyRule;
|
||||
|
||||
let error = null;
|
||||
async function retryDomain() {
|
||||
async function retryProxyRule() {
|
||||
try {
|
||||
await sdk
|
||||
.forProject(page.params.region, page.params.project)
|
||||
.proxy.updateRuleVerification(selectedDomain.$id);
|
||||
.proxy.updateRuleVerification(selectedProxyRule.$id);
|
||||
await invalidate(Dependencies.SITES_DOMAINS);
|
||||
show = false;
|
||||
addNotification({
|
||||
type: 'success',
|
||||
message: `${selectedDomain.domain} has been verified`
|
||||
message: `${selectedProxyRule.domain} has been verified`
|
||||
});
|
||||
trackEvent(Submit.DomainUpdateVerification);
|
||||
} catch (e) {
|
||||
@@ -38,9 +37,9 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<Modal title="Retry verification" bind:show onSubmit={retryDomain} bind:error>
|
||||
{#if selectedDomain}
|
||||
<RecordsCard domain={selectedDomain} />
|
||||
<Modal title="Retry verification" bind:show onSubmit={retryProxyRule} bind:error>
|
||||
{#if selectedProxyRule}
|
||||
<RecordsCard proxyRule={selectedProxyRule} />
|
||||
{/if}
|
||||
|
||||
<svelte:fragment slot="footer">
|
||||
|
||||
+22
-18
@@ -19,14 +19,22 @@
|
||||
import { columns } from './store';
|
||||
|
||||
let {
|
||||
domains
|
||||
proxyRules
|
||||
}: {
|
||||
domains: Models.ProxyRuleList;
|
||||
proxyRules: Models.ProxyRuleList;
|
||||
} = $props();
|
||||
|
||||
let showDelete = $state(false);
|
||||
let showRetry = $state(false);
|
||||
let selectedDomain: Models.ProxyRule = $state(null);
|
||||
let selectedProxyRule: Models.ProxyRule = $state(null);
|
||||
|
||||
const proxyTarget = (proxy: Models.ProxyRule) => {
|
||||
return proxy?.redirectUrl
|
||||
? 'Redirect to ' + proxy.redirectUrl
|
||||
: proxy?.deploymentVcsProviderBranch
|
||||
? 'Deployed from' + proxy.deploymentVcsProviderBranch
|
||||
: 'Active deployment';
|
||||
};
|
||||
</script>
|
||||
|
||||
<Table.Root columns={[...$columns, { id: 'actions', width: 40 }]} let:root>
|
||||
@@ -38,24 +46,24 @@
|
||||
{/each}
|
||||
<Table.Header.Cell column="actions" {root} />
|
||||
</svelte:fragment>
|
||||
{#each domains.rules as domain}
|
||||
{#each proxyRules.rules as proxyRule}
|
||||
<Table.Row.Base {root}>
|
||||
{#each $columns as column}
|
||||
<Table.Cell column={column.id} {root}>
|
||||
{#if column.id === 'domain'}
|
||||
<Layout.Stack direction="row" gap="xs">
|
||||
<Link external href={`${$protocol}${domain.domain}`} variant="quiet">
|
||||
<Link external href={`${$protocol}${proxyRule.domain}`} variant="quiet">
|
||||
<Typography.Text truncate>
|
||||
{domain.domain}
|
||||
{proxyRule.domain}
|
||||
</Typography.Text>
|
||||
</Link>
|
||||
{#if domain.status === 'verifying'}
|
||||
{#if proxyRule.status === 'verifying'}
|
||||
<Badge
|
||||
variant="secondary"
|
||||
type="warning"
|
||||
content="Verifying"
|
||||
size="s" />
|
||||
{:else if domain.status !== 'verified'}
|
||||
{:else if proxyRule.status !== 'verified'}
|
||||
<Badge
|
||||
variant="secondary"
|
||||
type="error"
|
||||
@@ -64,11 +72,7 @@
|
||||
{/if}
|
||||
</Layout.Stack>
|
||||
{:else if column.id === 'target'}
|
||||
{domain?.redirectUrl
|
||||
? 'Redirect to ' + domain.redirectUrl
|
||||
: domain?.deploymentVcsProviderBranch
|
||||
? 'Deployed from' + domain.deploymentVcsProviderBranch
|
||||
: '-'}
|
||||
{proxyTarget(proxyRule)}
|
||||
{/if}
|
||||
</Table.Cell>
|
||||
{/each}
|
||||
@@ -87,11 +91,11 @@
|
||||
|
||||
<svelte:fragment slot="tooltip" let:toggle>
|
||||
<ActionMenu.Root>
|
||||
{#if domain.status !== 'verified'}
|
||||
{#if proxyRule.status !== 'verified'}
|
||||
<ActionMenu.Item.Button
|
||||
leadingIcon={IconRefresh}
|
||||
on:click={(e) => {
|
||||
selectedDomain = domain;
|
||||
selectedProxyRule = proxyRule;
|
||||
showRetry = true;
|
||||
toggle(e);
|
||||
}}>
|
||||
@@ -102,7 +106,7 @@
|
||||
status="danger"
|
||||
leadingIcon={IconTrash}
|
||||
on:click={(e) => {
|
||||
selectedDomain = domain;
|
||||
selectedProxyRule = proxyRule;
|
||||
showDelete = true;
|
||||
toggle(e);
|
||||
trackEvent(Click.DomainDeleteClick, {
|
||||
@@ -121,9 +125,9 @@
|
||||
</Table.Root>
|
||||
|
||||
{#if showDelete}
|
||||
<DeleteDomainModal bind:show={showDelete} {selectedDomain} />
|
||||
<DeleteDomainModal bind:show={showDelete} {selectedProxyRule} />
|
||||
{/if}
|
||||
|
||||
{#if showRetry}
|
||||
<RetryDomainModal bind:show={showRetry} {selectedDomain} />
|
||||
<RetryDomainModal bind:show={showRetry} {selectedProxyRule} />
|
||||
{/if}
|
||||
|
||||
+3
-3
@@ -29,14 +29,14 @@
|
||||
</Button>
|
||||
</Layout.Stack>
|
||||
|
||||
{#if data.domains.total}
|
||||
<Table domains={data.domains} />
|
||||
{#if data.proxyRules.total}
|
||||
<Table proxyRules={data.proxyRules} />
|
||||
|
||||
<PaginationWithLimit
|
||||
name="Domains"
|
||||
limit={data.limit}
|
||||
offset={data.offset}
|
||||
total={data.domains.total} />
|
||||
total={data.proxyRules.total} />
|
||||
{:else if data?.search}
|
||||
<EmptySearch hidePages bind:search={data.search} target="domains" hidePagination>
|
||||
<Button
|
||||
|
||||
@@ -22,7 +22,7 @@ export const load = async ({ params, depends, url, route }) => {
|
||||
limit,
|
||||
query,
|
||||
search,
|
||||
domains: await sdk
|
||||
proxyRules: await sdk
|
||||
.forProject(params.region, params.project)
|
||||
.proxy.listRules(
|
||||
[
|
||||
|
||||
+5
-5
@@ -11,10 +11,10 @@
|
||||
|
||||
let {
|
||||
show = $bindable(),
|
||||
selectedDomain
|
||||
selectedProxyRule
|
||||
}: {
|
||||
show: boolean;
|
||||
selectedDomain: Models.ProxyRule;
|
||||
selectedProxyRule: Models.ProxyRule;
|
||||
} = $props();
|
||||
|
||||
let error: string = $state(null);
|
||||
@@ -23,7 +23,7 @@
|
||||
try {
|
||||
await sdk
|
||||
.forProject(page.params.region, page.params.project)
|
||||
.proxy.deleteRule(selectedDomain.$id);
|
||||
.proxy.deleteRule(selectedProxyRule.$id);
|
||||
await invalidate(Dependencies.SITES_DOMAINS);
|
||||
show = false;
|
||||
addNotification({
|
||||
@@ -39,13 +39,13 @@
|
||||
</script>
|
||||
|
||||
<Confirm title="Delete domain" bind:open={show} onSubmit={deleteDomain} bind:error confirmDeletion>
|
||||
{#if selectedDomain}
|
||||
{#if selectedProxyRule}
|
||||
<Typography.Text variant="m-400">
|
||||
Are you sure you want to delete this domain? You will no longer be able to view your
|
||||
site by visiting:
|
||||
</Typography.Text>
|
||||
<Typography.Text variant="m-500">
|
||||
{selectedDomain.domain}
|
||||
{selectedProxyRule.domain}
|
||||
</Typography.Text>
|
||||
{/if}
|
||||
</Confirm>
|
||||
|
||||
+7
-7
@@ -17,13 +17,13 @@
|
||||
|
||||
let {
|
||||
show = $bindable(false),
|
||||
selectedDomain
|
||||
selectedProxyRule
|
||||
}: {
|
||||
show: boolean;
|
||||
selectedDomain: Models.ProxyRule;
|
||||
selectedProxyRule: Models.ProxyRule;
|
||||
} = $props();
|
||||
|
||||
const isSubDomain = $derived.by(() => isASubdomain(selectedDomain?.domain));
|
||||
const isSubDomain = $derived.by(() => isASubdomain(selectedProxyRule?.domain));
|
||||
|
||||
let selectedTab = $state<'cname' | 'nameserver' | 'a' | 'aaaa'>('nameserver');
|
||||
$effect(() => {
|
||||
@@ -43,13 +43,13 @@
|
||||
try {
|
||||
const domain = await sdk
|
||||
.forProject(page.params.region, page.params.project)
|
||||
.proxy.updateRuleVerification(selectedDomain.$id);
|
||||
.proxy.updateRuleVerification(selectedProxyRule.$id);
|
||||
await invalidate(Dependencies.SITES_DOMAINS);
|
||||
verified = domain.status === 'verified';
|
||||
show = false;
|
||||
addNotification({
|
||||
type: 'success',
|
||||
message: `${selectedDomain.domain} has been verified`
|
||||
message: `${selectedProxyRule.domain} has been verified`
|
||||
});
|
||||
trackEvent(Submit.DomainUpdateVerification);
|
||||
} catch (e) {
|
||||
@@ -104,13 +104,13 @@
|
||||
<Divider />
|
||||
</div>
|
||||
{#if selectedTab === 'nameserver'}
|
||||
<NameserverTable domain={selectedDomain.domain} {verified} />
|
||||
<NameserverTable domain={selectedProxyRule.domain} {verified} />
|
||||
{:else}
|
||||
<RecordTable
|
||||
{verified}
|
||||
service="sites"
|
||||
variant={selectedTab}
|
||||
domain={selectedDomain.domain} />
|
||||
domain={selectedProxyRule.domain} />
|
||||
{/if}
|
||||
|
||||
<svelte:fragment slot="footer">
|
||||
|
||||
+22
-18
@@ -19,14 +19,22 @@
|
||||
import { columns } from './store';
|
||||
|
||||
let {
|
||||
domains
|
||||
proxyRules
|
||||
}: {
|
||||
domains: Models.ProxyRuleList;
|
||||
proxyRules: Models.ProxyRuleList;
|
||||
} = $props();
|
||||
|
||||
let showDelete = $state(false);
|
||||
let showRetry = $state(false);
|
||||
let selectedDomain: Models.ProxyRule = $state(null);
|
||||
let selectedProxyRule: Models.ProxyRule = $state(null);
|
||||
|
||||
const proxyTarget = (proxy: Models.ProxyRule) => {
|
||||
return proxy?.redirectUrl
|
||||
? 'Redirect to ' + proxy.redirectUrl
|
||||
: proxy?.deploymentVcsProviderBranch
|
||||
? 'Deployed from' + proxy.deploymentVcsProviderBranch
|
||||
: 'Active deployment';
|
||||
};
|
||||
</script>
|
||||
|
||||
<Table.Root columns={[...$columns, { id: 'actions', width: 40 }]} let:root>
|
||||
@@ -38,25 +46,25 @@
|
||||
{/each}
|
||||
<Table.Header.Cell column="actions" {root} />
|
||||
</svelte:fragment>
|
||||
{#each domains.rules as domain}
|
||||
{#each proxyRules.rules as rule}
|
||||
<Table.Row.Base {root}>
|
||||
{#each $columns as column}
|
||||
<Table.Cell column={column.id} {root}>
|
||||
{#if column.id === 'domain'}
|
||||
<Layout.Stack direction="row" gap="xs">
|
||||
<Link external href={`${$protocol}${domain.domain}`} variant="quiet">
|
||||
<Link external href={`${$protocol}${rule.domain}`} variant="quiet">
|
||||
<Typography.Text truncate>
|
||||
{domain.domain}
|
||||
{rule.domain}
|
||||
</Typography.Text>
|
||||
</Link>
|
||||
|
||||
{#if domain.status === 'verifying'}
|
||||
{#if rule.status === 'verifying'}
|
||||
<Badge
|
||||
variant="secondary"
|
||||
type="warning"
|
||||
content="Verifying"
|
||||
size="s" />
|
||||
{:else if domain.status !== 'verified'}
|
||||
{:else if rule.status !== 'verified'}
|
||||
<Badge
|
||||
variant="secondary"
|
||||
type="error"
|
||||
@@ -65,11 +73,7 @@
|
||||
{/if}
|
||||
</Layout.Stack>
|
||||
{:else if column.id === 'target'}
|
||||
{domain?.redirectUrl
|
||||
? 'Redirect to ' + domain.redirectUrl
|
||||
: domain?.deploymentVcsProviderBranch
|
||||
? 'Deployed from' + domain.deploymentVcsProviderBranch
|
||||
: '-'}
|
||||
{proxyTarget(rule)}
|
||||
{/if}
|
||||
</Table.Cell>
|
||||
{/each}
|
||||
@@ -88,11 +92,11 @@
|
||||
|
||||
<svelte:fragment slot="tooltip" let:toggle>
|
||||
<ActionMenu.Root>
|
||||
{#if domain.status !== 'verified'}
|
||||
{#if rule.status !== 'verified'}
|
||||
<ActionMenu.Item.Button
|
||||
leadingIcon={IconRefresh}
|
||||
on:click={(e) => {
|
||||
selectedDomain = domain;
|
||||
selectedProxyRule = rule;
|
||||
showRetry = true;
|
||||
toggle(e);
|
||||
}}>
|
||||
@@ -103,7 +107,7 @@
|
||||
status="danger"
|
||||
leadingIcon={IconTrash}
|
||||
on:click={(e) => {
|
||||
selectedDomain = domain;
|
||||
selectedProxyRule = rule;
|
||||
showDelete = true;
|
||||
toggle(e);
|
||||
trackEvent(Click.DomainDeleteClick, {
|
||||
@@ -122,9 +126,9 @@
|
||||
</Table.Root>
|
||||
|
||||
{#if showDelete}
|
||||
<DeleteDomainModal bind:show={showDelete} {selectedDomain} />
|
||||
<DeleteDomainModal bind:show={showDelete} {selectedProxyRule} />
|
||||
{/if}
|
||||
|
||||
{#if showRetry}
|
||||
<RetryDomainModal bind:show={showRetry} {selectedDomain} />
|
||||
<RetryDomainModal bind:show={showRetry} {selectedProxyRule} />
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user