feat: add component usage data in the ComponentDetails component [FC-0076]#1656
Conversation
|
Thanks for the pull request, @rpenido! This repository is currently maintained by 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 approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo 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:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere 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:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
c2ce1e2 to
644b0a4
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1656 +/- ##
==========================================
+ Coverage 93.35% 93.36% +0.01%
==========================================
Files 1109 1110 +1
Lines 22103 22154 +51
Branches 4681 4696 +15
==========================================
+ Hits 20635 20685 +50
- Misses 1403 1404 +1
Partials 65 65 ☔ View full report in Codecov by Sentry. |
f235183 to
8ad175a
Compare
navinkarkera
left a comment
There was a problem hiding this comment.
@rpenido Looks good 👍
- I tested this: Verified list of courses in library block details
- I read through the code
- I checked for accessibility issues
- Includes documentation
ChrisChV
left a comment
There was a problem hiding this comment.
Looks good. Only one nit
|
Sure @bradenmacdonald! |
cebcd25 to
d01f4ad
Compare
c1063b9 to
0f8ff9d
Compare
0f8ff9d to
0c35fe8
Compare
navinkarkera
left a comment
There was a problem hiding this comment.
@rpenido We need to make some minor changes but overall it looks good.
| } | ||
|
|
||
| const componentUsage = downstreamHits.reduce<ComponentUsageTree>((acc, hit) => { | ||
| const link = hit.breadcrumbs.at(-1); |
There was a problem hiding this comment.
You'll need to build url to link to the units, like here. Currently, I just see the unit names and links don't work.
There was a problem hiding this comment.
Scratch this, I missed to reindex and test. Will come back to this.
There was a problem hiding this comment.
I think building the url here is simple enough to avoid adding the link data to index. See openedx/openedx-platform#36253 (comment)
There was a problem hiding this comment.
Thanks @navinkarkera! Fixed!
I made it a bit different because the link on the Library page redirects me to Legacy Studio, despite the waffle flag.
There was a problem hiding this comment.
I made it a bit different because the link on the Library page redirects me to Legacy Studio, despite the waffle flag.
I think it might be a component under Problem Bank which is only supported legacy studio, so it doesn't redirect to MFE.
There was a problem hiding this comment.
You're right! I may have done something wrong with my testing.
It is respecting the waffle flag as expected.
There was a problem hiding this comment.
I would use a HyperLink and open the links in a new tab.
f80e4ab to
e9dd32f
Compare
e9dd32f to
586c3d8
Compare
Co-authored-by: Navin Karkera <navin@opencraft.com>
43160ac to
2999ae4
Compare
2999ae4 to
42a4949
Compare
There was a problem hiding this comment.
@rpenido This always takes us to new MFE page ignoring waffle flags. It also crashes incase the parent is a problem block as MFE doesn't support it. Why can't we use ${getConfig().STUDIO_BASE_URL}/container/${key} which then redirects us to correct url based on the waffle flags and other settings.
| } | ||
|
|
||
| const componentUsage = downstreamHits.reduce<ComponentUsageTree>((acc, hit) => { | ||
| const link = hit.breadcrumbs.at(-1); |
There was a problem hiding this comment.
I made it a bit different because the link on the Library page redirects me to Legacy Studio, despite the waffle flag.
I think it might be a component under Problem Bank which is only supported legacy studio, so it doesn't redirect to MFE.
| <Collapsible key={context.key} title={context.contextName} styling="basic"> | ||
| {context.links.map(({ usageKey: downstreamUsageKey, displayName, url }) => ( | ||
| <Hyperlink key={downstreamUsageKey} destination={url} target="_blank">{displayName}</Hyperlink> | ||
| ))} | ||
| </Collapsible> |
|
@rpenido Maybe I'm overlooking something, but when I add a component to a unit and refresh the page to see the "Component usage", the listing with the unit is not updated. I need to reindex the search index so that the unit appears in the list. |
|
@rpenido Also, I missed this before but we need to only display the unit once if the same component is used multiple times in the same unit or problem bank. |
It seems that on copy/paste we first create the block (which triggers the indexing), and then we set the parent: Should we create another task to handle it? |
@rpenido Sure 👍 |
navinkarkera
left a comment
There was a problem hiding this comment.
@rpenido Looks good! 👍
- I tested this: verified course and unit list in library component sidebar.
- I read through the code
- I checked for accessibility issues
- Includes documentation




Description
This PR adds the list of Courses and Units/Containers using a component to the "Details" tab on the sidebar.
Addition Information
Testing Instructions
Private ref: FAL-4005