Watch
0
0
Fork
You've already forked hyperhive
0

swarm-ui: a review runs page lists the review classifier's recent runs

One card per run, newest first, from GET /api/review-classifier/runs: repo,
PR, head commit, trigger, when, how long, how many classifications and the
outcome as a badge. A card opens to the try-out's result table, the overall
verdict, the reason and the posted review's link. TryOutResult takes the
answer it shows rather than a whole try-out result, and its styles move to
their own file.
This commit is contained in:
iris 2026-10-12 18:53:06 +02:00 • committed by mara
commit 5193a101a6
3 changed files with 355 additions and 16 deletions

View file

@ -62,13 +62,3 @@
margin: 0;
color: var(--muted);
}
.ui-tryout-row-error {
color: var(--red);
}
.ui-tryout-overall,
.ui-tryout-sha {
margin: 0.75em 0 0;
}
.ui-tryout-sha {
color: var(--muted);
}

View file

@ -0,0 +1,11 @@
/* A finished run's table, the overall verdict under it and the head commit. */
.ui-tryout-row-error {
color: var(--red);
}
.ui-tryout-overall,
.ui-tryout-sha {
margin: 0.75em 0 0;
}
.ui-tryout-sha {
color: var(--muted);
}

View file

@ -5,6 +5,7 @@
import { Badge } from "@hive/shared/badge.js";
import { Table, type TableColumn } from "../../ui/table/Table.js";
import type { TryOutResult as Result, TryOutRow } from "./TryOutTypes.js";
import "./TryOutResult.css";
const VERDICT_LABEL: Record<TryOutRow["verdict"], string> = {
match: "match",
@ -44,7 +45,21 @@ const COLUMNS: TableColumn<TryOutRow>[] = [
},
];
export function TryOutResult({ result }: { result: Result }) {
/** What the table needs of a run: the try-out's answer, or a listed run's. The
* head commit is absent for a run that never read one. */
export type TryOutAnswer = Pick<Result, "rows" | "overall"> & {
head_sha?: string;
};
export function TryOutResult({
result,
filterKey = "swarm-ui:review-tryout:table-filters",
}: {
result: TryOutAnswer;
/** Where the column filters are remembered; a page showing several tables
* keeps them apart from the try-out's. */
filterKey?: string;
}) {
const rows = result.rows ?? [];
return (
<div class="ui-tryout-result">
@ -54,7 +69,7 @@ export function TryOutResult({ result }: { result: Result }) {
// By position: two classifications may share a name, and a shared key
// would let one result render over the other.
rowKey={(r) => String(rows.indexOf(r))}
storageKey="swarm-ui:review-tryout:table-filters"
storageKey={filterKey}
emptyMessage="the run returned no classifications"
/>
{result.overall ? (
@ -66,9 +81,11 @@ export function TryOutResult({ result }: { result: Result }) {
/>
</p>
) : null}
<p class="ui-tryout-sha">
Ran on head <code>{result.head_sha.slice(0, 12)}</code>
</p>
{result.head_sha ? (
<p class="ui-tryout-sha">
Ran on head <code>{result.head_sha.slice(0, 12)}</code>
</p>
) : null}
</div>
);
}