feat: Graphify build worker endpoints + UI trigger

- POST /api/aos/instances/[id]/graph-build: trigger or get build command
- POST /api/aos/instances/[id]/graph-status: worker callback (ok/error)
- GET /api/aos/graphify-health: check if Graphify service is up
- Instance detail: 'Graph neu erstellen' button (visible when demo_active/active)
- Graceful degradation: if GRAPHIFY_URL not set, returns build command for external worker
This commit is contained in:
Z User committed 2026-10-28 19:38:28 +00:00
1 parent 7d94fe53ad
commit 25599a5516
4 files changed
+301 -9

No files matched your search

+52 -9
View File
@@ -19,6 +19,7 @@ import {
CheckCircle2,
XCircle,
CircleDashed,
Network,
} from 'lucide-react'
import { useFetch } from '@/hooks/use-fetch'
import { Card } from '@/components/ui/card'
@@ -898,15 +899,57 @@ function InstanceDetailSheet({
</Button>
</div>
) : (
<ActionsRow
status={status}
busyAction={busyAction}
onSuspend={() => handleAction('suspend', 'Suspendieren')}
onReactivate={() => handleAction('reactivate', 'Reaktivieren')}
onExtend={() => handleAction('extend', 'Demo verlängern', 7)}
onRetry={() => handleAction('retry', 'Provisioning wiederholen')}
onDelete={() => setConfirmingDelete(true)}
/>
<>
<ActionsRow
status={status}
busyAction={busyAction}
onSuspend={() => handleAction('suspend', 'Suspendieren')}
onReactivate={() => handleAction('reactivate', 'Reaktivieren')}
onExtend={() => handleAction('extend', 'Demo verlängern', 7)}
onRetry={() => handleAction('retry', 'Provisioning wiederholen')}
onDelete={() => setConfirmingDelete(true)}
/>
{['demo_active', 'active'].includes(status) && (
<Button
variant="outline"
size="sm"
className="w-full gap-1.5"
disabled={busyAction !== null}
onClick={async () => {
setBusyAction('graph-build')
const t = toast.loading('Graphify-Graph wird erstellt…')
try {
const r = await fetch(`/api/aos/instances/${instance.id}/graph-build`, { method: 'POST' })
const res = await r.json()
if (!r.ok) throw new Error(res.error || 'build failed')
if (res.status === 'queued') {
toast.info('Graphify nicht konfiguriert — Build-Kommando generiert.', {
id: t,
description: 'Worker muss den Build ausführen.',
duration: 6000,
})
} else if (res.status === 'command-ready') {
toast.success('Graphify-Service erreichbar. Build-Kommando bereit.', {
id: t,
description: 'Worker führt den Build aus.',
duration: 6000,
})
} else {
toast.success('Graph-Build gestartet', { id: t })
}
refetch()
} catch (err) {
toast.error(err instanceof Error ? err.message : 'Build fehlgeschlagen', { id: t })
} finally {
setBusyAction(null)
}
}}
>
<Network className="size-3.5" />
Graph neu erstellen
</Button>
)}
</>
)}
</section>
</div>