Skip to content

Your lightweight open-source personal agent.

feat(webui): refine automation views and scheduling controls

chengyongrue7da86857438
diff --git a/webui/src/App.tsx b/webui/src/App.tsx
index a98704fee..fd398e63f 100644
--- a/webui/src/App.tsx
+++ b/webui/src/App.tsx
@@ -2880,6 +2880,7 @@ function Shell({
initialSection={settingsInitialSection}
initialSettings={settingsSnapshot}
showSidebar={view === "settings"}
+ mainNavigationExpanded={showMainSidebar && hostSidebarOpen}
onToggleTheme={toggle}
onBackToChat={onBackToChat}
onModelNameChange={onModelNameChange}
diff --git a/webui/src/components/settings/SettingsPage.tsx b/webui/src/components/settings/SettingsPage.tsx
index 2be379df4..3dd9f3eec 100644
--- a/webui/src/components/settings/SettingsPage.tsx
+++ b/webui/src/components/settings/SettingsPage.tsx
@@ -49,6 +49,7 @@ interface SettingsPageProps {
controller: SettingsController;
theme: "light" | "dark";
showSidebar: boolean;
+ mainNavigationExpanded: boolean;
onToggleTheme: () => void;
onBackToChat: () => void;
skills: SkillSummary[];
@@ -69,6 +70,7 @@ export function SettingsPage({
controller,
theme,
showSidebar,
+ mainNavigationExpanded,
onToggleTheme,
onBackToChat,
skills,
@@ -734,6 +736,7 @@ export function SettingsPage({
data-testid="settings-section-transition"
ref={setDialogLayoutAnchor}
data-settings-section={activeSection}
+ data-main-navigation-expanded={mainNavigationExpanded}
className={cn(
"mx-auto w-full animate-in fade-in-0 slide-in-from-bottom-1 py-6 duration-200 ease-out",
"motion-reduce:animate-none sm:py-8 lg:py-12",
@@ -744,7 +747,7 @@ export function SettingsPage({
)}
>
{!showSidebar ? (
- <div className={activeSection === "automations" ? "lg:hidden" : "mb-7"}>
+ <div className={activeSection === "automations" ? "lg:hidden" : "settings-feature-header mb-7"}>
<button
type="button"
onClick={backToChat}
diff --git a/webui/src/components/settings/SettingsView.tsx b/webui/src/components/settings/SettingsView.tsx
index a14f1ea5f..662552793 100644
--- a/webui/src/components/settings/SettingsView.tsx
+++ b/webui/src/components/settings/SettingsView.tsx
@@ -12,6 +12,7 @@ interface SettingsViewProps {
initialSection?: SettingsSectionKey;
initialSettings?: SettingsPayload | null;
showSidebar?: boolean;
+ mainNavigationExpanded?: boolean;
onToggleTheme: () => void;
onBackToChat: () => void;
onModelNameChange: (modelName: string | null) => void;
@@ -38,6 +39,7 @@ export function SettingsView({
initialSection = "overview",
initialSettings = null,
showSidebar = true,
+ mainNavigationExpanded = false,
onToggleTheme,
onBackToChat,
onModelNameChange,
@@ -68,6 +70,7 @@ export function SettingsView({
controller={controller}
theme={theme}
showSidebar={showSidebar}
+ mainNavigationExpanded={mainNavigationExpanded}
onToggleTheme={onToggleTheme}
onBackToChat={onBackToChat}
skills={skills}
diff --git a/webui/src/components/settings/system/AutomationCalendar.tsx b/webui/src/components/settings/system/AutomationCalendar.tsx
index 211d64050..b1547ad5f 100644
--- a/webui/src/components/settings/system/AutomationCalendar.tsx
+++ b/webui/src/components/settings/system/AutomationCalendar.tsx
@@ -1,6 +1,5 @@
import { CircleAlert, Loader2, X } from "lucide-react";
import { useId, useLayoutEffect, useMemo, useRef, useState } from "react";
-import type { ReactNode } from "react";
import { Button } from "@/components/ui/button";
import { formControlFocusClassName } from "@/components/ui/form-control";
@@ -18,9 +17,6 @@ type CalendarEntry = {
};
type CalendarCopy = {
- previousMonth: string;
- nextMonth: string;
- today: string;
planned: string;
recorded: string;
running: string;
@@ -29,13 +25,14 @@ type CalendarCopy = {
close: string;
noEntries: string;
completed: string;
+ system: string;
};
interface AutomationCalendarProps {
jobs: SessionAutomationJob[];
+ month: Date;
locale: string;
copy: CalendarCopy;
- filters?: ReactNode;
onInspect: (job: SessionAutomationJob, trigger: HTMLElement) => void;
}
@@ -43,18 +40,10 @@ function startOfDay(date: Date): Date {
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
}
-function startOfMonth(date: Date): Date {
- return new Date(date.getFullYear(), date.getMonth(), 1);
-}
-
function addDays(date: Date, amount: number): Date {
return new Date(date.getFullYear(), date.getMonth(), date.getDate() + amount);
}
-function addMonths(date: Date, amount: number): Date {
- return new Date(date.getFullYear(), date.getMonth() + amount, 1);
-}
-
function mondayIndex(date: Date): number {
return (date.getDay() + 6) % 7;
}
@@ -134,13 +123,6 @@ function CalendarEntryRow({ entry, locale, copy, onInspect, compact = false }: {
: copy.recorded;
const content = (
<>
- <span className={cn(
- "mt-[0.4rem] h-1.5 w-1.5 shrink-0 rounded-full",
- running && "bg-[hsl(var(--usage-token))]",
- failed && "bg-destructive",
- !running && !failed && entry.kind === "planned" && "border border-foreground/50 bg-background",
- !running && !failed && entry.kind === "recorded" && "bg-foreground/45",
- )} aria-hidden />
<span className="min-w-0 flex-1">
<span className="block truncate font-medium text-foreground">{name}</span>
<span className="mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[10px] leading-4 text-muted-foreground">
@@ -148,6 +130,7 @@ function CalendarEntryRow({ entry, locale, copy, onInspect, compact = false }: {
{failed ? <CircleAlert className="h-3 w-3" aria-hidden /> : null}
<span className="tabular-nums">{entryTime(entry, locale)}</span>
{compact ? <span>{status}</span> : null}
+ {entry.job.protected ? <span>{copy.system}</span> : null}
</span>
</span>
</>
@@ -165,7 +148,7 @@ function CalendarEntryRow({ entry, locale, copy, onInspect, compact = false }: {
<button
type="button"
className={actionClass}
- aria-label={`${name}, ${entryTime(entry, locale)}, ${status}`}
+ aria-label={`${name}, ${entryTime(entry, locale)}, ${status}${entry.job.protected ? `, ${copy.system}` : ""}`}
aria-haspopup="dialog"
onClick={(event) => onInspect(entry.job, event.currentTarget)}
>
@@ -193,7 +176,7 @@ function CalendarOverflowEntries({ entries, dayLabel, locale, copy, onInspect }:
ref={triggerRef}
type="button"
className={cn(
- "min-h-6 w-full rounded-compact pe-2 ps-[1.375rem] py-1 text-left text-[10px] text-muted-foreground transition-colors duration-150 hover:bg-foreground/[0.055] hover:text-foreground motion-reduce:transition-none",
+ "min-h-6 w-full rounded-compact px-2 py-1 text-left text-[10px] text-muted-foreground transition-colors duration-150 hover:bg-foreground/[0.055] hover:text-foreground motion-reduce:transition-none",
formControlFocusClassName,
)}
>
@@ -239,8 +222,7 @@ function CalendarOverflowEntries({ entries, dayLabel, locale, copy, onInspect }:
);
}
-export function AutomationCalendar({ jobs, locale, copy, filters, onInspect }: AutomationCalendarProps) {
- const [month, setMonth] = useState(() => startOfMonth(new Date()));
+export function AutomationCalendar({ jobs, month, locale, copy, onInspect }: AutomationCalendarProps) {
const calendarRef = useRef<HTMLElement | null>(null);
const [wideCalendar, setWideCalendar] = useState(true);
const today = startOfDay(new Date());
@@ -276,44 +258,8 @@ export function AutomationCalendar({ jobs, locale, copy, filters, onInspect }: A
}, []);
return (
- <section ref={calendarRef} className="automation-calendar overflow-hidden rounded-panel bg-[hsl(var(--settings-surface))]">
+ <section ref={calendarRef} className="automation-calendar overflow-hidden bg-[hsl(var(--settings-surface))]">
<div className="automation-calendar-header bg-foreground/[0.025]">
- <div className="automation-calendar-toolbar">
- <h2 className="min-w-0 text-[15px] font-semibold text-foreground">{monthLabel}</h2>
- {filters ? <div className="automation-calendar-filters min-w-0">{filters}</div> : null}
- <div className="automation-calendar-navigation flex items-center gap-1">
- <Button
- type="button"
- variant="outline"
- size="sm"
- className="h-8 rounded-control px-3 text-[12px]"
- onClick={() => setMonth(startOfMonth(new Date()))}
- >
- {copy.today}
- </Button>
- <Button
- type="button"
- variant="ghost"
- size="icon"
- className="h-8 w-8 text-muted-foreground"
- aria-label={copy.previousMonth}
- onClick={() => setMonth((value) => addMonths(value, -1))}
- >
- <span className="text-lg leading-none" aria-hidden>‹</span>
- </Button>
- <Button
- type="button"
- variant="ghost"
- size="icon"
- className="h-8 w-8 text-muted-foreground"
- aria-label={copy.nextMonth}
- onClick={() => setMonth((value) => addMonths(value, 1))}
- >
- <span className="text-lg leading-none" aria-hidden>›</span>
- </Button>
- </div>
- </div>
-
{wideCalendar ? <div className="automation-calendar-weekdays" aria-hidden>
{weekdayLabels.map((label) => <div key={label}>{label}</div>)}
</div> : null}
@@ -396,21 +342,6 @@ export function AutomationCalendar({ jobs, locale, copy, filters, onInspect }: A
)}
</div> : null}
- {jobs.length ? (
- <div className="automation-meta-row py-2 text-[10px] text-muted-foreground">
- <span className="flex h-4 w-4 items-center justify-center" aria-hidden>
- <span className="h-1.5 w-1.5 rounded-full border border-foreground/50 bg-background" />
- </span>
- <span className="flex flex-wrap items-center gap-x-4 gap-y-1">
- <span>{copy.planned}</span>
- <span className="inline-flex items-center gap-1.5">
- <span className="h-1.5 w-1.5 rounded-full bg-foreground/45" aria-hidden />
- {copy.recorded}
- </span>
- </span>
- </div>
- ) : null}
-
</section>
);
}
diff --git a/webui/src/components/settings/system/AutomationRunAtPicker.tsx b/webui/src/components/settings/system/AutomationRunAtPicker.tsx
new file mode 100644
index 000000000..7fbb7f048
--- /dev/null
+++ b/webui/src/components/settings/system/AutomationRunAtPicker.tsx
@@ -0,0 +1,196 @@
+import { CalendarDays, ChevronLeft, ChevronRight, Clock3 } from "lucide-react";
+import { useId, useLayoutEffect, useRef, useState, type KeyboardEvent } from "react";
+import { useTranslation } from "react-i18next";
+
+import { Button } from "@/components/ui/button";
+import { formControlFocusClassName } from "@/components/ui/form-control";
+import { Input } from "@/components/ui/input";
+import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
+import { cn } from "@/lib/utils";
+
+function dateKey(date: Date): string {
+ return `${String(date.getFullYear()).padStart(4, "0")}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
+}
+
+function localDay(year: number, month: number, day: number): Date {
+ const date = new Date(0);
+ date.setHours(12, 0, 0, 0);
+ date.setFullYear(year, month, day);
+ return date;
+}
+
+function parseDay(value: string): Date | null {
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(value)) return null;
+ const [year, month, day] = value.split("-").map(Number);
+ const date = localDay(year, month - 1, day);
+ return year > 0 && dateKey(date) === value ? date : null;
+}
+
+export function parseAutomationRunAt(value: string): Date | null {
+ const [day, time, extra] = value.split("T");
+ const date = parseDay(day);
+ if (!date || extra !== undefined || !/^([01]\d|2[0-3]):[0-5]\d$/.test(time ?? "")) return null;
+ const [hour, minute] = time.split(":").map(Number);
+ date.setHours(hour, minute, 0, 0);
+ // Reject impossible dates and local times instead of silently rolling forward.
+ return dateKey(date) === day && date.getHours() === hour && date.getMinutes() === minute ? date : null;
+}
+
+function moveMonth(date: Date, amount: number): Date {
+ const month = localDay(date.getFullYear(), date.getMonth() + amount, 1);
+ const lastDay = localDay(month.getFullYear(), month.getMonth() + 1, 0).getDate();
+ month.setDate(Math.min(date.getDate(), lastDay));
+ return month;
+}
+
+export function AutomationRunAtPicker({ value, onChange, disabled = false, errorId }: {
+ value: string;
+ onChange: (value: string) => void;
+ disabled?: boolean;
+ errorId?: string;
+}) {
+ const { t, i18n } = useTranslation();
+ const locale = i18n.resolvedLanguage || i18n.language;
+ const id = useId();
+ const [open, setOpen] = useState(false);
+ const [focusedDay, setFocusedDay] = useState(() => parseDay(value.split("T")[0]) ?? new Date());
+ const activeDay = useRef<HTMLButtonElement | null>(null);
+ const restoreGridFocus = useRef(false);
+ const [dateValue, timeValue = ""] = value.split("T");
+ const month = localDay(focusedDay.getFullYear(), focusedDay.getMonth(), 1);
+ const weekStart = (month.getDay() + 6) % 7;
+ const monthLabel = new Intl.DateTimeFormat(locale, { year: "numeric", month: "long" }).format(month);
+ const dayFormatter = new Intl.DateTimeFormat(locale, { dateStyle: "full" });
+ const weekdays = Array.from({ length: 7 }, (_, index) => localDay(2026, 0, 5 + index));
+ const todayKey = dateKey(new Date());
+
+ useLayoutEffect(() => {
+ if (restoreGridFocus.current) {
+ activeDay.current?.focus({ preventScroll: true });
+ restoreGridFocus.current = false;
+ }
+ }, [focusedDay]);
+
+ const navigate = (next: Date, focus = false) => {
+ if (next.getFullYear() < 1 || next.getFullYear() > 9999) return;
+ restoreGridFocus.current = focus;
+ setFocusedDay(next);
+ };
+ const selectDay = (day: Date) => {
+ onChange(`${dateKey(day)}T${timeValue}`);
+ setOpen(false);
+ };
+ const onDayKeyDown = (event: KeyboardEvent<HTMLButtonElement>, day: Date) => {
+ const next = new Date(day);
+ const weekday = (day.getDay() + 6) % 7;
+ const rtl = i18n.dir(locale) === "rtl";
+ switch (event.key) {
+ case "ArrowLeft": next.setDate(day.getDate() + (rtl ? 1 : -1)); break;
+ case "ArrowRight": next.setDate(day.getDate() + (rtl ? -1 : 1)); break;
+ case "ArrowUp": next.setDate(day.getDate() - 7); break;
+ case "ArrowDown": next.setDate(day.getDate() + 7); break;
+ case "Home": next.setDate(day.getDate() - weekday); break;
+ case "End": next.setDate(day.getDate() + 6 - weekday); break;
+ case "PageUp": case "PageDown":
+ event.preventDefault();
+ navigate(moveMonth(day, (event.key === "PageUp" ? -1 : 1) * (event.shiftKey ? 12 : 1)), true);
+ return;
+ default: return;
+ }
+ event.preventDefault();
+ navigate(next, true);
+ };
+
+ return (
+ <fieldset className="automation-run-at-picker min-w-0" disabled={disabled}>
+ <legend className="mb-1.5 text-[12px] font-medium text-muted-foreground">{t("settings.automations.fields.runAt")}</legend>
+ <div className="automation-run-at-fields grid min-w-0 gap-2">
+ <div className="relative min-w-0">
+ <label htmlFor={`${id}-date`} className="sr-only">{t("settings.automations.fields.runDate")}</label>
+ <Input id={`${id}-date`} type="text" value={dateValue} placeholder="YYYY-MM-DD"
+ aria-describedby={errorId}
+ aria-invalid={dateValue !== "" && !parseDay(dateValue) || undefined}
+ autoComplete="off" spellCheck={false} className="pe-11 text-[16px] tabular-nums sm:text-[13px]"
+ onChange={(event) => onChange(`${event.target.value}T${timeValue}`)} />
+ <Popover open={open} onOpenChange={(next) => {
+ setOpen(next);
+ if (next) setFocusedDay(parseDay(dateValue) ?? new Date());
+ }}>
+ <PopoverTrigger asChild>
+ <Button type="button" variant="ghost" size="icon" disabled={disabled}
+ aria-label={t("settings.automations.fields.chooseDate")}
+ className="absolute end-1 top-1 h-8 w-8 rounded-full text-muted-foreground">
+ <CalendarDays className="h-4 w-4" aria-hidden />
+ </Button>
+ </PopoverTrigger>
+ <PopoverContent align="end" collisionPadding={12} aria-label={t("settings.automations.fields.chooseDate")}
+ data-automation-date-calendar=""
+ className="w-72 max-w-[calc(100vw-2rem)] overscroll-contain p-3"
+ onEscapeKeyDown={(event) => {
+ event.preventDefault();
+ setOpen(false);
+ }}
+ onOpenAutoFocus={(event) => { event.preventDefault(); activeDay.current?.focus({ preventScroll: true }); }}>
+ <div className="mb-2 flex items-center gap-1">
+ <span id={`${id}-month`} aria-live="polite" className="min-w-0 flex-1 ps-2 text-[13px] font-semibold">{monthLabel}</span>
+ <Button type="button" variant="ghost" size="icon" className="h-8 w-8 shrink-0"
+ disabled={month.getFullYear() === 1 && month.getMonth() === 0}
+ aria-label={t("settings.automations.calendar.previousMonth")}
+ onClick={() => navigate(moveMonth(focusedDay, -1))}>
+ <ChevronLeft className="h-4 w-4 rtl:rotate-180" aria-hidden />
+ </Button>
+ <Button type="button" variant="ghost" size="icon" className="h-8 w-8 shrink-0"
+ disabled={month.getFullYear() === 9999 && month.getMonth() === 11}
+ aria-label={t("settings.automations.calendar.nextMonth")}
+ onClick={() => navigate(moveMonth(focusedDay, 1))}>
+ <ChevronRight className="h-4 w-4 rtl:rotate-180" aria-hidden />
+ </Button>
+ </div>
+ <table role="grid" aria-labelledby={`${id}-month`} className="w-full table-fixed border-collapse text-center text-[12px]">
+ <thead><tr>{weekdays.map((day) => (
+ <th key={day.getDay()} scope="col" className="h-8 font-normal text-muted-foreground"
+ aria-label={new Intl.DateTimeFormat(locale, { weekday: "long" }).format(day)}>
+ {new Intl.DateTimeFormat(locale, { weekday: "short" }).format(day)}
+ </th>
+ ))}</tr></thead>
+ <tbody>{Array.from({ length: 6 }, (_, week) => (
+ <tr key={week}>{Array.from({ length: 7 }, (_, column) => {
+ const day = localDay(month.getFullYear(), month.getMonth(), 1 - weekStart + week * 7 + column);
+ const key = dateKey(day);
+ const selected = key === dateValue;
+ const focused = key === dateKey(focusedDay);
+ return <td key={key} role="gridcell" aria-selected={selected} className="p-0.5">
+ <button ref={focused ? activeDay : undefined} type="button" tabIndex={focused ? 0 : -1}
+ disabled={day.getFullYear() < 1 || day.getFullYear() > 9999}
+ aria-label={dayFormatter.format(day)} aria-current={key === todayKey ? "date" : undefined}
+ className={cn("flex h-8 w-full items-center justify-center rounded-full tabular-nums transition-colors hover:bg-muted motion-reduce:transition-none",
+ formControlFocusClassName,
+ day.getMonth() !== month.getMonth() && "text-muted-foreground/60",
+ key === todayKey && !selected && "font-semibold ring-1 ring-inset ring-border",
+ selected && "bg-foreground font-medium text-background hover:bg-foreground/90")}
+ onKeyDown={(event) => onDayKeyDown(event, day)} onClick={() => selectDay(day)}>
+ {day.getDate()}
+ </button>
+ </td>;
+ })}</tr>
+ ))}</tbody>
+ </table>
+ <Button type="button" variant="ghost" size="sm" className="mt-2 w-full text-[12px]" onClick={() => selectDay(new Date())}>
+ {t("settings.automations.calendar.today")}
+ </Button>
+ </PopoverContent>
+ </Popover>
+ </div>
+ <div className="relative">
+ <label htmlFor={`${id}-time`} className="sr-only">{t("settings.automations.fields.runTime")}</label>
+ <Clock3 className="pointer-events-none absolute start-3 top-3 h-4 w-4 text-muted-foreground" aria-hidden />
+ <Input id={`${id}-time`} type="text" value={timeValue} placeholder="HH:mm"
+ aria-describedby={errorId}
+ aria-invalid={timeValue !== "" && !/^([01]\d|2[0-3]):[0-5]\d$/.test(timeValue) || undefined}
+ autoComplete="off" spellCheck={false} className="ps-9 text-[16px] tabular-nums sm:text-[13px]"
+ onChange={(event) => onChange(`${dateValue}T${event.target.value}`)} />
+ </div>
+ </div>
+ </fieldset>
+ );
+}
diff --git a/webui/src/components/settings/system/AutomationsSettings.tsx b/webui/src/components/settings/system/AutomationsSettings.tsx
index e27288c31..8d61b976f 100644
--- a/webui/src/components/settings/system/AutomationsSettings.tsx
+++ b/webui/src/components/settings/system/AutomationsSettings.tsx
@@ -6,6 +6,7 @@ import {
ChevronDown,
CircleAlert,
Clipboard,
+ ListFilter,
Loader2,
} from "lucide-react";
import { useTranslation } from "react-i18next";
@@ -13,14 +14,15 @@ import { useTranslation } from "react-i18next";
import { channelTranslator } from "@/channel-plugins/i18n";
import { channelUiOwner, channelUiPresentation } from "@/channel-plugins/registry";
import { AutomationCalendar } from "@/components/settings/system/AutomationCalendar";
-import { SettingsGroup } from "@/components/settings/shared/SettingsControls";
+import { AutomationRunAtPicker, parseAutomationRunAt } from "@/components/settings/system/AutomationRunAtPicker";
import {
modelPresetOptionsFromSettings,
toModelBadgeInfo,
} from "@/components/thread/model-preset";
import { ThreadComposer } from "@/components/thread/ThreadComposer";
import { Button } from "@/components/ui/button";
-import { Disclosure, DisclosureContent } from "@/components/ui/disclosure";
+import { Disclosure } from "@/components/ui/disclosure";
+import { DropdownMenu, DropdownMenuContent, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
import { ExpandableText } from "@/components/ui/expandable-text";
import {
Dialog,
@@ -50,7 +52,6 @@ export type AutomationFilter = "all" | "active" | "paused" | "failed" | "system"
export type AutomationAction = "enable" | "disable" | "delete" | "run";
const EMPTY_TITLE_OVERRIDES: Record<string, string> = {};
-const SYSTEM_TASKS_OPEN_STORAGE_KEY = "nanobot-webui.automation-system-tasks-open";
export function AutomationsSettings({
payload, loading, filter, actionKey, error,
@@ -97,35 +98,28 @@ export function AutomationsSettings({
const [inspectedJob, setInspectedJob] = useState<SessionAutomationJob | null>(null);
const [detailOpen, setDetailOpen] = useState(false);
const [localModelPreset, setLocalModelPreset] = useState<string | null>(null);
- const [systemOpen, setSystemOpen] = useState(() => {
- try {
- return window.localStorage.getItem(SYSTEM_TASKS_OPEN_STORAGE_KEY) !== "false";
- } catch {
- return true;
- }
+ const [view, setView] = useState<"tasks" | "calendar">("calendar");
+ const [month, setMonth] = useState(() => {
+ const today = new Date();
+ return new Date(today.getFullYear(), today.getMonth(), 1);
});
const pageTitle = useRef<HTMLHeadingElement | null>(null);
const selectedTrigger = useRef<HTMLElement | null>(null);
const afterDetailClose = useRef<((job: SessionAutomationJob) => void) | null>(null);
- const filtered = useMemo(() => {
- return jobs
- .filter((job) => automationMatchesFilter(job, filter));
- }, [filter, jobs]);
- const personalJobs = jobs.filter((job) => !job.protected);
- const personal = filtered.filter((job) => !job.protected);
- const system = filtered.filter((job) => job.protected);
+ const visibleJobs = useMemo(() => jobs.filter((job) => !job.protected), [jobs]);
+ const filtered = useMemo(() => visibleJobs.filter((job) => automationMatchesFilter(job, filter)), [filter, visibleJobs]);
// Keep an inspected task open when an action moves it outside the current filter.
const liveSelectedJob = jobs.find((job) => job.id === inspectedJob?.id);
// Retain the last detail through its exit, even if a one-shot task disappears.
const selectedJob = liveSelectedJob ?? inspectedJob;
const summaryOptions: Array<{ value: AutomationFilter; label: string; count: number }> = [
- { value: "all", label: tx("settings.automations.filters.all", "All"), count: personalJobs.length },
+ { value: "all", label: tx("settings.automations.filters.all", "All"), count: visibleJobs.length },
{ value: "active", label: tx("settings.automations.filters.active", "Active"),
- count: personalJobs.filter((job) => automationMatchesFilter(job, "active")).length },
- { value: "paused", label: tx("settings.automations.filters.paused", "Paused"),
- count: personalJobs.filter((job) => automationMatchesFilter(job, "paused")).length },
+ count: visibleJobs.filter((job) => automationMatchesFilter(job, "active")).length },
+ { value: "paused", label: tx("settings.automations.filters.paused", "Disabled"),
+ count: visibleJobs.filter((job) => automationMatchesFilter(job, "paused")).length },
{ value: "failed", label: tx("settings.automations.filters.failed", "Needs attention"),
- count: personalJobs.filter(automationNeedsAttention).length },
+ count: visibleJobs.filter(automationNeedsAttention).length },
];
const configuredPresetNames = useMemo(
() => new Set(settingsSnapshot?.model_presets?.map((preset) => preset.name) ?? []),
@@ -163,19 +157,6 @@ export function AutomationsSettings({
onReturnToDetailHandled?.();
}, [jobs, onReturnToDetailHandled, returnToDetailJob]);
- const renderJob = (job: SessionAutomationJob) => (
- <AutomationListItem
- key={job.id}
- job={job}
- locale={locale}
- disabled={Boolean(job.protected) && !systemOpen}
- onSelect={(button) => {
- selectedTrigger.current = button;
- setInspectedJob(job);
- setDetailOpen(true);
- }}
- />
- );
const inspectJob = (job: SessionAutomationJob, trigger: HTMLElement) => {
selectedTrigger.current = trigger;
setInspectedJob(job);
@@ -201,10 +182,37 @@ export function AutomationsSettings({
options,
activeModelPreset,
);
+ const filterLabel = filter === "all" ? tx("settings.automations.filter", "Filter") : tx("settings.automations.filteredBy", "Filter: {{status}}", {
+ status: summaryOptions.find((option) => option.value === filter)?.label,
+ });
+ const filters = visibleJobs.length ? (
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <Button variant="ghost" size="sm" aria-label={filterLabel} title={filterLabel}
+ className={cn("h-8 text-[12px]", filter === "all" ? "w-8 p-0 text-muted-foreground" : "gap-1.5 bg-background text-foreground")}>
+ <ListFilter className="h-4 w-4" strokeWidth={1.5} aria-hidden />
+ {filter !== "all" ? filterLabel : null}
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" aria-label={tx("settings.automations.filter", "Filter")}>
+ <DropdownMenuRadioGroup value={filter} onValueChange={(value) => {
+ const option = summaryOptions.find((item) => item.value === value);
+ if (option) onFilterChange(option.value);
+ }}>
+ {summaryOptions.map((option) => (
+ <DropdownMenuRadioItem key={option.value} value={option.value} className="gap-6">
+ <span>{option.label}</span>
+ <span className="ms-auto tabular-nums text-muted-foreground">{option.count}</span>
+ </DropdownMenuRadioItem>
+ ))}
+ </DropdownMenuRadioGroup>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ ) : null;
return (
<div className="automations-page">
- <header className="mb-7">
+ <header className="settings-feature-header mb-7">
<h1 ref={pageTitle} tabIndex={-1} className="text-[24px] font-normal leading-tight tracking-normal text-foreground outline-none sm:text-[28px]">
{tx("settings.nav.automations", "Automations")}
</h1>
@@ -221,7 +229,7 @@ export function AutomationsSettings({
inputAriaLabel={tx("settings.automations.createInput", "Describe an automation")}
placeholder={tx(
"settings.automations.createPrompt",
- "What would you like nanobot to schedule?",
+ "What would you like nanobot to automate?",
)}
variant="thread"
compactWhenIdle
@@ -240,89 +248,115 @@ export function AutomationsSettings({
) : null}
{error ? <AutomationError message={error} /> : null}
- {loading && !payload ? (
- <div role="status" className="flex h-44 items-center justify-center rounded-panel border border-border/70 bg-[hsl(var(--settings-surface))] text-[13px] text-muted-foreground">
- <Loader2 className="mr-2 h-4 w-4 animate-spin" aria-hidden />
- {tx("settings.automations.loading", "Loading automations...")}
- </div>
- ) : (
- <AutomationCalendar
- jobs={personal}
- locale={locale}
- filters={jobs.length ? (
- <div role="group" aria-label={tx("settings.nav.automations", "Automations")}>
- <SegmentedControl
- value={filter}
- className="flex-wrap justify-start"
- itemClassName="px-2.5"
- options={summaryOptions.map((option) => ({
- value: option.value,
- label: <>{option.label} <span className="ml-0.5 tabular-nums opacity-65">{option.count}</span></>,
- }))}
- onChange={onFilterChange}
- />
+ <div className="automation-panel overflow-hidden rounded-panel bg-[hsl(var(--settings-surface))]">
+ <div className="automation-panel-toolbar bg-foreground/[0.025]">
+ <div className="automation-view-switch" role="group" aria-label={tx("settings.automations.views.label", "Automation view")}>
+ <SegmentedControl
+ value={view}
+ className="bg-[var(--automation-view-track)]"
+ itemClassName="min-h-8"
+ options={[
+ { value: "tasks", label: tx("settings.automations.views.tasks", "Tasks") },
+ { value: "calendar", label: tx("settings.automations.views.calendar", "Calendar") },
+ ]}
+ onChange={setView}
+ />
+ </div>
+ {view === "calendar" ? (
+ <h2 className="shrink-0 text-[13px] font-normal text-muted-foreground">
+ {new Intl.DateTimeFormat(locale, { month: "long", year: "numeric" }).format(month)}
+ </h2>
+ ) : null}
+ {filters ? <div className="automation-panel-filters min-w-0">{filters}</div> : null}
+ {view === "calendar" ? (
+ <div className="automation-calendar-navigation flex shrink-0 items-center gap-1">
+ <Button type="button" variant="outline" size="sm" className="h-8 rounded-control px-3 text-[12px]"
+ onClick={() => { const today = new Date(); setMonth(new Date(today.getFullYear(), today.getMonth(), 1)); }}>
+ {tx("settings.automations.calendar.today", "Today")}
+ </Button>
+ <Button type="button" variant="ghost" size="icon" className="h-8 w-8 text-muted-foreground"
+ aria-label={tx("settings.automations.calendar.previousMonth", "Previous month")}
+ onClick={() => setMonth((value) => new Date(value.getFullYear(), value.getMonth() - 1, 1))}>
+ <span className="text-lg leading-none" aria-hidden>‹</span>
+ </Button>
+ <Button type="button" variant="ghost" size="icon" className="h-8 w-8 text-muted-foreground"
+ aria-label={tx("settings.automations.calendar.nextMonth", "Next month")}
+ onClick={() => setMonth((value) => new Date(value.getFullYear(), value.getMonth() + 1, 1))}>
+ <span className="text-lg leading-none" aria-hidden>›</span>
+ </Button>
</div>
) : null}
- copy={{
- previousMonth: tx("settings.automations.calendar.previousMonth", "Previous month"),
- nextMonth: tx("settings.automations.calendar.nextMonth", "Next month"),
- today: tx("settings.automations.calendar.today", "Today"),
- planned: tx("settings.automations.calendar.planned", "Planned"),
- recorded: tx("settings.automations.calendar.recorded", "Recorded"),
- running: tx("settings.automations.status.running", "Running"),
- failed: tx("settings.automations.status.failed", "Failed"),
- more: (count) => tx("settings.automations.calendar.more", "+{{count}} more", { count }),
- close: tx("common.close", "Close"),
- noEntries: personal.length
- ? tx("settings.automations.calendar.noEntries", "No runs in this month.")
- : personalJobs.length
- ? tx("settings.automations.noMatches", "No automations match this view.")
- : tx("settings.automations.empty", "No automations yet."),
- completed: tx("settings.automations.status.completed", "Completed"),
- }}
- onInspect={inspectJob}
- />
- )}
-
- {system.length ? (
- <SettingsGroup>
- <section className="py-2">
- <button
- type="button"
- aria-expanded={systemOpen}
- aria-controls="automation-system-tasks"
- onClick={() => {
- const open = !systemOpen;
- setSystemOpen(open);
- try {
- window.localStorage.setItem(SYSTEM_TASKS_OPEN_STORAGE_KEY, String(open));
- } catch {
- // Unavailable storage must not prevent expanding or collapsing.
- }
- }}
- className={cn("automation-meta-row min-h-10 w-full items-center rounded-control py-1.5 text-left text-[13px] font-medium text-muted-foreground settings-hover", formControlFocusClassName)}
- >
- <span className="h-4 w-4" aria-hidden />
- <span className="flex min-w-0 items-center gap-2">
- <span className="truncate">{tx("settings.automations.systemTasks", "System tasks")}</span>
- <span className="text-[12px] font-normal tabular-nums text-muted-foreground/60">{system.length}</span>
- {system.some(automationNeedsAttention) ? (
- <span className="ml-auto inline-flex items-center gap-1.5 text-[12px] font-normal text-amber-700 dark:text-amber-400">
- <CircleAlert className="h-3.5 w-3.5" aria-hidden />
- {tx("settings.automations.filters.failed", "Needs attention")}
- </span>
- ) : null}
- </span>
- <ChevronDown className={cn("h-4 w-4 shrink-0 text-muted-foreground transition-transform motion-reduce:transition-none", systemOpen && "rotate-180")} aria-hidden />
- </button>
- <DisclosureContent id="automation-system-tasks" open={systemOpen}>
- <ul aria-label={tx("settings.automations.systemTasks", "System tasks")} className="space-y-1 px-4 pt-1 sm:px-6">
- {system.map(renderJob)}
+ </div>
+ {loading && !payload ? (
+ <div role="status" className="flex h-44 items-center justify-center rounded-panel border border-border/70 bg-[hsl(var(--settings-surface))] text-[13px] text-muted-foreground">
+ <Loader2 className="mr-2 h-4 w-4 animate-spin" aria-hidden />
+ {tx("settings.automations.loading", "Loading automations...")}
+ </div>
+ ) : view === "tasks" ? (
+ <section className="p-1" aria-label={tx("settings.automations.views.tasks", "Tasks")}>
+ {filtered.length ? (
+ <ul className="space-y-1">
+ {filtered.map((job) => {
+ const status = automationStatusKey(job);
+ const emphasizedStatus = status === "running" || status === "failed" || status === "paused";
+ return (
+ <li key={job.id}>
+ <button
+ type="button"
+ aria-haspopup="dialog"
+ onClick={(event) => inspectJob(job, event.currentTarget)}
+ className={cn("flex w-full min-w-0 flex-wrap items-center justify-between gap-x-6 gap-y-2 rounded-control px-3 py-3 text-start transition-colors hover:bg-foreground/[0.045] motion-reduce:transition-none", formControlFocusClassName)}
+ >
+ <span className="min-w-0 flex-1 basis-48">
+ <span className="block truncate text-[14px] font-medium text-foreground">{job.name || job.id}</span>
+ <span className="mt-1 flex flex-wrap gap-x-3 gap-y-1 text-[12px] leading-5 text-muted-foreground">
+ <span>{formatAutomationSchedule(job, locale, tx)}</span>
+ {job.protected ? <span>{tx("settings.automations.filters.system", "System")}</span> : null}
+ </span>
+ </span>
+ {emphasizedStatus ? (
+ <span className={cn("inline-flex items-center gap-1.5 text-[12px]", status === "failed" ? "text-destructive" : "text-muted-foreground")}>
+ {status === "running" ? <Loader2 className="h-3.5 w-3.5 animate-spin motion-reduce:animate-none" aria-hidden /> : null}
+ {status === "failed" ? <CircleAlert className="h-3.5 w-3.5" aria-hidden /> : null}
+ {tx(`settings.automations.status.${status}`, status === "paused" ? "Disabled" : status === "running" ? "Running" : "Failed")}
+ </span>
+ ) : null}
+ </button>
+ </li>
+ );
+ })}
</ul>
- </DisclosureContent>
+ ) : (
+ <p className="px-3 py-10 text-center text-[13px] text-muted-foreground">
+ {visibleJobs.length ? tx("settings.automations.noMatches", "No automations match this view.") : tx("settings.automations.empty", "No automations yet.")}
+ </p>
+ )}
</section>
- </SettingsGroup>
- ) : null}
+ ) : (
+ <AutomationCalendar
+ jobs={filtered}
+ month={month}
+ locale={locale}
+ copy={{
+ planned: tx("settings.automations.calendar.planned", "Planned"),
+ recorded: tx("settings.automations.calendar.recorded", "Recorded"),
+ running: tx("settings.automations.status.running", "Running"),
+ failed: tx("settings.automations.status.failed", "Failed"),
+ more: (count) => tx("settings.automations.calendar.more", "+{{count}} more", { count }),
+ close: tx("common.close", "Close"),
+ system: tx("settings.automations.filters.system", "System"),
+ noEntries: filtered.length
+ ? tx("settings.automations.calendar.noEntries", "No runs in this month.")
+ : visibleJobs.length
+ ? tx("settings.automations.noMatches", "No automations match this view.")
+ : tx("settings.automations.empty", "No automations yet."),
+ completed: tx("settings.automations.status.completed", "Completed"),
+ }}
+ onInspect={inspectJob}
+ />
+ )}
+ </div>
+
</div>
<AutomationDetailDialog
@@ -402,53 +436,6 @@ export function AutomationDetailDialog({
);
}
-function AutomationListItem({ job, locale, disabled, onSelect }: {
- job: SessionAutomationJob;
- locale: string;
- disabled: boolean;
- onSelect: (button: HTMLButtonElement) => void;
-}) {
- const { t } = useTranslation();
- const tx = (key: string, fallback: string, values?: Record<string, unknown>) =>
- t(key, { defaultValue: fallback, ...(values ?? {}) });
- const attention = automationNeedsAttention(job);
- const compact = Boolean(job.protected);
- const summary = job.state.last_error
- ? localizedAutomationError(job.state.last_error, tx)
- : compact ? null : automationSummary(job, tx);
- const running = Boolean(job.state.pending);
- return (
- <li>
- <button
- type="button"
- disabled={disabled}
- aria-haspopup="dialog"
- onClick={(event) => onSelect(event.currentTarget)}
- className={cn(
- "automation-task-row grid w-full grid-cols-1 items-center gap-x-4 gap-y-2 rounded-control px-2 py-3 text-left transition-colors duration-150 settings-hover",
- formControlFocusClassName,
- )}
- >
- <span className="min-w-0">
- <span className="block truncate text-[14px] font-semibold leading-5 text-foreground">{job.name || job.id}</span>
- {summary ? <span className="mt-0.5 block truncate text-[12px] leading-5 text-muted-foreground">{summary}</span> : null}
- </span>
- <span className="automation-task-state flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-[11px] text-muted-foreground">
- {running ? <Loader2 className="h-3.5 w-3.5 animate-spin" aria-hidden /> : null}
- {attention && !running ? (
- <>
- <CircleAlert className="h-4 w-4 shrink-0 text-amber-700 dark:text-amber-400" aria-hidden />
- <span className="text-amber-700 dark:text-amber-400">{tx("settings.automations.filters.failed", "Needs attention")}</span>
- {!job.enabled ? <span>{tx("settings.automations.next.paused", "Paused")}</span> : null}
- </>
- ) : (
- <span title={formatAutomationNextTitle(job, locale, tx)}>{formatAutomationNext(job, tx)}</span>
- )}
- </span>
- </button>
- </li>
- );
-}
function AutomationDetailPanel({
job, locale, actionKey, error, onAction, onRequestEdit, onRequestDelete,
@@ -464,7 +451,6 @@ function AutomationDetailPanel({
const { t } = useTranslation();
const tx = (key: string, fallback: string, values?: Record<string, unknown>) =>
t(key, { defaultValue: fallback, ...(values ?? {}) });
- const origin = automationOriginLabel(job, t);
const originHref = job.origin?.channel === "websocket" && job.origin.session_key
? `#/chat/${encodeURIComponent(job.origin.session_key)}` : null;
const localTrigger = isLocalTriggerAutomation(job);
@@ -494,12 +480,12 @@ function AutomationDetailPanel({
{canManage ? (
<DialogDescription className="flex flex-wrap items-center gap-x-4 gap-y-1 text-[13px] leading-5">
<span className="font-medium text-foreground/80">{formatAutomationSchedule(job, locale, tx)}</span>
- <span className="inline-flex min-w-0 items-center gap-1.5">
+ {!localTrigger ? <span className="inline-flex min-w-0 items-center gap-1.5">
<span>{tx("settings.automations.labels.next", "Next")}</span>
<span className="text-foreground/80" title={formatAutomationNextTitle(job, locale, tx)}>
{formatAutomationNext(job, tx)}
</span>
- </span>
+ </span> : null}
</DialogDescription>
) : null}
</DialogHeader>
@@ -553,9 +539,9 @@ function AutomationDetailPanel({
</span>
: lastStatus || tx("settings.automations.neverRun", "Not run yet")}
</AutomationDetail>
- {!job.protected ? (
+ {!job.protected && job.origin?.channel && job.origin.channel !== "websocket" ? (
<AutomationDetail label={tx("settings.automations.labels.origin", "Linked chat")}>
- <span className="block truncate" title={origin}>{origin}</span>
+ {automationChannelLabel(job.origin.channel, t)}
</AutomationDetail>
) : null}
</dl>
@@ -585,7 +571,7 @@ function AutomationDetailPanel({
<div className="flex min-w-0 flex-wrap items-center gap-1">
<Button variant="ghost" size="sm" className="text-muted-foreground" disabled={busy || !canToggle} onClick={() => void onAction(job.enabled ? "disable" : "enable", job)}>
{actionKey === `${job.enabled ? "disable" : "enable"}:${job.id}` ? <Loader2 className="mr-1.5 h-3.5 w-3.5 animate-spin" aria-hidden /> : null}
- {job.enabled ? tx("settings.automations.pause", "Pause") : tx("settings.automations.resume", "Resume")}
+ {job.enabled ? tx("settings.automations.pause", "Disable") : tx("settings.automations.resume", "Enable")}
</Button>
{!localTrigger ? (
<Button variant="ghost" size="sm" className="text-muted-foreground" disabled={!canRun || busy} onClick={() => void onAction("run", job)}>
@@ -710,6 +696,7 @@ export function AutomationEditDialog({
const tx = (key: string, fallback: string, values?: Record<string, unknown>) =>
t(key, { defaultValue: fallback, ...(values ?? {}) });
const [draft, setDraft] = useState<AutomationEditDraft>(() => automationDraftFromJob(null));
+ const validationId = useId();
const localTrigger = isLocalTriggerAutomation(job);
useEffect(() => {
@@ -750,6 +737,12 @@ export function AutomationEditDialog({
{...dialogFocus}
aria-describedby={undefined}
className="w-[min(calc(100vw-2rem),34rem)]"
+ onEscapeKeyDown={(event) => {
+ // Escape in the nested date calendar must not cancel the editor.
+ if (event.target instanceof Element && event.target.closest("[data-automation-date-calendar]")) {
+ event.preventDefault();
+ }
+ }}
>
<form className="space-y-5" onSubmit={submit}>
<DialogHeader>
@@ -869,20 +862,16 @@ export function AutomationEditDialog({
) : null}
{!localTrigger && draft.scheduleKind === "at" ? (
- <label className="block space-y-1.5">
- <span className="text-[12px] font-medium text-muted-foreground">
- {tx("settings.automations.fields.runAt", "Run at")}
- </span>
- <Input
- type="datetime-local"
- value={draft.atLocal}
- onChange={(event) => setDraft((prev) => ({ ...prev, atLocal: event.target.value }))}
- />
- </label>
+ <AutomationRunAtPicker
+ value={draft.atLocal}
+ onChange={(atLocal) => setDraft((prev) => ({ ...prev, atLocal }))}
+ disabled={saving}
+ errorId={validation ? validationId : undefined}
+ />
) : null}
{validation ? (
- <div className="rounded-control bg-destructive/8 px-3 py-2 text-[12px] text-destructive">
+ <div id={validationId} className="rounded-control bg-destructive/8 px-3 py-2 text-[12px] text-destructive">
{validation}
</div>
) : null}
@@ -972,15 +961,6 @@ function automationTriggerCommand(job: SessionAutomationJob): string {
return job.trigger?.command || job.payload.command || job.payload.message || "";
}
-function automationSummary(
- job: SessionAutomationJob,
- tx: (key: string, fallback: string, values?: Record<string, unknown>) => string,
-): string {
- if (isLocalTriggerAutomation(job)) {
- return automationTriggerCommand(job) || tx("settings.automations.localTrigger", "Local trigger");
- }
- return job.payload.message || tx("settings.automations.systemTask", "System-managed automation");
-}
function automationNeedsAttention(job: SessionAutomationJob): boolean {
return job.state.last_status === "error";
@@ -989,7 +969,6 @@ function automationNeedsAttention(job: SessionAutomationJob): boolean {
function automationStatusKey(
job: SessionAutomationJob,
): "active" | "running" | "paused" | "failed" | "system" | "completed" | "idle" {
- if (job.protected) return "system";
if (job.state.pending) return "running";
if (!job.enabled) return "paused";
if (job.state.last_status === "error") return "failed";
@@ -1054,7 +1033,7 @@ function automationEditDraftError(
return tx("settings.automations.validation.cronRequired", "Enter a Cron expression.");
}
if (draft.scheduleKind === "at") {
- const atMs = new Date(draft.atLocal).getTime();
+ const atMs = parseAutomationRunAt(draft.atLocal)?.getTime() ?? NaN;
if (!Number.isFinite(atMs)) {
return tx("settings.automations.validation.timeRequired", "Choose a run time.");
}
@@ -1096,7 +1075,7 @@ function automationSchedulePayloadFromDraft(draft: AutomationEditDraft): Automat
if (!expr) return "invalid";
return { kind: "cron", expr, ...(draft.tz.trim() ? { tz: draft.tz.trim() } : {}) };
} else {
- const atMs = new Date(draft.atLocal).getTime();
+ const atMs = parseAutomationRunAt(draft.atLocal)?.getTime() ?? NaN;
if (!Number.isFinite(atMs)) return "invalid";
return { kind: "at", at_ms: atMs };
}
@@ -1116,11 +1095,6 @@ function automationScheduleChanged(
return draft.atLocal !== formatLocalDateTimeInput(job.schedule.at_ms ?? NaN);
}
-const HOST_AUTOMATION_CHANNEL_LABELS: Record<string, string> = {
- api: "API",
- cli: "CLI",
-};
-
function automationMatchesFilter(job: SessionAutomationJob, filter: AutomationFilter): boolean {
const status = automationStatusKey(job);
if (filter === "active") return status === "active" || status === "running";
@@ -1130,22 +1104,12 @@ function automationMatchesFilter(job: SessionAutomationJob, filter: AutomationFi
return true;
}
+const HOST_AUTOMATION_CHANNEL_LABELS: Record<string, string> = {
+ api: "API",
+ cli: "CLI",
+};
-function automationOriginLabel(
- job: SessionAutomationJob,
- t: TFunction,
-): string {
- if (job.protected) return t("settings.automations.origin.system", { defaultValue: "System" });
- const origin = job.origin;
- if (!origin) return t("settings.automations.origin.unknown", { defaultValue: "No linked chat" });
- if (origin.channel !== "websocket") return automationChannelLabel(origin.channel, t);
- return origin.title || origin.preview || origin.session_key || automationChannelLabel(origin.channel, t);
-}
-
-function automationChannelLabel(
- channel: string,
- t: TFunction,
-): string {
+function automationChannelLabel(channel: string, t: TFunction): string {
const key = channel.trim().toLowerCase();
const presentation = channelUiPresentation(key);
if (presentation) {
@@ -1173,20 +1137,19 @@ function formatAutomationSchedule(
});
}
if (job.schedule.kind === "cron" && job.schedule.expr) {
- const summary = formatCronScheduleSummary(job.schedule.expr, tx);
+ const summary = formatCronScheduleSummary(job.schedule.expr, locale, tx);
if (summary) return summary;
- return tx("settings.automations.schedule.cron", "Cron {{expr}}", {
- expr: job.schedule.expr,
- });
+ return tx("settings.automations.schedule.custom", "Custom schedule");
}
if (isLocalTriggerAutomation(job)) {
- return tx("settings.automations.schedule.local", "Local trigger");
+ return tx("settings.automations.commandCondition", "Triggered by command");
}
return tx("settings.automations.schedule.custom", "Custom schedule");
}
function formatCronScheduleSummary(
expr: string,
+ locale: string,
tx: (key: string, fallback: string, values?: Record<string, unknown>) => string,
): string | null {
const parts = expr.trim().split(/\s+/);
@@ -1201,6 +1164,17 @@ function formatCronScheduleSummary(
const time = `${String(numericHour).padStart(2, "0")}:${String(numericMinute).padStart(2, "0")}`;
if (everyDay) return tx("settings.automations.schedule.dailyAt", "Daily at {{time}}", { time });
if (workdays) return tx("settings.automations.schedule.weekdaysAt", "Weekdays at {{time}}", { time });
+ const weekday = /^\d$/.test(dayOfWeek) ? Number(dayOfWeek) : ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"].indexOf(dayOfWeek.toUpperCase());
+ if (dayOfMonth === "*" && month === "*" && weekday >= 0 && weekday <= 7) {
+ return tx("settings.automations.schedule.weeklyAt", "Every {{day}} at {{time}}", {
+ day: new Intl.DateTimeFormat(locale, { weekday: "long" }).format(new Date(2024, 0, 7 + weekday % 7)),
+ time,
+ });
+ }
+ const day = cronNumericToken(dayOfMonth, 31);
+ if (day !== null && day > 0 && month === "*" && dayOfWeek === "*") {
+ return tx("settings.automations.schedule.monthlyAt", "Monthly on day {{day}} at {{time}}", { day, time });
+ }
}
if (everyDay && numericMinute !== null && hour === "*") {
@@ -1234,7 +1208,7 @@ function formatAutomationNext(
job: SessionAutomationJob,
tx: (key: string, fallback: string, values?: Record<string, unknown>) => string,
): string {
- if (!job.enabled) return tx("settings.automations.next.paused", "Paused");
+ if (!job.enabled) return tx("settings.automations.next.paused", "Disabled");
if (job.state.pending) return tx("settings.automations.next.pending", "Running now");
if (isLocalTriggerAutomation(job)) {
return tx("settings.automations.next.local", "Waiting for trigger");
diff --git a/webui/src/components/thread/ThreadComposer.tsx b/webui/src/components/thread/ThreadComposer.tsx
index 70d25a6b3..545a57dbc 100644
--- a/webui/src/components/thread/ThreadComposer.tsx
+++ b/webui/src/components/thread/ThreadComposer.tsx
@@ -2200,6 +2200,27 @@ export function ThreadComposer({
&& value.length === 0 && images.length === 0 && !inlineError
&& !normalizedQuotedContext && !queuedPrompts.length && !goalState?.active
&& !isDragging && !sessionDragPreview && !voiceRecorder.isRecording && !showProjectPicker;
+ useLayoutEffect(() => {
+ if (!compactWhenIdle) return;
+ const form = formRef.current;
+ const primary = form?.querySelector<HTMLElement>(".thread-composer-footer-primary");
+ const actions = form?.querySelector<HTMLElement>(".thread-composer-footer-actions");
+ if (!form || !primary || !actions) return;
+ const controls = Array.from(primary.children).filter((child) => getComputedStyle(child).display !== "none");
+ // Reserve the real toolbar width, including translated model labels, while
+ // the footer slides beneath the input. Neither control is remounted.
+ const measure = () => {
+ const gap = parseFloat(getComputedStyle(primary).columnGap) || 0;
+ const width = controls.reduce((sum, child) => sum + child.getBoundingClientRect().width, 0)
+ + Math.max(0, controls.length - 1) * gap + actions.getBoundingClientRect().width;
+ form.style.setProperty("--composer-compact-controls-width", `${width}px`);
+ };
+ measure();
+ const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(measure);
+ controls.forEach((control) => observer?.observe(control));
+ observer?.observe(actions);
+ return () => observer?.disconnect();
+ }, [compactWhenIdle, modelLabel, voiceRecorder.isRecording, workspaceScope]);
const inputTextClasses = cn(
"w-full resize-none bg-transparent",
isHero
@@ -2282,8 +2303,8 @@ export function ThreadComposer({
className={cn(
"thread-composer-surface group/composer relative mx-auto flex w-full flex-col overflow-visible transition-all duration-200",
isHero
- ? "max-w-[58rem] rounded-prominent bg-muted/30 focus-within:bg-muted/50 dark:bg-card dark:focus-within:bg-white/[0.06]"
- : "max-w-[49.5rem] rounded-panel bg-muted/30 focus-within:bg-muted/50 dark:bg-card dark:focus-within:bg-white/[0.06]",
+ ? "max-w-[58rem] rounded-prominent bg-muted/80 focus-within:bg-muted dark:bg-card dark:focus-within:bg-white/[0.06]"
+ : "max-w-[49.5rem] rounded-panel bg-muted/80 focus-within:bg-muted dark:bg-card dark:focus-within:bg-white/[0.06]",
compactWhenIdle && "thread-composer-collapsible transition-colors motion-reduce:transition-none",
interactionDisabled && "opacity-60",
sessionDragPreview && "ring-1 ring-primary/25",
diff --git a/webui/src/globals.css b/webui/src/globals.css
index 8c273b451..5c594bd57 100644
--- a/webui/src/globals.css
+++ b/webui/src/globals.css
@@ -61,6 +61,7 @@
--sidebar-border: 40 8% 90.5%;
--settings-canvas: var(--background);
--settings-surface: 60 6% 96.7%;
+ --automation-view-track: hsl(0 0% 91%);
--scrollbar-thumb: hsl(var(--muted-foreground) / 0.26);
--scrollbar-thumb-hover: hsl(var(--muted-foreground) / 0.42);
}
@@ -103,6 +104,7 @@
--sidebar-border: var(--border);
--settings-canvas: var(--background);
--settings-surface: var(--card);
+ --automation-view-track: hsl(var(--muted) / 0.65);
--scrollbar-thumb: hsl(var(--muted-foreground) / 0.28);
--scrollbar-thumb-hover: hsl(var(--muted-foreground) / 0.44);
}
@@ -1026,85 +1028,109 @@
}
/* Stack a task's status below its title when the content column is narrow. */
.automations-page {
+ --settings-inset: 1rem;
container: automations / inline-size;
}
.automation-create-composer .thread-composer-surface {
max-inline-size: none;
}
- .automation-calendar-toolbar {
- display: grid;
- grid-template-columns: minmax(0, 1fr) auto;
+ .automation-create-composer .thread-composer-input textarea {
+ padding-inline: var(--settings-inset);
+ }
+ .automation-view-switch .segmented-control button {
+ padding-inline: calc(var(--settings-inset) - 0.5rem);
+ }
+ .automation-panel-toolbar {
+ display: flex;
+ flex-wrap: wrap;
align-items: center;
- gap: 0.75rem 1rem;
+ gap: 0.5rem 1rem;
min-block-size: 4rem;
- padding: 1rem;
- }
- .automation-calendar-navigation {
- grid-column: 2;
- grid-row: 1;
- justify-self: end;
+ padding: 0.75rem 0.25rem;
}
- .automation-calendar-filters {
- grid-column: 1 / -1;
- grid-row: 2;
+ .automation-create-composer .thread-composer-collapsible-layout {
+ padding-block-start: 0;
}
- @container automations (max-width: 20rem) {
- .automation-calendar-filters .segmented-control {
- display: grid;
- grid-template-columns: repeat(2, minmax(0, 1fr));
- inline-size: 100%;
- border-radius: 1rem;
+ /* Match the main sidebar's lg visibility; its collapsed rail has no labels. */
+ @media (min-width: 1024px) {
+ .settings-feature-page[data-main-navigation-expanded="true"] .settings-feature-header {
+ margin-block-end: 0;
}
- }
- @container automations (min-width: 48rem) {
- .automation-calendar-toolbar {
- grid-template-columns: minmax(0, 1fr) auto auto;
- padding-inline: 1.5rem;
+ .settings-feature-page[data-main-navigation-expanded="true"] .settings-feature-header h1 {
+ @apply sr-only;
}
- .automation-calendar-filters {
- grid-column: 2;
- grid-row: 1;
- }
- .automation-calendar-navigation { grid-column: 3; }
+ }
+ .automation-run-at-picker {
+ container: automation-run-at / inline-size;
+ }
+ @container automation-run-at (min-width: 18rem) {
+ .automation-run-at-fields { grid-template-columns: minmax(0, 1fr) 7rem; }
+ }
+ .automation-panel-filters {
+ margin-inline-start: auto;
}
.thread-composer-collapsible-layout {
container: composer-layout / inline-size;
}
+ .thread-composer-collapsible .thread-composer-input textarea:placeholder-shown {
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ }
+ .thread-composer-collapsible[data-compact] .thread-composer-input textarea {
+ display: block;
+ block-size: 3.125rem !important;
+ }
@container composer-layout (min-width: 40rem) {
- .thread-composer-collapsible[data-compact] {
- display: grid;
- grid-template-columns: minmax(0, 1fr) auto;
- align-items: center;
+ .thread-composer-collapsible .thread-composer-input {
+ inline-size: 100%;
+ }
+ .thread-composer-collapsible .thread-composer-input textarea {
+ display: block;
+ min-block-size: 3.5rem;
+ padding-block: 1.125rem;
+ }
+ .thread-composer-collapsible[data-compact] .thread-composer-input {
+ inline-size: max(0px, calc(100% - var(--composer-compact-controls-width, 15rem) - 1.5rem));
}
.thread-composer-collapsible[data-compact] .thread-composer-input textarea {
display: block;
block-size: 3.5rem !important;
min-block-size: 3.5rem;
padding-block: 1.125rem;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
}
- .thread-composer-collapsible[data-compact] .thread-composer-footer {
+ .thread-composer-collapsible .thread-composer-footer {
+ min-block-size: 3.5rem;
+ margin-block-start: 0;
padding: 0.5rem;
- transition: none;
+ pointer-events: none;
+ }
+ .thread-composer-collapsible[data-compact] .thread-composer-footer {
+ margin-block-start: -3.5rem;
+ }
+ .thread-composer-collapsible .thread-composer-footer-primary {
+ flex: 1 0 auto;
+ margin-inline-start: auto;
+ pointer-events: auto;
}
.thread-composer-collapsible[data-compact] .thread-composer-footer-primary {
- flex: none;
+ flex-grow: 0;
}
- .thread-composer-collapsible[data-compact] .thread-composer-footer-actions {
+ .thread-composer-collapsible .thread-composer-footer-actions {
max-inline-size: none;
+ margin-inline-start: 0;
+ pointer-events: auto;
}
- }
- .automation-meta-row {
- display: grid;
- grid-template-columns: 1rem minmax(0, 1fr) auto;
- column-gap: 0.5rem;
- padding-inline: 1rem;
- }
- @media (min-width: 640px) {
- .automation-meta-row {
- padding-inline: 1.5rem;
+ @media (prefers-reduced-motion: no-preference) {
+ .thread-composer-collapsible .thread-composer-input {
+ transition: inline-size 220ms ease-out;
+ }
+ .thread-composer-collapsible .thread-composer-footer {
+ transition: margin-block-start 220ms ease-out;
+ }
+ .thread-composer-collapsible .thread-composer-footer-primary {
+ transition: flex-grow 220ms ease-out;
+ }
}
}
.automation-calendar-grid { display: none; }
@@ -1136,19 +1162,6 @@
.automation-calendar-day:nth-child(7n) { border-inline-end: 0; }
.automation-calendar-day:nth-last-child(-n + 7) { border-block-end: 0; }
}
- .automation-task-state {
- grid-column: 1;
- grid-row: 2;
- }
- @container automations (min-width: 36rem) {
- .automation-task-row { grid-template-columns: minmax(0, 1fr) auto; }
- .automation-task-state {
- grid-column: 2;
- grid-row: 1;
- max-width: 18rem;
- justify-content: flex-end;
- }
- }
.settings-stack > :not([hidden]) ~ :not([hidden]) {
margin-block-start: var(--settings-module-gap, 20px);
}
diff --git a/webui/src/i18n/locales/en/common.json b/webui/src/i18n/locales/en/common.json
index d5641f438..9478f157f 100644
--- a/webui/src/i18n/locales/en/common.json
+++ b/webui/src/i18n/locales/en/common.json
@@ -1089,7 +1089,7 @@
},
"automations": {
"create": "Create automation",
- "createPrompt": "What would you like nanobot to schedule?",
+ "createPrompt": "What would you like nanobot to automate?",
"createInput": "Describe an automation",
"createRequest": "Create an automation for this request:\n\n{{request}}",
"errors": {
@@ -1107,6 +1107,14 @@
},
"yourTasks": "Your automations",
"systemTasks": "System tasks",
+ "views": {
+ "label": "Automation view",
+ "tasks": "Tasks",
+ "calendar": "Calendar"
+ },
+ "filter": "Filter",
+ "filteredBy": "Filter: {{status}}",
+ "commandCondition": "Triggered by command",
"instructions": "Instructions",
"done": "Done",
"moreDetails": "More details",
@@ -1117,7 +1125,7 @@
"filters": {
"all": "All",
"active": "Active",
- "paused": "Paused",
+ "paused": "Disabled",
"failed": "Needs attention",
"system": "System"
},
@@ -1145,8 +1153,8 @@
"updated": "Updated"
},
"runNow": "Run now",
- "pause": "Pause",
- "resume": "Resume",
+ "pause": "Disable",
+ "resume": "Enable",
"edit": "Edit",
"delete": "Delete",
"protected": "Protected",
@@ -1160,7 +1168,7 @@
"status": {
"system": "System",
"running": "Running now",
- "paused": "Paused",
+ "paused": "Disabled",
"failed": "Failed",
"completed": "Completed",
"noSchedule": "No schedule",
@@ -1175,12 +1183,14 @@
"cli": "CLI"
},
"schedule": {
+ "weeklyAt": "Every {{day}} at {{time}}",
"at": "At {{time}}",
"every": "Every {{duration}}",
"cron": "Cron {{expr}}",
"cronWithTz": "Cron {{expr}} ({{tz}})",
"withTz": "{{summary}} ({{tz}})",
"dailyAt": "Daily at {{time}}",
+ "monthlyAt": "Monthly on day {{day}} at {{time}}",
"weekdaysAt": "Weekdays at {{time}}",
"hourlyAt": "Hourly at :{{minute}}",
"hourlyWindow": "Hourly {{start}}-{{end}} at :{{minute}}",
@@ -1188,7 +1198,7 @@
"custom": "Custom schedule"
},
"next": {
- "paused": "Paused",
+ "paused": "Disabled",
"pending": "Running now",
"local": "Waiting for trigger",
"none": "No next run"
@@ -1206,7 +1216,10 @@
"unit": "Unit",
"cronExpression": "Cron expression",
"timezone": "Timezone",
- "runAt": "Run at"
+ "runAt": "Run at",
+ "runDate": "Run date",
+ "runTime": "Run time",
+ "chooseDate": "Choose date"
},
"scheduleTypes": {
"every": "Interval",
diff --git a/webui/src/i18n/locales/es/common.json b/webui/src/i18n/locales/es/common.json
index 67f9f10d3..340a62146 100644
--- a/webui/src/i18n/locales/es/common.json
+++ b/webui/src/i18n/locales/es/common.json
@@ -890,7 +890,7 @@
},
"automations": {
"create": "Crear automatización",
- "createPrompt": "¿Qué te gustaría programar con nanobot?",
+ "createPrompt": "¿Qué te gustaría automatizar con nanobot?",
"createInput": "Describe una automatización",
"createRequest": "Crea una automatización para esta solicitud:\n\n{{request}}",
"errors": {
@@ -908,6 +908,14 @@
},
"yourTasks": "Tus automatizaciones",
"systemTasks": "Tareas del sistema",
+ "views": {
+ "label": "Vista de automatizaciones",
+ "tasks": "Tareas",
+ "calendar": "Calendario"
+ },
+ "filter": "Filtrar",
+ "filteredBy": "Filtro: {{status}}",
+ "commandCondition": "Se activa mediante un comando",
"instructions": "Instrucciones",
"done": "Listo",
"moreDetails": "Más detalles",
@@ -918,7 +926,7 @@
"filters": {
"all": "Todas",
"active": "Activas",
- "paused": "Pausadas",
+ "paused": "Desactivadas",
"failed": "Requieren atención",
"system": "Sistema"
},
@@ -946,8 +954,8 @@
"updated": "Actualizada"
},
"runNow": "Ejecutar ahora",
- "pause": "Pausar",
- "resume": "Reanudar",
+ "pause": "Desactivar",
+ "resume": "Activar",
"edit": "Editar",
"delete": "Eliminar",
"protected": "Protegida",
@@ -961,7 +969,7 @@
"status": {
"system": "Sistema",
"running": "Ejecutándose ahora",
- "paused": "Pausada",
+ "paused": "Desactivada",
"failed": "Fallida",
"completed": "Completada",
"noSchedule": "Sin programación",
@@ -976,12 +984,14 @@
"cli": "CLI"
},
"schedule": {
+ "weeklyAt": "Cada {{day}} a las {{time}}",
"at": "A las {{time}}",
"every": "Cada {{duration}}",
"cron": "Cron {{expr}}",
"cronWithTz": "Cron {{expr}} ({{tz}})",
"withTz": "{{summary}} ({{tz}})",
"dailyAt": "Todos los días a las {{time}}",
+ "monthlyAt": "El día {{day}} de cada mes a las {{time}}",
"weekdaysAt": "De lunes a viernes a las {{time}}",
"hourlyAt": "Cada hora, en el minuto {{minute}}",
"hourlyWindow": "Cada hora de {{start}} a {{end}}, en el minuto {{minute}}",
@@ -989,7 +999,7 @@
"custom": "Programación personalizada"
},
"next": {
- "paused": "Pausada",
+ "paused": "Desactivada",
"pending": "Ejecutándose ahora",
"local": "Esperando activador",
"none": "Sin próxima ejecución"
@@ -1007,7 +1017,10 @@
"unit": "Unidad",
"cronExpression": "Expresión cron",
"timezone": "Zona horaria",
- "runAt": "Ejecutar a las"
+ "runAt": "Ejecutar a las",
+ "runDate": "Fecha de ejecución",
+ "runTime": "Hora de ejecución",
+ "chooseDate": "Elegir fecha"
},
"scheduleTypes": {
"every": "Intervalo",
diff --git a/webui/src/i18n/locales/fr/common.json b/webui/src/i18n/locales/fr/common.json
index 582c60d30..f0b6c8088 100644
--- a/webui/src/i18n/locales/fr/common.json
+++ b/webui/src/i18n/locales/fr/common.json
@@ -889,7 +889,7 @@
},
"automations": {
"create": "Créer une automatisation",
- "createPrompt": "Que voulez-vous planifier avec nanobot ?",
+ "createPrompt": "Que voulez-vous automatiser avec nanobot ?",
"createInput": "Décrire une automatisation",
"createRequest": "Crée une automatisation pour cette demande :\n\n{{request}}",
"errors": {
@@ -907,6 +907,14 @@
},
"yourTasks": "Vos automatisations",
"systemTasks": "Tâches système",
+ "views": {
+ "label": "Vue des automatisations",
+ "tasks": "Tâches",
+ "calendar": "Calendrier"
+ },
+ "filter": "Filtrer",
+ "filteredBy": "Filtre : {{status}}",
+ "commandCondition": "Déclenchée par une commande",
"instructions": "Instructions",
"done": "Terminé",
"moreDetails": "Plus de détails",
@@ -917,7 +925,7 @@
"filters": {
"all": "Toutes",
"active": "Actives",
- "paused": "En pause",
+ "paused": "Désactivée",
"failed": "À traiter",
"system": "Système"
},
@@ -945,8 +953,8 @@
"updated": "Modifiée"
},
"runNow": "Exécuter maintenant",
- "pause": "Mettre en pause",
- "resume": "Reprendre",
+ "pause": "Désactiver",
+ "resume": "Activer",
"edit": "Modifier",
"delete": "Supprimer",
"protected": "Protégée",
@@ -960,7 +968,7 @@
"status": {
"system": "Système",
"running": "En cours d’exécution",
- "paused": "En pause",
+ "paused": "Désactivée",
"failed": "Échouée",
"completed": "Terminée",
"noSchedule": "Aucun planning",
@@ -975,12 +983,14 @@
"cli": "CLI"
},
"schedule": {
+ "weeklyAt": "Chaque {{day}} à {{time}}",
"at": "À {{time}}",
"every": "Toutes les {{duration}}",
"cron": "Cron {{expr}}",
"cronWithTz": "Cron {{expr}} ({{tz}})",
"withTz": "{{summary}} ({{tz}})",
"dailyAt": "Chaque jour à {{time}}",
+ "monthlyAt": "Le {{day}} de chaque mois à {{time}}",
"weekdaysAt": "Du lundi au vendredi à {{time}}",
"hourlyAt": "Toutes les heures à :{{minute}}",
"hourlyWindow": "Toutes les heures {{start}}-{{end}} à :{{minute}}",
@@ -988,7 +998,7 @@
"custom": "Planning personnalisé"
},
"next": {
- "paused": "En pause",
+ "paused": "Désactivée",
"pending": "En cours d’exécution",
"local": "En attente du déclencheur",
"none": "Aucune prochaine exécution"
@@ -1006,7 +1016,10 @@
"unit": "Unité",
"cronExpression": "Expression cron",
"timezone": "Fuseau horaire",
- "runAt": "Exécuter à"
+ "runAt": "Exécuter à",
+ "runDate": "Date d’exécution",
+ "runTime": "Heure d’exécution",
+ "chooseDate": "Choisir une date"
},
"scheduleTypes": {
"every": "Intervalle",
diff --git a/webui/src/i18n/locales/id/common.json b/webui/src/i18n/locales/id/common.json
index bae5d789a..ebadbf693 100644
--- a/webui/src/i18n/locales/id/common.json
+++ b/webui/src/i18n/locales/id/common.json
@@ -889,7 +889,7 @@
},
"automations": {
"create": "Buat otomatisasi",
- "createPrompt": "Apa yang ingin kamu jadwalkan dengan nanobot?",
+ "createPrompt": "Apa yang ingin kamu otomatisasi dengan nanobot?",
"createInput": "Jelaskan otomatisasi",
"createRequest": "Buat otomatisasi untuk permintaan ini:\n\n{{request}}",
"errors": {
@@ -907,6 +907,14 @@
},
"yourTasks": "Otomatisasi Anda",
"systemTasks": "Tugas sistem",
+ "views": {
+ "label": "Tampilan otomatisasi",
+ "tasks": "Tugas",
+ "calendar": "Kalender"
+ },
+ "filter": "Filter",
+ "filteredBy": "Filter: {{status}}",
+ "commandCondition": "Dipicu oleh perintah",
"instructions": "Instruksi",
"done": "Selesai",
"moreDetails": "Detail lainnya",
@@ -917,7 +925,7 @@
"filters": {
"all": "Semua",
"active": "Aktif",
- "paused": "Dijeda",
+ "paused": "Dinonaktifkan",
"failed": "Perlu ditangani",
"system": "Sistem"
},
@@ -945,8 +953,8 @@
"updated": "Diperbarui"
},
"runNow": "Jalankan sekarang",
- "pause": "Jeda",
- "resume": "Lanjutkan",
+ "pause": "Nonaktifkan",
+ "resume": "Aktifkan",
"edit": "Ubah",
"delete": "Hapus",
"protected": "Terlindungi",
@@ -960,7 +968,7 @@
"status": {
"system": "Sistem",
"running": "Sedang berjalan",
- "paused": "Dijeda",
+ "paused": "Dinonaktifkan",
"failed": "Gagal",
"completed": "Selesai",
"noSchedule": "Tanpa jadwal",
@@ -975,12 +983,14 @@
"cli": "CLI"
},
"schedule": {
+ "weeklyAt": "Setiap {{day}} pukul {{time}}",
"at": "Pada {{time}}",
"every": "Setiap {{duration}}",
"cron": "Cron {{expr}}",
"cronWithTz": "Cron {{expr}} ({{tz}})",
"withTz": "{{summary}} ({{tz}})",
"dailyAt": "Setiap hari pukul {{time}}",
+ "monthlyAt": "Setiap tanggal {{day}} pukul {{time}}",
"weekdaysAt": "Senin–Jumat pukul {{time}}",
"hourlyAt": "Setiap jam pada menit {{minute}}",
"hourlyWindow": "Setiap jam dari {{start}} hingga {{end}}, pada menit {{minute}}",
@@ -988,7 +998,7 @@
"custom": "Jadwal khusus"
},
"next": {
- "paused": "Dijeda",
+ "paused": "Dinonaktifkan",
"pending": "Sedang berjalan",
"local": "Menunggu pemicu",
"none": "Tidak ada jadwal berikutnya"
@@ -1006,7 +1016,10 @@
"unit": "Unit",
"cronExpression": "Ekspresi cron",
"timezone": "Zona waktu",
- "runAt": "Jalankan pada"
+ "runAt": "Jalankan pada",
+ "runDate": "Tanggal eksekusi",
+ "runTime": "Waktu eksekusi",
+ "chooseDate": "Pilih tanggal"
},
"scheduleTypes": {
"every": "Interval",
diff --git a/webui/src/i18n/locales/ja/common.json b/webui/src/i18n/locales/ja/common.json
index 0ea25474a..92ffdf4fe 100644
--- a/webui/src/i18n/locales/ja/common.json
+++ b/webui/src/i18n/locales/ja/common.json
@@ -889,7 +889,7 @@
},
"automations": {
"create": "自動タスクを作成",
- "createPrompt": "nanobot にいつ、何をしてほしいですか?",
+ "createPrompt": "nanobot に何を自動化してほしいですか?",
"createInput": "自動タスクを説明",
"createRequest": "次の依頼に対する自動タスクを作成してください:\n\n{{request}}",
"errors": {
@@ -907,6 +907,14 @@
},
"yourTasks": "自分の自動化",
"systemTasks": "システムタスク",
+ "views": {
+ "label": "自動化の表示",
+ "tasks": "タスク",
+ "calendar": "カレンダー"
+ },
+ "filter": "絞り込み",
+ "filteredBy": "絞り込み:{{status}}",
+ "commandCondition": "コマンドで実行",
"instructions": "指示",
"done": "完了",
"moreDetails": "詳細情報",
@@ -917,7 +925,7 @@
"filters": {
"all": "すべて",
"active": "有効",
- "paused": "一時停止",
+ "paused": "無効",
"failed": "要対応",
"system": "システム"
},
@@ -945,8 +953,8 @@
"updated": "更新"
},
"runNow": "今すぐ実行",
- "pause": "一時停止",
- "resume": "再開",
+ "pause": "無効にする",
+ "resume": "有効にする",
"edit": "編集",
"delete": "削除",
"protected": "保護済み",
@@ -960,7 +968,7 @@
"status": {
"system": "システム",
"running": "実行中",
- "paused": "一時停止",
+ "paused": "無効",
"failed": "失敗",
"completed": "完了",
"noSchedule": "スケジュールなし",
@@ -975,12 +983,14 @@
"cli": "CLI"
},
"schedule": {
+ "weeklyAt": "毎週{{day}} {{time}}",
"at": "{{time}}",
"every": "{{duration}} ごと",
"cron": "Cron {{expr}}",
"cronWithTz": "Cron {{expr}}({{tz}})",
"withTz": "{{summary}}({{tz}})",
"dailyAt": "毎日 {{time}}",
+ "monthlyAt": "毎月{{day}}日 {{time}}",
"weekdaysAt": "月曜日〜金曜日 {{time}}",
"hourlyAt": "毎時 {{minute}} 分",
"hourlyWindow": "{{start}}〜{{end}} の毎時 {{minute}} 分",
@@ -988,7 +998,7 @@
"custom": "カスタムスケジュール"
},
"next": {
- "paused": "一時停止",
+ "paused": "無効",
"pending": "実行中",
"local": "トリガー待ち",
"none": "次回実行なし"
@@ -1006,7 +1016,10 @@
"unit": "単位",
"cronExpression": "Cron 式",
"timezone": "タイムゾーン",
- "runAt": "実行日時"
+ "runAt": "実行日時",
+ "runDate": "実行日",
+ "runTime": "実行時刻",
+ "chooseDate": "日付を選択"
},
"scheduleTypes": {
"every": "間隔",
diff --git a/webui/src/i18n/locales/ko/common.json b/webui/src/i18n/locales/ko/common.json
index 023ff2d8a..e4cb55295 100644
--- a/webui/src/i18n/locales/ko/common.json
+++ b/webui/src/i18n/locales/ko/common.json
@@ -889,7 +889,7 @@
},
"automations": {
"create": "자동화 만들기",
- "createPrompt": "nanobot이 언제 무엇을 해주면 좋을까요?",
+ "createPrompt": "nanobot이 무엇을 자동으로 해주면 좋을까요?",
"createInput": "자동화 설명",
"createRequest": "다음 요청에 맞는 자동화를 만들어 주세요:\n\n{{request}}",
"errors": {
@@ -907,6 +907,14 @@
},
"yourTasks": "내 자동화",
"systemTasks": "시스템 작업",
+ "views": {
+ "label": "자동화 보기",
+ "tasks": "작업",
+ "calendar": "캘린더"
+ },
+ "filter": "필터",
+ "filteredBy": "필터: {{status}}",
+ "commandCondition": "명령으로 실행",
"instructions": "지침",
"done": "완료",
"moreDetails": "상세 정보",
@@ -917,7 +925,7 @@
"filters": {
"all": "전체",
"active": "활성",
- "paused": "일시 중지",
+ "paused": "비활성화",
"failed": "확인 필요",
"system": "시스템"
},
@@ -945,8 +953,8 @@
"updated": "업데이트"
},
"runNow": "지금 실행",
- "pause": "일시 중지",
- "resume": "재개",
+ "pause": "비활성화",
+ "resume": "활성화",
"edit": "편집",
"delete": "삭제",
"protected": "보호됨",
@@ -960,7 +968,7 @@
"status": {
"system": "시스템",
"running": "실행 중",
- "paused": "일시 중지",
+ "paused": "비활성화",
"failed": "실패",
"completed": "완료",
"noSchedule": "일정 없음",
@@ -975,12 +983,14 @@
"cli": "CLI"
},
"schedule": {
+ "weeklyAt": "매주 {{day}} {{time}}",
"at": "{{time}}",
"every": "{{duration}}마다",
"cron": "Cron {{expr}}",
"cronWithTz": "Cron {{expr}} ({{tz}})",
"withTz": "{{summary}} ({{tz}})",
"dailyAt": "매일 {{time}}",
+ "monthlyAt": "매월 {{day}}일 {{time}}",
"weekdaysAt": "월요일~금요일 {{time}}",
"hourlyAt": "매시 {{minute}}분",
"hourlyWindow": "{{start}}~{{end}} 사이 매시 {{minute}}분",
@@ -988,7 +998,7 @@
"custom": "사용자 지정 일정"
},
"next": {
- "paused": "일시 중지",
+ "paused": "비활성화",
"pending": "실행 중",
"local": "트리거 대기 중",
"none": "다음 실행 없음"
@@ -1006,7 +1016,10 @@
"unit": "단위",
"cronExpression": "Cron 식",
"timezone": "시간대",
- "runAt": "실행 시간"
+ "runAt": "실행 시간",
+ "runDate": "실행 날짜",
+ "runTime": "실행 시각",
+ "chooseDate": "날짜 선택"
},
"scheduleTypes": {
"every": "간격",
diff --git a/webui/src/i18n/locales/pt-BR/common.json b/webui/src/i18n/locales/pt-BR/common.json
index 04134cb94..9a1768e36 100644
--- a/webui/src/i18n/locales/pt-BR/common.json
+++ b/webui/src/i18n/locales/pt-BR/common.json
@@ -903,7 +903,7 @@
},
"automations": {
"create": "Criar automação",
- "createPrompt": "O que você gostaria de agendar com o nanobot?",
+ "createPrompt": "O que você gostaria de automatizar com o nanobot?",
"createInput": "Descreva uma automação",
"createRequest": "Crie uma automação para esta solicitação:\n\n{{request}}",
"errors": {
@@ -921,6 +921,14 @@
},
"yourTasks": "Suas automações",
"systemTasks": "Tarefas do sistema",
+ "views": {
+ "label": "Visualização das automações",
+ "tasks": "Tarefas",
+ "calendar": "Calendário"
+ },
+ "filter": "Filtrar",
+ "filteredBy": "Filtro: {{status}}",
+ "commandCondition": "Acionada por comando",
"instructions": "Instruções",
"done": "Concluído",
"moreDetails": "Mais detalhes",
@@ -931,7 +939,7 @@
"filters": {
"all": "Todas",
"active": "Ativas",
- "paused": "Pausadas",
+ "paused": "Desativadas",
"failed": "Precisam de atenção",
"system": "Sistema"
},
@@ -959,8 +967,8 @@
"updated": "Atualizada"
},
"runNow": "Executar agora",
- "pause": "Pausar",
- "resume": "Retomar",
+ "pause": "Desativar",
+ "resume": "Ativar",
"edit": "Editar",
"delete": "Excluir",
"protected": "Protegida",
@@ -974,7 +982,7 @@
"status": {
"system": "Sistema",
"running": "Executando agora",
- "paused": "Pausada",
+ "paused": "Desativada",
"failed": "Falhou",
"completed": "Concluída",
"noSchedule": "Sem agendamento",
@@ -989,12 +997,14 @@
"cli": "CLI"
},
"schedule": {
+ "weeklyAt": "Toda {{day}} às {{time}}",
"at": "Às {{time}}",
"every": "A cada {{duration}}",
"cron": "Cron {{expr}}",
"cronWithTz": "Cron {{expr}} ({{tz}})",
"withTz": "{{summary}} ({{tz}})",
"dailyAt": "Diariamente às {{time}}",
+ "monthlyAt": "Todo dia {{day}} do mês às {{time}}",
"weekdaysAt": "De segunda a sexta às {{time}}",
"hourlyAt": "A cada hora, no minuto {{minute}}",
"hourlyWindow": "A cada hora de {{start}} a {{end}}, no minuto {{minute}}",
@@ -1002,7 +1012,7 @@
"custom": "Agendamento personalizado"
},
"next": {
- "paused": "Pausada",
+ "paused": "Desativada",
"pending": "Executando agora",
"local": "Aguardando gatilho",
"none": "Sem próxima execução"
@@ -1020,7 +1030,10 @@
"unit": "Unidade",
"cronExpression": "Expressão cron",
"timezone": "Fuso horário",
- "runAt": "Executar em"
+ "runAt": "Executar em",
+ "runDate": "Data de execução",
+ "runTime": "Hora de execução",
+ "chooseDate": "Escolher data"
},
"scheduleTypes": {
"every": "Intervalo",
diff --git a/webui/src/i18n/locales/vi/common.json b/webui/src/i18n/locales/vi/common.json
index 09c0cfe9e..c1a3fa0ba 100644
--- a/webui/src/i18n/locales/vi/common.json
+++ b/webui/src/i18n/locales/vi/common.json
@@ -889,7 +889,7 @@
},
"automations": {
"create": "Tạo tự động hóa",
- "createPrompt": "Bạn muốn nanobot làm gì theo lịch?",
+ "createPrompt": "Bạn muốn nanobot tự động làm gì?",
"createInput": "Mô tả tác vụ tự động",
"createRequest": "Tạo một tác vụ tự động cho yêu cầu này:\n\n{{request}}",
"errors": {
@@ -907,6 +907,14 @@
},
"yourTasks": "Tác vụ tự động của bạn",
"systemTasks": "Tác vụ hệ thống",
+ "views": {
+ "label": "Chế độ xem tác vụ tự động",
+ "tasks": "Tác vụ",
+ "calendar": "Lịch"
+ },
+ "filter": "Lọc",
+ "filteredBy": "Lọc: {{status}}",
+ "commandCondition": "Kích hoạt bằng lệnh",
"instructions": "Chỉ dẫn",
"done": "Xong",
"moreDetails": "Chi tiết khác",
@@ -917,7 +925,7 @@
"filters": {
"all": "Tất cả",
"active": "Đã bật",
- "paused": "Đã tạm dừng",
+ "paused": "Đã tắt",
"failed": "Cần xử lý",
"system": "Hệ thống"
},
@@ -945,8 +953,8 @@
"updated": "Đã cập nhật"
},
"runNow": "Chạy ngay",
- "pause": "Tạm dừng",
- "resume": "Tiếp tục",
+ "pause": "Tắt",
+ "resume": "Bật",
"edit": "Sửa",
"delete": "Xóa",
"protected": "Được bảo vệ",
@@ -960,7 +968,7 @@
"status": {
"system": "Hệ thống",
"running": "Đang chạy",
- "paused": "Đã tạm dừng",
+ "paused": "Đã tắt",
"failed": "Thất bại",
"completed": "Hoàn tất",
"noSchedule": "Không có lịch",
@@ -975,12 +983,14 @@
"cli": "CLI"
},
"schedule": {
+ "weeklyAt": "Mỗi {{day}} lúc {{time}}",
"at": "Vào {{time}}",
"every": "Mỗi {{duration}}",
"cron": "Cron {{expr}}",
"cronWithTz": "Cron {{expr}} ({{tz}})",
"withTz": "{{summary}} ({{tz}})",
"dailyAt": "Hằng ngày lúc {{time}}",
+ "monthlyAt": "Ngày {{day}} hằng tháng lúc {{time}}",
"weekdaysAt": "Thứ Hai đến thứ Sáu lúc {{time}}",
"hourlyAt": "Vào phút {{minute}} mỗi giờ",
"hourlyWindow": "Vào phút {{minute}} mỗi giờ, từ {{start}} đến {{end}}",
@@ -988,7 +998,7 @@
"custom": "Lịch tùy chỉnh"
},
"next": {
- "paused": "Đã tạm dừng",
+ "paused": "Đã tắt",
"pending": "Đang chạy",
"local": "Đang chờ kích hoạt",
"none": "Không có lần chạy tiếp theo"
@@ -1006,7 +1016,10 @@
"unit": "Đơn vị",
"cronExpression": "Biểu thức cron",
"timezone": "Múi giờ",
- "runAt": "Chạy lúc"
+ "runAt": "Chạy lúc",
+ "runDate": "Ngày chạy",
+ "runTime": "Giờ chạy",
+ "chooseDate": "Chọn ngày"
},
"scheduleTypes": {
"every": "Khoảng lặp",
diff --git a/webui/src/i18n/locales/zh-CN/common.json b/webui/src/i18n/locales/zh-CN/common.json
index f7f56ba4f..e7b946385 100644
--- a/webui/src/i18n/locales/zh-CN/common.json
+++ b/webui/src/i18n/locales/zh-CN/common.json
@@ -1089,7 +1089,7 @@
},
"automations": {
"create": "创建自动任务",
- "createPrompt": "想让 nanobot 定时帮你做什么?",
+ "createPrompt": "想让 nanobot 自动帮你做什么?",
"createInput": "描述一个自动任务",
"createRequest": "请为以下需求创建自动任务:\n\n{{request}}",
"errors": {
@@ -1107,6 +1107,14 @@
},
"yourTasks": "你的自动任务",
"systemTasks": "系统任务",
+ "views": {
+ "label": "自动任务视图",
+ "tasks": "任务",
+ "calendar": "日历"
+ },
+ "filter": "筛选",
+ "filteredBy": "筛选:{{status}}",
+ "commandCondition": "通过命令触发",
"instructions": "任务指令",
"done": "完成",
"moreDetails": "更多信息",
@@ -1117,7 +1125,7 @@
"filters": {
"all": "全部",
"active": "已启用",
- "paused": "已暂停",
+ "paused": "已停用",
"failed": "异常",
"system": "系统"
},
@@ -1145,8 +1153,8 @@
"updated": "更新于"
},
"runNow": "立即运行",
- "pause": "暂停",
- "resume": "恢复",
+ "pause": "停用",
+ "resume": "启用",
"edit": "编辑",
"delete": "删除",
"protected": "受保护",
@@ -1160,7 +1168,7 @@
"status": {
"system": "系统",
"running": "正在运行",
- "paused": "已暂停",
+ "paused": "已停用",
"failed": "失败",
"completed": "已完成",
"noSchedule": "无计划",
@@ -1175,12 +1183,14 @@
"cli": "CLI"
},
"schedule": {
+ "weeklyAt": "每{{day}} {{time}}",
"at": "在 {{time}}",
"every": "每 {{duration}}",
"cron": "Cron {{expr}}",
"cronWithTz": "Cron {{expr}}({{tz}})",
"withTz": "{{summary}}({{tz}})",
"dailyAt": "每天 {{time}}",
+ "monthlyAt": "每月 {{day}} 日 {{time}}",
"weekdaysAt": "周一至周五 {{time}}",
"hourlyAt": "每小时第 {{minute}} 分钟",
"hourlyWindow": "{{start}}-{{end}} 点每小时第 {{minute}} 分钟",
@@ -1188,7 +1198,7 @@
"custom": "自定义计划"
},
"next": {
- "paused": "已暂停",
+ "paused": "已停用",
"pending": "正在运行",
"local": "等待触发",
"none": "无后续运行计划"
@@ -1206,7 +1216,10 @@
"unit": "单位",
"cronExpression": "Cron 表达式",
"timezone": "时区",
- "runAt": "运行时间"
+ "runAt": "运行时间",
+ "runDate": "运行日期",
+ "runTime": "运行时刻",
+ "chooseDate": "选择日期"
},
"scheduleTypes": {
"every": "间隔",
diff --git a/webui/src/i18n/locales/zh-TW/common.json b/webui/src/i18n/locales/zh-TW/common.json
index fe2806e86..71ff733dd 100644
--- a/webui/src/i18n/locales/zh-TW/common.json
+++ b/webui/src/i18n/locales/zh-TW/common.json
@@ -889,7 +889,7 @@
},
"automations": {
"create": "建立自動任務",
- "createPrompt": "想讓 nanobot 定時幫你做什麼?",
+ "createPrompt": "想讓 nanobot 自動幫你做什麼?",
"createInput": "描述自動任務",
"createRequest": "請為以下需求建立自動任務:\n\n{{request}}",
"errors": {
@@ -907,6 +907,14 @@
},
"yourTasks": "你的自動任務",
"systemTasks": "系統任務",
+ "views": {
+ "label": "自動任務檢視",
+ "tasks": "任務",
+ "calendar": "行事曆"
+ },
+ "filter": "篩選",
+ "filteredBy": "篩選:{{status}}",
+ "commandCondition": "透過指令觸發",
"instructions": "任務指示",
"done": "完成",
"moreDetails": "更多詳細資訊",
@@ -917,7 +925,7 @@
"filters": {
"all": "全部",
"active": "已啟用",
- "paused": "已暫停",
+ "paused": "已停用",
"failed": "需要處理",
"system": "系統"
},
@@ -945,8 +953,8 @@
"updated": "更新時間"
},
"runNow": "立即執行",
- "pause": "暫停",
- "resume": "繼續",
+ "pause": "停用",
+ "resume": "啟用",
"edit": "編輯",
"delete": "刪除",
"protected": "受保護",
@@ -960,7 +968,7 @@
"status": {
"system": "系統",
"running": "正在執行",
- "paused": "已暫停",
+ "paused": "已停用",
"failed": "失敗",
"completed": "已完成",
"noSchedule": "無排程",
@@ -975,12 +983,14 @@
"cli": "CLI"
},
"schedule": {
+ "weeklyAt": "每{{day}} {{time}}",
"at": "於 {{time}}",
"every": "每 {{duration}}",
"cron": "Cron {{expr}}",
"cronWithTz": "Cron {{expr}}({{tz}})",
"withTz": "{{summary}}({{tz}})",
"dailyAt": "每天 {{time}}",
+ "monthlyAt": "每月 {{day}} 日 {{time}}",
"weekdaysAt": "每週一至週五 {{time}}",
"hourlyAt": "每小時第 {{minute}} 分鐘",
"hourlyWindow": "每天 {{start}} 時至 {{end}} 時之間,於每小時第 {{minute}} 分鐘執行",
@@ -988,7 +998,7 @@
"custom": "自訂排程"
},
"next": {
- "paused": "已暫停",
+ "paused": "已停用",
"pending": "正在執行",
"local": "等待觸發",
"none": "沒有後續執行排程"
@@ -1006,7 +1016,10 @@
"unit": "單位",
"cronExpression": "Cron 表達式",
"timezone": "時區",
- "runAt": "執行時間"
+ "runAt": "執行時間",
+ "runDate": "執行日期",
+ "runTime": "執行時刻",
+ "chooseDate": "選擇日期"
},
"scheduleTypes": {
"every": "間隔",
diff --git a/webui/src/tests/automation-run-at-picker.test.tsx b/webui/src/tests/automation-run-at-picker.test.tsx
new file mode 100644
index 000000000..9e7adb0bf
--- /dev/null
+++ b/webui/src/tests/automation-run-at-picker.test.tsx
@@ -0,0 +1,133 @@
+import { useState } from "react";
+import { act, cleanup, fireEvent, render, screen, waitFor, within } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
+import { afterEach, describe, expect, it, vi } from "vitest";
+
+import { AutomationRunAtPicker, parseAutomationRunAt } from "@/components/settings/system/AutomationRunAtPicker";
+import { AutomationEditDialog } from "@/components/settings/system/AutomationsSettings";
+import i18n from "@/i18n";
+import type { SessionAutomationJob } from "@/lib/types";
+
+afterEach(cleanup);
+
+function Harness({ initial = "2032-09-12T09:37" }: { initial?: string }) {
+ const [value, setValue] = useState(initial);
+ return <AutomationRunAtPicker value={value} onChange={setValue} />;
+}
+
+function dayName(value: string) {
+ return new Intl.DateTimeFormat("en", { dateStyle: "full" }).format(parseAutomationRunAt(`${value}T12:00`)!);
+}
+
+describe("Automation run time picker", () => {
+ it("uses text fields and a themed calendar without native date or time controls", async () => {
+ const user = userEvent.setup();
+ render(<Harness />);
+ expect(screen.getByRole("textbox", { name: "Run date" })).toHaveValue("2032-09-12");
+ expect(screen.getByRole("textbox", { name: "Run time" })).toHaveValue("09:37");
+ expect(document.querySelector('input[type="datetime-local"], input[type="date"], input[type="time"]')).toBeNull();
+ const trigger = screen.getByRole("button", { name: "Choose date" });
+ await user.click(trigger);
+ const calendar = screen.getByRole("dialog", { name: "Choose date" });
+ expect(within(calendar).getByRole("grid", { name: "September 2032" })).toBeVisible();
+ expect(within(calendar).getByRole("button", { name: dayName("2032-09-12") })).toHaveFocus();
+ await user.click(within(calendar).getByRole("button", { name: dayName("2032-09-17") }));
+ expect(screen.getByRole("textbox", { name: "Run date" })).toHaveValue("2032-09-17");
+ expect(screen.getByRole("textbox", { name: "Run time" })).toHaveValue("09:37");
+ await waitFor(() => expect(trigger).toHaveFocus());
+ });
+
+ it("moves focus across month boundaries and clamps PageDown to a leap month's last day", async () => {
+ const user = userEvent.setup();
+ render(<Harness initial="2032-01-31T09:37" />);
+ await user.click(screen.getByRole("button", { name: "Choose date" }));
+ await user.keyboard("{PageDown}");
+ expect(screen.getByRole("button", { name: dayName("2032-02-29") })).toHaveFocus();
+ await user.keyboard("{ArrowRight}");
+ expect(screen.getByRole("button", { name: dayName("2032-03-01") })).toHaveFocus();
+ await user.keyboard("{Enter}");
+ expect(screen.getByRole("textbox", { name: "Run date" })).toHaveValue("2032-03-01");
+ expect(screen.getByRole("textbox", { name: "Run time" })).toHaveValue("09:37");
+ });
+
+ it("supports week navigation and Escape without selecting a different date", async () => {
+ const user = userEvent.setup();
+ render(<Harness initial="2032-03-03T09:37" />);
+ const trigger = screen.getByRole("button", { name: "Choose date" });
+ await user.click(trigger);
+ await user.keyboard("{Home}");
+ expect(screen.getByRole("button", { name: dayName("2032-03-01") })).toHaveFocus();
+ await user.keyboard("{End}{ArrowDown}");
+ expect(screen.getByRole("button", { name: dayName("2032-03-14") })).toHaveFocus();
+ await user.keyboard("{Escape}");
+ await waitFor(() => expect(trigger).toHaveFocus());
+ expect(screen.getByRole("textbox", { name: "Run date" })).toHaveValue("2032-03-03");
+ });
+
+ it("preserves exact minutes when typing and opens the calendar at the typed month", async () => {
+ const user = userEvent.setup();
+ render(<Harness />);
+ const date = screen.getByRole("textbox", { name: "Run date" });
+ const time = screen.getByRole("textbox", { name: "Run time" });
+ await user.clear(date);
+ await user.type(date, "2033-01-02");
+ await user.clear(time);
+ await user.type(time, "23:59");
+ await user.click(screen.getByRole("button", { name: "Choose date" }));
+ expect(screen.getByRole("grid", { name: "January 2033" })).toBeVisible();
+ expect(screen.getByRole("button", { name: dayName("2033-01-02") })).toHaveFocus();
+ expect(time).toHaveValue("23:59");
+ });
+
+ it("keeps the editor open when dismissing its calendar and saves a local timestamp", async () => {
+ const user = userEvent.setup();
+ const save = vi.fn();
+ const onOpenChange = vi.fn();
+ const job: SessionAutomationJob = {
+ id: "once", name: "One-time report", enabled: true,
+ schedule: { kind: "at", at_ms: new Date(2099, 8, 12, 9, 37).getTime() },
+ payload: { message: "Summarize project updates" }, state: {},
+ };
+ render(<AutomationEditDialog job={job} saving={false} onSave={save} onOpenChange={onOpenChange} />);
+ await user.click(screen.getByRole("button", { name: "Choose date" }));
+ await user.keyboard("{Escape}");
+ expect(screen.getByRole("dialog", { name: "Edit automation" })).toBeVisible();
+ expect(onOpenChange).not.toHaveBeenCalled();
+ await user.click(screen.getByRole("button", { name: "Choose date" }));
+ await user.click(screen.getByRole("button", { name: dayName("2099-09-17") }));
+ const time = screen.getByRole("textbox", { name: "Run time" });
+ await user.clear(time);
+ await user.type(time, "09:45");
+ await user.click(screen.getByRole("button", { name: "Save", exact: true }));
+ expect(save).toHaveBeenCalledWith(job, {
+ name: job.name, message: job.payload.message,
+ schedule: { kind: "at", at_ms: new Date(2099, 8, 17, 9, 45).getTime() },
+ });
+ fireEvent.change(screen.getByRole("textbox", { name: "Run date" }), { target: { value: "2099-02-31" } });
+ expect(screen.getByRole("button", { name: "Save", exact: true })).toBeDisabled();
+ expect(screen.getByText("Choose a run time.")).toBeVisible();
+ });
+
+ it("localizes the calendar and its field labels in Chinese", async () => {
+ await act(() => i18n.changeLanguage("zh-CN"));
+ const user = userEvent.setup();
+ render(<Harness />);
+ expect(screen.getByRole("textbox", { name: "运行日期" })).toBeVisible();
+ expect(screen.getByRole("textbox", { name: "运行时刻" })).toBeVisible();
+ await user.click(screen.getByRole("button", { name: "选择日期" }));
+ expect(screen.getByRole("grid", { name: "2032年9月" })).toBeVisible();
+ expect(screen.getByRole("button", { name: "下个月" })).toBeVisible();
+ });
+});
+
+describe("Automation local date validation", () => {
+ it.each(["", "2032-02-30T12:00", "2031-02-29T12:00", "2032-13-01T12:00", "2032-00-01T12:00",
+ "2032-01-00T12:00", "2032-01-01T24:00", "2032-01-01T12:60", "2032-01-01T9:00", "2032-01-01T", "0000-01-01T12:00"])(
+ "rejects an invalid local date or time: %s", (value) => expect(parseAutomationRunAt(value)).toBeNull(),
+ );
+
+ it("accepts leap days, midnight, and years below 100 without changing the local fields", () => {
+ expect(parseAutomationRunAt("2032-02-29T00:00")?.getTime()).toBe(new Date(2032, 1, 29, 0, 0).getTime());
+ expect(parseAutomationRunAt("0099-01-01T00:00")?.getFullYear()).toBe(99);
+ });
+});
diff --git a/webui/src/tests/automations-settings.test.tsx b/webui/src/tests/automations-settings.test.tsx
index c14b8d40e..63eb80a0c 100644
--- a/webui/src/tests/automations-settings.test.tsx
+++ b/webui/src/tests/automations-settings.test.tsx
@@ -3,7 +3,7 @@ import { act, cleanup, fireEvent, render, screen, waitFor, within } from "@testi
import userEvent from "@testing-library/user-event";
import { afterEach, beforeEach, describe, expect, it, onTestFinished, vi } from "vitest";
-import { AutomationDeleteDialog, AutomationEditDialog, AutomationsSettings } from "@/components/settings/system/AutomationsSettings";
+import { AutomationDeleteDialog, AutomationDetailDialog, AutomationEditDialog, AutomationsSettings } from "@/components/settings/system/AutomationsSettings";
import type { AutomationFilter } from "@/components/settings/system/AutomationsSettings";
import i18n from "@/i18n";
import type { SessionAutomationJob, SettingsPayload } from "@/lib/types";
@@ -36,7 +36,8 @@ const modelSettings = {
providers: [{ name: "openai", label: "OpenAI", configured: true }],
} as SettingsPayload;
type Props = Partial<React.ComponentProps<typeof AutomationsSettings>>;
-const SYSTEM_TASKS_OPEN_STORAGE_KEY = "nanobot-webui.automation-system-tasks-open";
+const SYSTEM_TASKS_OPEN_STORAGE_KEY = "nanobot-webui.automation-show-system-tasks";
+const VIEW_STORAGE_KEY = "nanobot-webui.automation-view";
function Harness({ payload = { jobs: [task, systemTask] }, ...props }: Props) {
const [filter, setFilter] = useState<AutomationFilter>("all");
@@ -48,8 +49,24 @@ function Harness({ payload = { jobs: [task, systemTask] }, ...props }: Props) {
/>;
}
+function openFilters() {
+ fireEvent.pointerDown(screen.getByRole("button", { name: /^Filter/ }), { button: 0, ctrlKey: false });
+ return screen.getByRole("menu", { name: /^Filter/ });
+}
+
+function selectFilter(name: string) {
+ const menu = openFilters();
+ fireEvent.click(within(menu).getByRole("menuitemradio", { name }));
+}
+
+function renderDetail(job: SessionAutomationJob) {
+ return render(<AutomationDetailDialog job={job} open locale="en" actionKey={null} error={null}
+ onOpenChange={() => {}} onAction={() => {}} onRequestEdit={() => {}} onRequestDelete={() => {}} />);
+}
+
beforeEach(() => {
window.localStorage.removeItem(SYSTEM_TASKS_OPEN_STORAGE_KEY);
+ window.localStorage.removeItem(VIEW_STORAGE_KEY);
});
afterEach(() => {
@@ -57,49 +74,130 @@ afterEach(() => {
vi.useRealTimers();
vi.restoreAllMocks();
window.localStorage.removeItem(SYSTEM_TASKS_OPEN_STORAGE_KEY);
+ window.localStorage.removeItem(VIEW_STORAGE_KEY);
});
describe("Automation task list and detail sheet", () => {
- it("avoids redundant headings and decorative uppercase group labels", () => {
+ it("keeps view selection and filters in one persistent panel toolbar", () => {
render(<Harness />);
- expect(screen.queryByRole("heading", { name: "Your automations" })).not.toBeInTheDocument();
- const month = new Intl.DateTimeFormat("en", { month: "long", year: "numeric" }).format(new Date());
- expect(screen.getByLabelText(month)).toBeVisible();
- const systemToggle = screen.getByRole("button", { name: "System tasks 1" });
- expect(systemToggle).toHaveClass("text-[13px]", "font-medium");
- expect(systemToggle).not.toHaveClass("uppercase", "tracking-[0.08em]");
- });
-
- it("opens system tasks by default and remembers manual changes across visits", () => {
- const first = render(<Harness />);
- expect(screen.getByRole("button", { name: "System tasks 1" })).toHaveAttribute("aria-expanded", "true");
- expect(window.localStorage.getItem(SYSTEM_TASKS_OPEN_STORAGE_KEY)).toBeNull();
- fireEvent.click(screen.getByRole("button", { name: "System tasks 1" }));
- first.unmount();
-
- const second = render(<Harness />);
- expect(screen.getByRole("button", { name: "System tasks 1" })).toHaveAttribute("aria-expanded", "false");
- expect(screen.queryByRole("button", { name: /heartbeat/ })).not.toBeInTheDocument();
- fireEvent.click(screen.getByRole("button", { name: "System tasks 1" }));
- second.unmount();
+ const views = screen.getByRole("group", { name: "Automation view" });
+ const filters = screen.getByRole("button", { name: /^Filter/ });
+ const toolbar = views.closest(".automation-panel-toolbar");
+ expect(toolbar).not.toBeNull();
+ expect(filters.closest(".automation-panel-toolbar")).toBe(toolbar);
+ expect(toolbar?.closest(".automation-panel")).toContainElement(document.querySelector(".automation-calendar"));
+ const tasksButton = screen.getByRole("button", { name: "Tasks", exact: true });
+ tasksButton.focus();
+ fireEvent.click(tasksButton);
+ expect(screen.getByRole("button", { name: "Tasks", exact: true })).toBe(tasksButton);
+ expect(tasksButton).toHaveFocus();
+ expect(screen.getByRole("button", { name: /^Filter/ }).closest(".automation-panel-toolbar")).toBe(toolbar);
+ expect(screen.queryByRole("heading", { level: 2 })).not.toBeInTheDocument();
+ });
+
+ const triggerTask: SessionAutomationJob = {
+ ...task, id: "trigger-review", name: "Review on request", kind: "local_trigger",
+ schedule: { kind: "local" }, state: {},
+ payload: { kind: "local_trigger", message: "nanobot trigger trg_review \"message\"" },
+ trigger: { id: "trg_review", command: "nanobot trigger trg_review \"message\"" },
+ };
+
+ it("keeps undated triggers in Tasks and opens their shared details with keyboard focus restored", async () => {
+ const user = userEvent.setup();
+ render(<Harness payload={{ jobs: [triggerTask, task] }} />);
+ expect(screen.queryByRole("button", { name: /Review on request/ })).not.toBeInTheDocument();
+ await user.click(screen.getByRole("button", { name: "Tasks", exact: true }));
+ const row = screen.getByRole("button", { name: /Review on request/ });
+ expect(within(row).getByText("Triggered by command")).toBeVisible();
+ expect(within(row).queryByText("Waiting for trigger")).not.toBeInTheDocument();
+ expect(within(row).queryByText(/nanobot trigger/)).not.toBeInTheDocument();
+ await user.click(row);
+ const dialog = screen.getByRole("dialog", { name: "Review on request" });
+ expect(within(dialog).getByText(triggerTask.trigger!.command)).toBeVisible();
+ expect(within(dialog).getByRole("button", { name: "Copy", exact: true })).toBeVisible();
+ expect(within(dialog).queryByText("Next")).not.toBeInTheDocument();
+ expect(within(dialog).queryByRole("button", { name: "Run now" })).not.toBeInTheDocument();
+ await user.keyboard("{Escape}");
+ await waitFor(() => expect(row).toHaveFocus());
+ await user.keyboard("{Enter}");
+ expect(screen.getByRole("dialog", { name: "Review on request" })).toBeVisible();
+ });
- render(<Harness />);
- expect(screen.getByRole("button", { name: "System tasks 1" })).toHaveAttribute("aria-expanded", "true");
- expect(window.localStorage.getItem(SYSTEM_TASKS_OPEN_STORAGE_KEY)).toBe("true");
+ it("puts trigger execution history on the calendar without a future placeholder", () => {
+ render(<Harness payload={{ jobs: [{ ...triggerTask, state: {
+ run_history: [{ run_at_ms: now, duration_ms: 60_000, status: "ok" }],
+ } }] }} />);
+ expect(screen.getByRole("button", { name: /Review on request.*Recorded/ })).toBeVisible();
+ expect(screen.queryByRole("button", { name: /Review on request.*Planned/ })).not.toBeInTheDocument();
});
- it("keeps the system toggle usable when browser storage is unavailable", () => {
+ it("defaults to Calendar on every visit regardless of the old saved view and shares filters", () => {
+ window.localStorage.setItem(VIEW_STORAGE_KEY, "tasks");
+ const first = render(<Harness payload={{ jobs: [triggerTask, task, systemTask] }} />);
+ expect(screen.getByRole("button", { name: "Calendar", exact: true })).toHaveAttribute("aria-pressed", "true");
+ fireEvent.click(screen.getByRole("button", { name: "Tasks", exact: true }));
+ expect(screen.queryByRole("button", { name: /heartbeat/ })).not.toBeInTheDocument();
+ first.unmount();
+ render(<Harness payload={{ jobs: [triggerTask, task, systemTask] }} />);
+ expect(screen.getByRole("button", { name: "Calendar", exact: true })).toHaveAttribute("aria-pressed", "true");
+ fireEvent.click(screen.getByRole("button", { name: "Tasks", exact: true }));
+ expect(screen.getByRole("button", { name: "Tasks", exact: true })).toHaveAttribute("aria-pressed", "true");
+ expect(screen.getByRole("button", { name: /Review on request/ })).toBeVisible();
+ selectFilter("Disabled 0");
+ expect(screen.getByText("No automations match this view.")).toBeVisible();
+ fireEvent.click(screen.getByRole("button", { name: "Calendar", exact: true }));
+ expect(screen.getByRole("button", { name: "Filter: Disabled" })).toBeVisible();
+ expect(screen.queryByRole("switch", { name: "Show system tasks" })).not.toBeInTheDocument();
+ });
+
+ it("highlights disabled, running and failed tasks without badges for healthy tasks", () => {
+ render(<Harness payload={{ jobs: [triggerTask,
+ { ...task, id: "off", name: "Disabled task", enabled: false },
+ { ...task, id: "busy", name: "Running task", state: { pending: true } },
+ { ...task, id: "error", name: "Failed task", state: { last_status: "error" } },
+ ] }} />);
+ fireEvent.click(screen.getByRole("button", { name: "Tasks", exact: true }));
+ expect(within(screen.getByRole("button", { name: /Review on request/ })).queryByText("Active")).not.toBeInTheDocument();
+ expect(within(screen.getByRole("button", { name: /Disabled task/ })).getByText("Disabled")).toBeVisible();
+ expect(within(screen.getByRole("button", { name: /Running task/ })).getByText("Running now")).toBeVisible();
+ expect(within(screen.getByRole("button", { name: /Failed task/ })).getByText("Failed")).toBeVisible();
+ });
+
+ it("switches views even when browser storage is blocked", () => {
vi.spyOn(window.localStorage, "getItem").mockImplementation(() => { throw new Error("Blocked"); });
vi.spyOn(window.localStorage, "setItem").mockImplementation(() => { throw new Error("Blocked"); });
- render(<Harness />);
- const toggle = screen.getByRole("button", { name: "System tasks 1" });
- expect(toggle).toHaveAttribute("aria-expanded", "true");
- fireEvent.click(toggle);
- expect(toggle).toHaveAttribute("aria-expanded", "false");
- fireEvent.click(toggle);
- expect(toggle).toHaveAttribute("aria-expanded", "true");
+ render(<Harness payload={{ jobs: [triggerTask] }} />);
+ fireEvent.click(screen.getByRole("button", { name: "Tasks", exact: true }));
+ expect(screen.getByRole("button", { name: /Review on request/ })).toBeVisible();
+ fireEvent.click(screen.getByRole("button", { name: "Calendar", exact: true }));
+ expect(screen.queryByRole("button", { name: /Review on request/ })).not.toBeInTheDocument();
});
+ it("excludes system tasks and their failures from both views even with the old preference enabled", () => {
+ window.localStorage.setItem(SYSTEM_TASKS_OPEN_STORAGE_KEY, "true");
+ const action = vi.fn();
+ render(<Harness payload={{ jobs: [task, { ...systemTask, state: {
+ ...systemTask.state, last_status: "error",
+ } }] }} onAction={action} />);
+ for (const view of ["Calendar", "Tasks"]) {
+ fireEvent.click(screen.getByRole("button", { name: view, exact: true }));
+ expect(screen.queryByRole("switch", { name: "Show system tasks" })).not.toBeInTheDocument();
+ expect(screen.queryByRole("button", { name: /heartbeat/ })).not.toBeInTheDocument();
+ expect(screen.getByRole("button", { name: /PR watch/ })).toBeVisible();
+ const menu = openFilters();
+ expect(within(menu).getByRole("menuitemradio", { name: "All 1" })).toBeVisible();
+ expect(within(menu).getByRole("menuitemradio", { name: "Needs attention 0" })).toBeVisible();
+ fireEvent.keyDown(menu, { key: "Escape" });
+ }
+ expect(action).not.toHaveBeenCalled();
+ expect(systemTask.enabled).toBe(true);
+ });
+
+
+
+
+
+
it.each(["Close", "Escape", "removed", "Edit", "Edit removed"])("finishes the detail exit before cleanup and handoff: %s", async (action) => {
// Happy DOM has no CSS animations. Give Radix live animation names so its
// real presence lifecycle runs, including the outer portal's ref boundary.
@@ -147,10 +245,10 @@ describe("Automation task list and detail sheet", () => {
const user = userEvent.setup();
render(<Harness />);
expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
- expect(screen.getByRole("group", { name: "Automations" })).toBeVisible();
+ expect(screen.getByRole("button", { name: /^Filter/ })).toBeVisible();
expect(screen.queryByRole("textbox")).not.toBeInTheDocument();
- expect(screen.getByRole("button", { name: /^Active/ })).toBeVisible();
- expect(screen.getByRole("button", { name: /heartbeat/ })).toBeVisible();
+ expect(screen.queryByRole("menuitemradio")).not.toBeInTheDocument();
+ expect(screen.queryByRole("button", { name: /heartbeat/ })).not.toBeInTheDocument();
expect(screen.queryByRole("button", { name: "Create in chat" })).not.toBeInTheDocument();
const row = screen.getByRole("button", { name: /PR watch/ });
await user.click(row);
@@ -186,6 +284,10 @@ describe("Automation task list and detail sheet", () => {
const recorded = screen.getByRole("button", { name: /PR watch.*Recorded/ });
expect(planned).toHaveAttribute("aria-haspopup", "dialog");
expect(recorded).toHaveAttribute("aria-haspopup", "dialog");
+ expect(planned.querySelector(".rounded-full")).toBeNull();
+ expect(recorded.querySelector(".rounded-full")).toBeNull();
+ expect(planned).not.toHaveClass("bg-muted/45");
+ expect(recorded).toHaveClass("bg-muted/45", "rounded-compact");
expect(screen.queryByRole("link", { name: /PR watch/ })).not.toBeInTheDocument();
await user.click(recorded);
@@ -227,14 +329,28 @@ describe("Automation task list and detail sheet", () => {
await waitFor(() => expect(more).toHaveFocus());
});
- it("keeps the calendar and filters available when a status has no matches", async () => {
- const user = userEvent.setup();
+ it("keeps explicit running and error icons after removing calendar status dots", () => {
+ const failedJob = {
+ ...task, id: "failed-job", name: "Failed check", enabled: false,
+ state: { run_history: [{ run_at_ms: now - 60_000, status: "error", duration_ms: 1_000 }] },
+ };
+ const runningJob = { ...task, state: { ...task.state, pending: true } };
+ render(<Harness payload={{ jobs: [runningJob, failedJob] }} />);
+ const running = screen.getByRole("button", { name: /PR watch.*Running/ });
+ const failed = screen.getByRole("button", { name: /Failed check.*Failed/ });
+ expect(running.querySelector(".lucide-loader-circle")).not.toBeNull();
+ expect(failed.querySelector(".lucide-circle-alert")).not.toBeNull();
+ expect(running.querySelector(".rounded-full")).toBeNull();
+ expect(failed.querySelector(".rounded-full")).toBeNull();
+ });
+
+ it("keeps the calendar and filters available when a status has no matches", () => {
render(<Harness payload={{ jobs: [task] }} />);
const month = screen.getByRole("heading", { level: 2 });
- await user.click(screen.getByRole("button", { name: "Paused 0" }));
+ selectFilter("Disabled 0");
expect(month).toBeVisible();
expect(screen.queryByRole("button", { name: /PR watch.*Planned/ })).not.toBeInTheDocument();
- await user.click(screen.getByRole("button", { name: "All 1" }));
+ selectFilter("All 1");
expect(screen.getByRole("button", { name: /PR watch.*Planned/ })).toBeVisible();
});
@@ -321,7 +437,7 @@ describe("Automation task list and detail sheet", () => {
render(<Harness payload={{ jobs: [] }} onStartChat={() => {}} settingsSnapshot={modelSettings} />);
expect(screen.getByRole("textbox", { name: "Describe an automation" })).toHaveAttribute(
"placeholder",
- "What would you like nanobot to schedule?",
+ "What would you like nanobot to automate?",
);
});
@@ -329,7 +445,7 @@ describe("Automation task list and detail sheet", () => {
await act(() => i18n.changeLanguage("zh-CN"));
render(<Harness payload={{ jobs: [] }} onStartChat={() => {}} settingsSnapshot={modelSettings} />);
expect(screen.getByRole("textbox", { name: "描述一个自动任务" })).toHaveAttribute(
- "placeholder", "想让 nanobot 定时帮你做什么?",
+ "placeholder", "想让 nanobot 自动帮你做什么?",
);
});
@@ -342,13 +458,10 @@ describe("Automation task list and detail sheet", () => {
expect(calendar.querySelectorAll(".automation-calendar-day").length).toBeGreaterThanOrEqual(35);
expect(screen.queryByRole("button", { name: "Create in chat" })).not.toBeInTheDocument();
expect(screen.queryByRole("button", { name: "Open a chat" })).not.toBeInTheDocument();
- expect(screen.getByRole("group", { name: "Automations" })).toBeVisible();
- fireEvent.click(screen.getByRole("button", { name: /heartbeat/ }));
- const dialog = screen.getByRole("dialog", { name: "heartbeat" });
- expect(within(dialog).queryByRole("button", { name: "Edit" })).not.toBeInTheDocument();
- expect(within(dialog).queryByRole("button", { name: "Pause" })).not.toBeInTheDocument();
- expect(within(dialog).queryByRole("button", { name: "More actions" })).not.toBeInTheDocument();
- expect(within(dialog).queryByText("Linked chat")).not.toBeInTheDocument();
+ expect(screen.queryByRole("button", { name: /^Filter/ })).not.toBeInTheDocument();
+ expect(screen.queryByRole("button", { name: /heartbeat/ })).not.toBeInTheDocument();
+ fireEvent.click(screen.getByRole("button", { name: "Tasks", exact: true }));
+ expect(screen.getByText("No automations yet.")).toBeVisible();
});
it("distinguishes a finished one-time task from a task with no scheduled run", () => {
@@ -359,10 +472,7 @@ describe("Automation task list and detail sheet", () => {
});
it.each(["heartbeat", "dream", "other-system-job"])("shows only actual task data for %s", (id) => {
- render(<Harness payload={{ jobs: [{ ...systemTask, id, name: id, state: {
- next_run_at_ms: now + 540_000,
- } }] }} />);
- fireEvent.click(screen.getByRole("button", { name: new RegExp(id) }));
+ renderDetail({ ...systemTask, id, name: id, state: { next_run_at_ms: now + 540_000 } });
const dialog = screen.getByRole("dialog", { name: id });
expect(dialog).toHaveClass("max-w-[440px]");
expect(dialog).not.toHaveAttribute("aria-describedby");
@@ -389,11 +499,10 @@ describe("Automation task list and detail sheet", () => {
expect(within(metadata).getByText("ID")).toBeInTheDocument();
});
- it("keeps system failures visible and does not infer purpose from a task name", () => {
- render(<Harness payload={{ jobs: [{ ...systemTask, id: "other-system-job", name: "heartbeat",
- state: { last_status: "error", last_error: "Background check failed", next_run_at_ms: null },
- }] }} />);
- fireEvent.click(screen.getByRole("button", { name: /heartbeat/ }));
+ it("keeps the shared protected detail read-only and does not infer purpose from a task name", () => {
+ renderDetail({ ...systemTask, id: "other-system-job", name: "heartbeat",
+ state: { last_run_at_ms: now - 60_000, last_status: "error", last_error: "Background check failed", next_run_at_ms: null },
+ });
const dialog = screen.getByRole("dialog", { name: "heartbeat" });
expect(within(dialog).queryByText("System-managed automation")).not.toBeInTheDocument();
expect(within(dialog).getByRole("alert")).toHaveTextContent("Background check failed");
@@ -403,8 +512,7 @@ describe("Automation task list and detail sheet", () => {
});
it.each([task, systemTask])("uses shared dialog styling and quiet detail rows for $name", (job) => {
- render(<Harness payload={{ jobs: [job] }} />);
- fireEvent.click(screen.getByRole("button", { name: new RegExp(job.name) }));
+ renderDetail(job);
const dialog = screen.getByRole("dialog", { name: job.name });
expect(dialog).toHaveClass("rounded-modal");
expect(dialog).not.toHaveClass("rounded-[20px]");
@@ -420,7 +528,7 @@ describe("Automation task list and detail sheet", () => {
expect(details.parentElement).not.toHaveClass("border-t");
expect(details).toHaveAttribute("aria-expanded", "false");
if (!job.protected) {
- const taskActions = within(dialog).getByRole("button", { name: "Pause" }).parentElement;
+ const taskActions = within(dialog).getByRole("button", { name: "Disable" }).parentElement;
expect(within(dialog).getByRole("button", { name: "Run now" }).parentElement).toBe(taskActions);
expect(within(dialog).getByRole("button", { name: "Delete" }).parentElement).toBe(taskActions);
const edit = within(dialog).getByRole("button", { name: "Edit" });
@@ -447,33 +555,7 @@ describe("Automation task list and detail sheet", () => {
expect(within(dialog).getByText("Asia/Shanghai")).toBeVisible();
});
- it("uses the existing settings surfaces for the calendar and system task group", async () => {
- const user = userEvent.setup();
- render(<Harness payload={{ jobs: [task, systemTask, {
- ...systemTask, id: "dream", name: "dream",
- state: { last_status: "error", last_error: "Memory update failed" },
- }] }} />);
- expect(screen.getByRole("heading", { name: "Automations" })).toHaveClass("font-normal", "text-[24px]");
- const taskBlock = screen.getByRole("button", { name: /PR watch.*Planned/ });
- expect(taskBlock).toHaveAttribute("aria-haspopup", "dialog");
- expect(screen.queryByRole("button", { name: "Manage PR watch" })).not.toBeInTheDocument();
- const list = screen.getByRole("list", { name: "System tasks" });
- expect(taskBlock.closest("section")).toHaveClass("rounded-panel", "bg-[hsl(var(--settings-surface))]");
- expect(list.closest(".bg-settings-surface")).not.toBe(taskBlock.closest("section"));
- const filters = screen.getByRole("group", { name: "Automations" });
- expect(filters.closest(".automation-calendar-header")).toBeInTheDocument();
- expect(screen.getByRole("button", { name: "All 1" }).parentElement).toHaveClass("segmented-control", "flex-wrap");
- const heartbeat = within(list).getByRole("button", { name: /heartbeat/ });
- expect(heartbeat).toHaveClass("rounded-control", "settings-hover");
- expect(within(list).queryByText("System-managed automation")).not.toBeInTheDocument();
- expect(within(list).getByText("Memory update failed")).toBeVisible();
- expect(within(list).getByText("Needs attention")).toBeVisible();
- heartbeat.focus();
- await user.keyboard("{Enter}");
- expect(screen.getByRole("dialog", { name: "heartbeat" })).toBeVisible();
- await user.keyboard("{Escape}");
- await waitFor(() => expect(heartbeat).toHaveFocus());
- });
+
it("keeps separators inside the date grid and omits an outside-month task list", () => {
const outsideTask: SessionAutomationJob = {
@@ -491,7 +573,7 @@ describe("Automation task list and detail sheet", () => {
expect(header).toHaveClass("bg-foreground/[0.025]");
expect(header).not.toHaveClass("border-b");
expect(header?.querySelector(".automation-calendar-weekdays")).toBeInTheDocument();
- expect(calendar.querySelector(".automation-meta-row")).not.toHaveClass("border-t");
+ expect(calendar.querySelector(".automation-meta-row")).toBeNull();
expect(calendar.querySelector(":scope > details")).toBeNull();
expect(screen.queryByRole("button", { name: /Paused backlog review/ })).not.toBeInTheDocument();
expect(calendar).not.toHaveTextContent("·");
@@ -510,50 +592,58 @@ describe("Automation task list and detail sheet", () => {
expect(dialog).not.toHaveTextContent("·");
});
- it("keeps system tasks mounted for shared expand and collapse transitions without hidden tab stops", async () => {
+ it.each([
+ ["30 13 25 * *", "Monthly on day 25 at 13:30"],
+ ["0 0 1 * *", "Monthly on day 1 at 00:00"],
+ ["30 8 * * 1", "Every Monday at 08:30"],
+ ["0 19 * * 0", "Every Sunday at 19:00"],
+ ["0 19 * * 7", "Every Sunday at 19:00"],
+ ["0 10 * * SAT", "Every Saturday at 10:00"],
+ ["0 10 * * 8", "Custom schedule"],
+ ["30 13 25 * 1", "Custom schedule"],
+ ["*/15 9-17 * * 1,3,5", "Custom schedule"],
+ ["0 9 0 * *", "Custom schedule"],
+ ])("keeps %s out of read-only details", (expr, summary) => {
+ render(<Harness payload={{ jobs: [{ ...task, schedule: { kind: "cron", expr } }] }} />);
+ fireEvent.click(screen.getByRole("button", { name: /PR watch/ }));
+ const dialog = screen.getByRole("dialog", { name: "PR watch" });
+ expect(within(dialog).getByText(summary)).toBeVisible();
+ fireEvent.click(within(dialog).getByRole("button", { name: "More details" }));
+ expect(dialog).not.toHaveTextContent(expr);
+ expect(dialog).not.toHaveTextContent("Linked chat");
+ });
+
+ it("localizes the monthly summary and retains the expression in the editor", async () => {
+ const language = i18n.language;
+ onTestFinished(() => i18n.changeLanguage(language));
+ await act(() => i18n.changeLanguage("zh-CN"));
+ const job: SessionAutomationJob = { ...task, schedule: { kind: "cron", expr: "30 13 25 * *" } };
+ const { unmount } = render(<Harness payload={{ jobs: [job] }} />);
+ fireEvent.click(screen.getByRole("button", { name: /PR watch/ }));
+ expect(screen.getByText("每月 25 日 13:30")).toBeVisible();
+ unmount();
+ render(<AutomationEditDialog job={job} saving={false} onOpenChange={() => {}} onSave={vi.fn()} />);
+ expect(screen.getByDisplayValue("30 13 25 * *")).toBeVisible();
+ });
+
+
+
+ it("opens an icon-only filter with the keyboard and restores focus on Escape", async () => {
const user = userEvent.setup();
render(<Harness />);
- const toggle = screen.getByRole("button", { name: "System tasks 1" });
- expect(toggle).toHaveAttribute("aria-expanded", "true");
- await user.click(toggle);
- const drawer = document.getElementById(toggle.getAttribute("aria-controls")!);
- expect(drawer).toHaveClass("inline-disclosure");
- expect(drawer).toHaveAttribute("data-state", "closed");
- expect(drawer).toHaveAttribute("aria-hidden", "true");
- expect(drawer!.firstElementChild).toHaveClass("inline-disclosure-clip");
- expect(drawer!.firstElementChild?.firstElementChild).toHaveClass("inline-disclosure-content");
- const row = within(drawer!).getByRole("button", { hidden: true });
- expect(row).toBeDisabled();
- toggle.focus();
- await user.tab();
- expect(row).not.toHaveFocus();
-
- toggle.focus();
- await user.keyboard("{Enter}");
- expect(toggle).toHaveAttribute("aria-expanded", "true");
- expect(drawer).toHaveAttribute("data-state", "open");
- expect(drawer).not.toHaveAttribute("aria-hidden");
- expect(row).toBeEnabled();
- await user.tab();
- expect(row).toHaveFocus();
- await user.keyboard("{Enter}");
- expect(screen.getByRole("dialog", { name: "heartbeat" })).toBeVisible();
+ const filterButton = screen.getByRole("button", { name: "Filter", exact: true });
+ expect(filterButton).toHaveTextContent("");
+ expect(filterButton.querySelector(".lucide-list-filter")).not.toBeNull();
+ expect(screen.queryByRole("menu")).not.toBeInTheDocument();
+ filterButton.focus();
+ fireEvent.keyDown(filterButton, { key: "Enter" });
+ expect(screen.getByRole("menuitemradio", { name: "All 1" })).toHaveAttribute("aria-checked", "true");
await user.keyboard("{Escape}");
- await waitFor(() => expect(row).toHaveFocus());
- await user.tab({ shift: true });
- expect(toggle).toHaveFocus();
- await user.keyboard("{Enter}");
- expect(document.getElementById("automation-system-tasks")).toBe(drawer);
- expect(drawer).toHaveAttribute("data-state", "closed");
- expect(drawer).toHaveAttribute("aria-hidden", "true");
- expect(row).toBeDisabled();
- expect(screen.queryByRole("button", { name: /heartbeat/ })).not.toBeInTheDocument();
- await user.click(toggle);
- expect(screen.getByRole("button", { name: /heartbeat/ })).toBe(row);
+ expect(screen.queryByRole("menu")).not.toBeInTheDocument();
+ expect(filterButton).toHaveFocus();
});
- it("keeps status filters immediately available", async () => {
- const user = userEvent.setup();
+ it("reveals status filters on demand and shows the applied condition", () => {
render(<Harness payload={{ jobs: [task, {
...task,
id: "paused",
@@ -562,16 +652,16 @@ describe("Automation task list and detail sheet", () => {
state: { last_run_at_ms: now - 60_000, last_status: "ok" },
}, systemTask] }} />);
expect(screen.queryByRole("textbox")).not.toBeInTheDocument();
- await user.click(screen.getByRole("button", { name: "Paused 1" }));
+ selectFilter("Disabled 1");
expect(screen.queryByRole("button", { name: /PR watch/ })).not.toBeInTheDocument();
expect(screen.getByRole("button", { name: /Weekly review/ })).toBeVisible();
- expect(screen.getByRole("button", { name: "Paused 1" })).toHaveAttribute("aria-pressed", "true");
- await user.click(screen.getByRole("button", { name: "All 2" }));
+ expect(screen.getByRole("button", { name: "Filter: Disabled" })).toBeVisible();
+ selectFilter("All 2");
expect(screen.queryByRole("button", { name: "Next run", exact: true })).not.toBeInTheDocument();
expect(screen.getByRole("button", { name: /PR watch.*Planned/ })).toBeVisible();
});
- it("uses live renamed chat titles in details without changing the bound task", async () => {
+ it("omits redundant chat metadata while preserving the bound task and chat action", async () => {
const user = userEvent.setup();
const action = vi.fn();
const payload = { jobs: [task] };
@@ -580,15 +670,13 @@ describe("Automation task list and detail sheet", () => {
titleOverrides={{ "websocket:demo": longTitle }} />);
await user.click(screen.getByRole("button", { name: /PR watch/ }));
const dialog = screen.getByRole("dialog", { name: "PR watch" });
- const chatLabel = within(dialog).getByText(longTitle);
- expect(chatLabel.closest("a")).toBeNull();
- expect(chatLabel).toHaveClass("truncate");
- expect(chatLabel).toHaveAttribute("title", longTitle);
+ expect(within(dialog).queryByText(longTitle)).not.toBeInTheDocument();
+ expect(within(dialog).queryByText("Linked chat")).not.toBeInTheDocument();
expect(dialog.querySelector(".lucide-chevron-right")).toBeNull();
rerender(<Harness payload={payload} onAction={action}
titleOverrides={{ "websocket:demo": "新会话名称" }} />);
- expect(within(dialog).getByText("新会话名称")).toBe(chatLabel);
- await user.click(within(dialog).getByRole("button", { name: "Pause" }));
+ expect(within(dialog).queryByText("新会话名称")).not.toBeInTheDocument();
+ await user.click(within(dialog).getByRole("button", { name: "Disable" }));
expect(action).toHaveBeenCalledWith("disable", expect.objectContaining({
id: task.id, payload: task.payload,
origin: expect.objectContaining({ session_key: "websocket:demo" }),
@@ -597,7 +685,7 @@ describe("Automation task list and detail sheet", () => {
await user.click(within(dialog).getByRole("button", { name: "Close" }));
rerender(<Harness payload={payload} titleOverrides={{}} />);
await user.click(screen.getByRole("button", { name: /PR watch/ }));
- expect(screen.getByText("nanobot-development").closest("a")).toBeNull();
+ expect(screen.queryByText("nanobot-development")).not.toBeInTheDocument();
expect(screen.getByRole("link", { name: "Open a chat" })).toHaveAttribute("href", "#/chat/websocket%3Ademo");
});
@@ -605,16 +693,37 @@ describe("Automation task list and detail sheet", () => {
const action = vi.fn();
const { rerender } = render(<Harness onAction={action} />);
fireEvent.click(screen.getByRole("button", { name: /PR watch/ }));
- fireEvent.click(screen.getByRole("button", { name: "Pause" }));
+ fireEvent.click(screen.getByRole("button", { name: "Disable" }));
expect(action).toHaveBeenCalledWith("disable", task);
rerender(<Harness payload={{ jobs: [{ ...task, enabled: false }] }} onAction={action} filter="active" />);
expect(screen.getByRole("dialog", { name: "PR watch" })).toBeVisible();
- fireEvent.click(screen.getByRole("button", { name: "Resume" }));
+ fireEvent.click(screen.getByRole("button", { name: "Enable" }));
expect(action).toHaveBeenLastCalledWith("enable", { ...task, enabled: false });
rerender(<Harness payload={{ jobs: [] }} />);
expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
});
+ it("uses enable and disable terminology throughout the Chinese automation flow", async () => {
+ const language = i18n.language;
+ onTestFinished(() => i18n.changeLanguage(language));
+ await act(() => i18n.changeLanguage("zh-CN"));
+ const action = vi.fn();
+ const { rerender } = render(<Harness payload={{ jobs: [task] }} onAction={action} />);
+ expect(screen.getByRole("button", { name: "筛选", exact: true })).toBeVisible();
+ fireEvent.click(screen.getByRole("button", { name: /PR watch/ }));
+ const dialog = screen.getByRole("dialog", { name: "PR watch" });
+ fireEvent.click(within(dialog).getByRole("button", { name: "停用", exact: true }));
+ expect(action).toHaveBeenLastCalledWith("disable", task);
+ const disabledTask = { ...task, enabled: false };
+ rerender(<Harness payload={{ jobs: [disabledTask] }} onAction={action} />);
+ expect(within(dialog).getByText("已停用")).toBeVisible();
+ fireEvent.click(within(dialog).getByRole("button", { name: "启用", exact: true }));
+ expect(action).toHaveBeenLastCalledWith("enable", disabledTask);
+ expect(dialog).not.toHaveTextContent("暂停");
+ expect(dialog).not.toHaveTextContent("恢复");
+ expect(i18n.t("settings.automations.status.paused")).toBe("已停用");
+ });
+
it("returns focus to the page heading when the inspected row is no longer present", async () => {
const user = userEvent.setup();
const { rerender } = render(<Harness filter="active" />);
@@ -636,14 +745,7 @@ describe("Automation task list and detail sheet", () => {
it("uses chevrons only for disclosures, while task rows open dialogs", async () => {
const user = userEvent.setup();
render(<Harness />);
- const toggle = screen.getByRole("button", { name: "System tasks 1" });
- const chevron = toggle.querySelector("svg");
- expect(chevron).toHaveClass("lucide-chevron-down", "rotate-180");
- await user.click(toggle);
- expect(chevron).not.toHaveClass("rotate-180");
- expect(toggle).toHaveAttribute("aria-expanded", "false");
- await user.click(toggle);
- for (const name of [/PR watch/, /heartbeat/]) {
+ for (const name of [/PR watch/]) {
const row = screen.getByRole("button", { name });
expect(row).toHaveAttribute("aria-haspopup", "dialog");
expect(row.querySelector(".lucide-chevron-right, .lucide-chevron-down")).toBeNull();
@@ -790,7 +892,7 @@ describe("Automation task list and detail sheet", () => {
await user.click(screen.getByRole("button", { name: "Run now" }));
expect(action).toHaveBeenCalledWith("run", task);
rerender(<Harness actionKey="run:private-job-id" />);
- for (const name of ["Edit", "Pause", "Run now", "Delete"]) {
+ for (const name of ["Edit", "Disable", "Run now", "Delete"]) {
expect(screen.getByRole("button", { name })).toBeDisabled();
}
rerender(<Harness error="Unable to run task" />);
@@ -805,7 +907,7 @@ describe("Automation task list and detail sheet", () => {
await user.click(screen.getByRole("button", { name: /PR watch/ }));
expect(screen.getByRole("button", { name: "Run now" })).toBeDisabled();
rerender(<Harness payload={{ jobs: [{ ...task, enabled: false, origin: null }] }} />);
- expect(screen.getByRole("button", { name: "Resume" })).toBeDisabled();
+ expect(screen.getByRole("button", { name: "Enable" })).toBeDisabled();
expect(screen.queryByRole("link", { name: "Open a chat" })).not.toBeInTheDocument();
});
@@ -830,7 +932,7 @@ describe("Automation task list and detail sheet", () => {
},
}, { ...systemTask, state: { last_status: "error" } }] }} />);
const row = screen.getByRole("button", { name: /PR watch.*Failed/ });
- expect(screen.getByRole("button", { name: /System tasks 1 Needs attention/ })).toBeVisible();
+ expect(within(openFilters()).getByRole("menuitemradio", { name: "Needs attention 1" })).toBeVisible();
fireEvent.click(row);
expect(within(screen.getByRole("dialog")).getByText("Failed")).toBeVisible();
expect(within(screen.getByRole("dialog")).queryByText(/Completed/)).not.toBeInTheDocument();
diff --git a/webui/src/tests/session-info-popover.test.tsx b/webui/src/tests/session-info-popover.test.tsx
index 1e1bac12d..dc4b8a5ee 100644
--- a/webui/src/tests/session-info-popover.test.tsx
+++ b/webui/src/tests/session-info-popover.test.tsx
@@ -81,7 +81,7 @@ describe("SessionInfoPopover", () => {
expect(detail).toHaveClass("max-w-[520px]", "rounded-modal");
expect(within(detail).getByText("Instructions")).toBeInTheDocument();
expect(within(detail).getByText("Check the project status")).toBeInTheDocument();
- await user.click(within(detail).getByRole("button", { name: "Done" }));
+ await user.click(within(detail).getByRole("button", { name: "Close" }));
await waitFor(() => expect(screen.queryByRole("dialog", { name: "Morning check" })).not.toBeInTheDocument());
expect(screen.getByRole("button", { name: "Session details" })).toHaveFocus();
});
@@ -103,14 +103,14 @@ describe("SessionInfoPopover", () => {
await user.click(screen.getByRole("button", { name: "Session details" }));
await user.click(await screen.findByRole("button", { name: /Morning check/ }));
const detail = screen.getByRole("dialog", { name: "Morning check" });
- await user.click(within(detail).getByRole("button", { name: "Pause" }));
+ await user.click(within(detail).getByRole("button", { name: "Disable" }));
expect(requestMutation).toHaveBeenCalledWith(
"automation.disable",
{ id: "job-1" },
20_000,
);
- expect(await within(detail).findByRole("button", { name: "Resume" })).toBeInTheDocument();
+ expect(await within(detail).findByRole("button", { name: "Enable" })).toBeInTheDocument();
});
it("returns from the shared editor to the same task detail", async () => {
diff --git a/webui/src/tests/settings-system.test.tsx b/webui/src/tests/settings-system.test.tsx
index f6e96a073..31058e830 100644
--- a/webui/src/tests/settings-system.test.tsx
+++ b/webui/src/tests/settings-system.test.tsx
@@ -40,6 +40,11 @@ const agentPlugin = {
source: "agent-plugin",
};
+function selectAutomationFilter(name: string) {
+ fireEvent.pointerDown(screen.getByRole("button", { name: /^Filter/ }), { button: 0, ctrlKey: false });
+ fireEvent.click(screen.getByRole("menuitemradio", { name }));
+}
+
describe("Settings system domains", () => {
installSettingsViewTestHooks();
@@ -164,6 +169,24 @@ describe("Settings system domains", () => {
expect(screen.getByTestId("settings-section-transition")).not.toHaveClass("settings-feature-page");
});
+ it.each(["apps", "skills", "automations", "channels"] as const)(
+ "keeps the standalone %s semantic heading and follows the main navigation state",
+ (initialSection) => {
+ renderSettingsView({ initialSection, initialSettings: settingsPayload(), showSidebar: false, mainNavigationExpanded: true });
+ const page = screen.getByTestId("settings-section-transition");
+ expect(page).toHaveAttribute("data-main-navigation-expanded", "true");
+ const heading = within(page).getByRole("heading", { level: 1 });
+ expect(heading.parentElement).toHaveClass("settings-feature-header");
+ expect(heading).not.toHaveAttribute("aria-hidden");
+ },
+ );
+
+ it("does not hide a standalone heading when the navigation is collapsed or absent", () => {
+ renderSettingsView({ initialSection: "skills", initialSettings: settingsPayload(), showSidebar: false, mainNavigationExpanded: false });
+ expect(screen.getByTestId("settings-section-transition")).toHaveAttribute("data-main-navigation-expanded", "false");
+ expect(screen.getByRole("heading", { name: "Skills", level: 1 })).toBeVisible();
+ });
+
it("uses the inline section heading layout to align Apps titles and counts", async () => {
vi.stubGlobal("fetch", vi.fn(async (input: RequestInfo | URL) => {
const url = String(input);
@@ -238,7 +261,7 @@ describe("Settings system domains", () => {
const input = screen.getByRole("textbox", { name: "Describe an automation" });
expect(input).toHaveAttribute(
"placeholder",
- "What would you like nanobot to schedule?",
+ "What would you like nanobot to automate?",
);
fireEvent.change(input, { target: { value: "Summarize updates every weekday at 9" } });
fireEvent.click(screen.getByRole("button", { name: "Send message" }));
@@ -278,14 +301,14 @@ describe("Settings system domains", () => {
});
expect(await screen.findByRole("button", { name: /Daily summary/ })).toBeInTheDocument();
- fireEvent.click(screen.getByRole("button", { name: "Paused 0" }));
+ selectAutomationFilter("Disabled 0");
expect(screen.queryByRole("button", { name: /Daily summary/ })).not.toBeInTheDocument();
expect(screen.getByRole("button", { name: "Today" })).toBeVisible();
- fireEvent.click(screen.getByRole("button", { name: "All 1" }));
+ selectAutomationFilter("All 1");
expect(await screen.findByRole("button", { name: /Daily summary/ })).toBeInTheDocument();
});
- it("wraps automation filters and keeps every option selectable", async () => {
+ it("reveals status filters on demand and keeps every option selectable", async () => {
vi.stubGlobal("fetch", vi.fn(async (input: RequestInfo | URL) => {
if (String(input) === "/api/settings") return jsonResponse(settingsPayload());
if (String(input) === "/api/webui/automations") {
@@ -293,7 +316,7 @@ describe("Settings system domains", () => {
{
id: "heartbeat", name: "heartbeat", enabled: true, protected: true,
schedule: { kind: "every", every_ms: 1_800_000 },
- payload: { message: "System-managed automation" }, state: {},
+ payload: { message: "System-managed automation" }, state: { next_run_at_ms: Date.now() + 60_000 },
},
{
id: "paused-job", name: "Paused reminder", enabled: false,
@@ -307,20 +330,18 @@ describe("Settings system domains", () => {
}));
renderSettingsView({ initialSection: "automations", initialSettings: settingsPayload(), showSidebar: false });
- const filters = await screen.findByRole("group", { name: "Automations" });
- expect(within(filters).getByRole("button", { name: "All 1" }).parentElement).toHaveClass("segmented-control", "flex-wrap");
- expect(within(filters).getAllByRole("button")).toHaveLength(4);
- expect(within(filters).getByRole("button", { name: "All 1" })).toHaveAttribute("aria-pressed", "true");
- expect(within(filters).queryByRole("button", { name: /System/ })).not.toBeInTheDocument();
- expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
- expect(screen.getByRole("button", { name: "System tasks 1" })).toHaveAttribute("aria-expanded", "true");
- expect(screen.getByRole("button", { name: /heartbeat/ })).toBeVisible();
-
- fireEvent.click(within(filters).getByRole("button", { name: "Paused 1" }));
- expect(within(filters).getByRole("button", { name: "Paused 1" })).toHaveAttribute("aria-pressed", "true");
+ const trigger = await screen.findByRole("button", { name: "Filter", exact: true });
+ expect(screen.queryByRole("menu")).not.toBeInTheDocument();
+ fireEvent.pointerDown(trigger, { button: 0, ctrlKey: false });
+ const menu = screen.getByRole("menu", { name: "Filter" });
+ expect(within(menu).getAllByRole("menuitemradio")).toHaveLength(4);
+ expect(within(menu).getByRole("menuitemradio", { name: "All 1" })).toHaveAttribute("aria-checked", "true");
+ expect(within(menu).queryByRole("menuitemradio", { name: /System/ })).not.toBeInTheDocument();
+ fireEvent.click(within(menu).getByRole("menuitemradio", { name: "Disabled 1" }));
+ expect(screen.getByRole("button", { name: "Filter: Disabled" })).toBeVisible();
expect(screen.getByRole("button", { name: /Paused reminder/ })).toBeVisible();
expect(screen.queryByRole("button", { name: /heartbeat/ })).not.toBeInTheDocument();
- expect(within(filters).getAllByRole("button", { pressed: true })).toHaveLength(1);
+
});
it("coalesces focus refreshes while automations are already loading", async () => {
diff --git a/webui/src/tests/settings-test-utils.tsx b/webui/src/tests/settings-test-utils.tsx
index beb49ddd1..7c987b542 100644
--- a/webui/src/tests/settings-test-utils.tsx
+++ b/webui/src/tests/settings-test-utils.tsx
@@ -138,6 +138,7 @@ export function renderSettingsView(
| "runtime";
initialSettings?: SettingsPayload;
showSidebar?: boolean;
+ mainNavigationExpanded?: boolean;
onBackToChat?: () => void;
onSettingsChange?: (payload: SettingsPayload) => void;
onStartAutomationChat?: React.ComponentProps<typeof SettingsView>["onStartAutomationChat"];
@@ -152,6 +153,7 @@ export function renderSettingsView(
initialSection={options.initialSection ?? "apps"}
initialSettings={options.initialSettings}
showSidebar={options.showSidebar}
+ mainNavigationExpanded={options.mainNavigationExpanded}
onToggleTheme={() => {}}
onBackToChat={options.onBackToChat ?? (() => {})}
onModelNameChange={() => {}}