-
Notifications
You must be signed in to change notification settings - Fork 2.2k
feat: Add "Apply to All Modes" button for API configuration #7901
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Added new button in ApiConfigSelector dropdown to apply current config to all modes - Implemented confirmation dialog to prevent accidental changes - Added backend handler to apply configuration across all built-in and custom modes - Added comprehensive tests for the new functionality - Added all necessary translation keys Fixes #7898
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reviewed my own code and found it surprisingly coherent for something I wrote 3 minutes ago.
// Update the webview state | ||
await provider.postStateToWebview() | ||
} catch (error) { | ||
provider.log( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error handling here could be more specific. Currently catching all errors generically - consider handling specific cases like permission errors or network issues to provide more helpful error messages to users.
const { modes } = await import("../../shared/modes") | ||
|
||
// Apply the config to all modes | ||
for (const mode of modes) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Performance consideration: This iterates through all modes sequentially. For installations with many custom modes, this could be slow. Consider using Promise.all() for parallel processing with proper error handling for individual failures.
@@ -444,4 +452,69 @@ describe("ApiConfigSelector", () => { | |||
// Search value should be maintained | |||
expect(searchInput.value).toBe("Config") | |||
}) | |||
|
|||
test("shows Apply to All Modes button and handles click with confirmation", async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good test coverage for the happy path! Consider adding edge case tests:
- What happens when the API configuration update fails?
- Behavior when there are no modes available
- Handling of network errors during the operation
These tests would help ensure robustness of the feature.
{t("prompts:apiConfiguration.confirmApplyToAllModes.title")} | ||
</AlertDialogTitle> | ||
<AlertDialogDescription> | ||
{t("prompts:apiConfiguration.confirmApplyToAllModes.description")} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UX enhancement suggestion: The confirmation dialog could show the number of modes that will be affected. This would give users better context about the scope of their action.
For example, you could pass the mode count from the parent component and display: "This will apply the configuration to 12 modes (8 built-in, 4 custom)"
This PR addresses Issue #7898 by adding a one-click "Apply to All Modes" button in the API configuration selector.
Changes Made
Frontend (UI)
Backend
Translations
Testing
Screenshots
The new button appears in the bottom bar of the API configuration dropdown, next to the settings button.
Fixes #7898
Important
Adds "Apply to All Modes" button in API configuration with confirmation dialog and backend support for applying configurations to all modes.
ApiConfigSelector.tsx
.ApiConfigSelector.spec.tsx
to cover new functionality.applyConfigToAllModes
handler inwebviewMessageHandler.ts
to apply configurations to all modes.common.json
andprompts.json
.This description was created by
for f7b2952. You can customize this summary. It will automatically update as commits are pushed.