feat: roles and permissions tab added#107
feat: roles and permissions tab added#107jesusbalderramawgu wants to merge 16 commits intoopenedx:masterfrom
Conversation
|
Thanks for the pull request, @jesusbalderramawgu! 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❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #107 +/- ##
==========================================
+ Coverage 95.18% 95.37% +0.19%
==========================================
Files 45 49 +4
Lines 913 994 +81
Branches 181 193 +12
==========================================
+ Hits 869 948 +79
- Misses 42 44 +2
Partials 2 2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| defaultMessage: 'Course Roles', | ||
| description: 'Libraries AuthZ title for the course roles alert', | ||
| }, | ||
| 'library.authz.tabs.permissionsRoles.courses.alert.description': { |
There was a problem hiding this comment.
this description is gonna change, waiting for the final text
| defaultMessage: 'This list shows the permissions currently available in Authoring Studio. Some roles may grant additional permissions manages outside this interface.', | ||
| description: 'Libraries AuthZ description for the course roles alert', | ||
| }, | ||
| 'library.authz.tabs.permissionsRoles.courses.alert.link': { |
There was a problem hiding this comment.
this link is gonna change, waiting for the final text
arbrandes
left a comment
There was a problem hiding this comment.
This is purely a code review: I did not test it.
| CONTENT_COURSE_PERMISSIONS.VIEW_COURSE_FILES, | ||
| CONTENT_COURSE_PERMISSIONS.VIEW_COURSE_FILES, |
| const [active, setActive] = useState('courses'); | ||
|
|
||
| const [libraryPermissionsByResource] = useMemo(() => { | ||
| if (!rolesLibraryObject && !libraryPermissions && !libraryResourceTypes) { return [null, null]; } |
There was a problem hiding this comment.
First: these are constants. Why are we guarding against their non-existence?
Second: If they're dynamic, the checks should be ||, not &&.
There was a problem hiding this comment.
I copied this function form another file and at first I thought it was going to be dynamic, I forgot to delete it.
it is fixed now!
| onClick={() => setActive('courses')} | ||
| variant={`${active === 'courses' ? 'primary' : 'outline-primary'}`} | ||
| > | ||
| Courses |
| onClick={() => setActive('libraries')} | ||
| variant={`${active === 'libraries' ? 'primary' : 'outline-primary'}`} | ||
| > | ||
| Libraries |
| <span><span className="font-weight-bold">Note:</span>{intl.formatMessage(messages['library.authz.tabs.permissionsRoles.courses.alert.description'])}</span> | ||
| </div> | ||
| <div className="col col-5"> | ||
| <Hyperlink className="d-block text-right h5 font-weight-normal" destination="." target="_blank" showLaunchIcon={false} isInline> |
There was a problem hiding this comment.
yes, well I'm still waiting for the final texts here, maybe we don't need a Hyperink either but I don't know yet
There was a problem hiding this comment.
|
|
||
| useEffect(() => { | ||
| const handleScroll = () => { | ||
| const scrollTop = window.pageYOffset || document.documentElement.scrollTop; |
There was a problem hiding this comment.
pageYOffset is deprecated. We should be using scrollY as the first option.
Regarding the fallback documentElement.scrollTop, there's no need for it. We don't support IE. (See the browsers we support here.
There was a problem hiding this comment.
thank you, this was fixed!
| <div className="row align-items-center"> | ||
| <div className="col col-7"> | ||
| <p className="text-primary font-weight-bold h4">{intl.formatMessage(messages['library.authz.tabs.permissionsRoles.courses.alert.title'])}</p> | ||
| <span><span className="font-weight-bold">Note:</span>{intl.formatMessage(messages['library.authz.tabs.permissionsRoles.courses.alert.description'])}</span> |
There was a problem hiding this comment.
"Note:" needs i18n
| @@ -0,0 +1,59 @@ | |||
| import { renderWrapper } from '@src/setupTest'; | |||
| import { fireEvent, waitFor } from '@testing-library/react'; | |||
There was a problem hiding this comment.
Do not use fireEvent, use userEvent instead
| <PermissionTable | ||
| permissionsTable={CoursePermissionsByResource} | ||
| roles={rolesObject} | ||
| title="Course Roles" |
Description
PR to replace old Roles and permissions Tab for a new one, completely merged. It closes the task