diff options
author | 2018-11-27 18:06:14 +0100 | |
---|---|---|
committer | 2018-11-27 18:06:14 +0100 | |
commit | 62972747866740dae84fc7b519fcedd731572329 (patch) | |
tree | 3a74610caa47350ff6b3cc07482f8472f18c1764 /src/components/settings | |
parent | Fix listening key (diff) | |
download | ferdium-app-62972747866740dae84fc7b519fcedd731572329.tar.gz ferdium-app-62972747866740dae84fc7b519fcedd731572329.tar.zst ferdium-app-62972747866740dae84fc7b519fcedd731572329.zip |
feat(App): Add proxy support for services
Diffstat (limited to 'src/components/settings')
4 files changed, 60 insertions, 38 deletions
diff --git a/src/components/settings/account/AccountDashboard.js b/src/components/settings/account/AccountDashboard.js index ede519fd6..06c7074dd 100644 --- a/src/components/settings/account/AccountDashboard.js +++ b/src/components/settings/account/AccountDashboard.js | |||
@@ -180,11 +180,9 @@ export default @observer class AccountDashboard extends Component { | |||
180 | <span className="badge badge--success">{intl.formatMessage(messages.accountTypeEnterprise)}</span> | 180 | <span className="badge badge--success">{intl.formatMessage(messages.accountTypeEnterprise)}</span> |
181 | )} | 181 | )} |
182 | </div> | 182 | </div> |
183 | {!user.isSSO && ( | 183 | <Link to="/settings/user/edit" className="button"> |
184 | <Link to="/settings/user/edit" className="button"> | 184 | {intl.formatMessage(messages.accountEditButton)} |
185 | {intl.formatMessage(messages.accountEditButton)} | 185 | </Link> |
186 | </Link> | ||
187 | )} | ||
188 | {user.emailValidated} | 186 | {user.emailValidated} |
189 | </div> | 187 | </div> |
190 | </div> | 188 | </div> |
diff --git a/src/components/settings/navigation/SettingsNavigation.js b/src/components/settings/navigation/SettingsNavigation.js index d8b410aaf..b86d94ac7 100644 --- a/src/components/settings/navigation/SettingsNavigation.js +++ b/src/components/settings/navigation/SettingsNavigation.js | |||
@@ -43,20 +43,17 @@ export default @inject('stores') @observer class SettingsNavigation extends Comp | |||
43 | 43 | ||
44 | render() { | 44 | render() { |
45 | const { serviceCount } = this.props; | 45 | const { serviceCount } = this.props; |
46 | const { features } = this.props.stores.features; | ||
47 | const { intl } = this.context; | 46 | const { intl } = this.context; |
48 | 47 | ||
49 | return ( | 48 | return ( |
50 | <div className="settings-navigation"> | 49 | <div className="settings-navigation"> |
51 | {features.userCanManageServices && ( | 50 | <Link |
52 | <Link | 51 | to="/settings/recipes" |
53 | to="/settings/recipes" | 52 | className="settings-navigation__link" |
54 | className="settings-navigation__link" | 53 | activeClassName="is-active" |
55 | activeClassName="is-active" | 54 | > |
56 | > | 55 | {intl.formatMessage(messages.availableServices)} |
57 | {intl.formatMessage(messages.availableServices)} | 56 | </Link> |
58 | </Link> | ||
59 | )} | ||
60 | <Link | 57 | <Link |
61 | to="/settings/services" | 58 | to="/settings/services" |
62 | className="settings-navigation__link" | 59 | className="settings-navigation__link" |
@@ -97,11 +94,3 @@ export default @inject('stores') @observer class SettingsNavigation extends Comp | |||
97 | } | 94 | } |
98 | } | 95 | } |
99 | 96 | ||
100 | SettingsNavigation.wrappedComponent.propTypes = { | ||
101 | stores: PropTypes.shape({ | ||
102 | features: PropTypes.shape({ | ||
103 | features: PropTypes.object.isRequired, | ||
104 | }).isRequired, | ||
105 | }).isRequired, | ||
106 | }; | ||
107 | |||
diff --git a/src/components/settings/services/EditServiceForm.js b/src/components/settings/services/EditServiceForm.js index 777a95fcf..47772efae 100644 --- a/src/components/settings/services/EditServiceForm.js +++ b/src/components/settings/services/EditServiceForm.js | |||
@@ -15,6 +15,8 @@ import Toggle from '../../ui/Toggle'; | |||
15 | import Button from '../../ui/Button'; | 15 | import Button from '../../ui/Button'; |
16 | import ImageUpload from '../../ui/ImageUpload'; | 16 | import ImageUpload from '../../ui/ImageUpload'; |
17 | 17 | ||
18 | import PremiumFeatureContainer from '../../ui/PremiumFeatureContainer'; | ||
19 | |||
18 | const messages = defineMessages({ | 20 | const messages = defineMessages({ |
19 | saveService: { | 21 | saveService: { |
20 | id: 'settings.service.form.saveButton', | 22 | id: 'settings.service.form.saveButton', |
@@ -92,6 +94,14 @@ const messages = defineMessages({ | |||
92 | id: 'settings.service.form.iconUpload', | 94 | id: 'settings.service.form.iconUpload', |
93 | defaultMessage: '!!!Drop your image, or click here', | 95 | defaultMessage: '!!!Drop your image, or click here', |
94 | }, | 96 | }, |
97 | headlineProxy: { | ||
98 | id: 'settings.service.form.proxy.headline', | ||
99 | defaultMessage: '!!!Proxy Settings', | ||
100 | }, | ||
101 | proxyInfo: { | ||
102 | id: 'settings.service.form.proxy.info', | ||
103 | defaultMessage: '!!!Proxy settings will not be synchronized with the Franz servers.', | ||
104 | }, | ||
95 | }); | 105 | }); |
96 | 106 | ||
97 | export default @observer class EditServiceForm extends Component { | 107 | export default @observer class EditServiceForm extends Component { |
@@ -106,13 +116,14 @@ export default @observer class EditServiceForm extends Component { | |||
106 | return null; | 116 | return null; |
107 | }, | 117 | }, |
108 | user: PropTypes.instanceOf(User).isRequired, | 118 | user: PropTypes.instanceOf(User).isRequired, |
109 | userCanManageServices: PropTypes.bool.isRequired, | ||
110 | action: PropTypes.string.isRequired, | 119 | action: PropTypes.string.isRequired, |
111 | form: PropTypes.instanceOf(Form).isRequired, | 120 | form: PropTypes.instanceOf(Form).isRequired, |
112 | onSubmit: PropTypes.func.isRequired, | 121 | onSubmit: PropTypes.func.isRequired, |
113 | onDelete: PropTypes.func.isRequired, | 122 | onDelete: PropTypes.func.isRequired, |
114 | isSaving: PropTypes.bool.isRequired, | 123 | isSaving: PropTypes.bool.isRequired, |
115 | isDeleting: PropTypes.bool.isRequired, | 124 | isDeleting: PropTypes.bool.isRequired, |
125 | isProxyFeatureEnabled: PropTypes.bool.isRequired, | ||
126 | isProxyFeaturePremiumFeature: PropTypes.bool.isRequired, | ||
116 | }; | 127 | }; |
117 | 128 | ||
118 | static defaultProps = { | 129 | static defaultProps = { |
@@ -169,11 +180,12 @@ export default @observer class EditServiceForm extends Component { | |||
169 | service, | 180 | service, |
170 | action, | 181 | action, |
171 | user, | 182 | user, |
172 | userCanManageServices, | ||
173 | form, | 183 | form, |
174 | isSaving, | 184 | isSaving, |
175 | isDeleting, | 185 | isDeleting, |
176 | onDelete, | 186 | onDelete, |
187 | isProxyFeatureEnabled, | ||
188 | isProxyFeaturePremiumFeature, | ||
177 | } = this.props; | 189 | } = this.props; |
178 | const { intl } = this.context; | 190 | const { intl } = this.context; |
179 | 191 | ||
@@ -318,6 +330,33 @@ export default @observer class EditServiceForm extends Component { | |||
318 | /> | 330 | /> |
319 | </div> | 331 | </div> |
320 | </div> | 332 | </div> |
333 | |||
334 | {isProxyFeatureEnabled && ( | ||
335 | <PremiumFeatureContainer condition={isProxyFeaturePremiumFeature}> | ||
336 | <div className="settings__settings-group"> | ||
337 | <h3> | ||
338 | {intl.formatMessage(messages.headlineProxy)} | ||
339 | <span className="badge badge--success">beta</span> | ||
340 | </h3> | ||
341 | <Toggle field={form.$('proxy.isEnabled')} /> | ||
342 | {form.$('proxy.isEnabled').value && ( | ||
343 | <div> | ||
344 | <Input field={form.$('proxy.host')} /> | ||
345 | <Input field={form.$('proxy.user')} /> | ||
346 | <Input | ||
347 | field={form.$('proxy.password')} | ||
348 | showPasswordToggle | ||
349 | /> | ||
350 | <p> | ||
351 | <span className="mdi mdi-information" /> | ||
352 | {intl.formatMessage(messages.proxyInfo)} | ||
353 | </p> | ||
354 | </div> | ||
355 | )} | ||
356 | </div> | ||
357 | </PremiumFeatureContainer> | ||
358 | )} | ||
359 | |||
321 | {recipe.message && ( | 360 | {recipe.message && ( |
322 | <p className="settings__message"> | 361 | <p className="settings__message"> |
323 | <span className="mdi mdi-information" /> | 362 | <span className="mdi mdi-information" /> |
@@ -328,7 +367,7 @@ export default @observer class EditServiceForm extends Component { | |||
328 | </div> | 367 | </div> |
329 | <div className="settings__controls"> | 368 | <div className="settings__controls"> |
330 | {/* Delete Button */} | 369 | {/* Delete Button */} |
331 | {action === 'edit' && userCanManageServices && deleteButton} | 370 | {action === 'edit' && deleteButton} |
332 | 371 | ||
333 | {/* Save Button */} | 372 | {/* Save Button */} |
334 | {isSaving || isValidatingCustomUrl ? ( | 373 | {isSaving || isValidatingCustomUrl ? ( |
diff --git a/src/components/settings/settings/EditSettingsForm.js b/src/components/settings/settings/EditSettingsForm.js index b87c11fc4..280449ead 100644 --- a/src/components/settings/settings/EditSettingsForm.js +++ b/src/components/settings/settings/EditSettingsForm.js | |||
@@ -96,7 +96,6 @@ export default @observer class EditSettingsForm extends Component { | |||
96 | isClearingAllCache: PropTypes.bool.isRequired, | 96 | isClearingAllCache: PropTypes.bool.isRequired, |
97 | onClearAllCache: PropTypes.func.isRequired, | 97 | onClearAllCache: PropTypes.func.isRequired, |
98 | cacheSize: PropTypes.string.isRequired, | 98 | cacheSize: PropTypes.string.isRequired, |
99 | isPremiumUser: PropTypes.bool.isRequired, | ||
100 | isSpellcheckerPremiumFeature: PropTypes.bool.isRequired, | 99 | isSpellcheckerPremiumFeature: PropTypes.bool.isRequired, |
101 | }; | 100 | }; |
102 | 101 | ||
@@ -127,7 +126,6 @@ export default @observer class EditSettingsForm extends Component { | |||
127 | isClearingAllCache, | 126 | isClearingAllCache, |
128 | onClearAllCache, | 127 | onClearAllCache, |
129 | cacheSize, | 128 | cacheSize, |
130 | isPremiumUser, | ||
131 | isSpellcheckerPremiumFeature, | 129 | isSpellcheckerPremiumFeature, |
132 | } = this.props; | 130 | } = this.props; |
133 | const { intl } = this.context; | 131 | const { intl } = this.context; |
@@ -180,16 +178,14 @@ export default @observer class EditSettingsForm extends Component { | |||
180 | 178 | ||
181 | {/* Advanced */} | 179 | {/* Advanced */} |
182 | <h2 id="advanced">{intl.formatMessage(messages.headlineAdvanced)}</h2> | 180 | <h2 id="advanced">{intl.formatMessage(messages.headlineAdvanced)}</h2> |
183 | {!isPremiumUser && isSpellcheckerPremiumFeature ? ( | 181 | <PremiumFeatureContainer |
184 | <PremiumFeatureContainer> | 182 | condition={isSpellcheckerPremiumFeature} |
185 | <Toggle | 183 | > |
186 | field={form.$('enableSpellchecking')} | 184 | <Toggle |
187 | disabled | 185 | field={form.$('enableSpellchecking')} |
188 | /> | 186 | disabled |
189 | </PremiumFeatureContainer> | 187 | /> |
190 | ) : ( | 188 | </PremiumFeatureContainer> |
191 | <Toggle field={form.$('enableSpellchecking')} /> | ||
192 | )} | ||
193 | <Toggle field={form.$('enableGPUAcceleration')} /> | 189 | <Toggle field={form.$('enableGPUAcceleration')} /> |
194 | <p className="settings__help">{intl.formatMessage(messages.enableGPUAccelerationInfo)}</p> | 190 | <p className="settings__help">{intl.formatMessage(messages.enableGPUAccelerationInfo)}</p> |
195 | {/* <Select field={form.$('spellcheckingLanguage')} /> */} | 191 | {/* <Select field={form.$('spellcheckingLanguage')} /> */} |