Skip to content
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f044340
Add new badges to site domains
vermakhushboo Sep 12, 2025
6df5f66
Merge branch 'main' into feat-improve-domain-flows
vermakhushboo Sep 15, 2025
995ef38
Add badges and links to functions/projects tables
vermakhushboo Sep 16, 2025
8ddcc95
Merge branch 'main' into feat-improve-domain-flows
vermakhushboo Sep 16, 2025
bb6c951
Fix verification flows for sites/functions/api
vermakhushboo Sep 17, 2025
8602eb4
Merge branch 'main' into feat-improve-domain-flows
vermakhushboo Sep 17, 2025
bfe9c92
Simplify timeFromNowShort function
vermakhushboo Sep 19, 2025
2ee96d1
Merge branch 'main' into feat-improve-domain-flows
vermakhushboo Sep 19, 2025
15e56c3
Add CNAME flattening changes
vermakhushboo Sep 19, 2025
2b68cf9
Add comment to empty catch block
vermakhushboo Sep 22, 2025
ce61ac0
Comment addressal
vermakhushboo Sep 22, 2025
625273d
Merge branch 'main' into feat-improve-domain-flows
vermakhushboo Sep 23, 2025
2fcdf31
Handle TLDs with multiple dots
vermakhushboo Sep 23, 2025
18de91d
Create and verify domain in background
vermakhushboo Sep 24, 2025
37571a0
Merge branch 'main' into feat-improve-domain-flows
vermakhushboo Sep 26, 2025
ffbab00
Change links to quiet-muted
vermakhushboo Sep 26, 2025
f81d05e
Migrate to svelte 5 syntax
vermakhushboo Sep 26, 2025
bf84ce6
Show view logs link if logs are not empty
vermakhushboo Sep 26, 2025
f8c2629
Resolve merge conflicts
vermakhushboo Oct 8, 2025
e41a191
Make records copy dynamic based on presence/absence of CAA row
vermakhushboo Oct 9, 2025
1faadf9
Fix error that always showed domain verified notification even on fai…
vermakhushboo Oct 9, 2025
160e9c0
Merge branch 'main' into feat-improve-domain-flows
vermakhushboo Oct 9, 2025
cb45348
Show certificate logs for verified state too
vermakhushboo Oct 13, 2025
71b7997
Merge branch 'main' into feat-improve-domain-flows
vermakhushboo Oct 13, 2025
6abb277
Update table without having to refresh
vermakhushboo Oct 13, 2025
493ad69
No in line view logs for verified
vermakhushboo Oct 13, 2025
11f7c13
Attempt to add auto-refresh
vermakhushboo Oct 13, 2025
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
40 changes: 34 additions & 6 deletions src/lib/components/domains/cnameTable.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
import { regionalConsoleVariables } from '$routes/(console)/project-[region]-[project]/store';

export let domain: string;
export let verified = undefined;
export let verified: boolean | undefined = undefined;
export let ruleStatus: string | undefined = undefined;

let subdomain = domain.split('.').slice(0, -2).join('.');
</script>
Expand All @@ -23,15 +24,23 @@
<Typography.Text variant="l-500" color="--fgcolor-neutral-primary">
{domain}
</Typography.Text>
{#if verified === true}
{#if ruleStatus === 'created'}
<Badge variant="secondary" type="error" size="xs" content="Verification failed" />
{:else if ruleStatus === 'verifying'}
<Badge variant="secondary" size="xs" content="Generating certificate" />
{:else if ruleStatus === 'unverified'}
<Badge
variant="secondary"
type="error"
size="xs"
content="Certificate generation failed" />
{:else if verified === true}
<Badge variant="secondary" type="success" size="xs" content="Verified" />
Comment on lines +40 to 51
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Handle ruleStatus === 'verified' explicitly.

Show the success badge when status is verified even if verified flag isn’t set.

-            {:else if ruleStatus === 'unverified'}
+            {:else if ruleStatus === 'unverified'}
                 <Badge
                     variant="secondary"
                     type="error"
                     size="xs"
                     content="Certificate generation failed" />
-            {:else if verified === true}
+            {:else if ruleStatus === 'verified' || verified === true}
                 <Badge variant="secondary" type="success" size="xs" content="Verified" />
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{#if ruleStatus === 'created'}
<Badge variant="secondary" type="error" size="xs" content="Verification failed" />
{:else if ruleStatus === 'verifying'}
<Badge variant="secondary" size="xs" content="Generating certificate" />
{:else if ruleStatus === 'unverified'}
<Badge
variant="secondary"
type="error"
size="xs"
content="Certificate generation failed" />
{:else if verified === true}
<Badge variant="secondary" type="success" size="xs" content="Verified" />
{#if ruleStatus === 'created'}
<Badge variant="secondary" type="error" size="xs" content="Verification failed" />
{:else if ruleStatus === 'verifying'}
<Badge variant="secondary" size="xs" content="Generating certificate" />
{:else if ruleStatus === 'unverified'}
<Badge
variant="secondary"
type="error"
size="xs"
content="Certificate generation failed" />
{:else if ruleStatus === 'verified' || verified === true}
<Badge variant="secondary" type="success" size="xs" content="Verified" />
🤖 Prompt for AI Agents
In src/lib/components/domains/cnameTable.svelte around lines 40 to 51, the
current conditional omits handling for ruleStatus === 'verified' and only shows
the success badge when verified === true; update the conditional flow to
explicitly check for ruleStatus === 'verified' (render the success Badge) before
the final verified === true fallback so that a 'verified' status always shows
the success badge regardless of the verified flag, keeping the existing other
branches intact.

{:else if verified === false}
<Badge variant="secondary" type="warning" size="xs" content="Verification failed" />
{/if}
</Layout.Stack>
<Typography.Text variant="m-400">
Add the following record on your DNS provider. Note that DNS changes may take time to
propagate fully.
Add the following record on your DNS provider. Note that DNS changes may take up to 48
hours to propagate fully.
</Typography.Text>
</Layout.Stack>

Expand All @@ -51,6 +60,25 @@
text={$regionalConsoleVariables._APP_DOMAIN_TARGET_CNAME} />
</Table.Cell>
</Table.Row.Base>
{#if $regionalConsoleVariables._APP_DOMAIN_TARGET_CAA}
<Table.Row.Base {root}>
<Table.Cell {root}>
<Layout.Stack gap="s" direction="row" alignItems="center">
<span>CAA</span>
<Badge variant="secondary" size="xs" content="Recommended" />
</Layout.Stack>
</Table.Cell>
<Table.Cell {root}>@</Table.Cell>
<Table.Cell {root}>
<InteractiveText
variant="copy"
isVisible
text={$regionalConsoleVariables._APP_DOMAIN_TARGET_CAA.includes(' ')
? $regionalConsoleVariables._APP_DOMAIN_TARGET_CAA
: `0 issue "${$regionalConsoleVariables._APP_DOMAIN_TARGET_CAA}"`} />
</Table.Cell>
</Table.Row.Base>
{/if}
</Table.Root>
<Layout.Stack gap="s" direction="row" alignItems="center">
<Icon icon={IconInfo} size="s" color="--fgcolor-neutral-secondary" />
Expand Down
5 changes: 5 additions & 0 deletions src/lib/components/domains/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export { default as ViewLogsModal } from './viewLogsModal.svelte';
export { default as CnameTable } from './cnameTable.svelte';
export { default as DnsRecordsAction } from './dnsRecordsAction.svelte';
export { default as NameserverTable } from './nameserverTable.svelte';
export { default as RecordTable } from './recordTable.svelte';
17 changes: 13 additions & 4 deletions src/lib/components/domains/nameserverTable.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import { Badge, Layout, Typography, Table, InteractiveText } from '@appwrite.io/pink-svelte';
export let domain: string;
export let verified = undefined;
export let verified: boolean | undefined = undefined;
export let ruleStatus: string | undefined = undefined;
const nameserverList = $regionalConsoleVariables?._APP_DOMAINS_NAMESERVERS
? $regionalConsoleVariables?._APP_DOMAINS_NAMESERVERS?.split(',')
Expand All @@ -16,10 +17,18 @@
<Typography.Text variant="l-500" color="--fgcolor-neutral-primary">
{domain}
</Typography.Text>
{#if verified === true}
{#if ruleStatus === 'created'}
<Badge variant="secondary" type="error" size="xs" content="Verification failed" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this correct? does ruleStatus === 'created mean it failed verification? is there no other status on rule?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per backend, created = verification failed, verifying = 'generating certificate', unverified = 'certificate generation failed', verified = verified

{:else if ruleStatus === 'verifying'}
<Badge variant="secondary" size="xs" content="Generating certificate" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we not use a warning [orange] variant in similar places for different states? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not as per new design, only in org > domains table

{:else if ruleStatus === 'unverified'}
<Badge
variant="secondary"
type="error"
size="xs"
content="Certificate generation failed" />
{:else if verified === true}
<Badge variant="secondary" type="success" size="xs" content="Verified" />
Comment on lines +26 to 37
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Handle ruleStatus === 'verified' explicitly.

If callers pass only ruleStatus without toggling verified=true, the "Verified" badge won’t render. Add a branch for ruleStatus === 'verified'.

-        {:else if ruleStatus === 'unverified'}
+        {:else if ruleStatus === 'unverified'}
             <Badge
                 variant="secondary"
                 type="error"
                 size="xs"
                 content="Certificate generation failed" />
-        {:else if verified === true}
+        {:else if ruleStatus === 'verified' || verified === true}
             <Badge variant="secondary" type="success" size="xs" content="Verified" />
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{#if ruleStatus === 'created'}
<Badge variant="secondary" type="error" size="xs" content="Verification failed" />
{:else if ruleStatus === 'verifying'}
<Badge variant="secondary" size="xs" content="Generating certificate" />
{:else if ruleStatus === 'unverified'}
<Badge
variant="secondary"
type="error"
size="xs"
content="Certificate generation failed" />
{:else if verified === true}
<Badge variant="secondary" type="success" size="xs" content="Verified" />
{#if ruleStatus === 'created'}
<Badge variant="secondary" type="error" size="xs" content="Verification failed" />
{:else if ruleStatus === 'verifying'}
<Badge variant="secondary" size="xs" content="Generating certificate" />
{:else if ruleStatus === 'unverified'}
<Badge
variant="secondary"
type="error"
size="xs"
content="Certificate generation failed" />
{:else if ruleStatus === 'verified' || verified === true}
<Badge variant="secondary" type="success" size="xs" content="Verified" />
{/if}
🤖 Prompt for AI Agents
In src/lib/components/domains/nameserverTable.svelte around lines 26 to 37, the
template lacks an explicit branch for ruleStatus === 'verified' so if callers
set ruleStatus to 'verified' but don't set verified=true the "Verified" badge
never renders; add an {:else if ruleStatus === 'verified'} branch (before the
final {:else if verified === true} or replace the final check) that renders the
same Badge as the verified=true case (variant="secondary" type="success"
size="xs" content="Verified"), ensuring the verified state is handled
consistently by ruleStatus alone.

{:else if verified === false}
<Badge variant="secondary" type="warning" size="xs" content="Verification failed" />
{/if}
</Layout.Stack>
<Typography.Text variant="m-400">
Expand Down
85 changes: 70 additions & 15 deletions src/lib/components/domains/recordTable.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,28 @@
Alert
} from '@appwrite.io/pink-svelte';
import { regionalConsoleVariables } from '$routes/(console)/project-[region]-[project]/store';
import { isCloud } from '$lib/system';

export let domain: string;
export let verified = undefined;
export let verified: boolean | undefined = undefined;
export let variant: 'cname' | 'a' | 'aaaa';
export let service: 'sites' | 'general' = 'general';
export let ruleStatus: string | undefined = undefined;
export let onNavigateToNameservers: () => void = () => {};
export let onNavigateToA: () => void = () => {};
export let onNavigateToAAAA: () => void = () => {};

let subdomain = domain?.split('.')?.slice(0, -2)?.join('.');

const aTabVisible =
!isCloud &&
!!$regionalConsoleVariables._APP_DOMAIN_TARGET_A &&
$regionalConsoleVariables._APP_DOMAIN_TARGET_A !== '127.0.0.1';
const aaaaTabVisible =
!isCloud &&
!!$regionalConsoleVariables._APP_DOMAIN_TARGET_AAAA &&
$regionalConsoleVariables._APP_DOMAIN_TARGET_AAAA !== '::1';

function setTarget() {
switch (variant) {
case 'cname':
Expand All @@ -37,15 +51,23 @@
<Typography.Text variant="l-500" color="--fgcolor-neutral-primary">
{domain}
</Typography.Text>
{#if verified === true}
{#if ruleStatus === 'created'}
<Badge variant="secondary" type="error" size="xs" content="Verification failed" />
{:else if ruleStatus === 'verifying'}
<Badge variant="secondary" size="xs" content="Generating certificate" />
Comment on lines +78 to +81
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

{:else if ruleStatus === 'unverified'}
<Badge
variant="secondary"
type="error"
size="xs"
content="Certificate generation failed" />
{:else if verified === true}
<Badge variant="secondary" type="success" size="xs" content="Verified" />
{:else if verified === false}
<Badge variant="secondary" type="warning" size="xs" content="Verification failed" />
{/if}
Comment on lines +78 to 90
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Handle ruleStatus === 'verified'.

Render success badge when status is verified even if verified flag isn’t true.

-            {:else if ruleStatus === 'unverified'}
+            {:else if ruleStatus === 'unverified'}
                 <Badge
                     variant="secondary"
                     type="error"
                     size="xs"
                     content="Certificate generation failed" />
-            {:else if verified === true}
+            {:else if ruleStatus === 'verified' || verified === true}
                 <Badge variant="secondary" type="success" size="xs" content="Verified" />
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{#if ruleStatus === 'created'}
<Badge variant="secondary" type="error" size="xs" content="Verification failed" />
{:else if ruleStatus === 'verifying'}
<Badge variant="secondary" size="xs" content="Generating certificate" />
{:else if ruleStatus === 'unverified'}
<Badge
variant="secondary"
type="error"
size="xs"
content="Certificate generation failed" />
{:else if verified === true}
<Badge variant="secondary" type="success" size="xs" content="Verified" />
{:else if verified === false}
<Badge variant="secondary" type="warning" size="xs" content="Verification failed" />
{/if}
{#if ruleStatus === 'created'}
<Badge variant="secondary" type="error" size="xs" content="Verification failed" />
{:else if ruleStatus === 'verifying'}
<Badge variant="secondary" size="xs" content="Generating certificate" />
{:else if ruleStatus === 'unverified'}
<Badge
variant="secondary"
type="error"
size="xs"
content="Certificate generation failed" />
{:else if ruleStatus === 'verified' || verified === true}
<Badge variant="secondary" type="success" size="xs" content="Verified" />
{/if}
🤖 Prompt for AI Agents
In src/lib/components/domains/recordTable.svelte around lines 74 to 86, the
template currently only renders the "Verified" success badge when the verified
flag is true, but the review requests handling ruleStatus === 'verified' too;
update the conditional so the success badge is shown when ruleStatus ===
'verified' OR verified === true (either by adding an else if branch for
ruleStatus === 'verified' before the final check, or by changing the final
condition to check ruleStatus === 'verified' || verified === true), ensuring the
"Verified" Badge renders for the 'verified' status even if the verified boolean
is false.

</Layout.Stack>
<Typography.Text variant="m-400">
Add the following record on your DNS provider. Note that DNS changes may take time to
propagate fully.
Add the following record on your DNS provider. Note that DNS changes may take up to 48
hours to propagate fully.
</Typography.Text>
</Layout.Stack>

Expand All @@ -62,17 +84,50 @@
<InteractiveText variant="copy" isVisible text={setTarget()} />
</Table.Cell>
</Table.Row.Base>
{#if $regionalConsoleVariables._APP_DOMAIN_TARGET_CAA}
<Table.Row.Base {root}>
<Table.Cell {root}>
<Layout.Stack gap="s" direction="row" alignItems="center">
<span>CAA</span>
<Badge variant="secondary" size="xs" content="Recommended" />
</Layout.Stack>
</Table.Cell>
<Table.Cell {root}>@</Table.Cell>
<Table.Cell {root}>
<InteractiveText
variant="copy"
isVisible
text={$regionalConsoleVariables._APP_DOMAIN_TARGET_CAA.includes(' ')
? $regionalConsoleVariables._APP_DOMAIN_TARGET_CAA
: `0 issue "${$regionalConsoleVariables._APP_DOMAIN_TARGET_CAA}"`} />
</Table.Cell>
</Table.Row.Base>
{/if}
</Table.Root>
<Layout.Stack gap="s" direction="row" alignItems="center">
{#if variant === 'cname'}
<Alert.Inline>
If your domain uses CAA records, ensure certainly.com is authorized — otherwise, SSL
setup may fail. A list of all domain providers and their DNS setting is available <Link
variant="muted"
external
href="https://appwrite.io/docs/advanced/platform/custom-domains">here</Link
>.
</Alert.Inline>
{#if variant === 'cname' && !subdomain}
{#if isCloud}
<Alert.Inline>
Since <Badge variant="secondary" size="s" content={domain} /> is an apex domain,
CNAME record is only supported by certain providers. If yours doesn't, please verify
using
<Link variant="muted" on:click={onNavigateToNameservers}>nameservers</Link> instead.
</Alert.Inline>
{:else if aTabVisible || aaaaTabVisible}
<Alert.Inline>
Since <Badge variant="secondary" size="s" content={domain} /> is an apex domain,
CNAME record is only supported by certain providers. If yours doesn't, please verify
using
{#if aTabVisible}
<Link variant="muted" on:click={onNavigateToA}>A record</Link>
{#if aaaaTabVisible}
or <Link variant="muted" on:click={onNavigateToAAAA}>AAAA record</Link
>{/if}
{:else if aaaaTabVisible}
<Link variant="muted" on:click={onNavigateToAAAA}>AAAA record</Link>
{/if} instead.
</Alert.Inline>
{/if}
Comment on lines +129 to +151
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Migrate event handlers to Svelte 5 syntax.

Use onclick instead of on:click. This aligns with project-wide Svelte 5 migration. Based on learnings

-                    <Link variant="muted" on:click={onNavigateToNameservers}>nameservers</Link> instead.
+                    <Link variant="muted" onclick={onNavigateToNameservers}>nameservers</Link> instead.
...
-                        <Link variant="muted" on:click={onNavigateToA}>A record</Link>
+                        <Link variant="muted" onclick={onNavigateToA}>A record</Link>
-                            or <Link variant="muted" on:click={onNavigateToAAAA}>AAAA record</Link
+                            or <Link variant="muted" onclick={onNavigateToAAAA}>AAAA record</Link
                             >{/if}
-                    {:else if aaaaTabVisible}
-                        <Link variant="muted" on:click={onNavigateToAAAA}>AAAA record</Link>
+                    {:else if aaaaTabVisible}
+                        <Link variant="muted" onclick={onNavigateToAAAA}>AAAA record</Link>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{#if variant === 'cname' && !subdomain}
{#if isCloud}
<Alert.Inline>
Since <Badge variant="secondary" size="s" content={domain} /> is an apex domain,
CNAME record is only supported by certain providers. If yours doesn't, please verify
using
<Link variant="muted" on:click={onNavigateToNameservers}>nameservers</Link> instead.
</Alert.Inline>
{:else if aTabVisible || aaaaTabVisible}
<Alert.Inline>
Since <Badge variant="secondary" size="s" content={domain} /> is an apex domain,
CNAME record is only supported by certain providers. If yours doesn't, please verify
using
{#if aTabVisible}
<Link variant="muted" on:click={onNavigateToA}>A record</Link>
{#if aaaaTabVisible}
or <Link variant="muted" on:click={onNavigateToAAAA}>AAAA record</Link
>{/if}
{:else if aaaaTabVisible}
<Link variant="muted" on:click={onNavigateToAAAA}>AAAA record</Link>
{/if} instead.
</Alert.Inline>
{/if}
{#if variant === 'cname' && !subdomain}
{#if isCloud}
<Alert.Inline>
Since <Badge variant="secondary" size="s" content={domain} /> is an apex domain,
CNAME record is only supported by certain providers. If yours doesn't, please verify
using
<Link variant="muted" onclick={onNavigateToNameservers}>nameservers</Link> instead.
</Alert.Inline>
{:else if aTabVisible || aaaaTabVisible}
<Alert.Inline>
Since <Badge variant="secondary" size="s" content={domain} /> is an apex domain,
CNAME record is only supported by certain providers. If yours doesn't, please verify
using
{#if aTabVisible}
<Link variant="muted" onclick={onNavigateToA}>A record</Link>
{#if aaaaTabVisible}
or <Link variant="muted" onclick={onNavigateToAAAA}>AAAA record</Link
>{/if}
{:else if aaaaTabVisible}
<Link variant="muted" onclick={onNavigateToAAAA}>AAAA record</Link>
{/if} instead.
</Alert.Inline>
{/if}
🤖 Prompt for AI Agents
In src/lib/components/domains/recordTable.svelte around lines 123 to 145, the
event handlers use the Svelte 3 "on:click" syntax; migrate them to Svelte 5 by
replacing on:click={...} with the onclick={...} prop on the Link components
(apply to onNavigateToNameservers, onNavigateToA, and onNavigateToAAAA),
ensuring no other behavior changes and preserving existing casing and props.

{:else}
<Typography.Text variant="m-400" color="--fgcolor-neutral-secondary">
A list of all domain providers and their DNS setting is available <Link
Expand Down
1 change: 1 addition & 0 deletions src/lib/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,4 @@ export { default as ExpirationInput } from './expirationInput.svelte';
export { default as EstimatedCard } from './estimatedCard.svelte';
export { default as EmailVerificationBanner } from './alerts/emailVerificationBanner.svelte';
export { default as SortButton, type SortDirection } from './sortButton.svelte';
export * from './domains';
15 changes: 15 additions & 0 deletions src/lib/helpers/date.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,21 @@ export function timeFromNow(datetime: string): string {
return dayjs().to(dayjs(datetime));
}

export function timeFromNowShort(datetime: string): string {
if (!datetime) {
return 'unknown time';
}
if (!isValidDate(datetime)) {
return 'invalid date';
}

const timeStr = dayjs().to(dayjs(datetime));
return timeStr
.replace('second', 'sec') // seconds > secs
.replace('minute', 'min') // minutes > mins
.replace('hour', 'hr'); // hours > hrs
}

export function hoursToDays(hours: number) {
if (hours > 24) {
return `${Math.floor(hours / 24)} days`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
Navigate to your domain provider and update the nameservers to <InlineCode
code="ns1.appwrite-dns.com"
size="s" /> and <InlineCode code="ns2.appwrite-dns.com" size="s" />.
Note that DNS changes may take time to propagate fully.
Note that DNS changes may take up to 48 hours to propagate fully.
</span>
<svelte:fragment slot="actions">
<Button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,24 +48,16 @@

async function addDomain() {
const apexDomain = getApexDomain(domainName);
let domain = data.domains?.domains.find((d: Models.Domain) => d.domain === apexDomain);
let domain: Models.Domain;

if (apexDomain && !domain && isCloud) {
if (isCloud && apexDomain) {
try {
domain = await sdk.forConsole.domains.create({
teamId: $project.teamId,
domain: apexDomain
});
} catch (error) {
// apex might already be added on organization level, skip.
const alreadyAdded = error?.type === 'domain_already_exists';
if (!alreadyAdded) {
addNotification({
type: 'error',
message: error.message
});
return;
}
// Empty as domain creation error needs to be silent
}
}

Expand Down Expand Up @@ -100,10 +92,15 @@
if (rule?.status === 'verified') {
await goto(routeBase);
await invalidate(Dependencies.FUNCTION_DOMAINS);
if (isCloud) {
try {
await sdk.forConsole.domains.updateNameservers({ domainId: domain.$id });
} catch (error) {
// Empty as domain update error needs to be silent
}
}
} else {
await goto(
`${routeBase}/add-domain/verify-${domainName}?rule=${rule.$id}&domain=${domain.$id}`
);
await goto(`${routeBase}/add-domain/verify-${domainName}?rule=${rule.$id}`);
await invalidate(Dependencies.FUNCTION_DOMAINS);
}
} catch (error) {
Expand Down
Loading