Skip to content

Commit 31f683d

Browse files
committed
fix
1 parent 7ea2c60 commit 31f683d

File tree

9 files changed

+77
-30
lines changed

9 files changed

+77
-30
lines changed

public/locales/en.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,11 @@
515515
"details": "You must be a member to access this Managed Control Plane. Please contact {{createdBy}} to request access.",
516516
"administrator": "an administrator"
517517
},
518-
"backToWorkspaces": "Back to workspaces"
518+
"customIdp": {
519+
"title": "Access Denied",
520+
"details": "non-default Identity Providers are not supported yet"
521+
},
522+
"backToWorkspaces": "Back to Workspaces"
519523
}
520524
}
521525
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.root {
2+
display: flex;
3+
align-items: center;
4+
justify-content: center;
5+
flex-direction: column;
6+
width: 100%;
7+
height: 100%;
8+
}
9+
10+
.textAlignCenter {
11+
text-align: center;
12+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import type { PropsWithChildren, ReactNode, CSSProperties } from 'react';
2+
import cx from 'clsx';
3+
import styles from './Center.module.css';
4+
5+
export type CenterProps = PropsWithChildren<{
6+
className?: string;
7+
style?: CSSProperties;
8+
textAlignCenter?: boolean;
9+
}>;
10+
11+
export const Center = ({ children, className, style, textAlignCenter = true }: CenterProps): ReactNode => {
12+
const classes = cx(styles.root, { [styles.textAlignCenter]: textAlignCenter }, className);
13+
14+
return (
15+
<div className={classes} style={style}>
16+
{children}
17+
</div>
18+
);
19+
};

src/components/Ui/NotFoundBanner/NotFoundBanner.module.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
.button {
77
margin-inline: auto;
88
margin-block: 2rem;
9-
}
9+
}

src/components/Ui/NotFoundBanner/NotFoundBanner.tsx

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ import IllustrationMessageType from '@ui5/webcomponents-fiori/dist/types/Illustr
33
import { Trans, useTranslation } from 'react-i18next';
44

55
import styles from './NotFoundBanner.module.css';
6-
import { Button } from '@ui5/webcomponents-react';
6+
import { Button, FlexBox } from '@ui5/webcomponents-react';
77
import { useNavigate } from 'react-router-dom';
8+
import { Center } from '../Center/Center.tsx';
89

910
export interface NotFoundBannerProps {
1011
entityType: string;
@@ -14,19 +15,21 @@ export function NotFoundBanner({ entityType }: NotFoundBannerProps) {
1415
const navigate = useNavigate();
1516

1617
return (
17-
<IllustratedBanner
18-
illustrationName={IllustrationMessageType.PageNotFound}
19-
title={t('NotFoundBanner.titleMessage', { entityType })}
20-
subtitle={
21-
<div className={styles.subtitleContainer}>
22-
<span>
23-
<Trans i18nKey="NotFoundBanner.subtitleMessage" values={{ entityType }} />
24-
</span>
25-
<Button className={styles.button} onClick={() => navigate('/')}>
26-
{t('NotFoundBanner.navigateHome')}
27-
</Button>
28-
</div>
29-
}
30-
/>
18+
<Center>
19+
<IllustratedBanner
20+
illustrationName={IllustrationMessageType.PageNotFound}
21+
title={t('NotFoundBanner.titleMessage', { entityType })}
22+
subtitle={
23+
<div className={styles.subtitleContainer}>
24+
<span>
25+
<Trans i18nKey="NotFoundBanner.subtitleMessage" values={{ entityType }} />
26+
</span>
27+
<Button className={styles.button} onClick={() => navigate('/')}>
28+
{t('NotFoundBanner.navigateHome')}
29+
</Button>
30+
</div>
31+
}
32+
/>
33+
</Center>
3134
);
3235
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,6 @@ export const ControlPlane = (
100100
): Resource<ControlPlaneType> => {
101101
return {
102102
path: `/apis/core.openmcp.cloud/v1alpha1/namespaces/project-${projectName}--ws-${workspaceName}/managedcontrolplanes/${controlPlaneName}`,
103-
jq: '{ spec: .spec | {components, authorization}, metadata: .metadata | {name, namespace, creationTimestamp, annotations}, status: { conditions: [.status.conditions[] | {type: .type, status: .status, message: .message, reason: .reason, lastTransitionTime: .lastTransitionTime}], access: .status.components.authentication.access, status: .status.status }}',
103+
jq: '{ spec: .spec | {components, authorization, authentication}, metadata: .metadata | {name, namespace, creationTimestamp, annotations}, status: { conditions: [.status.conditions[] | {type: .type, status: .status, message: .message, reason: .reason, lastTransitionTime: .lastTransitionTime}], access: .status.components.authentication.access, status: .status.status }}',
104104
};
105105
};

src/lib/shared/McpContext.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,7 @@ function RequireDownstreamLogin(props: { children?: ReactNode }) {
7272

7373
export function WithinManagedControlPlane({ children }: { children?: ReactNode }) {
7474
const auth = useAuthMcp();
75-
const { isMcpAdmin } = useGetMcpUserRights();
76-
console.log('isMcpAdmin');
77-
console.log(isMcpAdmin);
75+
7876
if (auth.isLoading) {
7977
return <BusyIndicator active />;
8078
}

src/spaces/mcp/authorization/ManagedControlPlaneAuthorization.module.css

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/spaces/mcp/authorization/ManagedControlPlaneAuthorization.tsx

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ import { useGetMcpUserRights } from './useGetMcpUserRights.ts';
33
import { useTranslation } from 'react-i18next';
44

55
import IllustratedError from '../../../components/Shared/IllustratedError.tsx';
6-
import { Button, FlexBox } from '@ui5/webcomponents-react';
6+
import { Button } from '@ui5/webcomponents-react';
77
import { ControlPlaneType } from '../../../lib/api/types/crate/controlPlanes.ts';
88
import { generatePath, useNavigate, useParams } from 'react-router-dom';
99
import { Routes } from '../../../Routes.ts';
10-
import styles from './ManagedControlPlaneAuthorization.module.css';
10+
11+
import { Center } from '../../../components/Ui/Center/Center.tsx';
1112

1213
export interface ManagedControlPlaneAuthorizationProps {
1314
mcp: ControlPlaneType;
@@ -29,18 +30,32 @@ export const ManagedControlPlaneAuthorization = ({ children, mcp }: ManagedContr
2930
const createdBy =
3031
mcp?.metadata?.annotations?.['openmcp.cloud/created-by']?.split(':')[1] ||
3132
t('mcp.authorization.accessDenied.administrator');
33+
const isSystemIdentityProviderEnabled = Boolean(mcp.spec?.authentication?.enableSystemIdentityProvider);
3234
const { isMcpMember } = useGetMcpUserRights();
35+
if (!isSystemIdentityProviderEnabled)
36+
return (
37+
<Center>
38+
<IllustratedError
39+
title={t('mcp.authorization.customIdp.title')}
40+
details={t('mcp.authorization.customIdp.details')}
41+
/>
42+
<Button design={'Default'} icon={'navigation-left-arrow'} onClick={onBack}>
43+
{t('mcp.authorization.backToWorkspaces')}
44+
</Button>
45+
</Center>
46+
);
47+
3348
if (!isMcpMember)
3449
return (
35-
<FlexBox justifyContent={'Center'} alignItems={'Center'} direction={'Column'} className={styles.container}>
50+
<Center>
3651
<IllustratedError
3752
title={t('mcp.authorization.accessDenied.title')}
3853
details={t('mcp.authorization.accessDenied.details', { createdBy })}
3954
/>
40-
<Button design={'Emphasized'} icon={'navigation-left-arrow'} onClick={onBack}>
55+
<Button design={'Default'} icon={'navigation-left-arrow'} onClick={onBack}>
4156
{t('mcp.authorization.backToWorkspaces')}
4257
</Button>
43-
</FlexBox>
58+
</Center>
4459
);
4560

4661
return <>{children}</>;

0 commit comments

Comments
 (0)