From 289d9fc94c216fcf4469e583aac348ce2919ba4f Mon Sep 17 00:00:00 2001 From: Darshan Date: Fri, 23 May 2025 13:04:30 +0530 Subject: [PATCH] update: rename all `domain` vars to `proxy` if `ProxyRule` type for clarity in functions. --- .../function-[function]/domains/+page.svelte | 6 ++-- .../function-[function]/domains/+page.ts | 2 +- .../domains/deleteDomainModal.svelte | 11 +++---- .../domains/recordsCard.svelte | 7 ++--- .../domains/retryDomainModal.svelte | 15 +++++----- .../function-[function]/domains/table.svelte | 30 +++++++++---------- 6 files changed, 35 insertions(+), 36 deletions(-) diff --git a/src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/+page.svelte b/src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/+page.svelte index e1ab5a837..eaba6f04b 100644 --- a/src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/+page.svelte +++ b/src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/+page.svelte @@ -18,7 +18,7 @@ let showDelete = $state(false); let showRetry = $state(false); - let selectedDomain: Models.ProxyRule = null; + let selectedProxyRule: Models.ProxyRule = null; @@ -83,9 +83,9 @@ {#if showDelete} - + {/if} {#if showRetry} - + {/if} diff --git a/src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/+page.ts b/src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/+page.ts index 8e96e426a..50397306c 100644 --- a/src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/+page.ts +++ b/src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/+page.ts @@ -26,7 +26,7 @@ export const load: PageLoad = async ({ depends, params, url, route }) => { limit, query, search, - domains: await sdk + proxyRules: await sdk .forProject(params.region, params.project) .proxy.listRules( [ diff --git a/src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/deleteDomainModal.svelte b/src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/deleteDomainModal.svelte index 1882bc282..c5ce1db80 100644 --- a/src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/deleteDomainModal.svelte +++ b/src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/deleteDomainModal.svelte @@ -11,15 +11,16 @@ import { page } from '$app/state'; export let show = false; - export let selectedDomain: Models.ProxyRule; - let confirm = false; + export let selectedProxyRule: Models.ProxyRule; + let error = ''; + let confirm = false; async function deleteDomain() { try { await sdk .forProject(page.params.region, page.params.project) - .proxy.deleteRule(selectedDomain.$id); + .proxy.deleteRule(selectedProxyRule.$id); await invalidate(Dependencies.FUNCTION_DOMAINS); show = false; addNotification({ @@ -35,13 +36,13 @@ - {#if selectedDomain} + {#if selectedProxyRule} Are you sure you want to delete this domain? You will no longer be able to execute your function by visiting: - {selectedDomain.domain} + {selectedProxyRule.domain} {/if} import { Link } from '$lib/elements'; - import type { Domain } from '$lib/sdk/domains'; import { IconInfo } from '@appwrite.io/pink-icons-svelte'; import { Badge, @@ -14,7 +13,7 @@ import type { Models } from '@appwrite.io/console'; import { consoleVariables } from '$routes/(console)/store'; - export let domain: Domain | Models.ProxyRule; + export let proxyRule: Models.ProxyRule;
@@ -22,7 +21,7 @@ - {domain?.domain} + {proxyRule?.domain} @@ -39,7 +38,7 @@ CNAME - {domain?.domain} + {proxyRule?.domain} - - {#if selectedDomain} - + + {#if selectedProxyRule} + {/if} diff --git a/src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/table.svelte b/src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/table.svelte index 4cd12187b..1c9df426f 100644 --- a/src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/table.svelte +++ b/src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/table.svelte @@ -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,24 +46,24 @@ {/each} - {#each domains.rules as domain} + {#each proxyRules.rules as proxyRule} {#each $columns as column} {#if column.id === 'domain'} - + - {domain.domain} + {proxyRule.domain} - {#if domain.status === 'verifying'} + {#if proxyRule.status === 'verifying'} - {:else if domain.status !== 'verified'} + {:else if proxyRule.status !== 'verified'} {:else if column.id === 'target'} - {domainTarget(domain)} + {proxyTarget(proxyRule)} {/if} {/each} @@ -91,11 +91,11 @@ - {#if domain.status !== 'verified'} + {#if proxyRule.status !== 'verified'} { - selectedDomain = domain; + selectedProxyRule = proxyRule; showRetry = true; toggle(e); }}> @@ -106,7 +106,7 @@ status="danger" leadingIcon={IconTrash} on:click={(e) => { - selectedDomain = domain; + selectedProxyRule = proxyRule; showDelete = true; toggle(e); trackEvent(Click.DomainDeleteClick, { @@ -125,9 +125,9 @@ {#if showDelete} - + {/if} {#if showRetry} - + {/if}