Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions docs/run-table-layout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Run table sizing

RunList and RunHistory share the widths in `packages/app/src/features/runs/table-layout.ts`.
The width envelope was checked in Chromium against the built app and its actual
table font, header weight, and responsive cell padding (`px-2` below `sm`, `px-3`
from `sm` upward):

| Column | Fixed width | Representative content used |
| --- | ---: | --- |
| Status | 120px (7.5rem) | `Status (11)` with both sort arrows; all 11 supported statuses selected |
| Elapsed | 160px (10rem) | `59m 59s–1h 2m`, `99999h 59m`, short and missing values |
| Created | 208px (13rem) | Full English and French medium-date/short-time strings and a recent relative date |

These are border-box table column widths, so they include the responsive cell
padding. The Status cell uses the widest bounded label and arrow state and stays
one line. Elapsed and Created fit the representative content without changing
the existing formatters. Longer durations and locale-specific dates stay in the
same columns, truncate within the cell, and expose the formatted value in the
native title tooltip. The rendered text remains left-aligned.

Run has no fixed width in either table. With the bounded Project/Job columns,
the minimum table widths leave at least 160px for Run: 62rem for the all-runs
listing, 52rem for RunList with one bounded context column, and 42rem for job
history. On narrow screens, the existing table shell owns horizontal scrolling;
the page itself does not grow horizontally. The fixed metadata widths do not
depend on visible rows, filters, sort direction, pagination, or row updates.

The browser coverage in `packages/app/test/runs.browser.test.mjs` checks the
header measurements and content matrix at wide and narrow viewports, including
the broader all-runs listing with both Project and Job columns.
7 changes: 4 additions & 3 deletions packages/app/src/features/runs/history.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useQuery } from "@tanstack/react-query";
import { historyQuery } from "./queries";
import { formatElapsedTime } from "../../shared/elapsed-time";
import { formatCreated } from "./format-created";
import { runTableColumnWidths, runTableMinimumWidths } from "./table-layout";
export type HistorySort = "run" | "status" | "created";
export type HistorySearch = { cursor?: string; previous?: string; states?: RunStatus[]; sort?: HistorySort; direction?: "asc" | "desc" };
export function RunHistory({ jobId }: { jobId: string }) {
Expand All @@ -23,12 +24,12 @@ export function RunHistory({ jobId }: { jobId: string }) {
const clearStatuses = () => void navigate({ to: "/jobs/$jobId", params: { jobId }, search: { ...search, states: undefined, sort: undefined, direction: undefined, cursor: undefined, previous: undefined } });
return <section aria-label="Runs" className="my-6 min-w-0">
{runs.isPending && <p role="status">Loading run history…</p>}{runs.error && <p role="alert">{runs.error.message} <Button onClick={() => void runs.refetch()}>Retry</Button></p>}
{runs.data && <><Table className="min-w-[40rem] table-fixed" shellProps={{ role: "region", "aria-label": "Runs table", tabIndex: 0 }}><caption className="sr-only">Job runs{search.sort ? "" : ", queued and starting first, running second, then other states; newest first within each group"}</caption><colgroup><col className="w-20" /><col className="w-64" /><col className="w-52" /><col className="w-44" /></colgroup>
<thead className={tableHeadClasses}><tr><StatusHeader selected={search.states ?? []} sortDirection={search.sort === "status" ? search.direction : undefined} onFilterChange={changeFilter} onSortChange={changeStatusSort} onClear={clearStatuses} />{columns.slice(1, 2).map(([column, label]) => <SortableHeader key={column} label={label} active={search.sort === column} direction={search.direction} ariaLabel={`${label}, ${sortLabel(column)}`} onSort={() => sortColumn(column)} />)}<th scope="col" className={tableCellClasses}>Elapsed</th>{columns.slice(2).map(([column, label]) => <SortableHeader key={column} label={label} active={search.sort === column} direction={search.direction} ariaLabel={`${label}, ${sortLabel(column)}`} onSort={() => sortColumn(column)} />)}</tr></thead>
{runs.data && <><Table className={`${runTableMinimumWidths.history} table-fixed`} shellProps={{ role: "region", "aria-label": "Runs table", tabIndex: 0 }}><caption className="sr-only">Job runs{search.sort ? "" : ", queued and starting first, running second, then other states; newest first within each group"}</caption><colgroup><col className={runTableColumnWidths.status} /><col /><col className={runTableColumnWidths.elapsed} /><col className={runTableColumnWidths.created} /></colgroup>
<thead className={tableHeadClasses}><tr><StatusHeader className={runTableColumnWidths.status} selected={search.states ?? []} sortDirection={search.sort === "status" ? search.direction : undefined} onFilterChange={changeFilter} onSortChange={changeStatusSort} onClear={clearStatuses} />{columns.slice(1, 2).map(([column, label]) => <SortableHeader key={column} label={label} active={search.sort === column} direction={search.direction} ariaLabel={`${label}, ${sortLabel(column)}`} onSort={() => sortColumn(column)} />)}<th scope="col" className={`${tableCellClasses} ${runTableColumnWidths.elapsed} whitespace-nowrap`}>Elapsed</th>{columns.slice(2).map(([column, label]) => <SortableHeader key={column} label={label} active={search.sort === column} direction={search.direction} ariaLabel={`${label}, ${sortLabel(column)}`} onSort={() => sortColumn(column)} />)}</tr></thead>
<tbody>{runs.data.items.map(run => <tr className={tableRowClasses} key={run.id}>
<td className={`whitespace-nowrap ${tableCellClasses}`}><RunStatusDot state={run.state} failureSource={run.failure_source} failure={run.failure} /></td>
<td className={tableCellClasses}><Link to="/job-runs/$runId" params={{ runId: run.id }} search={{ after: 0 }} title={run.run_name || run.issue_title || "Run"} className="block truncate font-semibold hover:text-factorize-700 focus-visible:rounded-sm dark:hover:text-factorize-500">{run.run_name || run.issue_title || "Run"}</Link>{(run.failure?.reason || (run.agent_error as any)?.reason) && <p className="mt-1 truncate text-xs text-red-700 dark:text-red-300" title={(run.failure?.reason || (run.agent_error as any).reason)}>{(run.failure?.reason || (run.agent_error as any).reason)}</p>}</td>
<td className={`whitespace-nowrap ${tableCellClasses}`} title={run.elapsed_time ? formatElapsedTime(run.elapsed_time) : undefined}>{run.elapsed_time ? formatElapsedTime(run.elapsed_time) : "—"}</td><td className={`whitespace-nowrap ${tableCellClasses}`}><time dateTime={run.created_at}>{formatCreated(run.created_at)}</time></td>
<td className={`${tableCellClasses} ${runTableColumnWidths.elapsed} min-w-0`} title={run.elapsed_time ? formatElapsedTime(run.elapsed_time) : undefined}><span className="block truncate">{run.elapsed_time ? formatElapsedTime(run.elapsed_time) : "—"}</span></td><td className={`${tableCellClasses} ${runTableColumnWidths.created} min-w-0`}><time className="block truncate" dateTime={run.created_at} title={formatCreated(run.created_at)}>{formatCreated(run.created_at)}</time></td>
</tr>)}{runs.data.items.length === 0 && <tr><td colSpan={4} className="px-3 py-6 text-center">{search.states?.length ? <><p>No runs match the selected statuses.</p><Button className="mt-3" onClick={() => void navigate({ to: "/jobs/$jobId", params: { jobId }, search: { ...search, states: undefined, cursor: undefined, previous: undefined } })}>Clear status filters</Button></> : "No runs found."}</td></tr>}</tbody>
</Table></>}
<nav aria-label="Run pages" className="mt-4 flex flex-wrap items-center gap-2">
Expand Down
Loading
Loading