Skip to content

Commit 40903db

Browse files
authored
[UI] Project wizard #323 (#3107)
1 parent 27a42b7 commit 40903db

File tree

1 file changed

+14
-4
lines changed
  • frontend/src/pages/Project/CreateWizard

1 file changed

+14
-4
lines changed

frontend/src/pages/Project/CreateWizard/index.tsx

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useCallback, useMemo, useState } from 'react';
1+
import React, { useCallback, useEffect, useMemo, useState } from 'react';
22
import { useForm } from 'react-hook-form';
33
import { useTranslation } from 'react-i18next';
44
import { useNavigate } from 'react-router-dom';
@@ -250,8 +250,8 @@ export const CreateProjectWizard: React.FC = () => {
250250
onNavigate({ requestedStepIndex, reason });
251251
};
252252

253-
const onChangeProjectType: TilesProps['onChange'] = ({ detail: { value } }) => {
254-
if (value === 'gpu_marketplace') {
253+
const onChangeProjectType = (backendType: string) => {
254+
if (backendType === 'gpu_marketplace') {
255255
setValue(
256256
'backends',
257257
backendBaseOptions.map((b: { value: string }) => b.value),
@@ -261,6 +261,16 @@ export const CreateProjectWizard: React.FC = () => {
261261
}
262262
};
263263

264+
const onChangeProjectTypeHandler: TilesProps['onChange'] = ({ detail: { value } }) => {
265+
onChangeProjectType(value);
266+
};
267+
268+
useEffect(() => {
269+
if (backendBaseOptions?.length) {
270+
onChangeProjectType(formValues.project_type);
271+
}
272+
}, [backendBaseOptions]);
273+
264274
const onSubmitWizard = async () => {
265275
const isValid = await trigger();
266276

@@ -335,7 +345,7 @@ export const CreateProjectWizard: React.FC = () => {
335345
control={control}
336346
name="project_type"
337347
items={projectTypeOptions}
338-
onChange={onChangeProjectType}
348+
onChange={onChangeProjectTypeHandler}
339349
/>
340350
</FormField>
341351
</div>

0 commit comments

Comments
 (0)