+ client: Display upstreams list loaded from a file
Squashed commit of the following:
commit b5abc9115806f345c8d0dd5ea00b8552d27813f9
Merge: 92708411 c1c8abdd
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Mon Sep 7 14:38:06 2020 +0300
Merge branch '1680-upstreams-file' into feature/1680
commit 92708411f07638c037e049ee8012d15bdeda77e4
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Fri Sep 4 13:54:24 2020 +0300
+ client: Display upstreams list loaded from a file
This commit is contained in:
@@ -12,15 +12,28 @@ const Upstream = () => {
|
||||
upstream_dns,
|
||||
bootstrap_dns,
|
||||
upstream_mode,
|
||||
processingSetConfig,
|
||||
} = useSelector((state) => state.dnsConfig, shallowEqual);
|
||||
|
||||
const { processingTestUpstream } = useSelector((state) => state.settings, shallowEqual);
|
||||
const upstream_dns_file = useSelector((state) => state.dnsConfig.upstream_dns_file);
|
||||
|
||||
const handleSubmit = (values) => {
|
||||
dispatch(setDnsConfig(values));
|
||||
const {
|
||||
bootstrap_dns,
|
||||
upstream_dns,
|
||||
upstream_mode,
|
||||
} = values;
|
||||
|
||||
const dnsConfig = {
|
||||
bootstrap_dns,
|
||||
upstream_mode,
|
||||
...(upstream_dns_file ? null : { upstream_dns }),
|
||||
};
|
||||
|
||||
dispatch(setDnsConfig(dnsConfig));
|
||||
};
|
||||
|
||||
const upstreamDns = upstream_dns_file ? t('configured_in', { path: upstream_dns_file }) : upstream_dns;
|
||||
|
||||
return <Card
|
||||
title={t('upstream_dns')}
|
||||
subtitle={t('upstream_dns_hint')}
|
||||
@@ -30,13 +43,11 @@ const Upstream = () => {
|
||||
<div className="col">
|
||||
<Form
|
||||
initialValues={{
|
||||
upstream_dns,
|
||||
upstream_dns: upstreamDns,
|
||||
bootstrap_dns,
|
||||
upstream_mode,
|
||||
}}
|
||||
onSubmit={handleSubmit}
|
||||
processingTestUpstream={processingTestUpstream}
|
||||
processingSetConfig={processingSetConfig}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user