Skip to content

Add subsection/unit to section/subsection full-page view within library [FC-0090] #2152

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

Merged
merged 14 commits into from
Jun 24, 2025

Conversation

pomegranited
Copy link
Contributor

@pomegranited pomegranited commented Jun 15, 2025

Description

  • Removes the "content type" tab bar from the "Add Existing Component/Unit/Subsection" modal, and in all cases where only one type of content is shown for selection.
  • Updates the section/subsection sidebar to show "Existing Library Content" + "New Subsection" / "New Unit" buttons.
  • Updates the "Add New Unit/Subsection" buttons to directly launch the new container modal, instead of going via the container sidebar.
  • Ensures that whenever a subsection/unit is created from within a section/subsection, that it is linked to the parent section/subsection after created.

Affects Library Content Authors.

Supporting information

Testing instructions

Code review: Recommend working through commit by commit.

  1. Create a new Library.
  2. Create a new Section.
  3. From the Section page, click "Add New Subsection".
    Ensure that the new Subsection is shown, and that its breadcrumbs reflect that it was added the Section
  4. From the Subsection page, click "Add New Unit".
    Ensure that the new Unit is shown. Navigate back to the Subsection to see that the Unit was added to the Subsection (see notes below).
  5. Repeat the steps above using the sidebar buttons.
  6. Ensure that the "Add Existing Subsection/Unit" buttons still work as expected.

Other information

  • A unit's membership in one or more subsections is not currently represented on the unit page (unlike subsections, whose membership in one or more sections is shown in the breadcrumbs). Fixing this is out of scope for this issue.

to make it easier to show or hide the "add new component" buttons.

Also removes the need to convert between Chapter => Section,
Sequential => Subsection, and Vertical => Unit.
instead of just opening the sidebar, when adding a container to another
container.

This saves the user a click and makes this consistent with the
"add new component" button on unit page.
@openedx-webhooks openedx-webhooks added open-source-contribution PR author is not from Axim or 2U core contributor PR author is a Core Contributor (who may or may not have write access to this repo). labels Jun 15, 2025
@openedx-webhooks
Copy link

openedx-webhooks commented Jun 15, 2025

Thanks for the pull request, @pomegranited!

This repository is currently maintained by @bradenmacdonald.

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.

Copy link

codecov bot commented Jun 15, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.13%. Comparing base (ebf4b7c) to head (a54a06a).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff            @@
##           master    #2152    +/-   ##
========================================
  Coverage   94.12%   94.13%            
========================================
  Files        1164     1164            
  Lines       24527    24540    +13     
  Branches     5339     5220   -119     
========================================
+ Hits        23086    23100    +14     
- Misses       1364     1372     +8     
+ Partials       77       68     -9     

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

@pomegranited pomegranited marked this pull request as ready for review June 15, 2025 23:55
@pomegranited pomegranited removed the request for review from ChrisChV June 17, 2025 15:44
expect(await screen.findByRole('button', { name: /existing library content/i })).toBeInTheDocument();
expect(await screen.findByRole('button', { name: /text/i })).toBeInTheDocument();
expect(await screen.findByRole('button', { name: /problem/i })).toBeInTheDocument();
});
});
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also need to remove the testIf skipped tests from ContainerInfo.test;

Copy link
Contributor Author

@pomegranited pomegranited Jun 18, 2025

Choose a reason for hiding this comment

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

Ah my mistake -- we can reinstate one of them, but the other relies on https://github.com/openedx/frontend-app-authoring/pull/2145/files#r2155581898

cf ec74917

@bradenmacdonald
Copy link
Contributor

A unit's membership in one or more subsections is not currently represented on the unit page (unlike subsections, whose membership in one or more sections is shown in the breadcrumbs). Fixing this is out of scope for this issue.

Is there an issue to track that somewhere? I did notice this when testing.

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.

👍 Seems good! Please just rebase / merge master and make sure it's working again before we can merge it. Also let me know about my minor comment and the testIf thing you mentioned.

  • I tested this: as suggested
  • I read through the code
  • I checked for accessibility issues
  • Includes documentation

@@ -37,7 +37,7 @@ import { ContainerType } from '../../generic/key-utils';

type ContentType = {
name: string,
disabled: boolean,
disabled?: boolean,
icon?: React.ComponentType,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
icon?: React.ComponentType,

Can we delete this icon field now? Seems to be unused after these changes.

Copy link
Contributor Author

@pomegranited pomegranited Jun 18, 2025

Choose a reason for hiding this comment

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

Ah, I made a mistake here -- we do need that icon parameter so we can show the little sparkle next to "Advanced / Other":

image

Fixed with 2e50209.

@ChrisChV
Copy link
Contributor

  • A unit's membership in one or more subsections is not currently represented on the unit page (unlike subsections, whose membership in one or more sections is shown in the breadcrumbs). Fixing this is out of scope for this issue.

No, but I asked to Product for the exact feature

@pomegranited pomegranited force-pushed the jill/add-to-container branch from d4ffcf9 to 2e50209 Compare June 18, 2025 22:01
@pomegranited pomegranited requested a review from ChrisChV June 18, 2025 22:08
@ChrisChV
Copy link
Contributor

@pomegranited Looks good! I found some issues:

On the section page, we need to change the first button to Existing Subsection and the second button to New Subsection. The same on the Subsection page.

image

On the select subsection modal, we need to remove the Type filter. The same on the select unit modal.

image

to make it easier to type these variables in other places
When adding units to a subsection:
* button names are "Add Unit" and "Existing Unit"
* modal title and text is "Select units" and "N units selected"
* modal button is "Add to subsection"

When adding subsection to a section:
* button names are "Add Subsection" and "Existing Subsection"
* modal title and text is "Select subsections" and "N subsections selected"
* modal button is "Add to section"

Otherwise, the more generic "component" text is used.
@pomegranited
Copy link
Contributor Author

@ChrisChV

On the section page, we need to change the first button to Existing Subsection and the second button to New Subsection. The same on the Subsection page.

Done with 3c62925.

I also updated the "Select components" and "N components selected" text to be consistent with the context.

On the select subsection modal, we need to remove the Type filter. The same on the select unit modal.

So, this would be harder to do, so I haven't done it.

Since the search modal isn't aware of the library routing context, we'd have to add something to the LibraryContext to pass this context through, like we do with showOnlyPublished and FilterByPublishedStatus.

@mphilbrick211 mphilbrick211 added the FC Relates to an Axim Funded Contribution project label Jun 20, 2025
@mphilbrick211 mphilbrick211 moved this from Needs Triage to In Eng Review in Contributions Jun 20, 2025
@ChrisChV
Copy link
Contributor

Done with 3c62925.

I also updated the "Select components" and "N components selected" text to be consistent with the context.

Thanks! Works great!

So, this would be harder to do, so I haven't done it.

Since the search modal isn't aware of the library routing context, we'd have to add something to the LibraryContext to pass this context through, like we do with showOnlyPublished and FilterByPublishedStatus.

@pomegranited What do you think about adding visibleFilters in LibraryAuthoringPage and ComponentPicker, like visibleTabs?

@pomegranited
Copy link
Contributor Author

@ChrisChV

What do you think about adding visibleFilters in LibraryAuthoringPage and ComponentPicker, like visibleTabs?

Ah, turned out to be even easier than that :) 50aedd2

Copy link
Contributor

@ChrisChV ChrisChV left a comment

Choose a reason for hiding this comment

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

Looks good 👍 Please, fix the CI to merge the PR

@pomegranited
Copy link
Contributor Author

@ChrisChV Done :) Tests will pass now.

@ChrisChV ChrisChV merged commit 747f7b6 into openedx:master Jun 24, 2025
7 checks passed
@github-project-automation github-project-automation bot moved this from In Eng Review to Done in Contributions Jun 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core contributor PR author is a Core Contributor (who may or may not have write access to this repo). FC Relates to an Axim Funded Contribution project open-source-contribution PR author is not from Axim or 2U
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants