import Link from 'next/link';
import { Section, KV } from '@/components/ui/section';
import { StatusBadge } from '@/components/ui/badge';
import { EmptyState } from '@/components/ui/empty-state';
import { adminOverview } from '@/lib/queries/admin';
import { listRuns } from '@/lib/queries/sources';
import { fmtDateTime, fmtDuration, fmtInt } from '@/lib/format';
export default async function AdminOverviewPage() {
const [o, runs] = await Promise.all([adminOverview(), listRuns({ limit: 15 })]);
return (
{[
{ label: 'Runs, last 24 h', value: o.runs24h, href: '/admin/connectors' },
{ label: 'Failed runs, 7 d', value: o.failedRuns7d, href: '/admin/connectors' },
{ label: 'Open unresolved labels', value: o.openUnresolved, href: '/admin/unresolved' },
{ label: 'Current ranking snapshots', value: o.currentSnapshots, href: '/admin/rankings' },
].map((k) => (
{fmtInt(k.value)}
{k.label}
))}
| Table |
Rows |
{o.tables.map((t) => (
| {t.table} |
{fmtInt(t.n)} |
))}
{runs.length ? (
| Run |
Status |
Started |
Duration |
Fetched |
{runs.map((r) => (
|
{r.id}
|
|
{fmtDateTime(r.started_at)} |
{fmtDuration(r.duration_ms)} |
{fmtInt(r.records_fetched)} |
))}
) : (
No ingest run recorded.
)}
{o.auditRecent.length ? (
{o.auditRecent.map((a) => (
-
{a.action} by {a.actor}
{a.entity_type ? (
<>
{' '}
on {a.entity_type} {a.entity_id}
>
) : null}
{a.reason ? — {a.reason} : null}
{fmtDateTime(a.created_at)}
))}
) : (
No audit entry yet.
)}
{process.env.CI_API_URL ?? `http://127.0.0.1:${process.env.API_PORT ?? 8251}`} }]} />
);
}