aboutsummaryrefslogtreecommitdiffstats
path: root/src/containers/settings
diff options
context:
space:
mode:
authorLibravatar Vijay A <avijayr@protonmail.com>2021-09-08 23:44:24 +0530
committerLibravatar Vijay A <avijayr@protonmail.com>2021-09-08 23:52:06 +0530
commit4960927289b88bcacbf7af2baa9c551deac64072 (patch)
tree4a338c63d2d42e06d37e6f01d14c5f2048c76ace /src/containers/settings
parentfix: U2F devices not recognised in snapcraft image (#1892) (diff)
downloadferdium-app-4960927289b88bcacbf7af2baa9c551deac64072.tar.gz
ferdium-app-4960927289b88bcacbf7af2baa9c551deac64072.tar.zst
ferdium-app-4960927289b88bcacbf7af2baa9c551deac64072.zip
Revert "chore: proxy feature is always turned on: remove 'enabled' flag"
Diffstat (limited to 'src/containers/settings')
-rw-r--r--src/containers/settings/EditServiceScreen.js77
1 files changed, 41 insertions, 36 deletions
diff --git a/src/containers/settings/EditServiceScreen.js b/src/containers/settings/EditServiceScreen.js
index 3a66a27e6..c880e97ae 100644
--- a/src/containers/settings/EditServiceScreen.js
+++ b/src/containers/settings/EditServiceScreen.js
@@ -18,6 +18,8 @@ import ErrorBoundary from '../../components/util/ErrorBoundary';
18import { required, url, oneRequired } from '../../helpers/validation-helpers'; 18import { required, url, oneRequired } from '../../helpers/validation-helpers';
19import { getSelectOptions } from '../../helpers/i18n-helpers'; 19import { getSelectOptions } from '../../helpers/i18n-helpers';
20 20
21import { config as proxyFeature } from '../../features/serviceProxy';
22
21import { SPELLCHECKER_LOCALES } from '../../i18n/languages'; 23import { SPELLCHECKER_LOCALES } from '../../i18n/languages';
22 24
23import globalMessages from '../../i18n/globalMessages'; 25import globalMessages from '../../i18n/globalMessages';
@@ -129,7 +131,7 @@ export default @inject('stores', 'actions') @observer class EditServiceScreen ex
129 } 131 }
130 } 132 }
131 133
132 prepareForm(recipe, service) { 134 prepareForm(recipe, service, proxy) {
133 const { 135 const {
134 intl, 136 intl,
135 } = this.context; 137 } = this.context;
@@ -273,42 +275,44 @@ export default @inject('stores', 'actions') @observer class EditServiceScreen ex
273 }); 275 });
274 } 276 }
275 277
276 const serviceProxyConfig = stores.settings.proxy[service.id] || {}; 278 if (proxy.isEnabled) {
277 279 const serviceProxyConfig = stores.settings.proxy[service.id] || {};
278 Object.assign(config.fields, { 280
279 proxy: { 281 Object.assign(config.fields, {
280 name: 'proxy', 282 proxy: {
281 label: 'proxy', 283 name: 'proxy',
282 fields: { 284 label: 'proxy',
283 isEnabled: { 285 fields: {
284 label: intl.formatMessage(messages.enableProxy), 286 isEnabled: {
285 value: serviceProxyConfig.isEnabled, 287 label: intl.formatMessage(messages.enableProxy),
286 default: false, 288 value: serviceProxyConfig.isEnabled,
287 }, 289 default: false,
288 host: { 290 },
289 label: intl.formatMessage(messages.proxyHost), 291 host: {
290 value: serviceProxyConfig.host, 292 label: intl.formatMessage(messages.proxyHost),
291 default: '', 293 value: serviceProxyConfig.host,
292 }, 294 default: '',
293 port: { 295 },
294 label: intl.formatMessage(messages.proxyPort), 296 port: {
295 value: serviceProxyConfig.port, 297 label: intl.formatMessage(messages.proxyPort),
296 default: '', 298 value: serviceProxyConfig.port,
297 }, 299 default: '',
298 user: { 300 },
299 label: intl.formatMessage(messages.proxyUser), 301 user: {
300 value: serviceProxyConfig.user, 302 label: intl.formatMessage(messages.proxyUser),
301 default: '', 303 value: serviceProxyConfig.user,
302 }, 304 default: '',
303 password: { 305 },
304 label: intl.formatMessage(messages.proxyPassword), 306 password: {
305 value: serviceProxyConfig.password, 307 label: intl.formatMessage(messages.proxyPassword),
306 default: '', 308 value: serviceProxyConfig.password,
307 type: 'password', 309 default: '',
310 type: 'password',
311 },
308 }, 312 },
309 }, 313 },
310 }, 314 });
311 }); 315 }
312 316
313 return new Form(config); 317 return new Form(config);
314 } 318 }
@@ -377,7 +381,7 @@ export default @inject('stores', 'actions') @observer class EditServiceScreen ex
377 ); 381 );
378 } 382 }
379 383
380 const form = this.prepareForm(recipe, service); 384 const form = this.prepareForm(recipe, service, proxyFeature);
381 385
382 return ( 386 return (
383 <ErrorBoundary> 387 <ErrorBoundary>
@@ -393,6 +397,7 @@ export default @inject('stores', 'actions') @observer class EditServiceScreen ex
393 onSubmit={(d) => this.onSubmit(d)} 397 onSubmit={(d) => this.onSubmit(d)}
394 onDelete={() => this.deleteService()} 398 onDelete={() => this.deleteService()}
395 openRecipeFile={(file) => this.openRecipeFile(file)} 399 openRecipeFile={(file) => this.openRecipeFile(file)}
400 isProxyFeatureEnabled={proxyFeature.isEnabled}
396 /> 401 />
397 </ErrorBoundary> 402 </ErrorBoundary>
398 ); 403 );