From 66c570ed6d2aa9107c2932d00aa780fd3b198462 Mon Sep 17 00:00:00 2001 From: Artyom Zaporozhets Date: Sat, 13 Sep 2025 16:45:09 +0300 Subject: [PATCH] add crossmatch statistic to table info page --- src/pages/TableDetails.tsx | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/pages/TableDetails.tsx b/src/pages/TableDetails.tsx index 00d1cdc..5703fee 100644 --- a/src/pages/TableDetails.tsx +++ b/src/pages/TableDetails.tsx @@ -3,6 +3,7 @@ import { Bibliography, GetTableResponse, HttpValidationError, + ObjectCrossmatchStatus, } from "../clients/admin/types.gen"; import { getTableAdminApiV1TableGet } from "../clients/admin/sdk.gen"; import { useNavigate, useParams } from "react-router-dom"; @@ -153,6 +154,42 @@ function MarkingRules(props: MarkingRulesProps): ReactElement { ); } +interface CrossmatchStatsProps { + table: GetTableResponse; +} + +function CrossmatchStats(props: CrossmatchStatsProps): ReactElement { + const columns: Column[] = [{ name: "Status" }, { name: "Count" }]; + + const values: Record[] = []; + + if (props.table.statistics) { + const statusLabels: Record = { + unprocessed: "Unprocessed", + new: "New", + collided: "Collided", + existing: "Existing", + }; + + Object.entries(props.table.statistics).forEach(([status, count]) => { + values.push({ + Status: statusLabels[status as ObjectCrossmatchStatus] || status, + Count: count || 0, + }); + }); + } + + if (values.length === 0) { + return
; + } + + return ( + +

Crossmatch Statistics

+
+ ); +} + interface ColumnInfoProps { table: GetTableResponse; } @@ -267,6 +304,7 @@ export function TableDetailsPage(): ReactElement {
+
) : error ? (