@@ -17,7 +17,9 @@ import {
1717 ReadyStatus ,
1818} from '../../../lib/api/types/crate/controlPlanes.ts' ;
1919import { ListWorkspacesType } from '../../../lib/api/types/crate/listWorkspaces.ts' ;
20- import { useApiResourceMutation } from '../../../lib/api/useApiResource.ts' ;
20+ import useResource , {
21+ useApiResourceMutation ,
22+ } from '../../../lib/api/useApiResource.ts' ;
2123import {
2224 DeleteMCPResource ,
2325 DeleteMCPType ,
@@ -28,6 +30,8 @@ import {
2830import { YamlViewButtonWithLoader } from '../../Yaml/YamlViewButtonWithLoader.tsx' ;
2931import { useToast } from '../../../context/ToastContext.tsx' ;
3032import { canConnectToMCP } from '../controlPlanes.ts' ;
33+ import { ResourceObject } from '../../../lib/api/types/crate/resourceObject.ts' ;
34+ import { Infobox } from '../../Ui/Infobox/Infobox.tsx' ;
3135
3236interface Props {
3337 controlPlane : ListControlPlanesType ;
@@ -60,7 +64,29 @@ export function ControlPlaneCard({
6064 const name = controlPlane . metadata . name ;
6165 const namespace = controlPlane . metadata . namespace ;
6266
63- const isConnectButtonEnabled = canConnectToMCP ( controlPlane ) ;
67+ // Disable the Connect button if the system IdP is disabled
68+ const controlPlaneConfig = useResource (
69+ ResourceObject (
70+ controlPlane . metadata . namespace ,
71+ 'managedcontrolplanes' ,
72+ controlPlane . metadata . name ,
73+ ) ,
74+ undefined ,
75+ true ,
76+ ) ;
77+
78+ const isSystemIdentityProviderEnabled =
79+ // @ts -ignore
80+ ! ! controlPlaneConfig . data ?. spec ?. authentication
81+ ?. enableSystemIdentityProvider ;
82+
83+ const isConnectButtonEnabled =
84+ canConnectToMCP ( controlPlane ) &&
85+ isSystemIdentityProviderEnabled &&
86+ ! controlPlaneConfig . isLoading ;
87+
88+ const showWarningBecauseOfDisabledSystemIdentityProvider =
89+ ! controlPlaneConfig . isLoading && ! isSystemIdentityProviderEnabled ;
6490
6591 return (
6692 < >
@@ -108,6 +134,11 @@ export function ControlPlaneCard({
108134 resourceName = { controlPlane . metadata . name }
109135 resourceType = { 'managedcontrolplanes' }
110136 />
137+ { showWarningBecauseOfDisabledSystemIdentityProvider && (
138+ < Infobox size = "sm" variant = "warning" >
139+ { t ( 'ConnectButton.unsupportedIdP' ) }
140+ </ Infobox >
141+ ) }
111142 < ConnectButton
112143 disabled = { ! isConnectButtonEnabled }
113144 controlPlaneName = { name }
0 commit comments