From cd550741727f4cdbc393adc2e2d0447a5124cbac Mon Sep 17 00:00:00 2001 From: Arman Date: Thu, 20 Feb 2025 17:04:23 +0100 Subject: [PATCH] feat: more work on domains --- .../domains/deleteDomainModal.svelte | 5 +- .../domains/domain-[domain]/+layout.ts | 2 +- .../domain-[domain]/addPresetModal.svelte | 1 - .../deleteCertificateModal.svelte | 6 +- .../domain-[domain]/createRecordModal.svelte | 8 +- .../domain-[domain]/deleteRecordModal.svelte | 35 ++++ .../domain-[domain]/editRecordModal.svelte | 152 ++++++++++++++++++ .../domains/domain-[domain]/table.svelte | 8 +- 8 files changed, 203 insertions(+), 14 deletions(-) create mode 100644 src/routes/(console)/organization-[organization]/domains/domain-[domain]/deleteRecordModal.svelte create mode 100644 src/routes/(console)/organization-[organization]/domains/domain-[domain]/editRecordModal.svelte diff --git a/src/routes/(console)/organization-[organization]/domains/deleteDomainModal.svelte b/src/routes/(console)/organization-[organization]/domains/deleteDomainModal.svelte index 98e11b70d..4e477cc7b 100644 --- a/src/routes/(console)/organization-[organization]/domains/deleteDomainModal.svelte +++ b/src/routes/(console)/organization-[organization]/domains/deleteDomainModal.svelte @@ -29,10 +29,7 @@ } -

Are you sure you want to delete {selectedDomain?.domain}?

-

- You will no longer be able to access any projects or services associated with this domain. -

+

Your site will no longer be available at this domain. This action is irreversible.

diff --git a/src/routes/(console)/organization-[organization]/domains/domain-[domain]/+layout.ts b/src/routes/(console)/organization-[organization]/domains/domain-[domain]/+layout.ts index 2256854df..fed93acca 100644 --- a/src/routes/(console)/organization-[organization]/domains/domain-[domain]/+layout.ts +++ b/src/routes/(console)/organization-[organization]/domains/domain-[domain]/+layout.ts @@ -4,7 +4,7 @@ import { Dependencies } from '$lib/constants'; import { sdk } from '$lib/stores/sdk'; export const load = async ({ depends, params }) => { - depends(Dependencies.SITE); + depends(Dependencies.DOMAIN); return { domain: await sdk.forConsole.domains.get(params.domain), diff --git a/src/routes/(console)/organization-[organization]/domains/domain-[domain]/addPresetModal.svelte b/src/routes/(console)/organization-[organization]/domains/domain-[domain]/addPresetModal.svelte index 61b30d753..76534c2ef 100644 --- a/src/routes/(console)/organization-[organization]/domains/domain-[domain]/addPresetModal.svelte +++ b/src/routes/(console)/organization-[organization]/domains/domain-[domain]/addPresetModal.svelte @@ -4,7 +4,6 @@ import { addNotification } from '$lib/stores/notifications'; import { Submit, trackError, trackEvent } from '$lib/actions/analytics'; import { Skeleton, Table } from '@appwrite.io/pink-svelte'; - import { onMount } from 'svelte'; import { capitalize } from '$lib/helpers/string'; export let show = false; diff --git a/src/routes/(console)/organization-[organization]/domains/domain-[domain]/certificates/deleteCertificateModal.svelte b/src/routes/(console)/organization-[organization]/domains/domain-[domain]/certificates/deleteCertificateModal.svelte index f0f5ec638..8ea29833c 100644 --- a/src/routes/(console)/organization-[organization]/domains/domain-[domain]/certificates/deleteCertificateModal.svelte +++ b/src/routes/(console)/organization-[organization]/domains/domain-[domain]/certificates/deleteCertificateModal.svelte @@ -1,11 +1,9 @@ - Are you sure you want to delete SSL certificate? This action is irreversible. + Are you sure you want to delete this SSL certificate? This action is irreversible. diff --git a/src/routes/(console)/organization-[organization]/domains/domain-[domain]/createRecordModal.svelte b/src/routes/(console)/organization-[organization]/domains/domain-[domain]/createRecordModal.svelte index 0571b00e4..545390677 100644 --- a/src/routes/(console)/organization-[organization]/domains/domain-[domain]/createRecordModal.svelte +++ b/src/routes/(console)/organization-[organization]/domains/domain-[domain]/createRecordModal.svelte @@ -68,7 +68,7 @@ } ]; let name: string; - let type: RecordType; + let type: RecordType = 'A'; let value: string; let ttl = 3600; let priority: number; @@ -99,9 +99,10 @@ - + + {options.find((option) => option.value === type)?.helper} @@ -109,7 +110,8 @@ - {options.find((option) => option.value === type)?.helper} + Enter the target or destination for this DNS record (e.g., IP address, hostname, + or other required data) diff --git a/src/routes/(console)/organization-[organization]/domains/domain-[domain]/deleteRecordModal.svelte b/src/routes/(console)/organization-[organization]/domains/domain-[domain]/deleteRecordModal.svelte new file mode 100644 index 000000000..e298d520b --- /dev/null +++ b/src/routes/(console)/organization-[organization]/domains/domain-[domain]/deleteRecordModal.svelte @@ -0,0 +1,35 @@ + + + +

Are you sure you want to delete this record? This action is irreversible.

+
diff --git a/src/routes/(console)/organization-[organization]/domains/domain-[domain]/editRecordModal.svelte b/src/routes/(console)/organization-[organization]/domains/domain-[domain]/editRecordModal.svelte new file mode 100644 index 000000000..0571b00e4 --- /dev/null +++ b/src/routes/(console)/organization-[organization]/domains/domain-[domain]/editRecordModal.svelte @@ -0,0 +1,152 @@ + + + + + DNS records map domain names to IP addresses or other resources. + + + + + + + + + + + + + + + {options.find((option) => option.value === type)?.helper} + + + + + + + + + TTL defines how long DNS information is cached. Lower values update faster; + higher values reduce server load. + + + + + + + + Sets the priority for this DNS record. Lower numbers indicate higher + priority (e.g., 10 is higher than 20). + + + + + + + + + + + + + diff --git a/src/routes/(console)/organization-[organization]/domains/domain-[domain]/table.svelte b/src/routes/(console)/organization-[organization]/domains/domain-[domain]/table.svelte index e845733eb..184af04ed 100644 --- a/src/routes/(console)/organization-[organization]/domains/domain-[domain]/table.svelte +++ b/src/routes/(console)/organization-[organization]/domains/domain-[domain]/table.svelte @@ -15,6 +15,8 @@ import { columns } from './store'; import { timeFromNow } from '$lib/helpers/date'; import type { Models } from '@appwrite.io/console'; + import DeleteRecordModal from './deleteRecordModal.svelte'; + import { capitalize } from '$lib/helpers/string'; export let data; @@ -79,7 +81,7 @@ {:else if column.id === '$createdAt'} - {timeFromNow(record.$createdAt)} + {capitalize(timeFromNow(record.$createdAt))} {/if} @@ -137,3 +139,7 @@ offset={data.offset} total={data.recordList.total} />
+ +{#if showDelete} + +{/if}