From d4ed3e89546880a8cb4aabb97c63a61ef7f8293c Mon Sep 17 00:00:00 2001 From: Hemachandar Date: Thu, 22 Jan 2026 21:21:50 +0530 Subject: [PATCH 1/3] Add retry button in ViewLogs modal --- .../components/domains/viewLogsModal.svelte | 65 ++++++++++++++++++- .../function-[function]/domains/table.svelte | 2 +- .../settings/domains/table.svelte | 2 +- .../sites/site-[site]/domains/table.svelte | 2 +- 4 files changed, 65 insertions(+), 6 deletions(-) diff --git a/src/lib/components/domains/viewLogsModal.svelte b/src/lib/components/domains/viewLogsModal.svelte index f41ee53302..0e164666bb 100644 --- a/src/lib/components/domains/viewLogsModal.svelte +++ b/src/lib/components/domains/viewLogsModal.svelte @@ -2,17 +2,76 @@ import { Modal } from '$lib/components'; import { Logs } from '@appwrite.io/pink-svelte'; import { app } from '$lib/stores/app'; - import type { Models } from '@appwrite.io/console'; + import { ProxyRuleStatus, type Models } from '@appwrite.io/console'; + import { Button } from '$lib/elements/forms'; + import { getApexDomain } from '$lib/helpers/tlds'; + import { isCloud } from '$lib/system'; + import { sdk } from '$lib/stores/sdk'; + import { page } from '$app/state'; + import { Dependencies } from '$lib/constants'; + import { invalidate } from '$app/navigation'; + import { addNotification } from '$lib/stores/notifications'; + import { Submit, trackError, trackEvent } from '$lib/actions/analytics'; let { show = $bindable(false), - selectedProxyRule + selectedProxyRule, + domainsList }: { show: boolean; selectedProxyRule: Models.ProxyRule; + domainsList?: Models.DomainsList; } = $props(); + + let error = $state(null); + + async function retryDomain() { + error = null; + + try { + const apexDomain = getApexDomain(selectedProxyRule.domain); + const domain = domainsList?.domains.find((d) => d.domain === apexDomain); + if (isCloud && domain) { + await sdk.forConsole.domains.updateNameservers({ + domainId: domain.$id + }); + } + } catch { + // Ignore error + } + + try { + selectedProxyRule = await sdk + .forProject(page.params.region, page.params.project) + .proxy.updateRuleVerification({ ruleId: selectedProxyRule.$id }); + + await invalidate(Dependencies.DOMAINS); + show = false; + addNotification({ + type: 'success', + message: 'Domain verified successfully' + }); + trackEvent(Submit.DomainUpdateVerification); + } catch (e) { + error = + e.message ?? + 'Domain verification failed. Please check your domain settings or try again later'; + trackError(e, Submit.DomainUpdateVerification); + } + } + + $effect(() => { + if (!show) { + error = null; + } + }); - + + + {#if selectedProxyRule.status === ProxyRuleStatus.Unverified} + + {/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 6f16935717..f0468cdaad 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 @@ -226,7 +226,7 @@ {/if} {#if showLogs} - + {/if}