File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
src/components/ControlPlanes/ControlPlaneCard Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import MCPHealthPopoverButton from '../../ControlPlane/MCPHealthPopoverButton.ts
1313import styles from './ControlPlaneCard.module.css' ;
1414import { KubectlDeleteMcp } from '../../Dialogs/KubectlCommandInfo/Controllers/KubectlDeleteMcp.tsx' ;
1515import {
16+ ControlPlaneType ,
1617 ListControlPlanesType ,
1718 ReadyStatus ,
1819} from '../../../lib/api/types/crate/controlPlanes.ts' ;
@@ -59,6 +60,22 @@ export function ControlPlaneCard({
5960 const name = controlPlane . metadata . name ;
6061 const namespace = controlPlane . metadata . namespace ;
6162
63+ const canConnectToMCP = ( controlPlane : ControlPlaneType ) : boolean => {
64+ const conditions = controlPlane . status ?. conditions ?? [ ] ;
65+
66+ return [
67+ 'APIServerHealthy' ,
68+ 'AuthenticationHealthy' ,
69+ 'AuthorizationHealthy' ,
70+ ] . every ( ( type ) =>
71+ conditions . some (
72+ ( condition ) => condition . type === type && condition . status === true ,
73+ ) ,
74+ ) ;
75+ } ;
76+
77+ const isConnectButtonEnabled = canConnectToMCP ( controlPlane ) ;
78+
6279 return (
6380 < >
6481 < Card key = { `${ name } --${ namespace } ` } className = { styles . card } >
@@ -106,7 +123,7 @@ export function ControlPlaneCard({
106123 resourceType = { 'managedcontrolplanes' }
107124 />
108125 < ConnectButton
109- disabled = { controlPlane . status ?. status !== ReadyStatus . Ready }
126+ disabled = { isConnectButtonEnabled }
110127 controlPlaneName = { name }
111128 projectName = { projectName }
112129 workspaceName = { workspace . metadata . name ?? '' }
You can’t perform that action at this time.
0 commit comments