Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
} from '@appwrite.io/pink-icons-svelte';
import {
ActionMenu,
Badge,
Card,
Empty,
Icon,
Expand All @@ -38,6 +39,10 @@
let showDelete = false;
let showRetry = false;
let selectedDomain: Domain = null;

const isDomainVerified = (domain: Domain) => {
return domain.nameservers.toLocaleLowerCase() === 'appwrite';
};
</script>

<Container>
Expand Down Expand Up @@ -76,13 +81,23 @@
<Table.Cell column={column.id} {root}>
<Typography.Text truncate>
{#if column.id === 'domain'}
<Link
external
icon
href={`${$protocol}${domain.domain}`}
variant="quiet">
{domain.domain}
</Link>
<Layout.Stack direction="row" gap="xs">
<Link
external
href={`${$protocol}${domain.domain}`}
variant="quiet">
<Typography.Text truncate>
{domain.domain}
</Typography.Text>
</Link>
{#if !isDomainVerified(domain)}
<Badge
variant="secondary"
type="warning"
content="Not verified"
size="s" />
{/if}
</Layout.Stack>
{:else if column.id === 'registrar'}
{domain.registrar || '-'}
{:else if column.id === 'nameservers'}
Expand Down Expand Up @@ -113,7 +128,7 @@

<svelte:fragment slot="tooltip" let:toggle>
<ActionMenu.Root>
{#if domain.nameservers !== 'Appwrite'}
{#if isDomainVerified(domain)}
<ActionMenu.Item.Button
leadingIcon={IconRefresh}
on:click={(e) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@

async function addDomain() {
try {
domain = await sdk.forConsole.domains.create(page.params.organization, domainName);
domain = await sdk.forConsole.domains.create(
page.params.organization,
domainName.toLocaleLowerCase()
);
invalidate(Dependencies.DOMAINS);
} catch (error) {
addNotification({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
<script lang="ts">
import { Layout } from '@appwrite.io/pink-svelte';
import { Trim, UsageCard } from '$lib/components';
import { toLocaleDate } from '$lib/helpers/date';
import { UsageCard } from '$lib/components';
import type { Domain } from '$lib/sdk/domains';
import { Link } from '$lib/elements';
import { protocol } from '$routes/(console)/store';
import { toLocaleDate } from '$lib/helpers/date';
import { Layout, Status } from '@appwrite.io/pink-svelte';

export let domain: Domain;

$: isDomainVerified = domain.nameservers.toLocaleLowerCase() === 'appwrite';

let metrics = [
{
value: domain.domain,
description: 'Domain'
value: isDomainVerified ? 'Verified' : 'Not verified',
description: 'Status'
},
{
value: domain?.registrar || '-',
Expand All @@ -22,7 +23,7 @@
},
{
value: domain?.expiry ? toLocaleDate(domain?.expiry) : '-',
description: 'Exipiry date'
description: 'Expiry date'
},
{
value: domain?.autoRenewal ? 'On' : 'Off',
Expand All @@ -38,13 +39,11 @@
<Layout.Grid gap="m" columnsL={2} columns={1}>
<Layout.Stack direction="row" gap="m">
{#each metrics.slice(0, 3) as metric}
{#if metric.description === 'Domain'}
{#if metric.description === 'Status'}
<UsageCard description={metric.description}>
<Link external href={`${$protocol}/${metric.value}`} variant="quiet">
<Trim alternativeTrim>
{metric.value}
</Trim>
</Link>
<Status
label={metric.value.toString()}
status={isDomainVerified ? 'complete' : 'pending'} />
</UsageCard>
{:else}
<UsageCard description={metric.description} bind:value={metric.value} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import { derived, writable } from 'svelte/store';

export const domain = derived(page, ($page) => $page.data.domain as Domain);
export const columns = writable<Column[]>([
{ id: 'name', title: 'Name', type: 'string' },
{ id: 'type', title: 'Type', type: 'string' },
{ id: 'value', title: 'Value', type: 'string' },
{ id: 'ttl', title: 'TTL', type: 'integer' },
{ id: 'priority', title: 'Priority', type: 'integer', hide: true },
{ id: 'comment', title: 'Comment', type: 'string', hide: true },
{ id: 'name', title: 'Name', type: 'string', width: 150 },
{ id: 'type', title: 'Type', type: 'string', width: 125 },
{ id: 'value', title: 'Value', type: 'string', width: 250 },
{ id: 'ttl', title: 'TTL', type: 'integer', width: 100 },
{ id: 'priority', title: 'Priority', type: 'integer', width: 80, hide: true },
{ id: 'comment', title: 'Comment', type: 'string', width: 200, hide: true },
{ id: '$createdAt', title: 'Created', type: 'datetime' }
]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,15 @@
{record.type}
</Typography.Text>
{:else if column.id === 'value'}
<InteractiveText variant="copy" text={record.value} isVisible />
{@const isARecord = record.value === 'a.a.a.a'}
{#if isARecord}
<!-- to align with InteractiveText -->
<div style:padding-inline-start="4px">
<Typography.Text>Served by Appwrite</Typography.Text>
</div>
{:else}
<InteractiveText variant="copy" text={record.value} isVisible />
{/if}
{:else if column.id === 'ttl'}
<Typography.Text>
{record.ttl}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@

if (!domain && isCloud) {
try {
domain = await sdk.forConsole.domains.create($project.teamId, domainName);
domain = await sdk.forConsole.domains.create(
$project.teamId,
domainName.toLocaleLowerCase()
);
} catch (error) {
addNotification({
type: 'error',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,26 @@
{#each $columns as column}
<Table.Cell column={column.id} {root}>
{#if column.id === 'domain'}
<Link external href={`${$protocol}${domain.domain}`} variant="quiet" icon>
<Typography.Text truncate>
{domain.domain}
{#if domain.status !== 'verified'}
<Badge
variant="secondary"
type="error"
content="Verification failed"
size="s" />
{/if}
</Typography.Text>
</Link>
<Layout.Stack direction="row" gap="xs">
<Link external href={`${$protocol}${domain.domain}`} variant="quiet">
<Typography.Text truncate>
{domain.domain}
</Typography.Text>
</Link>
{#if domain.status === 'verifying'}
<Badge
variant="secondary"
type="warning"
content="Verifying"
size="s" />
{:else if domain.status !== 'verified'}
<Badge
variant="secondary"
type="error"
content="Verification failed"
size="s" />
{/if}
</Layout.Stack>
{:else if column.id === 'target'}
{domain?.redirectUrl
? 'Redirect to ' + domain.redirectUrl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@

if (!domain && isCloud) {
try {
domain = await sdk.forConsole.domains.create($project.teamId, domainName);
domain = await sdk.forConsole.domains.create(
$project.teamId,
domainName.toLocaleLowerCase()
);
} catch (error) {
addNotification({
type: 'error',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,26 @@
{#each $columns as column}
<Table.Cell column={column.id} {root}>
{#if column.id === 'domain'}
<Link external href={`${$protocol}${domain.domain}`} variant="quiet" icon>
<Typography.Text truncate>
{domain.domain}
{#if domain.status !== 'verified'}
<Badge
variant="secondary"
type="error"
content="Verification failed"
size="s" />
{/if}
</Typography.Text>
</Link>
<Layout.Stack direction="row" gap="xs">
<Link external href={`${$protocol}${domain.domain}`} variant="quiet">
<Typography.Text truncate>
{domain.domain}
</Typography.Text>
</Link>
{#if domain.status === 'verifying'}
<Badge
variant="secondary"
type="warning"
content="Verifying"
size="s" />
{:else if domain.status !== 'verified'}
<Badge
variant="secondary"
type="error"
content="Verification failed"
size="s" />
{/if}
</Layout.Stack>
{/if}
</Table.Cell>
{/each}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,15 @@

if (!domain && isCloud) {
try {
domain = await sdk.forConsole.domains.create($project.teamId, domainName);
domain = await sdk.forConsole.domains.create(
$project.teamId,
domainName.toLocaleLowerCase()
);
} catch (error) {
addNotification({
type: 'error',
message: error.message
});

return;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,24 +43,27 @@
{#each $columns as column}
<Table.Cell column={column.id} {root}>
{#if column.id === 'domain'}
<Link external href={`${$protocol}${domain.domain}`} variant="quiet" icon>
<Typography.Text truncate>
{domain.domain}
{#if domain.status === 'verifying'}
<Badge
variant="secondary"
type="warning"
content="Verifying"
size="s" />
{:else if domain.status !== 'verified'}
<Badge
variant="secondary"
type="error"
content="Verification failed"
size="s" />
{/if}
</Typography.Text>
</Link>
<Layout.Stack direction="row" gap="xs">
<Link external href={`${$protocol}${domain.domain}`} variant="quiet">
<Typography.Text truncate>
{domain.domain}
</Typography.Text>
</Link>

{#if domain.status === 'verifying'}
<Badge
variant="secondary"
type="warning"
content="Verifying"
size="s" />
{:else if domain.status !== 'verified'}
<Badge
variant="secondary"
type="error"
content="Verification failed"
size="s" />
{/if}
</Layout.Stack>
{:else if column.id === 'target'}
{domain?.redirectUrl
? 'Redirect to ' + domain.redirectUrl
Expand Down
Loading