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
9 changes: 5 additions & 4 deletions packages/app/src/features/jobs/detail.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Badge, Button, Page } from "../../shared/ui";
import { Button, Page } from "../../shared/ui";
import { JobTabs } from "./tabs";
import { RunHistory } from "../runs/history";
import { useParams, Link } from "@tanstack/react-router";
Expand All @@ -17,10 +17,11 @@ export function JobDetail() {
const job = query.data;
return <Page className="max-w-6xl"><Link to="/jobs" search={{ q: "" }}>Jobs</Link>
{query.isPending && <p role="status">Loading job…</p>}{query.error && <p role="alert">{query.error.message}</p>}
{job && <><h1 className="mt-5 break-words text-3xl font-semibold">{job.name}</h1><JobTabs jobId={job.id} /><div className="mb-6 flex flex-wrap items-center gap-3"><Badge active={job.enabled}>{job.enabled ? "Enabled" : "Disabled"}</Badge><p className="text-sm text-slate-600 dark:text-slate-400">{job.agentKind} · {job.model || "Default model"} · {job.runningCount}/{job.concurrencyLimit} running</p></div><div className="mb-6 flex flex-wrap items-center gap-3"><InvokeJob jobId={job.id} enabled={job.enabled} />
<Button disabled={enabled.isPending} onClick={() => enabled.mutate(!job.enabled)}>{job.enabled ? "Disable job" : "Enable job"}</Button>
</div>{enabled.error && <p role="alert">{enabled.error.message}</p>}
{job && <><div className="mt-5 flex min-w-0 flex-wrap items-start gap-x-4 gap-y-2"><h1 className={`min-w-0 flex-1 break-words text-3xl font-semibold ${job.enabled ? "" : "text-slate-500 dark:text-slate-400"}`}>{job.name}</h1><div className="flex max-w-full shrink-0 flex-wrap items-center gap-2"><InvokeJob jobId={job.id} enabled={job.enabled} />
<Button className="min-h-9 px-2.5 py-1.5 text-xs" disabled={enabled.isPending} onClick={() => enabled.mutate(!job.enabled)}>{job.enabled ? "Disable job" : "Enable job"}</Button>
</div></div><p className="mb-4 mt-2 text-sm text-slate-600 dark:text-slate-400">{job.agentKind} · {job.model || "Default model"} · {job.runningCount}/{job.concurrencyLimit} running</p><JobTabs jobId={job.id} /><div className="mb-6">{enabled.error && <p role="alert">{enabled.error.message}</p>}
<RunHistory jobId={job.id} />
</div>
</>}
</Page>;
}
2 changes: 1 addition & 1 deletion packages/app/src/features/jobs/invoke.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function InvokeJob({ jobId, enabled }: { jobId: string; enabled: boolean
} catch { setValidation("JSON data must be an object."); return; }
mutation.mutate({ prompt: String(form.get("prompt") ?? ""), data, ...(String(form.get("name") ?? "").trim() ? { name: String(form.get("name")).trim() } : {}) });
}
return <div className="my-4"><Button variant="primary" disabled={!enabled} onClick={() => setOpen(true)}>Run job</Button>{open && <Dialog title="Run job" close={() => setOpen(false)}><p className="mb-5 text-sm text-slate-600 dark:text-slate-400">Start a run with optional instructions and trigger data.</p>
return <div><Button className="min-h-9 px-2.5 py-1.5 text-xs" variant="primary" disabled={!enabled} onClick={() => setOpen(true)}>Run job</Button>{open && <Dialog title="Run job" close={() => setOpen(false)}><p className="mb-5 text-sm text-slate-600 dark:text-slate-400">Start a run with optional instructions and trigger data.</p>
<form onSubmit={submit} className="grid gap-3">
<Label>Run name (optional)<Input name="name" maxLength={120} /></Label>
<Label>Prompt<Textarea name="prompt" maxLength={50000} /></Label>
Expand Down
23 changes: 23 additions & 0 deletions packages/app/test/jobs.browser.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,29 @@ test("invocation validates JSON, preserves retry idempotency and navigates to li
assert.equal(inputs.length, 2); assert.equal(inputs[0].idempotencyKey, inputs[1].idempotencyKey); assert.deepEqual(inputs[1].data, { build: 42 });
assert.equal(await page.locator("main script").count(), 0); await context.close();
});
for (const width of [1280, 390]) test(`job header actions and status remain usable at ${width}px`, async () => {
const { page, context } = await contextFor({ viewport: { width, height: 844 } });
let enabled = true;
const longTitle = "Production deployment " + "with a deliberately long title ".repeat(12);
await page.route(`**/api/v1/jobs/${jobId}`, route => route.fulfill({ json: { ...summary, name: longTitle, enabled, runningCount: 1, concurrencyLimit: 3, promptTemplate: "Template", executionTargetId: "local", triggers: [] } }));
await page.goto(origin + "/jobs/" + jobId);
const heading = page.getByRole("heading", { name: longTitle, exact: true });
await heading.waitFor();
assert.equal(await page.getByText("codex · Default model · 1/3 running", { exact: true }).count(), 1);
assert.equal(await page.getByText("Enabled", { exact: true }).count(), 0);
assert.equal(await page.getByRole("button", { name: "Run job", exact: true }).isEnabled(), true);
assert.equal(await page.getByRole("button", { name: "Disable job", exact: true }).count(), 1);
assert.equal(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth), true);

enabled = false;
await page.reload();
await page.getByRole("heading", { name: longTitle, exact: true }).waitFor();
assert.equal(await page.getByRole("button", { name: "Run job", exact: true }).isDisabled(), true);
assert.equal(await page.getByRole("button", { name: "Enable job", exact: true }).count(), 1);
assert.equal(await heading.evaluate(element => getComputedStyle(element).color !== "rgb(15, 23, 42)"), true);
assert.equal(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth), true);
await context.close();
});
test("trace reset between requests discards old pages and finalization keeps terminal polling alive", async () => {
const { page, context } = await contextFor();
let statusCalls = 0, reset = false;
Expand Down
Binary file modified packages/app/test/visual/baselines/job-dark-1280.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/app/test/visual/baselines/job-dark-390.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/app/test/visual/baselines/job-light-1280.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/app/test/visual/baselines/job-light-390.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/app/test/visual/baselines/long-job-mobile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading