Skip to content

Conversation

@lucasgoral
Copy link
Contributor

@lucasgoral lucasgoral commented Oct 21, 2025

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.

@lucasgoral lucasgoral changed the title Components mapping fix Remaping Components names of MCP mapping fix Oct 22, 2025
@lucasgoral lucasgoral marked this pull request as ready for review October 23, 2025 06:53
Copilot AI review requested due to automatic review settings October 23, 2025 06:53
Copy link
Contributor

Copilot AI left a 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 originalName and replaceName fields
  • Added remapComponentsKeysToOriginalNames function to reverse the mapping when loading existing MCP data for editing
  • Applied the mapping logic in getSelectedComponents to 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.

Copy link
Contributor

@Hubert-Szczepanski-SAP Hubert-Szczepanski-SAP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@lucasgoral lucasgoral merged commit 50559a8 into main Oct 28, 2025
5 checks passed
@lucasgoral lucasgoral deleted the components-mapping-fix branch October 28, 2025 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants