fix client form
This commit is contained in:
108
client/package-lock.json
generated
vendored
108
client/package-lock.json
generated
vendored
@@ -39,7 +39,6 @@
|
||||
"react-transition-group": "^4.4.5",
|
||||
"redux": "^4.0.5",
|
||||
"redux-actions": "^2.6.5",
|
||||
"redux-form": "^8.3.10",
|
||||
"redux-thunk": "^2.3.0",
|
||||
"ts-migrate": "^0.1.35",
|
||||
"url-polyfill": "^1.1.12"
|
||||
@@ -63,7 +62,6 @@
|
||||
"@types/react-router-dom": "^5.3.3",
|
||||
"@types/react-table": "^7.7.20",
|
||||
"@types/redux-actions": "^2.6.5",
|
||||
"@types/redux-form": "^8.3.10",
|
||||
"@typescript-eslint/eslint-plugin": "^7.11.0",
|
||||
"@typescript-eslint/parser": "^7.10.0",
|
||||
"babel-loader": "^9.1.3",
|
||||
@@ -3985,16 +3983,6 @@
|
||||
"integrity": "sha512-RgXOigay5cNweP+xH1ru+Vaaj1xXYLpWIfSVO8cSA8Ii2xvR+HRfWYdLe1UVOA8X0kIklalGOa0DTDyld0obkg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/redux-form": {
|
||||
"version": "8.3.10",
|
||||
"resolved": "https://registry.npmjs.org/@types/redux-form/-/redux-form-8.3.10.tgz",
|
||||
"integrity": "sha512-LExE1Ql/PY4zjjDd6otptJ/ymwCNdEJAvcXpD+cWzhHR1QZhimo8p1DIrJoAMzn3KmEC5fgaH6PNdWhCPqHJnw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/react": "*",
|
||||
"redux": "^3.6.0 || ^4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/retry": {
|
||||
"version": "0.12.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.2.tgz",
|
||||
@@ -7939,11 +7927,6 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/es6-error": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz",
|
||||
"integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg=="
|
||||
},
|
||||
"node_modules/escalade": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz",
|
||||
@@ -10932,11 +10915,6 @@
|
||||
"integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/is-promise": {
|
||||
"version": "2.2.2",
|
||||
"resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.2.2.tgz",
|
||||
"integrity": "sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ=="
|
||||
},
|
||||
"node_modules/is-regex": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz",
|
||||
@@ -16039,47 +16017,6 @@
|
||||
"to-camel-case": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/redux-form": {
|
||||
"version": "8.3.10",
|
||||
"resolved": "https://registry.npmjs.org/redux-form/-/redux-form-8.3.10.tgz",
|
||||
"integrity": "sha512-Eeog8dJYUxCSZI/oBoy7VkprvMjj1lpUnHa3LwjVNZvYDNeiRZMoZoaAT+6nlK2YQ4aiBopKUMiLe4ihUOHCGg==",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.9.2",
|
||||
"es6-error": "^4.1.1",
|
||||
"hoist-non-react-statics": "^3.3.2",
|
||||
"invariant": "^2.2.4",
|
||||
"is-promise": "^2.1.0",
|
||||
"lodash": "^4.17.15",
|
||||
"prop-types": "^15.6.1",
|
||||
"react-is": "^16.4.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.10"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/redux-form"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"immutable": "^3.8.2 || ^4.0.0",
|
||||
"react": "^16.4.2 || ^17.0.0 || ^18.0.0",
|
||||
"react-redux": "^6.0.1 || ^7.0.0 || ^8.0.0",
|
||||
"redux": "^3.7.2 || ^4.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"immutable": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/redux-form/node_modules/hoist-non-react-statics": {
|
||||
"version": "3.3.2",
|
||||
"resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz",
|
||||
"integrity": "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==",
|
||||
"dependencies": {
|
||||
"react-is": "^16.7.0"
|
||||
}
|
||||
},
|
||||
"node_modules/redux-thunk": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-2.3.0.tgz",
|
||||
@@ -23099,16 +23036,6 @@
|
||||
"integrity": "sha512-RgXOigay5cNweP+xH1ru+Vaaj1xXYLpWIfSVO8cSA8Ii2xvR+HRfWYdLe1UVOA8X0kIklalGOa0DTDyld0obkg==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/redux-form": {
|
||||
"version": "8.3.10",
|
||||
"resolved": "https://registry.npmjs.org/@types/redux-form/-/redux-form-8.3.10.tgz",
|
||||
"integrity": "sha512-LExE1Ql/PY4zjjDd6otptJ/ymwCNdEJAvcXpD+cWzhHR1QZhimo8p1DIrJoAMzn3KmEC5fgaH6PNdWhCPqHJnw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/react": "*",
|
||||
"redux": "^3.6.0 || ^4.0.0"
|
||||
}
|
||||
},
|
||||
"@types/retry": {
|
||||
"version": "0.12.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.2.tgz",
|
||||
@@ -26032,11 +25959,6 @@
|
||||
"is-symbol": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"es6-error": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz",
|
||||
"integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg=="
|
||||
},
|
||||
"escalade": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz",
|
||||
@@ -28198,11 +28120,6 @@
|
||||
"integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==",
|
||||
"dev": true
|
||||
},
|
||||
"is-promise": {
|
||||
"version": "2.2.2",
|
||||
"resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.2.2.tgz",
|
||||
"integrity": "sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ=="
|
||||
},
|
||||
"is-regex": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz",
|
||||
@@ -31922,31 +31839,6 @@
|
||||
"to-camel-case": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"redux-form": {
|
||||
"version": "8.3.10",
|
||||
"resolved": "https://registry.npmjs.org/redux-form/-/redux-form-8.3.10.tgz",
|
||||
"integrity": "sha512-Eeog8dJYUxCSZI/oBoy7VkprvMjj1lpUnHa3LwjVNZvYDNeiRZMoZoaAT+6nlK2YQ4aiBopKUMiLe4ihUOHCGg==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.9.2",
|
||||
"es6-error": "^4.1.1",
|
||||
"hoist-non-react-statics": "^3.3.2",
|
||||
"invariant": "^2.2.4",
|
||||
"is-promise": "^2.1.0",
|
||||
"lodash": "^4.17.15",
|
||||
"prop-types": "^15.6.1",
|
||||
"react-is": "^16.4.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"hoist-non-react-statics": {
|
||||
"version": "3.3.2",
|
||||
"resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz",
|
||||
"integrity": "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==",
|
||||
"requires": {
|
||||
"react-is": "^16.7.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"redux-thunk": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-2.3.0.tgz",
|
||||
|
||||
2
client/package.json
vendored
2
client/package.json
vendored
@@ -52,7 +52,6 @@
|
||||
"react-transition-group": "^4.4.5",
|
||||
"redux": "^4.0.5",
|
||||
"redux-actions": "^2.6.5",
|
||||
"redux-form": "^8.3.10",
|
||||
"redux-thunk": "^2.3.0",
|
||||
"ts-migrate": "^0.1.35",
|
||||
"url-polyfill": "^1.1.12"
|
||||
@@ -76,7 +75,6 @@
|
||||
"@types/react-router-dom": "^5.3.3",
|
||||
"@types/react-table": "^7.7.20",
|
||||
"@types/redux-actions": "^2.6.5",
|
||||
"@types/redux-form": "^8.3.10",
|
||||
"@typescript-eslint/eslint-plugin": "^7.11.0",
|
||||
"@typescript-eslint/parser": "^7.10.0",
|
||||
"babel-loader": "^9.1.3",
|
||||
|
||||
@@ -29,7 +29,6 @@ export const BlockedServices = ({ services }: Props) => {
|
||||
<ServiceField
|
||||
{...field}
|
||||
placeholder={t('blocked_services_global')}
|
||||
disabled={useGlobalServices}
|
||||
className="service--global"
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -5,7 +5,7 @@ import { Controller, FormProvider, useForm } from 'react-hook-form';
|
||||
import Select from 'react-select';
|
||||
|
||||
import Tabs from '../../../ui/Tabs';
|
||||
import { CLIENT_ID_LINK } from '../../../../helpers/constants';
|
||||
import { CLIENT_ID_LINK, LOCAL_TIMEZONE_VALUE } from '../../../../helpers/constants';
|
||||
import { RootState } from '../../../../initialState';
|
||||
import { Input } from '../../../ui/Controls/Input';
|
||||
import { validateRequiredValue } from '../../../../helpers/validators';
|
||||
@@ -14,6 +14,27 @@ import { BlockedServices, ClientIds, MainSettings, ScheduleServices, UpstreamDns
|
||||
|
||||
import '../Service.css';
|
||||
|
||||
const defaultFormValues: ClientForm = {
|
||||
ids: [{ name: '' }],
|
||||
name: '',
|
||||
tags: [],
|
||||
use_global_settings: false,
|
||||
filtering_enabled: false,
|
||||
safebrowsing_enabled: false,
|
||||
parental_enabled: false,
|
||||
ignore_querylog: false,
|
||||
ignore_statistics: false,
|
||||
blocked_services: {},
|
||||
safe_search: { enabled: false },
|
||||
upstreams: '',
|
||||
upstreams_cache_enabled: false,
|
||||
upstreams_cache_size: 0,
|
||||
use_global_blocked_services: false,
|
||||
blocked_services_schedule: {
|
||||
time_zone: LOCAL_TIMEZONE_VALUE,
|
||||
},
|
||||
};
|
||||
|
||||
type Props = {
|
||||
onSubmit: (...args: unknown[]) => void;
|
||||
onClose: () => void;
|
||||
@@ -38,7 +59,10 @@ export const Form = ({
|
||||
}: Props) => {
|
||||
const { t } = useTranslation();
|
||||
const methods = useForm<ClientForm>({
|
||||
defaultValues: initialValues,
|
||||
defaultValues: {
|
||||
...defaultFormValues,
|
||||
...initialValues,
|
||||
},
|
||||
mode: 'onChange',
|
||||
});
|
||||
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import {
|
||||
ALL_INTERFACES_IP,
|
||||
BLOCKING_MODES,
|
||||
DAY,
|
||||
DEFAULT_LOGS_FILTER,
|
||||
INSTALL_FIRST_STEP,
|
||||
STANDARD_DNS_PORT,
|
||||
STANDARD_WEB_PORT,
|
||||
TIME_UNITS,
|
||||
|
||||
Reference in New Issue
Block a user