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: Enable taxonomy/tagging feature in MFE by default #971

Conversation

rpenido
Copy link
Contributor

@rpenido rpenido commented Apr 30, 2024

Description

This PR sets the tagging feature as enabled by default and creates a new waffle flag, content_tagging.disabled, to allow the feature to be turned off.

More Information

Testing Instructions

See openedx/edx-platform#34633

@openedx-webhooks
Copy link

openedx-webhooks commented Apr 30, 2024

Thanks for the pull request, @rpenido! Please note that it may take us up to several weeks or months to complete a review and merge your PR.

Feel free to add as much of the following information to the ticket as you can:

  • supporting documentation
  • Open edX discussion forum threads
  • timeline information ("this must be merged by XX date", and why that is)
  • partner information ("this is a course on edx.org")
  • any other information that can help Product understand the context for the PR

All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here.

Please let us know once your PR is ready for our review and all tests are green.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Apr 30, 2024
@rpenido rpenido force-pushed the rpenido/fal-3708-enable-taxonomy-tagging-feature-in-mfe-by-default branch from 5a4da02 to 5fbfe66 Compare April 30, 2024 19:32
Copy link

codecov bot commented Apr 30, 2024

Codecov Report

Attention: Patch coverage is 96.00000% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 92.22%. Comparing base (087c82c) to head (5b19f45).

Files Patch % Lines
src/taxonomy/TaxonomyListPage.jsx 66.66% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master     #971   +/-   ##
=======================================
  Coverage   92.21%   92.22%           
=======================================
  Files         703      703           
  Lines       12361    12382   +21     
  Branches     2682     2649   -33     
=======================================
+ Hits        11399    11419   +20     
- Misses        926      927    +1     
  Partials       36       36           

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

@rpenido rpenido marked this pull request as ready for review May 1, 2024 10:50
@rpenido rpenido requested a review from a team as a code owner May 1, 2024 10:50
@rpenido rpenido requested a review from yusuf-musleh May 1, 2024 10:51
Copy link
Contributor

@yusuf-musleh yusuf-musleh left a comment

Choose a reason for hiding this comment

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

@rpenido Great work on this it's on the right path, just faced a few issues and have some suggestions below.

The "Manage tags" and tag counts are always present, regardless of whether the new waffle flag is set or not, see my comment below. The taxonomies tab however appears/disappears as expected.

src/index.jsx Outdated
@@ -121,7 +121,7 @@ initialize({
ENABLE_UNIT_PAGE: process.env.ENABLE_UNIT_PAGE || 'false',
ENABLE_ASSETS_PAGE: process.env.ENABLE_ASSETS_PAGE || 'false',
ENABLE_VIDEO_UPLOAD_PAGE_LINK_IN_CONTENT_DROPDOWN: process.env.ENABLE_VIDEO_UPLOAD_PAGE_LINK_IN_CONTENT_DROPDOWN || 'false',
ENABLE_TAGGING_TAXONOMY_PAGES: process.env.ENABLE_TAGGING_TAXONOMY_PAGES || 'false',
DISABLE_TAGGING_FEATURE: process.env.DISABLE_TAGGING_FEATURE || 'false',
Copy link
Contributor

Choose a reason for hiding this comment

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

This always seems to be falling back to false since the env variable is not being set, regardless of whether the flags is set in the edx-platform or not. So the "Manage Tags" and tags counts always show regardless if the new waffle flag is set or not.

The previous flag has the following env variables set:

https://github.com/openedx/frontend-app-course-authoring/blob/65f45f72f08c1f38ced5d8d302fbdd2406da228d/.env#L36

https://github.com/openedx/frontend-app-course-authoring/blob/65f45f72f08c1f38ced5d8d302fbdd2406da228d/.env.development#L39

https://github.com/openedx/frontend-app-course-authoring/blob/65f45f72f08c1f38ced5d8d302fbdd2406da228d/.env.test#L34

Since it currently doens't seem to be reading it from the edx-platform backend, I'm not sure what the general practice is for this, however maybe we could utilize the taxonomiesEnabled flag that is passed in from the backend:

https://github.com/openedx/frontend-app-course-authoring/blob/65f45f72f08c1f38ced5d8d302fbdd2406da228d/src/studio-home/tabs-section/index.jsx#L32-L37

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @yusuf-musleh!

I think getting the data from the backend is the right approach, but we need to fetch a lot of data to use this selector.

I created a new hook (using react-query) that solves that problem. The only issue is that we need this info in the index.jsx, where we don't have the necessary configs just to call a hook.

We may need to use some kind of "lazy load" for the routes. Maybe @bradenmacdonald could help us with some ideas?

Copy link
Contributor

Choose a reason for hiding this comment

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

hey guys, I don't know if there is a good pattern for this now. I think we should just stick to the simplest option and have an environment variable that disables the MFE features (getConfig().DISABLE_TAGGING_FEATURE) and a waffle flag that controls the legacy UI (content_tagging.disabled).

The waffle flag is already set on edx.org, in anticipation of this PR, but we'll also have to get them to set the env var once it's confirmed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually I like @rpenido's approach and I think it's even better if we can get it to work. Which index.jsx is the problem? The studio home page or the taxonomies page?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The root index, where we declare the <App>.

One "easy" approach to avoid this problem (needing a provider at the App level) is to move the check to the destination pages, showing an error message or redirecting to another place if the flag is disabled. I think this is not the best solution, but it will work.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's fine. We want most people using this, and having it disabled will be fairly rare. The important thing is that reading this flag doesn't slow down the frontend, so shouldn't introduce an additional blocking API request on every page.

Copy link
Contributor

Choose a reason for hiding this comment

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

One "easy" approach to avoid this problem (needing a provider at the App level) is to move the check to the destination pages, showing an error message or redirecting to another place if the flag is disabled.

So let's go with that.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, I implemented that ^

@yusuf-musleh could you please review/test this PR again?

@rpenido rpenido force-pushed the rpenido/fal-3708-enable-taxonomy-tagging-feature-in-mfe-by-default branch 2 times, most recently from ed8986d to 914c240 Compare May 2, 2024 21:49
@rpenido rpenido force-pushed the rpenido/fal-3708-enable-taxonomy-tagging-feature-in-mfe-by-default branch from 914c240 to c0404ae Compare May 2, 2024 22:01
@bradenmacdonald bradenmacdonald force-pushed the rpenido/fal-3708-enable-taxonomy-tagging-feature-in-mfe-by-default branch 2 times, most recently from 9ddeac2 to e17324c Compare May 7, 2024 23:32
@bradenmacdonald bradenmacdonald force-pushed the rpenido/fal-3708-enable-taxonomy-tagging-feature-in-mfe-by-default branch from e17324c to 29daee5 Compare May 7, 2024 23:41
@bradenmacdonald
Copy link
Contributor

@yusuf-musleh I have finished this up and it's ready for review again

Copy link
Contributor

@yusuf-musleh yusuf-musleh left a comment

Choose a reason for hiding this comment

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

👍 @bradenmacdonald I tested it out, its working well. There was just the unit side bar tags that was missing the check if tagging was enabled/disabled, but I went ahead
and added it here: 5d37761

  • I tested this: Followed the testing instructions in the edx-platform PR
  • I read through the code
  • I checked for accessibility issues
  • Includes documentation

@bradenmacdonald
Copy link
Contributor

Thinking about this more, I'm worried about the performance implications of loading the studio home data on every page since it's consumed by the updated header. I'm going to suggest we keep it simple and use an env var instead: #989

@openedx-webhooks
Copy link

@rpenido Even though your pull request wasn’t merged, please take a moment to answer a two question survey so we can improve your experience in the future.

@rpenido rpenido deleted the rpenido/fal-3708-enable-taxonomy-tagging-feature-in-mfe-by-default branch July 3, 2024 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open-source-contribution PR author is not from Axim or 2U
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants