diff options
author | 2017-12-15 14:00:17 +0100 | |
---|---|---|
committer | 2017-12-15 14:00:17 +0100 | |
commit | 03610f2dd6833b3b6358790d044b852c154b4bf3 (patch) | |
tree | a48a18458304a10f63c16ed108ccd2d87b91823b /src/components/settings/services | |
parent | fix(Recipes): Enable `urlInputPrefix` for team and customURL (diff) | |
download | ferdium-app-03610f2dd6833b3b6358790d044b852c154b4bf3.tar.gz ferdium-app-03610f2dd6833b3b6358790d044b852c154b4bf3.tar.zst ferdium-app-03610f2dd6833b3b6358790d044b852c154b4bf3.zip |
feat(Recipes): Add `hasHostedOption` to enable hosted & self hosted services
Diffstat (limited to 'src/components/settings/services')
-rw-r--r-- | src/components/settings/services/EditServiceForm.js | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/components/settings/services/EditServiceForm.js b/src/components/settings/services/EditServiceForm.js index a7d296460..f689dd5c4 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.', |
@@ -108,7 +112,6 @@ export default class EditServiceForm extends Component { | |||
108 | this.props.form.submit({ | 112 | this.props.form.submit({ |
109 | onSuccess: async (form) => { | 113 | onSuccess: async (form) => { |
110 | const values = form.values(); | 114 | const values = form.values(); |
111 | |||
112 | let isValid = true; | 115 | let isValid = true; |
113 | 116 | ||
114 | if (recipe.validateUrl && values.customUrl) { | 117 | if (recipe.validateUrl && values.customUrl) { |
@@ -166,6 +169,13 @@ export default class EditServiceForm extends Component { | |||
166 | /> | 169 | /> |
167 | ); | 170 | ); |
168 | 171 | ||
172 | let activeTabIndex = 0; | ||
173 | if (recipe.hasHostedOption && service.team) { | ||
174 | activeTabIndex = 1; | ||
175 | } else if (recipe.hasHostedOption && service.customUrl) { | ||
176 | activeTabIndex = 2; | ||
177 | } | ||
178 | |||
169 | return ( | 179 | return ( |
170 | <div className="settings__main"> | 180 | <div className="settings__main"> |
171 | <div className="settings__header"> | 181 | <div className="settings__header"> |
@@ -198,8 +208,13 @@ export default class EditServiceForm extends Component { | |||
198 | <Input field={form.$('name')} focus /> | 208 | <Input field={form.$('name')} focus /> |
199 | {(recipe.hasTeamId || recipe.hasCustomUrl) && ( | 209 | {(recipe.hasTeamId || recipe.hasCustomUrl) && ( |
200 | <Tabs | 210 | <Tabs |
201 | active={service.customUrl ? 1 : 0} | 211 | active={activeTabIndex} |
202 | > | 212 | > |
213 | {recipe.hasHostedOption && ( | ||
214 | <TabItem title={recipe.name}> | ||
215 | {intl.formatMessage(messages.useHostedService, { name: recipe.name })} | ||
216 | </TabItem> | ||
217 | )} | ||
203 | {recipe.hasTeamId && ( | 218 | {recipe.hasTeamId && ( |
204 | <TabItem title={intl.formatMessage(messages.tabHosted)}> | 219 | <TabItem title={intl.formatMessage(messages.tabHosted)}> |
205 | <Input | 220 | <Input |