diff --git a/webui/src/components/settings/system/AutomationsSettings.tsx b/webui/src/components/settings/system/AutomationsSettings.tsx index 25532a64c..cdebe96b8 100644 --- a/webui/src/components/settings/system/AutomationsSettings.tsx +++ b/webui/src/components/settings/system/AutomationsSettings.tsx @@ -300,9 +300,8 @@ export function AutomationsSettings({ {...(selectedJob.protected ? { "aria-describedby": undefined } : {})} {...(!detailOpen ? { inert: "", "aria-hidden": true } : {})} showCloseButton={false} - overlayClassName="bg-black/15 backdrop-blur-none" className={cn( - "flex max-h-[calc(100dvh-2rem)] max-w-[520px] flex-col gap-0 overflow-hidden rounded-[20px] p-0", + "flex max-h-[calc(100dvh-2rem)] max-w-[520px] flex-col gap-0 overflow-hidden p-0", selectedJob.protected && "max-w-[440px]", )} onCloseAutoFocus={(event) => { @@ -401,7 +400,7 @@ function AutomationDetailPanel({ ? `#/chat/${encodeURIComponent(job.origin.session_key)}` : null; const localTrigger = isLocalTriggerAutomation(job); const command = automationTriggerCommand(job); - const message = automationDetailText(job, tx); + const message = localTrigger ? command : job.payload.message || ""; const [messageExpanded, setMessageExpanded] = useState(false); const messageId = useId(); const [commandCopied, setCommandCopied] = useState(false); @@ -420,25 +419,25 @@ function AutomationDetailPanel({ return ( <> -
-
- {job.name || job.id} -
{canManage ? ( - + {formatAutomationSchedule(job, locale, tx)} ยท {formatAutomationNext(job, tx)} ) : null} -
-
- {canManage ?
+ +
+ {canManage && message.trim() ?
{localTrigger ? tx("settings.automations.fields.command", "Command") : tx("settings.automations.instructions", "Instructions")} {localTrigger && command ? ( -
- + {message}
@@ -459,7 +458,7 @@ function AutomationDetailPanel({
: null} {job.state.last_error ? : null} {error ? : null} -
+
{job.protected ? ( <> @@ -487,14 +486,14 @@ function AutomationDetailPanel({ ) : null}
{tx("settings.automations.moreDetails", "More details")} } > -
+
{job.delete_after_run ? {tx("settings.automations.oneShotHint", "Removed after running")} : null} {job.created_at_ms ? {fmtDateTime(job.created_at_ms, locale)} : null} {job.updated_at_ms ? {fmtDateTime(job.updated_at_ms, locale)} : null} @@ -503,27 +502,29 @@ function AutomationDetailPanel({
{canManage ? ( -
- {/* The detail dialog owns modality, including during the delete handoff. */} - {!localTrigger ? void onAction("run", job)}>{tx("settings.automations.runNow", "Run now")} : null} - onRequestDelete(job)} className="text-destructive focus:text-destructive">{tx("settings.automations.delete", "Delete")} + onRequestDelete(job)} tone="destructive">{tx("settings.automations.delete", "Delete")} - - {originHref ? : null} +
+ + {originHref ? : null} +
) : null} @@ -543,9 +544,9 @@ function automationMessageNeedsExpansion(message: string): boolean { function AutomationDetail({ label, title, children }: { label: string; title?: string; children: ReactNode }) { return ( -
+
{label}
-
{children}
+
{children}
); } @@ -869,13 +870,6 @@ function automationSummary( return job.payload.message || tx("settings.automations.systemTask", "System-managed automation"); } -function automationDetailText( - job: SessionAutomationJob, - tx: (key: string, fallback: string, values?: Record) => string, -): string { - return automationSummary(job, tx); -} - function automationNeedsAttention(job: SessionAutomationJob): boolean { return job.state.last_status === "error"; } diff --git a/webui/src/tests/automations-settings.test.tsx b/webui/src/tests/automations-settings.test.tsx index 09f665a2b..e4ed99fbc 100644 --- a/webui/src/tests/automations-settings.test.tsx +++ b/webui/src/tests/automations-settings.test.tsx @@ -204,7 +204,7 @@ describe("Automation task list and detail sheet", () => { expect(within(dialog).getByText("Every 30 minutes")).toBeVisible(); expect(within(dialog).getByText("Not run yet")).toBeVisible(); expect(within(dialog).getAllByRole("button")).toHaveLength(2); - expect(within(dialog).getByRole("button", { name: "Done" })).toHaveClass("text-foreground"); + expect(within(dialog).getByRole("button", { name: "Done" })).toHaveClass("rounded-control", "h-9"); const toggle = within(dialog).getByRole("button", { name: "More details" }); const metadata = document.getElementById(toggle.getAttribute("aria-controls")!)!; expect(metadata).toHaveAttribute("data-state", "closed"); @@ -231,6 +231,31 @@ describe("Automation task list and detail sheet", () => { expect(dialog).not.toHaveAttribute("aria-describedby"); }); + it.each([task, systemTask])("uses shared dialog styling and quiet detail rows for $name", (job) => { + render(); + fireEvent.click(screen.getByRole("button", { name: new RegExp(job.name) })); + const dialog = screen.getByRole("dialog", { name: job.name }); + expect(dialog).toHaveClass("rounded-modal"); + expect(dialog).not.toHaveClass("rounded-[20px]"); + const title = within(dialog).getByRole("heading", { name: job.name }); + expect(title).toHaveClass("text-lg", "leading-6"); + expect(title).not.toHaveClass("text-[22px]"); + const done = within(dialog).getByRole("button", { name: "Done" }); + expect(done).toHaveClass("rounded-control", "h-9"); + expect(done).not.toHaveClass("rounded-full"); + const lastRun = within(dialog).getByText("Last run"); + expect(lastRun.closest("dl")).not.toHaveClass("divide-y", "border-y"); + expect(lastRun.parentElement).toHaveClass("py-2.5"); + const details = within(dialog).getByRole("button", { name: "More details" }); + expect(details.parentElement).toHaveClass("border-t"); + expect(details).toHaveAttribute("aria-expanded", "false"); + if (!job.protected) { + const edit = within(dialog).getByRole("button", { name: "Edit" }); + expect(edit.parentElement).toHaveClass("ml-auto", "flex-wrap", "justify-end"); + expect(within(dialog).getByRole("link", { name: "Open a chat" }).parentElement).toBe(edit.parentElement); + } + }); + it("uses channel search controls and the skills catalog surface for both task groups", async () => { const user = userEvent.setup(); render( { expect(disclosure).toHaveAttribute("aria-expanded", "true"); expect(within(dialog).getByText(task.id)).toBeVisible(); }); + + it.each(["", " \n "])("omits the instructions section when a task has no real message: %j", (message) => { + render(); + fireEvent.click(screen.getByRole("button", { name: /PR watch/ })); + const dialog = screen.getByRole("dialog", { name: "PR watch" }); + expect(within(dialog).queryByText("Instructions")).not.toBeInTheDocument(); + expect(within(dialog).queryByText("System-managed automation")).not.toBeInTheDocument(); + expect(within(dialog).getByText("Last run")).toBeVisible(); + expect(within(dialog).getByRole("button", { name: "Edit" })).toBeEnabled(); + }); });