Skip to content

Changing logic for connect button to MCP #155

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Hubert-Szczepanski-SAP
Copy link
Contributor

What this PR does / why we need it:

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

@andreaskienle andreaskienle requested a review from Copilot June 27, 2025 06:34
Copy link
Contributor

@Copilot 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 changes the logic for the connect button in ControlPlaneCard to use MCP-specific health conditions.

  • Introduces a helper function (canConnectToMCP) to check for APIServer, Authentication, and Authorization health.
  • Propagates this check to set the disabled state of the ConnectButton.

@@ -106,7 +123,7 @@ export function ControlPlaneCard({
resourceType={'managedcontrolplanes'}
/>
<ConnectButton
disabled={controlPlane.status?.status !== ReadyStatus.Ready}
disabled={isConnectButtonEnabled}
Copy link
Preview

Copilot AI Jun 27, 2025

Choose a reason for hiding this comment

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

It appears that 'isConnectButtonEnabled' represents the connectable status; however, passing it directly to the 'disabled' prop will disable the button when the control plane is connectable. Consider inverting the condition (e.g., disabled={!isConnectButtonEnabled}) to align with the intended behavior.

Suggested change
disabled={isConnectButtonEnabled}
disabled={!isConnectButtonEnabled}

Copilot uses AI. Check for mistakes.

Copy link
Contributor

@andreaskienle andreaskienle Jun 27, 2025

Choose a reason for hiding this comment

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

Can you check @Hubert-Szczepanski-SAP?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I checked and made corrections. I made mistake in testing, because we receive status which is "True" - it's not boolean, it's string, so it was working for me in this scenario. Now it should be ok

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, maybe we could add a small unit test here to make it clearer what’s happening. This would also help us getting more into the habit of writing tests 😅💪.

We could move the ⁠canConnectToMCP function to ⁠controlPlanes.ts and test it in isolation. Should be pretty straightforward. No need to write a Cypress test, just a "normal" unit test.

Here's a similar example we could use as reference.

What are your thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a very good idea. I'll write some tests :)

changing condition
@Hubert-Szczepanski-SAP Hubert-Szczepanski-SAP force-pushed the feat/changing-logic-for-mcp-connect-button branch from 00d0e06 to 25e5b22 Compare June 27, 2025 08:10
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