Skip to content

Commit fad96f0

Browse files
committed
update: domain badges and verification consistency with errors.
1 parent fbd0737 commit fad96f0

File tree

10 files changed

+55
-48
lines changed

10 files changed

+55
-48
lines changed

src/lib/components/domains/cnameTable.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
{#if verified === true}
2727
<Badge variant="secondary" type="success" size="xs" content="Verified" />
2828
{:else if verified === false}
29-
<Badge variant="secondary" type="error" size="xs" content="Verification failed" />
29+
<Badge variant="secondary" type="warning" size="xs" content="Verification failed" />
3030
{/if}
3131
</Layout.Stack>
3232
<Typography.Text variant="m-400">

src/lib/components/domains/recordTable.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
{#if verified === true}
4141
<Badge variant="secondary" type="success" size="xs" content="Verified" />
4242
{:else if verified === false}
43-
<Badge variant="secondary" type="error" size="xs" content="Verification failed" />
43+
<Badge variant="secondary" type="warning" size="xs" content="Verification failed" />
4444
{/if}
4545
</Layout.Stack>
4646
<Typography.Text variant="m-400">

src/routes/(console)/organization-[organization]/domains/recordsCard.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
{#if verified === false}
7777
<Badge
7878
variant="secondary"
79-
type="error"
79+
type="warning"
8080
size="xs"
8181
content="Verification failed" />
8282
{:else if verified === true}

src/routes/(console)/organization-[organization]/domains/retryDomainModal.svelte

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,33 @@
1111
import { consoleVariables } from '$routes/(console)/store';
1212
import type { Models } from '@appwrite.io/console';
1313
14-
export let show = false;
15-
export let selectedDomain: Models.Domain;
14+
let {
15+
show = $bindable(),
16+
selectedDomain
17+
}: {
18+
show: boolean;
19+
selectedDomain: Models.ProxyRule;
20+
} = $props();
21+
1622
const nameservers = $consoleVariables?._APP_DOMAINS_NAMESERVERS.split(',') ?? [
1723
'ns1.appwrite.io',
1824
'ns2.appwrite.io'
1925
];
2026
21-
let error = null;
27+
let error = $state(null);
28+
2229
async function retryDomain() {
2330
try {
2431
const domain = await sdk.forConsole.domains.updateNameservers(selectedDomain.$id);
25-
show = false;
2632
if (domain.nameservers.toLowerCase() === 'appwrite') {
33+
show = false;
2734
addNotification({
2835
type: 'success',
2936
message: `${selectedDomain.domain} has been verified`
3037
});
3138
} else {
32-
addNotification({
33-
type: 'error',
34-
message:
35-
'Domain verification failed. Please check your domain settings or try again later'
36-
});
39+
error =
40+
'Domain verification failed. Please check your domain settings or try again later';
3741
}
3842
await invalidate(Dependencies.DOMAINS);
3943
trackEvent(Submit.DomainUpdateVerification);
@@ -43,9 +47,11 @@
4347
}
4448
}
4549
46-
$: if (!show) {
47-
error = null;
48-
}
50+
$effect(() => {
51+
if (!show) {
52+
error = null;
53+
}
54+
});
4955
</script>
5056

5157
<Modal title="Retry verification" bind:show onSubmit={retryDomain} bind:error>

src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/retryDomainModal.svelte

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,15 @@
1010
import type { Models } from '@appwrite.io/console';
1111
import { page } from '$app/state';
1212
13-
export let show = false;
14-
export let selectedProxyRule: Models.ProxyRule;
13+
let {
14+
show = $bindable(false),
15+
selectedProxyRule
16+
}: {
17+
show: boolean;
18+
selectedProxyRule: Models.ProxyRule;
19+
} = $props();
1520
16-
let error = null;
21+
let error = $state(null);
1722
async function retryProxyRule() {
1823
try {
1924
await sdk
@@ -32,9 +37,11 @@
3237
}
3338
}
3439
35-
$: if (!show) {
36-
error = null;
37-
}
40+
$effect(() => {
41+
if (!show) {
42+
error = null;
43+
}
44+
});
3845
</script>
3946

4047
<Modal title="Retry verification" bind:show onSubmit={retryProxyRule} bind:error>

src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/table.svelte

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,11 @@
6161
</Typography.Text>
6262
</Link>
6363
{#if proxyRule.status === 'verifying'}
64-
<Badge
65-
variant="secondary"
66-
type="warning"
67-
content="Verifying"
68-
size="s" />
64+
<Badge variant="secondary" content="Verifying" size="s" />
6965
{:else if proxyRule.status !== 'verified'}
7066
<Badge
7167
variant="secondary"
72-
type="error"
68+
type="warning"
7369
content="Verification failed"
7470
size="s" />
7571
{/if}

src/routes/(console)/project-[region]-[project]/settings/domains/retryDomainModal.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
show: boolean;
1818
selectedDomain: Models.ProxyRule;
1919
} = $props();
20-
let error = $state(null);
2120
21+
let error = $state(null);
2222
async function retryDomain() {
2323
try {
2424
await sdk

src/routes/(console)/project-[region]-[project]/settings/domains/table.svelte

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,11 @@
5353
</Typography.Text>
5454
</Link>
5555
{#if domain.status === 'verifying'}
56-
<Badge
57-
variant="secondary"
58-
type="warning"
59-
content="Verifying"
60-
size="s" />
56+
<Badge variant="secondary" content="Verifying" size="s" />
6157
{:else if domain.status !== 'verified'}
6258
<Badge
6359
variant="secondary"
64-
type="error"
60+
type="warning"
6561
content="Verification failed"
6662
size="s" />
6763
{/if}

src/routes/(console)/project-[region]-[project]/sites/site-[site]/domains/retryDomainModal.svelte

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,33 +39,39 @@
3939
}
4040
});
4141
42+
let error = $state(null);
4243
let verified = $state(false);
4344
4445
async function retryDomain() {
4546
try {
4647
const domain = await sdk
4748
.forProject(page.params.region, page.params.project)
4849
.proxy.updateRuleVerification(selectedProxyRule.$id);
49-
await invalidate(Dependencies.SITES_DOMAINS);
50-
verified = domain.status === 'verified';
50+
5151
show = false;
52+
verified = domain.status === 'verified';
53+
await invalidate(Dependencies.SITES_DOMAINS);
54+
5255
addNotification({
5356
type: 'success',
5457
message: `${selectedProxyRule.domain} has been verified`
5558
});
5659
trackEvent(Submit.DomainUpdateVerification);
5760
} catch (e) {
58-
addNotification({
59-
type: 'error',
60-
message:
61-
'Domain verification failed. Please check your domain settings or try again later'
62-
});
61+
error =
62+
'Domain verification failed. Please check your domain settings or try again later';
6363
trackError(e, Submit.DomainUpdateVerification);
6464
}
6565
}
66+
67+
$effect(() => {
68+
if (!show) {
69+
error = null;
70+
}
71+
});
6672
</script>
6773

68-
<Modal title="Retry verification" bind:show onSubmit={retryDomain}>
74+
<Modal title="Retry verification" bind:show onSubmit={retryDomain} bind:error>
6975
<div>
7076
<Tabs.Root variant="secondary" let:root>
7177
{#if isSubDomain && !!$regionalConsoleVariables._APP_DOMAIN_TARGET_CNAME && $regionalConsoleVariables._APP_DOMAIN_TARGET_CNAME !== 'localhost'}

src/routes/(console)/project-[region]-[project]/sites/site-[site]/domains/table.svelte

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,11 @@
6262
</Link>
6363

6464
{#if rule.status === 'verifying'}
65-
<Badge
66-
variant="secondary"
67-
type="warning"
68-
content="Verifying"
69-
size="s" />
65+
<Badge variant="secondary" content="Verifying" size="s" />
7066
{:else if rule.status !== 'verified'}
7167
<Badge
7268
variant="secondary"
73-
type="error"
69+
type="warning"
7470
content="Verification failed"
7571
size="s" />
7672
{/if}

0 commit comments

Comments
 (0)