From 789060e4d439a7d32b606625353c826c61a1db85 Mon Sep 17 00:00:00 2001 From: Ildar Kamalov Date: Tue, 21 Nov 2023 16:28:03 +0300 Subject: [PATCH] client: add form fields --- client/src/__locales/en.json | 4 +- .../Clients/ClientsTable/ClientsTable.js | 4 ++ .../src/components/Settings/Clients/Form.js | 38 ++++++++++++++++++- 3 files changed, 43 insertions(+), 3 deletions(-) diff --git a/client/src/__locales/en.json b/client/src/__locales/en.json index e75c1259..5edd09e3 100644 --- a/client/src/__locales/en.json +++ b/client/src/__locales/en.json @@ -734,5 +734,7 @@ "wednesday_short": "Wed", "thursday_short": "Thu", "friday_short": "Fri", - "saturday_short": "Sat" + "saturday_short": "Sat", + "upstream_dns_cache_configuration": "Upstream DNS cache configuration", + "enable_upstream_dns_cache": "Enable upstream DNS cache" } diff --git a/client/src/components/Settings/Clients/ClientsTable/ClientsTable.js b/client/src/components/Settings/Clients/ClientsTable/ClientsTable.js index 9f65986f..f4744a5a 100644 --- a/client/src/components/Settings/Clients/ClientsTable/ClientsTable.js +++ b/client/src/components/Settings/Clients/ClientsTable/ClientsTable.js @@ -79,6 +79,10 @@ const ClientsTable = ({ } else { config.tags = []; } + + if (typeof values.upstreams_cache_size === 'string') { + config.upstreams_cache_size = 0; + } } if (modalType === MODAL_TYPE.EDIT_FILTERS) { diff --git a/client/src/components/Settings/Clients/Form.js b/client/src/components/Settings/Clients/Form.js index 652957d0..bc1c9712 100644 --- a/client/src/components/Settings/Clients/Form.js +++ b/client/src/components/Settings/Clients/Form.js @@ -12,8 +12,13 @@ import i18n from '../../../i18n'; import Tabs from '../../ui/Tabs'; import Examples from '../Dns/Upstream/Examples'; import { ScheduleForm } from '../../Filters/Services/ScheduleForm'; -import { toggleAllServices, trimLinesAndRemoveEmpty, captitalizeWords } from '../../../helpers/helpers'; import { + toggleAllServices, + trimLinesAndRemoveEmpty, + captitalizeWords, +} from '../../../helpers/helpers'; +import { + toNumber, renderInputField, renderGroupField, CheckboxField, @@ -21,7 +26,7 @@ import { renderTextareaField, } from '../../../helpers/form'; import { validateClientId, validateRequiredValue } from '../../../helpers/validators'; -import { CLIENT_ID_LINK, FORM_NAME } from '../../../helpers/constants'; +import { CLIENT_ID_LINK, FORM_NAME, UINT32_RANGE } from '../../../helpers/constants'; import './Service.css'; const settingsCheckboxes = [ @@ -217,6 +222,35 @@ let Form = (props) => { /> ))} +
+ {t('upstream_dns_cache_configuration')} +
+
+ +
+
+ + +
, }, block_services: {