From d1e862770d9aee6a5916c0ffe51325bfe4c77dd0 Mon Sep 17 00:00:00 2001 From: Ty Balascio Date: Sun, 20 Sep 2026 07:42:37 -0700 Subject: [PATCH] Settings: split Test Connection into WooCommerce and Inference sections --- frontend/src/create/settings/Settings.svelte | 47 +++++++++++++++----- 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/frontend/src/create/settings/Settings.svelte b/frontend/src/create/settings/Settings.svelte index 4b4de05..9817bb8 100644 --- a/frontend/src/create/settings/Settings.svelte +++ b/frontend/src/create/settings/Settings.svelte @@ -98,15 +98,29 @@ saving = false; } - let testResult: { ok: boolean; detail: string } | null = null; + interface TestResult { ok: boolean; detail: string; busy?: boolean } + let wooTest: TestResult | null = null; + let inferenceTest: TestResult | null = null; async function testWoo() { - testResult = null; + wooTest = { ok: false, detail: 'Working…', busy: true }; try { const res = await fetch('/api/v1/settings/test-woo', { method: 'POST' }); - testResult = await res.json(); + const body = await res.json(); + wooTest = { ok: !!body.ok, detail: body.detail || (body.ok ? 'Connected & synced' : 'failed') }; } catch { - testResult = { ok: false, detail: 'network error' }; + wooTest = { ok: false, detail: 'network error' }; + } + } + + async function testInference() { + inferenceTest = { ok: false, detail: 'Working…', busy: true }; + try { + const res = await fetch('/api/v1/admin/test-inference', { method: 'POST' }); + const body = await res.json(); + inferenceTest = { ok: !!body.ok, detail: body.detail || (body.ok ? 'reachable' : 'failed') }; + } catch { + inferenceTest = { ok: false, detail: 'network error' }; } } @@ -177,13 +191,23 @@ - - {#if testResult} -

- {testResult.ok ? 'Connected & synced' : testResult.detail} -

- {/if} {#if message}

{message}

{/if} + +
+

WooCommerce

+ + {#if wooTest} +

{wooTest.detail}

+ {/if} +
+ +
+

Inference

+ + {#if inferenceTest} +

{inferenceTest.detail}

+ {/if} +
{/if} @@ -193,4 +217,7 @@ input, select, option { color: #eee; background: #1c1c1c; width: 100%; padding: 6px; } option { color: #eee; background: #1c1c1c; } button { margin-top: 16px; } + .section { margin-top: 20px; padding-top: 12px; border-top: 1px solid #333; } + .section h3 { margin: 0 0 8px; font-size: 1.05rem; color: #eee; } + .section button { margin-top: 4px; }