From 828759d1b699336ba235a704e8ff564983c0d2e9 Mon Sep 17 00:00:00 2001 From: chengyongru Date: Mon, 15 Jun 2026 18:08:44 +0800 Subject: [PATCH] fix(webui): hide settings kicker on automations --- .../src/components/settings/SettingsView.tsx | 2 +- webui/src/tests/app-layout.test.tsx | 12 ++++++++-- webui/src/tests/settings-view.test.tsx | 23 ++++++++++++++++++- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/webui/src/components/settings/SettingsView.tsx b/webui/src/components/settings/SettingsView.tsx index 5fe36e4c..2442d0dc 100644 --- a/webui/src/components/settings/SettingsView.tsx +++ b/webui/src/components/settings/SettingsView.tsx @@ -1733,7 +1733,7 @@ export function SettingsView({ {t("settings.backToChat")} ) : null} - {activeSection !== "automations" ? ( + {showSidebar ? (

{t("settings.sidebar.title")}

diff --git a/webui/src/tests/app-layout.test.tsx b/webui/src/tests/app-layout.test.tsx index a0c74a01..75ae92a8 100644 --- a/webui/src/tests/app-layout.test.tsx +++ b/webui/src/tests/app-layout.test.tsx @@ -439,7 +439,11 @@ describe("App layout", () => { fireEvent.click(automationsButton); - expect(await screen.findByRole("heading", { name: "Automations" })).toBeInTheDocument(); + const heading = await screen.findByRole("heading", { name: "Automations" }); + expect(heading).toBeInTheDocument(); + const automationsMain = heading.closest("main"); + expect(automationsMain).not.toBeNull(); + expect(within(automationsMain as HTMLElement).queryByText("Settings")).not.toBeInTheDocument(); expect(screen.getAllByText("Daily repo check").length).toBeGreaterThanOrEqual(1); expect(screen.getAllByText("Check the repo status").length).toBeGreaterThanOrEqual(1); expect(screen.getAllByText("Release prep").length).toBeGreaterThanOrEqual(1); @@ -586,7 +590,11 @@ describe("App layout", () => { const sidebar = screen.getByRole("navigation", { name: "侧边栏导航" }); fireEvent.click(within(sidebar).getByRole("button", { name: "自动任务" })); - expect(await screen.findByRole("heading", { name: "自动任务" })).toBeInTheDocument(); + const heading = await screen.findByRole("heading", { name: "自动任务" }); + expect(heading).toBeInTheDocument(); + const automationsMain = heading.closest("main"); + expect(automationsMain).not.toBeNull(); + expect(within(automationsMain as HTMLElement).queryByText("设置")).not.toBeInTheDocument(); expect(screen.getByText("任务队列")).toBeInTheDocument(); expect(screen.getAllByText("每日检查").length).toBeGreaterThanOrEqual(1); expect(screen.getAllByText("检查仓库状态").length).toBeGreaterThanOrEqual(1); diff --git a/webui/src/tests/settings-view.test.tsx b/webui/src/tests/settings-view.test.tsx index eac0b9c6..85a35b95 100644 --- a/webui/src/tests/settings-view.test.tsx +++ b/webui/src/tests/settings-view.test.tsx @@ -159,8 +159,9 @@ const installedAnyGen = { function renderSettingsView( options: { - initialSection?: "overview" | "apps" | "advanced" | "models"; + initialSection?: "overview" | "apps" | "automations" | "advanced" | "models"; initialSettings?: SettingsPayload; + showSidebar?: boolean; onSettingsChange?: (payload: SettingsPayload) => void; onNativeEngineRestart?: () => Promise; } = {}, @@ -171,6 +172,7 @@ function renderSettingsView( theme="light" initialSection={options.initialSection ?? "apps"} initialSettings={options.initialSettings} + showSidebar={options.showSidebar} onToggleTheme={() => {}} onBackToChat={() => {}} onModelNameChange={() => {}} @@ -187,6 +189,25 @@ describe("SettingsView Apps catalog", () => { vi.unstubAllGlobals(); }); + it("does not show the Settings kicker on the standalone Automations surface", async () => { + vi.stubGlobal("fetch", vi.fn(async (input: RequestInfo | URL) => { + const url = String(input); + if (url === "/api/settings") return jsonResponse(settingsPayload()); + if (url === "/api/webui/automations") return jsonResponse({ jobs: [] }); + return jsonResponse({}); + })); + + renderSettingsView({ + initialSection: "automations", + initialSettings: settingsPayload(), + showSidebar: false, + }); + + expect(screen.getByRole("heading", { name: "Automations" })).toBeInTheDocument(); + expect(await screen.findByText("No automations yet.")).toBeInTheDocument(); + expect(screen.queryByText("Settings")).not.toBeInTheDocument(); + }); + it("shows a visible uninstall button for installed CLI apps and calls uninstall", async () => { const fetchMock = vi.fn(async (input: RequestInfo | URL) => { const url = String(input);