import Link from 'next/link'; import { Section } from '@/components/ui/section'; import { Badge, MatchBadge, StatusBadge } from '@/components/ui/badge'; import { EmptyState } from '@/components/ui/empty-state'; import { Pagination } from '@/components/ui/pagination'; import { JsonView } from '@/components/ui/json-view'; import { listUnresolved } from '@/lib/queries/admin'; import { resolveAction, rejectAction } from '@/lib/admin/actions'; import { fmtInt, fmtDateTime } from '@/lib/format'; import { str, int, withParams, type SP } from '@/lib/search-params'; const PAGE_SIZE = 50; export default async function UnresolvedPage({ searchParams }: { searchParams: Promise }) { const sp = await searchParams; const entityKind = str(sp, 'kind'); const status = str(sp, 'status', 'open'); const page = int(sp, 'page', 1, 1, 10_000); const msg = str(sp, 'msg'); const ok = str(sp, 'ok'); const { rows, total, kinds } = await listUnresolved({ entityKind, status, page, pageSize: PAGE_SIZE }); const href = (o: Record) => `/admin/unresolved${withParams({ kind: entityKind, status }, o)}`; return (

Unresolved labels

Source labels that no identifier, alias or normalized string could map. Resolving adds an alias to the target entity, marks the label mapped and writes the audit log.

{msg ? (

{msg}

) : null}
Kind All {kinds.map((k) => ( {k.k} {fmtInt(k.n)} ))}
Status {['open', 'mapped', 'rejected', 'ignored', ''].map((s) => ( {s || 'all'} ))}
{rows.length === 0 ? ( No unresolved label matches these filters. Labels are enqueued by connectors when reconciliation fails. ) : ( <>
{rows.map((u) => ( ))}
Count Label Kind · source Suggestion Status Actions
{fmtInt(u.count)} {u.source_text} {u.normalized} {Object.keys(u.context ?? {}).length ? (
context
) : null} #{u.id} · {fmtDateTime(u.updated_at)}
{u.entity_kind} {u.source_slug} {u.suggested_id ? ( <> {u.suggested_id} {u.suggested_name ? — {u.suggested_name} : null} {u.suggested_score != null ? score {u.suggested_score.toFixed(2)} : null} ) : ( no suggestion )} {u.resolved_id ? {u.resolved_id} : null} {u.status === 'open' ? (
) : ( by {u.resolved_by ?? '—'} )}
href({ page: p === 1 ? '' : p })} /> )}
); }