Skip to content

Commit f75d6bf

Browse files
committed
fix
1 parent 35f0b08 commit f75d6bf

File tree

3 files changed

+43
-6
lines changed

3 files changed

+43
-6
lines changed

src/components/Wizards/CreateManagedControlPlane/CreateManagedControlPlaneWizardContainer.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,10 @@ type CreateManagedControlPlaneWizardContainerProps = {
6767
initialTemplateName?: string;
6868
initialData?: ManagedControlPlaneInterface;
6969
isOnMcpPage?: boolean;
70+
initialSection?: WizardStepType;
7071
};
7172

72-
type WizardStepType = 'metadata' | 'members' | 'componentSelection' | 'summarize' | 'success';
73+
export type WizardStepType = 'metadata' | 'members' | 'componentSelection' | 'summarize' | 'success';
7374

7475
const wizardStepOrder: WizardStepType[] = ['metadata', 'members', 'componentSelection', 'summarize', 'success'];
7576

@@ -82,12 +83,13 @@ export const CreateManagedControlPlaneWizardContainer: FC<CreateManagedControlPl
8283
initialTemplateName,
8384
initialData,
8485
isOnMcpPage = false,
86+
initialSection,
8587
}) => {
8688
const { t } = useTranslation();
8789
const { user } = useAuthOnboarding();
8890
const errorDialogRef = useRef<ErrorDialogHandle>(null);
8991

90-
const [selectedStep, setSelectedStep] = useState<WizardStepType>('summarize');
92+
const [selectedStep, setSelectedStep] = useState<WizardStepType>(initialSection ?? 'metadata');
9193
const [metadataFormKey, setMetadataFormKey] = useState(0);
9294

9395
const normalizeChargingTargetType = useCallback((val?: string | null) => (val ?? '').trim().toLowerCase(), []);

src/components/Wizards/CreateManagedControlPlane/EditManagedControlPlaneWizardDataLoader.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ import { useApiResource } from '../../../lib/api/useApiResource.ts';
33
import { ResourceObject } from '../../../lib/api/types/crate/resourceObject.ts';
44
import styles from './EditManagedControlPlaneWizardDataLoader.module.css';
55

6-
import { CreateManagedControlPlaneWizardContainer } from './CreateManagedControlPlaneWizardContainer.tsx';
6+
import {
7+
CreateManagedControlPlaneWizardContainer,
8+
WizardStepType,
9+
} from './CreateManagedControlPlaneWizardContainer.tsx';
710
import { PROJECT_NAME_LABEL, WORKSPACE_LABEL } from '../../../lib/api/types/shared/keyNames.ts';
811

912
import { BusyIndicator } from '@ui5/webcomponents-react';
@@ -15,6 +18,7 @@ export type EditManagedControlPlaneWizardDataLoaderProps = {
1518
isOpen: boolean;
1619
setIsOpen: (isOpen: boolean) => void;
1720
isOnMcpPage?: boolean;
21+
initialSection?: WizardStepType;
1822
};
1923

2024
export const EditManagedControlPlaneWizardDataLoader: FC<EditManagedControlPlaneWizardDataLoaderProps> = ({
@@ -23,6 +27,7 @@ export const EditManagedControlPlaneWizardDataLoader: FC<EditManagedControlPlane
2327
isOpen,
2428
setIsOpen,
2529
isOnMcpPage = false,
30+
initialSection,
2631
}) => {
2732
const { isLoading, data, error } = useApiResource(
2833
ResourceObject<ManagedControlPlaneInterface>(workspaceName ?? '', 'managedcontrolplanes', resourceName),
@@ -53,6 +58,7 @@ export const EditManagedControlPlaneWizardDataLoader: FC<EditManagedControlPlane
5358
isEditMode={true}
5459
initialData={data}
5560
isOnMcpPage={isOnMcpPage}
61+
initialSection={initialSection}
5662
/>
5763
) : null}
5864
</>

src/spaces/mcp/pages/McpPage.tsx

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1-
import { BusyIndicator, ObjectPage, ObjectPageSection, ObjectPageTitle, Panel, Title } from '@ui5/webcomponents-react';
1+
import {
2+
BusyIndicator,
3+
Button,
4+
FlexBox,
5+
ObjectPage,
6+
ObjectPageSection,
7+
ObjectPageTitle,
8+
Panel,
9+
Title,
10+
} from '@ui5/webcomponents-react';
211
import { useParams } from 'react-router-dom';
312
import CopyKubeconfigButton from '../../../components/ControlPlanes/CopyKubeconfigButton.tsx';
413
import styles from './McpPage.module.css';
@@ -32,17 +41,29 @@ import { useState } from 'react';
3241
import { EditManagedControlPlaneWizardDataLoader } from '../../../components/Wizards/CreateManagedControlPlane/EditManagedControlPlaneWizardDataLoader.tsx';
3342
import { ControlPlanePageMenu } from '../../../components/ControlPlanes/ControlPlanePageMenu.tsx';
3443
import { DISPLAY_NAME_ANNOTATION } from '../../../lib/api/types/shared/keyNames.ts';
44+
import { WizardStepType } from '../../../components/Wizards/CreateManagedControlPlane/CreateManagedControlPlaneWizardContainer.tsx';
3545

3646
export default function McpPage() {
3747
const { projectName, workspaceName, controlPlaneName } = useParams();
3848
const { t } = useTranslation();
3949
const [isEditManagedControlPlaneWizardOpen, setIsEditManagedControlPlaneWizardOpen] = useState(false);
50+
const [editManagedControlPlaneWizardSection, setEditManagedControlPlaneWizardSection] = useState<
51+
undefined | WizardStepType
52+
>(undefined);
4053
const {
4154
data: mcp,
4255
error,
4356
isLoading,
4457
} = useApiResource(ControlPlaneResource(projectName, workspaceName, controlPlaneName));
4558
const displayName = mcp?.metadata?.annotations?.[DISPLAY_NAME_ANNOTATION];
59+
const onEditComponents = () => {
60+
setEditManagedControlPlaneWizardSection('componentSelection');
61+
setIsEditManagedControlPlaneWizardOpen(true);
62+
};
63+
const handleEditManagedControlPlaneWizardClose = () => {
64+
setIsEditManagedControlPlaneWizardOpen(false);
65+
setEditManagedControlPlaneWizardSection(undefined);
66+
};
4667
if (isLoading) {
4768
return <BusyIndicator active />;
4869
}
@@ -98,10 +119,11 @@ export default function McpPage() {
98119
/>
99120
<EditManagedControlPlaneWizardDataLoader
100121
isOpen={isEditManagedControlPlaneWizardOpen}
101-
setIsOpen={setIsEditManagedControlPlaneWizardOpen}
122+
setIsOpen={handleEditManagedControlPlaneWizardClose}
102123
workspaceName={mcp?.status?.access?.namespace}
103124
resourceName={controlPlaneName}
104125
isOnMcpPage
126+
initialSection={editManagedControlPlaneWizardSection}
105127
/>
106128
</div>
107129
}
@@ -134,7 +156,14 @@ export default function McpPage() {
134156
className={styles.panel}
135157
headerLevel="H2"
136158
headerText="Panel"
137-
header={<Title level="H3">{t('McpPage.componentsTitle')}</Title>}
159+
header={
160+
<FlexBox justifyContent={'SpaceBetween'} alignItems={'Center'} style={{ width: '100%' }}>
161+
<Title level="H3">{t('McpPage.componentsTitle')}</Title>{' '}
162+
<Button icon={'edit'} onClick={onEditComponents}>
163+
Edit components
164+
</Button>
165+
</FlexBox>
166+
}
138167
noAnimation
139168
>
140169
<ComponentList mcp={mcp} />

0 commit comments

Comments
 (0)