Skip to content

Conversation

@andreaskienle
Copy link
Contributor

@andreaskienle andreaskienle commented Oct 29, 2025

This PR includes tests covering:

  • Creating an MCP with and without components
  • Updating an existing MCP with and without components

It also removes the ⁠isOnMcpPage parameter, which doesn’t appear to be necessary as far as I could see. That said, please feel free to validate the flows on your end to confirm there aren’t any edge cases I’ve missed. 🙏

Copilot AI review requested due to automatic review settings October 29, 2025 11:37
@andreaskienle andreaskienle marked this pull request as draft October 29, 2025 11:37
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 refactors how managed control plane components are queried and how the update mutation is handled by extracting logic into reusable hooks. The main changes centralize API call logic and remove the now-obsolete isOnMcpPage flag that was previously used to conditionally enable API requests.

  • Extracted component query logic into a dedicated useComponentsQuery hook
  • Extracted MCP update logic into a dedicated useUpdateManagedControlPlane hook
  • Removed the isOnMcpPage parameter from the wizard chain, which is no longer needed since the hooks handle API calls unconditionally
  • Added comprehensive test coverage for the new hooks and edit scenarios

Reviewed Changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/hooks/useUpdateManagedControlPlane.ts New hook that encapsulates the update MCP mutation logic with proper crate configuration
src/hooks/useUpdateManagedControlPlane.spec.ts Test coverage for the update MCP hook verifying correct PATCH requests
src/hooks/useCreateManagedControlPlane.ts New hook that encapsulates the create MCP mutation logic
src/hooks/useCreateManagedControlPlane.spec.ts Updated import path from .tsx to .ts extension
src/hooks/useComponentsQuery.ts New hook that encapsulates component fetching with crate configuration
src/components/Wizards/CreateManagedControlPlane/useComponentsSelectionData.ts Refactored to use the new useComponentsQuery hook instead of directly calling useApiResource
src/components/Wizards/CreateManagedControlPlane/EditManagedControlPlaneWizardDataLoader.tsx Removed isOnMcpPage prop which is no longer needed
src/components/Wizards/CreateManagedControlPlane/CreateManagedControlPlaneWizardContainer.tsx Integrated new hooks and removed isOnMcpPage prop throughout
src/components/Wizards/CreateManagedControlPlane/CreateManagedControlPlaneWizardContainer.cy.tsx Added comprehensive test coverage for create and edit scenarios
src/components/ControlPlanes/List/ControlPlaneListWorkspaceGridTile.tsx Removed unnecessary isEditMode={false} prop
src/spaces/mcp/pages/McpPage.tsx Removed isOnMcpPage prop from wizard component

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@andreaskienle andreaskienle marked this pull request as ready for review October 29, 2025 11:48
Copy link
Contributor

@lucasgoral lucasgoral left a comment

Choose a reason for hiding this comment

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

Basic user flow is covered nicely and it has proper assertion. Good job!

@andreaskienle andreaskienle merged commit b9a20e2 into main Oct 31, 2025
11 checks passed
@andreaskienle andreaskienle deleted the tests-mcp branch October 31, 2025 09:14
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.

3 participants