diff options
author | 2018-02-27 13:32:59 +0100 | |
---|---|---|
committer | 2018-02-27 13:32:59 +0100 | |
commit | 29a69b86a2d2a76a66813c4099952f9d46ec7a9f (patch) | |
tree | 6a6b696d7ea2e63c77cbd01100aaf1ec1c507c13 /src | |
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')
-rw-r--r-- | src/components/settings/navigation/SettingsNavigation.js | 8 | ||||
-rw-r--r-- | src/components/settings/services/EditServiceForm.js | 4 | ||||
-rw-r--r-- | src/containers/layout/AppLayoutContainer.js | 4 | ||||
-rw-r--r-- | src/containers/settings/EditServiceScreen.js | 14 | ||||
-rw-r--r-- | src/models/User.js | 4 |
5 files changed, 19 insertions, 15 deletions
diff --git a/src/components/settings/navigation/SettingsNavigation.js b/src/components/settings/navigation/SettingsNavigation.js index 620f09189..46b2f82fc 100644 --- a/src/components/settings/navigation/SettingsNavigation.js +++ b/src/components/settings/navigation/SettingsNavigation.js | |||
@@ -44,12 +44,12 @@ export default class SettingsNavigation extends Component { | |||
44 | 44 | ||
45 | render() { | 45 | render() { |
46 | const { serviceCount } = this.props; | 46 | const { serviceCount } = this.props; |
47 | const { data: user } = this.props.stores.user; | 47 | const { features } = this.props.stores.features; |
48 | const { intl } = this.context; | 48 | const { intl } = this.context; |
49 | 49 | ||
50 | return ( | 50 | return ( |
51 | <div className="settings-navigation"> | 51 | <div className="settings-navigation"> |
52 | {user.clientSettings && user.clientSettings.userCanManageServices && ( | 52 | {features.userCanManageServices && ( |
53 | <Link | 53 | <Link |
54 | to="/settings/recipes" | 54 | to="/settings/recipes" |
55 | className="settings-navigation__link" | 55 | className="settings-navigation__link" |
@@ -100,8 +100,8 @@ export default class SettingsNavigation extends Component { | |||
100 | 100 | ||
101 | SettingsNavigation.wrappedComponent.propTypes = { | 101 | SettingsNavigation.wrappedComponent.propTypes = { |
102 | stores: PropTypes.shape({ | 102 | stores: PropTypes.shape({ |
103 | user: PropTypes.shape({ | 103 | features: PropTypes.shape({ |
104 | data: PropTypes.object.isRequired, | 104 | features: PropTypes.object.isRequired, |
105 | }).isRequired, | 105 | }).isRequired, |
106 | }).isRequired, | 106 | }).isRequired, |
107 | }; | 107 | }; |
diff --git a/src/components/settings/services/EditServiceForm.js b/src/components/settings/services/EditServiceForm.js index e23dfa9f6..3ffca99a7 100644 --- a/src/components/settings/services/EditServiceForm.js +++ b/src/components/settings/services/EditServiceForm.js | |||
@@ -107,6 +107,7 @@ export default class EditServiceForm extends Component { | |||
107 | return null; | 107 | return null; |
108 | }, | 108 | }, |
109 | user: PropTypes.instanceOf(User).isRequired, | 109 | user: PropTypes.instanceOf(User).isRequired, |
110 | userCanManageServices: PropTypes.bool.isRequired, | ||
110 | action: PropTypes.string.isRequired, | 111 | action: PropTypes.string.isRequired, |
111 | form: PropTypes.instanceOf(Form).isRequired, | 112 | form: PropTypes.instanceOf(Form).isRequired, |
112 | onSubmit: PropTypes.func.isRequired, | 113 | onSubmit: PropTypes.func.isRequired, |
@@ -169,6 +170,7 @@ export default class EditServiceForm extends Component { | |||
169 | service, | 170 | service, |
170 | action, | 171 | action, |
171 | user, | 172 | user, |
173 | userCanManageServices, | ||
172 | form, | 174 | form, |
173 | isSaving, | 175 | isSaving, |
174 | isDeleting, | 176 | isDeleting, |
@@ -324,7 +326,7 @@ export default class EditServiceForm extends Component { | |||
324 | </div> | 326 | </div> |
325 | <div className="settings__controls"> | 327 | <div className="settings__controls"> |
326 | {/* Delete Button */} | 328 | {/* Delete Button */} |
327 | {action === 'edit' && user.clientSettings.userCanManageServices && deleteButton} | 329 | {action === 'edit' && userCanManageServices && deleteButton} |
328 | 330 | ||
329 | {/* Save Button */} | 331 | {/* Save Button */} |
330 | {isSaving || isValidatingCustomUrl ? ( | 332 | {isSaving || isValidatingCustomUrl ? ( |
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({ |
diff --git a/src/models/User.js b/src/models/User.js index 2eb48394f..6fca78f90 100644 --- a/src/models/User.js +++ b/src/models/User.js | |||
@@ -16,9 +16,6 @@ export default class User { | |||
16 | @observable isDonor = false; | 16 | @observable isDonor = false; |
17 | @observable isMiner = false; | 17 | @observable isMiner = false; |
18 | @observable isSSO = false; | 18 | @observable isSSO = false; |
19 | @observable clientSettings = { | ||
20 | userCanManageServices: true, | ||
21 | }; | ||
22 | @observable company = { | 19 | @observable company = { |
23 | name: 'Happle Apps', | 20 | name: 'Happle Apps', |
24 | contact: { | 21 | contact: { |
@@ -45,7 +42,6 @@ export default class User { | |||
45 | this.isSubscriptionOwner = data.isSubscriptionOwner || this.isSubscriptionOwner; | 42 | this.isSubscriptionOwner = data.isSubscriptionOwner || this.isSubscriptionOwner; |
46 | this.isMiner = data.isMiner || this.isMiner; | 43 | this.isMiner = data.isMiner || this.isMiner; |
47 | this.isSSO = data.isSSO || this.isSSO; | 44 | this.isSSO = data.isSSO || this.isSSO; |
48 | this.clientSettings = data.clientSettings || this.clientSettings; | ||
49 | this.company = data.company || this.company; | 45 | this.company = data.company || this.company; |
50 | } | 46 | } |
51 | 47 | ||