import type { JobRun } from "../api/types"; import { count, runPillClass, RUN_STATUS_LABEL, TRIGGER_LABEL } from "../lib/feed"; import { fmtTime } from "../lib/format"; /** The last runs of the VISUAL feed as a small table. `attached` maps a run id to the drawings attached after it. */ export function RunsTable({ runs, attached, label = "Last runs" }: { runs: JobRun[]; attached?: Map; label?: string }) { if (!runs.length) return
No runs yet.
; return (
{runs.map((r) => ( ))}
When Trigger Status New Updated Change orders Drawings attached Errors
{fmtTime(r.started_at)} {TRIGGER_LABEL[r.trigger] ?? r.trigger} {RUN_STATUS_LABEL[r.status] ?? r.status} {count(r, "new_drafts")} {count(r, "drafts_updated")} {count(r, "cos_opened") + count(r, "cos_reaimed")} {attached?.get(r.id) ?? count(r, "attached")} {r.errors.length ? ( {r.errors.length === 1 ? r.errors[0] : `${r.errors.length} errors: ${r.errors[0] ?? ""}`} ) : ( None )}
); }