feat(webui): refine automation views and scheduling controls
This commit is contained in:
1 parent
c25b2048ef
commit
e7da868574
23 files changed
+1131
-601
No files matched your search
@@ -2880,6 +2880,7 @@ function Shell({
|
|||||||
initialSection={settingsInitialSection}
|
initialSection={settingsInitialSection}
|
||||||
initialSettings={settingsSnapshot}
|
initialSettings={settingsSnapshot}
|
||||||
showSidebar={view === "settings"}
|
showSidebar={view === "settings"}
|
||||||
|
mainNavigationExpanded={showMainSidebar && hostSidebarOpen}
|
||||||
onToggleTheme={toggle}
|
onToggleTheme={toggle}
|
||||||
onBackToChat={onBackToChat}
|
onBackToChat={onBackToChat}
|
||||||
onModelNameChange={onModelNameChange}
|
onModelNameChange={onModelNameChange}
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ interface SettingsPageProps {
|
|||||||
controller: SettingsController;
|
controller: SettingsController;
|
||||||
theme: "light" | "dark";
|
theme: "light" | "dark";
|
||||||
showSidebar: boolean;
|
showSidebar: boolean;
|
||||||
|
mainNavigationExpanded: boolean;
|
||||||
onToggleTheme: () => void;
|
onToggleTheme: () => void;
|
||||||
onBackToChat: () => void;
|
onBackToChat: () => void;
|
||||||
skills: SkillSummary[];
|
skills: SkillSummary[];
|
||||||
@@ -69,6 +70,7 @@ export function SettingsPage({
|
|||||||
controller,
|
controller,
|
||||||
theme,
|
theme,
|
||||||
showSidebar,
|
showSidebar,
|
||||||
|
mainNavigationExpanded,
|
||||||
onToggleTheme,
|
onToggleTheme,
|
||||||
onBackToChat,
|
onBackToChat,
|
||||||
skills,
|
skills,
|
||||||
@@ -734,6 +736,7 @@ export function SettingsPage({
|
|||||||
data-testid="settings-section-transition"
|
data-testid="settings-section-transition"
|
||||||
ref={setDialogLayoutAnchor}
|
ref={setDialogLayoutAnchor}
|
||||||
data-settings-section={activeSection}
|
data-settings-section={activeSection}
|
||||||
|
data-main-navigation-expanded={mainNavigationExpanded}
|
||||||
className={cn(
|
className={cn(
|
||||||
"mx-auto w-full animate-in fade-in-0 slide-in-from-bottom-1 py-6 duration-200 ease-out",
|
"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",
|
"motion-reduce:animate-none sm:py-8 lg:py-12",
|
||||||
@@ -744,7 +747,7 @@ export function SettingsPage({
|
|||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{!showSidebar ? (
|
{!showSidebar ? (
|
||||||
<div className={activeSection === "automations" ? "lg:hidden" : "mb-7"}>
|
<div className={activeSection === "automations" ? "lg:hidden" : "settings-feature-header mb-7"}>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={backToChat}
|
onClick={backToChat}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ interface SettingsViewProps {
|
|||||||
initialSection?: SettingsSectionKey;
|
initialSection?: SettingsSectionKey;
|
||||||
initialSettings?: SettingsPayload | null;
|
initialSettings?: SettingsPayload | null;
|
||||||
showSidebar?: boolean;
|
showSidebar?: boolean;
|
||||||
|
mainNavigationExpanded?: boolean;
|
||||||
onToggleTheme: () => void;
|
onToggleTheme: () => void;
|
||||||
onBackToChat: () => void;
|
onBackToChat: () => void;
|
||||||
onModelNameChange: (modelName: string | null) => void;
|
onModelNameChange: (modelName: string | null) => void;
|
||||||
@@ -38,6 +39,7 @@ export function SettingsView({
|
|||||||
initialSection = "overview",
|
initialSection = "overview",
|
||||||
initialSettings = null,
|
initialSettings = null,
|
||||||
showSidebar = true,
|
showSidebar = true,
|
||||||
|
mainNavigationExpanded = false,
|
||||||
onToggleTheme,
|
onToggleTheme,
|
||||||
onBackToChat,
|
onBackToChat,
|
||||||
onModelNameChange,
|
onModelNameChange,
|
||||||
@@ -68,6 +70,7 @@ export function SettingsView({
|
|||||||
controller={controller}
|
controller={controller}
|
||||||
theme={theme}
|
theme={theme}
|
||||||
showSidebar={showSidebar}
|
showSidebar={showSidebar}
|
||||||
|
mainNavigationExpanded={mainNavigationExpanded}
|
||||||
onToggleTheme={onToggleTheme}
|
onToggleTheme={onToggleTheme}
|
||||||
onBackToChat={onBackToChat}
|
onBackToChat={onBackToChat}
|
||||||
skills={skills}
|
skills={skills}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { CircleAlert, Loader2, X } from "lucide-react";
|
import { CircleAlert, Loader2, X } from "lucide-react";
|
||||||
import { useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
import { useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
||||||
import type { ReactNode } from "react";
|
|
||||||
|
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { formControlFocusClassName } from "@/components/ui/form-control";
|
import { formControlFocusClassName } from "@/components/ui/form-control";
|
||||||
@@ -18,9 +17,6 @@ type CalendarEntry = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
type CalendarCopy = {
|
type CalendarCopy = {
|
||||||
previousMonth: string;
|
|
||||||
nextMonth: string;
|
|
||||||
today: string;
|
|
||||||
planned: string;
|
planned: string;
|
||||||
recorded: string;
|
recorded: string;
|
||||||
running: string;
|
running: string;
|
||||||
@@ -29,13 +25,14 @@ type CalendarCopy = {
|
|||||||
close: string;
|
close: string;
|
||||||
noEntries: string;
|
noEntries: string;
|
||||||
completed: string;
|
completed: string;
|
||||||
|
system: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
interface AutomationCalendarProps {
|
interface AutomationCalendarProps {
|
||||||
jobs: SessionAutomationJob[];
|
jobs: SessionAutomationJob[];
|
||||||
|
month: Date;
|
||||||
locale: string;
|
locale: string;
|
||||||
copy: CalendarCopy;
|
copy: CalendarCopy;
|
||||||
filters?: ReactNode;
|
|
||||||
onInspect: (job: SessionAutomationJob, trigger: HTMLElement) => void;
|
onInspect: (job: SessionAutomationJob, trigger: HTMLElement) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,18 +40,10 @@ function startOfDay(date: Date): Date {
|
|||||||
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
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 {
|
function addDays(date: Date, amount: number): Date {
|
||||||
return new Date(date.getFullYear(), date.getMonth(), date.getDate() + amount);
|
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 {
|
function mondayIndex(date: Date): number {
|
||||||
return (date.getDay() + 6) % 7;
|
return (date.getDay() + 6) % 7;
|
||||||
}
|
}
|
||||||
@@ -134,13 +123,6 @@ function CalendarEntryRow({ entry, locale, copy, onInspect, compact = false }: {
|
|||||||
: copy.recorded;
|
: copy.recorded;
|
||||||
const content = (
|
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="min-w-0 flex-1">
|
||||||
<span className="block truncate font-medium text-foreground">{name}</span>
|
<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">
|
<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}
|
{failed ? <CircleAlert className="h-3 w-3" aria-hidden /> : null}
|
||||||
<span className="tabular-nums">{entryTime(entry, locale)}</span>
|
<span className="tabular-nums">{entryTime(entry, locale)}</span>
|
||||||
{compact ? <span>{status}</span> : null}
|
{compact ? <span>{status}</span> : null}
|
||||||
|
{entry.job.protected ? <span>{copy.system}</span> : null}
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</>
|
</>
|
||||||
@@ -165,7 +148,7 @@ function CalendarEntryRow({ entry, locale, copy, onInspect, compact = false }: {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className={actionClass}
|
className={actionClass}
|
||||||
aria-label={`${name}, ${entryTime(entry, locale)}, ${status}`}
|
aria-label={`${name}, ${entryTime(entry, locale)}, ${status}${entry.job.protected ? `, ${copy.system}` : ""}`}
|
||||||
aria-haspopup="dialog"
|
aria-haspopup="dialog"
|
||||||
onClick={(event) => onInspect(entry.job, event.currentTarget)}
|
onClick={(event) => onInspect(entry.job, event.currentTarget)}
|
||||||
>
|
>
|
||||||
@@ -193,7 +176,7 @@ function CalendarOverflowEntries({ entries, dayLabel, locale, copy, onInspect }:
|
|||||||
ref={triggerRef}
|
ref={triggerRef}
|
||||||
type="button"
|
type="button"
|
||||||
className={cn(
|
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,
|
formControlFocusClassName,
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
@@ -239,8 +222,7 @@ function CalendarOverflowEntries({ entries, dayLabel, locale, copy, onInspect }:
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function AutomationCalendar({ jobs, locale, copy, filters, onInspect }: AutomationCalendarProps) {
|
export function AutomationCalendar({ jobs, month, locale, copy, onInspect }: AutomationCalendarProps) {
|
||||||
const [month, setMonth] = useState(() => startOfMonth(new Date()));
|
|
||||||
const calendarRef = useRef<HTMLElement | null>(null);
|
const calendarRef = useRef<HTMLElement | null>(null);
|
||||||
const [wideCalendar, setWideCalendar] = useState(true);
|
const [wideCalendar, setWideCalendar] = useState(true);
|
||||||
const today = startOfDay(new Date());
|
const today = startOfDay(new Date());
|
||||||
@@ -276,44 +258,8 @@ export function AutomationCalendar({ jobs, locale, copy, filters, onInspect }: A
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
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-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>
|
{wideCalendar ? <div className="automation-calendar-weekdays" aria-hidden>
|
||||||
{weekdayLabels.map((label) => <div key={label}>{label}</div>)}
|
{weekdayLabels.map((label) => <div key={label}>{label}</div>)}
|
||||||
</div> : null}
|
</div> : null}
|
||||||
@@ -396,21 +342,6 @@ export function AutomationCalendar({ jobs, locale, copy, filters, onInspect }: A
|
|||||||
)}
|
)}
|
||||||
</div> : null}
|
</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>
|
</section>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -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>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@ import {
|
|||||||
ChevronDown,
|
ChevronDown,
|
||||||
CircleAlert,
|
CircleAlert,
|
||||||
Clipboard,
|
Clipboard,
|
||||||
|
ListFilter,
|
||||||
Loader2,
|
Loader2,
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
@@ -13,14 +14,15 @@ import { useTranslation } from "react-i18next";
|
|||||||
import { channelTranslator } from "@/channel-plugins/i18n";
|
import { channelTranslator } from "@/channel-plugins/i18n";
|
||||||
import { channelUiOwner, channelUiPresentation } from "@/channel-plugins/registry";
|
import { channelUiOwner, channelUiPresentation } from "@/channel-plugins/registry";
|
||||||
import { AutomationCalendar } from "@/components/settings/system/AutomationCalendar";
|
import { AutomationCalendar } from "@/components/settings/system/AutomationCalendar";
|
||||||
import { SettingsGroup } from "@/components/settings/shared/SettingsControls";
|
import { AutomationRunAtPicker, parseAutomationRunAt } from "@/components/settings/system/AutomationRunAtPicker";
|
||||||
import {
|
import {
|
||||||
modelPresetOptionsFromSettings,
|
modelPresetOptionsFromSettings,
|
||||||
toModelBadgeInfo,
|
toModelBadgeInfo,
|
||||||
} from "@/components/thread/model-preset";
|
} from "@/components/thread/model-preset";
|
||||||
import { ThreadComposer } from "@/components/thread/ThreadComposer";
|
import { ThreadComposer } from "@/components/thread/ThreadComposer";
|
||||||
import { Button } from "@/components/ui/button";
|
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 { ExpandableText } from "@/components/ui/expandable-text";
|
||||||
import {
|
import {
|
||||||
Dialog,
|
Dialog,
|
||||||
@@ -50,7 +52,6 @@ export type AutomationFilter = "all" | "active" | "paused" | "failed" | "system"
|
|||||||
export type AutomationAction = "enable" | "disable" | "delete" | "run";
|
export type AutomationAction = "enable" | "disable" | "delete" | "run";
|
||||||
|
|
||||||
const EMPTY_TITLE_OVERRIDES: Record<string, string> = {};
|
const EMPTY_TITLE_OVERRIDES: Record<string, string> = {};
|
||||||
const SYSTEM_TASKS_OPEN_STORAGE_KEY = "nanobot-webui.automation-system-tasks-open";
|
|
||||||
|
|
||||||
export function AutomationsSettings({
|
export function AutomationsSettings({
|
||||||
payload, loading, filter, actionKey, error,
|
payload, loading, filter, actionKey, error,
|
||||||
@@ -97,35 +98,28 @@ export function AutomationsSettings({
|
|||||||
const [inspectedJob, setInspectedJob] = useState<SessionAutomationJob | null>(null);
|
const [inspectedJob, setInspectedJob] = useState<SessionAutomationJob | null>(null);
|
||||||
const [detailOpen, setDetailOpen] = useState(false);
|
const [detailOpen, setDetailOpen] = useState(false);
|
||||||
const [localModelPreset, setLocalModelPreset] = useState<string | null>(null);
|
const [localModelPreset, setLocalModelPreset] = useState<string | null>(null);
|
||||||
const [systemOpen, setSystemOpen] = useState(() => {
|
const [view, setView] = useState<"tasks" | "calendar">("calendar");
|
||||||
try {
|
const [month, setMonth] = useState(() => {
|
||||||
return window.localStorage.getItem(SYSTEM_TASKS_OPEN_STORAGE_KEY) !== "false";
|
const today = new Date();
|
||||||
} catch {
|
return new Date(today.getFullYear(), today.getMonth(), 1);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
const pageTitle = useRef<HTMLHeadingElement | null>(null);
|
const pageTitle = useRef<HTMLHeadingElement | null>(null);
|
||||||
const selectedTrigger = useRef<HTMLElement | null>(null);
|
const selectedTrigger = useRef<HTMLElement | null>(null);
|
||||||
const afterDetailClose = useRef<((job: SessionAutomationJob) => void) | null>(null);
|
const afterDetailClose = useRef<((job: SessionAutomationJob) => void) | null>(null);
|
||||||
const filtered = useMemo(() => {
|
const visibleJobs = useMemo(() => jobs.filter((job) => !job.protected), [jobs]);
|
||||||
return jobs
|
const filtered = useMemo(() => visibleJobs.filter((job) => automationMatchesFilter(job, filter)), [filter, visibleJobs]);
|
||||||
.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);
|
|
||||||
// Keep an inspected task open when an action moves it outside the current filter.
|
// Keep an inspected task open when an action moves it outside the current filter.
|
||||||
const liveSelectedJob = jobs.find((job) => job.id === inspectedJob?.id);
|
const liveSelectedJob = jobs.find((job) => job.id === inspectedJob?.id);
|
||||||
// Retain the last detail through its exit, even if a one-shot task disappears.
|
// Retain the last detail through its exit, even if a one-shot task disappears.
|
||||||
const selectedJob = liveSelectedJob ?? inspectedJob;
|
const selectedJob = liveSelectedJob ?? inspectedJob;
|
||||||
const summaryOptions: Array<{ value: AutomationFilter; label: string; count: number }> = [
|
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"),
|
{ value: "active", label: tx("settings.automations.filters.active", "Active"),
|
||||||
count: personalJobs.filter((job) => automationMatchesFilter(job, "active")).length },
|
count: visibleJobs.filter((job) => automationMatchesFilter(job, "active")).length },
|
||||||
{ value: "paused", label: tx("settings.automations.filters.paused", "Paused"),
|
{ value: "paused", label: tx("settings.automations.filters.paused", "Disabled"),
|
||||||
count: personalJobs.filter((job) => automationMatchesFilter(job, "paused")).length },
|
count: visibleJobs.filter((job) => automationMatchesFilter(job, "paused")).length },
|
||||||
{ value: "failed", label: tx("settings.automations.filters.failed", "Needs attention"),
|
{ value: "failed", label: tx("settings.automations.filters.failed", "Needs attention"),
|
||||||
count: personalJobs.filter(automationNeedsAttention).length },
|
count: visibleJobs.filter(automationNeedsAttention).length },
|
||||||
];
|
];
|
||||||
const configuredPresetNames = useMemo(
|
const configuredPresetNames = useMemo(
|
||||||
() => new Set(settingsSnapshot?.model_presets?.map((preset) => preset.name) ?? []),
|
() => new Set(settingsSnapshot?.model_presets?.map((preset) => preset.name) ?? []),
|
||||||
@@ -163,19 +157,6 @@ export function AutomationsSettings({
|
|||||||
onReturnToDetailHandled?.();
|
onReturnToDetailHandled?.();
|
||||||
}, [jobs, onReturnToDetailHandled, returnToDetailJob]);
|
}, [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) => {
|
const inspectJob = (job: SessionAutomationJob, trigger: HTMLElement) => {
|
||||||
selectedTrigger.current = trigger;
|
selectedTrigger.current = trigger;
|
||||||
setInspectedJob(job);
|
setInspectedJob(job);
|
||||||
@@ -201,10 +182,37 @@ export function AutomationsSettings({
|
|||||||
options,
|
options,
|
||||||
activeModelPreset,
|
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 (
|
return (
|
||||||
<div className="automations-page">
|
<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]">
|
<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")}
|
{tx("settings.nav.automations", "Automations")}
|
||||||
</h1>
|
</h1>
|
||||||
@@ -221,7 +229,7 @@ export function AutomationsSettings({
|
|||||||
inputAriaLabel={tx("settings.automations.createInput", "Describe an automation")}
|
inputAriaLabel={tx("settings.automations.createInput", "Describe an automation")}
|
||||||
placeholder={tx(
|
placeholder={tx(
|
||||||
"settings.automations.createPrompt",
|
"settings.automations.createPrompt",
|
||||||
"What would you like nanobot to schedule?",
|
"What would you like nanobot to automate?",
|
||||||
)}
|
)}
|
||||||
variant="thread"
|
variant="thread"
|
||||||
compactWhenIdle
|
compactWhenIdle
|
||||||
@@ -240,89 +248,115 @@ export function AutomationsSettings({
|
|||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
{error ? <AutomationError message={error} /> : null}
|
{error ? <AutomationError message={error} /> : null}
|
||||||
{loading && !payload ? (
|
<div className="automation-panel overflow-hidden rounded-panel bg-[hsl(var(--settings-surface))]">
|
||||||
<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">
|
<div className="automation-panel-toolbar bg-foreground/[0.025]">
|
||||||
<Loader2 className="mr-2 h-4 w-4 animate-spin" aria-hidden />
|
<div className="automation-view-switch" role="group" aria-label={tx("settings.automations.views.label", "Automation view")}>
|
||||||
{tx("settings.automations.loading", "Loading automations...")}
|
<SegmentedControl
|
||||||
</div>
|
value={view}
|
||||||
) : (
|
className="bg-[var(--automation-view-track)]"
|
||||||
<AutomationCalendar
|
itemClassName="min-h-8"
|
||||||
jobs={personal}
|
options={[
|
||||||
locale={locale}
|
{ value: "tasks", label: tx("settings.automations.views.tasks", "Tasks") },
|
||||||
filters={jobs.length ? (
|
{ value: "calendar", label: tx("settings.automations.views.calendar", "Calendar") },
|
||||||
<div role="group" aria-label={tx("settings.nav.automations", "Automations")}>
|
]}
|
||||||
<SegmentedControl
|
onChange={setView}
|
||||||
value={filter}
|
/>
|
||||||
className="flex-wrap justify-start"
|
</div>
|
||||||
itemClassName="px-2.5"
|
{view === "calendar" ? (
|
||||||
options={summaryOptions.map((option) => ({
|
<h2 className="shrink-0 text-[13px] font-normal text-muted-foreground">
|
||||||
value: option.value,
|
{new Intl.DateTimeFormat(locale, { month: "long", year: "numeric" }).format(month)}
|
||||||
label: <>{option.label} <span className="ml-0.5 tabular-nums opacity-65">{option.count}</span></>,
|
</h2>
|
||||||
}))}
|
) : null}
|
||||||
onChange={onFilterChange}
|
{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>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
copy={{
|
</div>
|
||||||
previousMonth: tx("settings.automations.calendar.previousMonth", "Previous month"),
|
{loading && !payload ? (
|
||||||
nextMonth: tx("settings.automations.calendar.nextMonth", "Next month"),
|
<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">
|
||||||
today: tx("settings.automations.calendar.today", "Today"),
|
<Loader2 className="mr-2 h-4 w-4 animate-spin" aria-hidden />
|
||||||
planned: tx("settings.automations.calendar.planned", "Planned"),
|
{tx("settings.automations.loading", "Loading automations...")}
|
||||||
recorded: tx("settings.automations.calendar.recorded", "Recorded"),
|
</div>
|
||||||
running: tx("settings.automations.status.running", "Running"),
|
) : view === "tasks" ? (
|
||||||
failed: tx("settings.automations.status.failed", "Failed"),
|
<section className="p-1" aria-label={tx("settings.automations.views.tasks", "Tasks")}>
|
||||||
more: (count) => tx("settings.automations.calendar.more", "+{{count}} more", { count }),
|
{filtered.length ? (
|
||||||
close: tx("common.close", "Close"),
|
<ul className="space-y-1">
|
||||||
noEntries: personal.length
|
{filtered.map((job) => {
|
||||||
? tx("settings.automations.calendar.noEntries", "No runs in this month.")
|
const status = automationStatusKey(job);
|
||||||
: personalJobs.length
|
const emphasizedStatus = status === "running" || status === "failed" || status === "paused";
|
||||||
? tx("settings.automations.noMatches", "No automations match this view.")
|
return (
|
||||||
: tx("settings.automations.empty", "No automations yet."),
|
<li key={job.id}>
|
||||||
completed: tx("settings.automations.status.completed", "Completed"),
|
<button
|
||||||
}}
|
type="button"
|
||||||
onInspect={inspectJob}
|
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)}
|
||||||
|
>
|
||||||
{system.length ? (
|
<span className="min-w-0 flex-1 basis-48">
|
||||||
<SettingsGroup>
|
<span className="block truncate text-[14px] font-medium text-foreground">{job.name || job.id}</span>
|
||||||
<section className="py-2">
|
<span className="mt-1 flex flex-wrap gap-x-3 gap-y-1 text-[12px] leading-5 text-muted-foreground">
|
||||||
<button
|
<span>{formatAutomationSchedule(job, locale, tx)}</span>
|
||||||
type="button"
|
{job.protected ? <span>{tx("settings.automations.filters.system", "System")}</span> : null}
|
||||||
aria-expanded={systemOpen}
|
</span>
|
||||||
aria-controls="automation-system-tasks"
|
</span>
|
||||||
onClick={() => {
|
{emphasizedStatus ? (
|
||||||
const open = !systemOpen;
|
<span className={cn("inline-flex items-center gap-1.5 text-[12px]", status === "failed" ? "text-destructive" : "text-muted-foreground")}>
|
||||||
setSystemOpen(open);
|
{status === "running" ? <Loader2 className="h-3.5 w-3.5 animate-spin motion-reduce:animate-none" aria-hidden /> : null}
|
||||||
try {
|
{status === "failed" ? <CircleAlert className="h-3.5 w-3.5" aria-hidden /> : null}
|
||||||
window.localStorage.setItem(SYSTEM_TASKS_OPEN_STORAGE_KEY, String(open));
|
{tx(`settings.automations.status.${status}`, status === "paused" ? "Disabled" : status === "running" ? "Running" : "Failed")}
|
||||||
} catch {
|
</span>
|
||||||
// Unavailable storage must not prevent expanding or collapsing.
|
) : null}
|
||||||
}
|
</button>
|
||||||
}}
|
</li>
|
||||||
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)}
|
|
||||||
</ul>
|
</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>
|
</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>
|
</div>
|
||||||
|
|
||||||
<AutomationDetailDialog
|
<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({
|
function AutomationDetailPanel({
|
||||||
job, locale, actionKey, error, onAction, onRequestEdit, onRequestDelete,
|
job, locale, actionKey, error, onAction, onRequestEdit, onRequestDelete,
|
||||||
@@ -464,7 +451,6 @@ function AutomationDetailPanel({
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const tx = (key: string, fallback: string, values?: Record<string, unknown>) =>
|
const tx = (key: string, fallback: string, values?: Record<string, unknown>) =>
|
||||||
t(key, { defaultValue: fallback, ...(values ?? {}) });
|
t(key, { defaultValue: fallback, ...(values ?? {}) });
|
||||||
const origin = automationOriginLabel(job, t);
|
|
||||||
const originHref = job.origin?.channel === "websocket" && job.origin.session_key
|
const originHref = job.origin?.channel === "websocket" && job.origin.session_key
|
||||||
? `#/chat/${encodeURIComponent(job.origin.session_key)}` : null;
|
? `#/chat/${encodeURIComponent(job.origin.session_key)}` : null;
|
||||||
const localTrigger = isLocalTriggerAutomation(job);
|
const localTrigger = isLocalTriggerAutomation(job);
|
||||||
@@ -494,12 +480,12 @@ function AutomationDetailPanel({
|
|||||||
{canManage ? (
|
{canManage ? (
|
||||||
<DialogDescription className="flex flex-wrap items-center gap-x-4 gap-y-1 text-[13px] leading-5">
|
<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="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>{tx("settings.automations.labels.next", "Next")}</span>
|
||||||
<span className="text-foreground/80" title={formatAutomationNextTitle(job, locale, tx)}>
|
<span className="text-foreground/80" title={formatAutomationNextTitle(job, locale, tx)}>
|
||||||
{formatAutomationNext(job, tx)}
|
{formatAutomationNext(job, tx)}
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span> : null}
|
||||||
</DialogDescription>
|
</DialogDescription>
|
||||||
) : null}
|
) : null}
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
@@ -553,9 +539,9 @@ function AutomationDetailPanel({
|
|||||||
</span>
|
</span>
|
||||||
: lastStatus || tx("settings.automations.neverRun", "Not run yet")}
|
: lastStatus || tx("settings.automations.neverRun", "Not run yet")}
|
||||||
</AutomationDetail>
|
</AutomationDetail>
|
||||||
{!job.protected ? (
|
{!job.protected && job.origin?.channel && job.origin.channel !== "websocket" ? (
|
||||||
<AutomationDetail label={tx("settings.automations.labels.origin", "Linked chat")}>
|
<AutomationDetail label={tx("settings.automations.labels.origin", "Linked chat")}>
|
||||||
<span className="block truncate" title={origin}>{origin}</span>
|
{automationChannelLabel(job.origin.channel, t)}
|
||||||
</AutomationDetail>
|
</AutomationDetail>
|
||||||
) : null}
|
) : null}
|
||||||
</dl>
|
</dl>
|
||||||
@@ -585,7 +571,7 @@ function AutomationDetailPanel({
|
|||||||
<div className="flex min-w-0 flex-wrap items-center gap-1">
|
<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)}>
|
<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}
|
{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>
|
</Button>
|
||||||
{!localTrigger ? (
|
{!localTrigger ? (
|
||||||
<Button variant="ghost" size="sm" className="text-muted-foreground" disabled={!canRun || busy} onClick={() => void onAction("run", job)}>
|
<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>) =>
|
const tx = (key: string, fallback: string, values?: Record<string, unknown>) =>
|
||||||
t(key, { defaultValue: fallback, ...(values ?? {}) });
|
t(key, { defaultValue: fallback, ...(values ?? {}) });
|
||||||
const [draft, setDraft] = useState<AutomationEditDraft>(() => automationDraftFromJob(null));
|
const [draft, setDraft] = useState<AutomationEditDraft>(() => automationDraftFromJob(null));
|
||||||
|
const validationId = useId();
|
||||||
const localTrigger = isLocalTriggerAutomation(job);
|
const localTrigger = isLocalTriggerAutomation(job);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -750,6 +737,12 @@ export function AutomationEditDialog({
|
|||||||
{...dialogFocus}
|
{...dialogFocus}
|
||||||
aria-describedby={undefined}
|
aria-describedby={undefined}
|
||||||
className="w-[min(calc(100vw-2rem),34rem)]"
|
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}>
|
<form className="space-y-5" onSubmit={submit}>
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
@@ -869,20 +862,16 @@ export function AutomationEditDialog({
|
|||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
{!localTrigger && draft.scheduleKind === "at" ? (
|
{!localTrigger && draft.scheduleKind === "at" ? (
|
||||||
<label className="block space-y-1.5">
|
<AutomationRunAtPicker
|
||||||
<span className="text-[12px] font-medium text-muted-foreground">
|
value={draft.atLocal}
|
||||||
{tx("settings.automations.fields.runAt", "Run at")}
|
onChange={(atLocal) => setDraft((prev) => ({ ...prev, atLocal }))}
|
||||||
</span>
|
disabled={saving}
|
||||||
<Input
|
errorId={validation ? validationId : undefined}
|
||||||
type="datetime-local"
|
/>
|
||||||
value={draft.atLocal}
|
|
||||||
onChange={(event) => setDraft((prev) => ({ ...prev, atLocal: event.target.value }))}
|
|
||||||
/>
|
|
||||||
</label>
|
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
{validation ? (
|
{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}
|
{validation}
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
@@ -972,15 +961,6 @@ function automationTriggerCommand(job: SessionAutomationJob): string {
|
|||||||
return job.trigger?.command || job.payload.command || job.payload.message || "";
|
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 {
|
function automationNeedsAttention(job: SessionAutomationJob): boolean {
|
||||||
return job.state.last_status === "error";
|
return job.state.last_status === "error";
|
||||||
@@ -989,7 +969,6 @@ function automationNeedsAttention(job: SessionAutomationJob): boolean {
|
|||||||
function automationStatusKey(
|
function automationStatusKey(
|
||||||
job: SessionAutomationJob,
|
job: SessionAutomationJob,
|
||||||
): "active" | "running" | "paused" | "failed" | "system" | "completed" | "idle" {
|
): "active" | "running" | "paused" | "failed" | "system" | "completed" | "idle" {
|
||||||
if (job.protected) return "system";
|
|
||||||
if (job.state.pending) return "running";
|
if (job.state.pending) return "running";
|
||||||
if (!job.enabled) return "paused";
|
if (!job.enabled) return "paused";
|
||||||
if (job.state.last_status === "error") return "failed";
|
if (job.state.last_status === "error") return "failed";
|
||||||
@@ -1054,7 +1033,7 @@ function automationEditDraftError(
|
|||||||
return tx("settings.automations.validation.cronRequired", "Enter a Cron expression.");
|
return tx("settings.automations.validation.cronRequired", "Enter a Cron expression.");
|
||||||
}
|
}
|
||||||
if (draft.scheduleKind === "at") {
|
if (draft.scheduleKind === "at") {
|
||||||
const atMs = new Date(draft.atLocal).getTime();
|
const atMs = parseAutomationRunAt(draft.atLocal)?.getTime() ?? NaN;
|
||||||
if (!Number.isFinite(atMs)) {
|
if (!Number.isFinite(atMs)) {
|
||||||
return tx("settings.automations.validation.timeRequired", "Choose a run time.");
|
return tx("settings.automations.validation.timeRequired", "Choose a run time.");
|
||||||
}
|
}
|
||||||
@@ -1096,7 +1075,7 @@ function automationSchedulePayloadFromDraft(draft: AutomationEditDraft): Automat
|
|||||||
if (!expr) return "invalid";
|
if (!expr) return "invalid";
|
||||||
return { kind: "cron", expr, ...(draft.tz.trim() ? { tz: draft.tz.trim() } : {}) };
|
return { kind: "cron", expr, ...(draft.tz.trim() ? { tz: draft.tz.trim() } : {}) };
|
||||||
} else {
|
} else {
|
||||||
const atMs = new Date(draft.atLocal).getTime();
|
const atMs = parseAutomationRunAt(draft.atLocal)?.getTime() ?? NaN;
|
||||||
if (!Number.isFinite(atMs)) return "invalid";
|
if (!Number.isFinite(atMs)) return "invalid";
|
||||||
return { kind: "at", at_ms: atMs };
|
return { kind: "at", at_ms: atMs };
|
||||||
}
|
}
|
||||||
@@ -1116,11 +1095,6 @@ function automationScheduleChanged(
|
|||||||
return draft.atLocal !== formatLocalDateTimeInput(job.schedule.at_ms ?? NaN);
|
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 {
|
function automationMatchesFilter(job: SessionAutomationJob, filter: AutomationFilter): boolean {
|
||||||
const status = automationStatusKey(job);
|
const status = automationStatusKey(job);
|
||||||
if (filter === "active") return status === "active" || status === "running";
|
if (filter === "active") return status === "active" || status === "running";
|
||||||
@@ -1130,22 +1104,12 @@ function automationMatchesFilter(job: SessionAutomationJob, filter: AutomationFi
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const HOST_AUTOMATION_CHANNEL_LABELS: Record<string, string> = {
|
||||||
|
api: "API",
|
||||||
|
cli: "CLI",
|
||||||
|
};
|
||||||
|
|
||||||
function automationOriginLabel(
|
function automationChannelLabel(channel: string, t: TFunction): string {
|
||||||
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 {
|
|
||||||
const key = channel.trim().toLowerCase();
|
const key = channel.trim().toLowerCase();
|
||||||
const presentation = channelUiPresentation(key);
|
const presentation = channelUiPresentation(key);
|
||||||
if (presentation) {
|
if (presentation) {
|
||||||
@@ -1173,20 +1137,19 @@ function formatAutomationSchedule(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (job.schedule.kind === "cron" && job.schedule.expr) {
|
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;
|
if (summary) return summary;
|
||||||
return tx("settings.automations.schedule.cron", "Cron {{expr}}", {
|
return tx("settings.automations.schedule.custom", "Custom schedule");
|
||||||
expr: job.schedule.expr,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
if (isLocalTriggerAutomation(job)) {
|
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");
|
return tx("settings.automations.schedule.custom", "Custom schedule");
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatCronScheduleSummary(
|
function formatCronScheduleSummary(
|
||||||
expr: string,
|
expr: string,
|
||||||
|
locale: string,
|
||||||
tx: (key: string, fallback: string, values?: Record<string, unknown>) => string,
|
tx: (key: string, fallback: string, values?: Record<string, unknown>) => string,
|
||||||
): string | null {
|
): string | null {
|
||||||
const parts = expr.trim().split(/\s+/);
|
const parts = expr.trim().split(/\s+/);
|
||||||
@@ -1201,6 +1164,17 @@ function formatCronScheduleSummary(
|
|||||||
const time = `${String(numericHour).padStart(2, "0")}:${String(numericMinute).padStart(2, "0")}`;
|
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 (everyDay) return tx("settings.automations.schedule.dailyAt", "Daily at {{time}}", { time });
|
||||||
if (workdays) return tx("settings.automations.schedule.weekdaysAt", "Weekdays 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 === "*") {
|
if (everyDay && numericMinute !== null && hour === "*") {
|
||||||
@@ -1234,7 +1208,7 @@ function formatAutomationNext(
|
|||||||
job: SessionAutomationJob,
|
job: SessionAutomationJob,
|
||||||
tx: (key: string, fallback: string, values?: Record<string, unknown>) => string,
|
tx: (key: string, fallback: string, values?: Record<string, unknown>) => string,
|
||||||
): 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 (job.state.pending) return tx("settings.automations.next.pending", "Running now");
|
||||||
if (isLocalTriggerAutomation(job)) {
|
if (isLocalTriggerAutomation(job)) {
|
||||||
return tx("settings.automations.next.local", "Waiting for trigger");
|
return tx("settings.automations.next.local", "Waiting for trigger");
|
||||||
|
|||||||
@@ -2200,6 +2200,27 @@ export function ThreadComposer({
|
|||||||
&& value.length === 0 && images.length === 0 && !inlineError
|
&& value.length === 0 && images.length === 0 && !inlineError
|
||||||
&& !normalizedQuotedContext && !queuedPrompts.length && !goalState?.active
|
&& !normalizedQuotedContext && !queuedPrompts.length && !goalState?.active
|
||||||
&& !isDragging && !sessionDragPreview && !voiceRecorder.isRecording && !showProjectPicker;
|
&& !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(
|
const inputTextClasses = cn(
|
||||||
"w-full resize-none bg-transparent",
|
"w-full resize-none bg-transparent",
|
||||||
isHero
|
isHero
|
||||||
@@ -2282,8 +2303,8 @@ export function ThreadComposer({
|
|||||||
className={cn(
|
className={cn(
|
||||||
"thread-composer-surface group/composer relative mx-auto flex w-full flex-col overflow-visible transition-all duration-200",
|
"thread-composer-surface group/composer relative mx-auto flex w-full flex-col overflow-visible transition-all duration-200",
|
||||||
isHero
|
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-[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/30 focus-within:bg-muted/50 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",
|
compactWhenIdle && "thread-composer-collapsible transition-colors motion-reduce:transition-none",
|
||||||
interactionDisabled && "opacity-60",
|
interactionDisabled && "opacity-60",
|
||||||
sessionDragPreview && "ring-1 ring-primary/25",
|
sessionDragPreview && "ring-1 ring-primary/25",
|
||||||
|
|||||||
+76
-63
@@ -61,6 +61,7 @@
|
|||||||
--sidebar-border: 40 8% 90.5%;
|
--sidebar-border: 40 8% 90.5%;
|
||||||
--settings-canvas: var(--background);
|
--settings-canvas: var(--background);
|
||||||
--settings-surface: 60 6% 96.7%;
|
--settings-surface: 60 6% 96.7%;
|
||||||
|
--automation-view-track: hsl(0 0% 91%);
|
||||||
--scrollbar-thumb: hsl(var(--muted-foreground) / 0.26);
|
--scrollbar-thumb: hsl(var(--muted-foreground) / 0.26);
|
||||||
--scrollbar-thumb-hover: hsl(var(--muted-foreground) / 0.42);
|
--scrollbar-thumb-hover: hsl(var(--muted-foreground) / 0.42);
|
||||||
}
|
}
|
||||||
@@ -103,6 +104,7 @@
|
|||||||
--sidebar-border: var(--border);
|
--sidebar-border: var(--border);
|
||||||
--settings-canvas: var(--background);
|
--settings-canvas: var(--background);
|
||||||
--settings-surface: var(--card);
|
--settings-surface: var(--card);
|
||||||
|
--automation-view-track: hsl(var(--muted) / 0.65);
|
||||||
--scrollbar-thumb: hsl(var(--muted-foreground) / 0.28);
|
--scrollbar-thumb: hsl(var(--muted-foreground) / 0.28);
|
||||||
--scrollbar-thumb-hover: hsl(var(--muted-foreground) / 0.44);
|
--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. */
|
/* Stack a task's status below its title when the content column is narrow. */
|
||||||
.automations-page {
|
.automations-page {
|
||||||
|
--settings-inset: 1rem;
|
||||||
container: automations / inline-size;
|
container: automations / inline-size;
|
||||||
}
|
}
|
||||||
.automation-create-composer .thread-composer-surface {
|
.automation-create-composer .thread-composer-surface {
|
||||||
max-inline-size: none;
|
max-inline-size: none;
|
||||||
}
|
}
|
||||||
.automation-calendar-toolbar {
|
.automation-create-composer .thread-composer-input textarea {
|
||||||
display: grid;
|
padding-inline: var(--settings-inset);
|
||||||
grid-template-columns: minmax(0, 1fr) auto;
|
}
|
||||||
|
.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;
|
align-items: center;
|
||||||
gap: 0.75rem 1rem;
|
gap: 0.5rem 1rem;
|
||||||
min-block-size: 4rem;
|
min-block-size: 4rem;
|
||||||
padding: 1rem;
|
padding: 0.75rem 0.25rem;
|
||||||
}
|
}
|
||||||
.automation-calendar-navigation {
|
.automation-create-composer .thread-composer-collapsible-layout {
|
||||||
grid-column: 2;
|
padding-block-start: 0;
|
||||||
grid-row: 1;
|
|
||||||
justify-self: end;
|
|
||||||
}
|
}
|
||||||
.automation-calendar-filters {
|
/* Match the main sidebar's lg visibility; its collapsed rail has no labels. */
|
||||||
grid-column: 1 / -1;
|
@media (min-width: 1024px) {
|
||||||
grid-row: 2;
|
.settings-feature-page[data-main-navigation-expanded="true"] .settings-feature-header {
|
||||||
}
|
margin-block-end: 0;
|
||||||
@container automations (max-width: 20rem) {
|
}
|
||||||
.automation-calendar-filters .segmented-control {
|
.settings-feature-page[data-main-navigation-expanded="true"] .settings-feature-header h1 {
|
||||||
display: grid;
|
@apply sr-only;
|
||||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
||||||
inline-size: 100%;
|
|
||||||
border-radius: 1rem;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@container automations (min-width: 48rem) {
|
.automation-run-at-picker {
|
||||||
.automation-calendar-toolbar {
|
container: automation-run-at / inline-size;
|
||||||
grid-template-columns: minmax(0, 1fr) auto auto;
|
}
|
||||||
padding-inline: 1.5rem;
|
@container automation-run-at (min-width: 18rem) {
|
||||||
}
|
.automation-run-at-fields { grid-template-columns: minmax(0, 1fr) 7rem; }
|
||||||
.automation-calendar-filters {
|
}
|
||||||
grid-column: 2;
|
.automation-panel-filters {
|
||||||
grid-row: 1;
|
margin-inline-start: auto;
|
||||||
}
|
|
||||||
.automation-calendar-navigation { grid-column: 3; }
|
|
||||||
}
|
}
|
||||||
.thread-composer-collapsible-layout {
|
.thread-composer-collapsible-layout {
|
||||||
container: composer-layout / inline-size;
|
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) {
|
@container composer-layout (min-width: 40rem) {
|
||||||
.thread-composer-collapsible[data-compact] {
|
.thread-composer-collapsible .thread-composer-input {
|
||||||
display: grid;
|
inline-size: 100%;
|
||||||
grid-template-columns: minmax(0, 1fr) auto;
|
}
|
||||||
align-items: center;
|
.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 {
|
.thread-composer-collapsible[data-compact] .thread-composer-input textarea {
|
||||||
display: block;
|
display: block;
|
||||||
block-size: 3.5rem !important;
|
block-size: 3.5rem !important;
|
||||||
min-block-size: 3.5rem;
|
min-block-size: 3.5rem;
|
||||||
padding-block: 1.125rem;
|
padding-block: 1.125rem;
|
||||||
overflow: hidden;
|
}
|
||||||
white-space: nowrap;
|
.thread-composer-collapsible .thread-composer-footer {
|
||||||
text-overflow: ellipsis;
|
min-block-size: 3.5rem;
|
||||||
|
margin-block-start: 0;
|
||||||
|
padding: 0.5rem;
|
||||||
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
.thread-composer-collapsible[data-compact] .thread-composer-footer {
|
.thread-composer-collapsible[data-compact] .thread-composer-footer {
|
||||||
padding: 0.5rem;
|
margin-block-start: -3.5rem;
|
||||||
transition: none;
|
}
|
||||||
|
.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 {
|
.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;
|
max-inline-size: none;
|
||||||
|
margin-inline-start: 0;
|
||||||
|
pointer-events: auto;
|
||||||
}
|
}
|
||||||
}
|
@media (prefers-reduced-motion: no-preference) {
|
||||||
.automation-meta-row {
|
.thread-composer-collapsible .thread-composer-input {
|
||||||
display: grid;
|
transition: inline-size 220ms ease-out;
|
||||||
grid-template-columns: 1rem minmax(0, 1fr) auto;
|
}
|
||||||
column-gap: 0.5rem;
|
.thread-composer-collapsible .thread-composer-footer {
|
||||||
padding-inline: 1rem;
|
transition: margin-block-start 220ms ease-out;
|
||||||
}
|
}
|
||||||
@media (min-width: 640px) {
|
.thread-composer-collapsible .thread-composer-footer-primary {
|
||||||
.automation-meta-row {
|
transition: flex-grow 220ms ease-out;
|
||||||
padding-inline: 1.5rem;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.automation-calendar-grid { display: none; }
|
.automation-calendar-grid { display: none; }
|
||||||
@@ -1136,19 +1162,6 @@
|
|||||||
.automation-calendar-day:nth-child(7n) { border-inline-end: 0; }
|
.automation-calendar-day:nth-child(7n) { border-inline-end: 0; }
|
||||||
.automation-calendar-day:nth-last-child(-n + 7) { border-block-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]) {
|
.settings-stack > :not([hidden]) ~ :not([hidden]) {
|
||||||
margin-block-start: var(--settings-module-gap, 20px);
|
margin-block-start: var(--settings-module-gap, 20px);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1089,7 +1089,7 @@
|
|||||||
},
|
},
|
||||||
"automations": {
|
"automations": {
|
||||||
"create": "Create automation",
|
"create": "Create automation",
|
||||||
"createPrompt": "What would you like nanobot to schedule?",
|
"createPrompt": "What would you like nanobot to automate?",
|
||||||
"createInput": "Describe an automation",
|
"createInput": "Describe an automation",
|
||||||
"createRequest": "Create an automation for this request:\n\n{{request}}",
|
"createRequest": "Create an automation for this request:\n\n{{request}}",
|
||||||
"errors": {
|
"errors": {
|
||||||
@@ -1107,6 +1107,14 @@
|
|||||||
},
|
},
|
||||||
"yourTasks": "Your automations",
|
"yourTasks": "Your automations",
|
||||||
"systemTasks": "System tasks",
|
"systemTasks": "System tasks",
|
||||||
|
"views": {
|
||||||
|
"label": "Automation view",
|
||||||
|
"tasks": "Tasks",
|
||||||
|
"calendar": "Calendar"
|
||||||
|
},
|
||||||
|
"filter": "Filter",
|
||||||
|
"filteredBy": "Filter: {{status}}",
|
||||||
|
"commandCondition": "Triggered by command",
|
||||||
"instructions": "Instructions",
|
"instructions": "Instructions",
|
||||||
"done": "Done",
|
"done": "Done",
|
||||||
"moreDetails": "More details",
|
"moreDetails": "More details",
|
||||||
@@ -1117,7 +1125,7 @@
|
|||||||
"filters": {
|
"filters": {
|
||||||
"all": "All",
|
"all": "All",
|
||||||
"active": "Active",
|
"active": "Active",
|
||||||
"paused": "Paused",
|
"paused": "Disabled",
|
||||||
"failed": "Needs attention",
|
"failed": "Needs attention",
|
||||||
"system": "System"
|
"system": "System"
|
||||||
},
|
},
|
||||||
@@ -1145,8 +1153,8 @@
|
|||||||
"updated": "Updated"
|
"updated": "Updated"
|
||||||
},
|
},
|
||||||
"runNow": "Run now",
|
"runNow": "Run now",
|
||||||
"pause": "Pause",
|
"pause": "Disable",
|
||||||
"resume": "Resume",
|
"resume": "Enable",
|
||||||
"edit": "Edit",
|
"edit": "Edit",
|
||||||
"delete": "Delete",
|
"delete": "Delete",
|
||||||
"protected": "Protected",
|
"protected": "Protected",
|
||||||
@@ -1160,7 +1168,7 @@
|
|||||||
"status": {
|
"status": {
|
||||||
"system": "System",
|
"system": "System",
|
||||||
"running": "Running now",
|
"running": "Running now",
|
||||||
"paused": "Paused",
|
"paused": "Disabled",
|
||||||
"failed": "Failed",
|
"failed": "Failed",
|
||||||
"completed": "Completed",
|
"completed": "Completed",
|
||||||
"noSchedule": "No schedule",
|
"noSchedule": "No schedule",
|
||||||
@@ -1175,12 +1183,14 @@
|
|||||||
"cli": "CLI"
|
"cli": "CLI"
|
||||||
},
|
},
|
||||||
"schedule": {
|
"schedule": {
|
||||||
|
"weeklyAt": "Every {{day}} at {{time}}",
|
||||||
"at": "At {{time}}",
|
"at": "At {{time}}",
|
||||||
"every": "Every {{duration}}",
|
"every": "Every {{duration}}",
|
||||||
"cron": "Cron {{expr}}",
|
"cron": "Cron {{expr}}",
|
||||||
"cronWithTz": "Cron {{expr}} ({{tz}})",
|
"cronWithTz": "Cron {{expr}} ({{tz}})",
|
||||||
"withTz": "{{summary}} ({{tz}})",
|
"withTz": "{{summary}} ({{tz}})",
|
||||||
"dailyAt": "Daily at {{time}}",
|
"dailyAt": "Daily at {{time}}",
|
||||||
|
"monthlyAt": "Monthly on day {{day}} at {{time}}",
|
||||||
"weekdaysAt": "Weekdays at {{time}}",
|
"weekdaysAt": "Weekdays at {{time}}",
|
||||||
"hourlyAt": "Hourly at :{{minute}}",
|
"hourlyAt": "Hourly at :{{minute}}",
|
||||||
"hourlyWindow": "Hourly {{start}}-{{end}} at :{{minute}}",
|
"hourlyWindow": "Hourly {{start}}-{{end}} at :{{minute}}",
|
||||||
@@ -1188,7 +1198,7 @@
|
|||||||
"custom": "Custom schedule"
|
"custom": "Custom schedule"
|
||||||
},
|
},
|
||||||
"next": {
|
"next": {
|
||||||
"paused": "Paused",
|
"paused": "Disabled",
|
||||||
"pending": "Running now",
|
"pending": "Running now",
|
||||||
"local": "Waiting for trigger",
|
"local": "Waiting for trigger",
|
||||||
"none": "No next run"
|
"none": "No next run"
|
||||||
@@ -1206,7 +1216,10 @@
|
|||||||
"unit": "Unit",
|
"unit": "Unit",
|
||||||
"cronExpression": "Cron expression",
|
"cronExpression": "Cron expression",
|
||||||
"timezone": "Timezone",
|
"timezone": "Timezone",
|
||||||
"runAt": "Run at"
|
"runAt": "Run at",
|
||||||
|
"runDate": "Run date",
|
||||||
|
"runTime": "Run time",
|
||||||
|
"chooseDate": "Choose date"
|
||||||
},
|
},
|
||||||
"scheduleTypes": {
|
"scheduleTypes": {
|
||||||
"every": "Interval",
|
"every": "Interval",
|
||||||
|
|||||||
@@ -890,7 +890,7 @@
|
|||||||
},
|
},
|
||||||
"automations": {
|
"automations": {
|
||||||
"create": "Crear automatización",
|
"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",
|
"createInput": "Describe una automatización",
|
||||||
"createRequest": "Crea una automatización para esta solicitud:\n\n{{request}}",
|
"createRequest": "Crea una automatización para esta solicitud:\n\n{{request}}",
|
||||||
"errors": {
|
"errors": {
|
||||||
@@ -908,6 +908,14 @@
|
|||||||
},
|
},
|
||||||
"yourTasks": "Tus automatizaciones",
|
"yourTasks": "Tus automatizaciones",
|
||||||
"systemTasks": "Tareas del sistema",
|
"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",
|
"instructions": "Instrucciones",
|
||||||
"done": "Listo",
|
"done": "Listo",
|
||||||
"moreDetails": "Más detalles",
|
"moreDetails": "Más detalles",
|
||||||
@@ -918,7 +926,7 @@
|
|||||||
"filters": {
|
"filters": {
|
||||||
"all": "Todas",
|
"all": "Todas",
|
||||||
"active": "Activas",
|
"active": "Activas",
|
||||||
"paused": "Pausadas",
|
"paused": "Desactivadas",
|
||||||
"failed": "Requieren atención",
|
"failed": "Requieren atención",
|
||||||
"system": "Sistema"
|
"system": "Sistema"
|
||||||
},
|
},
|
||||||
@@ -946,8 +954,8 @@
|
|||||||
"updated": "Actualizada"
|
"updated": "Actualizada"
|
||||||
},
|
},
|
||||||
"runNow": "Ejecutar ahora",
|
"runNow": "Ejecutar ahora",
|
||||||
"pause": "Pausar",
|
"pause": "Desactivar",
|
||||||
"resume": "Reanudar",
|
"resume": "Activar",
|
||||||
"edit": "Editar",
|
"edit": "Editar",
|
||||||
"delete": "Eliminar",
|
"delete": "Eliminar",
|
||||||
"protected": "Protegida",
|
"protected": "Protegida",
|
||||||
@@ -961,7 +969,7 @@
|
|||||||
"status": {
|
"status": {
|
||||||
"system": "Sistema",
|
"system": "Sistema",
|
||||||
"running": "Ejecutándose ahora",
|
"running": "Ejecutándose ahora",
|
||||||
"paused": "Pausada",
|
"paused": "Desactivada",
|
||||||
"failed": "Fallida",
|
"failed": "Fallida",
|
||||||
"completed": "Completada",
|
"completed": "Completada",
|
||||||
"noSchedule": "Sin programación",
|
"noSchedule": "Sin programación",
|
||||||
@@ -976,12 +984,14 @@
|
|||||||
"cli": "CLI"
|
"cli": "CLI"
|
||||||
},
|
},
|
||||||
"schedule": {
|
"schedule": {
|
||||||
|
"weeklyAt": "Cada {{day}} a las {{time}}",
|
||||||
"at": "A las {{time}}",
|
"at": "A las {{time}}",
|
||||||
"every": "Cada {{duration}}",
|
"every": "Cada {{duration}}",
|
||||||
"cron": "Cron {{expr}}",
|
"cron": "Cron {{expr}}",
|
||||||
"cronWithTz": "Cron {{expr}} ({{tz}})",
|
"cronWithTz": "Cron {{expr}} ({{tz}})",
|
||||||
"withTz": "{{summary}} ({{tz}})",
|
"withTz": "{{summary}} ({{tz}})",
|
||||||
"dailyAt": "Todos los días a las {{time}}",
|
"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}}",
|
"weekdaysAt": "De lunes a viernes a las {{time}}",
|
||||||
"hourlyAt": "Cada hora, en el minuto {{minute}}",
|
"hourlyAt": "Cada hora, en el minuto {{minute}}",
|
||||||
"hourlyWindow": "Cada hora de {{start}} a {{end}}, en el minuto {{minute}}",
|
"hourlyWindow": "Cada hora de {{start}} a {{end}}, en el minuto {{minute}}",
|
||||||
@@ -989,7 +999,7 @@
|
|||||||
"custom": "Programación personalizada"
|
"custom": "Programación personalizada"
|
||||||
},
|
},
|
||||||
"next": {
|
"next": {
|
||||||
"paused": "Pausada",
|
"paused": "Desactivada",
|
||||||
"pending": "Ejecutándose ahora",
|
"pending": "Ejecutándose ahora",
|
||||||
"local": "Esperando activador",
|
"local": "Esperando activador",
|
||||||
"none": "Sin próxima ejecución"
|
"none": "Sin próxima ejecución"
|
||||||
@@ -1007,7 +1017,10 @@
|
|||||||
"unit": "Unidad",
|
"unit": "Unidad",
|
||||||
"cronExpression": "Expresión cron",
|
"cronExpression": "Expresión cron",
|
||||||
"timezone": "Zona horaria",
|
"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": {
|
"scheduleTypes": {
|
||||||
"every": "Intervalo",
|
"every": "Intervalo",
|
||||||
|
|||||||
@@ -889,7 +889,7 @@
|
|||||||
},
|
},
|
||||||
"automations": {
|
"automations": {
|
||||||
"create": "Créer une automatisation",
|
"create": "Créer une automatisation",
|
||||||
"createPrompt": "Que voulez-vous planifier avec nanobot ?",
|
"createPrompt": "Que voulez-vous automatiser avec nanobot ?",
|
||||||
"createInput": "Décrire une automatisation",
|
"createInput": "Décrire une automatisation",
|
||||||
"createRequest": "Crée une automatisation pour cette demande :\n\n{{request}}",
|
"createRequest": "Crée une automatisation pour cette demande :\n\n{{request}}",
|
||||||
"errors": {
|
"errors": {
|
||||||
@@ -907,6 +907,14 @@
|
|||||||
},
|
},
|
||||||
"yourTasks": "Vos automatisations",
|
"yourTasks": "Vos automatisations",
|
||||||
"systemTasks": "Tâches système",
|
"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",
|
"instructions": "Instructions",
|
||||||
"done": "Terminé",
|
"done": "Terminé",
|
||||||
"moreDetails": "Plus de détails",
|
"moreDetails": "Plus de détails",
|
||||||
@@ -917,7 +925,7 @@
|
|||||||
"filters": {
|
"filters": {
|
||||||
"all": "Toutes",
|
"all": "Toutes",
|
||||||
"active": "Actives",
|
"active": "Actives",
|
||||||
"paused": "En pause",
|
"paused": "Désactivée",
|
||||||
"failed": "À traiter",
|
"failed": "À traiter",
|
||||||
"system": "Système"
|
"system": "Système"
|
||||||
},
|
},
|
||||||
@@ -945,8 +953,8 @@
|
|||||||
"updated": "Modifiée"
|
"updated": "Modifiée"
|
||||||
},
|
},
|
||||||
"runNow": "Exécuter maintenant",
|
"runNow": "Exécuter maintenant",
|
||||||
"pause": "Mettre en pause",
|
"pause": "Désactiver",
|
||||||
"resume": "Reprendre",
|
"resume": "Activer",
|
||||||
"edit": "Modifier",
|
"edit": "Modifier",
|
||||||
"delete": "Supprimer",
|
"delete": "Supprimer",
|
||||||
"protected": "Protégée",
|
"protected": "Protégée",
|
||||||
@@ -960,7 +968,7 @@
|
|||||||
"status": {
|
"status": {
|
||||||
"system": "Système",
|
"system": "Système",
|
||||||
"running": "En cours d’exécution",
|
"running": "En cours d’exécution",
|
||||||
"paused": "En pause",
|
"paused": "Désactivée",
|
||||||
"failed": "Échouée",
|
"failed": "Échouée",
|
||||||
"completed": "Terminée",
|
"completed": "Terminée",
|
||||||
"noSchedule": "Aucun planning",
|
"noSchedule": "Aucun planning",
|
||||||
@@ -975,12 +983,14 @@
|
|||||||
"cli": "CLI"
|
"cli": "CLI"
|
||||||
},
|
},
|
||||||
"schedule": {
|
"schedule": {
|
||||||
|
"weeklyAt": "Chaque {{day}} à {{time}}",
|
||||||
"at": "À {{time}}",
|
"at": "À {{time}}",
|
||||||
"every": "Toutes les {{duration}}",
|
"every": "Toutes les {{duration}}",
|
||||||
"cron": "Cron {{expr}}",
|
"cron": "Cron {{expr}}",
|
||||||
"cronWithTz": "Cron {{expr}} ({{tz}})",
|
"cronWithTz": "Cron {{expr}} ({{tz}})",
|
||||||
"withTz": "{{summary}} ({{tz}})",
|
"withTz": "{{summary}} ({{tz}})",
|
||||||
"dailyAt": "Chaque jour à {{time}}",
|
"dailyAt": "Chaque jour à {{time}}",
|
||||||
|
"monthlyAt": "Le {{day}} de chaque mois à {{time}}",
|
||||||
"weekdaysAt": "Du lundi au vendredi à {{time}}",
|
"weekdaysAt": "Du lundi au vendredi à {{time}}",
|
||||||
"hourlyAt": "Toutes les heures à :{{minute}}",
|
"hourlyAt": "Toutes les heures à :{{minute}}",
|
||||||
"hourlyWindow": "Toutes les heures {{start}}-{{end}} à :{{minute}}",
|
"hourlyWindow": "Toutes les heures {{start}}-{{end}} à :{{minute}}",
|
||||||
@@ -988,7 +998,7 @@
|
|||||||
"custom": "Planning personnalisé"
|
"custom": "Planning personnalisé"
|
||||||
},
|
},
|
||||||
"next": {
|
"next": {
|
||||||
"paused": "En pause",
|
"paused": "Désactivée",
|
||||||
"pending": "En cours d’exécution",
|
"pending": "En cours d’exécution",
|
||||||
"local": "En attente du déclencheur",
|
"local": "En attente du déclencheur",
|
||||||
"none": "Aucune prochaine exécution"
|
"none": "Aucune prochaine exécution"
|
||||||
@@ -1006,7 +1016,10 @@
|
|||||||
"unit": "Unité",
|
"unit": "Unité",
|
||||||
"cronExpression": "Expression cron",
|
"cronExpression": "Expression cron",
|
||||||
"timezone": "Fuseau horaire",
|
"timezone": "Fuseau horaire",
|
||||||
"runAt": "Exécuter à"
|
"runAt": "Exécuter à",
|
||||||
|
"runDate": "Date d’exécution",
|
||||||
|
"runTime": "Heure d’exécution",
|
||||||
|
"chooseDate": "Choisir une date"
|
||||||
},
|
},
|
||||||
"scheduleTypes": {
|
"scheduleTypes": {
|
||||||
"every": "Intervalle",
|
"every": "Intervalle",
|
||||||
|
|||||||
@@ -889,7 +889,7 @@
|
|||||||
},
|
},
|
||||||
"automations": {
|
"automations": {
|
||||||
"create": "Buat otomatisasi",
|
"create": "Buat otomatisasi",
|
||||||
"createPrompt": "Apa yang ingin kamu jadwalkan dengan nanobot?",
|
"createPrompt": "Apa yang ingin kamu otomatisasi dengan nanobot?",
|
||||||
"createInput": "Jelaskan otomatisasi",
|
"createInput": "Jelaskan otomatisasi",
|
||||||
"createRequest": "Buat otomatisasi untuk permintaan ini:\n\n{{request}}",
|
"createRequest": "Buat otomatisasi untuk permintaan ini:\n\n{{request}}",
|
||||||
"errors": {
|
"errors": {
|
||||||
@@ -907,6 +907,14 @@
|
|||||||
},
|
},
|
||||||
"yourTasks": "Otomatisasi Anda",
|
"yourTasks": "Otomatisasi Anda",
|
||||||
"systemTasks": "Tugas sistem",
|
"systemTasks": "Tugas sistem",
|
||||||
|
"views": {
|
||||||
|
"label": "Tampilan otomatisasi",
|
||||||
|
"tasks": "Tugas",
|
||||||
|
"calendar": "Kalender"
|
||||||
|
},
|
||||||
|
"filter": "Filter",
|
||||||
|
"filteredBy": "Filter: {{status}}",
|
||||||
|
"commandCondition": "Dipicu oleh perintah",
|
||||||
"instructions": "Instruksi",
|
"instructions": "Instruksi",
|
||||||
"done": "Selesai",
|
"done": "Selesai",
|
||||||
"moreDetails": "Detail lainnya",
|
"moreDetails": "Detail lainnya",
|
||||||
@@ -917,7 +925,7 @@
|
|||||||
"filters": {
|
"filters": {
|
||||||
"all": "Semua",
|
"all": "Semua",
|
||||||
"active": "Aktif",
|
"active": "Aktif",
|
||||||
"paused": "Dijeda",
|
"paused": "Dinonaktifkan",
|
||||||
"failed": "Perlu ditangani",
|
"failed": "Perlu ditangani",
|
||||||
"system": "Sistem"
|
"system": "Sistem"
|
||||||
},
|
},
|
||||||
@@ -945,8 +953,8 @@
|
|||||||
"updated": "Diperbarui"
|
"updated": "Diperbarui"
|
||||||
},
|
},
|
||||||
"runNow": "Jalankan sekarang",
|
"runNow": "Jalankan sekarang",
|
||||||
"pause": "Jeda",
|
"pause": "Nonaktifkan",
|
||||||
"resume": "Lanjutkan",
|
"resume": "Aktifkan",
|
||||||
"edit": "Ubah",
|
"edit": "Ubah",
|
||||||
"delete": "Hapus",
|
"delete": "Hapus",
|
||||||
"protected": "Terlindungi",
|
"protected": "Terlindungi",
|
||||||
@@ -960,7 +968,7 @@
|
|||||||
"status": {
|
"status": {
|
||||||
"system": "Sistem",
|
"system": "Sistem",
|
||||||
"running": "Sedang berjalan",
|
"running": "Sedang berjalan",
|
||||||
"paused": "Dijeda",
|
"paused": "Dinonaktifkan",
|
||||||
"failed": "Gagal",
|
"failed": "Gagal",
|
||||||
"completed": "Selesai",
|
"completed": "Selesai",
|
||||||
"noSchedule": "Tanpa jadwal",
|
"noSchedule": "Tanpa jadwal",
|
||||||
@@ -975,12 +983,14 @@
|
|||||||
"cli": "CLI"
|
"cli": "CLI"
|
||||||
},
|
},
|
||||||
"schedule": {
|
"schedule": {
|
||||||
|
"weeklyAt": "Setiap {{day}} pukul {{time}}",
|
||||||
"at": "Pada {{time}}",
|
"at": "Pada {{time}}",
|
||||||
"every": "Setiap {{duration}}",
|
"every": "Setiap {{duration}}",
|
||||||
"cron": "Cron {{expr}}",
|
"cron": "Cron {{expr}}",
|
||||||
"cronWithTz": "Cron {{expr}} ({{tz}})",
|
"cronWithTz": "Cron {{expr}} ({{tz}})",
|
||||||
"withTz": "{{summary}} ({{tz}})",
|
"withTz": "{{summary}} ({{tz}})",
|
||||||
"dailyAt": "Setiap hari pukul {{time}}",
|
"dailyAt": "Setiap hari pukul {{time}}",
|
||||||
|
"monthlyAt": "Setiap tanggal {{day}} pukul {{time}}",
|
||||||
"weekdaysAt": "Senin–Jumat pukul {{time}}",
|
"weekdaysAt": "Senin–Jumat pukul {{time}}",
|
||||||
"hourlyAt": "Setiap jam pada menit {{minute}}",
|
"hourlyAt": "Setiap jam pada menit {{minute}}",
|
||||||
"hourlyWindow": "Setiap jam dari {{start}} hingga {{end}}, pada menit {{minute}}",
|
"hourlyWindow": "Setiap jam dari {{start}} hingga {{end}}, pada menit {{minute}}",
|
||||||
@@ -988,7 +998,7 @@
|
|||||||
"custom": "Jadwal khusus"
|
"custom": "Jadwal khusus"
|
||||||
},
|
},
|
||||||
"next": {
|
"next": {
|
||||||
"paused": "Dijeda",
|
"paused": "Dinonaktifkan",
|
||||||
"pending": "Sedang berjalan",
|
"pending": "Sedang berjalan",
|
||||||
"local": "Menunggu pemicu",
|
"local": "Menunggu pemicu",
|
||||||
"none": "Tidak ada jadwal berikutnya"
|
"none": "Tidak ada jadwal berikutnya"
|
||||||
@@ -1006,7 +1016,10 @@
|
|||||||
"unit": "Unit",
|
"unit": "Unit",
|
||||||
"cronExpression": "Ekspresi cron",
|
"cronExpression": "Ekspresi cron",
|
||||||
"timezone": "Zona waktu",
|
"timezone": "Zona waktu",
|
||||||
"runAt": "Jalankan pada"
|
"runAt": "Jalankan pada",
|
||||||
|
"runDate": "Tanggal eksekusi",
|
||||||
|
"runTime": "Waktu eksekusi",
|
||||||
|
"chooseDate": "Pilih tanggal"
|
||||||
},
|
},
|
||||||
"scheduleTypes": {
|
"scheduleTypes": {
|
||||||
"every": "Interval",
|
"every": "Interval",
|
||||||
|
|||||||
@@ -889,7 +889,7 @@
|
|||||||
},
|
},
|
||||||
"automations": {
|
"automations": {
|
||||||
"create": "自動タスクを作成",
|
"create": "自動タスクを作成",
|
||||||
"createPrompt": "nanobot にいつ、何をしてほしいですか?",
|
"createPrompt": "nanobot に何を自動化してほしいですか?",
|
||||||
"createInput": "自動タスクを説明",
|
"createInput": "自動タスクを説明",
|
||||||
"createRequest": "次の依頼に対する自動タスクを作成してください:\n\n{{request}}",
|
"createRequest": "次の依頼に対する自動タスクを作成してください:\n\n{{request}}",
|
||||||
"errors": {
|
"errors": {
|
||||||
@@ -907,6 +907,14 @@
|
|||||||
},
|
},
|
||||||
"yourTasks": "自分の自動化",
|
"yourTasks": "自分の自動化",
|
||||||
"systemTasks": "システムタスク",
|
"systemTasks": "システムタスク",
|
||||||
|
"views": {
|
||||||
|
"label": "自動化の表示",
|
||||||
|
"tasks": "タスク",
|
||||||
|
"calendar": "カレンダー"
|
||||||
|
},
|
||||||
|
"filter": "絞り込み",
|
||||||
|
"filteredBy": "絞り込み:{{status}}",
|
||||||
|
"commandCondition": "コマンドで実行",
|
||||||
"instructions": "指示",
|
"instructions": "指示",
|
||||||
"done": "完了",
|
"done": "完了",
|
||||||
"moreDetails": "詳細情報",
|
"moreDetails": "詳細情報",
|
||||||
@@ -917,7 +925,7 @@
|
|||||||
"filters": {
|
"filters": {
|
||||||
"all": "すべて",
|
"all": "すべて",
|
||||||
"active": "有効",
|
"active": "有効",
|
||||||
"paused": "一時停止",
|
"paused": "無効",
|
||||||
"failed": "要対応",
|
"failed": "要対応",
|
||||||
"system": "システム"
|
"system": "システム"
|
||||||
},
|
},
|
||||||
@@ -945,8 +953,8 @@
|
|||||||
"updated": "更新"
|
"updated": "更新"
|
||||||
},
|
},
|
||||||
"runNow": "今すぐ実行",
|
"runNow": "今すぐ実行",
|
||||||
"pause": "一時停止",
|
"pause": "無効にする",
|
||||||
"resume": "再開",
|
"resume": "有効にする",
|
||||||
"edit": "編集",
|
"edit": "編集",
|
||||||
"delete": "削除",
|
"delete": "削除",
|
||||||
"protected": "保護済み",
|
"protected": "保護済み",
|
||||||
@@ -960,7 +968,7 @@
|
|||||||
"status": {
|
"status": {
|
||||||
"system": "システム",
|
"system": "システム",
|
||||||
"running": "実行中",
|
"running": "実行中",
|
||||||
"paused": "一時停止",
|
"paused": "無効",
|
||||||
"failed": "失敗",
|
"failed": "失敗",
|
||||||
"completed": "完了",
|
"completed": "完了",
|
||||||
"noSchedule": "スケジュールなし",
|
"noSchedule": "スケジュールなし",
|
||||||
@@ -975,12 +983,14 @@
|
|||||||
"cli": "CLI"
|
"cli": "CLI"
|
||||||
},
|
},
|
||||||
"schedule": {
|
"schedule": {
|
||||||
|
"weeklyAt": "毎週{{day}} {{time}}",
|
||||||
"at": "{{time}}",
|
"at": "{{time}}",
|
||||||
"every": "{{duration}} ごと",
|
"every": "{{duration}} ごと",
|
||||||
"cron": "Cron {{expr}}",
|
"cron": "Cron {{expr}}",
|
||||||
"cronWithTz": "Cron {{expr}}({{tz}})",
|
"cronWithTz": "Cron {{expr}}({{tz}})",
|
||||||
"withTz": "{{summary}}({{tz}})",
|
"withTz": "{{summary}}({{tz}})",
|
||||||
"dailyAt": "毎日 {{time}}",
|
"dailyAt": "毎日 {{time}}",
|
||||||
|
"monthlyAt": "毎月{{day}}日 {{time}}",
|
||||||
"weekdaysAt": "月曜日〜金曜日 {{time}}",
|
"weekdaysAt": "月曜日〜金曜日 {{time}}",
|
||||||
"hourlyAt": "毎時 {{minute}} 分",
|
"hourlyAt": "毎時 {{minute}} 分",
|
||||||
"hourlyWindow": "{{start}}〜{{end}} の毎時 {{minute}} 分",
|
"hourlyWindow": "{{start}}〜{{end}} の毎時 {{minute}} 分",
|
||||||
@@ -988,7 +998,7 @@
|
|||||||
"custom": "カスタムスケジュール"
|
"custom": "カスタムスケジュール"
|
||||||
},
|
},
|
||||||
"next": {
|
"next": {
|
||||||
"paused": "一時停止",
|
"paused": "無効",
|
||||||
"pending": "実行中",
|
"pending": "実行中",
|
||||||
"local": "トリガー待ち",
|
"local": "トリガー待ち",
|
||||||
"none": "次回実行なし"
|
"none": "次回実行なし"
|
||||||
@@ -1006,7 +1016,10 @@
|
|||||||
"unit": "単位",
|
"unit": "単位",
|
||||||
"cronExpression": "Cron 式",
|
"cronExpression": "Cron 式",
|
||||||
"timezone": "タイムゾーン",
|
"timezone": "タイムゾーン",
|
||||||
"runAt": "実行日時"
|
"runAt": "実行日時",
|
||||||
|
"runDate": "実行日",
|
||||||
|
"runTime": "実行時刻",
|
||||||
|
"chooseDate": "日付を選択"
|
||||||
},
|
},
|
||||||
"scheduleTypes": {
|
"scheduleTypes": {
|
||||||
"every": "間隔",
|
"every": "間隔",
|
||||||
|
|||||||
@@ -889,7 +889,7 @@
|
|||||||
},
|
},
|
||||||
"automations": {
|
"automations": {
|
||||||
"create": "자동화 만들기",
|
"create": "자동화 만들기",
|
||||||
"createPrompt": "nanobot이 언제 무엇을 해주면 좋을까요?",
|
"createPrompt": "nanobot이 무엇을 자동으로 해주면 좋을까요?",
|
||||||
"createInput": "자동화 설명",
|
"createInput": "자동화 설명",
|
||||||
"createRequest": "다음 요청에 맞는 자동화를 만들어 주세요:\n\n{{request}}",
|
"createRequest": "다음 요청에 맞는 자동화를 만들어 주세요:\n\n{{request}}",
|
||||||
"errors": {
|
"errors": {
|
||||||
@@ -907,6 +907,14 @@
|
|||||||
},
|
},
|
||||||
"yourTasks": "내 자동화",
|
"yourTasks": "내 자동화",
|
||||||
"systemTasks": "시스템 작업",
|
"systemTasks": "시스템 작업",
|
||||||
|
"views": {
|
||||||
|
"label": "자동화 보기",
|
||||||
|
"tasks": "작업",
|
||||||
|
"calendar": "캘린더"
|
||||||
|
},
|
||||||
|
"filter": "필터",
|
||||||
|
"filteredBy": "필터: {{status}}",
|
||||||
|
"commandCondition": "명령으로 실행",
|
||||||
"instructions": "지침",
|
"instructions": "지침",
|
||||||
"done": "완료",
|
"done": "완료",
|
||||||
"moreDetails": "상세 정보",
|
"moreDetails": "상세 정보",
|
||||||
@@ -917,7 +925,7 @@
|
|||||||
"filters": {
|
"filters": {
|
||||||
"all": "전체",
|
"all": "전체",
|
||||||
"active": "활성",
|
"active": "활성",
|
||||||
"paused": "일시 중지",
|
"paused": "비활성화",
|
||||||
"failed": "확인 필요",
|
"failed": "확인 필요",
|
||||||
"system": "시스템"
|
"system": "시스템"
|
||||||
},
|
},
|
||||||
@@ -945,8 +953,8 @@
|
|||||||
"updated": "업데이트"
|
"updated": "업데이트"
|
||||||
},
|
},
|
||||||
"runNow": "지금 실행",
|
"runNow": "지금 실행",
|
||||||
"pause": "일시 중지",
|
"pause": "비활성화",
|
||||||
"resume": "재개",
|
"resume": "활성화",
|
||||||
"edit": "편집",
|
"edit": "편집",
|
||||||
"delete": "삭제",
|
"delete": "삭제",
|
||||||
"protected": "보호됨",
|
"protected": "보호됨",
|
||||||
@@ -960,7 +968,7 @@
|
|||||||
"status": {
|
"status": {
|
||||||
"system": "시스템",
|
"system": "시스템",
|
||||||
"running": "실행 중",
|
"running": "실행 중",
|
||||||
"paused": "일시 중지",
|
"paused": "비활성화",
|
||||||
"failed": "실패",
|
"failed": "실패",
|
||||||
"completed": "완료",
|
"completed": "완료",
|
||||||
"noSchedule": "일정 없음",
|
"noSchedule": "일정 없음",
|
||||||
@@ -975,12 +983,14 @@
|
|||||||
"cli": "CLI"
|
"cli": "CLI"
|
||||||
},
|
},
|
||||||
"schedule": {
|
"schedule": {
|
||||||
|
"weeklyAt": "매주 {{day}} {{time}}",
|
||||||
"at": "{{time}}",
|
"at": "{{time}}",
|
||||||
"every": "{{duration}}마다",
|
"every": "{{duration}}마다",
|
||||||
"cron": "Cron {{expr}}",
|
"cron": "Cron {{expr}}",
|
||||||
"cronWithTz": "Cron {{expr}} ({{tz}})",
|
"cronWithTz": "Cron {{expr}} ({{tz}})",
|
||||||
"withTz": "{{summary}} ({{tz}})",
|
"withTz": "{{summary}} ({{tz}})",
|
||||||
"dailyAt": "매일 {{time}}",
|
"dailyAt": "매일 {{time}}",
|
||||||
|
"monthlyAt": "매월 {{day}}일 {{time}}",
|
||||||
"weekdaysAt": "월요일~금요일 {{time}}",
|
"weekdaysAt": "월요일~금요일 {{time}}",
|
||||||
"hourlyAt": "매시 {{minute}}분",
|
"hourlyAt": "매시 {{minute}}분",
|
||||||
"hourlyWindow": "{{start}}~{{end}} 사이 매시 {{minute}}분",
|
"hourlyWindow": "{{start}}~{{end}} 사이 매시 {{minute}}분",
|
||||||
@@ -988,7 +998,7 @@
|
|||||||
"custom": "사용자 지정 일정"
|
"custom": "사용자 지정 일정"
|
||||||
},
|
},
|
||||||
"next": {
|
"next": {
|
||||||
"paused": "일시 중지",
|
"paused": "비활성화",
|
||||||
"pending": "실행 중",
|
"pending": "실행 중",
|
||||||
"local": "트리거 대기 중",
|
"local": "트리거 대기 중",
|
||||||
"none": "다음 실행 없음"
|
"none": "다음 실행 없음"
|
||||||
@@ -1006,7 +1016,10 @@
|
|||||||
"unit": "단위",
|
"unit": "단위",
|
||||||
"cronExpression": "Cron 식",
|
"cronExpression": "Cron 식",
|
||||||
"timezone": "시간대",
|
"timezone": "시간대",
|
||||||
"runAt": "실행 시간"
|
"runAt": "실행 시간",
|
||||||
|
"runDate": "실행 날짜",
|
||||||
|
"runTime": "실행 시각",
|
||||||
|
"chooseDate": "날짜 선택"
|
||||||
},
|
},
|
||||||
"scheduleTypes": {
|
"scheduleTypes": {
|
||||||
"every": "간격",
|
"every": "간격",
|
||||||
|
|||||||
@@ -903,7 +903,7 @@
|
|||||||
},
|
},
|
||||||
"automations": {
|
"automations": {
|
||||||
"create": "Criar automação",
|
"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",
|
"createInput": "Descreva uma automação",
|
||||||
"createRequest": "Crie uma automação para esta solicitação:\n\n{{request}}",
|
"createRequest": "Crie uma automação para esta solicitação:\n\n{{request}}",
|
||||||
"errors": {
|
"errors": {
|
||||||
@@ -921,6 +921,14 @@
|
|||||||
},
|
},
|
||||||
"yourTasks": "Suas automações",
|
"yourTasks": "Suas automações",
|
||||||
"systemTasks": "Tarefas do sistema",
|
"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",
|
"instructions": "Instruções",
|
||||||
"done": "Concluído",
|
"done": "Concluído",
|
||||||
"moreDetails": "Mais detalhes",
|
"moreDetails": "Mais detalhes",
|
||||||
@@ -931,7 +939,7 @@
|
|||||||
"filters": {
|
"filters": {
|
||||||
"all": "Todas",
|
"all": "Todas",
|
||||||
"active": "Ativas",
|
"active": "Ativas",
|
||||||
"paused": "Pausadas",
|
"paused": "Desativadas",
|
||||||
"failed": "Precisam de atenção",
|
"failed": "Precisam de atenção",
|
||||||
"system": "Sistema"
|
"system": "Sistema"
|
||||||
},
|
},
|
||||||
@@ -959,8 +967,8 @@
|
|||||||
"updated": "Atualizada"
|
"updated": "Atualizada"
|
||||||
},
|
},
|
||||||
"runNow": "Executar agora",
|
"runNow": "Executar agora",
|
||||||
"pause": "Pausar",
|
"pause": "Desativar",
|
||||||
"resume": "Retomar",
|
"resume": "Ativar",
|
||||||
"edit": "Editar",
|
"edit": "Editar",
|
||||||
"delete": "Excluir",
|
"delete": "Excluir",
|
||||||
"protected": "Protegida",
|
"protected": "Protegida",
|
||||||
@@ -974,7 +982,7 @@
|
|||||||
"status": {
|
"status": {
|
||||||
"system": "Sistema",
|
"system": "Sistema",
|
||||||
"running": "Executando agora",
|
"running": "Executando agora",
|
||||||
"paused": "Pausada",
|
"paused": "Desativada",
|
||||||
"failed": "Falhou",
|
"failed": "Falhou",
|
||||||
"completed": "Concluída",
|
"completed": "Concluída",
|
||||||
"noSchedule": "Sem agendamento",
|
"noSchedule": "Sem agendamento",
|
||||||
@@ -989,12 +997,14 @@
|
|||||||
"cli": "CLI"
|
"cli": "CLI"
|
||||||
},
|
},
|
||||||
"schedule": {
|
"schedule": {
|
||||||
|
"weeklyAt": "Toda {{day}} às {{time}}",
|
||||||
"at": "Às {{time}}",
|
"at": "Às {{time}}",
|
||||||
"every": "A cada {{duration}}",
|
"every": "A cada {{duration}}",
|
||||||
"cron": "Cron {{expr}}",
|
"cron": "Cron {{expr}}",
|
||||||
"cronWithTz": "Cron {{expr}} ({{tz}})",
|
"cronWithTz": "Cron {{expr}} ({{tz}})",
|
||||||
"withTz": "{{summary}} ({{tz}})",
|
"withTz": "{{summary}} ({{tz}})",
|
||||||
"dailyAt": "Diariamente às {{time}}",
|
"dailyAt": "Diariamente às {{time}}",
|
||||||
|
"monthlyAt": "Todo dia {{day}} do mês às {{time}}",
|
||||||
"weekdaysAt": "De segunda a sexta às {{time}}",
|
"weekdaysAt": "De segunda a sexta às {{time}}",
|
||||||
"hourlyAt": "A cada hora, no minuto {{minute}}",
|
"hourlyAt": "A cada hora, no minuto {{minute}}",
|
||||||
"hourlyWindow": "A cada hora de {{start}} a {{end}}, no minuto {{minute}}",
|
"hourlyWindow": "A cada hora de {{start}} a {{end}}, no minuto {{minute}}",
|
||||||
@@ -1002,7 +1012,7 @@
|
|||||||
"custom": "Agendamento personalizado"
|
"custom": "Agendamento personalizado"
|
||||||
},
|
},
|
||||||
"next": {
|
"next": {
|
||||||
"paused": "Pausada",
|
"paused": "Desativada",
|
||||||
"pending": "Executando agora",
|
"pending": "Executando agora",
|
||||||
"local": "Aguardando gatilho",
|
"local": "Aguardando gatilho",
|
||||||
"none": "Sem próxima execução"
|
"none": "Sem próxima execução"
|
||||||
@@ -1020,7 +1030,10 @@
|
|||||||
"unit": "Unidade",
|
"unit": "Unidade",
|
||||||
"cronExpression": "Expressão cron",
|
"cronExpression": "Expressão cron",
|
||||||
"timezone": "Fuso horário",
|
"timezone": "Fuso horário",
|
||||||
"runAt": "Executar em"
|
"runAt": "Executar em",
|
||||||
|
"runDate": "Data de execução",
|
||||||
|
"runTime": "Hora de execução",
|
||||||
|
"chooseDate": "Escolher data"
|
||||||
},
|
},
|
||||||
"scheduleTypes": {
|
"scheduleTypes": {
|
||||||
"every": "Intervalo",
|
"every": "Intervalo",
|
||||||
|
|||||||
@@ -889,7 +889,7 @@
|
|||||||
},
|
},
|
||||||
"automations": {
|
"automations": {
|
||||||
"create": "Tạo tự động hóa",
|
"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",
|
"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}}",
|
"createRequest": "Tạo một tác vụ tự động cho yêu cầu này:\n\n{{request}}",
|
||||||
"errors": {
|
"errors": {
|
||||||
@@ -907,6 +907,14 @@
|
|||||||
},
|
},
|
||||||
"yourTasks": "Tác vụ tự động của bạn",
|
"yourTasks": "Tác vụ tự động của bạn",
|
||||||
"systemTasks": "Tác vụ hệ thống",
|
"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",
|
"instructions": "Chỉ dẫn",
|
||||||
"done": "Xong",
|
"done": "Xong",
|
||||||
"moreDetails": "Chi tiết khác",
|
"moreDetails": "Chi tiết khác",
|
||||||
@@ -917,7 +925,7 @@
|
|||||||
"filters": {
|
"filters": {
|
||||||
"all": "Tất cả",
|
"all": "Tất cả",
|
||||||
"active": "Đã bật",
|
"active": "Đã bật",
|
||||||
"paused": "Đã tạm dừng",
|
"paused": "Đã tắt",
|
||||||
"failed": "Cần xử lý",
|
"failed": "Cần xử lý",
|
||||||
"system": "Hệ thống"
|
"system": "Hệ thống"
|
||||||
},
|
},
|
||||||
@@ -945,8 +953,8 @@
|
|||||||
"updated": "Đã cập nhật"
|
"updated": "Đã cập nhật"
|
||||||
},
|
},
|
||||||
"runNow": "Chạy ngay",
|
"runNow": "Chạy ngay",
|
||||||
"pause": "Tạm dừng",
|
"pause": "Tắt",
|
||||||
"resume": "Tiếp tục",
|
"resume": "Bật",
|
||||||
"edit": "Sửa",
|
"edit": "Sửa",
|
||||||
"delete": "Xóa",
|
"delete": "Xóa",
|
||||||
"protected": "Được bảo vệ",
|
"protected": "Được bảo vệ",
|
||||||
@@ -960,7 +968,7 @@
|
|||||||
"status": {
|
"status": {
|
||||||
"system": "Hệ thống",
|
"system": "Hệ thống",
|
||||||
"running": "Đang chạy",
|
"running": "Đang chạy",
|
||||||
"paused": "Đã tạm dừng",
|
"paused": "Đã tắt",
|
||||||
"failed": "Thất bại",
|
"failed": "Thất bại",
|
||||||
"completed": "Hoàn tất",
|
"completed": "Hoàn tất",
|
||||||
"noSchedule": "Không có lịch",
|
"noSchedule": "Không có lịch",
|
||||||
@@ -975,12 +983,14 @@
|
|||||||
"cli": "CLI"
|
"cli": "CLI"
|
||||||
},
|
},
|
||||||
"schedule": {
|
"schedule": {
|
||||||
|
"weeklyAt": "Mỗi {{day}} lúc {{time}}",
|
||||||
"at": "Vào {{time}}",
|
"at": "Vào {{time}}",
|
||||||
"every": "Mỗi {{duration}}",
|
"every": "Mỗi {{duration}}",
|
||||||
"cron": "Cron {{expr}}",
|
"cron": "Cron {{expr}}",
|
||||||
"cronWithTz": "Cron {{expr}} ({{tz}})",
|
"cronWithTz": "Cron {{expr}} ({{tz}})",
|
||||||
"withTz": "{{summary}} ({{tz}})",
|
"withTz": "{{summary}} ({{tz}})",
|
||||||
"dailyAt": "Hằng ngày lúc {{time}}",
|
"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}}",
|
"weekdaysAt": "Thứ Hai đến thứ Sáu lúc {{time}}",
|
||||||
"hourlyAt": "Vào phút {{minute}} mỗi giờ",
|
"hourlyAt": "Vào phút {{minute}} mỗi giờ",
|
||||||
"hourlyWindow": "Vào phút {{minute}} mỗi giờ, từ {{start}} đến {{end}}",
|
"hourlyWindow": "Vào phút {{minute}} mỗi giờ, từ {{start}} đến {{end}}",
|
||||||
@@ -988,7 +998,7 @@
|
|||||||
"custom": "Lịch tùy chỉnh"
|
"custom": "Lịch tùy chỉnh"
|
||||||
},
|
},
|
||||||
"next": {
|
"next": {
|
||||||
"paused": "Đã tạm dừng",
|
"paused": "Đã tắt",
|
||||||
"pending": "Đang chạy",
|
"pending": "Đang chạy",
|
||||||
"local": "Đang chờ kích hoạt",
|
"local": "Đang chờ kích hoạt",
|
||||||
"none": "Không có lần chạy tiếp theo"
|
"none": "Không có lần chạy tiếp theo"
|
||||||
@@ -1006,7 +1016,10 @@
|
|||||||
"unit": "Đơn vị",
|
"unit": "Đơn vị",
|
||||||
"cronExpression": "Biểu thức cron",
|
"cronExpression": "Biểu thức cron",
|
||||||
"timezone": "Múi giờ",
|
"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": {
|
"scheduleTypes": {
|
||||||
"every": "Khoảng lặp",
|
"every": "Khoảng lặp",
|
||||||
|
|||||||
@@ -1089,7 +1089,7 @@
|
|||||||
},
|
},
|
||||||
"automations": {
|
"automations": {
|
||||||
"create": "创建自动任务",
|
"create": "创建自动任务",
|
||||||
"createPrompt": "想让 nanobot 定时帮你做什么?",
|
"createPrompt": "想让 nanobot 自动帮你做什么?",
|
||||||
"createInput": "描述一个自动任务",
|
"createInput": "描述一个自动任务",
|
||||||
"createRequest": "请为以下需求创建自动任务:\n\n{{request}}",
|
"createRequest": "请为以下需求创建自动任务:\n\n{{request}}",
|
||||||
"errors": {
|
"errors": {
|
||||||
@@ -1107,6 +1107,14 @@
|
|||||||
},
|
},
|
||||||
"yourTasks": "你的自动任务",
|
"yourTasks": "你的自动任务",
|
||||||
"systemTasks": "系统任务",
|
"systemTasks": "系统任务",
|
||||||
|
"views": {
|
||||||
|
"label": "自动任务视图",
|
||||||
|
"tasks": "任务",
|
||||||
|
"calendar": "日历"
|
||||||
|
},
|
||||||
|
"filter": "筛选",
|
||||||
|
"filteredBy": "筛选:{{status}}",
|
||||||
|
"commandCondition": "通过命令触发",
|
||||||
"instructions": "任务指令",
|
"instructions": "任务指令",
|
||||||
"done": "完成",
|
"done": "完成",
|
||||||
"moreDetails": "更多信息",
|
"moreDetails": "更多信息",
|
||||||
@@ -1117,7 +1125,7 @@
|
|||||||
"filters": {
|
"filters": {
|
||||||
"all": "全部",
|
"all": "全部",
|
||||||
"active": "已启用",
|
"active": "已启用",
|
||||||
"paused": "已暂停",
|
"paused": "已停用",
|
||||||
"failed": "异常",
|
"failed": "异常",
|
||||||
"system": "系统"
|
"system": "系统"
|
||||||
},
|
},
|
||||||
@@ -1145,8 +1153,8 @@
|
|||||||
"updated": "更新于"
|
"updated": "更新于"
|
||||||
},
|
},
|
||||||
"runNow": "立即运行",
|
"runNow": "立即运行",
|
||||||
"pause": "暂停",
|
"pause": "停用",
|
||||||
"resume": "恢复",
|
"resume": "启用",
|
||||||
"edit": "编辑",
|
"edit": "编辑",
|
||||||
"delete": "删除",
|
"delete": "删除",
|
||||||
"protected": "受保护",
|
"protected": "受保护",
|
||||||
@@ -1160,7 +1168,7 @@
|
|||||||
"status": {
|
"status": {
|
||||||
"system": "系统",
|
"system": "系统",
|
||||||
"running": "正在运行",
|
"running": "正在运行",
|
||||||
"paused": "已暂停",
|
"paused": "已停用",
|
||||||
"failed": "失败",
|
"failed": "失败",
|
||||||
"completed": "已完成",
|
"completed": "已完成",
|
||||||
"noSchedule": "无计划",
|
"noSchedule": "无计划",
|
||||||
@@ -1175,12 +1183,14 @@
|
|||||||
"cli": "CLI"
|
"cli": "CLI"
|
||||||
},
|
},
|
||||||
"schedule": {
|
"schedule": {
|
||||||
|
"weeklyAt": "每{{day}} {{time}}",
|
||||||
"at": "在 {{time}}",
|
"at": "在 {{time}}",
|
||||||
"every": "每 {{duration}}",
|
"every": "每 {{duration}}",
|
||||||
"cron": "Cron {{expr}}",
|
"cron": "Cron {{expr}}",
|
||||||
"cronWithTz": "Cron {{expr}}({{tz}})",
|
"cronWithTz": "Cron {{expr}}({{tz}})",
|
||||||
"withTz": "{{summary}}({{tz}})",
|
"withTz": "{{summary}}({{tz}})",
|
||||||
"dailyAt": "每天 {{time}}",
|
"dailyAt": "每天 {{time}}",
|
||||||
|
"monthlyAt": "每月 {{day}} 日 {{time}}",
|
||||||
"weekdaysAt": "周一至周五 {{time}}",
|
"weekdaysAt": "周一至周五 {{time}}",
|
||||||
"hourlyAt": "每小时第 {{minute}} 分钟",
|
"hourlyAt": "每小时第 {{minute}} 分钟",
|
||||||
"hourlyWindow": "{{start}}-{{end}} 点每小时第 {{minute}} 分钟",
|
"hourlyWindow": "{{start}}-{{end}} 点每小时第 {{minute}} 分钟",
|
||||||
@@ -1188,7 +1198,7 @@
|
|||||||
"custom": "自定义计划"
|
"custom": "自定义计划"
|
||||||
},
|
},
|
||||||
"next": {
|
"next": {
|
||||||
"paused": "已暂停",
|
"paused": "已停用",
|
||||||
"pending": "正在运行",
|
"pending": "正在运行",
|
||||||
"local": "等待触发",
|
"local": "等待触发",
|
||||||
"none": "无后续运行计划"
|
"none": "无后续运行计划"
|
||||||
@@ -1206,7 +1216,10 @@
|
|||||||
"unit": "单位",
|
"unit": "单位",
|
||||||
"cronExpression": "Cron 表达式",
|
"cronExpression": "Cron 表达式",
|
||||||
"timezone": "时区",
|
"timezone": "时区",
|
||||||
"runAt": "运行时间"
|
"runAt": "运行时间",
|
||||||
|
"runDate": "运行日期",
|
||||||
|
"runTime": "运行时刻",
|
||||||
|
"chooseDate": "选择日期"
|
||||||
},
|
},
|
||||||
"scheduleTypes": {
|
"scheduleTypes": {
|
||||||
"every": "间隔",
|
"every": "间隔",
|
||||||
|
|||||||
@@ -889,7 +889,7 @@
|
|||||||
},
|
},
|
||||||
"automations": {
|
"automations": {
|
||||||
"create": "建立自動任務",
|
"create": "建立自動任務",
|
||||||
"createPrompt": "想讓 nanobot 定時幫你做什麼?",
|
"createPrompt": "想讓 nanobot 自動幫你做什麼?",
|
||||||
"createInput": "描述自動任務",
|
"createInput": "描述自動任務",
|
||||||
"createRequest": "請為以下需求建立自動任務:\n\n{{request}}",
|
"createRequest": "請為以下需求建立自動任務:\n\n{{request}}",
|
||||||
"errors": {
|
"errors": {
|
||||||
@@ -907,6 +907,14 @@
|
|||||||
},
|
},
|
||||||
"yourTasks": "你的自動任務",
|
"yourTasks": "你的自動任務",
|
||||||
"systemTasks": "系統任務",
|
"systemTasks": "系統任務",
|
||||||
|
"views": {
|
||||||
|
"label": "自動任務檢視",
|
||||||
|
"tasks": "任務",
|
||||||
|
"calendar": "行事曆"
|
||||||
|
},
|
||||||
|
"filter": "篩選",
|
||||||
|
"filteredBy": "篩選:{{status}}",
|
||||||
|
"commandCondition": "透過指令觸發",
|
||||||
"instructions": "任務指示",
|
"instructions": "任務指示",
|
||||||
"done": "完成",
|
"done": "完成",
|
||||||
"moreDetails": "更多詳細資訊",
|
"moreDetails": "更多詳細資訊",
|
||||||
@@ -917,7 +925,7 @@
|
|||||||
"filters": {
|
"filters": {
|
||||||
"all": "全部",
|
"all": "全部",
|
||||||
"active": "已啟用",
|
"active": "已啟用",
|
||||||
"paused": "已暫停",
|
"paused": "已停用",
|
||||||
"failed": "需要處理",
|
"failed": "需要處理",
|
||||||
"system": "系統"
|
"system": "系統"
|
||||||
},
|
},
|
||||||
@@ -945,8 +953,8 @@
|
|||||||
"updated": "更新時間"
|
"updated": "更新時間"
|
||||||
},
|
},
|
||||||
"runNow": "立即執行",
|
"runNow": "立即執行",
|
||||||
"pause": "暫停",
|
"pause": "停用",
|
||||||
"resume": "繼續",
|
"resume": "啟用",
|
||||||
"edit": "編輯",
|
"edit": "編輯",
|
||||||
"delete": "刪除",
|
"delete": "刪除",
|
||||||
"protected": "受保護",
|
"protected": "受保護",
|
||||||
@@ -960,7 +968,7 @@
|
|||||||
"status": {
|
"status": {
|
||||||
"system": "系統",
|
"system": "系統",
|
||||||
"running": "正在執行",
|
"running": "正在執行",
|
||||||
"paused": "已暫停",
|
"paused": "已停用",
|
||||||
"failed": "失敗",
|
"failed": "失敗",
|
||||||
"completed": "已完成",
|
"completed": "已完成",
|
||||||
"noSchedule": "無排程",
|
"noSchedule": "無排程",
|
||||||
@@ -975,12 +983,14 @@
|
|||||||
"cli": "CLI"
|
"cli": "CLI"
|
||||||
},
|
},
|
||||||
"schedule": {
|
"schedule": {
|
||||||
|
"weeklyAt": "每{{day}} {{time}}",
|
||||||
"at": "於 {{time}}",
|
"at": "於 {{time}}",
|
||||||
"every": "每 {{duration}}",
|
"every": "每 {{duration}}",
|
||||||
"cron": "Cron {{expr}}",
|
"cron": "Cron {{expr}}",
|
||||||
"cronWithTz": "Cron {{expr}}({{tz}})",
|
"cronWithTz": "Cron {{expr}}({{tz}})",
|
||||||
"withTz": "{{summary}}({{tz}})",
|
"withTz": "{{summary}}({{tz}})",
|
||||||
"dailyAt": "每天 {{time}}",
|
"dailyAt": "每天 {{time}}",
|
||||||
|
"monthlyAt": "每月 {{day}} 日 {{time}}",
|
||||||
"weekdaysAt": "每週一至週五 {{time}}",
|
"weekdaysAt": "每週一至週五 {{time}}",
|
||||||
"hourlyAt": "每小時第 {{minute}} 分鐘",
|
"hourlyAt": "每小時第 {{minute}} 分鐘",
|
||||||
"hourlyWindow": "每天 {{start}} 時至 {{end}} 時之間,於每小時第 {{minute}} 分鐘執行",
|
"hourlyWindow": "每天 {{start}} 時至 {{end}} 時之間,於每小時第 {{minute}} 分鐘執行",
|
||||||
@@ -988,7 +998,7 @@
|
|||||||
"custom": "自訂排程"
|
"custom": "自訂排程"
|
||||||
},
|
},
|
||||||
"next": {
|
"next": {
|
||||||
"paused": "已暫停",
|
"paused": "已停用",
|
||||||
"pending": "正在執行",
|
"pending": "正在執行",
|
||||||
"local": "等待觸發",
|
"local": "等待觸發",
|
||||||
"none": "沒有後續執行排程"
|
"none": "沒有後續執行排程"
|
||||||
@@ -1006,7 +1016,10 @@
|
|||||||
"unit": "單位",
|
"unit": "單位",
|
||||||
"cronExpression": "Cron 表達式",
|
"cronExpression": "Cron 表達式",
|
||||||
"timezone": "時區",
|
"timezone": "時區",
|
||||||
"runAt": "執行時間"
|
"runAt": "執行時間",
|
||||||
|
"runDate": "執行日期",
|
||||||
|
"runTime": "執行時刻",
|
||||||
|
"chooseDate": "選擇日期"
|
||||||
},
|
},
|
||||||
"scheduleTypes": {
|
"scheduleTypes": {
|
||||||
"every": "間隔",
|
"every": "間隔",
|
||||||
|
|||||||
@@ -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);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -3,7 +3,7 @@ import { act, cleanup, fireEvent, render, screen, waitFor, within } from "@testi
|
|||||||
import userEvent from "@testing-library/user-event";
|
import userEvent from "@testing-library/user-event";
|
||||||
import { afterEach, beforeEach, describe, expect, it, onTestFinished, vi } from "vitest";
|
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 type { AutomationFilter } from "@/components/settings/system/AutomationsSettings";
|
||||||
import i18n from "@/i18n";
|
import i18n from "@/i18n";
|
||||||
import type { SessionAutomationJob, SettingsPayload } from "@/lib/types";
|
import type { SessionAutomationJob, SettingsPayload } from "@/lib/types";
|
||||||
@@ -36,7 +36,8 @@ const modelSettings = {
|
|||||||
providers: [{ name: "openai", label: "OpenAI", configured: true }],
|
providers: [{ name: "openai", label: "OpenAI", configured: true }],
|
||||||
} as SettingsPayload;
|
} as SettingsPayload;
|
||||||
type Props = Partial<React.ComponentProps<typeof AutomationsSettings>>;
|
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) {
|
function Harness({ payload = { jobs: [task, systemTask] }, ...props }: Props) {
|
||||||
const [filter, setFilter] = useState<AutomationFilter>("all");
|
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(() => {
|
beforeEach(() => {
|
||||||
window.localStorage.removeItem(SYSTEM_TASKS_OPEN_STORAGE_KEY);
|
window.localStorage.removeItem(SYSTEM_TASKS_OPEN_STORAGE_KEY);
|
||||||
|
window.localStorage.removeItem(VIEW_STORAGE_KEY);
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -57,49 +74,130 @@ afterEach(() => {
|
|||||||
vi.useRealTimers();
|
vi.useRealTimers();
|
||||||
vi.restoreAllMocks();
|
vi.restoreAllMocks();
|
||||||
window.localStorage.removeItem(SYSTEM_TASKS_OPEN_STORAGE_KEY);
|
window.localStorage.removeItem(SYSTEM_TASKS_OPEN_STORAGE_KEY);
|
||||||
|
window.localStorage.removeItem(VIEW_STORAGE_KEY);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("Automation task list and detail sheet", () => {
|
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 />);
|
render(<Harness />);
|
||||||
expect(screen.queryByRole("heading", { name: "Your automations" })).not.toBeInTheDocument();
|
const views = screen.getByRole("group", { name: "Automation view" });
|
||||||
const month = new Intl.DateTimeFormat("en", { month: "long", year: "numeric" }).format(new Date());
|
const filters = screen.getByRole("button", { name: /^Filter/ });
|
||||||
expect(screen.getByLabelText(month)).toBeVisible();
|
const toolbar = views.closest(".automation-panel-toolbar");
|
||||||
const systemToggle = screen.getByRole("button", { name: "System tasks 1" });
|
expect(toolbar).not.toBeNull();
|
||||||
expect(systemToggle).toHaveClass("text-[13px]", "font-medium");
|
expect(filters.closest(".automation-panel-toolbar")).toBe(toolbar);
|
||||||
expect(systemToggle).not.toHaveClass("uppercase", "tracking-[0.08em]");
|
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();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("opens system tasks by default and remembers manual changes across visits", () => {
|
const triggerTask: SessionAutomationJob = {
|
||||||
const first = render(<Harness />);
|
...task, id: "trigger-review", name: "Review on request", kind: "local_trigger",
|
||||||
expect(screen.getByRole("button", { name: "System tasks 1" })).toHaveAttribute("aria-expanded", "true");
|
schedule: { kind: "local" }, state: {},
|
||||||
expect(window.localStorage.getItem(SYSTEM_TASKS_OPEN_STORAGE_KEY)).toBeNull();
|
payload: { kind: "local_trigger", message: "nanobot trigger trg_review \"message\"" },
|
||||||
fireEvent.click(screen.getByRole("button", { name: "System tasks 1" }));
|
trigger: { id: "trg_review", command: "nanobot trigger trg_review \"message\"" },
|
||||||
first.unmount();
|
};
|
||||||
|
|
||||||
const second = render(<Harness />);
|
it("keeps undated triggers in Tasks and opens their shared details with keyboard focus restored", async () => {
|
||||||
expect(screen.getByRole("button", { name: "System tasks 1" })).toHaveAttribute("aria-expanded", "false");
|
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();
|
||||||
|
});
|
||||||
|
|
||||||
|
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("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();
|
expect(screen.queryByRole("button", { name: /heartbeat/ })).not.toBeInTheDocument();
|
||||||
fireEvent.click(screen.getByRole("button", { name: "System tasks 1" }));
|
first.unmount();
|
||||||
second.unmount();
|
render(<Harness payload={{ jobs: [triggerTask, task, systemTask] }} />);
|
||||||
|
expect(screen.getByRole("button", { name: "Calendar", exact: true })).toHaveAttribute("aria-pressed", "true");
|
||||||
render(<Harness />);
|
fireEvent.click(screen.getByRole("button", { name: "Tasks", exact: true }));
|
||||||
expect(screen.getByRole("button", { name: "System tasks 1" })).toHaveAttribute("aria-expanded", "true");
|
expect(screen.getByRole("button", { name: "Tasks", exact: true })).toHaveAttribute("aria-pressed", "true");
|
||||||
expect(window.localStorage.getItem(SYSTEM_TASKS_OPEN_STORAGE_KEY)).toBe("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("keeps the system toggle usable when browser storage is unavailable", () => {
|
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, "getItem").mockImplementation(() => { throw new Error("Blocked"); });
|
||||||
vi.spyOn(window.localStorage, "setItem").mockImplementation(() => { throw new Error("Blocked"); });
|
vi.spyOn(window.localStorage, "setItem").mockImplementation(() => { throw new Error("Blocked"); });
|
||||||
render(<Harness />);
|
render(<Harness payload={{ jobs: [triggerTask] }} />);
|
||||||
const toggle = screen.getByRole("button", { name: "System tasks 1" });
|
fireEvent.click(screen.getByRole("button", { name: "Tasks", exact: true }));
|
||||||
expect(toggle).toHaveAttribute("aria-expanded", "true");
|
expect(screen.getByRole("button", { name: /Review on request/ })).toBeVisible();
|
||||||
fireEvent.click(toggle);
|
fireEvent.click(screen.getByRole("button", { name: "Calendar", exact: true }));
|
||||||
expect(toggle).toHaveAttribute("aria-expanded", "false");
|
expect(screen.queryByRole("button", { name: /Review on request/ })).not.toBeInTheDocument();
|
||||||
fireEvent.click(toggle);
|
|
||||||
expect(toggle).toHaveAttribute("aria-expanded", "true");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
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) => {
|
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
|
// Happy DOM has no CSS animations. Give Radix live animation names so its
|
||||||
// real presence lifecycle runs, including the outer portal's ref boundary.
|
// 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();
|
const user = userEvent.setup();
|
||||||
render(<Harness />);
|
render(<Harness />);
|
||||||
expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
|
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.queryByRole("textbox")).not.toBeInTheDocument();
|
||||||
expect(screen.getByRole("button", { name: /^Active/ })).toBeVisible();
|
expect(screen.queryByRole("menuitemradio")).not.toBeInTheDocument();
|
||||||
expect(screen.getByRole("button", { name: /heartbeat/ })).toBeVisible();
|
expect(screen.queryByRole("button", { name: /heartbeat/ })).not.toBeInTheDocument();
|
||||||
expect(screen.queryByRole("button", { name: "Create in chat" })).not.toBeInTheDocument();
|
expect(screen.queryByRole("button", { name: "Create in chat" })).not.toBeInTheDocument();
|
||||||
const row = screen.getByRole("button", { name: /PR watch/ });
|
const row = screen.getByRole("button", { name: /PR watch/ });
|
||||||
await user.click(row);
|
await user.click(row);
|
||||||
@@ -186,6 +284,10 @@ describe("Automation task list and detail sheet", () => {
|
|||||||
const recorded = screen.getByRole("button", { name: /PR watch.*Recorded/ });
|
const recorded = screen.getByRole("button", { name: /PR watch.*Recorded/ });
|
||||||
expect(planned).toHaveAttribute("aria-haspopup", "dialog");
|
expect(planned).toHaveAttribute("aria-haspopup", "dialog");
|
||||||
expect(recorded).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();
|
expect(screen.queryByRole("link", { name: /PR watch/ })).not.toBeInTheDocument();
|
||||||
|
|
||||||
await user.click(recorded);
|
await user.click(recorded);
|
||||||
@@ -227,14 +329,28 @@ describe("Automation task list and detail sheet", () => {
|
|||||||
await waitFor(() => expect(more).toHaveFocus());
|
await waitFor(() => expect(more).toHaveFocus());
|
||||||
});
|
});
|
||||||
|
|
||||||
it("keeps the calendar and filters available when a status has no matches", async () => {
|
it("keeps explicit running and error icons after removing calendar status dots", () => {
|
||||||
const user = userEvent.setup();
|
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] }} />);
|
render(<Harness payload={{ jobs: [task] }} />);
|
||||||
const month = screen.getByRole("heading", { level: 2 });
|
const month = screen.getByRole("heading", { level: 2 });
|
||||||
await user.click(screen.getByRole("button", { name: "Paused 0" }));
|
selectFilter("Disabled 0");
|
||||||
expect(month).toBeVisible();
|
expect(month).toBeVisible();
|
||||||
expect(screen.queryByRole("button", { name: /PR watch.*Planned/ })).not.toBeInTheDocument();
|
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();
|
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} />);
|
render(<Harness payload={{ jobs: [] }} onStartChat={() => {}} settingsSnapshot={modelSettings} />);
|
||||||
expect(screen.getByRole("textbox", { name: "Describe an automation" })).toHaveAttribute(
|
expect(screen.getByRole("textbox", { name: "Describe an automation" })).toHaveAttribute(
|
||||||
"placeholder",
|
"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"));
|
await act(() => i18n.changeLanguage("zh-CN"));
|
||||||
render(<Harness payload={{ jobs: [] }} onStartChat={() => {}} settingsSnapshot={modelSettings} />);
|
render(<Harness payload={{ jobs: [] }} onStartChat={() => {}} settingsSnapshot={modelSettings} />);
|
||||||
expect(screen.getByRole("textbox", { name: "描述一个自动任务" })).toHaveAttribute(
|
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(calendar.querySelectorAll(".automation-calendar-day").length).toBeGreaterThanOrEqual(35);
|
||||||
expect(screen.queryByRole("button", { name: "Create in chat" })).not.toBeInTheDocument();
|
expect(screen.queryByRole("button", { name: "Create in chat" })).not.toBeInTheDocument();
|
||||||
expect(screen.queryByRole("button", { name: "Open a chat" })).not.toBeInTheDocument();
|
expect(screen.queryByRole("button", { name: "Open a chat" })).not.toBeInTheDocument();
|
||||||
expect(screen.getByRole("group", { name: "Automations" })).toBeVisible();
|
expect(screen.queryByRole("button", { name: /^Filter/ })).not.toBeInTheDocument();
|
||||||
fireEvent.click(screen.getByRole("button", { name: /heartbeat/ }));
|
expect(screen.queryByRole("button", { name: /heartbeat/ })).not.toBeInTheDocument();
|
||||||
const dialog = screen.getByRole("dialog", { name: "heartbeat" });
|
fireEvent.click(screen.getByRole("button", { name: "Tasks", exact: true }));
|
||||||
expect(within(dialog).queryByRole("button", { name: "Edit" })).not.toBeInTheDocument();
|
expect(screen.getByText("No automations yet.")).toBeVisible();
|
||||||
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();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("distinguishes a finished one-time task from a task with no scheduled run", () => {
|
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) => {
|
it.each(["heartbeat", "dream", "other-system-job"])("shows only actual task data for %s", (id) => {
|
||||||
render(<Harness payload={{ jobs: [{ ...systemTask, id, name: id, state: {
|
renderDetail({ ...systemTask, id, name: id, state: { next_run_at_ms: now + 540_000 } });
|
||||||
next_run_at_ms: now + 540_000,
|
|
||||||
} }] }} />);
|
|
||||||
fireEvent.click(screen.getByRole("button", { name: new RegExp(id) }));
|
|
||||||
const dialog = screen.getByRole("dialog", { name: id });
|
const dialog = screen.getByRole("dialog", { name: id });
|
||||||
expect(dialog).toHaveClass("max-w-[440px]");
|
expect(dialog).toHaveClass("max-w-[440px]");
|
||||||
expect(dialog).not.toHaveAttribute("aria-describedby");
|
expect(dialog).not.toHaveAttribute("aria-describedby");
|
||||||
@@ -389,11 +499,10 @@ describe("Automation task list and detail sheet", () => {
|
|||||||
expect(within(metadata).getByText("ID")).toBeInTheDocument();
|
expect(within(metadata).getByText("ID")).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("keeps system failures visible and does not infer purpose from a task name", () => {
|
it("keeps the shared protected detail read-only and does not infer purpose from a task name", () => {
|
||||||
render(<Harness payload={{ jobs: [{ ...systemTask, id: "other-system-job", name: "heartbeat",
|
renderDetail({ ...systemTask, id: "other-system-job", name: "heartbeat",
|
||||||
state: { last_status: "error", last_error: "Background check failed", next_run_at_ms: null },
|
state: { last_run_at_ms: now - 60_000, last_status: "error", last_error: "Background check failed", next_run_at_ms: null },
|
||||||
}] }} />);
|
});
|
||||||
fireEvent.click(screen.getByRole("button", { name: /heartbeat/ }));
|
|
||||||
const dialog = screen.getByRole("dialog", { name: "heartbeat" });
|
const dialog = screen.getByRole("dialog", { name: "heartbeat" });
|
||||||
expect(within(dialog).queryByText("System-managed automation")).not.toBeInTheDocument();
|
expect(within(dialog).queryByText("System-managed automation")).not.toBeInTheDocument();
|
||||||
expect(within(dialog).getByRole("alert")).toHaveTextContent("Background check failed");
|
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) => {
|
it.each([task, systemTask])("uses shared dialog styling and quiet detail rows for $name", (job) => {
|
||||||
render(<Harness payload={{ jobs: [job] }} />);
|
renderDetail(job);
|
||||||
fireEvent.click(screen.getByRole("button", { name: new RegExp(job.name) }));
|
|
||||||
const dialog = screen.getByRole("dialog", { name: job.name });
|
const dialog = screen.getByRole("dialog", { name: job.name });
|
||||||
expect(dialog).toHaveClass("rounded-modal");
|
expect(dialog).toHaveClass("rounded-modal");
|
||||||
expect(dialog).not.toHaveClass("rounded-[20px]");
|
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.parentElement).not.toHaveClass("border-t");
|
||||||
expect(details).toHaveAttribute("aria-expanded", "false");
|
expect(details).toHaveAttribute("aria-expanded", "false");
|
||||||
if (!job.protected) {
|
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: "Run now" }).parentElement).toBe(taskActions);
|
||||||
expect(within(dialog).getByRole("button", { name: "Delete" }).parentElement).toBe(taskActions);
|
expect(within(dialog).getByRole("button", { name: "Delete" }).parentElement).toBe(taskActions);
|
||||||
const edit = within(dialog).getByRole("button", { name: "Edit" });
|
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();
|
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", () => {
|
it("keeps separators inside the date grid and omits an outside-month task list", () => {
|
||||||
const outsideTask: SessionAutomationJob = {
|
const outsideTask: SessionAutomationJob = {
|
||||||
@@ -491,7 +573,7 @@ describe("Automation task list and detail sheet", () => {
|
|||||||
expect(header).toHaveClass("bg-foreground/[0.025]");
|
expect(header).toHaveClass("bg-foreground/[0.025]");
|
||||||
expect(header).not.toHaveClass("border-b");
|
expect(header).not.toHaveClass("border-b");
|
||||||
expect(header?.querySelector(".automation-calendar-weekdays")).toBeInTheDocument();
|
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(calendar.querySelector(":scope > details")).toBeNull();
|
||||||
expect(screen.queryByRole("button", { name: /Paused backlog review/ })).not.toBeInTheDocument();
|
expect(screen.queryByRole("button", { name: /Paused backlog review/ })).not.toBeInTheDocument();
|
||||||
expect(calendar).not.toHaveTextContent("·");
|
expect(calendar).not.toHaveTextContent("·");
|
||||||
@@ -510,50 +592,58 @@ describe("Automation task list and detail sheet", () => {
|
|||||||
expect(dialog).not.toHaveTextContent("·");
|
expect(dialog).not.toHaveTextContent("·");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("keeps system tasks mounted for shared expand and collapse transitions without hidden tab stops", async () => {
|
it.each([
|
||||||
const user = userEvent.setup();
|
["30 13 25 * *", "Monthly on day 25 at 13:30"],
|
||||||
render(<Harness />);
|
["0 0 1 * *", "Monthly on day 1 at 00:00"],
|
||||||
const toggle = screen.getByRole("button", { name: "System tasks 1" });
|
["30 8 * * 1", "Every Monday at 08:30"],
|
||||||
expect(toggle).toHaveAttribute("aria-expanded", "true");
|
["0 19 * * 0", "Every Sunday at 19:00"],
|
||||||
await user.click(toggle);
|
["0 19 * * 7", "Every Sunday at 19:00"],
|
||||||
const drawer = document.getElementById(toggle.getAttribute("aria-controls")!);
|
["0 10 * * SAT", "Every Saturday at 10:00"],
|
||||||
expect(drawer).toHaveClass("inline-disclosure");
|
["0 10 * * 8", "Custom schedule"],
|
||||||
expect(drawer).toHaveAttribute("data-state", "closed");
|
["30 13 25 * 1", "Custom schedule"],
|
||||||
expect(drawer).toHaveAttribute("aria-hidden", "true");
|
["*/15 9-17 * * 1,3,5", "Custom schedule"],
|
||||||
expect(drawer!.firstElementChild).toHaveClass("inline-disclosure-clip");
|
["0 9 0 * *", "Custom schedule"],
|
||||||
expect(drawer!.firstElementChild?.firstElementChild).toHaveClass("inline-disclosure-content");
|
])("keeps %s out of read-only details", (expr, summary) => {
|
||||||
const row = within(drawer!).getByRole("button", { hidden: true });
|
render(<Harness payload={{ jobs: [{ ...task, schedule: { kind: "cron", expr } }] }} />);
|
||||||
expect(row).toBeDisabled();
|
fireEvent.click(screen.getByRole("button", { name: /PR watch/ }));
|
||||||
toggle.focus();
|
const dialog = screen.getByRole("dialog", { name: "PR watch" });
|
||||||
await user.tab();
|
expect(within(dialog).getByText(summary)).toBeVisible();
|
||||||
expect(row).not.toHaveFocus();
|
fireEvent.click(within(dialog).getByRole("button", { name: "More details" }));
|
||||||
|
expect(dialog).not.toHaveTextContent(expr);
|
||||||
toggle.focus();
|
expect(dialog).not.toHaveTextContent("Linked chat");
|
||||||
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();
|
|
||||||
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);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("keeps status filters immediately available", async () => {
|
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();
|
const user = userEvent.setup();
|
||||||
|
render(<Harness />);
|
||||||
|
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}");
|
||||||
|
expect(screen.queryByRole("menu")).not.toBeInTheDocument();
|
||||||
|
expect(filterButton).toHaveFocus();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("reveals status filters on demand and shows the applied condition", () => {
|
||||||
render(<Harness payload={{ jobs: [task, {
|
render(<Harness payload={{ jobs: [task, {
|
||||||
...task,
|
...task,
|
||||||
id: "paused",
|
id: "paused",
|
||||||
@@ -562,16 +652,16 @@ describe("Automation task list and detail sheet", () => {
|
|||||||
state: { last_run_at_ms: now - 60_000, last_status: "ok" },
|
state: { last_run_at_ms: now - 60_000, last_status: "ok" },
|
||||||
}, systemTask] }} />);
|
}, systemTask] }} />);
|
||||||
expect(screen.queryByRole("textbox")).not.toBeInTheDocument();
|
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.queryByRole("button", { name: /PR watch/ })).not.toBeInTheDocument();
|
||||||
expect(screen.getByRole("button", { name: /Weekly review/ })).toBeVisible();
|
expect(screen.getByRole("button", { name: /Weekly review/ })).toBeVisible();
|
||||||
expect(screen.getByRole("button", { name: "Paused 1" })).toHaveAttribute("aria-pressed", "true");
|
expect(screen.getByRole("button", { name: "Filter: Disabled" })).toBeVisible();
|
||||||
await user.click(screen.getByRole("button", { name: "All 2" }));
|
selectFilter("All 2");
|
||||||
expect(screen.queryByRole("button", { name: "Next run", exact: true })).not.toBeInTheDocument();
|
expect(screen.queryByRole("button", { name: "Next run", exact: true })).not.toBeInTheDocument();
|
||||||
expect(screen.getByRole("button", { name: /PR watch.*Planned/ })).toBeVisible();
|
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 user = userEvent.setup();
|
||||||
const action = vi.fn();
|
const action = vi.fn();
|
||||||
const payload = { jobs: [task] };
|
const payload = { jobs: [task] };
|
||||||
@@ -580,15 +670,13 @@ describe("Automation task list and detail sheet", () => {
|
|||||||
titleOverrides={{ "websocket:demo": longTitle }} />);
|
titleOverrides={{ "websocket:demo": longTitle }} />);
|
||||||
await user.click(screen.getByRole("button", { name: /PR watch/ }));
|
await user.click(screen.getByRole("button", { name: /PR watch/ }));
|
||||||
const dialog = screen.getByRole("dialog", { name: "PR watch" });
|
const dialog = screen.getByRole("dialog", { name: "PR watch" });
|
||||||
const chatLabel = within(dialog).getByText(longTitle);
|
expect(within(dialog).queryByText(longTitle)).not.toBeInTheDocument();
|
||||||
expect(chatLabel.closest("a")).toBeNull();
|
expect(within(dialog).queryByText("Linked chat")).not.toBeInTheDocument();
|
||||||
expect(chatLabel).toHaveClass("truncate");
|
|
||||||
expect(chatLabel).toHaveAttribute("title", longTitle);
|
|
||||||
expect(dialog.querySelector(".lucide-chevron-right")).toBeNull();
|
expect(dialog.querySelector(".lucide-chevron-right")).toBeNull();
|
||||||
rerender(<Harness payload={payload} onAction={action}
|
rerender(<Harness payload={payload} onAction={action}
|
||||||
titleOverrides={{ "websocket:demo": "新会话名称" }} />);
|
titleOverrides={{ "websocket:demo": "新会话名称" }} />);
|
||||||
expect(within(dialog).getByText("新会话名称")).toBe(chatLabel);
|
expect(within(dialog).queryByText("新会话名称")).not.toBeInTheDocument();
|
||||||
await user.click(within(dialog).getByRole("button", { name: "Pause" }));
|
await user.click(within(dialog).getByRole("button", { name: "Disable" }));
|
||||||
expect(action).toHaveBeenCalledWith("disable", expect.objectContaining({
|
expect(action).toHaveBeenCalledWith("disable", expect.objectContaining({
|
||||||
id: task.id, payload: task.payload,
|
id: task.id, payload: task.payload,
|
||||||
origin: expect.objectContaining({ session_key: "websocket:demo" }),
|
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" }));
|
await user.click(within(dialog).getByRole("button", { name: "Close" }));
|
||||||
rerender(<Harness payload={payload} titleOverrides={{}} />);
|
rerender(<Harness payload={payload} titleOverrides={{}} />);
|
||||||
await user.click(screen.getByRole("button", { name: /PR watch/ }));
|
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");
|
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 action = vi.fn();
|
||||||
const { rerender } = render(<Harness onAction={action} />);
|
const { rerender } = render(<Harness onAction={action} />);
|
||||||
fireEvent.click(screen.getByRole("button", { name: /PR watch/ }));
|
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);
|
expect(action).toHaveBeenCalledWith("disable", task);
|
||||||
rerender(<Harness payload={{ jobs: [{ ...task, enabled: false }] }} onAction={action} filter="active" />);
|
rerender(<Harness payload={{ jobs: [{ ...task, enabled: false }] }} onAction={action} filter="active" />);
|
||||||
expect(screen.getByRole("dialog", { name: "PR watch" })).toBeVisible();
|
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 });
|
expect(action).toHaveBeenLastCalledWith("enable", { ...task, enabled: false });
|
||||||
rerender(<Harness payload={{ jobs: [] }} />);
|
rerender(<Harness payload={{ jobs: [] }} />);
|
||||||
expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
|
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 () => {
|
it("returns focus to the page heading when the inspected row is no longer present", async () => {
|
||||||
const user = userEvent.setup();
|
const user = userEvent.setup();
|
||||||
const { rerender } = render(<Harness filter="active" />);
|
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 () => {
|
it("uses chevrons only for disclosures, while task rows open dialogs", async () => {
|
||||||
const user = userEvent.setup();
|
const user = userEvent.setup();
|
||||||
render(<Harness />);
|
render(<Harness />);
|
||||||
const toggle = screen.getByRole("button", { name: "System tasks 1" });
|
for (const name of [/PR watch/]) {
|
||||||
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/]) {
|
|
||||||
const row = screen.getByRole("button", { name });
|
const row = screen.getByRole("button", { name });
|
||||||
expect(row).toHaveAttribute("aria-haspopup", "dialog");
|
expect(row).toHaveAttribute("aria-haspopup", "dialog");
|
||||||
expect(row.querySelector(".lucide-chevron-right, .lucide-chevron-down")).toBeNull();
|
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" }));
|
await user.click(screen.getByRole("button", { name: "Run now" }));
|
||||||
expect(action).toHaveBeenCalledWith("run", task);
|
expect(action).toHaveBeenCalledWith("run", task);
|
||||||
rerender(<Harness actionKey="run:private-job-id" />);
|
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();
|
expect(screen.getByRole("button", { name })).toBeDisabled();
|
||||||
}
|
}
|
||||||
rerender(<Harness error="Unable to run task" />);
|
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/ }));
|
await user.click(screen.getByRole("button", { name: /PR watch/ }));
|
||||||
expect(screen.getByRole("button", { name: "Run now" })).toBeDisabled();
|
expect(screen.getByRole("button", { name: "Run now" })).toBeDisabled();
|
||||||
rerender(<Harness payload={{ jobs: [{ ...task, enabled: false, origin: null }] }} />);
|
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();
|
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" } }] }} />);
|
}, { ...systemTask, state: { last_status: "error" } }] }} />);
|
||||||
const row = screen.getByRole("button", { name: /PR watch.*Failed/ });
|
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);
|
fireEvent.click(row);
|
||||||
expect(within(screen.getByRole("dialog")).getByText("Failed")).toBeVisible();
|
expect(within(screen.getByRole("dialog")).getByText("Failed")).toBeVisible();
|
||||||
expect(within(screen.getByRole("dialog")).queryByText(/Completed/)).not.toBeInTheDocument();
|
expect(within(screen.getByRole("dialog")).queryByText(/Completed/)).not.toBeInTheDocument();
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ describe("SessionInfoPopover", () => {
|
|||||||
expect(detail).toHaveClass("max-w-[520px]", "rounded-modal");
|
expect(detail).toHaveClass("max-w-[520px]", "rounded-modal");
|
||||||
expect(within(detail).getByText("Instructions")).toBeInTheDocument();
|
expect(within(detail).getByText("Instructions")).toBeInTheDocument();
|
||||||
expect(within(detail).getByText("Check the project status")).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());
|
await waitFor(() => expect(screen.queryByRole("dialog", { name: "Morning check" })).not.toBeInTheDocument());
|
||||||
expect(screen.getByRole("button", { name: "Session details" })).toHaveFocus();
|
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(screen.getByRole("button", { name: "Session details" }));
|
||||||
await user.click(await screen.findByRole("button", { name: /Morning check/ }));
|
await user.click(await screen.findByRole("button", { name: /Morning check/ }));
|
||||||
const detail = screen.getByRole("dialog", { 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(
|
expect(requestMutation).toHaveBeenCalledWith(
|
||||||
"automation.disable",
|
"automation.disable",
|
||||||
{ id: "job-1" },
|
{ id: "job-1" },
|
||||||
20_000,
|
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 () => {
|
it("returns from the shared editor to the same task detail", async () => {
|
||||||
|
|||||||
@@ -40,6 +40,11 @@ const agentPlugin = {
|
|||||||
source: "agent-plugin",
|
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", () => {
|
describe("Settings system domains", () => {
|
||||||
installSettingsViewTestHooks();
|
installSettingsViewTestHooks();
|
||||||
|
|
||||||
@@ -164,6 +169,24 @@ describe("Settings system domains", () => {
|
|||||||
expect(screen.getByTestId("settings-section-transition")).not.toHaveClass("settings-feature-page");
|
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 () => {
|
it("uses the inline section heading layout to align Apps titles and counts", async () => {
|
||||||
vi.stubGlobal("fetch", vi.fn(async (input: RequestInfo | URL) => {
|
vi.stubGlobal("fetch", vi.fn(async (input: RequestInfo | URL) => {
|
||||||
const url = String(input);
|
const url = String(input);
|
||||||
@@ -238,7 +261,7 @@ describe("Settings system domains", () => {
|
|||||||
const input = screen.getByRole("textbox", { name: "Describe an automation" });
|
const input = screen.getByRole("textbox", { name: "Describe an automation" });
|
||||||
expect(input).toHaveAttribute(
|
expect(input).toHaveAttribute(
|
||||||
"placeholder",
|
"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.change(input, { target: { value: "Summarize updates every weekday at 9" } });
|
||||||
fireEvent.click(screen.getByRole("button", { name: "Send message" }));
|
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();
|
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.queryByRole("button", { name: /Daily summary/ })).not.toBeInTheDocument();
|
||||||
expect(screen.getByRole("button", { name: "Today" })).toBeVisible();
|
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();
|
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) => {
|
vi.stubGlobal("fetch", vi.fn(async (input: RequestInfo | URL) => {
|
||||||
if (String(input) === "/api/settings") return jsonResponse(settingsPayload());
|
if (String(input) === "/api/settings") return jsonResponse(settingsPayload());
|
||||||
if (String(input) === "/api/webui/automations") {
|
if (String(input) === "/api/webui/automations") {
|
||||||
@@ -293,7 +316,7 @@ describe("Settings system domains", () => {
|
|||||||
{
|
{
|
||||||
id: "heartbeat", name: "heartbeat", enabled: true, protected: true,
|
id: "heartbeat", name: "heartbeat", enabled: true, protected: true,
|
||||||
schedule: { kind: "every", every_ms: 1_800_000 },
|
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,
|
id: "paused-job", name: "Paused reminder", enabled: false,
|
||||||
@@ -307,20 +330,18 @@ describe("Settings system domains", () => {
|
|||||||
}));
|
}));
|
||||||
renderSettingsView({ initialSection: "automations", initialSettings: settingsPayload(), showSidebar: false });
|
renderSettingsView({ initialSection: "automations", initialSettings: settingsPayload(), showSidebar: false });
|
||||||
|
|
||||||
const filters = await screen.findByRole("group", { name: "Automations" });
|
const trigger = await screen.findByRole("button", { name: "Filter", exact: true });
|
||||||
expect(within(filters).getByRole("button", { name: "All 1" }).parentElement).toHaveClass("segmented-control", "flex-wrap");
|
expect(screen.queryByRole("menu")).not.toBeInTheDocument();
|
||||||
expect(within(filters).getAllByRole("button")).toHaveLength(4);
|
fireEvent.pointerDown(trigger, { button: 0, ctrlKey: false });
|
||||||
expect(within(filters).getByRole("button", { name: "All 1" })).toHaveAttribute("aria-pressed", "true");
|
const menu = screen.getByRole("menu", { name: "Filter" });
|
||||||
expect(within(filters).queryByRole("button", { name: /System/ })).not.toBeInTheDocument();
|
expect(within(menu).getAllByRole("menuitemradio")).toHaveLength(4);
|
||||||
expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
|
expect(within(menu).getByRole("menuitemradio", { name: "All 1" })).toHaveAttribute("aria-checked", "true");
|
||||||
expect(screen.getByRole("button", { name: "System tasks 1" })).toHaveAttribute("aria-expanded", "true");
|
expect(within(menu).queryByRole("menuitemradio", { name: /System/ })).not.toBeInTheDocument();
|
||||||
expect(screen.getByRole("button", { name: /heartbeat/ })).toBeVisible();
|
fireEvent.click(within(menu).getByRole("menuitemradio", { name: "Disabled 1" }));
|
||||||
|
expect(screen.getByRole("button", { name: "Filter: Disabled" })).toBeVisible();
|
||||||
fireEvent.click(within(filters).getByRole("button", { name: "Paused 1" }));
|
|
||||||
expect(within(filters).getByRole("button", { name: "Paused 1" })).toHaveAttribute("aria-pressed", "true");
|
|
||||||
expect(screen.getByRole("button", { name: /Paused reminder/ })).toBeVisible();
|
expect(screen.getByRole("button", { name: /Paused reminder/ })).toBeVisible();
|
||||||
expect(screen.queryByRole("button", { name: /heartbeat/ })).not.toBeInTheDocument();
|
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 () => {
|
it("coalesces focus refreshes while automations are already loading", async () => {
|
||||||
|
|||||||
@@ -138,6 +138,7 @@ export function renderSettingsView(
|
|||||||
| "runtime";
|
| "runtime";
|
||||||
initialSettings?: SettingsPayload;
|
initialSettings?: SettingsPayload;
|
||||||
showSidebar?: boolean;
|
showSidebar?: boolean;
|
||||||
|
mainNavigationExpanded?: boolean;
|
||||||
onBackToChat?: () => void;
|
onBackToChat?: () => void;
|
||||||
onSettingsChange?: (payload: SettingsPayload) => void;
|
onSettingsChange?: (payload: SettingsPayload) => void;
|
||||||
onStartAutomationChat?: React.ComponentProps<typeof SettingsView>["onStartAutomationChat"];
|
onStartAutomationChat?: React.ComponentProps<typeof SettingsView>["onStartAutomationChat"];
|
||||||
@@ -152,6 +153,7 @@ export function renderSettingsView(
|
|||||||
initialSection={options.initialSection ?? "apps"}
|
initialSection={options.initialSection ?? "apps"}
|
||||||
initialSettings={options.initialSettings}
|
initialSettings={options.initialSettings}
|
||||||
showSidebar={options.showSidebar}
|
showSidebar={options.showSidebar}
|
||||||
|
mainNavigationExpanded={options.mainNavigationExpanded}
|
||||||
onToggleTheme={() => {}}
|
onToggleTheme={() => {}}
|
||||||
onBackToChat={options.onBackToChat ?? (() => {})}
|
onBackToChat={options.onBackToChat ?? (() => {})}
|
||||||
onModelNameChange={() => {}}
|
onModelNameChange={() => {}}
|
||||||
|
|||||||
Reference in new issue
Block a user