-
Notifications
You must be signed in to change notification settings - Fork 7
feat(authz): [FC-0099] permissions tab #12
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
Changes from 7 commits
00c1b25
4312440
351e172
a144f44
f4c0e33
48efee0
14a631b
c7cd081
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,52 @@ | ||||||
| import { Check, Close } from '@openedx/paragon/icons'; | ||||||
| import { Icon } from '@openedx/paragon'; | ||||||
| import { PermissionsResourceGrouped, Role } from '@src/types'; | ||||||
| import { actionsDictionary } from './RoleCard/constants'; | ||||||
| import ResourceTooltip from './ResourceTooltip'; | ||||||
|
|
||||||
| type PermissionTableProps = { | ||||||
| roles: Role[]; | ||||||
| permissionsTable: PermissionsResourceGrouped[]; | ||||||
| }; | ||||||
|
|
||||||
| const PermissionTable = ({ permissionsTable, roles }: PermissionTableProps) => ( | ||||||
| <table className="pgn__data-table bg-light-100"> | ||||||
|
brian-smith-tcril marked this conversation as resolved.
Outdated
|
||||||
| <thead> | ||||||
| <tr> | ||||||
| <th className="bg-light-100" aria-hidden="true" /> | ||||||
| {roles.map(role => ( | ||||||
| <th key={role.name} className="text-center bg-light-100 py-3">{role.name}</th> | ||||||
| ))} | ||||||
| </tr> | ||||||
| </thead> | ||||||
| <tbody> | ||||||
| {permissionsTable.map(resourceGroup => ( | ||||||
| <> | ||||||
| <tr className="bg-info-100 text-primary"> | ||||||
| <td colSpan={roles.length + 1} className="text-start py-3 px-4"> | ||||||
| <strong>{resourceGroup.label}</strong> | ||||||
| <ResourceTooltip resourceGroup={resourceGroup} /> | ||||||
| </td> | ||||||
| </tr> | ||||||
| { | ||||||
| resourceGroup.permissions.map(permission => ( | ||||||
| <tr key={permission.key} className="border-top"> | ||||||
| <td className="text-start d-flex align-items-center small px-4 py-3"> | ||||||
| <Icon className="d-inline-block mr-2" size="sm" src={actionsDictionary[permission.actionKey]} /> | ||||||
| {permission.label} | ||||||
| </td> | ||||||
| {roles.map(role => ( | ||||||
| <td key={role.name} className="text-center"> | ||||||
| {permission.roles[role.name] ? <Icon className="d-inline-block" src={Check} /> : <Icon className="text-danger d-inline-block" src={Close} />} | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just curious as to what color we want the checkmarks to be Current
"Success"
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The original design has no specific color https://www.figma.com/design/q3Knq0BKoVTBbtaxb81n9R/RBAC---Console---Wireframes?node-id=2750-9661&t=hu3T5aVg659Dg0J2-4 Do you consider the green is a better indicative? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm perfectly happy with it either way. I just saw " |
||||||
| </td> | ||||||
| ))} | ||||||
| </tr> | ||||||
| )) | ||||||
| } | ||||||
| </> | ||||||
| ))} | ||||||
| </tbody> | ||||||
| </table> | ||||||
| ); | ||||||
|
|
||||||
| export default PermissionTable; | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import { Icon, OverlayTrigger, Popover } from '@openedx/paragon'; | ||
| import { Info } from '@openedx/paragon/icons'; | ||
| import { PermissionsResourceGrouped, RoleResourceGroup } from '@src/types'; | ||
|
|
||
| type ResourceTooltipProps = { | ||
| resourceGroup: PermissionsResourceGrouped | RoleResourceGroup; | ||
| }; | ||
|
|
||
| const ResourceTooltip = ({ resourceGroup }:ResourceTooltipProps) => ( | ||
| <OverlayTrigger | ||
| key={`overlay-${resourceGroup.key}`} | ||
| placement="auto" | ||
| overlay={( | ||
| <Popover variant="light" id={`tooltip-${resourceGroup.label}`}> | ||
|
brian-smith-tcril marked this conversation as resolved.
Outdated
|
||
| <Popover.Content className="p-3"> | ||
| <h4 className="text-primary">{resourceGroup.label}</h4> | ||
| <p className="small">{resourceGroup.description}</p> | ||
| <ul className="small"> | ||
| {resourceGroup.permissions.map(permission => ( | ||
| <li><b>{permission.label.trim()}:</b> {permission.description}</li> | ||
| ))} | ||
| </ul> | ||
| </Popover.Content> | ||
| </Popover> | ||
| )} | ||
| > | ||
| <Icon className="d-inline-block text-gray ml-2 my-auto" size="inline" src={Info} /> | ||
| </OverlayTrigger> | ||
| ); | ||
|
|
||
| export default ResourceTooltip; | ||


Uh oh!
There was an error while loading. Please reload this page.