feat: [FC-0099] redirect to admin console MFE#2570
feat: [FC-0099] redirect to admin console MFE#2570brian-smith-tcril merged 2 commits intoopenedx:masterfrom
Conversation
|
Thanks for the pull request, @dcoa! 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. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2570 +/- ##
========================================
Coverage 94.77% 94.78%
========================================
Files 1225 1225
Lines 27393 27399 +6
Branches 5989 6152 +163
========================================
+ Hits 25963 25969 +6
Misses 1372 1372
Partials 58 58 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This PR redirects to admin console MFE if the URL is configured, to leverage the new experience of team management this is part of the AuthZ project https://github.com/openedx/openedx-authz/tree/main/docs/decisions
84282c9 to
32b8c19
Compare
| {!adminConsoleUrl && !readOnly && ( | ||
| <Button variant="outline-primary" onClick={openLibraryTeamModal}> | ||
| {intl.formatMessage(messages.libraryTeamButtonTitle)} | ||
| </Button> | ||
| )} | ||
| {adminConsoleUrl && ( | ||
| <Button as={Hyperlink} variant="outline-primary" destination={`${adminConsoleUrl}/authz/libraries/${libraryId}`} target="_blank"> | ||
| {intl.formatMessage(messages.libraryTeamButtonTitle)} | ||
| </Button> | ||
| )} |
There was a problem hiding this comment.
I'm curious about the logic here
Before changes in this PR
readOnly |
Behavior |
|---|---|
| truthy | don't render a button |
| falsy | render button to open team modal |
With change in this PR
adminConsoleUrl |
readOnly |
Behavior |
|---|---|---|
| truthy | truthy | render button as link to authz |
| truthy | falsy | render button as link to authz |
| falsy | truthy | don't render a button |
| falsy | falsy | render button to open team modal |
Is this the intended behavior?
There was a problem hiding this comment.
yes, admin console is visible for any user withhin the library team, that includes the Library User, those ones with read-only access, for better understanding this is the mapping of roles and permissions.
There was a problem hiding this comment.
Glad to hear it's intended!
I'm trying to think of a way to make the intention of this logic clearer when reading the code. The best idea I've come up with so far is to add something like
// always show link to admin console MFE if it is being used
const shouldShowAdminConsoleLink = !!adminConsoleUrl;
// if the admin console MFE isn't being used, show team modal button for non–read-only users
const shouldShowTeamModalButton = !adminConsoleUrl && !readOnly;then use shouldShowAdminConsoleLink && and shouldShowTeamModalButton && instead.
I'm very open to other ideas, and I'm also happy to land this PR as-is since the logic is already accomplishing what it is intending to accomplish.
There was a problem hiding this comment.
I think this definitely makes the code easier to read, I made the change
| {!adminConsoleUrl && !readOnly && ( | ||
| <Button variant="outline-primary" onClick={openLibraryTeamModal}> | ||
| {intl.formatMessage(messages.libraryTeamButtonTitle)} | ||
| </Button> | ||
| )} | ||
| {adminConsoleUrl && ( | ||
| <Button as={Hyperlink} variant="outline-primary" destination={`${adminConsoleUrl}/authz/libraries/${libraryId}`} target="_blank"> | ||
| {intl.formatMessage(messages.libraryTeamButtonTitle)} | ||
| </Button> | ||
| )} |
There was a problem hiding this comment.
Glad to hear it's intended!
I'm trying to think of a way to make the intention of this logic clearer when reading the code. The best idea I've come up with so far is to add something like
// always show link to admin console MFE if it is being used
const shouldShowAdminConsoleLink = !!adminConsoleUrl;
// if the admin console MFE isn't being used, show team modal button for non–read-only users
const shouldShowTeamModalButton = !adminConsoleUrl && !readOnly;then use shouldShowAdminConsoleLink && and shouldShowTeamModalButton && instead.
I'm very open to other ideas, and I'm also happy to land this PR as-is since the logic is already accomplishing what it is intending to accomplish.
Updates navbar in library authoring page to include `Team Access` and `Import` menu options. Clicking on `Team Access` button opens Team management modal. As per this new PR: #2570, if admin console url is set, it should be used instead of team access modal. So updated this PR accordingly.
Description
This PR redirects to admin console MFE if the URL is configured, to use the new experience of team management. This is part of the AuthZ Project.
The main idea of the Admin Console is having a centralized place to manage configuration including roles and perimssions. For Ulmo, we aim to have a MVP that works with libraries. For additional information about this project visit MVP - Administrative Console: AuthZ
Introduced changes
This changes only affect users with library access.
ADMIN_CONSOLE_URLto configure the Admin Console MFE.Screencast.from.2025-10-26.13-05-29.webm
Other information
Testing instructions
NOTE There is a PR created in tutor-mfe to introduce the new MFE as core feat: [FC-0099] include admin console as core MFE overhangio/tutor-mfe#276
Best Practices Checklist
We're trying to move away from some deprecated patterns in this codebase. Please
check if your PR meets these recommendations before asking for a review:
.ts,.tsx).propTypes,defaultProps, andinjectIntlpatterns are not used in any new or modified code.src/testUtils.tsx(specificallyinitializeMocks)apiHooks.tsin this repo for examples.messages.tsfiles have adescriptionfor translators to use.../. To import from parent folders, use@src, e.g.import { initializeMocks } from '@src/testUtils';instead offrom '../../../../testUtils'