Skip to content

feat: add enrollment action slots for mitxonline instructor dashboard MFE#119

Open
Anas12091101 wants to merge 2 commits into
mainfrom
anas/enrollment-actions-slot-override
Open

feat: add enrollment action slots for mitxonline instructor dashboard MFE#119
Anas12091101 wants to merge 2 commits into
mainfrom
anas/enrollment-actions-slot-override

Conversation

@Anas12091101

@Anas12091101 Anas12091101 commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

What are the relevant tickets?

https://github.com/mitodl/hq/issues/11861

Description (What does it do?)

Adds a MITx Online–only override of the instructor dashboard's enrollment actions slot.

The upstream @openedx/frontend-app-instructor-dashboard MFE now ships an overridable slot around
the Enroll Learners and Add Beta Testers buttons. This PR registers a MITx Online widget
into that slot (via WidgetOperationTypes.REPLACE) that gates each button by permission,
reproducing the legacy MITx Online instructor dashboard:

  • Enroll Learners → requires platform staff (permissions.admin / is_staff)
  • Add Beta Testers → requires the course Admin role (permissions.instructor)

A button the user cannot use stays visible but disabled, with an explanatory tooltip. The modals
stay owned by the MFE's Enrollments page — the widget only renders the buttons and calls the
handlers the slot passes in.

Scope & dependency:

  • Scoped to mitxonline only (mitxonline/src/instructor-dashboard/); xpro and mitx keep the MFE's ungated default.
  • Bumps @openedx/frontend-app-instructor-dashboard for mitxonline to ^1.1.0-alpha (1.1.0-alpha.1 is the first release exposing the slot exports).

Screenshots (if appropriate):

Default
default_enrollment_action

Custom
custom_enrollment_action

How can this be tested?

  1. Build/run the mitxonline instructor dashboard MFE from this branch (the dependency resolves to frontend-app-instructor-dashboard@1.1.0-alpha.1).
  2. Open a course's Instructor Dashboard → Enrollments.
  3. As a course Admin (instructor role, not a platform superuser): Enroll Learners is disabled (tooltip shown); Add Beta Testers is enabled.
  4. As a platform staff / superuser: both buttons are enabled.
  5. As course staff (no instructor role): both buttons are disabled.
  6. Regression: on xpro and mitx, both buttons remain enabled (ungated default unchanged)

Additional Context

Copilot AI review requested due to automatic review settings July 20, 2026 15:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds MITx Online-specific permission gating for instructor-dashboard enrollment actions.

Changes:

  • Replaces default enrollment buttons with permission-gated variants.
  • Registers the override in development and production configs.
  • Upgrades the instructor-dashboard dependency.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
EnrollmentActions.tsx Implements gated enrollment buttons.
instructor-dashboard/index.tsx Registers the replacement slot widget.
site.config.dev.tsx Enables the override in development.
site.config.build.tsx Enables the override in production.
package.json Updates the dashboard dependency.
package-lock.json Locks updated dependencies.
Files not reviewed (1)
  • deployments/mit-ol/mfe_slot_config/frontend/mitxonline/package-lock.json: Generated file

Comment on lines +51 to +54
'Add Beta Testers',
onAddBetaTesters,
'mitxonline-add-beta-testers-disabled',
'You do not have permission to add beta testers to this course.',
Comment on lines +59 to +62
'Enroll Learners',
onEnrollLearners,
'mitxonline-enroll-learners-disabled',
'You do not have permission to enroll learners in this course.',
},
"dependencies": {
"@openedx/frontend-app-instructor-dashboard": "^1.0.0-alpha",
"@openedx/frontend-app-instructor-dashboard": "^1.1.0-alpha",
// factory's ungated default.
// ---------------------------------------------------------------------------

export function createMitxOnlineInstructorDashboardApp(): App {
@Anas12091101 Anas12091101 added Needs Review An open Pull Request that is ready for review and removed Needs Review An open Pull Request that is ready for review labels Jul 20, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 7 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • deployments/mit-ol/mfe_slot_config/frontend/mitxonline/package-lock.json: Generated file

@Anas12091101 Anas12091101 added the Needs Review An open Pull Request that is ready for review label Jul 20, 2026
@Anas12091101
Anas12091101 requested a review from asadali145 July 21, 2026 06:43
@asadali145
asadali145 requested a review from Copilot July 22, 2026 09:43
@asadali145 asadali145 self-assigned this Jul 22, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • deployments/mit-ol/mfe_slot_config/frontend/mitxonline/package-lock.json: Generated file


return (
<OverlayTrigger placement="top" overlay={<Tooltip id={tooltipId}>{tooltip}</Tooltip>}>
<span className="d-inline-block" tabIndex={0}>{button}</span>

@asadali145 asadali145 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.

I have noticed that the instructor can unenroll learner using the enrollments table. Do we want to allow instructor to unenroll learners?

Enrollments tab displays the list of enrolled learners. We have 2 options:L

  • Disable enrollments tab completely for non-admin. This should be simpler.
  • R&D and modify the table to disable the unenroll button. Or maybe an event listener or do it via styles maybe?

CC: @pdpinch

@asadali145 asadali145 added waiting on author and removed Needs Review An open Pull Request that is ready for review labels Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants