import React, { Fragment } from 'react'; import PropTypes from 'prop-types'; import { Field, reduxForm } from 'redux-form'; import { withNamespaces, Trans } from 'react-i18next'; import flow from 'lodash/flow'; import { R_IPV4 } from '../../../helpers/constants'; const required = (value) => { if (value || value === 0) { return false; } return form_error_required; }; const ipv4 = (value) => { if (value && !new RegExp(R_IPV4).test(value)) { return form_error_ip_format; } return false; }; const isPositive = (value) => { if ((value || value === 0) && (value <= 0)) { return form_error_positive; } return false; }; const toNumber = value => value && parseInt(value, 10); const renderField = ({ input, className, placeholder, type, disabled, meta: { touched, error }, }) => ( {!disabled && touched && (error && {error})} ); const Form = (props) => { const { t, handleSubmit, submitting, invalid, processingConfig, } = props; return (
); }; Form.propTypes = { handleSubmit: PropTypes.func, submitting: PropTypes.bool, invalid: PropTypes.bool, interfaces: PropTypes.object, initialValues: PropTypes.object, processingConfig: PropTypes.bool, t: PropTypes.func, }; export default flow([ withNamespaces(), reduxForm({ form: 'dhcpForm' }), ])(Form);