import type { AgentRecord, RunRecord, TaskRecord, WorkspaceRecord } from "@shared/types"; import { timeAgo } from "../../lib/formatters"; import { EmptyState, Input, ListFrame, ListRow, Panel, Select, StatusPill } from "../ui"; import type { TranslationFn } from "../../i18n"; interface RunQueueProps { filteredRuns: RunRecord[]; selectedRun: RunRecord | null; taskMap: Map; agentMap: Map; workspaceMap: Map; statusFilter: "all" | RunRecord["status"]; setStatusFilter: (value: "all" | RunRecord["status"]) => void; search: string; setSearch: (value: string) => void; onSelectRun: (runId: string) => void; t: TranslationFn; } export function RunQueue({ filteredRuns, selectedRun, taskMap, agentMap, workspaceMap, statusFilter, setStatusFilter, search, setSearch, onSelectRun, t, }: RunQueueProps) { return (
setStatusFilter(value as "all" | RunRecord["status"])} options={[ { value: "all", label: "All" }, { value: "queued", label: "Queued" }, { value: "running", label: "Running" }, { value: "succeeded", label: "Succeeded" }, { value: "failed", label: "Failed" }, { value: "timed_out", label: "Timed out" }, { value: "cancelled", label: "Cancelled" }, { value: "interrupted", label: "Interrupted" }, ]} /> )} >
{filteredRuns.map((run) => { const task = run.taskId ? taskMap.get(run.taskId) : undefined; const agent = agentMap.get(run.agentId); const workspace = run.workspaceId ? workspaceMap.get(run.workspaceId) : null; const title = task?.title ?? (run.summary || `Run ${run.id.slice(0, 8)}`); const supportingText = run.errorMessage || run.summary || "No summary yet"; return ( onSelectRun(run.id)} className={selectedRun?.id === run.id ? "bg-accent" : "hover:bg-muted"} >
{title}
{agent?.name ?? "Unknown agent"} via {run.connectorId} {workspace ? `\u00B7 ${workspace.name}` : ""}
{supportingText} {timeAgo(run.updatedAt)}
); })}
{filteredRuns.length === 0 ? ( ) : null}
); }