Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: expose enterpriseFeatures from API in portalConfiguration #1039

Merged
merged 5 commits into from
Sep 21, 2023

Conversation

adamstankiewicz
Copy link
Member

@adamstankiewicz adamstankiewicz commented Sep 20, 2023

Stores enterpriseFeatures from existing API integration in the portalConfiguration reducer within the application's Redux store. To retrieve the enterpriseFeatures within one of the child components of EnterprisePage:

const mapStateToProps = state => ({
  // existing
  enterpriseId: state.portalConfiguration.enterpriseId,
  enterpriseSlug: state.portalConfiguration.enterpriseSlug,

  // new
  enterpriseFeatures: state.portalConfiguration.enterpriseFeatures,
});

MyComponent.propTypes = {
  enterpriseId: PropTypes.string.isRequired,
  enterpriseSlug: PropTypes.STRING.isRequired,
  enterpriseFeatures: PropTypes.shape().isRequired,
};

export default connect(mapStateToProps)(MyComponent);

Example enterpriseFeatures object

https://courses.stage.edx.org/enterprise/api/v1/enterprise-customer/dashboard_list/?page=1&page_size=50&enterprise_slug=exec-ed-2u-integration-qa

{ 'top_down_assignment_real_time_lcm': true }

Example API response:

{
	"next": null,
	"previous": null,
	"count": 1,
	"num_pages": 1,
	"current_page": 1,
	"start": 0,
	"results": [{
		"uuid": "d0224477-4903-404a-b3c4-9edfce728d37",
		"name": "Executive Education (2U) Integration QA",
		"slug": "exec-ed-2u-integration-qa",
		"active": true,
		// ...
	}],
	"enterprise_features": {
		"top_down_assignment_real_time_lcm": true
	}
}

For all changes

  • Ensure adequate tests are in place (or reviewed existing tests cover changes)

Only if submitting a visual change

  • Ensure to attach screenshots
  • Ensure to have UX team confirm screenshots

@adamstankiewicz adamstankiewicz changed the title feat: expose enterpriseFeatures from API in portalConfiguration feat: expose enterpriseFeatures from API in portalConfiguration Sep 20, 2023
@codecov
Copy link

codecov bot commented Sep 20, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (0eca22c) 83.01% compared to head (212983c) 83.01%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1039   +/-   ##
=======================================
  Coverage   83.01%   83.01%           
=======================================
  Files         412      412           
  Lines        8849     8849           
  Branches     1820     1819    -1     
=======================================
  Hits         7346     7346           
  Misses       1464     1464           
  Partials       39       39           
Files Changed Coverage Δ
src/data/reducers/portalConfiguration.js 73.33% <ø> (ø)
src/data/actions/portalConfiguration.js 100.00% <100.00%> (ø)
src/data/services/LmsApiService.js 33.92% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -34,7 +37,7 @@ const fetchPortalConfiguration = slug => (
dispatch(fetchPortalConfigurationRequest());
return LmsApiService.fetchEnterpriseBySlug(slug)
.then((response) => {
dispatch(fetchPortalConfigurationSuccess(response.data));
dispatch(fetchPortalConfigurationSuccess(response));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[context] We want to all of response now that it contains both data (i.e., the actively viewed enterprise customer metadata) and enterpriseFeatures (i.e., the Waffled-based feature flags).

Copy link
Contributor

@emrosarioa emrosarioa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@adamstankiewicz adamstankiewicz merged commit f4328dc into master Sep 21, 2023
5 checks passed
@adamstankiewicz adamstankiewicz deleted the ags/ent-7714 branch September 21, 2023 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants