90 lines
2.2 KiB
JavaScript
90 lines
2.2 KiB
JavaScript
import PropTypes from 'prop-types'
|
|
import ObjectInfo from '../../common/ObjectInfo'
|
|
import NewObjectForm from '../../common/NewObjectForm'
|
|
import WizardView from '../../common/WizardView'
|
|
|
|
const NewGCodeFile = ({ onOk }) => {
|
|
return (
|
|
<NewObjectForm
|
|
type={'gcodeFile'}
|
|
defaultValues={{
|
|
state: { type: 'draft' }
|
|
}}
|
|
>
|
|
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
|
const steps = [
|
|
{
|
|
title: 'Upload',
|
|
key: 'uplaod',
|
|
content: (
|
|
<ObjectInfo
|
|
type='gcodeFile'
|
|
column={1}
|
|
bordered={false}
|
|
isEditing={true}
|
|
required={true}
|
|
objectData={objectData}
|
|
visibleProperties={{ name: false, filament: false }}
|
|
showLabels={false}
|
|
/>
|
|
)
|
|
},
|
|
{
|
|
title: 'Required',
|
|
key: 'required',
|
|
content: (
|
|
<ObjectInfo
|
|
type='gcodeFile'
|
|
column={1}
|
|
bordered={false}
|
|
isEditing={true}
|
|
required={true}
|
|
objectData={objectData}
|
|
visibleProperties={{ file: false }}
|
|
/>
|
|
)
|
|
},
|
|
{
|
|
title: 'Summary',
|
|
key: 'summary',
|
|
content: (
|
|
<ObjectInfo
|
|
type='gcodeFile'
|
|
column={1}
|
|
bordered={false}
|
|
visibleProperties={{
|
|
_id: false,
|
|
createdAt: false,
|
|
updatedAt: false,
|
|
startedAt: false
|
|
}}
|
|
isEditing={false}
|
|
objectData={objectData}
|
|
/>
|
|
)
|
|
}
|
|
]
|
|
return (
|
|
<WizardView
|
|
steps={steps}
|
|
loading={submitLoading}
|
|
formValid={formValid}
|
|
title='New GCode File'
|
|
onSubmit={() => {
|
|
handleSubmit()
|
|
onOk()
|
|
}}
|
|
/>
|
|
)
|
|
}}
|
|
</NewObjectForm>
|
|
)
|
|
}
|
|
|
|
NewGCodeFile.propTypes = {
|
|
onOk: PropTypes.func.isRequired,
|
|
reset: PropTypes.bool
|
|
}
|
|
|
|
export default NewGCodeFile
|