-
Notifications
You must be signed in to change notification settings - Fork 270
feat: Add slots to add tab links and add mechanism for plugin routes #1645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Thanks for the pull request, @xitij2000! 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. 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:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1645 +/- ##
=========================================
Coverage ? 90.50%
=========================================
Files ? 347
Lines ? 5837
Branches ? 1363
=========================================
Hits ? 5283
Misses ? 537
Partials ? 17 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
83693c3
to
b9df318
Compare
7245d96
to
e040882
Compare
d6afeb0
to
7affcf0
Compare
7affcf0
to
fd9df35
Compare
@bradenmacdonald Would love to get your thoughts on the approach used in this PR. It's doing a few non-standard things. We wanted to add a new course tab, for which we need two things.
To add a new page that feels like part of the platform we need some way to extend the routes to allow creating a new page. I tried making the routes pluggable, but the router refuses to work with components that aren't a Route. Which led to the approach used here, which is to add a config value for defining new routes, each route gets its own slot so you can create a new page there. |
@xitij2000 I don't think plugins can add This is because:
See https://github.com/openedx/frontend-app-authoring/blob/aeefcc639f430c4769b0903cad0da7977cb40cf3/src/pages-and-resources/PagesAndResources.jsx#L88-L93 for an example of this. It's not wrapped in a plugin slot, but it would work just the same way if it were. Also, I think we want to move away from a very config-heavy plugin approach toward something where plugins "register themselves" and require minimal config other than installation, so I think this sort of approach (adding |
Description
This PR adds mechanisms to add course tabs using a frontend plugin.
It includes two plugin slots:
It also adds a new mechanism to add course routes using the
PLUGIN_ROUTES
config. This is a simple array that adds new routes for the MFE that can then be handled by plugins.The combination of the above will allow injecting a new course tab by:
PLUGIN_ROUTES
array.It is also possible to add the links anywhere else, to simply add new pages that are not tabs.