Pull request 2338: AGDNS-2665-upstream-timeout

Merge in DNS/adguard-home from AGDNS-2665-upstream-timeout to master

Squashed commit of the following:

commit b4041c97f2ccd371a9cff8312bda72f4c18496b9
Merge: d939b3b3e b92a3cfb8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Feb 7 16:15:19 2025 +0300

    Merge branch 'master' into AGDNS-2665-upstream-timeout

commit d939b3b3ef2345d315c05a3730e81e1f1ea9f79f
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Feb 7 16:10:06 2025 +0300

    client: imp i18n

commit 52089adb6c28d8c47f5a916d9df941c5fddea1fc
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Thu Feb 6 18:39:53 2025 +0300

    all: fix typo

commit aca08b1873c9f39b8c1da0439a9057117e1dacce
Author: Ildar Kamalov <ik@adguard.com>
Date:   Thu Feb 6 15:19:30 2025 +0300

    client: rearrange upstream timeout settings

commit 48e75fabe2f65aeac7156a020cce3d4c2412e5f9
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Tue Feb 4 20:48:53 2025 +0300

    github: upd actions cache

commit 64bac193fc834a975e6913bb86a6bf27e54c382a
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Tue Feb 4 20:28:54 2025 +0300

    all: imp code

commit 95c73698985dc528a4af6ff0d3b8a301da1f0d4a
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Mon Feb 3 16:25:35 2025 +0300

    all: upstream timeout
This commit is contained in:
Stanislav Chzhen
2025-02-10 16:07:11 +03:00
parent b92a3cfb89
commit 2fe2d254b5
13 changed files with 176 additions and 5 deletions

View File

@@ -7,8 +7,19 @@ import classnames from 'classnames';
import Examples from './Examples';
import { renderRadioField, renderTextareaField, CheckboxField } from '../../../../helpers/form';
import { DNS_REQUEST_OPTIONS, FORM_NAME, UPSTREAM_CONFIGURATION_WIKI_LINK } from '../../../../helpers/constants';
import {
renderRadioField,
renderTextareaField,
CheckboxField,
renderInputField,
toNumber,
} from '../../../../helpers/form';
import {
DNS_REQUEST_OPTIONS,
FORM_NAME,
UINT32_RANGE,
UPSTREAM_CONFIGURATION_WIKI_LINK,
} from '../../../../helpers/constants';
import { testUpstreamWithFormValues } from '../../../../actions';
@@ -17,6 +28,7 @@ import { removeEmptyLines, trimLinesAndRemoveEmpty } from '../../../../helpers/h
import { getTextareaCommentsHighlight, syncScroll } from '../../../../helpers/highlightTextareaComments';
import '../../../ui/texareaCommentsHighlight.css';
import { RootState } from '../../../../initialState';
import { validateRequiredValue } from '../../../../helpers/validators';
const UPSTREAM_DNS_NAME = 'upstream_dns';
const UPSTREAM_MODE_NAME = 'upstream_mode';
@@ -301,7 +313,7 @@ const Form = ({ submitting, invalid, handleSubmit }: FormProps) => {
<hr />
</div>
<div className="col-12 mb-4">
<div className="col-12">
<Field
name="resolve_clients"
type="checkbox"
@@ -311,6 +323,34 @@ const Form = ({ submitting, invalid, handleSubmit }: FormProps) => {
disabled={processingSetConfig}
/>
</div>
<div className="col-12">
<hr />
</div>
<div className="col-12 col-md-7">
<div className="form__group">
<label htmlFor="upstream_timeout" className="form__label form__label--with-desc">
<Trans>upstream_timeout</Trans>
</label>
<div className="form__desc form__desc--top">
<Trans>upstream_timeout_desc</Trans>
</div>
<Field
name="upstream_timeout"
type="number"
component={renderInputField}
className="form-control"
placeholder={t('form_enter_upstream_timeout')}
normalize={toNumber}
validate={validateRequiredValue}
min={1}
max={UINT32_RANGE.MAX}
/>
</div>
</div>
</div>
<div className="card-actions">

View File

@@ -19,6 +19,7 @@ const Upstream = () => {
resolve_clients,
local_ptr_upstreams,
use_private_ptr_resolvers,
upstream_timeout,
} = useSelector((state: RootState) => state.dnsConfig, shallowEqual);
const upstream_dns_file = useSelector((state: RootState) => state.dnsConfig.upstream_dns_file);
@@ -32,6 +33,7 @@ const Upstream = () => {
resolve_clients,
local_ptr_upstreams,
use_private_ptr_resolvers,
upstream_timeout,
} = values;
const dnsConfig = {
@@ -41,6 +43,7 @@ const Upstream = () => {
resolve_clients,
local_ptr_upstreams,
use_private_ptr_resolvers,
upstream_timeout,
...(upstream_dns_file ? null : { upstream_dns }),
};
@@ -64,6 +67,7 @@ const Upstream = () => {
resolve_clients,
local_ptr_upstreams,
use_private_ptr_resolvers,
upstream_timeout,
}}
onSubmit={handleSubmit}
/>