Skip to content

feat: course libraries page [FC-0076]#1641

Merged
ChrisChV merged 10 commits intoopenedx:masterfrom
open-craft:navin/fal-4006/course-libraries-page
Feb 18, 2025
Merged

feat: course libraries page [FC-0076]#1641
ChrisChV merged 10 commits intoopenedx:masterfrom
open-craft:navin/fal-4006/course-libraries-page

Conversation

@navinkarkera
Copy link
Contributor

@navinkarkera navinkarkera commented Jan 29, 2025

Description:

Adds Libraries page that lists all library components being used in the current course to Content > Libraries.

image

Part of: #1565
Depends on: openedx/openedx-platform#36190
Private-ref: FAL-4006

Test instructions:

  • Checkout PR feat: entity link view and api openedx-platform#36190 in edx-platform repo.
  • Run tutor images build openedx-dev && tutor dev launch -I --skip-build.
  • Go to any course outline page and visit its Libraries page using Content > Libraries navigation menu item.
  • Verify the design and the links if the course is using any library components.
  • Add some more components from multiple libraries using Library Content picker, copy & paste or Problem bank option.
  • Verify that these items are then visible in the Libraries page.
  • Update and publish some of the upstream library components and verify that the Libraries page displays components out of sync list.

Concerns:

Some of the requirements listed in the comment here: #1565 (comment) are not finalized.

@navinkarkera navinkarkera requested a review from a team as a code owner January 29, 2025 11:23
@openedx-webhooks
Copy link

openedx-webhooks commented Jan 29, 2025

Thanks for the pull request, @navinkarkera!

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.

Details
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 Jan 29, 2025
@navinkarkera navinkarkera marked this pull request as draft January 29, 2025 11:25
@navinkarkera navinkarkera force-pushed the navin/fal-4006/course-libraries-page branch from caea2df to e9d41f5 Compare February 10, 2025 06:20
@navinkarkera navinkarkera changed the title navin/fal 4006/course libraries page feat: course libraries page Feb 10, 2025
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.

👍 Looks and works great @navinkarkera !

  • I tested this using the PR test instructions.
  • I read through the code
  • I checked for accessibility issues by using my keyboard alone to navigate this new page.
  • Includes documentation -- code comments for new apis/hooks.
  • User-facing strings are extracted for translation

const intl = useIntl();
const componentIcon = getItemIcon(info.blockType);
const breadcrumbs = tail(info.breadcrumbs) as Array<{ displayName: string, usageKey: string }>;
const unitUsageKey = breadcrumbs[breadcrumbs.length - 1].usageKey;
Copy link
Contributor

Choose a reason for hiding this comment

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

[suggestion] I get an error on this line sometimes -- which was resolved by re-running reindex_studio.

But maybe check breadcrumbs.length before assuming there's a wrapper unit?

Breadcrumb.error.mp4

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. 4e262a3

import { DECODED_ROUTES } from './constants';
import CourseChecklist from './course-checklist';
import GroupConfigurations from './group-configurations';
import CourseLibraries from './course-libraries/CourseLibraries';
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: worth importing this from an index file like the other course 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.

Fixed. 4e262a3

const componentIcon = getItemIcon(info.blockType);
const breadcrumbs = tail(info.breadcrumbs) as Array<{ displayName: string, usageKey: string }>;
const unitUsageKey = breadcrumbs[breadcrumbs.length - 1].usageKey;
const blockLink = `${getConfig().STUDIO_BASE_URL}/container/${unitUsageKey}`;
Copy link
Contributor

Choose a reason for hiding this comment

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

[suggestion] Is there a way to re-use the methods in search-modal.SearchResult like getUnitComponentUrlSuffix instead of setting the URL explicitly here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pomegranited SearchResult component seems to generate new mfe links and ignores server waffle flags, so I did not reuse it. It is easier to always point to server url as it redirects to mfe if enabled else displays legacy unit page. Note that here we always open the link in a new tab so full refresh is inevitable (react-router fast routing won't help).

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah ok, that makes sense.

@navinkarkera navinkarkera force-pushed the navin/fal-4006/course-libraries-page branch 2 times, most recently from f547160 to 87d7567 Compare February 12, 2025 13:45
@codecov
Copy link

codecov bot commented Feb 12, 2025

Codecov Report

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

Project coverage is 93.33%. Comparing base (0b08d82) to head (a1ee33c).
Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
src/course-libraries/CourseLibraries.tsx 97.77% 2 Missing ⚠️
src/course-libraries/data/api.mocks.ts 90.47% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1641      +/-   ##
==========================================
+ Coverage   93.30%   93.33%   +0.02%     
==========================================
  Files        1101     1107       +6     
  Lines       21855    22002     +147     
  Branches     4646     4768     +122     
==========================================
+ Hits        20392    20535     +143     
+ Misses       1398     1396       -2     
- Partials       65       71       +6     

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

@navinkarkera navinkarkera marked this pull request as ready for review February 12, 2025 13:58
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.

@navinkarkera Looks good! There are some nits

readyToSync: boolean;
}

export const getEntityLinksByDownstreamContext = async (
Copy link
Contributor

Choose a reason for hiding this comment

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

@navinkarkera Could you add a simple test to this function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Added test case for the hook that covers this API as well. 20650d5

@navinkarkera navinkarkera force-pushed the navin/fal-4006/course-libraries-page branch from 87d7567 to 20650d5 Compare February 13, 2025 05:40
@ChrisChV ChrisChV changed the title feat: course libraries page feat: course libraries page [FC-0076] Feb 18, 2025
@ChrisChV ChrisChV merged commit 8275bbe into openedx:master Feb 18, 2025
7 checks passed
@ChrisChV ChrisChV deleted the navin/fal-4006/course-libraries-page branch February 18, 2025 15:36
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.

4 participants