diff --git a/client/src/components/Settings/Clients/Form/index.tsx b/client/src/components/Settings/Clients/Form/index.tsx index 90cbd3da..0ea6098c 100644 --- a/client/src/components/Settings/Clients/Form/index.tsx +++ b/client/src/components/Settings/Clients/Form/index.tsx @@ -186,9 +186,7 @@ export const Form = ({
- text - , + , ]}> client_identifier_desc diff --git a/client/src/components/Settings/Dhcp/FormDHCPv4.tsx b/client/src/components/Settings/Dhcp/FormDHCPv4.tsx index b10f7b4d..a502643d 100644 --- a/client/src/components/Settings/Dhcp/FormDHCPv4.tsx +++ b/client/src/components/Settings/Dhcp/FormDHCPv4.tsx @@ -1,7 +1,8 @@ -import React from 'react'; +import React, { useMemo } from 'react'; import { useFormContext } from 'react-hook-form'; import { useTranslation } from 'react-i18next'; +import { isValid } from 'date-fns'; import { UINT32_RANGE } from '../../../helpers/constants'; import { validateGatewaySubnetMask, @@ -32,7 +33,7 @@ const FormDHCPv4 = ({ processingConfig, ipv4placeholders, interfaces, onSubmit } const { register, handleSubmit, - formState: { errors, isSubmitting }, + formState: { errors, isSubmitting, isValid }, watch, } = useFormContext(); @@ -49,6 +50,10 @@ const FormDHCPv4 = ({ processingConfig, ipv4placeholders, interfaces, onSubmit } } }; + const isDisabled = useMemo(() => { + return isSubmitting || !isValid || processingConfig || !isInterfaceIncludesIpv4 || isEmptyConfig; + }, [isSubmitting, isValid, processingConfig, isInterfaceIncludesIpv4, isEmptyConfig]); + return (
@@ -169,16 +174,7 @@ const FormDHCPv4 = ({ processingConfig, ipv4placeholders, interfaces, onSubmit }
-
diff --git a/client/src/components/Settings/Dhcp/FormDHCPv6.tsx b/client/src/components/Settings/Dhcp/FormDHCPv6.tsx index a3b04e6c..d4dcd246 100644 --- a/client/src/components/Settings/Dhcp/FormDHCPv6.tsx +++ b/client/src/components/Settings/Dhcp/FormDHCPv6.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useMemo } from 'react'; import { useFormContext } from 'react-hook-form'; import { useTranslation } from 'react-i18next'; @@ -30,7 +30,7 @@ const FormDHCPv6 = ({ processingConfig, ipv6placeholders, interfaces, onSubmit } const { register, handleSubmit, - formState: { errors, isSubmitting }, + formState: { errors, isSubmitting, isValid }, watch, } = useFormContext(); @@ -46,6 +46,10 @@ const FormDHCPv6 = ({ processingConfig, ipv6placeholders, interfaces, onSubmit } } }; + const isDisabled = useMemo(() => { + return isSubmitting || !isValid || processingConfig || !isInterfaceIncludesIpv6 || isEmptyConfig; + }, [isSubmitting, isValid, processingConfig, isInterfaceIncludesIpv6, isEmptyConfig]); + return (
@@ -126,16 +130,7 @@ const FormDHCPv6 = ({ processingConfig, ipv6placeholders, interfaces, onSubmit }
-
diff --git a/client/src/components/Settings/Dns/Access/Form.tsx b/client/src/components/Settings/Dns/Access/Form.tsx index 53190c6c..ac0f4c71 100644 --- a/client/src/components/Settings/Dns/Access/Form.tsx +++ b/client/src/components/Settings/Dns/Access/Form.tsx @@ -4,6 +4,7 @@ import { Trans, useTranslation } from 'react-i18next'; import { CLIENT_ID_LINK } from '../../../../helpers/constants'; import { removeEmptyLines, trimMultilineString } from '../../../../helpers/helpers'; +import { Textarea } from '../../../ui/Controls/Textarea'; const fields = [ { @@ -44,7 +45,7 @@ interface FormData { const Form = ({ initialValues, onSubmit, processingSet }: FormProps) => { const { t } = useTranslation(); - + const { control, handleSubmit, @@ -88,11 +89,7 @@ const Form = ({ initialValues, onSubmit, processingSet }: FormProps) => {
- {t('text')} - - ), + a: , }}> {subtitle} @@ -102,14 +99,12 @@ const Form = ({ initialValues, onSubmit, processingSet }: FormProps) => { name={id} control={control} render={({ field }) => ( -