- client: Allow change minimum TTL override in UI

Close #2091 #2094 #2056

Squashed commit of the following:

commit a84384bb409bfe60c4bd6477b2249c4431aa3b63
Merge: cdc5f27f a22db5f3
Author: ArtemBaskal <a.baskal@adguard.com>
Date:   Mon Sep 14 19:59:47 2020 +0300

    Merge branch 'master' into fix/2091

commit cdc5f27f279f33c7d988f2927adc172e77e0a6af
Author: ArtemBaskal <a.baskal@adguard.com>
Date:   Mon Sep 14 15:41:00 2020 +0300

    Fix uint32 fields validation

commit 0c6fcb90f9741ae8a33bf6c4d53bd954f2033a88
Author: ArtemBaskal <a.baskal@adguard.com>
Date:   Mon Sep 14 14:43:20 2020 +0300

    Validate DNS cache configuration DNS values unit32 range

commit 1f90a1fcbc04f6c7ffb75b453e5c67e117d1c5bf
Author: ArtemBaskal <a.baskal@adguard.com>
Date:   Mon Sep 14 12:11:39 2020 +0300

    Remove the limit on cache-min-ttl

commit 72e961034cc5752a50a4afc57c7be6a93d652f7d
Author: ArtemBaskal <a.baskal@adguard.com>
Date:   Fri Sep 11 16:50:19 2020 +0300

    Fix translation

commit 6aebf4b87bb806ac0729b40418ba6056b3f71afa
Author: ArtemBaskal <a.baskal@adguard.com>
Date:   Fri Sep 11 12:53:01 2020 +0300

    - client: Allow change minimum TTL override in UI
This commit is contained in:
Artem Baskal
2020-09-14 20:16:46 +03:00
parent a22db5f358
commit 2a5b0b8da1
8 changed files with 69 additions and 78 deletions

View File

@@ -8,10 +8,9 @@ import {
renderInputField,
toNumber,
} from '../../../helpers/form';
import { FORM_NAME } from '../../../helpers/constants';
import { FORM_NAME, UINT32_RANGE } from '../../../helpers/constants';
import {
validateIpv4,
validateIsPositiveValue,
validateRequiredValue,
validateIpv4RangeEnd,
} from '../../../helpers/validators';
@@ -110,9 +109,10 @@ const FormDHCPv4 = ({
type="number"
className="form-control"
placeholder={t(ipv4placeholders.lease_duration)}
validate={[validateIsPositiveValue, validateRequired]}
validate={validateRequired}
normalize={toNumber}
min={0}
min={1}
max={UINT32_RANGE.MAX}
disabled={!isInterfaceIncludesIpv4}
/>
</div>

View File

@@ -8,12 +8,8 @@ import {
renderInputField,
toNumber,
} from '../../../helpers/form';
import { FORM_NAME } from '../../../helpers/constants';
import {
validateIpv6,
validateIsPositiveValue,
validateRequiredValue,
} from '../../../helpers/validators';
import { FORM_NAME, UINT32_RANGE } from '../../../helpers/constants';
import { validateIpv6, validateRequiredValue } from '../../../helpers/validators';
const FormDHCPv6 = ({
handleSubmit,
@@ -86,9 +82,10 @@ const FormDHCPv6 = ({
type="number"
className="form-control"
placeholder={t(ipv6placeholders.lease_duration)}
validate={[validateIsPositiveValue, validateRequired]}
validate={validateRequired}
normalizeOnBlur={toNumber}
min={0}
min={1}
max={UINT32_RANGE.MAX}
disabled={!isInterfaceIncludesIpv6}
/>
</div>