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 <d.seregin@adguard.com>
Date:   Tue Nov 2 19:20:06 2021 +0300

    3767: removed dhcp leases validators
This commit is contained in:
Dmitry Seregin 2021-11-02 20:12:11 +03:00
parent 2fc108486d
commit b1e28a74d1
3 changed files with 0 additions and 33 deletions

View File

@ -49,9 +49,7 @@
"form_error_positive": "Must be greater than 0", "form_error_positive": "Must be greater than 0",
"form_error_negative": "Must be equal to 0 or greater", "form_error_negative": "Must be equal to 0 or greater",
"out_of_range_error": "Must be out of range \"{{start}}\"-\"{{end}}\"", "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_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_start_error": "Must be greater than range start",
"greater_range_end_error": "Must be greater than range end", "greater_range_end_error": "Must be greater than range end",
"subnet_error": "Addresses must be in one subnet", "subnet_error": "Addresses must be in one subnet",

View File

@ -10,7 +10,6 @@ import {
validateMac, validateMac,
validateRequiredValue, validateRequiredValue,
validateIpv4InCidr, validateIpv4InCidr,
validateInRange,
} from '../../../../helpers/validators'; } from '../../../../helpers/validators';
import { FORM_NAME } from '../../../../helpers/constants'; import { FORM_NAME } from '../../../../helpers/constants';
import { toggleLeaseModal } from '../../../../actions'; import { toggleLeaseModal } from '../../../../actions';
@ -58,7 +57,6 @@ const Form = ({
validateRequiredValue, validateRequiredValue,
validateIpv4, validateIpv4,
validateIpv4InCidr, validateIpv4InCidr,
validateInRange,
]} ]}
/> />
</div> </div>

View File

@ -99,35 +99,6 @@ export const validateNotInRange = (value, allValues) => {
return undefined; 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} * @returns {undefined|string}
* @param _ * @param _