mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-08-06 17:38:35 +00:00
fix(webui): hide settings kicker on automations
This commit is contained in:
parent
167a53dc45
commit
828759d1b6
@ -1733,7 +1733,7 @@ export function SettingsView({
|
|||||||
{t("settings.backToChat")}
|
{t("settings.backToChat")}
|
||||||
</button>
|
</button>
|
||||||
) : null}
|
) : null}
|
||||||
{activeSection !== "automations" ? (
|
{showSidebar ? (
|
||||||
<p className="mb-2 text-[12px] font-normal text-muted-foreground">
|
<p className="mb-2 text-[12px] font-normal text-muted-foreground">
|
||||||
{t("settings.sidebar.title")}
|
{t("settings.sidebar.title")}
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@ -439,7 +439,11 @@ describe("App layout", () => {
|
|||||||
|
|
||||||
fireEvent.click(automationsButton);
|
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("Daily repo check").length).toBeGreaterThanOrEqual(1);
|
||||||
expect(screen.getAllByText("Check the repo status").length).toBeGreaterThanOrEqual(1);
|
expect(screen.getAllByText("Check the repo status").length).toBeGreaterThanOrEqual(1);
|
||||||
expect(screen.getAllByText("Release prep").length).toBeGreaterThanOrEqual(1);
|
expect(screen.getAllByText("Release prep").length).toBeGreaterThanOrEqual(1);
|
||||||
@ -586,7 +590,11 @@ describe("App layout", () => {
|
|||||||
const sidebar = screen.getByRole("navigation", { name: "侧边栏导航" });
|
const sidebar = screen.getByRole("navigation", { name: "侧边栏导航" });
|
||||||
fireEvent.click(within(sidebar).getByRole("button", { 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.getByText("任务队列")).toBeInTheDocument();
|
||||||
expect(screen.getAllByText("每日检查").length).toBeGreaterThanOrEqual(1);
|
expect(screen.getAllByText("每日检查").length).toBeGreaterThanOrEqual(1);
|
||||||
expect(screen.getAllByText("检查仓库状态").length).toBeGreaterThanOrEqual(1);
|
expect(screen.getAllByText("检查仓库状态").length).toBeGreaterThanOrEqual(1);
|
||||||
|
|||||||
@ -159,8 +159,9 @@ const installedAnyGen = {
|
|||||||
|
|
||||||
function renderSettingsView(
|
function renderSettingsView(
|
||||||
options: {
|
options: {
|
||||||
initialSection?: "overview" | "apps" | "advanced" | "models";
|
initialSection?: "overview" | "apps" | "automations" | "advanced" | "models";
|
||||||
initialSettings?: SettingsPayload;
|
initialSettings?: SettingsPayload;
|
||||||
|
showSidebar?: boolean;
|
||||||
onSettingsChange?: (payload: SettingsPayload) => void;
|
onSettingsChange?: (payload: SettingsPayload) => void;
|
||||||
onNativeEngineRestart?: () => Promise<string>;
|
onNativeEngineRestart?: () => Promise<string>;
|
||||||
} = {},
|
} = {},
|
||||||
@ -171,6 +172,7 @@ function renderSettingsView(
|
|||||||
theme="light"
|
theme="light"
|
||||||
initialSection={options.initialSection ?? "apps"}
|
initialSection={options.initialSection ?? "apps"}
|
||||||
initialSettings={options.initialSettings}
|
initialSettings={options.initialSettings}
|
||||||
|
showSidebar={options.showSidebar}
|
||||||
onToggleTheme={() => {}}
|
onToggleTheme={() => {}}
|
||||||
onBackToChat={() => {}}
|
onBackToChat={() => {}}
|
||||||
onModelNameChange={() => {}}
|
onModelNameChange={() => {}}
|
||||||
@ -187,6 +189,25 @@ describe("SettingsView Apps catalog", () => {
|
|||||||
vi.unstubAllGlobals();
|
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 () => {
|
it("shows a visible uninstall button for installed CLI apps and calls uninstall", async () => {
|
||||||
const fetchMock = vi.fn(async (input: RequestInfo | URL) => {
|
const fetchMock = vi.fn(async (input: RequestInfo | URL) => {
|
||||||
const url = String(input);
|
const url = String(input);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user