Skip to content

Commit 80970fa

Browse files
committed
fixes
1 parent 1c71d7f commit 80970fa

File tree

2 files changed

+19
-29
lines changed

2 files changed

+19
-29
lines changed

src/components/Wizards/CreateManagedControlPlaneWizardContainer.tsx

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import {
2929
CreateManagedControlPlaneResource,
3030
CreateManagedControlPlaneType,
3131
} from '../../lib/api/types/crate/createManagedControlPlane.ts';
32-
import { ErrorDialogHandle } from '../Shared/ErrorMessageBox.tsx';
32+
import { ErrorDialog, ErrorDialogHandle } from '../Shared/ErrorMessageBox.tsx';
3333
import { useToast } from '../../context/ToastContext.tsx';
3434

3535
export type CreateDialogProps = {
@@ -71,13 +71,13 @@ export const CreateManagedControlPlaneWizardContainer: FC<
7171
const errorDialogRef = useRef<ErrorDialogHandle>(null);
7272
const resetFormAndClose = () => {
7373
reset();
74-
setSelectedStep(1);
74+
setSelectedStep('1');
7575
setIsOpen(false);
7676
};
7777
console.log(errors);
7878
// const { t } = useTranslation();
7979
const { user } = useAuth();
80-
const [selectedStep, setSelectedStep] = useState(1);
80+
const [selectedStep, setSelectedStep] = useState<string>('1');
8181
const username = user?.email;
8282
const toast = useToast();
8383
const clearForm = useCallback(() => {
@@ -99,6 +99,7 @@ export const CreateManagedControlPlaneWizardContainer: FC<
9999
const { trigger } = useApiResourceMutation<CreateManagedControlPlaneType>(
100100
CreateManagedControlPlaneResource(projectName, workspaceName),
101101
);
102+
102103
const handleCreateManagedControlPlane = async ({
103104
name,
104105
displayName,
@@ -129,23 +130,25 @@ export const CreateManagedControlPlaneWizardContainer: FC<
129130
return false;
130131
}
131132
};
132-
133+
const handleStepChange = (e: any) => {
134+
setSelectedStep(e.detail.step.dataset.step);
135+
};
133136
const onNextClick = () => {
134137
console.log('test');
135138
console.log(getValues());
136-
if (selectedStep === 1) {
139+
if (selectedStep === '1') {
137140
handleSubmit(
138141
() => {
139142
console.log('valid');
140-
setSelectedStep(2);
143+
setSelectedStep('2');
141144
},
142145
() => {
143146
console.log('not valid');
144147
console.log(errors);
145148
},
146149
)();
147150
}
148-
if (selectedStep === 2) {
151+
if (selectedStep === '2') {
149152
handleCreateManagedControlPlane(getValues());
150153
}
151154
};
@@ -166,25 +169,23 @@ export const CreateManagedControlPlaneWizardContainer: FC<
166169
Close
167170
</Button>
168171
<Button design="Emphasized" onClick={onNextClick}>
169-
{selectedStep === 2 ? 'Create' : 'Next'}
172+
{selectedStep === '2' ? 'Create' : 'Next'}
170173
</Button>
171174
</div>
172175
}
173176
/>
174177
}
175178
onClose={() => setIsOpen(false)}
176179
>
177-
<Wizard contentLayout={'SingleStep'}>
180+
<Wizard contentLayout={'SingleStep'} onStepChange={handleStepChange}>
178181
<WizardStep
179182
icon={'create-form'}
180183
titleText="Metadata"
181184
disabled={false}
182-
selected={selectedStep === 1}
185+
selected={selectedStep === '1'}
183186
data-step={'1'}
184-
onClick={() => {
185-
setSelectedStep(1);
186-
}}
187187
>
188+
{selectedStep}
188189
<MetadataAndMembersForm
189190
members={watch('members')}
190191
register={register}
@@ -195,12 +196,9 @@ export const CreateManagedControlPlaneWizardContainer: FC<
195196
<WizardStep
196197
icon={'activities'}
197198
titleText="Summarize"
198-
disabled={!isValid}
199-
selected={selectedStep === 2}
199+
disabled={selectedStep === '1' || !isValid}
200+
selected={selectedStep === '2'}
200201
data-step={'2'}
201-
onClick={() => {
202-
setSelectedStep(2);
203-
}}
204202
>
205203
<h1>Summarize</h1>
206204
<Grid defaultSpan="XL6 L6 M6 S6">
@@ -234,6 +232,7 @@ export const CreateManagedControlPlaneWizardContainer: FC<
234232
</List>
235233
</div>
236234
<div>
235+
{selectedStep}
237236
<YamlViewer
238237
yamlString={stringify(getValues('members'))}
239238
filename={'test'}
@@ -242,6 +241,7 @@ export const CreateManagedControlPlaneWizardContainer: FC<
242241
</Grid>
243242
</WizardStep>
244243
</Wizard>
244+
<ErrorDialog ref={errorDialogRef} />
245245
</Dialog>
246246
);
247247
};

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

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,6 @@ export const CreateManagedControlPlane = (
4949
},
5050
spec: {
5151
members: optional?.members ?? [],
52-
// dataplane: {
53-
// type: 'Gardener',
54-
// gardener: {
55-
// region: 'eu-west-1',
56-
// },
57-
// },
58-
// crossplane: {
59-
// enabled: false,
60-
// version: '1.14.0',
61-
// },
6252
},
6353
};
6454
};
@@ -70,7 +60,7 @@ export const CreateManagedControlPlaneResource = (
7060
return {
7161
path: `/apis/core.openmcp.cloud/v1alpha1/namespaces/${projectName}--ws-${workspaceName}/managedcontrolplanes`,
7262
method: 'POST',
73-
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 } }]',
63+
jq: undefined,
7464
body: undefined,
7565
};
7666
};

0 commit comments

Comments
 (0)