diff options
author | 2018-02-27 13:32:59 +0100 | |
---|---|---|
committer | 2018-02-27 13:32:59 +0100 | |
commit | 29a69b86a2d2a76a66813c4099952f9d46ec7a9f (patch) | |
tree | 6a6b696d7ea2e63c77cbd01100aaf1ec1c507c13 /src/containers | |
parent | Merge branch 'feature/features-api' into feature/enterprise-ui (diff) | |
download | ferdium-app-29a69b86a2d2a76a66813c4099952f9d46ec7a9f.tar.gz ferdium-app-29a69b86a2d2a76a66813c4099952f9d46ec7a9f.tar.zst ferdium-app-29a69b86a2d2a76a66813c4099952f9d46ec7a9f.zip |
adapt enterprise UI flags to features-api
Diffstat (limited to 'src/containers')
-rw-r--r-- | src/containers/layout/AppLayoutContainer.js | 4 | ||||
-rw-r--r-- | src/containers/settings/EditServiceScreen.js | 14 |
2 files changed, 12 insertions, 6 deletions
diff --git a/src/containers/layout/AppLayoutContainer.js b/src/containers/layout/AppLayoutContainer.js index 2db2b7bb7..7a398ed2d 100644 --- a/src/containers/layout/AppLayoutContainer.js +++ b/src/containers/layout/AppLayoutContainer.js | |||
@@ -5,6 +5,7 @@ import { inject, observer } from 'mobx-react'; | |||
5 | import AppStore from '../../stores/AppStore'; | 5 | import AppStore from '../../stores/AppStore'; |
6 | import RecipesStore from '../../stores/RecipesStore'; | 6 | import RecipesStore from '../../stores/RecipesStore'; |
7 | import ServicesStore from '../../stores/ServicesStore'; | 7 | import ServicesStore from '../../stores/ServicesStore'; |
8 | import FeaturesStore from '../../stores/FeaturesStore'; | ||
8 | import UIStore from '../../stores/UIStore'; | 9 | import UIStore from '../../stores/UIStore'; |
9 | import NewsStore from '../../stores/NewsStore'; | 10 | import NewsStore from '../../stores/NewsStore'; |
10 | import SettingsStore from '../../stores/SettingsStore'; | 11 | import SettingsStore from '../../stores/SettingsStore'; |
@@ -66,7 +67,7 @@ export default class AppLayoutContainer extends Component { | |||
66 | const { children } = this.props; | 67 | const { children } = this.props; |
67 | 68 | ||
68 | const isLoadingFeatures = features.featuresRequest.isExecuting | 69 | const isLoadingFeatures = features.featuresRequest.isExecuting |
69 | && features.featuresRequest.isExecutingFirstTime; | 70 | && !features.featuresRequest.wasExecuted; |
70 | 71 | ||
71 | const isLoadingServices = services.allServicesRequest.isExecuting | 72 | const isLoadingServices = services.allServicesRequest.isExecuting |
72 | && services.allServicesRequest.isExecutingFirstTime; | 73 | && services.allServicesRequest.isExecutingFirstTime; |
@@ -134,6 +135,7 @@ export default class AppLayoutContainer extends Component { | |||
134 | AppLayoutContainer.wrappedComponent.propTypes = { | 135 | AppLayoutContainer.wrappedComponent.propTypes = { |
135 | stores: PropTypes.shape({ | 136 | stores: PropTypes.shape({ |
136 | services: PropTypes.instanceOf(ServicesStore).isRequired, | 137 | services: PropTypes.instanceOf(ServicesStore).isRequired, |
138 | features: PropTypes.instanceOf(FeaturesStore).isRequired, | ||
137 | recipes: PropTypes.instanceOf(RecipesStore).isRequired, | 139 | recipes: PropTypes.instanceOf(RecipesStore).isRequired, |
138 | app: PropTypes.instanceOf(AppStore).isRequired, | 140 | app: PropTypes.instanceOf(AppStore).isRequired, |
139 | ui: PropTypes.instanceOf(UIStore).isRequired, | 141 | ui: PropTypes.instanceOf(UIStore).isRequired, |
diff --git a/src/containers/settings/EditServiceScreen.js b/src/containers/settings/EditServiceScreen.js index 0ddb84db0..f2d5550e1 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 Form from '../../lib/Form'; | 10 | import Form from '../../lib/Form'; |
10 | import { gaPage } from '../../lib/analytics'; | 11 | import { gaPage } from '../../lib/analytics'; |
11 | 12 | ||
@@ -77,7 +78,7 @@ export default class EditServiceScreen extends Component { | |||
77 | } | 78 | } |
78 | } | 79 | } |
79 | 80 | ||
80 | prepareForm(recipe, service, userCanManageService) { | 81 | prepareForm(recipe, service, userCanManageServices) { |
81 | const { intl } = this.context; | 82 | const { intl } = this.context; |
82 | const config = { | 83 | const config = { |
83 | fields: { | 84 | fields: { |
@@ -118,7 +119,7 @@ export default class EditServiceScreen extends Component { | |||
118 | if (recipe.hasTeamId) { | 119 | if (recipe.hasTeamId) { |
119 | Object.assign(config.fields, { | 120 | Object.assign(config.fields, { |
120 | team: { | 121 | team: { |
121 | disabled: !userCanManageService, | 122 | disabled: !userCanManageServices, |
122 | label: intl.formatMessage(messages.team), | 123 | label: intl.formatMessage(messages.team), |
123 | placeholder: intl.formatMessage(messages.team), | 124 | placeholder: intl.formatMessage(messages.team), |
124 | value: service.team, | 125 | value: service.team, |
@@ -130,7 +131,7 @@ export default class EditServiceScreen extends Component { | |||
130 | if (recipe.hasCustomUrl) { | 131 | if (recipe.hasCustomUrl) { |
131 | Object.assign(config.fields, { | 132 | Object.assign(config.fields, { |
132 | customUrl: { | 133 | customUrl: { |
133 | disabled: !userCanManageService, | 134 | disabled: !userCanManageServices, |
134 | label: intl.formatMessage(messages.customUrl), | 135 | label: intl.formatMessage(messages.customUrl), |
135 | placeholder: 'https://', | 136 | placeholder: 'https://', |
136 | value: service.customUrl, | 137 | value: service.customUrl, |
@@ -182,7 +183,7 @@ export default class EditServiceScreen extends Component { | |||
182 | } | 183 | } |
183 | 184 | ||
184 | render() { | 185 | render() { |
185 | const { recipes, services, user } = this.props.stores; | 186 | const { recipes, services, user, features } = this.props.stores; |
186 | const { action } = this.props.router.params; | 187 | const { action } = this.props.router.params; |
187 | 188 | ||
188 | let recipe; | 189 | let recipe; |
@@ -217,7 +218,8 @@ export default class EditServiceScreen extends Component { | |||
217 | ); | 218 | ); |
218 | } | 219 | } |
219 | 220 | ||
220 | const form = this.prepareForm(recipe, service, user.data.clientSettings.userCanManageServices); | 221 | const userCanManageServices = features.features.userCanManageServices; |
222 | const form = this.prepareForm(recipe, service, userCanManageServices); | ||
221 | 223 | ||
222 | return ( | 224 | return ( |
223 | <EditServiceForm | 225 | <EditServiceForm |
@@ -225,6 +227,7 @@ export default class EditServiceScreen extends Component { | |||
225 | recipe={recipe} | 227 | recipe={recipe} |
226 | service={service} | 228 | service={service} |
227 | user={user.data} | 229 | user={user.data} |
230 | userCanManageServices={userCanManageServices} | ||
228 | form={form} | 231 | form={form} |
229 | status={services.actionStatus} | 232 | status={services.actionStatus} |
230 | isSaving={services.updateServiceRequest.isExecuting || services.createServiceRequest.isExecuting} | 233 | isSaving={services.updateServiceRequest.isExecuting || services.createServiceRequest.isExecuting} |
@@ -241,6 +244,7 @@ EditServiceScreen.wrappedComponent.propTypes = { | |||
241 | user: PropTypes.instanceOf(UserStore).isRequired, | 244 | user: PropTypes.instanceOf(UserStore).isRequired, |
242 | recipes: PropTypes.instanceOf(RecipesStore).isRequired, | 245 | recipes: PropTypes.instanceOf(RecipesStore).isRequired, |
243 | services: PropTypes.instanceOf(ServicesStore).isRequired, | 246 | services: PropTypes.instanceOf(ServicesStore).isRequired, |
247 | features: PropTypes.instanceOf(FeaturesStore).isRequired, | ||
244 | }).isRequired, | 248 | }).isRequired, |
245 | router: PropTypes.shape({ | 249 | router: PropTypes.shape({ |
246 | params: PropTypes.shape({ | 250 | params: PropTypes.shape({ |