diff --git a/.gitignore b/.gitignore index e044fc32a7..36873ab2ee 100644 --- a/.gitignore +++ b/.gitignore @@ -48,4 +48,4 @@ logs .roo/mcp.json # Qdrant -qdrant_storage/ +qdrant_storage/ \ No newline at end of file diff --git a/webview-ui/src/components/settings/SettingsView.tsx b/webview-ui/src/components/settings/SettingsView.tsx index f680f3e5fe..e7b0b642db 100644 --- a/webview-ui/src/components/settings/SettingsView.tsx +++ b/webview-ui/src/components/settings/SettingsView.tsx @@ -609,6 +609,11 @@ const SettingsView = forwardRef(({ onDone, t apiConfiguration, }) prevApiConfigName.current = newName + // Trigger change detection for profile rename + prevApiConfigName.current = newName + // Trigger change detection for profile rename to enable save button + // This ensures users can persist renamed profiles + setChangeDetected(true) }} onUpsertConfig={(configName: string) => vscode.postMessage({ diff --git a/webview-ui/src/components/settings/__tests__/SettingsView.spec.tsx b/webview-ui/src/components/settings/__tests__/SettingsView.spec.tsx index 694ff174a7..d75b5c8b24 100644 --- a/webview-ui/src/components/settings/__tests__/SettingsView.spec.tsx +++ b/webview-ui/src/components/settings/__tests__/SettingsView.spec.tsx @@ -1,3 +1,4 @@ +import React from "react" import { render, screen, fireEvent } from "@/utils/test-utils" import { QueryClient, QueryClientProvider } from "@tanstack/react-query" @@ -8,13 +9,51 @@ import SettingsView from "../SettingsView" vi.mock("@src/utils/vscode", () => ({ vscode: { postMessage: vi.fn() } })) -vi.mock("../ApiConfigManager", () => ({ - __esModule: true, - default: ({ currentApiConfigName }: any) => ( +const MockApiConfigManager = ({ currentApiConfigName, onRenameConfig }: any) => { + const [isRenaming, setIsRenaming] = React.useState(false) + const [newName, setNewName] = React.useState("") + + const handleRename = () => { + if (isRenaming && newName.trim() && onRenameConfig) { + onRenameConfig(currentApiConfigName || "defaultProfile", newName.trim()) + setIsRenaming(false) + setNewName("") + } else { + setIsRenaming(true) + setNewName(currentApiConfigName || "defaultProfile") + } + } + + return (
Current config: {currentApiConfigName} + {isRenaming ? ( +
+ setNewName(e.target.value)} + placeholder="Enter new profile name" + /> + + +
+ ) : ( + + )}
- ), + ) +} + +vi.mock("../ApiConfigManager", () => ({ + __esModule: true, + default: MockApiConfigManager, })) vi.mock("@vscode/webview-ui-toolkit/react", () => ({ @@ -135,8 +174,13 @@ vi.mock("@/components/ui", () => ({ data-testid={dataTestId} /> ), - Button: ({ children, onClick, variant, className, "data-testid": dataTestId }: any) => ( - ),