feat(webui): expand and organize settings with autosave (#5704)
* feat(webui): expand settings with autosave and live configuration * feat(memory): add long-term memory and idle compaction switches * refactor(webui): clarify settings hierarchy and align compact controls * refactor(webui): keep only memory consolidation in memory settings * refactor(webui): defer runtime changes until explicit restart * refactor(webui): remove default workspace setting * fix(webui): align model lists and remove preset counters * fix(i18n): use natural Chinese labels for chat platforms * fix(i18n): shorten chat settings navigation label * fix(webui): match settings navigation icons to text size * refactor(webui): remove redundant settings sidebar heading * refactor(webui): use icon-only back navigation in settings * fix(webui): remove back arrow hover hint * refactor(webui): remove redundant overview details * refactor(webui): hide secondary descriptions in settings rows * style(webui): replace settings dividers with rounded highlights * refactor(webui): remove redundant model list subtitles and badges * fix(i18n): restore chat translation namespace boundaries * fix(i18n): complete settings translations for all locales * fix(webui): reveal settings only for enabled capabilities * fix(webui): consolidate capabilities and isolate settings feedback * fix(webui): clear restart notices when settings are reverted * fix(webui): anchor restart controls in settings sidebar * fix(webui): shorten sidebar restart label * fix(webui): align settings spacing and control sizes * refactor(webui): unify settings dialogs and interaction feedback * fix(webui): keep settings option groups on one line without scrolling * refactor(webui): align settings spacing and sidebar icon proportions * style(webui): match main sidebar typography to settings * style(webui): use monospace for sidebar session handles * refactor(webui): remove heartbeat configuration from automations * feat(webui): expose configuration actions beside capability toggles * style(webui): remove ellipsis from configuration actions * refactor(webui): remove redundant app configuration controls * feat(webui): add compact sidebar navigation and shortcut hints * fix(webui): synchronize npm dependency lockfile * test(webui): align input radius expectation with pill styling * feat(webui): show daily token usage and cache breakdown * feat(webui): add model usage details and cache hit rates * feat(webui): chart daily token usage by model * refactor(webui): simplify usage details and model labels * fix(webui): hide usage dialog date range * refactor(webui): consolidate model usage into chart legends * fix(webui): enforce restart choices and correct settings test route * fix(webui): polish settings localization and controls * fix(webui): avoid repeated usage legend labels * fix(webui): skip empty usage columns in keyboard navigation * test(webui): assert settings behavior positively * feat(webui): refine sidebar navigation and add drag resizing * style(webui): soften sidebar scroll edges * style(webui): harmonize sidebar typography and text colors * feat(webui): move channels to the main sidebar * style(webui): remove dotted underlines from settings hints * fix(webui): unify tooltip hover delay * fix(webui): support Seatbelt sandbox settings * fix(webui): remove unused appearance density preference * fix(webui): align settings input values consistently * style(webui): group compact settings controls before inputs * feat(webui): edit multiline settings in compact dialogs * feat(webui): add continuous settings scrolling with gentle snapping * Revert "feat(webui): add continuous settings scrolling with gentle snapping" This reverts commit f0978c261a53c844185eeab4d0c3190fbd196fe6.
This commit is contained in:
1 parent
20f115bf46
commit
8ea683679d
244 files changed
+6929
-3900
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { act, fireEvent, screen, waitFor } from "@testing-library/react";
|
||||
import { act, fireEvent, screen, waitFor, within } from "@testing-library/react";
|
||||
import { expect, it, vi } from "vitest";
|
||||
import { installedMcpPresetsFromPayload } from "@/lib/mcp-preset-events";
|
||||
import { requestMutationMock, jsonResponse, settingsPayload, renderSettingsView, installSettingsViewTestHooks } from "@/tests/settings-test-utils";
|
||||
@@ -41,6 +41,61 @@ const agentPlugin = {
|
||||
describe("Settings system domains", () => {
|
||||
installSettingsViewTestHooks();
|
||||
|
||||
it("asks before leaving with pending changes and lets the user restart later", () => {
|
||||
const leave = vi.fn();
|
||||
renderSettingsView({ initialSection: "runtime", initialSettings: {
|
||||
...settingsPayload(), requires_restart: true, restart_required_sections: ["runtime"],
|
||||
}, onBackToChat: leave });
|
||||
fireEvent.click(screen.getByRole("button", { name: "Back to chat" }));
|
||||
const dialog = screen.getByRole("dialog", { name: "Restart before leaving?" });
|
||||
expect(leave).not.toHaveBeenCalled();
|
||||
expect(within(dialog).getByText("Your changes are saved. Restart to apply them.")).toBeVisible();
|
||||
expect(within(dialog).getAllByRole("button").map((button) => button.textContent)).toEqual([
|
||||
"Restart later", "Restart",
|
||||
]);
|
||||
fireEvent.click(within(dialog).getByRole("button", { name: "Restart later" }));
|
||||
expect(leave).toHaveBeenCalledTimes(1);
|
||||
expect(requestMutationMock).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("restarts from the exit prompt", () => {
|
||||
const restart = vi.fn();
|
||||
renderSettingsView({ initialSection: "runtime", initialSettings: {
|
||||
...settingsPayload(), requires_restart: true,
|
||||
}, onRestart: restart });
|
||||
fireEvent.click(screen.getByRole("button", { name: "Back to chat" }));
|
||||
fireEvent.click(within(screen.getByRole("dialog")).getByRole("button", { name: "Restart", exact: true }));
|
||||
expect(restart).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("leaves directly when no restart is pending", () => {
|
||||
const leave = vi.fn();
|
||||
renderSettingsView({ initialSection: "runtime", initialSettings: settingsPayload(), onBackToChat: leave });
|
||||
fireEvent.click(screen.getByRole("button", { name: "Back to chat" }));
|
||||
expect(leave).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("keeps one restart action and pending notice in the sidebar across settings pages", async () => {
|
||||
renderSettingsView({
|
||||
initialSection: "runtime",
|
||||
initialSettings: {
|
||||
...settingsPayload(),
|
||||
requires_restart: true,
|
||||
restart_required_sections: ["runtime", "image"],
|
||||
},
|
||||
});
|
||||
const sidebar = screen.getByRole("complementary");
|
||||
const restart = within(sidebar).getByRole("button", { name: "Restart", exact: true });
|
||||
for (const section of ["Capabilities", "Models", "Advanced", "System"]) {
|
||||
fireEvent.click(within(sidebar).getByRole("button", { name: section, exact: true }));
|
||||
await waitFor(() => {
|
||||
expect(screen.getAllByRole("button", { name: "Restart", exact: true })).toEqual([restart]);
|
||||
expect(screen.getAllByText("Saved. Restart to apply changes.")).toHaveLength(1);
|
||||
expect(within(sidebar).getByText("Saved. Restart to apply changes.")).toBeVisible();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
it("keeps enabled Agent Plugins out of MCP composer attachments", () => {
|
||||
const enabled = { ...agentPlugin, enabled: true, available: true, status: "enabled" };
|
||||
expect(installedMcpPresetsFromPayload({ presets: [enabled], installed_count: 1 })).toEqual([]);
|
||||
@@ -109,10 +164,6 @@ describe("Settings system domains", () => {
|
||||
|
||||
expect(screen.getByRole("heading", { name: "Automations" })).toBeInTheDocument();
|
||||
expect(await screen.findByText("No automations yet.")).toBeInTheDocument();
|
||||
expect(screen.queryByText("Settings")).not.toBeInTheDocument();
|
||||
expect(
|
||||
screen.queryByPlaceholderText("Search task, message, linked chat, or schedule"),
|
||||
).not.toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole("button", { name: "Open a chat" }));
|
||||
expect(onBackToChat).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
@@ -262,7 +313,6 @@ describe("Settings system domains", () => {
|
||||
|
||||
renderSettingsView();
|
||||
|
||||
expect(screen.queryByRole("heading", { name: "Apps" })).not.toBeInTheDocument();
|
||||
expect(await screen.findByText("AnyGen")).toBeInTheDocument();
|
||||
const uninstall = screen.getByRole("button", { name: "Uninstall app" });
|
||||
|
||||
@@ -279,7 +329,6 @@ describe("Settings system domains", () => {
|
||||
|
||||
fireEvent.click(screen.getByRole("button", { name: "Dismiss" }));
|
||||
|
||||
expect(screen.queryByText("Uninstalled CLI for AnyGen.")).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("keeps runtime dependencies out of Apps and explains chat mentions", async () => {
|
||||
@@ -319,15 +368,9 @@ describe("Settings system domains", () => {
|
||||
renderSettingsView({ initialSection: "apps" });
|
||||
|
||||
expect(await screen.findByText("AnyGen")).toBeInTheDocument();
|
||||
expect(
|
||||
screen.queryByText("Add tools to nanobot, then @ them in chat."),
|
||||
).not.toBeInTheDocument();
|
||||
expect(screen.getByRole("button", { name: "Ready" })).toHaveAttribute("aria-pressed", "false");
|
||||
expect(screen.getByRole("button", { name: "Apps" })).toHaveAttribute("aria-pressed", "true");
|
||||
expect(screen.getByRole("button", { name: "MCP" })).toBeInTheDocument();
|
||||
expect(screen.queryByRole("button", { name: "Plugins" })).not.toBeInTheDocument();
|
||||
expect(screen.queryByText("Api")).not.toBeInTheDocument();
|
||||
expect(screen.queryByText("0 ready")).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("shows nanobot optional features and enables one", async () => {
|
||||
@@ -402,10 +445,10 @@ describe("Settings system domains", () => {
|
||||
renderSettingsView({ initialSection: "channels" });
|
||||
|
||||
const matrixRow = await screen.findByRole("button", { name: "View Matrix settings" });
|
||||
expect(matrixRow).toHaveAttribute("aria-pressed", "true");
|
||||
expect(screen.getAllByText("Matrix")).toHaveLength(2);
|
||||
expect(screen.getAllByText("Use nanobot from Matrix rooms.")).toHaveLength(2);
|
||||
expect(screen.queryByText(/Enabling Nanobot features may install Python packages/)).not.toBeInTheDocument();
|
||||
expect(matrixRow).toHaveAttribute("aria-haspopup", "dialog");
|
||||
fireEvent.click(matrixRow);
|
||||
expect(screen.getByRole("heading", { name: "Matrix", exact: true })).toBeVisible();
|
||||
fireEvent.click(screen.getByRole("button", { name: "Close", exact: true }));
|
||||
fireEvent.click(screen.getByRole("switch", { name: "Matrix channel" }));
|
||||
expect(screen.getByRole("dialog", { name: "Install support for Matrix?" })).toBeInTheDocument();
|
||||
expect(screen.getByText("nanobot will add what Matrix needs, then turn it on. Continue?")).toBeInTheDocument();
|
||||
@@ -422,15 +465,14 @@ describe("Settings system domains", () => {
|
||||
await waitFor(() =>
|
||||
expect(screen.getByRole("switch", { name: "Matrix channel" })).toHaveAttribute("aria-checked", "true"),
|
||||
);
|
||||
expect(screen.queryByText("Enabled channel 'matrix'")).not.toBeInTheDocument();
|
||||
expect(screen.queryByText("Restart nanobot to apply updated channel support.")).not.toBeInTheDocument();
|
||||
expect(screen.getAllByText("On").length).toBeGreaterThan(0);
|
||||
|
||||
fireEvent.click(screen.getByRole("button", { name: "View Matrix settings" }));
|
||||
expect(screen.getByLabelText("Homeserver")).toBeInTheDocument();
|
||||
expect(screen.getByLabelText("User ID")).toBeInTheDocument();
|
||||
expect(screen.getByLabelText("Device ID")).toBeInTheDocument();
|
||||
expect(screen.queryByText("channels.matrix.homeserver")).not.toBeInTheDocument();
|
||||
|
||||
fireEvent.click(screen.getByRole("button", { name: "Close", exact: true }));
|
||||
fireEvent.click(screen.getByRole("switch", { name: "Matrix channel" }));
|
||||
|
||||
await waitFor(() =>
|
||||
@@ -443,6 +485,5 @@ describe("Settings system domains", () => {
|
||||
await waitFor(() =>
|
||||
expect(screen.getByRole("switch", { name: "Matrix channel" })).toHaveAttribute("aria-checked", "false"),
|
||||
);
|
||||
expect(screen.queryByText("Disabled channel 'matrix'")).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user