+ client: add clients forms validation and cache findClients function

This commit is contained in:
Artem Baskal
2019-12-12 21:48:17 +03:00
parent cddf3ca01e
commit 2e493e0226
16 changed files with 187 additions and 162 deletions

View File

@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
import { Field, reduxForm } from 'redux-form';
import { Trans, withNamespaces } from 'react-i18next';
import flow from 'lodash/flow';
import { renderTextareaField } from '../../../../helpers/form';
const Form = (props) => {
const {
@@ -21,7 +22,7 @@ const Form = (props) => {
<Field
id="allowed_clients"
name="allowed_clients"
component="textarea"
component={renderTextareaField}
type="text"
className="form-control form-control--textarea"
disabled={processingSet}
@@ -37,7 +38,7 @@ const Form = (props) => {
<Field
id="disallowed_clients"
name="disallowed_clients"
component="textarea"
component={renderTextareaField}
type="text"
className="form-control form-control--textarea"
disabled={processingSet}
@@ -53,7 +54,7 @@ const Form = (props) => {
<Field
id="blocked_hosts"
name="blocked_hosts"
component="textarea"
component={renderTextareaField}
type="text"
className="form-control form-control--textarea"
disabled={processingSet}
@@ -81,6 +82,7 @@ Form.propTypes = {
initialValues: PropTypes.object.isRequired,
processingSet: PropTypes.bool.isRequired,
t: PropTypes.func.isRequired,
textarea: PropTypes.bool,
};
export default flow([withNamespaces(), reduxForm({ form: 'accessForm' })])(Form);

View File

@@ -4,7 +4,7 @@ import { Field, reduxForm } from 'redux-form';
import { Trans, withNamespaces } from 'react-i18next';
import flow from 'lodash/flow';
import { renderField, required, domain, answer } from '../../../../helpers/form';
import { renderInputField, required, domain, answer } from '../../../../helpers/form';
const Form = (props) => {
const {
@@ -24,7 +24,7 @@ const Form = (props) => {
<Field
id="domain"
name="domain"
component={renderField}
component={renderInputField}
type="text"
className="form-control"
placeholder={t('form_domain')}
@@ -35,7 +35,7 @@ const Form = (props) => {
<Field
id="answer"
name="answer"
component={renderField}
component={renderInputField}
type="text"
className="form-control"
placeholder={t('form_answer')}