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: adds Library Content button to Studio Unit page [FC-0062] #35670

Conversation

navinkarkera
Copy link
Contributor

@navinkarkera navinkarkera commented Oct 18, 2024

Built on top of: open-craft#699 and #35636

Depends on

First iteration

vokoscreenNG-2024-10-18_17-57-00.mp4

Second iteration

vokoscreenNG-2024-10-21_11-16-03.mp4

Test instructions:

  1. Check out this branch
  2. Run tutor dev exec lms openedx-assets build --env=dev to rebuild JS files
  3. Check out refactor: picker component to only post message with block info [FC-0062] frontend-app-authoring#1401 in authoring MFE
  4. Disable browser cache and view the unit page

@openedx-webhooks
Copy link

openedx-webhooks commented Oct 18, 2024

Thanks for the pull request, @navinkarkera!

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/wg-maintenance-edx-platform. 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.

placeholderElement.remove();
});
},

duplicateComponent: function(xblockElement) {
// A placeholder element is created in the correct location for the duplicate xblock
// and then onNewXBlock will replace it with a rendering of the xblock. Note that
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This file has many duplicate functions like deleteXBlock, duplicateXBlock, showMoveXBlockModal etc.

openedx/core/djangoapps/content_staging/api.py Outdated Show resolved Hide resolved
Comment on lines +138 to +139
:library_content_key: the key of the library content to add. (Incompatible with
all other fields except parent_locator)
Copy link
Member

Choose a reason for hiding this comment

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

Having this POST arg will be nice, so that we don't have to follow up the request with a PUT 👍🏻

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kdmccormick Yes, called upstream sync after creating the block in a single call, simplified the js part. bc27ba3

@navinkarkera navinkarkera force-pushed the navin/jill/rpenido/fal-3876-add-libary-content-to-a-course branch from ddd1307 to bc27ba3 Compare October 19, 2024 10:18
Copy link
Contributor Author

@navinkarkera navinkarkera left a comment

Choose a reason for hiding this comment

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

It seems like upstream sync will only support blocks that were published. Currently the component picker shows all components including drafts that were never published.

@@ -224,7 +225,7 @@ function($, _, Backbone, gettext, BasePage,
},

initializePasteButton() {
if (this.options.canEdit && !self.options.isIframeEmbed) {
if (this.options.canEdit && !this.options.isIframeEmbed) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixes a typo/bug introduced in #35587

@@ -241,7 +242,7 @@ function($, _, Backbone, gettext, BasePage,
refreshPasteButton(data) {
// Do not perform any changes on paste button since they are not
// rendered on Library or LibraryContent pages
if (!this.isLibraryPage && !this.isLibraryContentPage && !self.options.isIframeEmbed) {
if (!this.isLibraryPage && !this.isLibraryContentPage && !this.options.isIframeEmbed) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixes a typo/bug introduced in #35587

@bradenmacdonald
Copy link
Contributor

It seems like upstream sync will only support blocks that were published. Currently the component picker shows all components including drafts that were never published.

We have a separate story for that which @ChrisChV is working on: openedx/frontend-app-authoring#1354 / https://tasks.opencraft.com/browse/FAL-3881

@bradenmacdonald
Copy link
Contributor

I also have a draft "published" filter but it turns out to need some backend changes to implement and I haven't had time. CC @ChrisChV . openedx/frontend-app-authoring#1406

Copy link
Contributor

@bradenmacdonald bradenmacdonald left a comment

Choose a reason for hiding this comment

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

Nice! It's working well. Here are some minor things I've noted that we should clean up:

cms/djangoapps/contentstore/utils.py Outdated Show resolved Hide resolved
cms/djangoapps/contentstore/views/component.py Outdated Show resolved Hide resolved
cms/static/js/views/components/add_library_content.js Outdated Show resolved Hide resolved
* Adds the action buttons to the modal.
*/
addActionButtons: function() {
this.addActionButton('cancel', gettext('Cancel'));
Copy link
Contributor

@bradenmacdonald bradenmacdonald Oct 19, 2024

Choose a reason for hiding this comment

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

This can be fixed in a fast-follow PR (because I'm eager to get this into testing ASAP), but it's not a great UX that the "Next" button is sometimes hidden until you scroll, and the Next + Cancel buttons are in totally different places. I think they need to either be both inside the modal or both in the legy UI actions bar.
sceenshot

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, do we even need a Next button? Selecting a course should directly take to next page since we only have one item to select in the first slide.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed next button and updated it to go to component selection on library selection.

vokoscreenNG-2024-10-21_11-16-03.mp4

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense to me!

@bradenmacdonald
Copy link
Contributor

bradenmacdonald commented Oct 19, 2024

@navinkarkera Oh, actually one more important thing: can you make sure this new button is only enabled visible if libraries_v2_enabled()?

@navinkarkera navinkarkera marked this pull request as ready for review October 21, 2024 05:48
@navinkarkera
Copy link
Contributor Author

@bradenmacdonald Thanks for the suggestions, updated and addressed all your comments.

@navinkarkera navinkarkera changed the title feat: adds Library Content button to Studio Unit page feat: adds Library Content button to Studio Unit page [FC-0062] Oct 21, 2024
Copy link
Contributor

@bradenmacdonald bradenmacdonald left a comment

Choose a reason for hiding this comment

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

Great work @navinkarkera ! I tested this with the latest course-authoring PR and it's working well. Ready to merge.

@bradenmacdonald bradenmacdonald merged commit 7e8fb43 into openedx:master Oct 21, 2024
49 checks passed
@bradenmacdonald bradenmacdonald deleted the navin/jill/rpenido/fal-3876-add-libary-content-to-a-course branch October 21, 2024 17:32
@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

1 similar comment
@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

1 similar comment
@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

Ian2012 pushed a commit to eduNEXT/edx-platform that referenced this pull request Oct 22, 2024
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.

7 participants