+ <>
+
+
+
+ {this.getToggleDhcpButton()}
+
-
- {dhcp.config.enabled && (
-
-
-
- )}
-
-
-
-
-
-
-
-
+ {!enabled && dhcp.check && (
+ <>
+ {this.getStaticIpWarning(t, dhcp.check, interface_name)}
+ {this.getActiveDhcpMessage(t, dhcp.check)}
+ {this.getDhcpWarning(dhcp.check)}
+ >
+ )}
+ >
+
+
+ {dhcp.config.enabled && (
+
+
+
)}
-
- );
+
+
+
+
+
+
+
+
+
+
+ >}
+ >;
}
}
diff --git a/client/src/components/Settings/Dns/Access/index.js b/client/src/components/Settings/Dns/Access/index.js
index acceef48..a1c263aa 100644
--- a/client/src/components/Settings/Dns/Access/index.js
+++ b/client/src/components/Settings/Dns/Access/index.js
@@ -1,40 +1,36 @@
-import React, { Component } from 'react';
-import PropTypes from 'prop-types';
-import { withTranslation } from 'react-i18next';
-
+import React from 'react';
+import { useTranslation } from 'react-i18next';
+import { shallowEqual, useDispatch, useSelector } from 'react-redux';
import Form from './Form';
import Card from '../../../ui/Card';
+import { setAccessList } from '../../../../actions/access';
-class Access extends Component {
- handleFormSubmit = (values) => {
- this.props.setAccessList(values);
+const Access = () => {
+ const { t } = useTranslation();
+ const dispatch = useDispatch();
+ const {
+ processing,
+ processingSet,
+ ...values
+ } = useSelector((state) => state.access, shallowEqual);
+
+ const handleFormSubmit = (values) => {
+ dispatch(setAccessList(values));
};
- render() {
- const { t, access } = this.props;
-
- const { processing, processingSet, ...values } = access;
-
- return (
-
-
-
- );
- }
-}
-
-Access.propTypes = {
- access: PropTypes.object.isRequired,
- setAccessList: PropTypes.func.isRequired,
- t: PropTypes.func.isRequired,
+ return (
+
+
+
+ );
};
-export default withTranslation()(Access);
+export default Access;
diff --git a/client/src/components/Settings/Dns/Config/Form.js b/client/src/components/Settings/Dns/Config/Form.js
index 08514bc8..58b7d2c0 100644
--- a/client/src/components/Settings/Dns/Config/Form.js
+++ b/client/src/components/Settings/Dns/Config/Form.js
@@ -1,9 +1,8 @@
-import React, { Fragment } from 'react';
+import React from 'react';
import PropTypes from 'prop-types';
-import { connect } from 'react-redux';
-import { Field, reduxForm, formValueSelector } from 'redux-form';
-import { Trans, withTranslation } from 'react-i18next';
-import flow from 'lodash/flow';
+import { shallowEqual, useSelector } from 'react-redux';
+import { Field, reduxForm } from 'redux-form';
+import { Trans, useTranslation } from 'react-i18next';
import {
renderInputField,
renderRadioField,
@@ -18,32 +17,36 @@ import {
} from '../../../../helpers/validators';
import { BLOCKING_MODES, FORM_NAME } from '../../../../helpers/constants';
-const checkboxes = [{
- name: 'edns_cs_enabled',
- placeholder: 'edns_enable',
- subtitle: 'edns_cs_desc',
-},
-{
- name: 'dnssec_enabled',
- placeholder: 'dnssec_enable',
- subtitle: 'dnssec_enable_desc',
-},
-{
- name: 'disable_ipv6',
- placeholder: 'disable_ipv6',
- subtitle: 'disable_ipv6_desc',
-}];
+const checkboxes = [
+ {
+ name: 'edns_cs_enabled',
+ placeholder: 'edns_enable',
+ subtitle: 'edns_cs_desc',
+ },
+ {
+ name: 'dnssec_enabled',
+ placeholder: 'dnssec_enable',
+ subtitle: 'dnssec_enable_desc',
+ },
+ {
+ name: 'disable_ipv6',
+ placeholder: 'disable_ipv6',
+ subtitle: 'disable_ipv6_desc',
+ },
+];
-const customIps = [{
- description: 'blocking_ipv4_desc',
- name: 'blocking_ipv4',
- validateIp: validateIpv4,
-},
-{
- description: 'blocking_ipv6_desc',
- name: 'blocking_ipv6',
- validateIp: validateIpv6,
-}];
+const customIps = [
+ {
+ description: 'blocking_ipv4_desc',
+ name: 'blocking_ipv4',
+ validateIp: validateIpv4,
+ },
+ {
+ description: 'blocking_ipv6_desc',
+ name: 'blocking_ipv6',
+ validateIp: validateIpv6,
+ },
+];
const getFields = (processing, t) => Object.values(BLOCKING_MODES)
.map((mode) => (
@@ -58,114 +61,107 @@ const getFields = (processing, t) => Object.values(BLOCKING_MODES)
/>
));
-let Form = ({
- handleSubmit, submitting, invalid, processing, blockingMode, t,
-}) =>