|
1 | 1 | import React from 'react'; |
2 | 2 | import {Link as RouterLink, useParams, useNavigate} from 'react-router-dom'; |
| 3 | +import {Theme} from '@mui/material/styles'; |
3 | 4 |
|
4 | 5 | import Box from '@mui/material/Box'; |
5 | 6 | import Chip from '@mui/material/Chip'; |
@@ -644,6 +645,106 @@ export default function ReadGroup() { |
644 | 645 | </Table> |
645 | 646 | </TableContainer> |
646 | 647 | </Grid> |
| 648 | + {group.type !== 'role_group' && (group.active_role_member_mappings?.length || group.active_role_owner_mappings?.length) ? ( |
| 649 | + <Grid item xs={12}> |
| 650 | + <TableContainer component={Paper}> |
| 651 | + <Table sx={{minWidth: 650}} size="small" aria-label="roles with access"> |
| 652 | + <TableHead> |
| 653 | + <TableRow> |
| 654 | + <TableCell colSpan={3}> |
| 655 | + <Stack direction="row" spacing={1} sx={{display: 'flex', alignItems: 'center'}}> |
| 656 | + <Typography variant="h6" color="text.accent"> |
| 657 | + Roles with Access |
| 658 | + </Typography> |
| 659 | + <Typography variant="body1" color="text.secondary"> |
| 660 | + Roles that grant access to this group |
| 661 | + </Typography> |
| 662 | + </Stack> |
| 663 | + </TableCell> |
| 664 | + <TableCell> |
| 665 | + <Box |
| 666 | + sx={{ |
| 667 | + display: 'flex', |
| 668 | + justifyContent: 'flex-end', |
| 669 | + }}> |
| 670 | + <Divider sx={{mx: 2}} orientation="vertical" flexItem /> |
| 671 | + Total: {(group.active_role_member_mappings?.length || 0) + (group.active_role_owner_mappings?.length || 0)} |
| 672 | + </Box> |
| 673 | + </TableCell> |
| 674 | + </TableRow> |
| 675 | + <TableRow> |
| 676 | + <TableCell>Role Name</TableCell> |
| 677 | + <TableCell>Access Type</TableCell> |
| 678 | + <TableCell>Ending</TableCell> |
| 679 | + <TableCell></TableCell> |
| 680 | + </TableRow> |
| 681 | + </TableHead> |
| 682 | + <TableBody> |
| 683 | + {(group.active_role_owner_mappings ?? []).map((roleMapping: RoleGroupMap) => ( |
| 684 | + <TableRow key={'role-owner-' + roleMapping.active_role_group?.id}> |
| 685 | + <TableCell> |
| 686 | + <Link |
| 687 | + to={`/groups/${roleMapping.active_role_group?.name}`} |
| 688 | + sx={{ |
| 689 | + textDecoration: 'none', |
| 690 | + color: 'inherit', |
| 691 | + '&:hover': { |
| 692 | + color: (theme: Theme) => theme.palette.primary.main, |
| 693 | + }, |
| 694 | + }} |
| 695 | + component={RouterLink}> |
| 696 | + {roleMapping.active_role_group?.name} |
| 697 | + </Link> |
| 698 | + </TableCell> |
| 699 | + <TableCell> |
| 700 | + <Chip |
| 701 | + label="Owner" |
| 702 | + color="primary" |
| 703 | + variant="filled" |
| 704 | + size="small" |
| 705 | + /> |
| 706 | + </TableCell> |
| 707 | + <TableCell> |
| 708 | + <Ending memberships={[roleMapping]} /> |
| 709 | + </TableCell> |
| 710 | + <TableCell></TableCell> |
| 711 | + </TableRow> |
| 712 | + ))} |
| 713 | + {(group.active_role_member_mappings ?? []).map((roleMapping: RoleGroupMap) => ( |
| 714 | + <TableRow key={'role-member-' + roleMapping.active_role_group?.id}> |
| 715 | + <TableCell> |
| 716 | + <Link |
| 717 | + to={`/groups/${roleMapping.active_role_group?.name}`} |
| 718 | + sx={{ |
| 719 | + textDecoration: 'none', |
| 720 | + color: 'inherit', |
| 721 | + '&:hover': { |
| 722 | + color: (theme: Theme) => theme.palette.primary.main, |
| 723 | + }, |
| 724 | + }} |
| 725 | + component={RouterLink}> |
| 726 | + {roleMapping.active_role_group?.name} |
| 727 | + </Link> |
| 728 | + </TableCell> |
| 729 | + <TableCell> |
| 730 | + <Chip |
| 731 | + label="Member" |
| 732 | + color="secondary" |
| 733 | + variant="outlined" |
| 734 | + size="small" |
| 735 | + /> |
| 736 | + </TableCell> |
| 737 | + <TableCell> |
| 738 | + <Ending memberships={[roleMapping]} /> |
| 739 | + </TableCell> |
| 740 | + <TableCell></TableCell> |
| 741 | + </TableRow> |
| 742 | + ))} |
| 743 | + </TableBody> |
| 744 | + </Table> |
| 745 | + </TableContainer> |
| 746 | + </Grid> |
| 747 | + ) : null} |
647 | 748 | <Grid item xs={12}> |
648 | 749 | <TableContainer component={Paper}> |
649 | 750 | <Table sx={{minWidth: 650}} size="small" aria-label="group members"> |
|
0 commit comments