update: rename all domain vars to proxy if ProxyRule type for clarity in sites.

This commit is contained in:
Darshan committed 2025-05-23 13:50:25 +05:30
1 parent 289d9fc94c
commit 6ead88a743
5 files changed
+31 -31

No files matched your search

@@ -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(
[
@@ -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>
@@ -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">
@@ -19,16 +19,16 @@
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 domainTarget = (proxy: Models.ProxyRule) => {
const proxyTarget = (proxy: Models.ProxyRule) => {
return proxy?.redirectUrl
? 'Redirect to ' + proxy.redirectUrl
: proxy?.deploymentVcsProviderBranch
@@ -46,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"
@@ -73,7 +73,7 @@
{/if}
</Layout.Stack>
{:else if column.id === 'target'}
{domainTarget(domain)}
{proxyTarget(rule)}
{/if}
</Table.Cell>
{/each}
@@ -92,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);
}}>
@@ -107,7 +107,7 @@
status="danger"
leadingIcon={IconTrash}
on:click={(e) => {
selectedDomain = domain;
selectedProxyRule = rule;
showDelete = true;
toggle(e);
trackEvent(Click.DomainDeleteClick, {
@@ -126,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}