Skip to content

Commit 7744000

Browse files
use spec.authentication to determine system IDP
1 parent a84b9ff commit 7744000

File tree

2 files changed

+18
-28
lines changed

2 files changed

+18
-28
lines changed

src/components/ControlPlanes/ControlPlaneCard/ControlPlaneCard.tsx

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -64,29 +64,16 @@ export function ControlPlaneCard({
6464
const name = controlPlane.metadata.name;
6565
const namespace = controlPlane.metadata.namespace;
6666

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-
7867
const isSystemIdentityProviderEnabled =
79-
// @ts-ignore
80-
!!controlPlaneConfig.data?.spec?.authentication
68+
!!controlPlane.spec?.authentication
8169
?.enableSystemIdentityProvider;
8270

8371
const isConnectButtonEnabled =
8472
canConnectToMCP(controlPlane) &&
85-
isSystemIdentityProviderEnabled &&
86-
!controlPlaneConfig.isLoading;
73+
isSystemIdentityProviderEnabled
8774

8875
const showWarningBecauseOfDisabledSystemIdentityProvider =
89-
!controlPlaneConfig.isLoading && !isSystemIdentityProviderEnabled;
76+
!isSystemIdentityProviderEnabled;
9077

9178
return (
9279
<>

src/lib/api/types/crate/controlPlanes.ts

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@ export interface Metadata {
1010
export interface ControlPlaneType {
1111
metadata: Metadata;
1212
spec:
13-
| {
14-
components: ControlPlaneComponentsType;
15-
}
16-
| undefined;
13+
| {
14+
authentication: {
15+
enableSystemIdentityProvider?: boolean;
16+
};
17+
components: ControlPlaneComponentsType;
18+
}
19+
| undefined;
1720
status: ControlPlaneStatusType | undefined;
1821
}
1922

@@ -33,13 +36,13 @@ export interface ControlPlaneStatusType {
3336
status: ReadyStatus;
3437
conditions: ControlPlaneStatusCondition[];
3538
access:
36-
| {
37-
key: string | undefined;
38-
name: string | undefined;
39-
namespace: string | undefined;
40-
kubeconfig: string | undefined;
41-
}
42-
| undefined;
39+
| {
40+
key: string | undefined;
41+
name: string | undefined;
42+
namespace: string | undefined;
43+
kubeconfig: string | undefined;
44+
}
45+
| undefined;
4346
}
4447

4548
export interface ControlPlaneStatusCondition {
@@ -65,7 +68,7 @@ export const ListControlPlanes = (
6568
projectName === null
6669
? null
6770
: `/apis/core.openmcp.cloud/v1alpha1/namespaces/project-${projectName}--ws-${workspaceName}/managedcontrolplanes`,
68-
jq: '[.items[] | {metadata: .metadata | {name, namespace}, status: { conditions: [.status.conditions[] | {type: .type, status: .status, message: .message, reason: .reason, lastTransitionTime: .lastTransitionTime}], access: .status.components.authentication.access, status: .status.status } }]',
71+
jq: '[.items[] |{ spec: .spec | {authentication} }, {metadata: .metadata | {name, namespace}, status: { conditions: [.status.conditions[] | {type: .type, status: .status, message: .message, reason: .reason, lastTransitionTime: .lastTransitionTime}], access: .status.components.authentication.access, status: .status.status } }]',
6972
};
7073
};
7174

0 commit comments

Comments
 (0)