feat(webui): simplify automation management and unify disclosure motion
Replace the dense automation workspace with a calm list and on-demand details, show current linked-chat titles, and remember manual system-task expansion preferences. Reuse disclosure transitions across expandable controls, preserve drafts and focus through closing, and release large diffs after their exit animation. Refs NAN-116
This commit is contained in:
1 parent
90b889394f
commit
1640784d45
37 files changed
+1746
-721
No files matched your search
@@ -180,7 +180,10 @@ describe("Settings system domains", () => {
|
||||
|
||||
expect(screen.getByRole("heading", { name: "Automations" })).toBeInTheDocument();
|
||||
expect(await screen.findByText("No automations yet.")).toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole("button", { name: "Open a chat" }));
|
||||
expect(screen.getByText("Tell nanobot in a chat what you'd like it to do on a schedule.")).toBeInTheDocument();
|
||||
expect(screen.queryByRole("button", { name: "Create in chat" })).not.toBeInTheDocument();
|
||||
expect(screen.queryByRole("button", { name: "Open a chat" })).not.toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole("button", { name: "Back to chat" }));
|
||||
expect(onBackToChat).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
@@ -209,11 +212,50 @@ describe("Settings system domains", () => {
|
||||
showSidebar: false,
|
||||
});
|
||||
|
||||
expect(await screen.findByRole("heading", { name: "Daily summary" })).toBeInTheDocument();
|
||||
expect(await screen.findByRole("button", { name: /Daily summary/ })).toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole("button", { name: "Search and filter" }));
|
||||
fireEvent.click(screen.getByRole("button", { name: "Paused 0" }));
|
||||
expect(await screen.findByText("No automations match this view.")).toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole("button", { name: "Clear filters" }));
|
||||
expect(await screen.findByRole("heading", { name: "Daily summary" })).toBeInTheDocument();
|
||||
expect(await screen.findByRole("button", { name: /Daily summary/ })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("wraps automation filters and keeps every option selectable", async () => {
|
||||
vi.stubGlobal("fetch", vi.fn(async (input: RequestInfo | URL) => {
|
||||
if (String(input) === "/api/settings") return jsonResponse(settingsPayload());
|
||||
if (String(input) === "/api/webui/automations") {
|
||||
return jsonResponse({ jobs: [
|
||||
{
|
||||
id: "heartbeat", name: "heartbeat", enabled: true, protected: true,
|
||||
schedule: { kind: "every", every_ms: 1_800_000 },
|
||||
payload: { message: "System-managed automation" }, state: {},
|
||||
},
|
||||
{
|
||||
id: "paused-job", name: "Paused reminder", enabled: false,
|
||||
schedule: { kind: "every", every_ms: 86_400_000 },
|
||||
payload: { message: "Check the repo" }, state: {},
|
||||
},
|
||||
] });
|
||||
}
|
||||
return jsonResponse({});
|
||||
}));
|
||||
renderSettingsView({ initialSection: "automations", initialSettings: settingsPayload(), showSidebar: false });
|
||||
|
||||
fireEvent.click(await screen.findByRole("button", { name: "Search and filter" }));
|
||||
const filters = screen.getByRole("group", { name: "Automations" });
|
||||
expect(filters).toHaveClass("flex-wrap");
|
||||
expect(within(filters).getAllByRole("button")).toHaveLength(4);
|
||||
expect(within(filters).getByRole("button", { name: "All 1" })).toHaveAttribute("aria-pressed", "true");
|
||||
expect(within(filters).queryByRole("button", { name: /System/ })).not.toBeInTheDocument();
|
||||
expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
|
||||
expect(screen.getByRole("button", { name: "System tasks 1" })).toHaveAttribute("aria-expanded", "true");
|
||||
expect(screen.getByRole("button", { name: /heartbeat/ })).toBeVisible();
|
||||
|
||||
fireEvent.click(within(filters).getByRole("button", { name: "Paused 1" }));
|
||||
expect(within(filters).getByRole("button", { name: "Paused 1" })).toHaveAttribute("aria-pressed", "true");
|
||||
expect(screen.getByRole("button", { name: /Paused reminder/ })).toBeVisible();
|
||||
expect(screen.queryByRole("button", { name: /heartbeat/ })).not.toBeInTheDocument();
|
||||
expect(within(filters).getAllByRole("button", { pressed: true })).toHaveLength(1);
|
||||
});
|
||||
|
||||
it("coalesces focus refreshes while automations are already loading", async () => {
|
||||
|
||||
Reference in new issue
Block a user