diff --git a/rads/transparency-portal/src/components/authority/overview-tab.tsx b/rads/transparency-portal/src/components/authority/overview-tab.tsx index 6f57d72..ed0ff92 100644 --- a/rads/transparency-portal/src/components/authority/overview-tab.tsx +++ b/rads/transparency-portal/src/components/authority/overview-tab.tsx @@ -63,7 +63,7 @@ export function OverviewTab({ events, access }: OverviewTabProps) { {failures.slice(0, 10).map((failure, index) => ( {shortId(failure.algorithmId)} - {shortId(failure.runId)} + {shortId(failure.runId)} {failure.event} diff --git a/rads/transparency-portal/src/components/authority/runs-tab.tsx b/rads/transparency-portal/src/components/authority/runs-tab.tsx index b78954f..088cf0b 100644 --- a/rads/transparency-portal/src/components/authority/runs-tab.tsx +++ b/rads/transparency-portal/src/components/authority/runs-tab.tsx @@ -25,7 +25,7 @@ const columns: ColumnDef[] = [ accessorKey: "runId", header: "Run", cell: ({ row }) => ( - + {shortId(row.original.runId)} ), @@ -68,7 +68,7 @@ export function RunsTab({ events }: { events: RunEvent[] }) { if (!needle) return true; return ( event.event.toLowerCase().includes(needle) || - event.runId.toLowerCase().includes(needle) || + (event.runId ?? "").toLowerCase().includes(needle) || event.algorithmId.toLowerCase().includes(needle) ); }) diff --git a/rads/transparency-portal/src/lib/api.ts b/rads/transparency-portal/src/lib/api.ts index 29c9ce4..af8cd9a 100644 --- a/rads/transparency-portal/src/lib/api.ts +++ b/rads/transparency-portal/src/lib/api.ts @@ -5,7 +5,7 @@ const PDM_URL = import.meta.env.VITE_PDM_URL ?? "https://pdm.r.secure-rads.org"; export interface RunEvent { algorithmId: string; - runId: string; + runId: string | null; event: string; timestamp: string; receivedAt: string; diff --git a/rads/transparency-portal/src/lib/format.ts b/rads/transparency-portal/src/lib/format.ts index 79ae112..7f66342 100644 --- a/rads/transparency-portal/src/lib/format.ts +++ b/rads/transparency-portal/src/lib/format.ts @@ -3,7 +3,8 @@ export function formatDateTime(value: string): string { return Number.isNaN(date.getTime()) ? value : date.toLocaleString(); } -export function shortId(value: string, length = 14): string { +export function shortId(value: string | null | undefined, length = 14): string { + if (!value) return "-"; return value.length <= length ? value : `${value.slice(0, length)}...`; } diff --git a/secure/transparency-portal/src/components/authority/overview-tab.tsx b/secure/transparency-portal/src/components/authority/overview-tab.tsx index 6f57d72..ed0ff92 100644 --- a/secure/transparency-portal/src/components/authority/overview-tab.tsx +++ b/secure/transparency-portal/src/components/authority/overview-tab.tsx @@ -63,7 +63,7 @@ export function OverviewTab({ events, access }: OverviewTabProps) { {failures.slice(0, 10).map((failure, index) => ( {shortId(failure.algorithmId)} - {shortId(failure.runId)} + {shortId(failure.runId)} {failure.event} diff --git a/secure/transparency-portal/src/components/authority/runs-tab.tsx b/secure/transparency-portal/src/components/authority/runs-tab.tsx index b78954f..088cf0b 100644 --- a/secure/transparency-portal/src/components/authority/runs-tab.tsx +++ b/secure/transparency-portal/src/components/authority/runs-tab.tsx @@ -25,7 +25,7 @@ const columns: ColumnDef[] = [ accessorKey: "runId", header: "Run", cell: ({ row }) => ( - + {shortId(row.original.runId)} ), @@ -68,7 +68,7 @@ export function RunsTab({ events }: { events: RunEvent[] }) { if (!needle) return true; return ( event.event.toLowerCase().includes(needle) || - event.runId.toLowerCase().includes(needle) || + (event.runId ?? "").toLowerCase().includes(needle) || event.algorithmId.toLowerCase().includes(needle) ); }) diff --git a/secure/transparency-portal/src/lib/api.ts b/secure/transparency-portal/src/lib/api.ts index fb828bf..a79cd3f 100644 --- a/secure/transparency-portal/src/lib/api.ts +++ b/secure/transparency-portal/src/lib/api.ts @@ -5,7 +5,7 @@ const PDM_URL = import.meta.env.VITE_PDM_URL ?? "https://pdm.sr.secure-rads.org" export interface RunEvent { algorithmId: string; - runId: string; + runId: string | null; event: string; timestamp: string; receivedAt: string; diff --git a/secure/transparency-portal/src/lib/format.ts b/secure/transparency-portal/src/lib/format.ts index 79ae112..7f66342 100644 --- a/secure/transparency-portal/src/lib/format.ts +++ b/secure/transparency-portal/src/lib/format.ts @@ -3,7 +3,8 @@ export function formatDateTime(value: string): string { return Number.isNaN(date.getTime()) ? value : date.toLocaleString(); } -export function shortId(value: string, length = 14): string { +export function shortId(value: string | null | undefined, length = 14): string { + if (!value) return "-"; return value.length <= length ? value : `${value.slice(0, length)}...`; }