@backstage-community/plugin-rbac 1.40.1 → 1.41.1

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 (99) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/components/Administration.esm.js +2 -2
  3. package/dist/components/Administration.esm.js.map +1 -1
  4. package/dist/components/ConditionalAccess/AddNestedConditionButton.esm.js +16 -7
  5. package/dist/components/ConditionalAccess/AddNestedConditionButton.esm.js.map +1 -1
  6. package/dist/components/ConditionalAccess/ComplexConditionRow.esm.js +40 -38
  7. package/dist/components/ConditionalAccess/ComplexConditionRow.esm.js.map +1 -1
  8. package/dist/components/ConditionalAccess/ComplexConditionRowButtons.esm.js +34 -32
  9. package/dist/components/ConditionalAccess/ComplexConditionRowButtons.esm.js.map +1 -1
  10. package/dist/components/ConditionalAccess/ConditionRule.esm.js +2 -2
  11. package/dist/components/ConditionalAccess/ConditionRule.esm.js.map +1 -1
  12. package/dist/components/ConditionalAccess/ConditionalAccessSidebar.esm.js +63 -53
  13. package/dist/components/ConditionalAccess/ConditionalAccessSidebar.esm.js.map +1 -1
  14. package/dist/components/ConditionalAccess/ConditionsForm.esm.js +108 -96
  15. package/dist/components/ConditionalAccess/ConditionsForm.esm.js.map +1 -1
  16. package/dist/components/ConditionalAccess/ConditionsFormRow.esm.js +236 -215
  17. package/dist/components/ConditionalAccess/ConditionsFormRow.esm.js.map +1 -1
  18. package/dist/components/ConditionalAccess/ConditionsFormRowFields.esm.js +63 -60
  19. package/dist/components/ConditionalAccess/ConditionsFormRowFields.esm.js.map +1 -1
  20. package/dist/components/ConditionalAccess/CriteriaToggleButton.esm.js +5 -5
  21. package/dist/components/ConditionalAccess/CriteriaToggleButton.esm.js.map +1 -1
  22. package/dist/components/ConditionalAccess/CustomArrayField.esm.js +32 -30
  23. package/dist/components/ConditionalAccess/CustomArrayField.esm.js.map +1 -1
  24. package/dist/components/ConditionalAccess/RulesDropdownOption.esm.js +11 -10
  25. package/dist/components/ConditionalAccess/RulesDropdownOption.esm.js.map +1 -1
  26. package/dist/components/CreateRole/AddMembersForm.esm.js +69 -59
  27. package/dist/components/CreateRole/AddMembersForm.esm.js.map +1 -1
  28. package/dist/components/CreateRole/AddedMembersTable.esm.js +3 -3
  29. package/dist/components/CreateRole/AddedMembersTable.esm.js.map +1 -1
  30. package/dist/components/CreateRole/AddedMembersTableColumn.esm.js +7 -7
  31. package/dist/components/CreateRole/AddedMembersTableColumn.esm.js.map +1 -1
  32. package/dist/components/CreateRole/CancelDialog.esm.js +73 -59
  33. package/dist/components/CreateRole/CancelDialog.esm.js.map +1 -1
  34. package/dist/components/CreateRole/CreateRolePage.esm.js +23 -20
  35. package/dist/components/CreateRole/CreateRolePage.esm.js.map +1 -1
  36. package/dist/components/CreateRole/EditRolePage.esm.js +27 -24
  37. package/dist/components/CreateRole/EditRolePage.esm.js.map +1 -1
  38. package/dist/components/CreateRole/MembersDropdownOption.esm.js +34 -24
  39. package/dist/components/CreateRole/MembersDropdownOption.esm.js.map +1 -1
  40. package/dist/components/CreateRole/PermissionPoliciesForm.esm.js +39 -26
  41. package/dist/components/CreateRole/PermissionPoliciesForm.esm.js.map +1 -1
  42. package/dist/components/CreateRole/PermissionPoliciesFormNestedRow.esm.js +107 -90
  43. package/dist/components/CreateRole/PermissionPoliciesFormNestedRow.esm.js.map +1 -1
  44. package/dist/components/CreateRole/PermissionPoliciesFormRow.esm.js +82 -72
  45. package/dist/components/CreateRole/PermissionPoliciesFormRow.esm.js.map +1 -1
  46. package/dist/components/CreateRole/PermissionPoliciesFormTable.esm.js +127 -111
  47. package/dist/components/CreateRole/PermissionPoliciesFormTable.esm.js.map +1 -1
  48. package/dist/components/CreateRole/PluginsDropdown.esm.js +6 -5
  49. package/dist/components/CreateRole/PluginsDropdown.esm.js.map +1 -1
  50. package/dist/components/CreateRole/PluginsDropdownOption.esm.js +21 -18
  51. package/dist/components/CreateRole/PluginsDropdownOption.esm.js.map +1 -1
  52. package/dist/components/CreateRole/ReviewStep.esm.js +21 -12
  53. package/dist/components/CreateRole/ReviewStep.esm.js.map +1 -1
  54. package/dist/components/CreateRole/ReviewStepTable.esm.js +18 -11
  55. package/dist/components/CreateRole/ReviewStepTable.esm.js.map +1 -1
  56. package/dist/components/CreateRole/RoleDetailsForm.esm.js +55 -53
  57. package/dist/components/CreateRole/RoleDetailsForm.esm.js.map +1 -1
  58. package/dist/components/CreateRole/RoleForm.esm.js +139 -116
  59. package/dist/components/CreateRole/RoleForm.esm.js.map +1 -1
  60. package/dist/components/DownloadUserStatistics.esm.js +5 -5
  61. package/dist/components/DownloadUserStatistics.esm.js.map +1 -1
  62. package/dist/components/EditRole.esm.js +6 -6
  63. package/dist/components/EditRole.esm.js.map +1 -1
  64. package/dist/components/RbacPage.esm.js +6 -3
  65. package/dist/components/RbacPage.esm.js.map +1 -1
  66. package/dist/components/RoleOverview/AboutCard.esm.js +46 -39
  67. package/dist/components/RoleOverview/AboutCard.esm.js.map +1 -1
  68. package/dist/components/RoleOverview/MembersCard.esm.js +36 -32
  69. package/dist/components/RoleOverview/MembersCard.esm.js.map +1 -1
  70. package/dist/components/RoleOverview/MembersListColumns.esm.js +5 -5
  71. package/dist/components/RoleOverview/MembersListColumns.esm.js.map +1 -1
  72. package/dist/components/RoleOverview/PermissionsCard.esm.js +36 -32
  73. package/dist/components/RoleOverview/PermissionsCard.esm.js.map +1 -1
  74. package/dist/components/RoleOverview/RoleOverviewPage.esm.js +39 -30
  75. package/dist/components/RoleOverview/RoleOverviewPage.esm.js.map +1 -1
  76. package/dist/components/RolesList/DeleteRole.esm.js +6 -6
  77. package/dist/components/RolesList/DeleteRole.esm.js.map +1 -1
  78. package/dist/components/RolesList/DeleteRoleDialog.esm.js +128 -92
  79. package/dist/components/RolesList/DeleteRoleDialog.esm.js.map +1 -1
  80. package/dist/components/RolesList/RolesList.esm.js +54 -46
  81. package/dist/components/RolesList/RolesList.esm.js.map +1 -1
  82. package/dist/components/RolesList/RolesListColumns.esm.js +19 -16
  83. package/dist/components/RolesList/RolesListColumns.esm.js.map +1 -1
  84. package/dist/components/RolesList/RolesListToolbar.esm.js +49 -36
  85. package/dist/components/RolesList/RolesListToolbar.esm.js.map +1 -1
  86. package/dist/components/Router.esm.js +14 -9
  87. package/dist/components/Router.esm.js.map +1 -1
  88. package/dist/components/SnackbarAlert.esm.js +5 -5
  89. package/dist/components/SnackbarAlert.esm.js.map +1 -1
  90. package/dist/components/ToastContext.esm.js +5 -4
  91. package/dist/components/ToastContext.esm.js.map +1 -1
  92. package/dist/hooks/useMembers.esm.js +2 -2
  93. package/dist/hooks/useMembers.esm.js.map +1 -1
  94. package/dist/hooks/usePermissionPolicies.esm.js +4 -4
  95. package/dist/hooks/usePermissionPolicies.esm.js.map +1 -1
  96. package/dist/hooks/useRoles.esm.js +9 -7
  97. package/dist/hooks/useRoles.esm.js.map +1 -1
  98. package/dist/index.d.ts +3 -4
  99. package/package.json +13 -13
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  ### Dependencies
2
2
 
3
+ ## 1.41.1
4
+
5
+ ### Patch Changes
6
+
7
+ - c92a50c: Fixed a bug where updating a role name via the `PUT </api/permission/roles/:kind/:namespace/:name>` endpoint did not propagate changes to metadata, permissions and conditions, leaving them mapped to the old role name.
8
+
9
+ ## 1.41.0
10
+
11
+ ### Minor Changes
12
+
13
+ - e8755f6: Backstage version bump to v1.38.1
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies [e8755f6]
18
+ - @backstage-community/plugin-rbac-common@1.16.0
19
+
3
20
  ## 1.40.1
4
21
 
5
22
  ### Patch Changes
@@ -1,4 +1,4 @@
1
- import React__default from 'react';
1
+ import { jsx } from 'react/jsx-runtime';
2
2
  import { useAsync } from 'react-use';
3
3
  import { SidebarItem } from '@backstage/core-components';
4
4
  import { useApi, configApiRef } from '@backstage/core-plugin-api';
@@ -14,7 +14,7 @@ const Administration = () => {
14
14
  const config = useApi(configApiRef);
15
15
  const isRBACPluginEnabled = config.getOptionalBoolean("permission.enabled");
16
16
  if (!isUserLoading && isRBACPluginEnabled) {
17
- return result?.status === "Authorized" ? /* @__PURE__ */ React__default.createElement(SidebarItem, { text: "RBAC", to: "rbac", icon: RbacIcon }) : null;
17
+ return result?.status === "Authorized" ? /* @__PURE__ */ jsx(SidebarItem, { text: "RBAC", to: "rbac", icon: RbacIcon }) : null;
18
18
  }
19
19
  return null;
20
20
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Administration.esm.js","sources":["../../src/components/Administration.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 { useAsync } from 'react-use';\n\nimport { SidebarItem } from '@backstage/core-components';\nimport {\n configApiRef,\n IconComponent,\n useApi,\n} from '@backstage/core-plugin-api';\n\nimport { default as RbacIcon } from '@mui/icons-material/VpnKeyOutlined';\n\nimport { rbacApiRef } from '../api/RBACBackendClient';\n\nexport const Administration = () => {\n const rbacApi = useApi(rbacApiRef);\n const { loading: isUserLoading, value: result } = useAsync(\n async () => await rbacApi.getUserAuthorization(),\n [],\n );\n\n const config = useApi(configApiRef);\n const isRBACPluginEnabled = config.getOptionalBoolean('permission.enabled');\n\n if (!isUserLoading && isRBACPluginEnabled) {\n return result?.status === 'Authorized' ? (\n <SidebarItem text=\"RBAC\" to=\"rbac\" icon={RbacIcon as IconComponent} />\n ) : null;\n }\n return null;\n};\n"],"names":["React"],"mappings":";;;;;;;AA6BO,MAAM,iBAAiB,MAAM;AAClC,EAAM,MAAA,OAAA,GAAU,OAAO,UAAU,CAAA;AACjC,EAAA,MAAM,EAAE,OAAA,EAAS,aAAe,EAAA,KAAA,EAAO,QAAW,GAAA,QAAA;AAAA,IAChD,YAAY,MAAM,OAAA,CAAQ,oBAAqB,EAAA;AAAA,IAC/C;AAAC,GACH;AAEA,EAAM,MAAA,MAAA,GAAS,OAAO,YAAY,CAAA;AAClC,EAAM,MAAA,mBAAA,GAAsB,MAAO,CAAA,kBAAA,CAAmB,oBAAoB,CAAA;AAE1E,EAAI,IAAA,CAAC,iBAAiB,mBAAqB,EAAA;AACzC,IAAO,OAAA,MAAA,EAAQ,MAAW,KAAA,YAAA,mBACvBA,cAAA,CAAA,aAAA,CAAA,WAAA,EAAA,EAAY,IAAK,EAAA,MAAA,EAAO,EAAG,EAAA,MAAA,EAAO,IAAM,EAAA,QAAA,EAA2B,CAClE,GAAA,IAAA;AAAA;AAEN,EAAO,OAAA,IAAA;AACT;;;;"}
1
+ {"version":3,"file":"Administration.esm.js","sources":["../../src/components/Administration.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 { useAsync } from 'react-use';\n\nimport { SidebarItem } from '@backstage/core-components';\nimport {\n configApiRef,\n IconComponent,\n useApi,\n} from '@backstage/core-plugin-api';\n\nimport { default as RbacIcon } from '@mui/icons-material/VpnKeyOutlined';\n\nimport { rbacApiRef } from '../api/RBACBackendClient';\n\nexport const Administration = () => {\n const rbacApi = useApi(rbacApiRef);\n const { loading: isUserLoading, value: result } = useAsync(\n async () => await rbacApi.getUserAuthorization(),\n [],\n );\n\n const config = useApi(configApiRef);\n const isRBACPluginEnabled = config.getOptionalBoolean('permission.enabled');\n\n if (!isUserLoading && isRBACPluginEnabled) {\n return result?.status === 'Authorized' ? (\n <SidebarItem text=\"RBAC\" to=\"rbac\" icon={RbacIcon as IconComponent} />\n ) : null;\n }\n return null;\n};\n"],"names":[],"mappings":";;;;;;;AA4BO,MAAM,iBAAiB,MAAM;AAClC,EAAM,MAAA,OAAA,GAAU,OAAO,UAAU,CAAA;AACjC,EAAA,MAAM,EAAE,OAAA,EAAS,aAAe,EAAA,KAAA,EAAO,QAAW,GAAA,QAAA;AAAA,IAChD,YAAY,MAAM,OAAA,CAAQ,oBAAqB,EAAA;AAAA,IAC/C;AAAC,GACH;AAEA,EAAM,MAAA,MAAA,GAAS,OAAO,YAAY,CAAA;AAClC,EAAM,MAAA,mBAAA,GAAsB,MAAO,CAAA,kBAAA,CAAmB,oBAAoB,CAAA;AAE1E,EAAI,IAAA,CAAC,iBAAiB,mBAAqB,EAAA;AACzC,IAAO,OAAA,MAAA,EAAQ,MAAW,KAAA,YAAA,mBACvB,GAAA,CAAA,WAAA,EAAA,EAAY,IAAK,EAAA,MAAA,EAAO,EAAG,EAAA,MAAA,EAAO,IAAM,EAAA,QAAA,EAA2B,CAClE,GAAA,IAAA;AAAA;AAEN,EAAO,OAAA,IAAA;AACT;;;;"}
@@ -1,22 +1,31 @@
1
- import React__default from 'react';
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import HelpOutlineIcon from '@mui/icons-material/HelpOutline';
3
3
  import Box from '@mui/material/Box';
4
4
  import Tooltip from '@mui/material/Tooltip';
5
5
  import Typography from '@mui/material/Typography';
6
6
 
7
- const tooltipTitle = () => /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement(Typography, { variant: "body1", component: "p", align: "center" }, "Nested conditions are ", /* @__PURE__ */ React__default.createElement("b", null, "1 layer rules within a main condition"), ". It lets you allow appropriate access by using detailed permissions based on various conditions. You can add multiple nested conditions."), /* @__PURE__ */ React__default.createElement(Typography, { variant: "body1", component: "p", align: "center" }, "For example, you can allow access to all entity types in the main condition and use a nested condition to limit the access to entities owned by the user."));
7
+ const tooltipTitle = () => /* @__PURE__ */ jsxs("div", { children: [
8
+ /* @__PURE__ */ jsxs(Typography, { variant: "body1", component: "p", align: "center", children: [
9
+ "Nested conditions are ",
10
+ /* @__PURE__ */ jsx("b", { children: "1 layer rules within a main condition" }),
11
+ ". It lets you allow appropriate access by using detailed permissions based on various conditions. You can add multiple nested conditions."
12
+ ] }),
13
+ /* @__PURE__ */ jsx(Typography, { variant: "body1", component: "p", align: "center", children: "For example, you can allow access to all entity types in the main condition and use a nested condition to limit the access to entities owned by the user." })
14
+ ] });
8
15
  const AddNestedConditionButton = () => {
9
- return /* @__PURE__ */ React__default.createElement(
16
+ return /* @__PURE__ */ jsxs(
10
17
  Box,
11
18
  {
12
19
  sx: {
13
20
  display: "flex",
14
21
  justifyContent: "center",
15
22
  alignItems: "center"
16
- }
17
- },
18
- /* @__PURE__ */ React__default.createElement(Typography, { variant: "body1", component: "span" }, "Add Nested Condition"),
19
- /* @__PURE__ */ React__default.createElement(Tooltip, { title: tooltipTitle(), placement: "top" }, /* @__PURE__ */ React__default.createElement(HelpOutlineIcon, { fontSize: "inherit", style: { marginLeft: "0.25rem" } }))
23
+ },
24
+ children: [
25
+ /* @__PURE__ */ jsx(Typography, { variant: "body1", component: "span", children: "Add Nested Condition" }),
26
+ /* @__PURE__ */ jsx(Tooltip, { title: tooltipTitle(), placement: "top", children: /* @__PURE__ */ jsx(HelpOutlineIcon, { fontSize: "inherit", style: { marginLeft: "0.25rem" } }) })
27
+ ]
28
+ }
20
29
  );
21
30
  };
22
31
 
@@ -1 +1 @@
1
- {"version":3,"file":"AddNestedConditionButton.esm.js","sources":["../../../src/components/ConditionalAccess/AddNestedConditionButton.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 HelpOutlineIcon from '@mui/icons-material/HelpOutline';\nimport Box from '@mui/material/Box';\nimport Tooltip from '@mui/material/Tooltip';\nimport Typography from '@mui/material/Typography';\n\nexport const tooltipTitle = () => (\n <div>\n <Typography variant=\"body1\" component=\"p\" align=\"center\">\n Nested conditions are <b>1 layer rules within a main condition</b>. It\n lets you allow appropriate access by using detailed permissions based on\n various conditions. You can add multiple nested conditions.\n </Typography>\n <Typography variant=\"body1\" component=\"p\" align=\"center\">\n For example, you can allow access to all entity types in the main\n condition and use a nested condition to limit the access to entities owned\n by the user.\n </Typography>\n </div>\n);\n\nexport const AddNestedConditionButton = () => {\n return (\n <Box\n sx={{\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n }}\n >\n <Typography variant=\"body1\" component=\"span\">\n Add Nested Condition\n </Typography>\n <Tooltip title={tooltipTitle()} placement=\"top\">\n <HelpOutlineIcon fontSize=\"inherit\" style={{ marginLeft: '0.25rem' }} />\n </Tooltip>\n </Box>\n );\n};\n"],"names":["React"],"mappings":";;;;;;AAsBO,MAAM,YAAe,GAAA,sBACzBA,cAAA,CAAA,aAAA,CAAA,KAAA,EAAA,IAAA,kBACEA,cAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,OAAA,EAAQ,SAAU,EAAA,GAAA,EAAI,KAAM,EAAA,QAAA,EAAA,EAAS,wBACjC,kBAAAA,cAAA,CAAA,aAAA,CAAC,GAAE,EAAA,IAAA,EAAA,uCAAqC,CAAI,EAAA,2IAGpE,CACA,kBAAAA,cAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,OAAQ,EAAA,SAAA,EAAU,GAAI,EAAA,KAAA,EAAM,QAAS,EAAA,EAAA,2JAIzD,CACF;AAGK,MAAM,2BAA2B,MAAM;AAC5C,EACE,uBAAAA,cAAA,CAAA,aAAA;AAAA,IAAC,GAAA;AAAA,IAAA;AAAA,MACC,EAAI,EAAA;AAAA,QACF,OAAS,EAAA,MAAA;AAAA,QACT,cAAgB,EAAA,QAAA;AAAA,QAChB,UAAY,EAAA;AAAA;AACd,KAAA;AAAA,iDAEC,UAAW,EAAA,EAAA,OAAA,EAAQ,OAAQ,EAAA,SAAA,EAAU,UAAO,sBAE7C,CAAA;AAAA,iDACC,OAAQ,EAAA,EAAA,KAAA,EAAO,YAAa,EAAA,EAAG,WAAU,KACxC,EAAA,kBAAAA,cAAA,CAAA,aAAA,CAAC,eAAgB,EAAA,EAAA,QAAA,EAAS,WAAU,KAAO,EAAA,EAAE,UAAY,EAAA,SAAA,IAAa,CACxE;AAAA,GACF;AAEJ;;;;"}
1
+ {"version":3,"file":"AddNestedConditionButton.esm.js","sources":["../../../src/components/ConditionalAccess/AddNestedConditionButton.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 HelpOutlineIcon from '@mui/icons-material/HelpOutline';\nimport Box from '@mui/material/Box';\nimport Tooltip from '@mui/material/Tooltip';\nimport Typography from '@mui/material/Typography';\n\nexport const tooltipTitle = () => (\n <div>\n <Typography variant=\"body1\" component=\"p\" align=\"center\">\n Nested conditions are <b>1 layer rules within a main condition</b>. It\n lets you allow appropriate access by using detailed permissions based on\n various conditions. You can add multiple nested conditions.\n </Typography>\n <Typography variant=\"body1\" component=\"p\" align=\"center\">\n For example, you can allow access to all entity types in the main\n condition and use a nested condition to limit the access to entities owned\n by the user.\n </Typography>\n </div>\n);\n\nexport const AddNestedConditionButton = () => {\n return (\n <Box\n sx={{\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n }}\n >\n <Typography variant=\"body1\" component=\"span\">\n Add Nested Condition\n </Typography>\n <Tooltip title={tooltipTitle()} placement=\"top\">\n <HelpOutlineIcon fontSize=\"inherit\" style={{ marginLeft: '0.25rem' }} />\n </Tooltip>\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;AAoBa,MAAA,YAAA,GAAe,sBAC1B,IAAA,CAAC,KACC,EAAA,EAAA,QAAA,EAAA;AAAA,kBAAA,IAAA,CAAC,cAAW,OAAQ,EAAA,OAAA,EAAQ,SAAU,EAAA,GAAA,EAAI,OAAM,QAAS,EAAA,QAAA,EAAA;AAAA,IAAA,wBAAA;AAAA,oBACjC,GAAA,CAAC,OAAE,QAAqC,EAAA,uCAAA,EAAA,CAAA;AAAA,IAAI;AAAA,GAGpE,EAAA,CAAA;AAAA,kBACA,GAAA,CAAC,cAAW,OAAQ,EAAA,OAAA,EAAQ,WAAU,GAAI,EAAA,KAAA,EAAM,UAAS,QAIzD,EAAA,2JAAA,EAAA;AAAA,CACF,EAAA;AAGK,MAAM,2BAA2B,MAAM;AAC5C,EACE,uBAAA,IAAA;AAAA,IAAC,GAAA;AAAA,IAAA;AAAA,MACC,EAAI,EAAA;AAAA,QACF,OAAS,EAAA,MAAA;AAAA,QACT,cAAgB,EAAA,QAAA;AAAA,QAChB,UAAY,EAAA;AAAA,OACd;AAAA,MAEA,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,OAAQ,EAAA,SAAA,EAAU,QAAO,QAE7C,EAAA,sBAAA,EAAA,CAAA;AAAA,4BACC,OAAQ,EAAA,EAAA,KAAA,EAAO,YAAa,EAAA,EAAG,WAAU,KACxC,EAAA,QAAA,kBAAA,GAAA,CAAC,eAAgB,EAAA,EAAA,QAAA,EAAS,WAAU,KAAO,EAAA,EAAE,UAAY,EAAA,SAAA,IAAa,CACxE,EAAA;AAAA;AAAA;AAAA,GACF;AAEJ;;;;"}
@@ -1,4 +1,4 @@
1
- import React__default from 'react';
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import RemoveIcon from '@mui/icons-material/Remove';
3
3
  import IconButton from '@mui/material/IconButton';
4
4
  import { isSimpleRule, getRowStyle, getRowKey, getSimpleRuleErrors, getNestedRuleErrors } from '../../utils/conditional-access-utils.esm.js';
@@ -105,47 +105,49 @@ const ComplexConditionRow = ({
105
105
  );
106
106
  const disabled = !isNestedCondition && conditionRow[criteria].length === 1 && nestedConditionRow.length === 0 && ruleIndex === 0;
107
107
  const nestedDisabled = isNestedCondition && nestedConditionRow[nestedConditionIndex ?? 0][activeNestedCriteria].length === 1 && ruleIndex === 0;
108
- return currentCondition.resourceType && /* @__PURE__ */ React__default.createElement(
108
+ return currentCondition.resourceType && /* @__PURE__ */ jsxs(
109
109
  "div",
110
110
  {
111
111
  style: getRowStyle(currentCondition, isNestedCondition),
112
- key: getRowKey(isNestedCondition, ruleIndex)
112
+ children: [
113
+ /* @__PURE__ */ jsx(
114
+ ConditionsFormRowFields,
115
+ {
116
+ oldCondition: currentCondition,
117
+ index: isNestedCondition ? undefined : ruleIndex,
118
+ onRuleChange,
119
+ conditionRow,
120
+ criteria,
121
+ conditionRulesData,
122
+ setErrors,
123
+ setRemoveAllClicked,
124
+ nestedConditionRow: isNestedCondition ? nestedConditionRow : undefined,
125
+ nestedConditionCriteria: isNestedCondition ? activeNestedCriteria : undefined,
126
+ nestedConditionIndex: isNestedCondition ? nestedConditionIndex : undefined,
127
+ nestedConditionRuleIndex: isNestedCondition ? ruleIndex : undefined,
128
+ updateRules: isNestedCondition ? updateRules : undefined
129
+ }
130
+ ),
131
+ /* @__PURE__ */ jsx(
132
+ IconButton,
133
+ {
134
+ title: "Remove",
135
+ sx: {
136
+ color: (theme) => theme.palette.grey[500],
137
+ flexGrow: 0,
138
+ alignSelf: "baseline",
139
+ marginTop: (theme) => theme.spacing(3.3)
140
+ },
141
+ disabled: isNestedCondition ? nestedDisabled : disabled,
142
+ onClick: isNestedCondition && activeNestedCriteria && nestedConditionIndex !== undefined ? () => handleRemoveNestedConditionRule(activeNestedCriteria) : () => {
143
+ handleRemoveSimpleConditionRule(ruleIndex, ruleList);
144
+ },
145
+ children: /* @__PURE__ */ jsx(RemoveIcon, {})
146
+ }
147
+ )
148
+ ]
113
149
  },
114
- /* @__PURE__ */ React__default.createElement(
115
- ConditionsFormRowFields,
116
- {
117
- oldCondition: currentCondition,
118
- index: isNestedCondition ? undefined : ruleIndex,
119
- onRuleChange,
120
- conditionRow,
121
- criteria,
122
- conditionRulesData,
123
- setErrors,
124
- setRemoveAllClicked,
125
- nestedConditionRow: isNestedCondition ? nestedConditionRow : undefined,
126
- nestedConditionCriteria: isNestedCondition ? activeNestedCriteria : undefined,
127
- nestedConditionIndex: isNestedCondition ? nestedConditionIndex : undefined,
128
- nestedConditionRuleIndex: isNestedCondition ? ruleIndex : undefined,
129
- updateRules: isNestedCondition ? updateRules : undefined
130
- }
131
- ),
132
- /* @__PURE__ */ React__default.createElement(
133
- IconButton,
134
- {
135
- title: "Remove",
136
- sx: {
137
- color: (theme) => theme.palette.grey[500],
138
- flexGrow: 0,
139
- alignSelf: "baseline",
140
- marginTop: (theme) => theme.spacing(3.3)
141
- },
142
- disabled: isNestedCondition ? nestedDisabled : disabled,
143
- onClick: isNestedCondition && activeNestedCriteria && nestedConditionIndex !== undefined ? () => handleRemoveNestedConditionRule(activeNestedCriteria) : () => {
144
- handleRemoveSimpleConditionRule(ruleIndex, ruleList);
145
- }
146
- },
147
- /* @__PURE__ */ React__default.createElement(RemoveIcon, null)
148
- )
150
+ getRowKey(isNestedCondition, ruleIndex)
149
151
  );
150
152
  };
151
153
 
@@ -1 +1 @@
1
- {"version":3,"file":"ComplexConditionRow.esm.js","sources":["../../../src/components/ConditionalAccess/ComplexConditionRow.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 { PermissionCondition } from '@backstage/plugin-permission-common';\n\nimport RemoveIcon from '@mui/icons-material/Remove';\nimport IconButton from '@mui/material/IconButton';\n\nimport {\n getNestedRuleErrors,\n getRowKey,\n getRowStyle,\n getSimpleRuleErrors,\n isSimpleRule,\n} from '../../utils/conditional-access-utils';\nimport { ConditionsFormRowFields } from './ConditionsFormRowFields';\nimport { criterias } from './const';\nimport {\n AccessConditionsErrors,\n ComplexErrors,\n Condition,\n ConditionsData,\n NestedCriteriaErrors,\n NotConditionType,\n RulesData,\n} from './types';\n\ntype ComplexConditionRowProps = {\n conditionRow: ConditionsData;\n nestedConditionRow: Condition[];\n criteria: keyof ConditionsData;\n onRuleChange: (newCondition: ConditionsData) => void;\n updateRules: (updatedNestedConditionRow: Condition[] | Condition) => void;\n setErrors: React.Dispatch<\n React.SetStateAction<AccessConditionsErrors | undefined>\n >;\n setRemoveAllClicked: React.Dispatch<React.SetStateAction<boolean>>;\n conditionRulesData?: RulesData;\n notConditionType?: NotConditionType;\n currentCondition: Condition;\n ruleIndex: number;\n activeCriteria?: 'allOf' | 'anyOf';\n isNestedCondition?: boolean;\n nestedConditionIndex?: number;\n activeNestedCriteria?: 'allOf' | 'anyOf';\n};\n\nexport const ComplexConditionRow = ({\n conditionRow,\n nestedConditionRow,\n criteria,\n onRuleChange,\n updateRules,\n setErrors,\n setRemoveAllClicked,\n conditionRulesData,\n notConditionType,\n currentCondition,\n ruleIndex,\n activeCriteria,\n isNestedCondition = false,\n nestedConditionIndex,\n activeNestedCriteria,\n}: ComplexConditionRowProps) => {\n const handleRemoveSimpleConditionRule = (\n index: number,\n ruleList: PermissionCondition[],\n ) => {\n if (!activeCriteria) {\n return;\n }\n const updatedSimpleRules = ruleList.filter(\n (_r, rindex) => index !== rindex,\n );\n const nestedConditions =\n (conditionRow[criteria] as PermissionCondition[])?.filter(\n (con: PermissionCondition) =>\n criterias.allOf in con ||\n criterias.anyOf in con ||\n criterias.not in con,\n ) || [];\n\n onRuleChange({\n [activeCriteria as keyof ConditionsData]: [\n ...updatedSimpleRules,\n ...nestedConditions,\n ],\n });\n\n setErrors(prevErrors => {\n const updatedErrors = { ...prevErrors };\n\n if (updatedErrors[activeCriteria]) {\n const criteriaErrors = updatedErrors[activeCriteria] as ComplexErrors[];\n const simpleRuleErrors = getSimpleRuleErrors(criteriaErrors);\n\n if (Array.isArray(simpleRuleErrors) && simpleRuleErrors.length > 0) {\n const updatedCriteriaErrors = [\n ...simpleRuleErrors.filter((_, rindex) => rindex !== index),\n ...getNestedRuleErrors(criteriaErrors),\n ];\n\n updatedErrors[activeCriteria] =\n updatedCriteriaErrors.length > 0 ? updatedCriteriaErrors : [];\n } else {\n delete updatedErrors[activeCriteria];\n }\n }\n\n return updatedErrors;\n });\n };\n\n const handleRemoveNestedConditionRule = (nestedConditionCriteria: string) => {\n const updatedNestedConditionRow: Condition[] = [];\n\n nestedConditionRow.forEach((c, index) => {\n if (index === nestedConditionIndex) {\n const updatedRules = (\n (c[\n nestedConditionCriteria as keyof Condition\n ] as PermissionCondition[]) || []\n ).filter((_r, rindex) => rindex !== ruleIndex);\n updatedNestedConditionRow.push({\n [nestedConditionCriteria as keyof Condition]: updatedRules,\n });\n } else {\n updatedNestedConditionRow.push(c);\n }\n });\n\n updateRules(\n criteria === criterias.not\n ? updatedNestedConditionRow[0]\n : updatedNestedConditionRow,\n );\n\n setErrors(prevErrors => {\n const updatedErrors = { ...prevErrors };\n\n if (updatedErrors[criteria] !== undefined) {\n const criteriaErrors = updatedErrors[criteria] as ComplexErrors[];\n\n if (\n criteria === criterias.not &&\n notConditionType === 'nested-condition'\n ) {\n (\n (updatedErrors[criteria] as NestedCriteriaErrors)[\n nestedConditionCriteria\n ] as string[]\n ).splice(ruleIndex, 1);\n return updatedErrors;\n }\n\n const nestedConditionErrors = getNestedRuleErrors(criteriaErrors);\n\n if (\n Array.isArray(nestedConditionErrors) &&\n nestedConditionIndex !== undefined\n ) {\n const nestedErrors = nestedConditionErrors[nestedConditionIndex];\n if (nestedErrors[nestedConditionCriteria]) {\n const updatedNestedErrors = (\n nestedErrors[nestedConditionCriteria] as string[]\n ).filter((_error, index) => index !== ruleIndex);\n\n if (updatedNestedErrors.length > 0) {\n nestedErrors[nestedConditionCriteria] = updatedNestedErrors;\n } else {\n delete nestedErrors[nestedConditionCriteria];\n }\n\n nestedConditionErrors[nestedConditionIndex] = nestedErrors;\n }\n\n updatedErrors[criteria] = [\n ...getSimpleRuleErrors(criteriaErrors),\n ...nestedConditionErrors,\n ];\n }\n }\n\n return updatedErrors;\n });\n };\n\n const ruleList = isNestedCondition\n ? (currentCondition[\n activeCriteria as keyof Condition\n ] as PermissionCondition[])\n : ((conditionRow[activeCriteria as keyof Condition] as Condition[]).filter(\n r => isSimpleRule(r),\n ) as PermissionCondition[]);\n\n const disabled =\n !isNestedCondition &&\n (conditionRow[criteria as keyof Condition] as Condition[]).length === 1 &&\n nestedConditionRow.length === 0 &&\n ruleIndex === 0;\n const nestedDisabled =\n isNestedCondition &&\n (\n nestedConditionRow[nestedConditionIndex ?? 0][\n activeNestedCriteria as keyof Condition\n ] as Condition[]\n ).length === 1 &&\n ruleIndex === 0;\n\n return (\n (currentCondition as PermissionCondition).resourceType && (\n <div\n style={getRowStyle(currentCondition, isNestedCondition)}\n key={getRowKey(isNestedCondition, ruleIndex)}\n >\n <ConditionsFormRowFields\n oldCondition={currentCondition}\n index={isNestedCondition ? undefined : ruleIndex}\n onRuleChange={onRuleChange}\n conditionRow={conditionRow}\n criteria={criteria}\n conditionRulesData={conditionRulesData}\n setErrors={setErrors}\n setRemoveAllClicked={setRemoveAllClicked}\n nestedConditionRow={\n isNestedCondition ? nestedConditionRow : undefined\n }\n nestedConditionCriteria={\n isNestedCondition ? activeNestedCriteria : undefined\n }\n nestedConditionIndex={\n isNestedCondition ? nestedConditionIndex : undefined\n }\n nestedConditionRuleIndex={isNestedCondition ? ruleIndex : undefined}\n updateRules={isNestedCondition ? updateRules : undefined}\n />\n <IconButton\n title=\"Remove\"\n sx={{\n color: theme => theme.palette.grey[500],\n flexGrow: 0,\n alignSelf: 'baseline',\n marginTop: theme => theme.spacing(3.3),\n }}\n disabled={isNestedCondition ? nestedDisabled : disabled}\n onClick={\n isNestedCondition &&\n activeNestedCriteria &&\n nestedConditionIndex !== undefined\n ? () => handleRemoveNestedConditionRule(activeNestedCriteria)\n : () => {\n handleRemoveSimpleConditionRule(ruleIndex, ruleList);\n }\n }\n >\n <RemoveIcon />\n </IconButton>\n </div>\n )\n );\n};\n"],"names":["ruleList","React"],"mappings":";;;;;;;AA6DO,MAAM,sBAAsB,CAAC;AAAA,EAClC,YAAA;AAAA,EACA,kBAAA;AAAA,EACA,QAAA;AAAA,EACA,YAAA;AAAA,EACA,WAAA;AAAA,EACA,SAAA;AAAA,EACA,mBAAA;AAAA,EACA,kBAAA;AAAA,EACA,gBAAA;AAAA,EACA,gBAAA;AAAA,EACA,SAAA;AAAA,EACA,cAAA;AAAA,EACA,iBAAoB,GAAA,KAAA;AAAA,EACpB,oBAAA;AAAA,EACA;AACF,CAAgC,KAAA;AAC9B,EAAM,MAAA,+BAAA,GAAkC,CACtC,KAAA,EACAA,SACG,KAAA;AACH,IAAA,IAAI,CAAC,cAAgB,EAAA;AACnB,MAAA;AAAA;AAEF,IAAA,MAAM,qBAAqBA,SAAS,CAAA,MAAA;AAAA,MAClC,CAAC,EAAI,EAAA,MAAA,KAA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,YAAA;AAAA,QACA,YAAA;AAAA,QACA,QAAA;AAAA,QACA,kBAAA;AAAA,QACA,SAAA;AAAA,QACA,mBAAA;AAAA,QACA,kBAAA,EACE,oBAAoB,kBAAqB,GAAA,SAAA;AAAA,QAE3C,uBAAA,EACE,oBAAoB,oBAAuB,GAAA,SAAA;AAAA,QAE7C,oBAAA,EACE,oBAAoB,oBAAuB,GAAA,SAAA;AAAA,QAE7C,wBAAA,EAA0B,oBAAoB,SAAY,GAAA,SAAA;AAAA,QAC1D,WAAA,EAAa,oBAAoB,WAAc,GAAA;AAAA;AAAA,KACjD;AAAA,oBACAA,cAAA,CAAA,aAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,KAAM,EAAA,QAAA;AAAA,QACN,EAAI,EAAA;AAAA,UACF,KAAO,EAAA,CAAA,KAAA,KAAS,KAAM,CAAA,OAAA,CAAQ,KAAK,GAAG,CAAA;AAAA,UACtC,QAAU,EAAA,CAAA;AAAA,UACV,SAAW,EAAA,UAAA;AAAA,UACX,SAAW,EAAA,CAAA,KAAA,KAAS,KAAM,CAAA,OAAA,CAAQ,GAAG;AAAA,SACvC;AAAA,QACA,QAAA,EAAU,oBAAoB,cAAiB,GAAA,QAAA;AAAA,QAC/C,OAAA,EACE,qBACA,oBACA,IAAA,oBAAA,KAAyB,YACrB,MAAM,+BAAA,CAAgC,oBAAoB,CAAA,GAC1D,MAAM;AACJ,UAAA,+BAAA,CAAgC,WAAW,QAAQ,CAAA;AAAA;AACrD,OAAA;AAAA,mDAGL,UAAW,EAAA,IAAA;AAAA;AACd,GACF;AAGN;;;;"}
1
+ {"version":3,"file":"ComplexConditionRow.esm.js","sources":["../../../src/components/ConditionalAccess/ComplexConditionRow.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 type { SetStateAction, Dispatch } from 'react';\n\nimport { PermissionCondition } from '@backstage/plugin-permission-common';\n\nimport RemoveIcon from '@mui/icons-material/Remove';\nimport IconButton from '@mui/material/IconButton';\n\nimport {\n getNestedRuleErrors,\n getRowKey,\n getRowStyle,\n getSimpleRuleErrors,\n isSimpleRule,\n} from '../../utils/conditional-access-utils';\nimport { ConditionsFormRowFields } from './ConditionsFormRowFields';\nimport { criterias } from './const';\nimport {\n AccessConditionsErrors,\n ComplexErrors,\n Condition,\n ConditionsData,\n NestedCriteriaErrors,\n NotConditionType,\n RulesData,\n} from './types';\n\ntype ComplexConditionRowProps = {\n conditionRow: ConditionsData;\n nestedConditionRow: Condition[];\n criteria: keyof ConditionsData;\n onRuleChange: (newCondition: ConditionsData) => void;\n updateRules: (updatedNestedConditionRow: Condition[] | Condition) => void;\n setErrors: Dispatch<SetStateAction<AccessConditionsErrors | undefined>>;\n setRemoveAllClicked: Dispatch<SetStateAction<boolean>>;\n conditionRulesData?: RulesData;\n notConditionType?: NotConditionType;\n currentCondition: Condition;\n ruleIndex: number;\n activeCriteria?: 'allOf' | 'anyOf';\n isNestedCondition?: boolean;\n nestedConditionIndex?: number;\n activeNestedCriteria?: 'allOf' | 'anyOf';\n};\n\nexport const ComplexConditionRow = ({\n conditionRow,\n nestedConditionRow,\n criteria,\n onRuleChange,\n updateRules,\n setErrors,\n setRemoveAllClicked,\n conditionRulesData,\n notConditionType,\n currentCondition,\n ruleIndex,\n activeCriteria,\n isNestedCondition = false,\n nestedConditionIndex,\n activeNestedCriteria,\n}: ComplexConditionRowProps) => {\n const handleRemoveSimpleConditionRule = (\n index: number,\n ruleList: PermissionCondition[],\n ) => {\n if (!activeCriteria) {\n return;\n }\n const updatedSimpleRules = ruleList.filter(\n (_r, rindex) => index !== rindex,\n );\n const nestedConditions =\n (conditionRow[criteria] as PermissionCondition[])?.filter(\n (con: PermissionCondition) =>\n criterias.allOf in con ||\n criterias.anyOf in con ||\n criterias.not in con,\n ) || [];\n\n onRuleChange({\n [activeCriteria as keyof ConditionsData]: [\n ...updatedSimpleRules,\n ...nestedConditions,\n ],\n });\n\n setErrors(prevErrors => {\n const updatedErrors = { ...prevErrors };\n\n if (updatedErrors[activeCriteria]) {\n const criteriaErrors = updatedErrors[activeCriteria] as ComplexErrors[];\n const simpleRuleErrors = getSimpleRuleErrors(criteriaErrors);\n\n if (Array.isArray(simpleRuleErrors) && simpleRuleErrors.length > 0) {\n const updatedCriteriaErrors = [\n ...simpleRuleErrors.filter((_, rindex) => rindex !== index),\n ...getNestedRuleErrors(criteriaErrors),\n ];\n\n updatedErrors[activeCriteria] =\n updatedCriteriaErrors.length > 0 ? updatedCriteriaErrors : [];\n } else {\n delete updatedErrors[activeCriteria];\n }\n }\n\n return updatedErrors;\n });\n };\n\n const handleRemoveNestedConditionRule = (nestedConditionCriteria: string) => {\n const updatedNestedConditionRow: Condition[] = [];\n\n nestedConditionRow.forEach((c, index) => {\n if (index === nestedConditionIndex) {\n const updatedRules = (\n (c[\n nestedConditionCriteria as keyof Condition\n ] as PermissionCondition[]) || []\n ).filter((_r, rindex) => rindex !== ruleIndex);\n updatedNestedConditionRow.push({\n [nestedConditionCriteria as keyof Condition]: updatedRules,\n });\n } else {\n updatedNestedConditionRow.push(c);\n }\n });\n\n updateRules(\n criteria === criterias.not\n ? updatedNestedConditionRow[0]\n : updatedNestedConditionRow,\n );\n\n setErrors(prevErrors => {\n const updatedErrors = { ...prevErrors };\n\n if (updatedErrors[criteria] !== undefined) {\n const criteriaErrors = updatedErrors[criteria] as ComplexErrors[];\n\n if (\n criteria === criterias.not &&\n notConditionType === 'nested-condition'\n ) {\n (\n (updatedErrors[criteria] as NestedCriteriaErrors)[\n nestedConditionCriteria\n ] as string[]\n ).splice(ruleIndex, 1);\n return updatedErrors;\n }\n\n const nestedConditionErrors = getNestedRuleErrors(criteriaErrors);\n\n if (\n Array.isArray(nestedConditionErrors) &&\n nestedConditionIndex !== undefined\n ) {\n const nestedErrors = nestedConditionErrors[nestedConditionIndex];\n if (nestedErrors[nestedConditionCriteria]) {\n const updatedNestedErrors = (\n nestedErrors[nestedConditionCriteria] as string[]\n ).filter((_error, index) => index !== ruleIndex);\n\n if (updatedNestedErrors.length > 0) {\n nestedErrors[nestedConditionCriteria] = updatedNestedErrors;\n } else {\n delete nestedErrors[nestedConditionCriteria];\n }\n\n nestedConditionErrors[nestedConditionIndex] = nestedErrors;\n }\n\n updatedErrors[criteria] = [\n ...getSimpleRuleErrors(criteriaErrors),\n ...nestedConditionErrors,\n ];\n }\n }\n\n return updatedErrors;\n });\n };\n\n const ruleList = isNestedCondition\n ? (currentCondition[\n activeCriteria as keyof Condition\n ] as PermissionCondition[])\n : ((conditionRow[activeCriteria as keyof Condition] as Condition[]).filter(\n r => isSimpleRule(r),\n ) as PermissionCondition[]);\n\n const disabled =\n !isNestedCondition &&\n (conditionRow[criteria as keyof Condition] as Condition[]).length === 1 &&\n nestedConditionRow.length === 0 &&\n ruleIndex === 0;\n const nestedDisabled =\n isNestedCondition &&\n (\n nestedConditionRow[nestedConditionIndex ?? 0][\n activeNestedCriteria as keyof Condition\n ] as Condition[]\n ).length === 1 &&\n ruleIndex === 0;\n\n return (\n (currentCondition as PermissionCondition).resourceType && (\n <div\n style={getRowStyle(currentCondition, isNestedCondition)}\n key={getRowKey(isNestedCondition, ruleIndex)}\n >\n <ConditionsFormRowFields\n oldCondition={currentCondition}\n index={isNestedCondition ? undefined : ruleIndex}\n onRuleChange={onRuleChange}\n conditionRow={conditionRow}\n criteria={criteria}\n conditionRulesData={conditionRulesData}\n setErrors={setErrors}\n setRemoveAllClicked={setRemoveAllClicked}\n nestedConditionRow={\n isNestedCondition ? nestedConditionRow : undefined\n }\n nestedConditionCriteria={\n isNestedCondition ? activeNestedCriteria : undefined\n }\n nestedConditionIndex={\n isNestedCondition ? nestedConditionIndex : undefined\n }\n nestedConditionRuleIndex={isNestedCondition ? ruleIndex : undefined}\n updateRules={isNestedCondition ? updateRules : undefined}\n />\n <IconButton\n title=\"Remove\"\n sx={{\n color: theme => theme.palette.grey[500],\n flexGrow: 0,\n alignSelf: 'baseline',\n marginTop: theme => theme.spacing(3.3),\n }}\n disabled={isNestedCondition ? nestedDisabled : disabled}\n onClick={\n isNestedCondition &&\n activeNestedCriteria &&\n nestedConditionIndex !== undefined\n ? () => handleRemoveNestedConditionRule(activeNestedCriteria)\n : () => {\n handleRemoveSimpleConditionRule(ruleIndex, ruleList);\n }\n }\n >\n <RemoveIcon />\n </IconButton>\n </div>\n )\n );\n};\n"],"names":["ruleList"],"mappings":";;;;;;;AA2DO,MAAM,sBAAsB,CAAC;AAAA,EAClC,YAAA;AAAA,EACA,kBAAA;AAAA,EACA,QAAA;AAAA,EACA,YAAA;AAAA,EACA,WAAA;AAAA,EACA,SAAA;AAAA,EACA,mBAAA;AAAA,EACA,kBAAA;AAAA,EACA,gBAAA;AAAA,EACA,gBAAA;AAAA,EACA,SAAA;AAAA,EACA,cAAA;AAAA,EACA,iBAAoB,GAAA,KAAA;AAAA,EACpB,oBAAA;AAAA,EACA;AACF,CAAgC,KAAA;AAC9B,EAAM,MAAA,+BAAA,GAAkC,CACtC,KAAA,EACAA,SACG,KAAA;AACH,IAAA,IAAI,CAAC,cAAgB,EAAA;AACnB,MAAA;AAAA;AAEF,IAAA,MAAM,qBAAqBA,SAAS,CAAA,MAAA;AAAA,MAClC,CAAC,EAAI,EAAA,MAAA,KAAW,KAAU,KAAA;AAAA,KAC5B;AACA,IAAM,MAAA,gBAAA,GACH,YAAa,CAAA,QAAQ,CAA6B,EAAA,MAAA;AAAA,MACjD,CAAC,QACC,SAAU,CAAA,KAAA,IAAS,OACnB,SAAU,CAAA,KAAA,IAAS,GACnB,IAAA,SAAA,CAAU,GAAO,IAAA;AAAA,SACh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,SAAY,GAAA,SAAA;AAAA,YAC1D,WAAA,EAAa,oBAAoB,WAAc,GAAA;AAAA;AAAA,SACjD;AAAA,wBACA,GAAA;AAAA,UAAC,UAAA;AAAA,UAAA;AAAA,YACC,KAAM,EAAA,QAAA;AAAA,YACN,EAAI,EAAA;AAAA,cACF,KAAO,EAAA,CAAA,KAAA,KAAS,KAAM,CAAA,OAAA,CAAQ,KAAK,GAAG,CAAA;AAAA,cACtC,QAAU,EAAA,CAAA;AAAA,cACV,SAAW,EAAA,UAAA;AAAA,cACX,SAAW,EAAA,CAAA,KAAA,KAAS,KAAM,CAAA,OAAA,CAAQ,GAAG;AAAA,aACvC;AAAA,YACA,QAAA,EAAU,oBAAoB,cAAiB,GAAA,QAAA;AAAA,YAC/C,OAAA,EACE,qBACA,oBACA,IAAA,oBAAA,KAAyB,YACrB,MAAM,+BAAA,CAAgC,oBAAoB,CAAA,GAC1D,MAAM;AACJ,cAAA,+BAAA,CAAgC,WAAW,QAAQ,CAAA;AAAA,aACrD;AAAA,YAGN,8BAAC,UAAW,EAAA,EAAA;AAAA;AAAA;AACd;AAAA,KAAA;AAAA,IA3CK,SAAA,CAAU,mBAAmB,SAAS;AAAA,GA4C7C;AAGN;;;;"}
@@ -1,4 +1,4 @@
1
- import React__default from 'react';
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import AddIcon from '@mui/icons-material/Add';
3
3
  import HelpOutlineIcon from '@mui/icons-material/HelpOutline';
4
4
  import Box from '@mui/material/Box';
@@ -38,7 +38,7 @@ const ComplexConditionRowButtons = ({
38
38
  onRuleChange({ [criteria]: [...updatedRules] });
39
39
  updateErrors(firstNestedConditionIndex);
40
40
  };
41
- return (criteria === criterias.allOf || criteria === criterias.anyOf) && /* @__PURE__ */ React__default.createElement(
41
+ return (criteria === criterias.allOf || criteria === criterias.anyOf) && /* @__PURE__ */ jsxs(
42
42
  Box,
43
43
  {
44
44
  mt: 1,
@@ -47,39 +47,41 @@ const ComplexConditionRowButtons = ({
47
47
  display: "flex",
48
48
  flexDirection: "column",
49
49
  alignItems: "flex-start"
50
- }
51
- },
52
- /* @__PURE__ */ React__default.createElement(
53
- Button,
54
- {
55
- sx: {
56
- color: (theme) => theme.palette.primary.light
57
- },
58
- size: "small",
59
- onClick: handleAddRule,
60
- startIcon: /* @__PURE__ */ React__default.createElement(AddIcon, { fontSize: "small" })
61
50
  },
62
- "Add rule"
63
- ),
64
- /* @__PURE__ */ React__default.createElement(
65
- Button,
66
- {
67
- sx: {
68
- color: (theme) => theme.palette.primary.light
69
- },
70
- size: "small",
71
- onClick: () => handleAddNestedCondition(criteria),
72
- startIcon: /* @__PURE__ */ React__default.createElement(AddIcon, { fontSize: "small" }),
73
- endIcon: /* @__PURE__ */ React__default.createElement(Tooltip, { title: tooltipTitle(), placement: "top" }, /* @__PURE__ */ React__default.createElement(
74
- HelpOutlineIcon,
51
+ children: [
52
+ /* @__PURE__ */ jsx(
53
+ Button,
75
54
  {
76
- fontSize: "small",
77
- style: { marginLeft: "0.25rem" }
55
+ sx: {
56
+ color: (theme) => theme.palette.primary.light
57
+ },
58
+ size: "small",
59
+ onClick: handleAddRule,
60
+ startIcon: /* @__PURE__ */ jsx(AddIcon, { fontSize: "small" }),
61
+ children: "Add rule"
78
62
  }
79
- ))
80
- },
81
- "Add Nested Condition"
82
- )
63
+ ),
64
+ /* @__PURE__ */ jsx(
65
+ Button,
66
+ {
67
+ sx: {
68
+ color: (theme) => theme.palette.primary.light
69
+ },
70
+ size: "small",
71
+ onClick: () => handleAddNestedCondition(criteria),
72
+ startIcon: /* @__PURE__ */ jsx(AddIcon, { fontSize: "small" }),
73
+ endIcon: /* @__PURE__ */ jsx(Tooltip, { title: tooltipTitle(), placement: "top", children: /* @__PURE__ */ jsx(
74
+ HelpOutlineIcon,
75
+ {
76
+ fontSize: "small",
77
+ style: { marginLeft: "0.25rem" }
78
+ }
79
+ ) }),
80
+ children: "Add Nested Condition"
81
+ }
82
+ )
83
+ ]
84
+ }
83
85
  );
84
86
  };
85
87
 
@@ -1 +1 @@
1
- {"version":3,"file":"ComplexConditionRowButtons.esm.js","sources":["../../../src/components/ConditionalAccess/ComplexConditionRowButtons.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 AddIcon from '@mui/icons-material/Add';\nimport HelpOutlineIcon from '@mui/icons-material/HelpOutline';\nimport Box from '@mui/material/Box';\nimport Button from '@mui/material/Button';\nimport Tooltip from '@mui/material/Tooltip';\n\nimport { getDefaultRule } from '../../utils/conditional-access-utils';\nimport { tooltipTitle } from './AddNestedConditionButton';\nimport { criterias } from './const';\nimport { Condition, ConditionsData } from './types';\n\ntype ComplexConditionRowButtonsProps = {\n conditionRow: ConditionsData;\n onRuleChange: (newCondition: ConditionsData) => void;\n criteria: string;\n selPluginResourceType: string;\n updateErrors: (_index: number) => void;\n isNestedConditionRule: (condition: Condition) => boolean;\n handleAddNestedCondition: (criteria: string) => void;\n};\n\nexport const ComplexConditionRowButtons = ({\n conditionRow,\n onRuleChange,\n criteria,\n selPluginResourceType,\n updateErrors,\n isNestedConditionRule,\n handleAddNestedCondition,\n}: ComplexConditionRowButtonsProps) => {\n const findFirstNestedConditionIndex = (rules: Condition[]): number => {\n return rules.findIndex(e => isNestedConditionRule(e)) || 0;\n };\n const handleAddRule = () => {\n const updatedRules = [\n ...(conditionRow.allOf ?? []),\n ...(conditionRow.anyOf ?? []),\n ];\n\n const firstNestedConditionIndex =\n findFirstNestedConditionIndex(updatedRules);\n if (firstNestedConditionIndex !== -1) {\n updatedRules.splice(\n firstNestedConditionIndex,\n 0,\n getDefaultRule(selPluginResourceType),\n );\n } else {\n updatedRules.push(getDefaultRule(selPluginResourceType));\n }\n\n onRuleChange({ [criteria]: [...updatedRules] });\n updateErrors(firstNestedConditionIndex);\n };\n\n return (\n (criteria === criterias.allOf || criteria === criterias.anyOf) && (\n <Box\n mt={1}\n mb={1}\n sx={{\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'flex-start',\n }}\n >\n <Button\n sx={{\n color: theme => theme.palette.primary.light,\n }}\n size=\"small\"\n onClick={handleAddRule}\n startIcon={<AddIcon fontSize=\"small\" />}\n >\n Add rule\n </Button>\n <Button\n sx={{\n color: theme => theme.palette.primary.light,\n }}\n size=\"small\"\n onClick={() => handleAddNestedCondition(criteria)}\n startIcon={<AddIcon fontSize=\"small\" />}\n endIcon={\n <Tooltip title={tooltipTitle()} placement=\"top\">\n <HelpOutlineIcon\n fontSize=\"small\"\n style={{ marginLeft: '0.25rem' }}\n />\n </Tooltip>\n }\n >\n Add Nested Condition\n </Button>\n </Box>\n )\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;AAsCO,MAAM,6BAA6B,CAAC;AAAA,EACzC,YAAA;AAAA,EACA,YAAA;AAAA,EACA,QAAA;AAAA,EACA,qBAAA;AAAA,EACA,YAAA;AAAA,EACA,qBAAA;AAAA,EACA;AACF,CAAuC,KAAA;AACrC,EAAM,MAAA,6BAAA,GAAgC,CAAC,KAA+B,KAAA;AACpE,IAAA,OAAO,MAAM,SAAU,CAAA,CAAA,CAAA,KAAK,qBAAsB,CAAA,CAAC,CAAC,CAAK,IAAA,CAAA;AAAA,GAC3D;AACA,EAAA,MAAM,gBAAgB,MAAM;AAC1B,IAAA,MAAM,YAAe,GAAA;AAAA,MACnB,GAAI,YAAa,CAAA,KAAA,IAAS,EAAC;AAAA,MAC3B,GAAI,YAAa,CAAA,KAAA,IAAS;AAAC,KAC7B;AAEA,IAAM,MAAA,yBAAA,GACJ,8BAA8B,YAAY,CAAA;AAC5C,I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EAAA,OAAA;AAAA,QACL,OAAA,EAAS,MAAM,wBAAA,CAAyB,QAAQ,CAAA;AAAA,QAChD,SAAW,kBAAAA,cAAA,CAAA,aAAA,CAAC,OAAQ,EAAA,EAAA,QAAA,EAAS,OAAQ,EAAA,CAAA;AAAA,QACrC,yBACGA,cAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EAAQ,OAAO,YAAa,EAAA,EAAG,WAAU,KACxC,EAAA,kBAAAA,cAAA,CAAA,aAAA;AAAA,UAAC,eAAA;AAAA,UAAA;AAAA,YACC,QAAS,EAAA,OAAA;AAAA,YACT,KAAA,EAAO,EAAE,UAAA,EAAY,SAAU;AAAA;AAAA,SAEnC;AAAA,OAAA;AAAA,MAEH;AAAA;AAED,GACF;AAGN;;;;"}
1
+ {"version":3,"file":"ComplexConditionRowButtons.esm.js","sources":["../../../src/components/ConditionalAccess/ComplexConditionRowButtons.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 AddIcon from '@mui/icons-material/Add';\nimport HelpOutlineIcon from '@mui/icons-material/HelpOutline';\nimport Box from '@mui/material/Box';\nimport Button from '@mui/material/Button';\nimport Tooltip from '@mui/material/Tooltip';\n\nimport { getDefaultRule } from '../../utils/conditional-access-utils';\nimport { tooltipTitle } from './AddNestedConditionButton';\nimport { criterias } from './const';\nimport { Condition, ConditionsData } from './types';\n\ntype ComplexConditionRowButtonsProps = {\n conditionRow: ConditionsData;\n onRuleChange: (newCondition: ConditionsData) => void;\n criteria: string;\n selPluginResourceType: string;\n updateErrors: (_index: number) => void;\n isNestedConditionRule: (condition: Condition) => boolean;\n handleAddNestedCondition: (criteria: string) => void;\n};\n\nexport const ComplexConditionRowButtons = ({\n conditionRow,\n onRuleChange,\n criteria,\n selPluginResourceType,\n updateErrors,\n isNestedConditionRule,\n handleAddNestedCondition,\n}: ComplexConditionRowButtonsProps) => {\n const findFirstNestedConditionIndex = (rules: Condition[]): number => {\n return rules.findIndex(e => isNestedConditionRule(e)) || 0;\n };\n const handleAddRule = () => {\n const updatedRules = [\n ...(conditionRow.allOf ?? []),\n ...(conditionRow.anyOf ?? []),\n ];\n\n const firstNestedConditionIndex =\n findFirstNestedConditionIndex(updatedRules);\n if (firstNestedConditionIndex !== -1) {\n updatedRules.splice(\n firstNestedConditionIndex,\n 0,\n getDefaultRule(selPluginResourceType),\n );\n } else {\n updatedRules.push(getDefaultRule(selPluginResourceType));\n }\n\n onRuleChange({ [criteria]: [...updatedRules] });\n updateErrors(firstNestedConditionIndex);\n };\n\n return (\n (criteria === criterias.allOf || criteria === criterias.anyOf) && (\n <Box\n mt={1}\n mb={1}\n sx={{\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'flex-start',\n }}\n >\n <Button\n sx={{\n color: theme => theme.palette.primary.light,\n }}\n size=\"small\"\n onClick={handleAddRule}\n startIcon={<AddIcon fontSize=\"small\" />}\n >\n Add rule\n </Button>\n <Button\n sx={{\n color: theme => theme.palette.primary.light,\n }}\n size=\"small\"\n onClick={() => handleAddNestedCondition(criteria)}\n startIcon={<AddIcon fontSize=\"small\" />}\n endIcon={\n <Tooltip title={tooltipTitle()} placement=\"top\">\n <HelpOutlineIcon\n fontSize=\"small\"\n style={{ marginLeft: '0.25rem' }}\n />\n </Tooltip>\n }\n >\n Add Nested Condition\n </Button>\n </Box>\n )\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AAoCO,MAAM,6BAA6B,CAAC;AAAA,EACzC,YAAA;AAAA,EACA,YAAA;AAAA,EACA,QAAA;AAAA,EACA,qBAAA;AAAA,EACA,YAAA;AAAA,EAC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AA,OAAA,CAAQ,OAAQ,CAAA;AAAA,aACxC;AAAA,YACA,IAAK,EAAA,OAAA;AAAA,YACL,OAAS,EAAA,aAAA;AAAA,YACT,SAAW,kBAAA,GAAA,CAAC,OAAQ,EAAA,EAAA,QAAA,EAAS,OAAQ,EAAA,CAAA;AAAA,YACtC,QAAA,EAAA;AAAA;AAAA,SAED;AAAA,wBACA,GAAA;AAAA,UAAC,MAAA;AAAA,UAAA;AAAA,YACC,EAAI,EAAA;AAAA,cACF,KAAO,EAAA,CAAA,KAAA,KAAS,KAAM,CAAA,OAAA,CAAQ,OAAQ,CAAA;AAAA,aACxC;AAAA,YACA,IAAK,EAAA,OAAA;AAAA,YACL,OAAA,EAAS,MAAM,wBAAA,CAAyB,QAAQ,CAAA;AAAA,YAChD,SAAW,kBAAA,GAAA,CAAC,OAAQ,EAAA,EAAA,QAAA,EAAS,OAAQ,EAAA,CAAA;AAAA,YACrC,yBACG,GAAA,CAAA,OAAA,EAAA,EAAQ,OAAO,YAAa,EAAA,EAAG,WAAU,KACxC,EAAA,QAAA,kBAAA,GAAA;AAAA,cAAC,eAAA;AAAA,cAAA;AAAA,gBACC,QAAS,EAAA,OAAA;AAAA,gBACT,KAAA,EAAO,EAAE,UAAA,EAAY,SAAU;AAAA;AAAA,aAEnC,EAAA,CAAA;AAAA,YAEH,QAAA,EAAA;AAAA;AAAA;AAED;AAAA;AAAA,GACF;AAGN;;;;"}
@@ -1,4 +1,4 @@
1
- import React__default from 'react';
1
+ import { jsx } from 'react/jsx-runtime';
2
2
  import { getDefaultRule, ruleOptionDisabled } from '../../utils/conditional-access-utils.esm.js';
3
3
  import { ConditionsFormRowFields } from './ConditionsFormRowFields.esm.js';
4
4
  import { criterias } from './const.esm.js';
@@ -12,7 +12,7 @@ const ConditionRule = ({
12
12
  setErrors,
13
13
  setRemoveAllClicked
14
14
  }) => {
15
- return criteria === criterias.condition && /* @__PURE__ */ React__default.createElement(
15
+ return criteria === criterias.condition && /* @__PURE__ */ jsx(
16
16
  ConditionsFormRowFields,
17
17
  {
18
18
  oldCondition: conditionRow.condition ?? getDefaultRule(selPluginResourceType),
@@ -1 +1 @@
1
- {"version":3,"file":"ConditionRule.esm.js","sources":["../../../src/components/ConditionalAccess/ConditionRule.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 {\n getDefaultRule,\n ruleOptionDisabled,\n} from '../../utils/conditional-access-utils';\nimport { ConditionsFormRowFields } from './ConditionsFormRowFields';\nimport { criterias } from './const';\nimport { AccessConditionsErrors, ConditionsData, RulesData } from './types';\n\ntype ConditionRuleProps = {\n conditionRow: ConditionsData;\n selPluginResourceType: string;\n onRuleChange: (newCondition: ConditionsData) => void;\n criteria: string;\n conditionRulesData?: RulesData;\n setErrors: React.Dispatch<\n React.SetStateAction<AccessConditionsErrors | undefined>\n >;\n setRemoveAllClicked: React.Dispatch<React.SetStateAction<boolean>>;\n};\n\nexport const ConditionRule = ({\n conditionRow,\n selPluginResourceType,\n onRuleChange,\n criteria,\n conditionRulesData,\n setErrors,\n setRemoveAllClicked,\n}: ConditionRuleProps) => {\n return (\n criteria === criterias.condition && (\n <ConditionsFormRowFields\n oldCondition={\n conditionRow.condition ?? getDefaultRule(selPluginResourceType)\n }\n onRuleChange={onRuleChange}\n conditionRow={conditionRow}\n criteria={criteria}\n conditionRulesData={conditionRulesData}\n setErrors={setErrors}\n optionDisabled={ruleOption =>\n ruleOptionDisabled(\n ruleOption,\n conditionRow.condition ? [conditionRow.condition] : undefined,\n )\n }\n setRemoveAllClicked={setRemoveAllClicked}\n />\n )\n );\n};\n"],"names":["React"],"mappings":";;;;;AAqCO,MAAM,gBAAgB,CAAC;AAAA,EAC5B,YAAA;AAAA,EACA,qBAAA;AAAA,EACA,YAAA;AAAA,EACA,QAAA;AAAA,EACA,kBAAA;AAAA,EACA,SAAA;AAAA,EACA;AACF,CAA0B,KAAA;AACxB,EACE,OAAA,QAAA,KAAa,UAAU,SACrB,oBAAAA,cAAA,CAAA,aAAA;AAAA,IAAC,uBAAA;AAAA,IAAA;AAAA,MACC,YACE,EAAA,YAAA,CAAa,SAAa,IAAA,cAAA,CAAe,qBAAqB,CAAA;AAAA,MAEhE,YAAA;AAAA,MACA,YAAA;AAAA,MACA,QAAA;AAAA,MACA,kBAAA;AAAA,MACA,SAAA;AAAA,MACA,gBAAgB,CACd,UAAA,KAAA,kBAAA;AAAA,QACE,UAAA;AAAA,QACA,YAAa,CAAA,SAAA,GAAY,CAAC,YAAA,CAAa,SAAS,CAAI,GAAA;AAAA,OACtD;AAAA,MAEF;AAAA;AAAA,GACF;AAGN;;;;"}
1
+ {"version":3,"file":"ConditionRule.esm.js","sources":["../../../src/components/ConditionalAccess/ConditionRule.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 type { SetStateAction, Dispatch } from 'react';\n\nimport {\n getDefaultRule,\n ruleOptionDisabled,\n} from '../../utils/conditional-access-utils';\nimport { ConditionsFormRowFields } from './ConditionsFormRowFields';\nimport { criterias } from './const';\nimport { AccessConditionsErrors, ConditionsData, RulesData } from './types';\n\ntype ConditionRuleProps = {\n conditionRow: ConditionsData;\n selPluginResourceType: string;\n onRuleChange: (newCondition: ConditionsData) => void;\n criteria: string;\n conditionRulesData?: RulesData;\n setErrors: Dispatch<SetStateAction<AccessConditionsErrors | undefined>>;\n setRemoveAllClicked: Dispatch<SetStateAction<boolean>>;\n};\n\nexport const ConditionRule = ({\n conditionRow,\n selPluginResourceType,\n onRuleChange,\n criteria,\n conditionRulesData,\n setErrors,\n setRemoveAllClicked,\n}: ConditionRuleProps) => {\n return (\n criteria === criterias.condition && (\n <ConditionsFormRowFields\n oldCondition={\n conditionRow.condition ?? getDefaultRule(selPluginResourceType)\n }\n onRuleChange={onRuleChange}\n conditionRow={conditionRow}\n criteria={criteria}\n conditionRulesData={conditionRulesData}\n setErrors={setErrors}\n optionDisabled={ruleOption =>\n ruleOptionDisabled(\n ruleOption,\n conditionRow.condition ? [conditionRow.condition] : undefined,\n )\n }\n setRemoveAllClicked={setRemoveAllClicked}\n />\n )\n );\n};\n"],"names":[],"mappings":";;;;;AAmCO,MAAM,gBAAgB,CAAC;AAAA,EAC5B,YAAA;AAAA,EACA,qBAAA;AAAA,EACA,YAAA;AAAA,EACA,QAAA;AAAA,EACA,kBAAA;AAAA,EACA,SAAA;AAAA,EACA;AACF,CAA0B,KAAA;AACxB,EACE,OAAA,QAAA,KAAa,UAAU,SACrB,oBAAA,GAAA;AAAA,IAAC,uBAAA;AAAA,IAAA;AAAA,MACC,YACE,EAAA,YAAA,CAAa,SAAa,IAAA,cAAA,CAAe,qBAAqB,CAAA;AAAA,MAEhE,YAAA;AAAA,MACA,YAAA;AAAA,MACA,QAAA;AAAA,MACA,kBAAA;AAAA,MACA,SAAA;AAAA,MACA,gBAAgB,CACd,UAAA,KAAA,kBAAA;AAAA,QACE,UAAA;AAAA,QACA,YAAa,CAAA,SAAA,GAAY,CAAC,YAAA,CAAa,SAAS,CAAI,GAAA;AAAA,OACtD;AAAA,MAEF;AAAA;AAAA,GACF;AAGN;;;;"}
@@ -1,4 +1,4 @@
1
- import React__default from 'react';
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import CloseIcon from '@mui/icons-material/Close';
3
3
  import Box from '@mui/material/Box';
4
4
  import Drawer from '@mui/material/Drawer';
@@ -14,7 +14,7 @@ const ConditionalAccessSidebar = ({
14
14
  conditionRulesData,
15
15
  conditionsFormVal
16
16
  }) => {
17
- return /* @__PURE__ */ React__default.createElement(
17
+ return /* @__PURE__ */ jsx(
18
18
  Drawer,
19
19
  {
20
20
  anchor: "right",
@@ -28,66 +28,76 @@ const ConditionalAccessSidebar = ({
28
28
  width: "50%",
29
29
  height: "100%"
30
30
  }
31
- }
32
- },
33
- /* @__PURE__ */ React__default.createElement(
34
- Box,
35
- {
36
- sx: {
37
- display: "flex",
38
- flexFlow: "column",
39
- justifyContent: "space-between",
40
- height: "100%",
41
- backgroundColor: (theme) => `${theme.palette.background.paper}`
42
- }
43
31
  },
44
- /* @__PURE__ */ React__default.createElement(
32
+ children: /* @__PURE__ */ jsxs(
45
33
  Box,
46
34
  {
47
35
  sx: {
48
36
  display: "flex",
49
- flexDirection: "row",
37
+ flexFlow: "column",
50
38
  justifyContent: "space-between",
51
- alignItems: "baseline",
52
- padding: (theme) => theme.spacing(2.5),
53
- fontFamily: (theme) => theme.typography.fontFamily
54
- }
55
- },
56
- /* @__PURE__ */ React__default.createElement(Box, null, /* @__PURE__ */ React__default.createElement(Box, { sx: { display: "flex", gap: "5px" } }, /* @__PURE__ */ React__default.createElement(Typography, { sx: { fontWeight: 500 }, variant: "h5" }, "Configure access for the"), /* @__PURE__ */ React__default.createElement(Typography, { style: { fontWeight: 600 }, variant: "h5" }, selPluginResourceType)), /* @__PURE__ */ React__default.createElement(
57
- Typography,
58
- {
59
- variant: "body2",
60
- sx: {
61
- fontWeight: 400,
62
- fontFamily: (theme) => theme.typography.fontFamily,
63
- paddingTop: (theme) => theme.spacing(1)
64
- },
65
- align: "left"
39
+ height: "100%",
40
+ backgroundColor: (theme) => `${theme.palette.background.paper}`
66
41
  },
67
- "By default, the selected resource type is visible to all added users. If you want to restrict or grant permission to specific plugin rules, select them and add the parameters."
68
- )),
69
- /* @__PURE__ */ React__default.createElement(
70
- IconButton,
71
- {
72
- key: "dismiss",
73
- title: "Close the drawer",
74
- onClick: onClose,
75
- color: "inherit"
76
- },
77
- /* @__PURE__ */ React__default.createElement(CloseIcon, { fontSize: "small" })
78
- )
79
- ),
80
- /* @__PURE__ */ React__default.createElement(
81
- ConditionsForm,
82
- {
83
- conditionRulesData,
84
- selPluginResourceType,
85
- conditionsFormVal,
86
- onClose,
87
- onSave
42
+ children: [
43
+ /* @__PURE__ */ jsxs(
44
+ Box,
45
+ {
46
+ sx: {
47
+ display: "flex",
48
+ flexDirection: "row",
49
+ justifyContent: "space-between",
50
+ alignItems: "baseline",
51
+ padding: (theme) => theme.spacing(2.5),
52
+ fontFamily: (theme) => theme.typography.fontFamily
53
+ },
54
+ children: [
55
+ /* @__PURE__ */ jsxs(Box, { children: [
56
+ /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", gap: "5px" }, children: [
57
+ /* @__PURE__ */ jsx(Typography, { sx: { fontWeight: 500 }, variant: "h5", children: "Configure access for the" }),
58
+ /* @__PURE__ */ jsx(Typography, { style: { fontWeight: 600 }, variant: "h5", children: selPluginResourceType })
59
+ ] }),
60
+ /* @__PURE__ */ jsx(
61
+ Typography,
62
+ {
63
+ variant: "body2",
64
+ sx: {
65
+ fontWeight: 400,
66
+ fontFamily: (theme) => theme.typography.fontFamily,
67
+ paddingTop: (theme) => theme.spacing(1)
68
+ },
69
+ align: "left",
70
+ children: "By default, the selected resource type is visible to all added users. If you want to restrict or grant permission to specific plugin rules, select them and add the parameters."
71
+ }
72
+ )
73
+ ] }),
74
+ /* @__PURE__ */ jsx(
75
+ IconButton,
76
+ {
77
+ title: "Close the drawer",
78
+ onClick: onClose,
79
+ color: "inherit",
80
+ children: /* @__PURE__ */ jsx(CloseIcon, { fontSize: "small" })
81
+ },
82
+ "dismiss"
83
+ )
84
+ ]
85
+ }
86
+ ),
87
+ /* @__PURE__ */ jsx(
88
+ ConditionsForm,
89
+ {
90
+ conditionRulesData,
91
+ selPluginResourceType,
92
+ conditionsFormVal,
93
+ onClose,
94
+ onSave
95
+ }
96
+ )
97
+ ]
88
98
  }
89
99
  )
90
- )
100
+ }
91
101
  );
92
102
  };
93
103
 
@@ -1 +1 @@
1
- {"version":3,"file":"ConditionalAccessSidebar.esm.js","sources":["../../../src/components/ConditionalAccess/ConditionalAccessSidebar.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 CloseIcon from '@mui/icons-material/Close';\nimport Box from '@mui/material/Box';\nimport Drawer from '@mui/material/Drawer';\nimport IconButton from '@mui/material/IconButton';\nimport Typography from '@mui/material/Typography';\n\nimport { ConditionsForm } from './ConditionsForm';\nimport { ConditionsData, RulesData } from './types';\n\ntype ConditionalAccessSidebarProps = {\n open: boolean;\n onClose: () => void;\n onSave: (conditions?: ConditionsData) => void;\n selPluginResourceType: string;\n conditionRulesData?: RulesData;\n conditionsFormVal?: ConditionsData;\n};\n\nexport const ConditionalAccessSidebar = ({\n open,\n onClose,\n onSave,\n selPluginResourceType,\n conditionRulesData,\n conditionsFormVal,\n}: ConditionalAccessSidebarProps) => {\n return (\n <Drawer\n anchor=\"right\"\n open={open}\n data-testid=\"rules-sidebar\"\n PaperProps={{\n sx: {\n ['@media (max-width: 960px)']: {\n width: '100%',\n },\n width: '50%',\n height: '100%',\n },\n }}\n >\n <Box\n sx={{\n display: 'flex',\n flexFlow: 'column',\n justifyContent: 'space-between',\n height: '100%',\n backgroundColor: theme => `${theme.palette.background.paper}`,\n }}\n >\n <Box\n sx={{\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'space-between',\n alignItems: 'baseline',\n padding: theme => theme.spacing(2.5),\n fontFamily: theme => theme.typography.fontFamily,\n }}\n >\n <Box>\n <Box sx={{ display: 'flex', gap: '5px' }}>\n <Typography sx={{ fontWeight: 500 }} variant=\"h5\">\n Configure access for the\n </Typography>\n <Typography style={{ fontWeight: 600 }} variant=\"h5\">\n {selPluginResourceType}\n </Typography>\n </Box>\n <Typography\n variant=\"body2\"\n sx={{\n fontWeight: 400,\n fontFamily: theme => theme.typography.fontFamily,\n paddingTop: theme => theme.spacing(1),\n }}\n align=\"left\"\n >\n By default, the selected resource type is visible to all added\n users. If you want to restrict or grant permission to specific\n plugin rules, select them and add the parameters.\n </Typography>\n </Box>\n <IconButton\n key=\"dismiss\"\n title=\"Close the drawer\"\n onClick={onClose}\n color=\"inherit\"\n >\n <CloseIcon fontSize=\"small\" />\n </IconButton>\n </Box>\n <ConditionsForm\n conditionRulesData={conditionRulesData}\n selPluginResourceType={selPluginResourceType}\n conditionsFormVal={conditionsFormVal}\n onClose={onClose}\n onSave={onSave}\n />\n </Box>\n </Drawer>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;AAmCO,MAAM,2BAA2B,CAAC;AAAA,EACvC,IAAA;AAAA,EACA,OAAA;AAAA,EACA,MAAA;AAAA,EACA,qBAAA;AAAA,EACA,kBAAA;AAAA,EACA;AACF,CAAqC,KAAA;AACnC,EACE,uBAAAA,cAAA,CAAA,aAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,MAAO,EAAA,OAAA;AAAA,MACP,IAAA;AAAA,MACA,aAAY,EAAA,eAAA;AAAA,MACZ,UAAY,EAAA;AAAA,QACV,EAAI,EAAA;AAAA,UACF,CAAC,2BAA2B,GAAG;AAAA,YAC7B,KAAO,EAAA;AAAA,WACT;AAAA,UACA,KAAO,EAAA,KAAA;AAA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AA;AAAA,YACR,EAAI,EAAA;AAAA,cACF,UAAY,EAAA,GAAA;AAAA,cACZ,UAAA,EAAY,CAAS,KAAA,KAAA,KAAA,CAAM,UAAW,CAAA,UAAA;AAAA,cACtC,UAAY,EAAA,CAAA,KAAA,KAAS,KAAM,CAAA,OAAA,CAAQ,CAAC;AAAA,aACtC;AAAA,YACA,KAAM,EAAA;AAAA,WAAA;AAAA,UACP;AAAA,SAKH,CAAA;AAAA,wBACAA,cAAA,CAAA,aAAA;AAAA,UAAC,UAAA;AAAA,UAAA;AAAA,YACC,GAAI,EAAA,SAAA;AAAA,YACJ,KAAM,EAAA,kBAAA;AAAA,YACN,OAAS,EAAA,OAAA;AAAA,YACT,KAAM,EAAA;AAAA,WAAA;AAAA,0BAENA,cAAA,CAAA,aAAA,CAAC,SAAU,EAAA,EAAA,QAAA,EAAS,OAAQ,EAAA;AAAA;AAC9B,OACF;AAAA,sBACAA,cAAA,CAAA,aAAA;AAAA,QAAC,cAAA;AAAA,QAAA;AAAA,UACC,kBAAA;AAAA,UACA,qBAAA;AAAA,UACA,iBAAA;AAAA,UACA,OAAA;AAAA,UACA;AAAA;AAAA;AACF;AACF,GACF;AAEJ;;;;"}
1
+ {"version":3,"file":"ConditionalAccessSidebar.esm.js","sources":["../../../src/components/ConditionalAccess/ConditionalAccessSidebar.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 CloseIcon from '@mui/icons-material/Close';\nimport Box from '@mui/material/Box';\nimport Drawer from '@mui/material/Drawer';\nimport IconButton from '@mui/material/IconButton';\nimport Typography from '@mui/material/Typography';\n\nimport { ConditionsForm } from './ConditionsForm';\nimport { ConditionsData, RulesData } from './types';\n\ntype ConditionalAccessSidebarProps = {\n open: boolean;\n onClose: () => void;\n onSave: (conditions?: ConditionsData) => void;\n selPluginResourceType: string;\n conditionRulesData?: RulesData;\n conditionsFormVal?: ConditionsData;\n};\n\nexport const ConditionalAccessSidebar = ({\n open,\n onClose,\n onSave,\n selPluginResourceType,\n conditionRulesData,\n conditionsFormVal,\n}: ConditionalAccessSidebarProps) => {\n return (\n <Drawer\n anchor=\"right\"\n open={open}\n data-testid=\"rules-sidebar\"\n PaperProps={{\n sx: {\n ['@media (max-width: 960px)']: {\n width: '100%',\n },\n width: '50%',\n height: '100%',\n },\n }}\n >\n <Box\n sx={{\n display: 'flex',\n flexFlow: 'column',\n justifyContent: 'space-between',\n height: '100%',\n backgroundColor: theme => `${theme.palette.background.paper}`,\n }}\n >\n <Box\n sx={{\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'space-between',\n alignItems: 'baseline',\n padding: theme => theme.spacing(2.5),\n fontFamily: theme => theme.typography.fontFamily,\n }}\n >\n <Box>\n <Box sx={{ display: 'flex', gap: '5px' }}>\n <Typography sx={{ fontWeight: 500 }} variant=\"h5\">\n Configure access for the\n </Typography>\n <Typography style={{ fontWeight: 600 }} variant=\"h5\">\n {selPluginResourceType}\n </Typography>\n </Box>\n <Typography\n variant=\"body2\"\n sx={{\n fontWeight: 400,\n fontFamily: theme => theme.typography.fontFamily,\n paddingTop: theme => theme.spacing(1),\n }}\n align=\"left\"\n >\n By default, the selected resource type is visible to all added\n users. If you want to restrict or grant permission to specific\n plugin rules, select them and add the parameters.\n </Typography>\n </Box>\n <IconButton\n key=\"dismiss\"\n title=\"Close the drawer\"\n onClick={onClose}\n color=\"inherit\"\n >\n <CloseIcon fontSize=\"small\" />\n </IconButton>\n </Box>\n <ConditionsForm\n conditionRulesData={conditionRulesData}\n selPluginResourceType={selPluginResourceType}\n conditionsFormVal={conditionsFormV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