Skip to content

Conversation

@rpenido
Copy link
Contributor

@rpenido rpenido commented Apr 9, 2025

Description

This PR adds support to add Units to Collections.
image

Supporting information

Testing Instructions

Using the sidebar

  • Click on a Unit to show the sidebar
  • Navigate to the Organize tab
  • Select some collections and save
  • Open the collection and check if the Unit was added
  • Remove the unit from the collection using the menu from the Unit Card
  • Check if the unit was removed from the Collection

Using the card menu

  • Open the menu from a Unit card
  • Click on the "Add to collection" menu item
  • Check if the sidebar opens with the Collection widget open and in Edit mode
  • Select some collections and save
  • Open the collection and check if the Unit was added
  • Remove the unit from the collection using the menu from the Unit Card
  • Check if the unit was removed from the Collection

Using the component picker

  • Open a Collection
  • Click on "+ New" and then on "Existing Library Content"
  • Select a unit and click on "Add to Collection"
  • Check if the Unit was correctly added

Creating a unit directly inside a collection

  • Open a Collection
  • Click on "+ New" and then on "Unit"
  • Fill the form and click on "Create"
  • Check if the Unit was correctly created and added to the collection

Check if you can NOT add a unit in the Unit Outline

  • Open a Unit Outline for an existing Course Unit
  • On the "Add a new component" widget, click on "Library Content (beta)"
  • Check that no Units are shown on the component picker

Private ref: FAL-4068

@openedx-webhooks
Copy link

openedx-webhooks commented Apr 9, 2025

Thanks for the pull request, @rpenido!

This repository is currently maintained by @openedx/2u-tnl.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are 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.


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.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Apr 9, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage in Contributions Apr 9, 2025
@rpenido rpenido changed the title feat: add container collection support feat: add container collection support [FC-0083] Apr 9, 2025
@rpenido rpenido force-pushed the rpenido/fal-4068/add-unit-collections-support branch 3 times, most recently from 5264613 to cb3f628 Compare April 9, 2025 18:32
@codecov
Copy link

codecov bot commented Apr 9, 2025

Codecov Report

Attention: Patch coverage is 97.48428% with 4 lines in your changes missing coverage. Please review.

Project coverage is 93.56%. Comparing base (6818542) to head (bbdf3d4).
Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
src/library-authoring/components/ContainerCard.tsx 92.30% 2 Missing ⚠️
.../library-authoring/create-unit/CreateUnitModal.tsx 87.50% 1 Missing ⚠️
src/library-authoring/units/LibraryUnitBlocks.tsx 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1797      +/-   ##
==========================================
+ Coverage   93.55%   93.56%   +0.01%     
==========================================
  Files        1136     1139       +3     
  Lines       23245    23308      +63     
  Branches     5013     5022       +9     
==========================================
+ Hits        21746    21808      +62     
- Misses       1423     1424       +1     
  Partials       76       76              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@rpenido rpenido force-pushed the rpenido/fal-4068/add-unit-collections-support branch 4 times, most recently from d21f870 to 551b2b5 Compare April 9, 2025 21:29
@rpenido rpenido changed the title feat: add container collection support [FC-0083] feat: add collections support for containers [FC-0083] Apr 10, 2025
@rpenido rpenido force-pushed the rpenido/fal-4068/add-unit-collections-support branch 11 times, most recently from aa698ea to 955e7ba Compare April 10, 2025 19:48
@rpenido rpenido marked this pull request as ready for review April 10, 2025 20:19
@rpenido rpenido force-pushed the rpenido/fal-4068/add-unit-collections-support branch from 955e7ba to f9efda9 Compare April 10, 2025 21:19
@rpenido rpenido force-pushed the rpenido/fal-4068/add-unit-collections-support branch from f9efda9 to 604d19f Compare April 10, 2025 21:33
Copy link
Contributor

@pomegranited pomegranited left a comment

Choose a reason for hiding this comment

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

👍 This is working beautifully @rpenido !

  • I tested this by adding/removing Units and Components to/from Collections using the "Organize" tab and the "add existing content" component picker.
  • I read through the code
  • I checked for accessibility issues by using my keyboard to navigate
  • Includes documentation
  • User-facing strings are extracted for translation

>
<ComponentPicker
showOnlyPublished
extraFilter={['NOT block_type = "unit"']}
Copy link
Contributor

Choose a reason for hiding this comment

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

Oo good catches!

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.

LGTM! If you can fix the conflicts and get the coverage tests passing, I'll merge it for you.

export interface SelectedComponent {
usageKey: string;
blockType: string;
blockType?: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

How does a Component ever have a usageKey but not a blockType ? Or is this really an ItemPicker that can select non-components?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was planning not to pass blockType when selecting 'Units', but I ended up passing it as the containerType has a similar meaning. Reverted 0962eab

@@ -0,0 +1,51 @@
import { defineMessages } from '@edx/frontend-platform/i18n';
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: this file can be .ts not .tsx.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed: 0962eab

@rpenido rpenido force-pushed the rpenido/fal-4068/add-unit-collections-support branch from 1896819 to caedcba Compare April 12, 2025 01:39
@rpenido rpenido force-pushed the rpenido/fal-4068/add-unit-collections-support branch from 4abb90f to 073d1f4 Compare April 12, 2025 03:27
@rpenido
Copy link
Contributor Author

rpenido commented Apr 12, 2025

LGTM! If you can fix the conflicts and get the coverage tests passing, I'll merge it for you.

Thanks for the review @bradenmacdonald!
We still need to get openedx/edx-platform#36504 merged first (which depends on openedx/openedx-learning#299) because we changed the API collection endpoint from collection/:collecionId/components to collection/:collecionId/items there.

@rpenido rpenido marked this pull request as draft April 12, 2025 04:48
@mphilbrick211 mphilbrick211 added the FC Relates to an Axim Funded Contribution project label Apr 14, 2025
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Waiting on Author in Contributions Apr 14, 2025
@rpenido rpenido force-pushed the rpenido/fal-4068/add-unit-collections-support branch 3 times, most recently from dcc5036 to 3991b70 Compare April 15, 2025 15:05
@rpenido rpenido force-pushed the rpenido/fal-4068/add-unit-collections-support branch from 3991b70 to bbdf3d4 Compare April 15, 2025 15:16
@rpenido rpenido marked this pull request as ready for review April 15, 2025 15:34
@ChrisChV ChrisChV merged commit aa8a5bf into openedx:master Apr 15, 2025
7 checks passed
@github-project-automation github-project-automation bot moved this from Waiting on Author to Done in Contributions Apr 15, 2025
@rpenido rpenido deleted the rpenido/fal-4068/add-unit-collections-support branch April 15, 2025 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

6 participants