import React from 'react'; import PropTypes from 'prop-types'; import { Field, reduxForm } from 'redux-form'; import { Trans, useTranslation } from 'react-i18next'; import { useDispatch, useSelector, shallowEqual } from 'react-redux'; import { renderInputField, normalizeMac } from '../../../../helpers/form'; import { validateIpv4, validateMac, validateRequiredValue, validateIpv4InCidr, validateIpGateway, } from '../../../../helpers/validators'; import { FORM_NAME } from '../../../../helpers/constants'; import { toggleLeaseModal } from '../../../../actions'; const Form = ({ handleSubmit, reset, pristine, submitting, processingAdding, cidr, isEdit, }) => { const { t } = useTranslation(); const dispatch = useDispatch(); const dynamicLease = useSelector((store) => store.dhcp.leaseModalConfig, shallowEqual); const onClick = () => { reset(); dispatch(toggleLeaseModal()); }; return (
); }; Form.propTypes = { initialValues: PropTypes.shape({ mac: PropTypes.string.isRequired, ip: PropTypes.string.isRequired, hostname: PropTypes.string.isRequired, cidr: PropTypes.string.isRequired, gatewayIp: PropTypes.string, }), pristine: PropTypes.bool.isRequired, handleSubmit: PropTypes.func.isRequired, reset: PropTypes.func.isRequired, submitting: PropTypes.bool.isRequired, processingAdding: PropTypes.bool.isRequired, cidr: PropTypes.string.isRequired, isEdit: PropTypes.bool, }; export default reduxForm({ form: FORM_NAME.LEASE })(Form);