Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ logs
.roo/mcp.json

# Qdrant
qdrant_storage/
qdrant_storage/
5 changes: 5 additions & 0 deletions webview-ui/src/components/settings/SettingsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,11 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ 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({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from "react"
import { render, screen, fireEvent } from "@/utils/test-utils"
import { QueryClient, QueryClientProvider } from "@tanstack/react-query"

Expand All @@ -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 (
<div data-testid="api-config-management">
<span>Current config: {currentApiConfigName}</span>
{isRenaming ? (
<div>
<input
data-testid="rename-input"
value={newName}
onChange={(e) => setNewName(e.target.value)}
placeholder="Enter new profile name"
/>
<button data-testid="confirm-rename-button" onClick={handleRename}>
Confirm
</button>
<button data-testid="cancel-rename-button" onClick={() => setIsRenaming(false)}>
Cancel
</button>
</div>
) : (
<button data-testid="rename-profile-button" onClick={handleRename}>
Rename Profile
</button>
)}
</div>
),
)
}

vi.mock("../ApiConfigManager", () => ({
__esModule: true,
default: MockApiConfigManager,
}))

vi.mock("@vscode/webview-ui-toolkit/react", () => ({
Expand Down Expand Up @@ -135,8 +174,13 @@ vi.mock("@/components/ui", () => ({
data-testid={dataTestId}
/>
),
Button: ({ children, onClick, variant, className, "data-testid": dataTestId }: any) => (
<button onClick={onClick} data-variant={variant} className={className} data-testid={dataTestId}>
Button: ({ children, onClick, variant, className, disabled, "data-testid": dataTestId }: any) => (
<button
onClick={onClick}
data-variant={variant}
className={className}
disabled={disabled}
data-testid={dataTestId}>
{children}
</button>
),
Expand Down
Loading