Merge: - client: Fix DNS settings

Merge in DNS/adguard-home from fix/2021 to master

* commit 'a1ca7862f84b07bde441f4578b1deb025ff79660':
  Fix selector
  - client: Fix DNS settings
This commit is contained in:
Andrey Meshkov 2020-08-13 19:09:17 +03:00
commit 473d881871
2 changed files with 26 additions and 27 deletions

View File

@ -52,10 +52,11 @@ const Form = ({
submitting, invalid, processingSetConfig, processingTestUpstream, handleSubmit, submitting, invalid, processingSetConfig, processingTestUpstream, handleSubmit,
}) => { }) => {
const dispatch = useDispatch(); const dispatch = useDispatch();
const [t] = useTranslation(); const { t } = useTranslation();
const upstream_dns = useSelector((store) => store.form[FORM_NAME.UPSTREAM].values.upstream_dns); const upstream_dns = useSelector((store) => store.form[FORM_NAME.UPSTREAM].values.upstream_dns);
const bootstrap_dns = useSelector((store) => store.form[FORM_NAME.UPSTREAM] const bootstrap_dns = useSelector(
.values.bootstrap_dns); (store) => store.form[FORM_NAME.UPSTREAM].values.bootstrap_dns,
);
const handleUpstreamTest = () => dispatch(testUpstream({ const handleUpstreamTest = () => dispatch(testUpstream({
upstream_dns, upstream_dns,

View File

@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { shallowEqual, useDispatch } from 'react-redux'; import { shallowEqual, useDispatch, useSelector } from 'react-redux';
import Form from './Form'; import Form from './Form';
import Card from '../../../ui/Card'; import Card from '../../../ui/Card';
import { setDnsConfig } from '../../../../actions/dnsConfig'; import { setDnsConfig } from '../../../../actions/dnsConfig';
@ -13,16 +13,15 @@ const Upstream = () => {
bootstrap_dns, bootstrap_dns,
upstream_mode, upstream_mode,
processingSetConfig, processingSetConfig,
} = ((state) => state.dnsConfig, shallowEqual); } = useSelector((state) => state.dnsConfig, shallowEqual);
const { processingTestUpstream } = ((state) => state.settings, shallowEqual); const { processingTestUpstream } = useSelector((state) => state.settings, shallowEqual);
const handleSubmit = (values) => { const handleSubmit = (values) => {
dispatch(setDnsConfig(values)); dispatch(setDnsConfig(values));
}; };
return ( return <Card
<Card
title={t('upstream_dns')} title={t('upstream_dns')}
subtitle={t('upstream_dns_hint')} subtitle={t('upstream_dns_hint')}
bodyType="card-body box-body--settings" bodyType="card-body box-body--settings"
@ -41,8 +40,7 @@ const Upstream = () => {
/> />
</div> </div>
</div> </div>
</Card> </Card>;
);
}; };
export default Upstream; export default Upstream;