52 lines
1.4 KiB
TypeScript
52 lines
1.4 KiB
TypeScript
import type { AgentJobRow } from "./model";
|
|
|
|
type AgentJobsTableProps = {
|
|
rows: readonly AgentJobRow[];
|
|
};
|
|
|
|
export function AgentJobsTable({ rows }: AgentJobsTableProps) {
|
|
if (rows.length === 0) {
|
|
return <p className="emptyState">No agent jobs yet.</p>;
|
|
}
|
|
|
|
return (
|
|
<table className="table">
|
|
<thead>
|
|
<tr>
|
|
<th>Job</th>
|
|
<th>Status</th>
|
|
<th>Attempt</th>
|
|
<th>Runtime</th>
|
|
<th>Workspace</th>
|
|
<th>Logs</th>
|
|
<th>Outputs</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{rows.map((row) => (
|
|
<tr key={row.id}>
|
|
<td>
|
|
<div>{row.type}</div>
|
|
<small>{row.id}</small>
|
|
{row.parentJobId ? <div>retry of {row.parentJobId}</div> : null}
|
|
</td>
|
|
<td>{row.status}</td>
|
|
<td>{row.attempt}</td>
|
|
<td>
|
|
<div>exit: {row.exitCode ?? "pending"}</div>
|
|
<div>{row.durationMs ?? 0} ms</div>
|
|
{row.error ? <div>{row.error}</div> : null}
|
|
</td>
|
|
<td>{row.workspacePath ?? "pending"}</td>
|
|
<td>
|
|
<pre className="logBlock">{row.stdout || "stdout pending"}</pre>
|
|
{row.stderr ? <pre className="logBlock">{row.stderr}</pre> : null}
|
|
</td>
|
|
<td>{row.outputFiles || "none"}</td>
|
|
</tr>
|
|
))}
|
|
</tbody>
|
|
</table>
|
|
);
|
|
}
|