From b1e28a74d1a0b26975e079ff547e6e1b72f21a19 Mon Sep 17 00:00:00 2001 From: Dmitry Seregin Date: Tue, 2 Nov 2021 20:12:11 +0300 Subject: [PATCH] Pull request: 3767 removed dhcp leases validators Merge in DNS/adguard-home from 3767-remove-dhcp-leases-validators to master Squashed commit of the following: commit 30511ecbb1ebbc913d3c3490b80b284fcc857e6c Author: Dmitriy Seregin Date: Tue Nov 2 19:20:06 2021 +0300 3767: removed dhcp leases validators --- client/src/__locales/en.json | 2 -- .../Settings/Dhcp/StaticLeases/Form.js | 2 -- client/src/helpers/validators.js | 29 ------------------- 3 files changed, 33 deletions(-) diff --git a/client/src/__locales/en.json b/client/src/__locales/en.json index 6db195fe..070f1afa 100644 --- a/client/src/__locales/en.json +++ b/client/src/__locales/en.json @@ -49,9 +49,7 @@ "form_error_positive": "Must be greater than 0", "form_error_negative": "Must be equal to 0 or greater", "out_of_range_error": "Must be out of range \"{{start}}\"-\"{{end}}\"", - "in_range_error": "Must be in range \"{{start}}\"-\"{{end}}\"", "lower_range_start_error": "Must be lower than range start", - "lower_range_end_error": "Must be lower than range end", "greater_range_start_error": "Must be greater than range start", "greater_range_end_error": "Must be greater than range end", "subnet_error": "Addresses must be in one subnet", diff --git a/client/src/components/Settings/Dhcp/StaticLeases/Form.js b/client/src/components/Settings/Dhcp/StaticLeases/Form.js index 7e9c641b..625e87e2 100644 --- a/client/src/components/Settings/Dhcp/StaticLeases/Form.js +++ b/client/src/components/Settings/Dhcp/StaticLeases/Form.js @@ -10,7 +10,6 @@ import { validateMac, validateRequiredValue, validateIpv4InCidr, - validateInRange, } from '../../../../helpers/validators'; import { FORM_NAME } from '../../../../helpers/constants'; import { toggleLeaseModal } from '../../../../actions'; @@ -58,7 +57,6 @@ const Form = ({ validateRequiredValue, validateIpv4, validateIpv4InCidr, - validateInRange, ]} /> diff --git a/client/src/helpers/validators.js b/client/src/helpers/validators.js index 4a4125d2..54bf0341 100644 --- a/client/src/helpers/validators.js +++ b/client/src/helpers/validators.js @@ -99,35 +99,6 @@ export const validateNotInRange = (value, allValues) => { return undefined; }; -/** - * @returns {undefined|string} - * @param _ - * @param allValues - */ -export const validateInRange = (value, allValues) => { - const { rangeStart, rangeEnd } = allValues; - - if (rangeStart && validateIpv4(rangeStart)) { - return 'form_error_ip4_range_start_format'; - } - - if (rangeEnd && validateIpv4(rangeEnd)) { - return 'form_error_ip4_range_end_format'; - } - - const isBelowMin = rangeStart && ip4ToInt(value) < ip4ToInt(rangeStart); - const isAboveMax = rangeEnd && ip4ToInt(value) > ip4ToInt(rangeEnd); - - if (isAboveMax || isBelowMin) { - return i18next.t('in_range_error', { - start: rangeStart, - end: rangeEnd, - }); - } - - return undefined; -}; - /** * @returns {undefined|string} * @param _