- 
        Couldn't load subscription status. 
- Fork 3
Remaping Components names of MCP mapping fix #335
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 addresses inconsistency in MCP component naming between frontend and backend by implementing bidirectional name mapping. The changes ensure components are properly renamed when sending data to the backend and remapped back to original names when receiving data.
Key Changes
- Refactored component name mapping from a simple key-value object to an array of mapping objects with explicit originalNameandreplaceNamefields
- Added remapComponentsKeysToOriginalNamesfunction to reverse the mapping when loading existing MCP data for editing
- Applied the mapping logic in getSelectedComponentsto ensure correct component names are used when filtering selected components
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description | 
|---|---|
| src/lib/api/types/crate/createManagedControlPlane.ts | Restructured component name mapping from Record to array format and updated mapping logic to use find() method | 
| src/components/Wizards/CreateManagedControlPlane/CreateManagedControlPlaneWizardContainer.tsx | Added remapping function to convert backend component names back to original names when initializing edit/duplicate modes | 
| src/components/ComponentsSelection/ComponentsSelectionContainer.tsx | Refactored getSelectedComponents to apply name remapping and simplified filtering logic | 
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
        
          
                src/components/Wizards/CreateManagedControlPlane/CreateManagedControlPlaneWizardContainer.tsx
          
            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.
lgtm
What this PR does / why we need it:
Due to inconsistency of two MCP components in backend we need to remap the names when sending and getting data from the backend.