CreateImageWizard: enable passing initial state to CreateImageWizard

This commit is contained in:
Jacob Kozol 2022-03-07 15:27:34 +01:00 committed by jkozol
parent c3c7888610
commit c3f86f3575
2 changed files with 7 additions and 3 deletions

View file

@ -1,6 +1,6 @@
import React from 'react';
import ImageCreator from './ImageCreator';
import { useNavigate } from 'react-router-dom';
import { useNavigate, useLocation } from 'react-router-dom';
import componentTypes from '@data-driven-forms/react-form-renderer/component-types';
import DocumentationButton from '../sharedComponents/DocumentationButton';
import './CreateImageWizard.scss';
@ -198,6 +198,7 @@ const onSave = (values) => {
const CreateImageWizard = () => {
const dispatch = useDispatch();
const navigate = useNavigate();
const location = useLocation();
return <ImageCreator
onClose={ () => navigate('/') }
onSubmit={ ({ values, setIsSaving }) => {
@ -261,7 +262,8 @@ const CreateImageWizard = () => {
]
}
]
} } />;
} }
initialValues={ {} } />;
};
export default CreateImageWizard;

View file

@ -17,6 +17,7 @@ import FileSystemConfigToggle from './formComponents/FileSystemConfigToggle';
const ImageCreator = ({ schema, onSubmit, onClose, customComponentMapper, customValidatorMapper, defaultArch, className, ...props }) => {
return schema ? <FormRenderer
initialValues={ props.initialValues }
schema={ schema }
className={ `image-builder${className ? ` ${className}` : ''}` }
subscription={ { values: true } }
@ -57,7 +58,8 @@ ImageCreator.propTypes = {
[PropTypes.string]: PropTypes.func
}),
defaultArch: PropTypes.string,
className: PropTypes.string
className: PropTypes.string,
initialValues: PropTypes.object
};
export default ImageCreator;