diff options
author | 2017-12-15 14:41:49 +0100 | |
---|---|---|
committer | 2017-12-15 14:41:49 +0100 | |
commit | 19c45a41cdd8051ecd97cf90ca98b0e8a13c98fb (patch) | |
tree | 50c2b2512d15cae8525889714e1f003a17371ed7 /src/components/settings/services/EditServiceForm.js | |
parent | Merge pull request #469 from meetfranz/feature/hide-badge (diff) | |
parent | Add missing translation strings (diff) | |
download | ferdium-app-19c45a41cdd8051ecd97cf90ca98b0e8a13c98fb.tar.gz ferdium-app-19c45a41cdd8051ecd97cf90ca98b0e8a13c98fb.tar.zst ferdium-app-19c45a41cdd8051ecd97cf90ca98b0e8a13c98fb.zip |
Merge pull request #474 from meetfranz/feature/service-improvements
[PR] Service improvements
Diffstat (limited to 'src/components/settings/services/EditServiceForm.js')
-rw-r--r-- | src/components/settings/services/EditServiceForm.js | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/components/settings/services/EditServiceForm.js b/src/components/settings/services/EditServiceForm.js index 32f9d72f0..4458c4c5a 100644 --- a/src/components/settings/services/EditServiceForm.js +++ b/src/components/settings/services/EditServiceForm.js | |||
@@ -47,6 +47,10 @@ const messages = defineMessages({ | |||
47 | id: 'settings.service.form.tabOnPremise', | 47 | id: 'settings.service.form.tabOnPremise', |
48 | defaultMessage: '!!!Self hosted ⭐️', | 48 | defaultMessage: '!!!Self hosted ⭐️', |
49 | }, | 49 | }, |
50 | useHostedService: { | ||
51 | id: 'settings.service.form.useHostedService', | ||
52 | defaultMessage: '!!!Use the hosted {name} service.', | ||
53 | }, | ||
50 | customUrlValidationError: { | 54 | customUrlValidationError: { |
51 | id: 'settings.service.form.customUrlValidationError', | 55 | id: 'settings.service.form.customUrlValidationError', |
52 | defaultMessage: '!!!Could not validate custom {name} server.', | 56 | defaultMessage: '!!!Could not validate custom {name} server.', |
@@ -120,7 +124,6 @@ export default class EditServiceForm extends Component { | |||
120 | this.props.form.submit({ | 124 | this.props.form.submit({ |
121 | onSuccess: async (form) => { | 125 | onSuccess: async (form) => { |
122 | const values = form.values(); | 126 | const values = form.values(); |
123 | |||
124 | let isValid = true; | 127 | let isValid = true; |
125 | 128 | ||
126 | if (recipe.validateUrl && values.customUrl) { | 129 | if (recipe.validateUrl && values.customUrl) { |
@@ -178,6 +181,13 @@ export default class EditServiceForm extends Component { | |||
178 | /> | 181 | /> |
179 | ); | 182 | ); |
180 | 183 | ||
184 | let activeTabIndex = 0; | ||
185 | if (recipe.hasHostedOption && service.team) { | ||
186 | activeTabIndex = 1; | ||
187 | } else if (recipe.hasHostedOption && service.customUrl) { | ||
188 | activeTabIndex = 2; | ||
189 | } | ||
190 | |||
181 | return ( | 191 | return ( |
182 | <div className="settings__main"> | 192 | <div className="settings__main"> |
183 | <div className="settings__header"> | 193 | <div className="settings__header"> |
@@ -210,11 +220,20 @@ export default class EditServiceForm extends Component { | |||
210 | <Input field={form.$('name')} focus /> | 220 | <Input field={form.$('name')} focus /> |
211 | {(recipe.hasTeamId || recipe.hasCustomUrl) && ( | 221 | {(recipe.hasTeamId || recipe.hasCustomUrl) && ( |
212 | <Tabs | 222 | <Tabs |
213 | active={service.customUrl ? 1 : 0} | 223 | active={activeTabIndex} |
214 | > | 224 | > |
225 | {recipe.hasHostedOption && ( | ||
226 | <TabItem title={recipe.name}> | ||
227 | {intl.formatMessage(messages.useHostedService, { name: recipe.name })} | ||
228 | </TabItem> | ||
229 | )} | ||
215 | {recipe.hasTeamId && ( | 230 | {recipe.hasTeamId && ( |
216 | <TabItem title={intl.formatMessage(messages.tabHosted)}> | 231 | <TabItem title={intl.formatMessage(messages.tabHosted)}> |
217 | <Input field={form.$('team')} suffix={recipe.urlInputSuffix} /> | 232 | <Input |
233 | field={form.$('team')} | ||
234 | prefix={recipe.urlInputPrefix} | ||
235 | suffix={recipe.urlInputSuffix} | ||
236 | /> | ||
218 | </TabItem> | 237 | </TabItem> |
219 | )} | 238 | )} |
220 | {recipe.hasCustomUrl && ( | 239 | {recipe.hasCustomUrl && ( |