- client: Fix client Access settings normalization
Close #1820 Squashed commit of the following: commit 5aadec2e6e126588313ff006d6f95223ba19a526 Merge: a4db6b4295f41285Author: ArtemBaskal <a.baskal@adguard.com> Date: Wed Jul 15 11:15:31 2020 +0300 Merge branch 'master' into fix/1820 commit a4db6b42ab9cbf43d96c783a72a99e0a2c594108 Author: ArtemBaskal <a.baskal@adguard.com> Date: Tue Jul 14 19:08:09 2020 +0300 Remove textarea comma splitting commit bb34797aac6602b405941dbd90fe6a81b663bb92 Author: ArtemBaskal <a.baskal@adguard.com> Date: Tue Jul 14 18:21:18 2020 +0300 Fix client Access settings normalization commit ac4fb536514f54c5722077d78dbbd981c4e906a8 Merge: 0c758ddcb9fca8d0Author: ArtemBaskal <a.baskal@adguard.com> Date: Tue Jul 14 18:14:38 2020 +0300 Merge branch 'master' into fix/1820 commit 0c758ddcd738136b92e6f947a8068ecc59f7ec25 Merge: 15650db3f5a1f311Author: ArtemBaskal <a.baskal@adguard.com> Date: Fri Jul 3 11:22:00 2020 +0300 Merge branch 'master' into fix/1820 commit 15650db35323009001fd427a74a312705b54ac86 Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jun 29 12:01:51 2020 +0300 '- client: Don't normalise disallowed domains'
This commit is contained in:
@@ -4,7 +4,10 @@ import { Field, reduxForm } from 'redux-form';
|
||||
import { Trans, withTranslation } from 'react-i18next';
|
||||
import flow from 'lodash/flow';
|
||||
import { renderTextareaField } from '../../../../helpers/form';
|
||||
import { normalizeMultiline } from '../../../../helpers/helpers';
|
||||
import {
|
||||
trimMultilineString,
|
||||
removeEmptyLines,
|
||||
} from '../../../../helpers/helpers';
|
||||
import { FORM_NAME } from '../../../../helpers/constants';
|
||||
|
||||
const fields = [
|
||||
@@ -12,16 +15,19 @@ const fields = [
|
||||
id: 'allowed_clients',
|
||||
title: 'access_allowed_title',
|
||||
subtitle: 'access_allowed_desc',
|
||||
normalizeOnBlur: removeEmptyLines,
|
||||
},
|
||||
{
|
||||
id: 'disallowed_clients',
|
||||
title: 'access_disallowed_title',
|
||||
subtitle: 'access_disallowed_desc',
|
||||
normalizeOnBlur: trimMultilineString,
|
||||
},
|
||||
{
|
||||
id: 'blocked_hosts',
|
||||
title: 'access_blocked_title',
|
||||
subtitle: 'access_blocked_desc',
|
||||
normalizeOnBlur: removeEmptyLines,
|
||||
},
|
||||
];
|
||||
|
||||
@@ -31,7 +37,7 @@ const Form = (props) => {
|
||||
} = props;
|
||||
|
||||
const renderField = ({
|
||||
id, title, subtitle, disabled = processingSet,
|
||||
id, title, subtitle, disabled = processingSet, normalizeOnBlur,
|
||||
}) => <div key={id} className="form__group mb-5">
|
||||
<label className="form__label form__label--with-desc" htmlFor={id}>
|
||||
<Trans>{title}</Trans>
|
||||
@@ -46,7 +52,7 @@ const Form = (props) => {
|
||||
type="text"
|
||||
className="form-control form-control--textarea font-monospace"
|
||||
disabled={disabled}
|
||||
normalizeOnBlur={id === 'disallowed_clients' ? normalizeMultiline : undefined}
|
||||
normalizeOnBlur={normalizeOnBlur}
|
||||
/>
|
||||
</div>;
|
||||
|
||||
@@ -55,6 +61,7 @@ const Form = (props) => {
|
||||
title: PropTypes.string,
|
||||
subtitle: PropTypes.string,
|
||||
disabled: PropTypes.bool,
|
||||
normalizeOnBlur: PropTypes.func,
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user