@backstage-community/plugin-rbac 1.32.4 → 1.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/components/ConditionalAccess/AddNestedConditionButton.esm.js +7 -6
  3. package/dist/components/ConditionalAccess/AddNestedConditionButton.esm.js.map +1 -1
  4. package/dist/components/ConditionalAccess/ComplexConditionRow.esm.js +7 -3
  5. package/dist/components/ConditionalAccess/ComplexConditionRow.esm.js.map +1 -1
  6. package/dist/components/ConditionalAccess/ComplexConditionRowButtons.esm.js +44 -19
  7. package/dist/components/ConditionalAccess/ComplexConditionRowButtons.esm.js.map +1 -1
  8. package/dist/components/ConditionalAccess/ConditionalAccessSidebar.esm.js +65 -63
  9. package/dist/components/ConditionalAccess/ConditionalAccessSidebar.esm.js.map +1 -1
  10. package/dist/components/ConditionalAccess/ConditionsForm.esm.js +94 -85
  11. package/dist/components/ConditionalAccess/ConditionsForm.esm.js.map +1 -1
  12. package/dist/components/ConditionalAccess/ConditionsFormRow.esm.js +155 -101
  13. package/dist/components/ConditionalAccess/ConditionsFormRow.esm.js.map +1 -1
  14. package/dist/components/ConditionalAccess/ConditionsFormRowFields.esm.js +98 -9
  15. package/dist/components/ConditionalAccess/ConditionsFormRowFields.esm.js.map +1 -1
  16. package/dist/components/ConditionalAccess/CriteriaToggleButton.esm.js.map +1 -1
  17. package/dist/components/ConditionalAccess/CustomArrayField.esm.js +7 -10
  18. package/dist/components/ConditionalAccess/CustomArrayField.esm.js.map +1 -1
  19. package/dist/components/ConditionalAccess/RulesDropdownOption.esm.js +30 -14
  20. package/dist/components/ConditionalAccess/RulesDropdownOption.esm.js.map +1 -1
  21. package/dist/components/CreateRole/AddMembersForm.esm.js +7 -5
  22. package/dist/components/CreateRole/AddMembersForm.esm.js.map +1 -1
  23. package/dist/components/CreateRole/AddedMembersTable.esm.js +2 -10
  24. package/dist/components/CreateRole/AddedMembersTable.esm.js.map +1 -1
  25. package/dist/components/CreateRole/AddedMembersTableColumn.esm.js +2 -1
  26. package/dist/components/CreateRole/AddedMembersTableColumn.esm.js.map +1 -1
  27. package/dist/components/CreateRole/MembersDropdownOption.esm.js +26 -21
  28. package/dist/components/CreateRole/MembersDropdownOption.esm.js.map +1 -1
  29. package/dist/components/CreateRole/PermissionPoliciesForm.esm.js +59 -49
  30. package/dist/components/CreateRole/PermissionPoliciesForm.esm.js.map +1 -1
  31. package/dist/components/CreateRole/PermissionPoliciesFormRow.esm.js +12 -17
  32. package/dist/components/CreateRole/PermissionPoliciesFormRow.esm.js.map +1 -1
  33. package/dist/components/CreateRole/PoliciesCheckboxGroup.esm.js +5 -5
  34. package/dist/components/CreateRole/PoliciesCheckboxGroup.esm.js.map +1 -1
  35. package/dist/components/CreateRole/RoleDetailsForm.esm.js +1 -1
  36. package/dist/components/CreateRole/RoleDetailsForm.esm.js.map +1 -1
  37. package/dist/components/CreateRole/RoleForm.esm.js +8 -2
  38. package/dist/components/CreateRole/RoleForm.esm.js.map +1 -1
  39. package/dist/components/DownloadUserStatistics.esm.js +7 -10
  40. package/dist/components/DownloadUserStatistics.esm.js.map +1 -1
  41. package/dist/components/EditRole.esm.js +4 -2
  42. package/dist/components/EditRole.esm.js.map +1 -1
  43. package/dist/components/RoleOverview/AboutCard.esm.js +55 -49
  44. package/dist/components/RoleOverview/AboutCard.esm.js.map +1 -1
  45. package/dist/components/RoleOverview/MembersCard.esm.js +12 -11
  46. package/dist/components/RoleOverview/MembersCard.esm.js.map +1 -1
  47. package/dist/components/RoleOverview/PermissionsCard.esm.js +12 -11
  48. package/dist/components/RoleOverview/PermissionsCard.esm.js.map +1 -1
  49. package/dist/components/RoleOverview/RoleOverviewPage.esm.js +1 -1
  50. package/dist/components/RoleOverview/RoleOverviewPage.esm.js.map +1 -1
  51. package/dist/components/RolesList/DeleteRole.esm.js +2 -1
  52. package/dist/components/RolesList/DeleteRole.esm.js.map +1 -1
  53. package/dist/components/RolesList/DeleteRoleDialog.esm.js +45 -38
  54. package/dist/components/RolesList/DeleteRoleDialog.esm.js.map +1 -1
  55. package/dist/components/RolesList/RolesList.esm.js +9 -10
  56. package/dist/components/RolesList/RolesList.esm.js.map +1 -1
  57. package/dist/components/RolesList/RolesListColumns.esm.js +2 -1
  58. package/dist/components/RolesList/RolesListColumns.esm.js.map +1 -1
  59. package/dist/components/RolesList/RolesListToolbar.esm.js +35 -32
  60. package/dist/components/RolesList/RolesListToolbar.esm.js.map +1 -1
  61. package/dist/components/SnackbarAlert.esm.js +2 -2
  62. package/dist/components/SnackbarAlert.esm.js.map +1 -1
  63. package/dist/utils/conditional-access-utils.esm.js +1 -122
  64. package/dist/utils/conditional-access-utils.esm.js.map +1 -1
  65. package/package.json +4 -6
@@ -1 +1 @@
1
- {"version":3,"file":"RoleOverviewPage.esm.js","sources":["../../../src/components/RoleOverview/RoleOverviewPage.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\nimport { useParams } from 'react-router-dom';\n\nimport { Header, Page, TabbedLayout } from '@backstage/core-components';\n\nimport { Grid } from '@material-ui/core';\n\nimport { useLocationToast } from '../../hooks/useLocationToast';\nimport { useMembers } from '../../hooks/useMembers';\nimport { SnackbarAlert } from '../SnackbarAlert';\nimport { useToast } from '../ToastContext';\nimport { AboutCard } from './AboutCard';\nimport { MembersCard } from './MembersCard';\nimport { PermissionsCard } from './PermissionsCard';\n\nexport const RoleOverviewPage = () => {\n const { roleName, roleNamespace, roleKind } = useParams();\n const { toastMessage, setToastMessage } = useToast();\n const membersInfo = useMembers(`${roleKind}:${roleNamespace}/${roleName}`);\n\n useLocationToast(setToastMessage);\n\n const onAlertClose = () => {\n setToastMessage('');\n };\n\n return (\n <>\n <SnackbarAlert toastMessage={toastMessage} onAlertClose={onAlertClose} />\n <Page themeId=\"tool\">\n <Header\n title={`${roleKind}:${roleNamespace}/${roleName}`}\n type=\"RBAC\"\n typeLink=\"..\"\n />\n <TabbedLayout>\n <TabbedLayout.Route path=\"\" title=\"Overview\">\n <Grid container direction=\"row\">\n <Grid item lg={12} xs={12}>\n <AboutCard\n roleName={`${roleKind}:${roleNamespace}/${roleName}`}\n />\n </Grid>\n <Grid item lg={6} xs={12}>\n <MembersCard\n roleName={`${roleKind}:${roleNamespace}/${roleName}`}\n membersInfo={membersInfo}\n />\n </Grid>\n <Grid item lg={6} xs={12}>\n <PermissionsCard\n entityReference={`${roleKind}:${roleNamespace}/${roleName}`}\n canReadUsersAndGroups={membersInfo.canReadUsersAndGroups}\n />\n </Grid>\n </Grid>\n </TabbedLayout.Route>\n </TabbedLayout>\n </Page>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AA8BO,MAAM,mBAAmB,MAAM;AACpC,EAAA,MAAM,EAAE,QAAA,EAAU,aAAe,EAAA,QAAA,KAAa,SAAU,EAAA;AACxD,EAAA,MAAM,EAAE,YAAA,EAAc,eAAgB,EAAA,GAAI,QAAS,EAAA;AACnD,EAAM,MAAA,WAAA,GAAc,WAAW,CAAG,EAAA,QAAQ,IAAI,aAAa,CAAA,CAAA,EAAI,QAAQ,CAAE,CAAA,CAAA;AAEzE,EAAA,gBAAA,CAAiB,eAAe,CAAA;AAEhC,EAAA,MAAM,eAAe,MAAM;AACzB,IAAA,eAAA,CAAgB,EAAE,CAAA;AAAA,GACpB;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,sCACG,aAAc,EAAA,EAAA,YAAA,EAA4B,cAA4B,CACvE,kBAA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AAAA,IAAA;AAAA,MACC,iBAAiB,CAAG,EAAA,QAAQ,CAAI,CAAA,EAAA,aAAa,IAAI,QAAQ,CAAA,CAAA;AAAA,MACzD,uBAAuB,WAAY,CAAA;AAAA;AAAA,GAEvC,CACF,CACF,CACF,CACF,CACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"RoleOverviewPage.esm.js","sources":["../../../src/components/RoleOverview/RoleOverviewPage.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\nimport { useParams } from 'react-router-dom';\n\nimport { Header, Page, TabbedLayout } from '@backstage/core-components';\n\nimport Grid from '@mui/material/Grid';\n\nimport { useLocationToast } from '../../hooks/useLocationToast';\nimport { useMembers } from '../../hooks/useMembers';\nimport { SnackbarAlert } from '../SnackbarAlert';\nimport { useToast } from '../ToastContext';\nimport { AboutCard } from './AboutCard';\nimport { MembersCard } from './MembersCard';\nimport { PermissionsCard } from './PermissionsCard';\n\nexport const RoleOverviewPage = () => {\n const { roleName, roleNamespace, roleKind } = useParams();\n const { toastMessage, setToastMessage } = useToast();\n const membersInfo = useMembers(`${roleKind}:${roleNamespace}/${roleName}`);\n\n useLocationToast(setToastMessage);\n\n const onAlertClose = () => {\n setToastMessage('');\n };\n\n return (\n <>\n <SnackbarAlert toastMessage={toastMessage} onAlertClose={onAlertClose} />\n <Page themeId=\"tool\">\n <Header\n title={`${roleKind}:${roleNamespace}/${roleName}`}\n type=\"RBAC\"\n typeLink=\"..\"\n />\n <TabbedLayout>\n <TabbedLayout.Route path=\"\" title=\"Overview\">\n <Grid container direction=\"row\">\n <Grid item lg={12} xs={12}>\n <AboutCard\n roleName={`${roleKind}:${roleNamespace}/${roleName}`}\n />\n </Grid>\n <Grid item lg={6} xs={12}>\n <MembersCard\n roleName={`${roleKind}:${roleNamespace}/${roleName}`}\n membersInfo={membersInfo}\n />\n </Grid>\n <Grid item lg={6} xs={12}>\n <PermissionsCard\n entityReference={`${roleKind}:${roleNamespace}/${roleName}`}\n canReadUsersAndGroups={membersInfo.canReadUsersAndGroups}\n />\n </Grid>\n </Grid>\n </TabbedLayout.Route>\n </TabbedLayout>\n </Page>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AA8BO,MAAM,mBAAmB,MAAM;AACpC,EAAA,MAAM,EAAE,QAAA,EAAU,aAAe,EAAA,QAAA,KAAa,SAAU,EAAA;AACxD,EAAA,MAAM,EAAE,YAAA,EAAc,eAAgB,EAAA,GAAI,QAAS,EAAA;AACnD,EAAM,MAAA,WAAA,GAAc,WAAW,CAAG,EAAA,QAAQ,IAAI,aAAa,CAAA,CAAA,EAAI,QAAQ,CAAE,CAAA,CAAA;AAEzE,EAAA,gBAAA,CAAiB,eAAe,CAAA;AAEhC,EAAA,MAAM,eAAe,MAAM;AACzB,IAAA,eAAA,CAAgB,EAAE,CAAA;AAAA,GACpB;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,sCACG,aAAc,EAAA,EAAA,YAAA,EAA4B,cAA4B,CACvE,kBAAA,KAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,OAAA,EAAQ,MACZ,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,OAAO,CAAG,EAAA,QAAQ,CAAI,CAAA,EAAA,aAAa,IAAI,QAAQ,CAAA,CAAA;AAAA,MAC/C,IAAK,EAAA,MAAA;AAAA,MACL,QAAS,EAAA;AAAA;AAAA,GACX,kBACC,KAAA,CAAA,aAAA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
  import Delete from '@mui/icons-material/Delete';
4
+ import IconButton from '@mui/material/IconButton';
5
+ import Tooltip from '@mui/material/Tooltip';
5
6
  import Typography from '@mui/material/Typography';
6
7
 
7
8
  const DeleteRole = ({
@@ -1 +1 @@
1
- {"version":3,"file":"DeleteRole.esm.js","sources":["../../../src/components/RolesList/DeleteRole.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\n\nimport { useDeleteDialog } from '@janus-idp/shared-react';\nimport { IconButton, Tooltip } from '@material-ui/core';\nimport Delete from '@mui/icons-material/Delete';\nimport Typography from '@mui/material/Typography';\n\ntype DeleteRoleProps = {\n roleName: string;\n disable: boolean;\n tooltip?: string;\n dataTestId: string;\n};\n\nconst DeleteRole = ({\n roleName,\n tooltip,\n disable,\n dataTestId,\n}: DeleteRoleProps) => {\n const { setDeleteComponent, setOpenDialog } = useDeleteDialog();\n\n const openDialog = (name: string) => {\n setDeleteComponent({ roleName: name });\n setOpenDialog(true);\n };\n\n return (\n <Tooltip title={tooltip || ''}>\n <Typography component=\"span\" data-testid={dataTestId}>\n <IconButton\n color=\"inherit\"\n onClick={() => openDialog(roleName)}\n aria-label=\"Delete\"\n disabled={disable}\n title={tooltip || 'Delete Role'}\n >\n <Delete />\n </IconButton>\n </Typography>\n </Tooltip>\n );\n};\nexport default DeleteRole;\n"],"names":[],"mappings":";;;;;;AA6BA,MAAM,aAAa,CAAC;AAAA,EAClB,QAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA;AAAA,EACA;AACF,CAAuB,KAAA;AACrB,EAAA,MAAM,EAAE,kBAAA,EAAoB,aAAc,EAAA,GAAI,eAAgB,EAAA;AAE9D,EAAM,MAAA,UAAA,GAAa,CAAC,IAAiB,KAAA;AACnC,IAAmB,kBAAA,CAAA,EAAE,QAAU,EAAA,IAAA,EAAM,CAAA;AACrC,IAAA,aAAA,CAAc,IAAI,CAAA;AAAA,GACpB;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,OAAQ,EAAA,EAAA,KAAA,EAAO,OAAW,IAAA,EAAA,EAAA,sCACxB,UAAW,EAAA,EAAA,SAAA,EAAU,MAAO,EAAA,aAAA,EAAa,UACxC,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,KAAM,EAAA,SAAA;AAAA,MACN,OAAA,EAAS,MAAM,UAAA,CAAW,QAAQ,CAAA;AAAA,MAClC,YAAW,EAAA,QAAA;AAAA,MACX,QAAU,EAAA,OAAA;AAAA,MACV,OAAO,OAAW,IAAA;AAAA,KAAA;AAAA,wCAEjB,MAAO,EAAA,IAAA;AAAA,GAEZ,CACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"DeleteRole.esm.js","sources":["../../../src/components/RolesList/DeleteRole.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\n\nimport { useDeleteDialog } from '@janus-idp/shared-react';\nimport Delete from '@mui/icons-material/Delete';\nimport IconButton from '@mui/material/IconButton';\nimport Tooltip from '@mui/material/Tooltip';\nimport Typography from '@mui/material/Typography';\n\ntype DeleteRoleProps = {\n roleName: string;\n disable: boolean;\n tooltip?: string;\n dataTestId: string;\n};\n\nconst DeleteRole = ({\n roleName,\n tooltip,\n disable,\n dataTestId,\n}: DeleteRoleProps) => {\n const { setDeleteComponent, setOpenDialog } = useDeleteDialog();\n\n const openDialog = (name: string) => {\n setDeleteComponent({ roleName: name });\n setOpenDialog(true);\n };\n\n return (\n <Tooltip title={tooltip || ''}>\n <Typography component=\"span\" data-testid={dataTestId}>\n <IconButton\n color=\"inherit\"\n onClick={() => openDialog(roleName)}\n aria-label=\"Delete\"\n disabled={disable}\n title={tooltip || 'Delete Role'}\n >\n <Delete />\n </IconButton>\n </Typography>\n </Tooltip>\n );\n};\nexport default DeleteRole;\n"],"names":[],"mappings":";;;;;;;AA8BA,MAAM,aAAa,CAAC;AAAA,EAClB,QAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA;AAAA,EACA;AACF,CAAuB,KAAA;AACrB,EAAA,MAAM,EAAE,kBAAA,EAAoB,aAAc,EAAA,GAAI,eAAgB,EAAA;AAE9D,EAAM,MAAA,UAAA,GAAa,CAAC,IAAiB,KAAA;AACnC,IAAmB,kBAAA,CAAA,EAAE,QAAU,EAAA,IAAA,EAAM,CAAA;AACrC,IAAA,aAAA,CAAc,IAAI,CAAA;AAAA,GACpB;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,OAAQ,EAAA,EAAA,KAAA,EAAO,OAAW,IAAA,EAAA,EAAA,sCACxB,UAAW,EAAA,EAAA,SAAA,EAAU,MAAO,EAAA,aAAA,EAAa,UACxC,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,KAAM,EAAA,SAAA;AAAA,MACN,OAAA,EAAS,MAAM,UAAA,CAAW,QAAQ,CAAA;AAAA,MAClC,YAAW,EAAA,QAAA;AAAA,MACX,QAAU,EAAA,OAAA;AAAA,MACV,OAAO,OAAW,IAAA;AAAA,KAAA;AAAA,wCAEjB,MAAO,EAAA,IAAA;AAAA,GAEZ,CACF,CAAA;AAEJ;;;;"}
@@ -1,37 +1,28 @@
1
1
  import React from 'react';
2
2
  import { useApi } from '@backstage/core-plugin-api';
3
- import { makeStyles, createStyles, Dialog, DialogTitle, Box, IconButton, DialogContent, TextField, DialogActions, Button } from '@material-ui/core';
4
- import CloseIcon from '@material-ui/icons/Close';
5
- import ErrorIcon from '@material-ui/icons/Error';
6
- import { Alert } from '@material-ui/lab';
3
+ import CloseIcon from '@mui/icons-material/Close';
4
+ import ErrorIcon from '@mui/icons-material/Error';
5
+ import Alert from '@mui/material/Alert';
6
+ import Box from '@mui/material/Box';
7
+ import Button from '@mui/material/Button';
8
+ import Dialog from '@mui/material/Dialog';
9
+ import DialogActions from '@mui/material/DialogActions';
10
+ import DialogContent from '@mui/material/DialogContent';
11
+ import DialogTitle from '@mui/material/DialogTitle';
12
+ import IconButton from '@mui/material/IconButton';
13
+ import TextField from '@mui/material/TextField';
7
14
  import Typography from '@mui/material/Typography';
8
15
  import { rbacApiRef } from '../../api/RBACBackendClient.esm.js';
9
16
  import { getMembers } from '../../utils/rbac-utils.esm.js';
10
17
  import { removePermissions, removeConditions } from '../../utils/role-form-utils.esm.js';
11
18
  import { useToast } from '../ToastContext.esm.js';
12
19
 
13
- const useStyles = makeStyles(
14
- (theme) => createStyles({
15
- titleContainer: {
16
- display: "flex",
17
- alignItems: "center",
18
- gap: theme.spacing(1)
19
- },
20
- closeButton: {
21
- position: "absolute",
22
- right: theme.spacing(1),
23
- top: theme.spacing(1),
24
- color: theme.palette.grey[500]
25
- }
26
- })
27
- );
28
20
  const DeleteRoleDialog = ({
29
21
  open,
30
22
  closeDialog,
31
23
  roleName,
32
24
  propOptions
33
25
  }) => {
34
- const classes = useStyles();
35
26
  const { setToastMessage } = useToast();
36
27
  const [deleteRoleValue, setDeleteRoleValue] = React.useState();
37
28
  const [disableDelete, setDisableDelete] = React.useState(false);
@@ -72,26 +63,42 @@ const DeleteRoleDialog = ({
72
63
  setDisableDelete(true);
73
64
  }
74
65
  };
75
- return /* @__PURE__ */ React.createElement(Dialog, { maxWidth: "md", open, onClose: closeDialog }, /* @__PURE__ */ React.createElement(DialogTitle, { id: "delete-role", title: "Delete Role" }, /* @__PURE__ */ React.createElement(Box, { className: classes.titleContainer }, /* @__PURE__ */ React.createElement(Typography, { component: "span", sx: { fontWeight: "bold" } }, /* @__PURE__ */ React.createElement(
76
- ErrorIcon,
77
- {
78
- style: {
79
- color: "red",
80
- alignContent: "center",
81
- marginTop: "7px",
82
- marginBottom: "-3px"
83
- },
84
- fontSize: "small"
85
- }
86
- ), " ", "Delete this role?"), /* @__PURE__ */ React.createElement(
87
- IconButton,
66
+ return /* @__PURE__ */ React.createElement(Dialog, { maxWidth: "md", open, onClose: closeDialog }, /* @__PURE__ */ React.createElement(DialogTitle, { id: "delete-role", title: "Delete Role" }, /* @__PURE__ */ React.createElement(
67
+ Box,
88
68
  {
89
- "aria-label": "close",
90
- className: classes.closeButton,
91
- onClick: closeDialog
69
+ sx: {
70
+ display: "flex",
71
+ alignItems: "center",
72
+ gap: (theme) => theme.spacing(1)
73
+ }
92
74
  },
93
- /* @__PURE__ */ React.createElement(CloseIcon, null)
94
- ))), /* @__PURE__ */ React.createElement(DialogContent, null, "Are you sure you want to delete the role", " ", /* @__PURE__ */ React.createElement(Typography, { component: "span", sx: { fontWeight: "bold" } }, roleName), " ", "?", /* @__PURE__ */ React.createElement("br", null), /* @__PURE__ */ React.createElement("br", null), "Deleting this role is irreversible and will remove its functionality from the system. Proceed with caution.", /* @__PURE__ */ React.createElement("br", null), /* @__PURE__ */ React.createElement("br", null), "The", " ", /* @__PURE__ */ React.createElement(Typography, { component: "span", sx: { fontWeight: "bold" } }, `${getMembers(
75
+ /* @__PURE__ */ React.createElement(Typography, { component: "span", sx: { fontWeight: "bold" } }, /* @__PURE__ */ React.createElement(
76
+ ErrorIcon,
77
+ {
78
+ style: {
79
+ color: "red",
80
+ alignContent: "center",
81
+ marginTop: "7px",
82
+ marginBottom: "-3px"
83
+ },
84
+ fontSize: "small"
85
+ }
86
+ ), " ", "Delete this role?"),
87
+ /* @__PURE__ */ React.createElement(
88
+ IconButton,
89
+ {
90
+ "aria-label": "close",
91
+ sx: {
92
+ position: "absolute",
93
+ right: (theme) => theme.spacing(1),
94
+ top: (theme) => theme.spacing(1),
95
+ color: (theme) => theme.palette.grey[500]
96
+ },
97
+ onClick: closeDialog
98
+ },
99
+ /* @__PURE__ */ React.createElement(CloseIcon, null)
100
+ )
101
+ )), /* @__PURE__ */ React.createElement(DialogContent, null, "Are you sure you want to delete the role", " ", /* @__PURE__ */ React.createElement(Typography, { component: "span", sx: { fontWeight: "bold" } }, roleName), " ", "?", /* @__PURE__ */ React.createElement("br", null), /* @__PURE__ */ React.createElement("br", null), "Deleting this role is irreversible and will remove its functionality from the system. Proceed with caution.", /* @__PURE__ */ React.createElement("br", null), /* @__PURE__ */ React.createElement("br", null), "The", " ", /* @__PURE__ */ React.createElement(Typography, { component: "span", sx: { fontWeight: "bold" } }, `${getMembers(
95
102
  propOptions.memberRefs
96
103
  ).toLocaleLowerCase("en-US")}`), " ", "associated with this role will lose access to all the", " ", /* @__PURE__ */ React.createElement(
97
104
  Typography,
@@ -1 +1 @@
1
- {"version":3,"file":"DeleteRoleDialog.esm.js","sources":["../../../src/components/RolesList/DeleteRoleDialog.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\n\nimport { useApi } from '@backstage/core-plugin-api';\n\nimport {\n Box,\n Button,\n createStyles,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n IconButton,\n makeStyles,\n TextField,\n Theme,\n} from '@material-ui/core';\nimport CloseIcon from '@material-ui/icons/Close';\nimport ErrorIcon from '@material-ui/icons/Error';\nimport { Alert } from '@material-ui/lab';\nimport Typography from '@mui/material/Typography';\n\nimport { RoleBasedPolicy } from '@backstage-community/plugin-rbac-common';\n\nimport { rbacApiRef } from '../../api/RBACBackendClient';\nimport { getMembers } from '../../utils/rbac-utils';\nimport {\n removeConditions,\n removePermissions,\n} from '../../utils/role-form-utils';\nimport { useToast } from '../ToastContext';\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n titleContainer: {\n display: 'flex',\n alignItems: 'center',\n gap: theme.spacing(1),\n },\n closeButton: {\n position: 'absolute',\n right: theme.spacing(1),\n top: theme.spacing(1),\n color: theme.palette.grey[500],\n },\n }),\n);\n\ntype DeleteRoleDialogProps = {\n open: boolean;\n closeDialog: () => void;\n roleName: string;\n propOptions: {\n memberRefs: string[];\n permissions: number;\n };\n};\n\nconst DeleteRoleDialog = ({\n open,\n closeDialog,\n roleName,\n propOptions,\n}: DeleteRoleDialogProps) => {\n const classes = useStyles();\n const { setToastMessage } = useToast();\n const [deleteRoleValue, setDeleteRoleValue] = React.useState<string>();\n const [disableDelete, setDisableDelete] = React.useState(false);\n const [error, setError] = React.useState<string>('');\n\n const rbacApi = useApi(rbacApiRef);\n\n const deleteRole = async () => {\n try {\n const policies = await rbacApi.getAssociatedPolicies(roleName);\n const conditionalPolicies = await rbacApi.getRoleConditions(roleName);\n\n if (Array.isArray(policies)) {\n const allowedPolicies = policies.filter(\n (policy: RoleBasedPolicy) => policy.effect !== 'deny',\n );\n await removePermissions(roleName, allowedPolicies, rbacApi);\n }\n\n if (Array.isArray(conditionalPolicies)) {\n const conditionalPoliciesIds = conditionalPolicies.map(cp => cp.id);\n await removeConditions(conditionalPoliciesIds, rbacApi);\n }\n\n const response = await rbacApi.deleteRole(roleName);\n if (response.status === 200 || response.status === 204) {\n setToastMessage(`Role ${roleName} deleted successfully`);\n closeDialog();\n } else {\n setError(`Unable to delete the role. ${response.statusText}`);\n }\n } catch (err) {\n setError(err instanceof Error ? err.message : `${err}`);\n }\n };\n\n const onTextInput = (value: string) => {\n setDeleteRoleValue(value);\n if (value === '') {\n setDisableDelete(true);\n } else if (value === roleName) {\n setDisableDelete(false);\n } else {\n setDisableDelete(true);\n }\n };\n\n return (\n <Dialog maxWidth=\"md\" open={open} onClose={closeDialog}>\n <DialogTitle id=\"delete-role\" title=\"Delete Role\">\n <Box className={classes.titleContainer}>\n <Typography component=\"span\" sx={{ fontWeight: 'bold' }}>\n <ErrorIcon\n style={{\n color: 'red',\n alignContent: 'center',\n marginTop: '7px',\n marginBottom: '-3px',\n }}\n fontSize=\"small\"\n />{' '}\n Delete this role?\n </Typography>\n\n <IconButton\n aria-label=\"close\"\n className={classes.closeButton}\n onClick={closeDialog}\n >\n <CloseIcon />\n </IconButton>\n </Box>\n </DialogTitle>\n <DialogContent>\n Are you sure you want to delete the role{' '}\n <Typography component=\"span\" sx={{ fontWeight: 'bold' }}>\n {roleName}\n </Typography>{' '}\n ?\n <br />\n <br />\n Deleting this role is irreversible and will remove its functionality\n from the system. Proceed with caution.\n <br />\n <br />\n The{' '}\n <Typography component=\"span\" sx={{ fontWeight: 'bold' }}>{`${getMembers(\n propOptions.memberRefs,\n ).toLocaleLowerCase('en-US')}`}</Typography>{' '}\n associated with this role will lose access to all the{' '}\n <Typography\n component=\"span\"\n sx={{ fontWeight: 'bold' }}\n >{`${propOptions.permissions} permission policies`}</Typography>{' '}\n specified in this role.\n <br />\n <TextField\n name=\"delete-role\"\n data-testid=\"delete-role\"\n style={{ marginTop: '24px' }}\n required\n variant=\"outlined\"\n label=\"Role name\"\n defaultValue={deleteRoleValue}\n helperText=\"Type the name of the role to confirm\"\n onChange={({ target: { value } }) => onTextInput(value)}\n onBlur={({ target: { value } }) => onTextInput(value)}\n />\n </DialogContent>\n {error && (\n <Box maxWidth=\"650px\" marginLeft=\"20px\">\n <Alert severity=\"error\">{error}</Alert>\n </Box>\n )}\n <DialogActions\n style={{\n paddingLeft: '25px',\n paddingBottom: '30px',\n justifyContent: 'left',\n paddingTop: '16px',\n }}\n >\n <Button\n variant=\"contained\"\n style={\n disableDelete || !deleteRoleValue\n ? {}\n : { background: 'red', color: 'white' }\n }\n onClick={deleteRole}\n disabled={disableDelete || !deleteRoleValue}\n >\n Delete\n </Button>\n <Button variant=\"outlined\" onClick={closeDialog}>\n Cancel\n </Button>\n </DialogActions>\n </Dialog>\n );\n};\n\nexport default DeleteRoleDialog;\n"],"names":[],"mappings":";;;;;;;;;;;;AA+CA,MAAM,SAAY,GAAA,UAAA;AAAA,EAAW,CAAC,UAC5B,YAAa,CAAA;AAAA,IACX,cAAgB,EAAA;AAAA,MACd,OAAS,EAAA,MAAA;AAAA,MACT,UAAY,EAAA,QAAA;AAAA,MACZ,GAAA,EAAK,KAAM,CAAA,OAAA,CAAQ,CAAC;AAAA,KACtB;AAAA,IACA,WAAa,EAAA;AAAA,MACX,QAAU,EAAA,UAAA;AAAA,MACV,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,MACtB,GAAA,EAAK,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,MACpB,KAAO,EAAA,KAAA,CAAM,OAAQ,CAAA,IAAA,CAAK,GAAG;AAAA;AAC/B,GACD;AACH,CAAA;AAYA,MAAM,mBAAmB,CAAC;AAAA,EACxB,IAAA;AAAA,EACA,WAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF,CAA6B,KAAA;AAC3B,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAM,MAAA,EAAE,eAAgB,EAAA,GAAI,QAAS,EAAA;AACrC,EAAA,MAAM,CAAC,eAAA,EAAiB,kBAAkB,CAAA,GAAI,MAAM,QAAiB,EAAA;AACrE,EAAA,MAAM,CAAC,aAAe,EAAA,gBAAgB,CAAI,GAAA,KAAA,CAAM,SAAS,KAAK,CAAA;AAC9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A,eAAA;AAAA,MACd,UAAW,EAAA,sCAAA;AAAA,MACX,QAAA,EAAU,CAAC,EAAE,MAAA,EAAQ,EAAE,KAAM,EAAA,EAAQ,KAAA,WAAA,CAAY,KAAK,CAAA;AAAA,MACtD,MAAA,EAAQ,CAAC,EAAE,MAAA,EAAQ,EAAE,KAAM,EAAA,EAAQ,KAAA,WAAA,CAAY,KAAK;AAAA;AAAA,GAExD,CAAA,EACC,KACC,oBAAA,KAAA,CAAA,aAAA,CAAC,OAAI,QAAS,EAAA,OAAA,EAAQ,UAAW,EAAA,MAAA,EAAA,sCAC9B,KAAM,EAAA,EAAA,QAAA,EAAS,OAAS,EAAA,EAAA,KAAM,CACjC,CAEF,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,aAAA;AAAA,IAAA;AAAA,MACC,KAAO,EAAA;AAAA,QACL,WAAa,EAAA,MAAA;AAAA,QACb,aAAe,EAAA,MAAA;AAAA,QACf,cAAgB,EAAA,MAAA;AAAA,QAChB,UAAY,EAAA;AAAA;AACd,KAAA;AAAA,oBAEA,KAAA,CAAA,aAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,OAAQ,EAAA,WAAA;AAAA,QACR,KAAA,EACE,aAAiB,IAAA,CAAC,eACd,GAAA,KACA,EAAE,UAAA,EAAY,KAAO,EAAA,KAAA,EAAO,OAAQ,EAAA;AAAA,QAE1C,OAAS,EAAA,UAAA;AAAA,QACT,QAAA,EAAU,iBAAiB,CAAC;AAAA,OAAA;AAAA,MAC7B;AAAA,KAED;AAAA,wCACC,MAAO,EAAA,EAAA,OAAA,EAAQ,UAAW,EAAA,OAAA,EAAS,eAAa,QAEjD;AAAA,GAEJ,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"DeleteRoleDialog.esm.js","sources":["../../../src/components/RolesList/DeleteRoleDialog.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\n\nimport { useApi } from '@backstage/core-plugin-api';\n\nimport CloseIcon from '@mui/icons-material/Close';\nimport ErrorIcon from '@mui/icons-material/Error';\nimport Alert from '@mui/material/Alert';\nimport Box from '@mui/material/Box';\nimport Button from '@mui/material/Button';\nimport Dialog from '@mui/material/Dialog';\nimport DialogActions from '@mui/material/DialogActions';\nimport DialogContent from '@mui/material/DialogContent';\nimport DialogTitle from '@mui/material/DialogTitle';\nimport IconButton from '@mui/material/IconButton';\nimport TextField from '@mui/material/TextField';\nimport Typography from '@mui/material/Typography';\n\nimport { RoleBasedPolicy } from '@backstage-community/plugin-rbac-common';\n\nimport { rbacApiRef } from '../../api/RBACBackendClient';\nimport { getMembers } from '../../utils/rbac-utils';\nimport {\n removeConditions,\n removePermissions,\n} from '../../utils/role-form-utils';\nimport { useToast } from '../ToastContext';\n\ntype DeleteRoleDialogProps = {\n open: boolean;\n closeDialog: () => void;\n roleName: string;\n propOptions: {\n memberRefs: string[];\n permissions: number;\n };\n};\n\nconst DeleteRoleDialog = ({\n open,\n closeDialog,\n roleName,\n propOptions,\n}: DeleteRoleDialogProps) => {\n const { setToastMessage } = useToast();\n const [deleteRoleValue, setDeleteRoleValue] = React.useState<string>();\n const [disableDelete, setDisableDelete] = React.useState(false);\n const [error, setError] = React.useState<string>('');\n\n const rbacApi = useApi(rbacApiRef);\n\n const deleteRole = async () => {\n try {\n const policies = await rbacApi.getAssociatedPolicies(roleName);\n const conditionalPolicies = await rbacApi.getRoleConditions(roleName);\n\n if (Array.isArray(policies)) {\n const allowedPolicies = policies.filter(\n (policy: RoleBasedPolicy) => policy.effect !== 'deny',\n );\n await removePermissions(roleName, allowedPolicies, rbacApi);\n }\n\n if (Array.isArray(conditionalPolicies)) {\n const conditionalPoliciesIds = conditionalPolicies.map(cp => cp.id);\n await removeConditions(conditionalPoliciesIds, rbacApi);\n }\n\n const response = await rbacApi.deleteRole(roleName);\n if (response.status === 200 || response.status === 204) {\n setToastMessage(`Role ${roleName} deleted successfully`);\n closeDialog();\n } else {\n setError(`Unable to delete the role. ${response.statusText}`);\n }\n } catch (err) {\n setError(err instanceof Error ? err.message : `${err}`);\n }\n };\n\n const onTextInput = (value: string) => {\n setDeleteRoleValue(value);\n if (value === '') {\n setDisableDelete(true);\n } else if (value === roleName) {\n setDisableDelete(false);\n } else {\n setDisableDelete(true);\n }\n };\n\n return (\n <Dialog maxWidth=\"md\" open={open} onClose={closeDialog}>\n <DialogTitle id=\"delete-role\" title=\"Delete Role\">\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n gap: theme => theme.spacing(1),\n }}\n >\n <Typography component=\"span\" sx={{ fontWeight: 'bold' }}>\n <ErrorIcon\n style={{\n color: 'red',\n alignContent: 'center',\n marginTop: '7px',\n marginBottom: '-3px',\n }}\n fontSize=\"small\"\n />{' '}\n Delete this role?\n </Typography>\n\n <IconButton\n aria-label=\"close\"\n sx={{\n position: 'absolute',\n right: theme => theme.spacing(1),\n top: theme => theme.spacing(1),\n color: theme => theme.palette.grey[500],\n }}\n onClick={closeDialog}\n >\n <CloseIcon />\n </IconButton>\n </Box>\n </DialogTitle>\n <DialogContent>\n Are you sure you want to delete the role{' '}\n <Typography component=\"span\" sx={{ fontWeight: 'bold' }}>\n {roleName}\n </Typography>{' '}\n ?\n <br />\n <br />\n Deleting this role is irreversible and will remove its functionality\n from the system. Proceed with caution.\n <br />\n <br />\n The{' '}\n <Typography component=\"span\" sx={{ fontWeight: 'bold' }}>{`${getMembers(\n propOptions.memberRefs,\n ).toLocaleLowerCase('en-US')}`}</Typography>{' '}\n associated with this role will lose access to all the{' '}\n <Typography\n component=\"span\"\n sx={{ fontWeight: 'bold' }}\n >{`${propOptions.permissions} permission policies`}</Typography>{' '}\n specified in this role.\n <br />\n <TextField\n name=\"delete-role\"\n data-testid=\"delete-role\"\n style={{ marginTop: '24px' }}\n required\n variant=\"outlined\"\n label=\"Role name\"\n defaultValue={deleteRoleValue}\n helperText=\"Type the name of the role to confirm\"\n onChange={({ target: { value } }) => onTextInput(value)}\n onBlur={({ target: { value } }) => onTextInput(value)}\n />\n </DialogContent>\n {error && (\n <Box maxWidth=\"650px\" marginLeft=\"20px\">\n <Alert severity=\"error\">{error}</Alert>\n </Box>\n )}\n <DialogActions\n style={{\n paddingLeft: '25px',\n paddingBottom: '30px',\n justifyContent: 'left',\n paddingTop: '16px',\n }}\n >\n <Button\n variant=\"contained\"\n style={\n disableDelete || !deleteRoleValue\n ? {}\n : { background: 'red', color: 'white' }\n }\n onClick={deleteRole}\n disabled={disableDelete || !deleteRoleValue}\n >\n Delete\n </Button>\n <Button variant=\"outlined\" onClick={closeDialog}>\n Cancel\n </Button>\n </DialogActions>\n </Dialog>\n );\n};\n\nexport default DeleteRoleDialog;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAoDA,MAAM,mBAAmB,CAAC;AAAA,EACxB,IAAA;AAAA,EACA,WAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF,CAA6B,KAAA;AAC3B,EAAM,MAAA,EAAE,eAAgB,EAAA,GAAI,QAAS,EAAA;AACrC,EAAA,MAAM,CAAC,eAAA,EAAiB,kBAAkB,CAAA,GAAI,MAAM,QAAiB,EAAA;AACrE,EAAA,MAAM,CAAC,aAAe,EAAA,gBAAgB,CAAI,GAAA,KAAA,CAAM,SAAS,KAAK,CAAA;AAC9D,EAAA,MAAM,CAAC,KAAO,EAAA,QAAQ,CAAI,GAAA,KAAA,CAAM,SAAiB,EAAE,CAAA;AAEnD,EAAM,MAAA,OAAA,GAAU,OAAO,UAAU,CAAA;AAEjC,EAAA,MAAM,aAAa,YAAY;AAC7B,IAAI,IAAA;AACF,MAA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AAA,EAAS,eAAa,QAEjD;AAAA,GAEJ,CAAA;AAEJ;;;;"}
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { Progress, WarningPanel, Table } from '@backstage/core-components';
3
3
  import { useDeleteDialog } from '@janus-idp/shared-react';
4
- import { makeStyles } from '@material-ui/core';
4
+ import Box from '@mui/material/Box';
5
5
  import { useCheckIfLicensePluginEnabled } from '../../hooks/useCheckIfLicensePluginEnabled.esm.js';
6
6
  import { useLocationToast } from '../../hooks/useLocationToast.esm.js';
7
7
  import { useRoles } from '../../hooks/useRoles.esm.js';
@@ -12,19 +12,11 @@ import DeleteRoleDialog from './DeleteRoleDialog.esm.js';
12
12
  import { columns } from './RolesListColumns.esm.js';
13
13
  import { RolesListToolbar } from './RolesListToolbar.esm.js';
14
14
 
15
- const useStyles = makeStyles((theme) => ({
16
- empty: {
17
- padding: theme.spacing(2),
18
- display: "flex",
19
- justifyContent: "center"
20
- }
21
- }));
22
15
  const RolesList = () => {
23
16
  const { toastMessage, setToastMessage } = useToast();
24
17
  const { openDialog, setOpenDialog, deleteComponent } = useDeleteDialog();
25
18
  useLocationToast(setToastMessage);
26
19
  const [roles, setRoles] = React.useState();
27
- const classes = useStyles();
28
20
  const { loading, data, retry, createRoleAllowed, createRoleLoading, error } = useRoles();
29
21
  const closeDialog = () => {
30
22
  setOpenDialog(false);
@@ -82,7 +74,14 @@ const RolesList = () => {
82
74
  isLoading: loading,
83
75
  columns,
84
76
  renderSummaryRow: (summary) => onSearchResultsChange(summary.data),
85
- emptyContent: /* @__PURE__ */ React.createElement("div", { "data-testid": "roles-table-empty", className: classes.empty }, "No records found")
77
+ emptyContent: /* @__PURE__ */ React.createElement(
78
+ Box,
79
+ {
80
+ "data-testid": "roles-table-empty",
81
+ sx: { display: "flex", justifyContent: "center", p: 2 }
82
+ },
83
+ "No records found"
84
+ )
86
85
  }
87
86
  ), isLicensePluginEnabled.isEnabled && /* @__PURE__ */ React.createElement(DownloadCSVLink, null), openDialog && /* @__PURE__ */ React.createElement(
88
87
  DeleteRoleDialog,
@@ -1 +1 @@
1
- {"version":3,"file":"RolesList.esm.js","sources":["../../../src/components/RolesList/RolesList.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\n\nimport { Progress, Table, WarningPanel } from '@backstage/core-components';\n\nimport { useDeleteDialog } from '@janus-idp/shared-react';\nimport { makeStyles } from '@material-ui/core';\n\nimport { useCheckIfLicensePluginEnabled } from '../../hooks/useCheckIfLicensePluginEnabled';\nimport { useLocationToast } from '../../hooks/useLocationToast';\nimport { useRoles } from '../../hooks/useRoles';\nimport { RolesData } from '../../types';\nimport DownloadCSVLink from '../DownloadUserStatistics';\nimport { SnackbarAlert } from '../SnackbarAlert';\nimport { useToast } from '../ToastContext';\nimport DeleteRoleDialog from './DeleteRoleDialog';\nimport { columns } from './RolesListColumns';\nimport { RolesListToolbar } from './RolesListToolbar';\n\nconst useStyles = makeStyles(theme => ({\n empty: {\n padding: theme.spacing(2),\n display: 'flex',\n justifyContent: 'center',\n },\n}));\n\nexport const RolesList = () => {\n const { toastMessage, setToastMessage } = useToast();\n const { openDialog, setOpenDialog, deleteComponent } = useDeleteDialog();\n useLocationToast(setToastMessage);\n const [roles, setRoles] = React.useState<number | undefined>();\n const classes = useStyles();\n const { loading, data, retry, createRoleAllowed, createRoleLoading, error } =\n useRoles();\n\n const closeDialog = () => {\n setOpenDialog(false);\n retry.roleRetry();\n retry.policiesRetry();\n };\n\n const onAlertClose = () => {\n setToastMessage('');\n };\n const onSearchResultsChange = (searchResults: RolesData[]) => {\n setRoles(searchResults.length);\n };\n\n const getErrorWarning = () => {\n const errorTitleBase = 'Something went wrong while fetching the';\n const errorWarningArr = [\n { message: error?.rolesError, title: `${errorTitleBase} roles` },\n {\n message: error?.policiesError,\n title: `${errorTitleBase} permission policies`,\n },\n {\n message: error?.roleConditionError,\n title: `${errorTitleBase} role conditions`,\n },\n ];\n\n return (\n errorWarningArr.find(({ message }) => message) || {\n message: '',\n title: '',\n }\n );\n };\n\n const errorWarning = getErrorWarning();\n\n const isLicensePluginEnabled = useCheckIfLicensePluginEnabled();\n if (isLicensePluginEnabled.loading) {\n return <Progress />;\n }\n\n return (\n <>\n <SnackbarAlert toastMessage={toastMessage} onAlertClose={onAlertClose} />\n <RolesListToolbar\n createRoleAllowed={createRoleAllowed}\n createRoleLoading={createRoleLoading}\n />\n {errorWarning.message && (\n <div style={{ paddingBottom: '16px' }}>\n <WarningPanel\n message={errorWarning.message}\n title={errorWarning.title}\n severity=\"error\"\n />\n </div>\n )}\n <Table\n title={\n !loading && data?.length\n ? `All roles (${roles ?? data.length})`\n : `All roles`\n }\n options={{ padding: 'default', search: true, paging: true }}\n data={data}\n isLoading={loading}\n columns={columns}\n renderSummaryRow={summary => onSearchResultsChange(summary.data)}\n emptyContent={\n <div data-testid=\"roles-table-empty\" className={classes.empty}>\n No records found\n </div>\n }\n />\n {isLicensePluginEnabled.isEnabled && <DownloadCSVLink />}\n {openDialog && (\n <DeleteRoleDialog\n open={openDialog}\n closeDialog={closeDialog}\n roleName={deleteComponent.roleName}\n propOptions={{\n memberRefs:\n data.find(d => d.name === deleteComponent.roleName)?.members ||\n [],\n permissions:\n data.find(d => d.name === deleteComponent.roleName)\n ?.permissions || 0,\n }}\n />\n )}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAiCA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,KAAO,EAAA;AAAA,IACL,OAAA,EAAS,KAAM,CAAA,OAAA,CAAQ,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A,SAAW,EAAA,OAAA;AAAA,MACX,OAAA;AAAA,MACA,gBAAkB,EAAA,CAAA,OAAA,KAAW,qBAAsB,CAAA,OAAA,CAAQ,IAAI,CAAA;AAAA,MAC/D,YAAA,sCACG,KAAI,EAAA,EAAA,aAAA,EAAY,qBAAoB,SAAW,EAAA,OAAA,CAAQ,SAAO,kBAE/D;AAAA;AAAA,KAGH,sBAAuB,CAAA,SAAA,oBAAc,KAAA,CAAA,aAAA,CAAA,eAAA,EAAA,IAAgB,GACrD,UACC,oBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,gBAAA;AAAA,IAAA;AAAA,MACC,IAAM,EAAA,UAAA;AAAA,MACN,WAAA;AAAA,MACA,UAAU,eAAgB,CAAA,QAAA;AAAA,MAC1B,WAAa,EAAA;AAAA,QACX,UAAA,EACE,IAAK,CAAA,IAAA,CAAK,CAAK,CAAA,KAAA,CAAA,CAAE,SAAS,eAAgB,CAAA,QAAQ,CAAG,EAAA,OAAA,IACrD,EAAC;AAAA,QACH,WAAA,EACE,KAAK,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,IAAS,KAAA,eAAA,CAAgB,QAAQ,CAAA,EAC9C,WAAe,IAAA;AAAA;AACvB;AAAA,GAGN,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"RolesList.esm.js","sources":["../../../src/components/RolesList/RolesList.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\n\nimport { Progress, Table, WarningPanel } from '@backstage/core-components';\n\nimport { useDeleteDialog } from '@janus-idp/shared-react';\nimport Box from '@mui/material/Box';\n\nimport { useCheckIfLicensePluginEnabled } from '../../hooks/useCheckIfLicensePluginEnabled';\nimport { useLocationToast } from '../../hooks/useLocationToast';\nimport { useRoles } from '../../hooks/useRoles';\nimport { RolesData } from '../../types';\nimport DownloadCSVLink from '../DownloadUserStatistics';\nimport { SnackbarAlert } from '../SnackbarAlert';\nimport { useToast } from '../ToastContext';\nimport DeleteRoleDialog from './DeleteRoleDialog';\nimport { columns } from './RolesListColumns';\nimport { RolesListToolbar } from './RolesListToolbar';\n\nexport const RolesList = () => {\n const { toastMessage, setToastMessage } = useToast();\n const { openDialog, setOpenDialog, deleteComponent } = useDeleteDialog();\n useLocationToast(setToastMessage);\n const [roles, setRoles] = React.useState<number | undefined>();\n const { loading, data, retry, createRoleAllowed, createRoleLoading, error } =\n useRoles();\n\n const closeDialog = () => {\n setOpenDialog(false);\n retry.roleRetry();\n retry.policiesRetry();\n };\n\n const onAlertClose = () => {\n setToastMessage('');\n };\n const onSearchResultsChange = (searchResults: RolesData[]) => {\n setRoles(searchResults.length);\n };\n\n const getErrorWarning = () => {\n const errorTitleBase = 'Something went wrong while fetching the';\n const errorWarningArr = [\n { message: error?.rolesError, title: `${errorTitleBase} roles` },\n {\n message: error?.policiesError,\n title: `${errorTitleBase} permission policies`,\n },\n {\n message: error?.roleConditionError,\n title: `${errorTitleBase} role conditions`,\n },\n ];\n\n return (\n errorWarningArr.find(({ message }) => message) || {\n message: '',\n title: '',\n }\n );\n };\n\n const errorWarning = getErrorWarning();\n\n const isLicensePluginEnabled = useCheckIfLicensePluginEnabled();\n if (isLicensePluginEnabled.loading) {\n return <Progress />;\n }\n\n return (\n <>\n <SnackbarAlert toastMessage={toastMessage} onAlertClose={onAlertClose} />\n <RolesListToolbar\n createRoleAllowed={createRoleAllowed}\n createRoleLoading={createRoleLoading}\n />\n {errorWarning.message && (\n <div style={{ paddingBottom: '16px' }}>\n <WarningPanel\n message={errorWarning.message}\n title={errorWarning.title}\n severity=\"error\"\n />\n </div>\n )}\n <Table\n title={\n !loading && data?.length\n ? `All roles (${roles ?? data.length})`\n : `All roles`\n }\n options={{ padding: 'default', search: true, paging: true }}\n data={data}\n isLoading={loading}\n columns={columns}\n renderSummaryRow={summary => onSearchResultsChange(summary.data)}\n emptyContent={\n <Box\n data-testid=\"roles-table-empty\"\n sx={{ display: 'flex', justifyContent: 'center', p: 2 }}\n >\n No records found\n </Box>\n }\n />\n {isLicensePluginEnabled.isEnabled && <DownloadCSVLink />}\n {openDialog && (\n <DeleteRoleDialog\n open={openDialog}\n closeDialog={closeDialog}\n roleName={deleteComponent.roleName}\n propOptions={{\n memberRefs:\n data.find(d => d.name === deleteComponent.roleName)?.members ||\n [],\n permissions:\n data.find(d => d.name === deleteComponent.roleName)\n ?.permissions || 0,\n }}\n />\n )}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAiCO,MAAM,YAAY,MAAM;AAC7B,EAAA,MAAM,EAAE,YAAA,EAAc,eAAgB,EAAA,GAAI,QAAS,EAAA;AACnD,EAAA,MAAM,EAAE,UAAA,EAAY,aAAe,EAAA,eAAA,KAAoB,eAAgB,EAAA;AACvE,EAAA,gBAAA,CAAiB,eAAe,CAAA;AAChC,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,MAAM,QAA6B,EAAA;AAC7D,EAAM,MAAA,EAAE,SAAS,IAAM,EAAA,KAAA,EAAO,mBAAmB,iBAAmB,EAAA,KAAA,KAClE,QAAS,EAAA;AAEX,EAAA,MAAM,cAAc,MAAM;AACxB,IAAA,aAAA,CAAc,KAAK,CAAA;AACnB,IAAA,KAAA,CAAM,SAAU,EAAA;AAChB,IAAA,KAAA,CAAM,aAAc,EAAA;AAAA,GACtB;AAEA,EAAA,MAAM,eAAe,MAAM;AACzB,IAAA,eAAA,CAAgB,EAAE,CAAA;AAAA,GACpB;AACA,EAAM,MAAA,qBAAA,GAAwB,CAAC,aAA+B,KAAA;AAC5D,IAAA,QAAA,CAAS,c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,CAAA,EAC9C,WAAe,IAAA;AAAA;AACvB;AAAA,GAGN,CAAA;AAEJ;;;;"}
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
2
  import { parseEntityRef } from '@backstage/catalog-model';
3
3
  import { Link } from '@backstage/core-components';
4
- import { Tooltip, Typography } from '@material-ui/core';
4
+ import Tooltip from '@mui/material/Tooltip';
5
+ import Typography from '@mui/material/Typography';
5
6
  import { getMembers } from '../../utils/rbac-utils.esm.js';
6
7
  import EditRole from '../EditRole.esm.js';
7
8
  import DeleteRole from './DeleteRole.esm.js';
@@ -1 +1 @@
1
- {"version":3,"file":"RolesListColumns.esm.js","sources":["../../../src/components/RolesList/RolesListColumns.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\n\nimport { parseEntityRef } from '@backstage/catalog-model';\nimport { Link, TableColumn } from '@backstage/core-components';\n\nimport { Tooltip, Typography } from '@material-ui/core';\n\nimport { RolesData } from '../../types';\nimport { getMembers } from '../../utils/rbac-utils';\nimport EditRole from '../EditRole';\nimport DeleteRole from './DeleteRole';\n\nexport const columns: TableColumn<RolesData>[] = [\n {\n title: 'Name',\n field: 'name',\n type: 'string',\n render: (props: RolesData) => {\n const { kind, namespace, name } = parseEntityRef(props.name);\n return (\n <Link to={`roles/${kind}/${namespace}/${name}`}>{props.name}</Link>\n );\n },\n },\n {\n title: 'Users and groups',\n field: 'members',\n type: 'string',\n align: 'left',\n render: props => getMembers(props.members),\n customSort: (a, b) => {\n if (a.members.length === 0) {\n return -1;\n }\n if (b.members.length === 0) {\n return 1;\n }\n if (a.members.length === b.members.length) {\n return 0;\n }\n return a.members.length < b.members.length ? -1 : 1;\n },\n },\n {\n title: 'Accessible plugins',\n field: 'accessiblePlugins',\n type: 'string',\n align: 'left',\n render: (props: RolesData) => {\n const pls = props.accessiblePlugins.map(\n p => p[0].toLocaleUpperCase('en-US') + p.slice(1),\n );\n const plsTooltip = pls.join(', ');\n const plsOverflowCount = pls.length > 2 ? `+ ${pls.length - 2}` : '';\n\n return pls.length > 0 ? (\n <Tooltip title={plsTooltip || ''} placement=\"top-start\">\n <Typography>\n {pls.length === 1\n ? `${pls[0]}`\n : `${pls[0]}, ${pls[1]} ${plsOverflowCount}`}\n </Typography>\n </Tooltip>\n ) : (\n '-'\n );\n },\n },\n {\n title: 'Actions',\n sorting: false,\n render: (props: RolesData) => (\n <>\n <EditRole\n dataTestId={\n !props.actionsPermissionResults.edit.allowed\n ? `disable-update-role-${props.name}`\n : `update-role-${props.name}`\n }\n roleName={props.name}\n disable={!props.actionsPermissionResults.edit.allowed}\n tooltip={\n !props.actionsPermissionResults.edit.allowed\n ? 'Unauthorized to edit'\n : ''\n }\n />\n <DeleteRole\n dataTestId={\n !props.actionsPermissionResults.delete.allowed\n ? `disable-delete-role-${props.name}`\n : `delete-role-${props.name}`\n }\n roleName={props.name}\n disable={!props.actionsPermissionResults.delete.allowed}\n tooltip={\n !props.actionsPermissionResults.delete.allowed\n ? 'Role cannot be deleted'\n : ''\n }\n />\n </>\n ),\n },\n];\n"],"names":[],"mappings":";;;;;;;;AA2BO,MAAM,OAAoC,GAAA;AAAA,EAC/C;AAAA,IACE,KAAO,EAAA,MAAA;AAAA,IACP,KAAO,EAAA,MAAA;AAAA,IACP,IAAM,EAAA,QAAA;AAAA,IACN,MAAA,EAAQ,CAAC,KAAqB,KAAA;AAC5B,MAAA,MAAM,EAAE,IAAM,EAAA,SAAA,EAAW,MAAS,GAAA,cAAA,CAAe,MAAM,IAAI,CAAA;AAC3D,MACE,uBAAA,KAAA,CAAA,aAA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AAA,KAGR,kBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,UACE,EAAA,CAAC,KAAM,CAAA,wBAAA,CAAyB,MAAO,CAAA,OAAA,GACnC,CAAuB,oBAAA,EAAA,KAAA,CAAM,IAAI,CAAA,CAAA,GACjC,CAAe,YAAA,EAAA,KAAA,CAAM,IAAI,CAAA,CAAA;AAAA,QAE/B,UAAU,KAAM,CAAA,IAAA;AAAA,QAChB,OAAS,EAAA,CAAC,KAAM,CAAA,wBAAA,CAAyB,MAAO,CAAA,OAAA;AAAA,QAChD,SACE,CAAC,KAAA,CAAM,wBAAyB,CAAA,MAAA,CAAO,UACnC,wBACA,GAAA;AAAA;AAAA,KAGV;AAAA;AAGN;;;;"}
1
+ {"version":3,"file":"RolesListColumns.esm.js","sources":["../../../src/components/RolesList/RolesListColumns.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\n\nimport { parseEntityRef } from '@backstage/catalog-model';\nimport { Link, TableColumn } from '@backstage/core-components';\n\nimport Tooltip from '@mui/material/Tooltip';\nimport Typography from '@mui/material/Typography';\n\nimport { RolesData } from '../../types';\nimport { getMembers } from '../../utils/rbac-utils';\nimport EditRole from '../EditRole';\nimport DeleteRole from './DeleteRole';\n\nexport const columns: TableColumn<RolesData>[] = [\n {\n title: 'Name',\n field: 'name',\n type: 'string',\n render: (props: RolesData) => {\n const { kind, namespace, name } = parseEntityRef(props.name);\n return (\n <Link to={`roles/${kind}/${namespace}/${name}`}>{props.name}</Link>\n );\n },\n },\n {\n title: 'Users and groups',\n field: 'members',\n type: 'string',\n align: 'left',\n render: props => getMembers(props.members),\n customSort: (a, b) => {\n if (a.members.length === 0) {\n return -1;\n }\n if (b.members.length === 0) {\n return 1;\n }\n if (a.members.length === b.members.length) {\n return 0;\n }\n return a.members.length < b.members.length ? -1 : 1;\n },\n },\n {\n title: 'Accessible plugins',\n field: 'accessiblePlugins',\n type: 'string',\n align: 'left',\n render: (props: RolesData) => {\n const pls = props.accessiblePlugins.map(\n p => p[0].toLocaleUpperCase('en-US') + p.slice(1),\n );\n const plsTooltip = pls.join(', ');\n const plsOverflowCount = pls.length > 2 ? `+ ${pls.length - 2}` : '';\n\n return pls.length > 0 ? (\n <Tooltip title={plsTooltip || ''} placement=\"top-start\">\n <Typography>\n {pls.length === 1\n ? `${pls[0]}`\n : `${pls[0]}, ${pls[1]} ${plsOverflowCount}`}\n </Typography>\n </Tooltip>\n ) : (\n '-'\n );\n },\n },\n {\n title: 'Actions',\n sorting: false,\n render: (props: RolesData) => (\n <>\n <EditRole\n dataTestId={\n !props.actionsPermissionResults.edit.allowed\n ? `disable-update-role-${props.name}`\n : `update-role-${props.name}`\n }\n roleName={props.name}\n disable={!props.actionsPermissionResults.edit.allowed}\n tooltip={\n !props.actionsPermissionResults.edit.allowed\n ? 'Unauthorized to edit'\n : ''\n }\n />\n <DeleteRole\n dataTestId={\n !props.actionsPermissionResults.delete.allowed\n ? `disable-delete-role-${props.name}`\n : `delete-role-${props.name}`\n }\n roleName={props.name}\n disable={!props.actionsPermissionResults.delete.allowed}\n tooltip={\n !props.actionsPermissionResults.delete.allowed\n ? 'Role cannot be deleted'\n : ''\n }\n />\n </>\n ),\n },\n];\n"],"names":[],"mappings":";;;;;;;;;AA4BO,MAAM,OAAoC,GAAA;AAAA,EAC/C;AAAA,IACE,KAAO,EAAA,MAAA;AAAA,IACP,KAAO,EAAA,MAAA;AAAA,IACP,IAAM,EAAA,QAAA;AAAA,IACN,MAAA,EAAQ,CAAC,KAAqB,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KAAM,CAAA,wBAAA,CAAyB,IAAK,CAAA,OAAA;AAAA,QAC9C,SACE,CAAC,KAAA,CAAM,wBAAyB,CAAA,IAAA,CAAK,UACjC,sBACA,GAAA;AAAA;AAAA,KAGR,kBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,UACE,EAAA,CAAC,KAAM,CAAA,wBAAA,CAAyB,MAAO,CAAA,OAAA,GACnC,CAAuB,oBAAA,EAAA,KAAA,CAAM,IAAI,CAAA,CAAA,GACjC,CAAe,YAAA,EAAA,KAAA,CAAM,IAAI,CAAA,CAAA;AAAA,QAE/B,UAAU,KAAM,CAAA,IAAA;AAAA,QAChB,OAAS,EAAA,CAAC,KAAM,CAAA,wBAAA,CAAyB,MAAO,CAAA,OAAA;AAAA,QAChD,SACE,CAAC,KAAA,CAAM,wBAAyB,CAAA,MAAA,CAAO,UACnC,wBACA,GAAA;AAAA;AAAA,KAGV;AAAA;AAGN;;;;"}
@@ -1,47 +1,50 @@
1
1
  import React from 'react';
2
- import { LinkButton } from '@backstage/core-components';
3
- import { makeStyles } from '@material-ui/core';
4
- import Alert from '@material-ui/lab/Alert';
5
- import AlertTitle from '@material-ui/lab/AlertTitle';
2
+ import { Link, LinkButton } from '@backstage/core-components';
3
+ import Alert from '@mui/material/Alert';
4
+ import AlertTitle from '@mui/material/AlertTitle';
6
5
  import Typography from '@mui/material/Typography';
7
6
 
8
- const useStyles = makeStyles((theme) => ({
9
- toolbar: {
10
- display: "flex",
11
- justifyContent: "end",
12
- marginBottom: "24px"
13
- },
14
- rbacPreReqLink: {
15
- color: theme.palette.link
16
- },
17
- alertTitle: {
18
- fontWeight: "bold"
19
- }
20
- }));
21
7
  const RolesListToolbar = ({
22
8
  createRoleAllowed,
23
9
  createRoleLoading
24
10
  }) => {
25
- const classes = useStyles();
26
- return /* @__PURE__ */ React.createElement("div", null, !createRoleLoading && !createRoleAllowed && /* @__PURE__ */ React.createElement(Alert, { severity: "warning", "data-testid": "create-role-warning" }, /* @__PURE__ */ React.createElement(AlertTitle, { className: classes.alertTitle }, "Unable to create role."), "To enable create/edit role button, make sure required users/groups are available in catalog as a role cannot be created without users/groups and also the role associated with your user should have the permission policies mentioned", " ", /* @__PURE__ */ React.createElement(
27
- "a",
11
+ return /* @__PURE__ */ React.createElement("div", null, !createRoleLoading && !createRoleAllowed && /* @__PURE__ */ React.createElement(Alert, { severity: "warning", "data-testid": "create-role-warning" }, /* @__PURE__ */ React.createElement(
12
+ AlertTitle,
28
13
  {
29
- href: "https://github.com/backstage/community-plugins/tree/main/workspaces/rbac/plugins/rbac#prerequisites",
30
- target: "blank",
31
- className: classes.rbacPreReqLink
14
+ sx: {
15
+ fontWeight: "bold"
16
+ }
17
+ },
18
+ "Unable to create role."
19
+ ), "To enable create/edit role button, make sure required users/groups are available in catalog as a role cannot be created without users/groups and also the role associated with your user should have the permission policies mentioned", " ", /* @__PURE__ */ React.createElement(
20
+ Link,
21
+ {
22
+ to: "https://github.com/backstage/community-plugins/tree/main/workspaces/rbac/plugins/rbac#prerequisites",
23
+ target: "_blank"
32
24
  },
33
25
  "here"
34
- ), ".", /* @__PURE__ */ React.createElement("br", null), /* @__PURE__ */ React.createElement(Typography, null, /* @__PURE__ */ React.createElement(Typography, { component: "span", sx: { fontWeight: "bold" } }, "Note"), ": Even after ingesting users/groups in catalog and applying above permissions if the create/edit button is still disabled then please contact your administrator as you might be conditionally restricted from accessing the create/edit button.")), /* @__PURE__ */ React.createElement("br", null), /* @__PURE__ */ React.createElement(Typography, { component: "span", className: classes.toolbar }, /* @__PURE__ */ React.createElement(
35
- LinkButton,
26
+ ), /* @__PURE__ */ React.createElement(Typography, { sx: { mt: 1 }, fontSize: "small" }, /* @__PURE__ */ React.createElement(Typography, { component: "span", fontWeight: "bold", fontSize: "small" }, "Note"), ": Even after ingesting users/groups in catalog and applying above permissions if the create/edit button is still disabled then please contact your administrator as you might be conditionally restricted from accessing the create/edit button.")), /* @__PURE__ */ React.createElement("br", null), /* @__PURE__ */ React.createElement(
27
+ Typography,
36
28
  {
37
- to: "role/new",
38
- color: "primary",
39
- variant: "contained",
40
- disabled: !createRoleAllowed,
41
- "data-testid": "create-role"
29
+ component: "span",
30
+ sx: {
31
+ display: "flex",
32
+ justifyContent: "end",
33
+ marginBottom: "24px"
34
+ }
42
35
  },
43
- "Create"
44
- )));
36
+ /* @__PURE__ */ React.createElement(
37
+ LinkButton,
38
+ {
39
+ to: "role/new",
40
+ color: "primary",
41
+ variant: "contained",
42
+ disabled: !createRoleAllowed,
43
+ "data-testid": "create-role"
44
+ },
45
+ "Create"
46
+ )
47
+ ));
45
48
  };
46
49
 
47
50
  export { RolesListToolbar };
@@ -1 +1 @@
1
- {"version":3,"file":"RolesListToolbar.esm.js","sources":["../../../src/components/RolesList/RolesListToolbar.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\n\nimport { LinkButton } from '@backstage/core-components';\n\nimport { makeStyles } from '@material-ui/core';\nimport Alert from '@material-ui/lab/Alert';\nimport AlertTitle from '@material-ui/lab/AlertTitle';\nimport Typography from '@mui/material/Typography';\n\nconst useStyles = makeStyles(theme => ({\n toolbar: {\n display: 'flex',\n justifyContent: 'end',\n marginBottom: '24px',\n },\n rbacPreReqLink: {\n color: theme.palette.link,\n },\n alertTitle: {\n fontWeight: 'bold',\n },\n}));\n\nexport const RolesListToolbar = ({\n createRoleAllowed,\n createRoleLoading,\n}: {\n createRoleAllowed: boolean;\n createRoleLoading: boolean;\n}) => {\n const classes = useStyles();\n return (\n <div>\n {!createRoleLoading && !createRoleAllowed && (\n <Alert severity=\"warning\" data-testid=\"create-role-warning\">\n <AlertTitle className={classes.alertTitle}>\n Unable to create role.\n </AlertTitle>\n To enable create/edit role button, make sure required users/groups are\n available in catalog as a role cannot be created without users/groups\n and also the role associated with your user should have the permission\n policies mentioned{' '}\n <a\n href=\"https://github.com/backstage/community-plugins/tree/main/workspaces/rbac/plugins/rbac#prerequisites\"\n target=\"blank\"\n className={classes.rbacPreReqLink}\n >\n here\n </a>\n .\n <br />\n <Typography>\n <Typography component=\"span\" sx={{ fontWeight: 'bold' }}>\n Note\n </Typography>\n : Even after ingesting users/groups in catalog and applying above\n permissions if the create/edit button is still disabled then please\n contact your administrator as you might be conditionally restricted\n from accessing the create/edit button.\n </Typography>\n </Alert>\n )}\n <br />\n <Typography component=\"span\" className={classes.toolbar}>\n <LinkButton\n to=\"role/new\"\n color=\"primary\"\n variant=\"contained\"\n disabled={!createRoleAllowed}\n data-testid=\"create-role\"\n >\n Create\n </LinkButton>\n </Typography>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAwBA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,OAAS,EAAA;AAAA,IACP,OAAS,EAAA,MAAA;AAAA,IACT,cAAgB,EAAA,KAAA;AAAA,IAChB,YAAc,EAAA;AAAA,GAChB;AAAA,EACA,cAAgB,EAAA;AAAA,IACd,KAAA,EAAO,MAAM,OAAQ,CAAA;AAAA,GACvB;AAAA,EACA,UAAY,EAAA;AAAA,IACV,UAAY,EAAA;AAAA;AAEhB,CAAE,CAAA,CAAA;AAEK,MAAM,mBAAmB,CAAC;AAAA,EAC/B,iBAAA;AAAA,EACA;AACF,CAGM,KAAA;AACJ,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,aACE,CAAC,iBAAA,IAAqB,CAAC,iBACtB,oBAAA,KAAA,CAAA,aAAA,CAAC,SAAM,QAAS,EAAA,SAAA,EAAU,eAAY,qBACpC,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,cAAW,SAAW,EAAA,OAAA,CAAQ,cAAY,wBAE3C,CAAA,EAAa,0OAIM,GACnB,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,GAAA;AAAA,IAAA;AAAA,MACC,IAAK,EAAA,qGAAA;AAAA,MACL,MAAO,EAAA,OAAA;AAAA,MACP,WAAW,OAAQ,CAAA;AAAA,KAAA;AAAA,IACpB;AAAA,GAEG,EAAA,GAAA,kBAEH,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,IAAG,CACJ,kBAAA,KAAA,CAAA,aAAA,CAAC,UACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,SAAA,EAAU,MAAO,EAAA,EAAA,EAAI,EAAE,UAAY,EAAA,MAAA,EAAU,EAAA,EAAA,MAEzD,CAAa,EAAA,kPAKf,CACF,CAAA,kBAED,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,IAAG,CACJ,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,SAAA,EAAU,MAAO,EAAA,SAAA,EAAW,QAAQ,OAC9C,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,EAAG,EAAA,UAAA;AAAA,MACH,KAAM,EAAA,SAAA;AAAA,MACN,OAAQ,EAAA,WAAA;AAAA,MACR,UAAU,CAAC,iBAAA;AAAA,MACX,aAAY,EAAA;AAAA,KAAA;AAAA,IACb;AAAA,GAGH,CACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"RolesListToolbar.esm.js","sources":["../../../src/components/RolesList/RolesListToolbar.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\n\nimport { Link, LinkButton } from '@backstage/core-components';\n\nimport Alert from '@mui/material/Alert';\nimport AlertTitle from '@mui/material/AlertTitle';\nimport Typography from '@mui/material/Typography';\n\nexport const RolesListToolbar = ({\n createRoleAllowed,\n createRoleLoading,\n}: {\n createRoleAllowed: boolean;\n createRoleLoading: boolean;\n}) => {\n return (\n <div>\n {!createRoleLoading && !createRoleAllowed && (\n <Alert severity=\"warning\" data-testid=\"create-role-warning\">\n <AlertTitle\n sx={{\n fontWeight: 'bold',\n }}\n >\n Unable to create role.\n </AlertTitle>\n To enable create/edit role button, make sure required users/groups are\n available in catalog as a role cannot be created without users/groups\n and also the role associated with your user should have the permission\n policies mentioned{' '}\n <Link\n to=\"https://github.com/backstage/community-plugins/tree/main/workspaces/rbac/plugins/rbac#prerequisites\"\n target=\"_blank\"\n >\n here\n </Link>\n <Typography sx={{ mt: 1 }} fontSize=\"small\">\n <Typography component=\"span\" fontWeight=\"bold\" fontSize=\"small\">\n Note\n </Typography>\n : Even after ingesting users/groups in catalog and applying above\n permissions if the create/edit button is still disabled then please\n contact your administrator as you might be conditionally restricted\n from accessing the create/edit button.\n </Typography>\n </Alert>\n )}\n <br />\n <Typography\n component=\"span\"\n sx={{\n display: 'flex',\n justifyContent: 'end',\n marginBottom: '24px',\n }}\n >\n <LinkButton\n to=\"role/new\"\n color=\"primary\"\n variant=\"contained\"\n disabled={!createRoleAllowed}\n data-testid=\"create-role\"\n >\n Create\n </LinkButton>\n </Typography>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;AAuBO,MAAM,mBAAmB,CAAC;AAAA,EAC/B,iBAAA;AAAA,EACA;AACF,CAGM,KAAA;AACJ,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,KACE,EAAA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AAEJ;;;;"}
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import Snackbar from '@material-ui/core/Snackbar';
3
- import Alert from '@material-ui/lab/Alert';
2
+ import Alert from '@mui/material/Alert';
3
+ import Snackbar from '@mui/material/Snackbar';
4
4
 
5
5
  const SnackbarAlert = ({
6
6
  toastMessage,
@@ -1 +1 @@
1
- {"version":3,"file":"SnackbarAlert.esm.js","sources":["../../src/components/SnackbarAlert.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\n\nimport Snackbar from '@material-ui/core/Snackbar';\nimport Alert from '@material-ui/lab/Alert';\n\nexport const SnackbarAlert = ({\n toastMessage,\n onAlertClose,\n}: {\n toastMessage: string;\n onAlertClose: () => void;\n}) => {\n return (\n <Snackbar\n open={toastMessage !== ''}\n autoHideDuration={10000}\n anchorOrigin={{ vertical: 'top', horizontal: 'right' }}\n style={{ top: '100px', left: '0px', justifyContent: 'center' }}\n onClose={onAlertClose}\n >\n <Alert onClose={onAlertClose} severity=\"success\">\n {toastMessage}\n </Alert>\n </Snackbar>\n );\n};\n"],"names":[],"mappings":";;;;AAoBO,MAAM,gBAAgB,CAAC;AAAA,EAC5B,YAAA;AAAA,EACA;AACF,CAGM,KAAA;AACJ,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,MAAM,YAAiB,KAAA,EAAA;AAAA,MACvB,gBAAkB,EAAA,GAAA;AAAA,MAClB,YAAc,EAAA,EAAE,QAAU,EAAA,KAAA,EAAO,YAAY,OAAQ,EAAA;AAAA,MACrD,OAAO,EAAE,GAAA,EAAK,SAAS,IAAM,EAAA,KAAA,EAAO,gBAAgB,QAAS,EAAA;AAAA,MAC7D,OAAS,EAAA;AAAA,KAAA;AAAA,wCAER,KAAM,EAAA,EAAA,OAAA,EAAS,YAAc,EAAA,QAAA,EAAS,aACpC,YACH;AAAA,GACF;AAEJ;;;;"}
1
+ {"version":3,"file":"SnackbarAlert.esm.js","sources":["../../src/components/SnackbarAlert.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\n\nimport Alert from '@mui/material/Alert';\nimport Snackbar from '@mui/material/Snackbar';\n\nexport const SnackbarAlert = ({\n toastMessage,\n onAlertClose,\n}: {\n toastMessage: string;\n onAlertClose: () => void;\n}) => {\n return (\n <Snackbar\n open={toastMessage !== ''}\n autoHideDuration={10000}\n anchorOrigin={{ vertical: 'top', horizontal: 'right' }}\n style={{ top: '100px', left: '0px', justifyContent: 'center' }}\n onClose={onAlertClose}\n >\n <Alert onClose={onAlertClose} severity=\"success\">\n {toastMessage}\n </Alert>\n </Snackbar>\n );\n};\n"],"names":[],"mappings":";;;;AAoBO,MAAM,gBAAgB,CAAC;AAAA,EAC5B,YAAA;AAAA,EACA;AACF,CAGM,KAAA;AACJ,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,MAAM,YAAiB,KAAA,EAAA;AAAA,MACvB,gBAAkB,EAAA,GAAA;AAAA,MAClB,YAAc,EAAA,EAAE,QAAU,EAAA,KAAA,EAAO,YAAY,OAAQ,EAAA;AAAA,MACrD,OAAO,EAAE,GAAA,EAAK,SAAS,IAAM,EAAA,KAAA,EAAO,gBAAgB,QAAS,EAAA;AAAA,MAC7D,OAAS,EAAA;AAAA,KAAA;AAAA,wCAER,KAAM,EAAA,EAAA,OAAA,EAAS,YAAc,EAAA,QAAA,EAAS,aACpC,YACH;AAAA,GACF;AAEJ;;;;"}