From 0721681cfea62b0d8f183791d86cebb44e46bebe Mon Sep 17 00:00:00 2001 From: busya Date: Thu, 4 Jun 2026 23:34:45 +0300 Subject: [PATCH] =?UTF-8?q?032:=20fix(TargetSchemaHint)=20=E2=80=94=20diff?= =?UTF-8?q?erentiate=20transient=20errors=20(503/504)=20from=20table=20not?= =?UTF-8?q?=20found?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit HIGH: 'bodyClass' and display logic updated — 503/504 errors now show warning (yellow) styling and 'Could not verify' message instead of destructive (red) 'Table not found'. Backend now returns 503 on pool exhaustion and 504 on upstream timeout after async refactoring. --- .../translate/TargetSchemaHint.svelte | 36 +++++++++++++------ 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/frontend/src/lib/components/translate/TargetSchemaHint.svelte b/frontend/src/lib/components/translate/TargetSchemaHint.svelte index 07afb19a..de6fbd06 100644 --- a/frontend/src/lib/components/translate/TargetSchemaHint.svelte +++ b/frontend/src/lib/components/translate/TargetSchemaHint.svelte @@ -7,7 +7,7 @@ - + @@ -29,16 +29,20 @@ targetSourceLanguageColumn = null, } = $props(); - /** @type {'idle'|'checking'|'complete'|'error'} */ + /** @type {'idle'|'checking'|'complete'|'complete_error'|'error'} */ let state = $state('idle'); let result = $state(null); let abortController = $state(null); let renderKey = $state(0); + /** True if result is a backend/network error (503/504/timeout), not a "table not found" */ + let isTransientError = $derived(state === 'complete' && !result?.table_exists && !!result?.error); + /** CSS-класс body в зависимости от состояния */ let bodyClass = $derived.by(() => { if (state === 'complete' && result?.all_present) return 'px-3 py-2.5 bg-success-light'; if (state === 'complete' && !result?.all_present && result?.table_exists) return 'px-3 py-2.5 bg-warning-light'; + if (state === 'complete' && !result?.table_exists && result?.error) return 'px-3 py-2.5 bg-warning-light'; if (state === 'error' || (state === 'complete' && !result?.table_exists)) return 'px-3 py-2.5 bg-destructive-light'; return 'px-3 py-2.5'; }); @@ -134,7 +138,8 @@
@@ -216,12 +222,22 @@ {:else if state === 'complete' && result} {#key renderKey} {#if !result.table_exists} -
- - - -

{_('translate.target_schema.table_not_found') || 'Target table not found in the database.'}

-
+ {#if result.error} + +
+ + + +

{_('translate.target_schema.check_error') || 'Could not verify target table schema.'}

+
+ {:else} +
+ + + +

{_('translate.target_schema.table_not_found') || 'Target table not found in the database.'}

+
+ {/if} {:else if result.all_present}