-
Notifications
You must be signed in to change notification settings - Fork 3
Edit MCP - Crossplane providers: Handle prefix correctly and do not drop unknown providers #398
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
Conversation
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.
Pull request overview
This PR refactors the hook that handles Crossplane provider selection to correctly handle provider naming prefixes and prevent dropping unknown providers. The changes address the issue where providers can be stored in the API without the provider- prefix (e.g., btp) while the component list includes them with the prefix (e.g., provider-btp).
Key changes:
- Added
originalNamefield to track the provider name as stored in the API - Refactored provider matching logic to handle both prefixed and non-prefixed provider names
- Preserved unknown/custom providers that aren't in the available components list
- Extracted complex logic into well-tested helper functions for better maintainability
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/lib/api/types/crate/createManagedControlPlane.ts |
Added originalName field to ComponentsListItem interface and updated provider mapping to use it for API requests |
src/components/Wizards/CreateManagedControlPlane/useComponentsSelectionData.ts |
Refactored the hook by extracting helper functions for provider prefix handling, component mapping, validation, and custom provider addition |
src/components/Wizards/CreateManagedControlPlane/useComponentsSelectionData.spec.ts |
Added comprehensive test coverage for all new helper functions and edge cases |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/components/Wizards/CreateManagedControlPlane/useComponentsSelectionData.ts
Outdated
Show resolved
Hide resolved
src/components/Wizards/CreateManagedControlPlane/useComponentsSelectionData.spec.ts
Show resolved
Hide resolved
src/components/Wizards/CreateManagedControlPlane/useComponentsSelectionData.ts
Outdated
Show resolved
Hide resolved
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.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
What this PR does / why we need it:
Edit MCP - Crossplane providers: Handle prefix correctly and do not drop unknown providers. Refactored hook that handles it