diff --git a/client/src/__locales/en.json b/client/src/__locales/en.json index 18eabbce..66541f0f 100644 --- a/client/src/__locales/en.json +++ b/client/src/__locales/en.json @@ -223,6 +223,8 @@ "anonymize_client_ip": "Anonymize client IP", "anonymize_client_ip_desc": "Don't save the full IP address of the client in logs and statistics", "dns_config": "DNS server configuration", + "dns_cache_config": "DNS cache configuration", + "dns_cache_config_desc": "Here you can configure DNS cache", "blocking_mode": "Blocking mode", "default": "Default", "nxdomain": "NXDOMAIN", @@ -529,5 +531,17 @@ "rewritten": "Rewritten", "safe_search": "Safe search", "blocklist": "Blocklist", - "milliseconds_abbreviation": "ms" -} \ No newline at end of file + "milliseconds_abbreviation": "ms", + "dnssec_enable_desc": "Set DNSSEC flag in the outcoming DNS queries and check the result (DNSSEC-enabled resolver is required)", + "cache_size": "Cache size", + "cache_size_desc": "DNS cache size (in bytes)", + "cache_ttl_min_override": "Override minimum TTL", + "cache_ttl_max_override": "Override maximum TTL", + "enter_cache_size": "Enter cache size", + "enter_cache_ttl_min_override": "Enter minimum TTL", + "enter_cache_ttl_max_override": "Enter maximum TTL", + "cache_ttl_min_override_desc": "Override TTL value (minimum) received from upstream server. This value can't larger than 3600 (1 hour)", + "cache_ttl_max_override_desc": "Override TTL value (maximum) received from upstream server", + "min_exceeds_max_value": "Minimum value exceeds maximum value", + "value_not_larger_than": "Value can't be larger than {{maximum}}" +} diff --git a/client/src/components/Filters/Form.js b/client/src/components/Filters/Form.js index 46e0579d..0237a5d6 100644 --- a/client/src/components/Filters/Form.js +++ b/client/src/components/Filters/Form.js @@ -3,8 +3,8 @@ import PropTypes from 'prop-types'; import { Field, reduxForm } from 'redux-form'; import { Trans, withTranslation } from 'react-i18next'; import flow from 'lodash/flow'; - -import { renderInputField, required, isValidPath } from '../../helpers/form'; +import { renderInputField } from '../../helpers/form'; +import { validatePath, validateRequiredValue } from '../../helpers/validators'; import { FORM_NAME } from '../../helpers/constants'; const Form = (props) => { @@ -28,7 +28,7 @@ const Form = (props) => { component={renderInputField} className="form-control" placeholder={t('enter_name_hint')} - validate={[required]} + validate={[validateRequiredValue]} normalizeOnBlur={(data) => data.trim()} /> @@ -40,7 +40,7 @@ const Form = (props) => { component={renderInputField} className="form-control" placeholder={t('enter_url_or_path_hint')} - validate={[required, isValidPath]} + validate={[validateRequiredValue, validatePath]} normalizeOnBlur={(data) => data.trim()} /> diff --git a/client/src/components/Filters/Rewrites/Form.js b/client/src/components/Filters/Rewrites/Form.js index 5382ee32..2db7be35 100644 --- a/client/src/components/Filters/Rewrites/Form.js +++ b/client/src/components/Filters/Rewrites/Form.js @@ -3,10 +3,8 @@ import PropTypes from 'prop-types'; import { Field, reduxForm } from 'redux-form'; import { Trans, withTranslation } from 'react-i18next'; import flow from 'lodash/flow'; - -import { - renderInputField, required, domain, answer, -} from '../../../helpers/form'; +import { renderInputField } from '../../../helpers/form'; +import { validateAnswer, validateDomain, validateRequiredValue } from '../../../helpers/validators'; import { FORM_NAME } from '../../../helpers/constants'; const Form = (props) => { @@ -34,7 +32,7 @@ const Form = (props) => { type="text" className="form-control" placeholder={t('form_domain')} - validate={[required, domain]} + validate={[validateRequiredValue, validateDomain]} /> @@ -61,7 +59,7 @@ const Form = (props) => { type="text" className="form-control" placeholder={t('form_answer')} - validate={[required, answer]} + validate={[validateRequiredValue, validateAnswer]} /> diff --git a/client/src/components/Settings/Clients/Form.js b/client/src/components/Settings/Clients/Form.js index 65c16cb3..5c7bf471 100644 --- a/client/src/components/Settings/Clients/Form.js +++ b/client/src/components/Settings/Clients/Form.js @@ -13,13 +13,12 @@ import Tabs from '../../ui/Tabs'; import Examples from '../Dns/Upstream/Examples'; import { toggleAllServices } from '../../../helpers/helpers'; import { - required, - clientId, renderInputField, renderGroupField, renderSelectField, renderServiceField, } from '../../../helpers/form'; +import { validateClientId, validateRequiredValue } from '../../../helpers/validators'; import { FORM_NAME, SERVICES } from '../../../helpers/constants'; import './Service.css'; @@ -48,12 +47,12 @@ const settingsCheckboxes = [ const validate = (values) => { const errors = {}; const { name, ids } = values; - errors.name = required(name); + errors.name = validateRequiredValue(name); if (ids && ids.length) { const idArrayErrors = []; ids.forEach((id, idx) => { - idArrayErrors[idx] = required(id) || clientId(id); + idArrayErrors[idx] = validateRequiredValue(id) || validateClientId(id); }); if (idArrayErrors.length) { diff --git a/client/src/components/Settings/Dhcp/Form.js b/client/src/components/Settings/Dhcp/Form.js index 6e0a134f..6fd8c40e 100644 --- a/client/src/components/Settings/Dhcp/Form.js +++ b/client/src/components/Settings/Dhcp/Form.js @@ -4,11 +4,9 @@ import PropTypes from 'prop-types'; import { Field, reduxForm, formValueSelector } from 'redux-form'; import { Trans, withTranslation } from 'react-i18next'; import flow from 'lodash/flow'; - -import { - renderInputField, required, ipv4, isPositive, toNumber, -} from '../../../helpers/form'; +import { renderInputField, toNumber } from '../../../helpers/form'; import { FORM_NAME } from '../../../helpers/constants'; +import { validateIpv4, validateIsPositiveValue, validateRequiredValue } from '../../../helpers/validators'; const renderInterfaces = ((interfaces) => ( Object.keys(interfaces).map((item) => { @@ -96,7 +94,7 @@ let Form = (props) => { name="interface_name" component="select" className="form-control custom-select" - validate={[required]} + validate={[validateRequiredValue]} >