diff options
Diffstat (limited to 'src/containers/settings/EditServiceScreen.js')
-rw-r--r-- | src/containers/settings/EditServiceScreen.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/containers/settings/EditServiceScreen.js b/src/containers/settings/EditServiceScreen.js index e69c2c2a8..17d727642 100644 --- a/src/containers/settings/EditServiceScreen.js +++ b/src/containers/settings/EditServiceScreen.js | |||
@@ -6,6 +6,7 @@ import { defineMessages, intlShape } from 'react-intl'; | |||
6 | import UserStore from '../../stores/UserStore'; | 6 | import UserStore from '../../stores/UserStore'; |
7 | import RecipesStore from '../../stores/RecipesStore'; | 7 | import RecipesStore from '../../stores/RecipesStore'; |
8 | import ServicesStore from '../../stores/ServicesStore'; | 8 | import ServicesStore from '../../stores/ServicesStore'; |
9 | import FeaturesStore from '../../stores/FeaturesStore'; | ||
9 | import SettingsStore from '../../stores/SettingsStore'; | 10 | import SettingsStore from '../../stores/SettingsStore'; |
10 | import Form from '../../lib/Form'; | 11 | import Form from '../../lib/Form'; |
11 | import { gaPage } from '../../lib/analytics'; | 12 | import { gaPage } from '../../lib/analytics'; |
@@ -81,7 +82,7 @@ export default @inject('stores', 'actions') @observer class EditServiceScreen ex | |||
81 | } | 82 | } |
82 | } | 83 | } |
83 | 84 | ||
84 | prepareForm(recipe, service) { | 85 | prepareForm(recipe, service, userCanManageServices) { |
85 | const { intl } = this.context; | 86 | const { intl } = this.context; |
86 | const config = { | 87 | const config = { |
87 | fields: { | 88 | fields: { |
@@ -127,6 +128,7 @@ export default @inject('stores', 'actions') @observer class EditServiceScreen ex | |||
127 | if (recipe.hasTeamId) { | 128 | if (recipe.hasTeamId) { |
128 | Object.assign(config.fields, { | 129 | Object.assign(config.fields, { |
129 | team: { | 130 | team: { |
131 | disabled: !userCanManageServices, | ||
130 | label: intl.formatMessage(messages.team), | 132 | label: intl.formatMessage(messages.team), |
131 | placeholder: intl.formatMessage(messages.team), | 133 | placeholder: intl.formatMessage(messages.team), |
132 | value: service.team, | 134 | value: service.team, |
@@ -138,6 +140,7 @@ export default @inject('stores', 'actions') @observer class EditServiceScreen ex | |||
138 | if (recipe.hasCustomUrl) { | 140 | if (recipe.hasCustomUrl) { |
139 | Object.assign(config.fields, { | 141 | Object.assign(config.fields, { |
140 | customUrl: { | 142 | customUrl: { |
143 | disabled: !userCanManageServices, | ||
141 | label: intl.formatMessage(messages.customUrl), | 144 | label: intl.formatMessage(messages.customUrl), |
142 | placeholder: 'https://', | 145 | placeholder: 'https://', |
143 | value: service.customUrl, | 146 | value: service.customUrl, |
@@ -189,7 +192,7 @@ export default @inject('stores', 'actions') @observer class EditServiceScreen ex | |||
189 | } | 192 | } |
190 | 193 | ||
191 | render() { | 194 | render() { |
192 | const { recipes, services, user } = this.props.stores; | 195 | const { recipes, services, user, features } = this.props.stores; |
193 | const { action } = this.props.router.params; | 196 | const { action } = this.props.router.params; |
194 | 197 | ||
195 | let recipe; | 198 | let recipe; |
@@ -224,7 +227,8 @@ export default @inject('stores', 'actions') @observer class EditServiceScreen ex | |||
224 | ); | 227 | ); |
225 | } | 228 | } |
226 | 229 | ||
227 | const form = this.prepareForm(recipe, service); | 230 | const userCanManageServices = features.features.userCanManageServices; |
231 | const form = this.prepareForm(recipe, service, userCanManageServices); | ||
228 | 232 | ||
229 | return ( | 233 | return ( |
230 | <EditServiceForm | 234 | <EditServiceForm |
@@ -232,6 +236,7 @@ export default @inject('stores', 'actions') @observer class EditServiceScreen ex | |||
232 | recipe={recipe} | 236 | recipe={recipe} |
233 | service={service} | 237 | service={service} |
234 | user={user.data} | 238 | user={user.data} |
239 | userCanManageServices={userCanManageServices} | ||
235 | form={form} | 240 | form={form} |
236 | status={services.actionStatus} | 241 | status={services.actionStatus} |
237 | isSaving={services.updateServiceRequest.isExecuting || services.createServiceRequest.isExecuting} | 242 | isSaving={services.updateServiceRequest.isExecuting || services.createServiceRequest.isExecuting} |
@@ -248,6 +253,7 @@ EditServiceScreen.wrappedComponent.propTypes = { | |||
248 | user: PropTypes.instanceOf(UserStore).isRequired, | 253 | user: PropTypes.instanceOf(UserStore).isRequired, |
249 | recipes: PropTypes.instanceOf(RecipesStore).isRequired, | 254 | recipes: PropTypes.instanceOf(RecipesStore).isRequired, |
250 | services: PropTypes.instanceOf(ServicesStore).isRequired, | 255 | services: PropTypes.instanceOf(ServicesStore).isRequired, |
256 | features: PropTypes.instanceOf(FeaturesStore).isRequired, | ||
251 | settings: PropTypes.instanceOf(SettingsStore).isRequired, | 257 | settings: PropTypes.instanceOf(SettingsStore).isRequired, |
252 | }).isRequired, | 258 | }).isRequired, |
253 | router: PropTypes.shape({ | 259 | router: PropTypes.shape({ |