mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-28 18:08:51 +03:00
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:
parent
2fc108486d
commit
b1e28a74d1
3 changed files with 0 additions and 33 deletions
|
@ -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",
|
||||
|
|
|
@ -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,
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
|
|
|
@ -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 _
|
||||
|
|
Loading…
Reference in a new issue