|
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'; |
2 | 11 | import { useParams } from 'react-router-dom'; |
3 | 12 | import CopyKubeconfigButton from '../../../components/ControlPlanes/CopyKubeconfigButton.tsx'; |
4 | 13 | import styles from './McpPage.module.css'; |
@@ -32,17 +41,29 @@ import { useState } from 'react'; |
32 | 41 | import { EditManagedControlPlaneWizardDataLoader } from '../../../components/Wizards/CreateManagedControlPlane/EditManagedControlPlaneWizardDataLoader.tsx'; |
33 | 42 | import { ControlPlanePageMenu } from '../../../components/ControlPlanes/ControlPlanePageMenu.tsx'; |
34 | 43 | import { DISPLAY_NAME_ANNOTATION } from '../../../lib/api/types/shared/keyNames.ts'; |
| 44 | +import { WizardStepType } from '../../../components/Wizards/CreateManagedControlPlane/CreateManagedControlPlaneWizardContainer.tsx'; |
35 | 45 |
|
36 | 46 | export default function McpPage() { |
37 | 47 | const { projectName, workspaceName, controlPlaneName } = useParams(); |
38 | 48 | const { t } = useTranslation(); |
39 | 49 | const [isEditManagedControlPlaneWizardOpen, setIsEditManagedControlPlaneWizardOpen] = useState(false); |
| 50 | + const [editManagedControlPlaneWizardSection, setEditManagedControlPlaneWizardSection] = useState< |
| 51 | + undefined | WizardStepType |
| 52 | + >(undefined); |
40 | 53 | const { |
41 | 54 | data: mcp, |
42 | 55 | error, |
43 | 56 | isLoading, |
44 | 57 | } = useApiResource(ControlPlaneResource(projectName, workspaceName, controlPlaneName)); |
45 | 58 | 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 | + }; |
46 | 67 | if (isLoading) { |
47 | 68 | return <BusyIndicator active />; |
48 | 69 | } |
@@ -98,10 +119,11 @@ export default function McpPage() { |
98 | 119 | /> |
99 | 120 | <EditManagedControlPlaneWizardDataLoader |
100 | 121 | isOpen={isEditManagedControlPlaneWizardOpen} |
101 | | - setIsOpen={setIsEditManagedControlPlaneWizardOpen} |
| 122 | + setIsOpen={handleEditManagedControlPlaneWizardClose} |
102 | 123 | workspaceName={mcp?.status?.access?.namespace} |
103 | 124 | resourceName={controlPlaneName} |
104 | 125 | isOnMcpPage |
| 126 | + initialSection={editManagedControlPlaneWizardSection} |
105 | 127 | /> |
106 | 128 | </div> |
107 | 129 | } |
@@ -134,7 +156,14 @@ export default function McpPage() { |
134 | 156 | className={styles.panel} |
135 | 157 | headerLevel="H2" |
136 | 158 | 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 | + } |
138 | 167 | noAnimation |
139 | 168 | > |
140 | 169 | <ComponentList mcp={mcp} /> |
|
0 commit comments