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: [FC-0044] Course unit - Drag and drop for xblocks #908

Merged

Conversation

PKulkoRaccoonGang
Copy link
Contributor

@PKulkoRaccoonGang PKulkoRaccoonGang commented Mar 18, 2024

Settings

EDX_PLATFORM_REPOSITORY: https://github.com/openedx/edx-platform.git
EDX_PLATFORM_VERSION: master

TUTOR_GROVE_WAFFLE_FLAGS:
  - name: contentstore.new_studio_mfe.use_new_unit_page
    everyone: true

TUTOR_GROVE_MFE_LMS_COMMON_SETTINGS:
  MFE_CONFIG:
    ENABLE_UNIT_PAGE: true

Description

Xblock drag and drop feature for Course unit page.

Useful information to include:

  • In this PR we will reuse the xblocks drag and drop functionality previously created for the Course outline page.

Supporting information

Testing instructions

  • Run master devstack.
  • Start platform make dev.up.lms+cms+frontend-app-course-authoring and make checkout on this branch.
  • Enable the new Unit page by adding a waffle flag contentstore.new_studio_mfe.use_new_unit_page in the CMS admin panel.
  • Go to the Course Unit page from the Course Outline page.
  • Add a new xblock component.

Other information

Include anything else that will help reviewers and consumers understand the change.

  • Does this change depend on other changes elsewhere?
  • Any special concerns or limitations? For example: deprecations, migrations, security, or accessibility.

@PKulkoRaccoonGang PKulkoRaccoonGang requested a review from a team as a code owner March 18, 2024 21:52
@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Mar 18, 2024
@PKulkoRaccoonGang PKulkoRaccoonGang marked this pull request as draft March 18, 2024 21:52
@openedx-webhooks
Copy link

openedx-webhooks commented Mar 18, 2024

Thanks for the pull request, @PKulkoRaccoonGang! 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.

@PKulkoRaccoonGang PKulkoRaccoonGang force-pushed the Peter_Kulko/drag-and-drop-for-xblocks branch from fb9c34d to a68fc60 Compare March 18, 2024 21:54
@PKulkoRaccoonGang
Copy link
Contributor Author

PKulkoRaccoonGang commented Mar 18, 2024

@arbrandes @KristinAoki the first commit in this PR will be deleted after the #884 merge

@PKulkoRaccoonGang PKulkoRaccoonGang self-assigned this Mar 18, 2024
@PKulkoRaccoonGang PKulkoRaccoonGang added the create-sandbox open-craft-grove should create a sandbox environment from this PR label Mar 18, 2024
@open-craft-grove
Copy link

Sandbox deployment successful 🚀
🎓 LMS
📝 Studio
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@PKulkoRaccoonGang PKulkoRaccoonGang changed the title feat: Course unit - Drag and drop for xblocks feat: [FC-0044] Course unit - Drag and drop for xblocks Mar 19, 2024
@open-craft-grove
Copy link

Sandbox deployment successful 🚀
🎓 LMS
📝 Studio
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@open-craft-grove
Copy link

Sandbox deployment successful 🚀
🎓 LMS
📝 Studio
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@ihor-romaniuk ihor-romaniuk force-pushed the Peter_Kulko/drag-and-drop-for-xblocks branch from fdccc68 to b698843 Compare April 25, 2024 09:42
@PKulkoRaccoonGang PKulkoRaccoonGang marked this pull request as ready for review April 25, 2024 09:46
Copy link

codecov bot commented Apr 25, 2024

Codecov Report

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

Project coverage is 92.12%. Comparing base (e24fb78) to head (7bf6021).

Files Patch % Lines
src/course-unit/data/thunk.js 92.85% 1 Missing ⚠️
src/course-unit/data/utils.js 93.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #908      +/-   ##
==========================================
+ Coverage   92.09%   92.12%   +0.02%     
==========================================
  Files         685      685              
  Lines       12090    12133      +43     
  Branches     2609     2642      +33     
==========================================
+ Hits        11134    11177      +43     
  Misses        920      920              
  Partials       36       36              

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

@open-craft-grove
Copy link

Sandbox deployment successful 🚀
🎓 LMS
📝 Studio
ℹ️ Grove Config, Tutor Config, Tutor Requirements

Copy link
Contributor

@arbrandes arbrandes left a comment

Choose a reason for hiding this comment

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

This seems to be working fine, and the code looks good! I did have one minor question, though. See below.


// Directly sort the children based on the order defined in payload
// This avoids the need to copy the array beforehand
state.courseVerticalChildren.children.sort((a, b) => (indexMap.get(a.id) || 0) - (indexMap.get(b.id) || 0));
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks


// Special handling for objects with both 'id' and 'blockId' to ensure 'blockId' takes precedence
if ('blockId' in data) {
updatedData.id = data.blockId;
Copy link
Contributor

Choose a reason for hiding this comment

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

If we're doing this here, can't we get rid of the else if on line 75?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, thanks
Good catch! 💯

@arbrandes
Copy link
Contributor

Also, please resolve conflicts so I can merge on the next pass. Thanks!

PKulkoRaccoonGang and others added 2 commits April 30, 2024 11:01
* feat: [AXIMST-46] Drag And Drop For Xblocks

* feat: added tests

* refactor: refactoring after review
@open-craft-grove
Copy link

Sandbox deployment successful 🚀
🎓 LMS
📝 Studio
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@open-craft-grove
Copy link

Sandbox deployment successful 🚀
🎓 LMS
📝 Studio
ℹ️ Grove Config, Tutor Config, Tutor Requirements

Copy link
Contributor

@arbrandes arbrandes left a comment

Choose a reason for hiding this comment

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

Thanks for addressing my comments!

@arbrandes arbrandes merged commit a9a73ef into openedx:master Apr 30, 2024
6 checks passed
@openedx-webhooks
Copy link

@PKulkoRaccoonGang 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
create-sandbox open-craft-grove should create a sandbox environment from this PR 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