Skip to content

update readme for AdditionalTranslationsComponentSlot - #2321

Merged
bradenmacdonald merged 1 commit into
openedx:masterfrom
WGU-Open-edX:plugin-slot-docs
Jul 25, 2025
Merged

update readme for AdditionalTranslationsComponentSlot#2321
bradenmacdonald merged 1 commit into
openedx:masterfrom
WGU-Open-edX:plugin-slot-docs

Conversation

@jacobo-dominguez-wgu

@jacobo-dominguez-wgu jacobo-dominguez-wgu commented Jul 22, 2025

Copy link
Copy Markdown
Contributor

Description

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

@openedx-webhooks

Copy link
Copy Markdown

Thanks for the pull request, @jacobo-dominguez-wgu!

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.

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 Jul 22, 2025
@github-project-automation github-project-automation Bot moved this to Needs Triage in Contributions Jul 22, 2025
@jacobo-dominguez-wgu
jacobo-dominguez-wgu force-pushed the plugin-slot-docs branch 2 times, most recently from 3c8a39d to 13b4f6d Compare July 22, 2025 22:20
@codecov

codecov Bot commented Jul 22, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.41%. Comparing base (8e3ea89) to head (6e89add).
⚠️ Report is 9 commits behind head on master.

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

@jacobo-dominguez-wgu jacobo-dominguez-wgu added the mao-onboarding Reviewing this will help onboard devs from an Axim mission-aligned organization (MAO). label Jul 22, 2025
@jacobo-dominguez-wgu jacobo-dominguez-wgu moved this from Needs Triage to Ready for Review in Contributions Jul 22, 2025

@bradenmacdonald bradenmacdonald left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
**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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Screenshot 2025-07-24 at 3 00 30 PM

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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Out of scope for this PR, but this is a bad name. Shouldn't it be something like pages_resources_content_permissions_additional_cards ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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?

@bradenmacdonald

Copy link
Copy Markdown
Contributor

@brian-smith-tcril do you have any additional context on these "Pages & Resources" plugin slots?

@brian-smith-tcril

Copy link
Copy Markdown
Contributor

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 PageGrid component.


It was then updated in

which changed the PageGrid component from using a hardcoded slot id to one passed in as a prop

In PagesAndResources:

<PageGrid pages={pages} pluginSlotId="additional_course_plugin" />
[...]
<PageGrid pages={contentPermissionsPages} pluginSlotId="additional_course_content_plugin" />

In PageGrid:

- <PluginSlot id="additional_course_plugin" />
+ {pluginSlotId && <PluginSlot id={pluginSlotId} />}

I then made the "standardize slot ids" PR

With that I moved PageGrid away from taking in a slot id as a prop to instead take in a slot component as a prop.

In PageGrid:

- 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

image

In that screenshot we can see the 2 PageGrid components rendered by the PagesAndResources component:

The top grid is from

<PageGrid pages={pages} pluginSlotComponent={<AdditionalCoursePluginSlot />} courseId={courseId} />

The bottom grid is from

<PageGrid pages={contentPermissionsPages} pluginSlotComponent={<AdditionalCourseContentPluginSlot />} />


I know this is a lot. Hopefully that helps a bit! Let me know if you have more questions!

@brian-smith-tcril

Copy link
Copy Markdown
Contributor

As for the dependency issue, it seems to be stemming from

const hasAdditionalCoursePlugin = getConfig()?.pluginSlots?.additional_course_plugin != null;

and

{
(contentPermissionsPages.length > 0 || hasAdditionalCoursePlugin)
&& (
<>
<div className="d-flex justify-content-between my-4 my-md-5 align-items-center">
<h3 className="m-0">{intl.formatMessage(messages.contentPermissions)}</h3>
</div>
<PageGrid pages={contentPermissionsPages} pluginSlotComponent={<AdditionalCourseContentPluginSlot />} />
</>
)
}

specifically

(contentPermissionsPages.length > 0 || hasAdditionalCoursePlugin)


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 hasAdditionalCoursePlugin would be falsy if someone used the proper org.openedx.frontend.authoring.additional_course_plugin.v1 id instead of the additional_course_plugin alias.

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:

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?

@bradenmacdonald

Copy link
Copy Markdown
Contributor

@jristau1984 I think the "Content Permissions" thing may have originated from a 2U plugin - do you know the answer to that question ^ ? (not urgent)

@jristau1984

Copy link
Copy Markdown
Contributor

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.

@brian-smith-tcril

Copy link
Copy Markdown
Contributor

Thanks for that context @jristau1984!

So it sounds like we can simplify this quite a bit!

If we remove this block:

// We want the Xpert learning assistant and unit summaries to appear in the "Content Permissions" section instead,
// so we remove them from pages and add them to contentPermissionsPages.
const contentPermissionsPages = [];
['xpert_unit_summary', 'learning_assistant'].forEach(separateAppId => {
const index = pages.findIndex(app => app.id === separateAppId);
if (index !== -1) {
const [page] = pages.splice(index, 1);
contentPermissionsPages.push(page);
}
});

and this line

const hasAdditionalCoursePlugin = getConfig()?.pluginSlots?.additional_course_plugin != null;

and this block

{
(contentPermissionsPages.length > 0 || hasAdditionalCoursePlugin)
&& (
<>
<div className="d-flex justify-content-between my-4 my-md-5 align-items-center">
<h3 className="m-0">{intl.formatMessage(messages.contentPermissions)}</h3>
</div>
<PageGrid pages={contentPermissionsPages} pluginSlotComponent={<AdditionalCourseContentPluginSlot />} />
</>
)
}

then everything should be in the one PageGrid.

We then need to handle the 2 slot id issue. By removing those and making no other changes we'd only be supporting:

  • Site operators using only org.openedx.frontend.authoring.additional_course_plugin.v1/additional_course_plugin

And we need to continue to also support:

  • Site operators using only org.openedx.frontend.authoring.additional_course_content_plugin.v1/additional_course_content_plugin
  • Site operators using both org.openedx.frontend.authoring.additional_course_plugin.v1/additional_course_plugin and org.openedx.frontend.authoring.additional_course_content_plugin.v1/additional_course_content_plugin

I think the best way to handle this would be to update the AdditionalCoursePluginSlot component

export const AdditionalCoursePluginSlot = () => (
<PluginSlot
id="org.openedx.frontend.authoring.additional_course_plugin.v1"
idAliases={['additional_course_plugin']}
/>
);

to include the plugin slot from the AdditionalCourseContentPluginSlot component

<PluginSlot
id="org.openedx.frontend.authoring.additional_course_content_plugin.v1"
idAliases={['additional_course_content_plugin']}
/>

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 AdditionalCourseContentPluginSlot component.

We can then put out a DEPR for the org.openedx.frontend.authoring.additional_course_content_plugin.v1/additional_course_content_plugin id/alias and let site operators know they should move anything they're currently putting in that slot to the org.openedx.frontend.authoring.additional_course_plugin.v1 slot instead.

@jacobo-dominguez-wgu

Copy link
Copy Markdown
Contributor Author

Alright then. Do you guys @bradenmacdonald, @brian-smith-tcril agree to use this current pr just for the AdditionalTranslationsComponentSlot docs and create a new issue to handle the AdditionalCourseContentPluginSlot deprecation?

@brian-smith-tcril brian-smith-tcril left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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!

@jacobo-dominguez-wgu jacobo-dominguez-wgu changed the title update readme for some plugin slots update readme for AdditionalTranslationsComponentSlot Jul 25, 2025
@bradenmacdonald
bradenmacdonald merged commit 556bb1e into openedx:master Jul 25, 2025
7 checks passed
@github-project-automation github-project-automation Bot moved this from Ready for Review to Done in Contributions Jul 25, 2025
jacobo-dominguez-wgu added a commit to WGU-Open-edX/frontend-app-authoring that referenced this pull request Jul 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mao-onboarding Reviewing this will help onboard devs from an Axim mission-aligned organization (MAO). 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.

5 participants