feat(dashboard): vervang SECTIONS-grid door 5 live status-widgets

Parallel server-side fetches via Promise.allSettled voor Docker, Caddy,
systemd, Git en Audit. Iedere widget toont geaggregeerde status en
refresht elke 30s client-side onafhankelijk van de andere widgets.

- lib/agent-fetch.ts: gedeelde client-side streaming helper
- app/api/audit/latest/route.ts: GET endpoint voor AuditWidget refresh
- app/_components/DockerWidget.tsx: running/total containers
- app/_components/CaddyWidget.tsx: soonest cert expiry in dagen
- app/_components/SystemdWidget.tsx: healthy/total units (of niet geconfigureerd)
- app/_components/GitWidget.tsx: dirty repo count (of niet geconfigureerd)
- app/_components/AuditWidget.tsx: laatste FlowRun status + relatief tijdstip
- app/page.tsx: vervangt SECTIONS-grid, doet parallel fetches, rendert widgets

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Scrum4Me Agent 2026-05-13 22:06:00 +02:00
parent ae63876f21
commit faa1463cd7
8 changed files with 523 additions and 22 deletions

View file

@ -0,0 +1,20 @@
import { NextResponse } from 'next/server'
import { getCurrentUser } from '@/lib/session'
import { prisma } from '@/lib/prisma'
export const dynamic = 'force-dynamic'
export async function GET() {
const user = await getCurrentUser()
if (!user) return NextResponse.json({ error: 'unauthorized' }, { status: 401 })
const run = await prisma.flowRun.findFirst({
where: { user_id: user.id },
orderBy: { started_at: 'desc' },
select: { id: true, flow_key: true, status: true, started_at: true },
})
return NextResponse.json({
run: run ? { ...run, started_at: run.started_at.toISOString() } : null,
})
}