Skip to content

Commit ad9ab9b

Browse files
feat: disable columns and tooltip added
1 parent eadc69d commit ad9ab9b

4 files changed

Lines changed: 34 additions & 5 deletions

File tree

src/authz-module/components/PermissionTable.tsx

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useIntl } from '@edx/frontend-platform/i18n';
22
import { Check, Close } from '@openedx/paragon/icons';
3-
import { Card, Icon } from '@openedx/paragon';
3+
import { Card, Icon, OverlayTrigger, Tooltip } from '@openedx/paragon';
44
import { PermissionsResourceGrouped, Role } from '@src/types';
55
import { actionsDictionary } from './RoleCard/constants';
66
import ResourceTooltip from './ResourceTooltip';
@@ -23,7 +23,28 @@ const PermissionTable = ({ permissionsTable, roles, title }: PermissionTableProp
2323
{title}
2424
</th>
2525
{roles.map(role => (
26-
<th key={role.name} className="text-center py-3 sticky-top bg-white">{role.name}</th>
26+
<th
27+
key={role.name}
28+
className={`text-center py-3 sticky-top bg-white ${role.disable && 'text-muted opacity-50'}`}
29+
>
30+
{role.disable ? (
31+
<OverlayTrigger
32+
placement="top"
33+
overlay={(
34+
<Tooltip
35+
id={`tooltip-${role.name}`}
36+
variant="light"
37+
>
38+
{formatMessage(messages['authz.role.card.permission.for.role.status.disabled'])}
39+
</Tooltip>
40+
)}
41+
>
42+
<span style={{ cursor: 'help' }}>{role.name}</span>
43+
</OverlayTrigger>
44+
) : (
45+
role.name
46+
)}
47+
</th>
2748
))}
2849
</tr>
2950
</thead>
@@ -46,12 +67,12 @@ const PermissionTable = ({ permissionsTable, roles, title }: PermissionTableProp
4667
{permission.label}
4768
</td>
4869
{roles.map(role => (
49-
<td key={role.name} className="text-center">
70+
<td key={role.name} className={`text-center ${role.disable && 'opacity-50'}`}>
5071
{
5172
permission.roles[role.name]
5273
? (
5374
<Icon
54-
className="d-inline-block"
75+
className={`d-inline-block ${role.disable && 'text-muted'}`}
5576
src={Check}
5677
aria-label={formatMessage(messages['authz.role.card.permission.for.role.status.granted'], {
5778
roleName: role.name,
@@ -63,7 +84,7 @@ const PermissionTable = ({ permissionsTable, roles, title }: PermissionTableProp
6384
)
6485
: (
6586
<Icon
66-
className="text-danger d-inline-block"
87+
className={`d-inline-block ${role.disable ? 'text-muted' : 'text-danger'}`}
6788
src={Close}
6889
aria-label={formatMessage(messages['authz.role.card.permission.for.role.status.not.granted'], {
6990
roleName: role.name,

src/authz-module/components/messages.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ const messages = defineMessages({
1111
defaultMessage: 'Permission not granted in {roleName} role',
1212
description: 'Label for not granted status of a permission in the permissions table',
1313
},
14+
'authz.role.card.permission.for.role.status.disabled': {
15+
id: 'authz.role.card.permission.for.role.status.disabled',
16+
defaultMessage: 'We are expanding our permissions system. This role is currently unavailable but will be part of an upcoming update.',
17+
description: 'Tooltip message for disabled roles in the permissions table',
18+
},
1419
'authz.anchor.button.alt': {
1520
id: 'authz.anchor.button.alt',
1621
defaultMessage: 'Scroll to top',

src/authz-module/courses/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,7 @@ export const rolesObject = [
400400
userCount: 1,
401401
name: 'Course Editor',
402402
description: 'building and maintaining course content and supporting assets, without operational controls or high impact actions that can affect a live course.',
403+
disable: true,
403404
},
404405
{
405406
role: 'course_auditor',
@@ -417,6 +418,7 @@ export const rolesObject = [
417418
userCount: 1,
418419
name: 'Course Auditor',
419420
description: ' QA, compliance review, content review, and general oversight, no changes in Studio.',
421+
disable: true,
420422
},
421423

422424
];

src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export interface RoleMetadata {
3232
export interface Role extends RoleMetadata {
3333
userCount: number;
3434
permissions: string[];
35+
disable?: boolean;
3536
}
3637

3738
export type ResourceMetadata = {

0 commit comments

Comments
 (0)