update readme for AdditionalTranslationsComponentSlot - #2321
Conversation
|
Thanks for the pull request, @jacobo-dominguez-wgu! 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. |
3c8a39d to
13b4f6d
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2321 +/- ##
=======================================
Coverage 94.40% 94.41%
=======================================
Files 1167 1167
Lines 24901 24928 +27
Branches 5408 5433 +25
=======================================
+ Hits 23508 23535 +27
Misses 1320 1320
Partials 73 73 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
bradenmacdonald
left a comment
There was a problem hiding this comment.
Thanks for taking the time to document these! Your docs are nice, but I find these plugin slots to be pretty messy and I have a few questions.
| ## Description | ||
|
|
||
| This slot is used to add a custom block in the **Content permissions** section of the **page & resources** page. | ||
| **AdditionalCourseContentPluginSlot** is dependent of [AdditionalCoursePluginSlot](../AdditionalCoursePluginSlot/README.md), to make it visible is also needed to provide settings for **AdditionalCoursePluginSlot**. |
There was a problem hiding this comment.
| **AdditionalCourseContentPluginSlot** is dependent of [AdditionalCoursePluginSlot](../AdditionalCoursePluginSlot/README.md), to make it visible is also needed to provide settings for **AdditionalCoursePluginSlot**. | |
| **AdditionalCourseContentPluginSlot** is depends on [AdditionalCoursePluginSlot](../AdditionalCoursePluginSlot/README.md); to make it visible, you must also provide configuration for the **AdditionalCoursePluginSlot**. |
This is weird to me. Why does one of these slots depend on the other? There isn't a technical reason as far as I can see, because if I do this:
'org.openedx.frontend.authoring.additional_course_content_plugin.v1': {
plugins: [
{
op: PLUGIN_OPERATIONS.Insert,
widget: {
id: 'custom_additional_course_content_id',
type: DIRECT_PLUGIN,
RenderWidget: () => (
<Card className={'shadow justify-content-between'} >
<Card.Header
title={'Additional Course Content'}
/>
<Card.Body>
<Card.Section>
<p>Additional course contentfrom slot plugins. Add all the content needed here.</p>
</Card.Section>
</Card.Body>
</Card>
),
},
},
],
},
'org.openedx.frontend.authoring.additional_course_plugin.v1': {
plugins: []
}it works fine. Even though this is the same as not having an additional_course_plugin at all.
| const hasAdditionalCoursePlugin = getConfig()?.pluginSlots?.additional_course_plugin != null; | ||
| const { pluginSlots } = getConfig(); | ||
| const hasAdditionalCoursePlugin = pluginSlots?.['org.openedx.frontend.authoring.additional_course_plugin.v1'] != null | ||
| && pluginSlots?.['org.openedx.frontend.authoring.additional_course_content_plugin.v1'] != null; |
There was a problem hiding this comment.
Checking for null seems strange because it means that if you don't define 'org.openedx.frontend.authoring.additional_course_plugin.v1' at all, this will be false, but if you define it as being empty, this will be true:
const config = {
pluginSlots: {
'org.openedx.frontend.authoring.additional_course_content_plugin.v1': {
plugins: [],
},
'org.openedx.frontend.authoring.additional_course_plugin.v1': {
plugins: []
}
},
}| @@ -4,3 +4,73 @@ | |||
|
|
|||
| ### Slot ID Aliases | |||
| * `additional_course_content_plugin` | |||
There was a problem hiding this comment.
Out of scope for this PR, but this is a bad name. Shouldn't it be something like pages_resources_content_permissions_additional_cards ?
There was a problem hiding this comment.
The alias can't change for backwards compatibility reasons, but I'm very open to changing the id and making the current id (org.openedx.frontend.authoring.additional_course_content_plugin.v1) another alias.
|
|
||
| ## Description | ||
|
|
||
| This slot is used to add a custom block in the **Content permissions** section of the **page & resources** page. |
There was a problem hiding this comment.
Does anyone know why we even have "Content permissions" as a separate section? It doesn't seem that useful to me to have one or two cards separate from the others. Why are the permissions settings not just managed within the "regular" settings for the particular app?
|
@brian-smith-tcril do you have any additional context on these "Pages & Resources" plugin slots? |
|
I did some digging through the blame and found: The slot was originally added in at that point it was just <PluginSlot id="additional_course_plugin" />hardcoded into the It was then updated in which changed the In <PageGrid pages={pages} pluginSlotId="additional_course_plugin" />
[...]
<PageGrid pages={contentPermissionsPages} pluginSlotId="additional_course_content_plugin" />In - <PluginSlot id="additional_course_plugin" />
+ {pluginSlotId && <PluginSlot id={pluginSlotId} />}I then made the "standardize slot ids" PR
With that I moved In - const PageGrid = ({ pages, pluginSlotId, courseId }) => (
+ const PageGrid = ({ pages, pluginSlotComponent, courseId }) => (- {pluginSlotId && <PluginSlot id={pluginSlotId} />}
+ {pluginSlotComponent}I think the image showing the bug in #994 helps provide some context
In that screenshot we can see the 2 The top grid is from The bottom grid is from I know this is a lot. Hopefully that helps a bit! Let me know if you have more questions! |
|
As for the dependency issue, it seems to be stemming from and frontend-app-authoring/src/pages-and-resources/PagesAndResources.jsx Lines 96 to 106 in 11de402 specifically It seems to me this started as a mistake in #994 - it seems it should have been const hasAdditionalCoursePlugin = getConfig()?.pluginSlots?.additional_course_content_plugin != null;Unfortunately, this logic seems to be even worse now than when it started now that we've standardized slot ids and added alias functionality. I'd want to double check this but I'm pretty sure with the current code I absolutely think cleaning up the logic surrounding the conditional rendering of the "Content permissions" grid makes sense. I'd also like to know if anyone has an answer to @bradenmacdonald's previous question:
|
|
@jristau1984 I think the "Content Permissions" thing may have originated from a 2U plugin - do you know the answer to that question ^ ? (not urgent) |
|
It looks like the reason it's just to call out that the plugin will be accessing course content in some way. There are disclaimers in our widget and precedent that we don't need another section like this now... I think it can be deprecated from 2U's Palestine. |
|
Thanks for that context @jristau1984! So it sounds like we can simplify this quite a bit! If we remove this block: frontend-app-authoring/src/pages-and-resources/PagesAndResources.jsx Lines 48 to 58 in 11de402 and this line and this block frontend-app-authoring/src/pages-and-resources/PagesAndResources.jsx Lines 96 to 106 in 11de402 then everything should be in the one We then need to handle the 2 slot id issue. By removing those and making no other changes we'd only be supporting:
And we need to continue to also support:
I think the best way to handle this would be to update the to include the plugin slot from the so we'd have export const AdditionalCoursePluginSlot = () => (
<PluginSlot
id="org.openedx.frontend.authoring.additional_course_plugin.v1"
idAliases={['additional_course_plugin']}
/>
<PluginSlot
id="org.openedx.frontend.authoring.additional_course_content_plugin.v1"
idAliases={['additional_course_content_plugin']}
/>
);at that point we can completely remove the We can then put out a DEPR for the |
|
Alright then. Do you guys @bradenmacdonald, @brian-smith-tcril agree to use this current pr just for the |
13b4f6d to
2b9f5a2
Compare
2b9f5a2 to
6e89add
Compare
brian-smith-tcril
left a comment
There was a problem hiding this comment.
This looks great as it stands now!
Thanks for making the #2330 issue!
If you could update the PR description of this to be something like "docs: update AdditionalTranslationsComponentSlot README" to clarify the new scope of this PR that'd be perfect!


Description
Updating docs for AdditionalTranslationsComponentSlot adding description, example code and example image.