diff --git a/web/src/pages/Integrations.tsx b/web/src/pages/Integrations.tsx index ef268c1..8f6366d 100644 --- a/web/src/pages/Integrations.tsx +++ b/web/src/pages/Integrations.tsx @@ -29,6 +29,8 @@ export default function Integrations({ user }: { user: CurrentUser }) { const [editingIntegration, setEditingIntegration] = useState(null); const [error, setError] = useState(null); const [integrationColors, setIntegrationColors] = useState>({}); + const [testingId, setTestingId] = useState(null); + const [testResults, setTestResults] = useState>({}); useEffect(() => { api.settings.integrationColors().then((res) => setIntegrationColors(res.integrationColors)).catch(() => {}); @@ -52,6 +54,18 @@ export default function Integrations({ user }: { user: CurrentUser }) { } } + async function testIntegration(i: IntegrationSummary) { + setTestingId(i.id); + try { + const result = await api.integrations.testExisting(i.id, {}); + setTestResults((prev) => ({ ...prev, [i.id]: result })); + } catch (err) { + setTestResults((prev) => ({ ...prev, [i.id]: { ok: false, error: err instanceof Error ? err.message : String(err) } })); + } finally { + setTestingId(null); + } + } + async function removeIntegration(i: IntegrationSummary) { if (!confirm(`Delete integration "${i.name}"?`)) return; try { @@ -159,7 +173,17 @@ export default function Integrations({ user }: { user: CurrentUser }) { {isAdmin && ( -
+
+ + {testResults[i.id] && testingId !== i.id && ( + + {testResults[i.id].ok + ? `OK${testResults[i.id].latencyMs !== undefined ? ` (${testResults[i.id].latencyMs}ms)` : ""}` + : "Failed"} + + )} @@ -167,6 +191,9 @@ export default function Integrations({ user }: { user: CurrentUser }) { Delete
+ {testResults[i.id] && !testResults[i.id].ok && testingId !== i.id && ( +
{testResults[i.id].error}
+ )} )}