fix(ui): handle empty cron summaries

This commit is contained in:
Val Alexander
2026-04-27 06:46:08 -05:00
parent 15e83969f9
commit 251f01a3b0
3 changed files with 27 additions and 11 deletions

View File

@@ -1341,15 +1341,6 @@
box-sizing: border-box;
}
.cron-run-entry__body pre,
.cron-run-entry__body blockquote,
.cron-job-detail-value pre,
.cron-job-detail-value blockquote {
width: 100%;
max-width: 100%;
box-sizing: border-box;
}
@media (max-width: 1100px) {
.cron-job.list-item {
display: flex;

View File

@@ -372,6 +372,31 @@ describe("cron view", () => {
expect(container.querySelector(".cron-run-entry__body strong")?.textContent).toBe("markdown");
});
it("treats empty run summaries as absent when an error exists", () => {
const container = document.createElement("div");
render(
renderCron(
createProps({
runs: [
{
ts: 2,
jobId: "job-empty-summary",
status: "error",
summary: "",
error: "Failed with **markdown**",
},
],
}),
),
container,
);
expect(container.querySelector(".cron-run-entry__meta")?.textContent).not.toContain(
"Failed with",
);
expect(container.querySelector(".cron-run-entry__body strong")?.textContent).toBe("markdown");
});
it("wires the Edit action and shows save/cancel controls when editing", () => {
const container = document.createElement("div");
const onEdit = vi.fn();

View File

@@ -1723,8 +1723,8 @@ function renderRun(
: usage && typeof usage.input_tokens === "number" && typeof usage.output_tokens === "number"
? `${usage.input_tokens} in / ${usage.output_tokens} out`
: null;
const bodySource = entry.summary ?? entry.error ?? t("cron.runEntry.noSummary");
const showErrorInMeta = !!entry.error && entry.summary != null;
const bodySource = entry.summary || entry.error || t("cron.runEntry.noSummary");
const showErrorInMeta = !!entry.error && !!entry.summary;
return html`
<div class="list-item cron-run-entry">
<div class="cron-run-entry__header">