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-0070] implement move xblock modal #1422

Merged

Conversation

ihor-romaniuk
Copy link
Contributor

@ihor-romaniuk ihor-romaniuk commented Oct 22, 2024

🚨 Dependencies:

Settings

EDX_PLATFORM_REPOSITORY: https://github.com/raccoongang/edx-platform.git
EDX_PLATFORM_VERSION: romaniuk/implement-move-xblock-modal

TUTOR_GROVE_NEW_MFES:
  authoring:
    port: 18000
    repository: https://github.com/raccoongang/frontend-app-course-authoring.git
    version: romaniuk/implement-move-xblock-modal

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

This PR introduces the ability to move an xBlock from one unit to another within a course using a modal window. The feature enables users to select a target unit for the xBlock and confirm the move.

move-xblock.mov

Related Pull Requests

Testing instructions

  • сreate a new course.
  • create several units.
  • open the course unit page.
  • add some xBlocks to the unit.
  • move xBlock to another unit: click three dots icon (xBlock action menu) -> select "Move" -> select new location.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Oct 22, 2024
@openedx-webhooks
Copy link

openedx-webhooks commented Oct 22, 2024

Thanks for the pull request, @ihor-romaniuk!

What's next?

Please work through the following steps to get your changes ready for engineering review:

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.

🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads

🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

🔘 Let us know that your PR is ready for review:

Who will review my changes?

This repository is currently maintained by @openedx/2u-tnl. Tag them in a comment and let them know that your changes are ready for review.

Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@ihor-romaniuk ihor-romaniuk force-pushed the romaniuk/implement-move-xblock-modal branch from c917065 to 1a9145e Compare November 8, 2024 17:46
@ihor-romaniuk ihor-romaniuk marked this pull request as ready for review November 8, 2024 17:46
@ihor-romaniuk ihor-romaniuk requested a review from a team as a code owner November 8, 2024 17:46
@ihor-romaniuk ihor-romaniuk force-pushed the romaniuk/implement-move-xblock-modal branch from 1a9145e to de9f97c Compare November 8, 2024 18:08
@arbrandes arbrandes self-requested a review November 8, 2024 18:17
@ihor-romaniuk ihor-romaniuk force-pushed the romaniuk/implement-move-xblock-modal branch 3 times, most recently from 0d617b7 to 062e439 Compare November 8, 2024 18:28
@ihor-romaniuk ihor-romaniuk added the create-sandbox open-craft-grove should create a sandbox environment from this PR label Nov 8, 2024
@open-craft-grove
Copy link

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

Copy link
Contributor

@PKulkoRaccoonGang PKulkoRaccoonGang left a comment

Choose a reason for hiding this comment

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

[inform]: Regarding the failing tests. Apparently after merging one of the last PRs we had problems with tests for the library functionality. I have already fixed this in a new PR
#1493

src/course-unit/CourseUnit.test.jsx Outdated Show resolved Hide resolved
src/course-unit/CourseUnit.test.jsx Outdated Show resolved Hide resolved
src/course-unit/CourseUnit.test.jsx Outdated Show resolved Hide resolved
src/course-unit/move-modal/index.tsx Outdated Show resolved Hide resolved
src/course-unit/CourseUnit.test.jsx Outdated Show resolved Hide resolved
src/course-unit/move-modal/moveModal.test.tsx Outdated Show resolved Hide resolved
src/course-unit/move-modal/moveModal.test.tsx Outdated Show resolved Hide resolved
src/course-unit/move-modal/moveModal.test.tsx Outdated Show resolved Hide resolved
src/course-unit/move-modal/moveModal.test.tsx Outdated Show resolved Hide resolved
src/course-unit/move-modal/utils.ts Outdated Show resolved Hide resolved
Copy link

codecov bot commented Nov 11, 2024

Codecov Report

Attention: Patch coverage is 95.49839% with 14 lines in your changes missing coverage. Please review.

Project coverage is 93.11%. Comparing base (ba48a27) to head (a06651c).
Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
src/course-unit/data/thunk.js 82.14% 5 Missing ⚠️
src/course-unit/hooks.jsx 72.22% 5 Missing ⚠️
src/course-unit/context/iFrameContext.tsx 82.35% 3 Missing ⚠️
src/course-unit/move-modal/hooks.tsx 98.93% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1422      +/-   ##
==========================================
+ Coverage   93.04%   93.11%   +0.06%     
==========================================
  Files        1048     1060      +12     
  Lines       20544    20889     +345     
  Branches     4363     4531     +168     
==========================================
+ Hits        19116    19451     +335     
- Misses       1358     1369      +11     
+ Partials       70       69       -1     

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


🚨 Try these New Features:

@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

@PKulkoRaccoonGang PKulkoRaccoonGang added create-sandbox open-craft-grove should create a sandbox environment from this PR and removed create-sandbox open-craft-grove should create a sandbox environment from this PR labels Nov 12, 2024
src/course-unit/data/api.js Outdated Show resolved Hide resolved
src/course-unit/data/api.js Outdated Show resolved Hide resolved
src/course-unit/move-modal/components/EmptyMessage.tsx Outdated Show resolved Hide resolved
@open-craft-grove
Copy link

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

@ihor-romaniuk ihor-romaniuk force-pushed the romaniuk/implement-move-xblock-modal branch from 7429b68 to 8965b19 Compare November 13, 2024 14:39
@open-craft-grove
Copy link

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

@ihor-romaniuk ihor-romaniuk force-pushed the romaniuk/implement-move-xblock-modal branch from 8965b19 to dedc765 Compare November 15, 2024 07:34
@open-craft-grove
Copy link

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

src/course-unit/context/iFrameContext.tsx Outdated Show resolved Hide resolved
src/course-unit/move-modal/components/EmptyMessage.tsx Outdated Show resolved Hide resolved
src/course-unit/move-modal/components/ModalLoader.tsx Outdated Show resolved Hide resolved
src/course-unit/move-modal/hooks.tsx Outdated Show resolved Hide resolved
src/course-unit/move-modal/index.scss Show resolved Hide resolved
src/course-unit/move-modal/moveModal.test.tsx Outdated Show resolved Hide resolved
@ihor-romaniuk ihor-romaniuk force-pushed the romaniuk/implement-move-xblock-modal branch from dedc765 to 01031d4 Compare November 15, 2024 11:02
Copy link
Contributor

@PKulkoRaccoonGang PKulkoRaccoonGang left a comment

Choose a reason for hiding this comment

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

Looks nice! 👍
Thanks!

@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.

Can't find anything to object to except for the console logging. Code looks good and works well. Once the calls to console() are removed, we can merge.


import { IframeContext, IframeContextType } from './iFrameContext';

// eslint-disable-next-line import/prefer-default-export
Copy link
Contributor

Choose a reason for hiding this comment

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

Not a blocker, but the latest frontend-build makes it so that we don't need this line anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After update current branch to master branch and reinstall dependencies, still catch the error ESLint: Prefer default export on a file with single export.(import/ prefer-default-export)

Copy link
Contributor

Choose a reason for hiding this comment

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

@bradenmacdonald, FYI. Not sure what went wrong.

Copy link
Contributor

Choose a reason for hiding this comment

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

@arbrandes This MFE's master branch is still on 14.1.4 not 14.2.0

npm ls @openedx/frontend-build
@edx/[email protected]
├─┬ @edx/[email protected]
│ └── @openedx/[email protected] deduped
├─┬ @edx/[email protected]
│ └── @openedx/[email protected] deduped
└── @openedx/[email protected]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's update @openedx/frontend-build in the next PRs to avoid delaying this feature, as it will require additional time to refactor the current code (I found 104 matches for import/prefer-default-export).

Copy link
Contributor

Choose a reason for hiding this comment

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

I've done that refactor in #1519 and it's now merged to master :)

iframeWindow.postMessage({ type: messageType, payload }, '*');
} catch (error) {
// eslint-disable-next-line no-console
console.error('Failed to send message to iframe:', error);
Copy link
Contributor

Choose a reason for hiding this comment

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

This is fine for debugging, but there's a reason for the linting to be there: we don't want to use the console in production code.

Copy link
Contributor Author

@ihor-romaniuk ihor-romaniuk Nov 18, 2024

Choose a reason for hiding this comment

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

Replaced with throw new Error('Failed to send message to iframe.');

Copy link
Contributor

Choose a reason for hiding this comment

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

The idea to not use console() is to avoid showing ugly messages to the end user. I'm not sure if throwing a new Error() will get managed properly, but I suspect it won't.

How about if we used logError instead? Right now it only works with newRelic, but at least it takes case of both sides of the issue: not showing the message to the end user while still allowing the operator to know about it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. This place and comment below are replaced with logError events.

}
} else {
// eslint-disable-next-line no-console
console.warn('Iframe is not accessible or loaded yet.');
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove the console message, as per the previous comment.

Copy link
Contributor Author

@ihor-romaniuk ihor-romaniuk Nov 18, 2024

Choose a reason for hiding this comment

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

Replaced with throw new Error('Iframe is not accessible or loaded yet.');

@ihor-romaniuk ihor-romaniuk force-pushed the romaniuk/implement-move-xblock-modal branch from 01031d4 to c561446 Compare November 18, 2024 16:46
@open-craft-grove
Copy link

Sandbox deployment failed 💥
Please check the settings and requirements.
Retry deployment by pushing a new commit or updating the requirements/settings in the pull request's description.
📜 Failure Logs
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@ihor-romaniuk ihor-romaniuk added create-sandbox open-craft-grove should create a sandbox environment from this PR and removed create-sandbox open-craft-grove should create a sandbox environment from this PR labels Nov 19, 2024
@ihor-romaniuk ihor-romaniuk force-pushed the romaniuk/implement-move-xblock-modal branch from c561446 to a06651c Compare November 20, 2024 10:06
@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.

Works for me! Thank you!

@arbrandes arbrandes merged commit b5419ac into openedx:master Nov 21, 2024
7 checks passed
@ihor-romaniuk ihor-romaniuk deleted the romaniuk/implement-move-xblock-modal branch November 22, 2024 09:32
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 FC Relates to an Axim Funded Contribution project 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.

7 participants