diff --git a/src/lib/paddles.d.ts b/src/lib/paddles.d.ts index 77e9bc8..afad206 100644 --- a/src/lib/paddles.d.ts +++ b/src/lib/paddles.d.ts @@ -26,12 +26,17 @@ export type Job = { scheduled: string; }; +export type RunResults = { + [key: string]: number | string; +} + export type Run = { name: string; branch: string; suite: string; jobs: Job[]; scheduled: string; + results: RunResults; }; export type Node = { @@ -67,4 +72,4 @@ export interface StatsJobsResponse { unknown?: number; running?: number; total: number; -} \ No newline at end of file +} diff --git a/src/pages/Run/index.tsx b/src/pages/Run/index.tsx index f7ffaef..eec797c 100644 --- a/src/pages/Run/index.tsx +++ b/src/pages/Run/index.tsx @@ -38,6 +38,10 @@ const FilterLink = (props: PropsWithChildren) => ( ); +type StatusLabels = { + [key: string]: string; +} + export default function Run() { const [params, setParams] = useQueryParams({ status: StringParam, @@ -51,7 +55,12 @@ export default function Run() { const data: Run | undefined = query.data; const suite = data?.suite; const branch = query.data?.branch; - const statuses = ["pass", "fail", "dead", "running", "waiting"]; + const statuses = ["pass", "fail", "dead", "running", "waiting", "queued"]; + const statusLabels: StatusLabels = {}; + statuses.forEach(item => { + statusLabels[item] = item.charAt(0).toUpperCase() + item.slice(1); + if ( data?.results[item] ) statusLabels[item] += ` (${data.results[item]})`; + }); const date = query.data?.scheduled ? format(new Date(query.data.scheduled), "yyyy-MM-dd") : null; @@ -84,7 +93,7 @@ export default function Run() { > All - {statuses.map((item) => ( + {statuses.filter(item => data?.results[item]).map((item) => ( ))}