@backstage-community/plugin-rbac 1.43.0 → 1.44.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.
- package/CHANGELOG.md +6 -0
- package/dist/alpha.d.ts +179 -0
- package/dist/alpha.esm.js +3 -0
- package/dist/alpha.esm.js.map +1 -0
- package/dist/components/ConditionalAccess/AddNestedConditionButton.esm.js +13 -9
- package/dist/components/ConditionalAccess/AddNestedConditionButton.esm.js.map +1 -1
- package/dist/components/ConditionalAccess/ComplexConditionRow.esm.js +3 -1
- package/dist/components/ConditionalAccess/ComplexConditionRow.esm.js.map +1 -1
- package/dist/components/ConditionalAccess/ComplexConditionRowButtons.esm.js +5 -3
- package/dist/components/ConditionalAccess/ComplexConditionRowButtons.esm.js.map +1 -1
- package/dist/components/ConditionalAccess/ConditionalAccessSidebar.esm.js +5 -3
- package/dist/components/ConditionalAccess/ConditionalAccessSidebar.esm.js.map +1 -1
- package/dist/components/ConditionalAccess/ConditionsFormRow.esm.js +7 -5
- package/dist/components/ConditionalAccess/ConditionsFormRow.esm.js.map +1 -1
- package/dist/components/ConditionalAccess/ConditionsFormRowFields.esm.js +4 -2
- package/dist/components/ConditionalAccess/ConditionsFormRowFields.esm.js.map +1 -1
- package/dist/components/ConditionalAccess/const.esm.js +6 -12
- package/dist/components/ConditionalAccess/const.esm.js.map +1 -1
- package/dist/components/CreateRole/AddMembersForm.esm.js +25 -19
- package/dist/components/CreateRole/AddMembersForm.esm.js.map +1 -1
- package/dist/components/CreateRole/AddedMembersTable.esm.js +10 -4
- package/dist/components/CreateRole/AddedMembersTable.esm.js.map +1 -1
- package/dist/components/CreateRole/AddedMembersTableColumn.esm.js +30 -28
- package/dist/components/CreateRole/AddedMembersTableColumn.esm.js.map +1 -1
- package/dist/components/CreateRole/CancelDialog.esm.js +8 -9
- package/dist/components/CreateRole/CancelDialog.esm.js.map +1 -1
- package/dist/components/CreateRole/CreateRolePage.esm.js +8 -6
- package/dist/components/CreateRole/CreateRolePage.esm.js.map +1 -1
- package/dist/components/CreateRole/EditRolePage.esm.js +9 -7
- package/dist/components/CreateRole/EditRolePage.esm.js.map +1 -1
- package/dist/components/CreateRole/PermissionPoliciesForm.esm.js +9 -3
- package/dist/components/CreateRole/PermissionPoliciesForm.esm.js.map +1 -1
- package/dist/components/CreateRole/PermissionPoliciesFormNestedRow.esm.js +6 -2
- package/dist/components/CreateRole/PermissionPoliciesFormNestedRow.esm.js.map +1 -1
- package/dist/components/CreateRole/PermissionPoliciesFormRow.esm.js +8 -4
- package/dist/components/CreateRole/PermissionPoliciesFormRow.esm.js.map +1 -1
- package/dist/components/CreateRole/PermissionPoliciesFormTable.esm.js +11 -6
- package/dist/components/CreateRole/PermissionPoliciesFormTable.esm.js.map +1 -1
- package/dist/components/CreateRole/PluginsDropdown.esm.js +4 -2
- package/dist/components/CreateRole/PluginsDropdown.esm.js.map +1 -1
- package/dist/components/CreateRole/ReviewStep.esm.js +9 -7
- package/dist/components/CreateRole/ReviewStep.esm.js.map +1 -1
- package/dist/components/CreateRole/RoleDetailsForm.esm.js +8 -6
- package/dist/components/CreateRole/RoleDetailsForm.esm.js.map +1 -1
- package/dist/components/CreateRole/RoleForm.esm.js +27 -23
- package/dist/components/CreateRole/RoleForm.esm.js.map +1 -1
- package/dist/components/CreateRole/SelectedPermissionPoliciesColumn.esm.js +24 -22
- package/dist/components/CreateRole/SelectedPermissionPoliciesColumn.esm.js.map +1 -1
- package/dist/components/DownloadUserStatistics.esm.js +4 -2
- package/dist/components/DownloadUserStatistics.esm.js.map +1 -1
- package/dist/components/EditRole.esm.js +4 -2
- package/dist/components/EditRole.esm.js.map +1 -1
- package/dist/components/RbacPage.esm.js +4 -2
- package/dist/components/RbacPage.esm.js.map +1 -1
- package/dist/components/RoleOverview/AboutCard.esm.js +12 -8
- package/dist/components/RoleOverview/AboutCard.esm.js.map +1 -1
- package/dist/components/RoleOverview/MembersCard.esm.js +18 -9
- package/dist/components/RoleOverview/MembersCard.esm.js.map +1 -1
- package/dist/components/RoleOverview/MembersListColumns.esm.js +42 -40
- package/dist/components/RoleOverview/MembersListColumns.esm.js.map +1 -1
- package/dist/components/RoleOverview/PermissionsCard.esm.js +27 -10
- package/dist/components/RoleOverview/PermissionsCard.esm.js.map +1 -1
- package/dist/components/RoleOverview/PermissionsListColumns.esm.js +38 -36
- package/dist/components/RoleOverview/PermissionsListColumns.esm.js.map +1 -1
- package/dist/components/RoleOverview/RoleOverviewPage.esm.js +3 -1
- package/dist/components/RoleOverview/RoleOverviewPage.esm.js.map +1 -1
- package/dist/components/RolesList/DeleteRole.esm.js +4 -2
- package/dist/components/RolesList/DeleteRole.esm.js.map +1 -1
- package/dist/components/RolesList/DeleteRoleDialog.esm.js +23 -38
- package/dist/components/RolesList/DeleteRoleDialog.esm.js.map +1 -1
- package/dist/components/RolesList/RolesList.esm.js +19 -9
- package/dist/components/RolesList/RolesList.esm.js.map +1 -1
- package/dist/components/RolesList/RolesListColumns.esm.js +63 -61
- package/dist/components/RolesList/RolesListColumns.esm.js.map +1 -1
- package/dist/components/RolesList/RolesListToolbar.esm.js +20 -10
- package/dist/components/RolesList/RolesListToolbar.esm.js.map +1 -1
- package/dist/components/Router.esm.js +4 -2
- package/dist/components/Router.esm.js.map +1 -1
- package/dist/components/Trans.esm.js +22 -0
- package/dist/components/Trans.esm.js.map +1 -0
- package/dist/hooks/useActionPermissionTooltip.esm.js +10 -5
- package/dist/hooks/useActionPermissionTooltip.esm.js.map +1 -1
- package/dist/hooks/useLanguage.esm.js +7 -0
- package/dist/hooks/useLanguage.esm.js.map +1 -0
- package/dist/hooks/useMembers.esm.js +16 -8
- package/dist/hooks/useMembers.esm.js.map +1 -1
- package/dist/hooks/usePermissionPolicies.esm.js +20 -9
- package/dist/hooks/usePermissionPolicies.esm.js.map +1 -1
- package/dist/hooks/useTranslation.esm.js +8 -0
- package/dist/hooks/useTranslation.esm.js.map +1 -0
- package/dist/translations/de.esm.js +176 -0
- package/dist/translations/de.esm.js.map +1 -0
- package/dist/translations/es.esm.js +176 -0
- package/dist/translations/es.esm.js.map +1 -0
- package/dist/translations/fr.esm.js +176 -0
- package/dist/translations/fr.esm.js.map +1 -0
- package/dist/translations/index.esm.js +15 -0
- package/dist/translations/index.esm.js.map +1 -0
- package/dist/translations/it.esm.js +176 -0
- package/dist/translations/it.esm.js.map +1 -0
- package/dist/translations/ref.esm.js +215 -0
- package/dist/translations/ref.esm.js.map +1 -0
- package/dist/utils/conditional-access-utils.esm.js +4 -4
- package/dist/utils/conditional-access-utils.esm.js.map +1 -1
- package/dist/utils/create-role-utils.esm.js +11 -11
- package/dist/utils/create-role-utils.esm.js.map +1 -1
- package/dist/utils/filter-table-data.esm.js +4 -3
- package/dist/utils/filter-table-data.esm.js.map +1 -1
- package/dist/utils/rbac-utils.esm.js +23 -19
- package/dist/utils/rbac-utils.esm.js.map +1 -1
- package/dist/utils/role-form-utils.esm.js +17 -12
- package/dist/utils/role-form-utils.esm.js.map +1 -1
- package/dist/utils/string-utils.esm.js +2 -2
- package/dist/utils/string-utils.esm.js.map +1 -1
- package/package.json +27 -13
package/CHANGELOG.md
CHANGED
package/dist/alpha.d.ts
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import * as _backstage_core_plugin_api_alpha from '@backstage/core-plugin-api/alpha';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Translation reference for RBAC plugin
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
declare const rbacTranslationRef: _backstage_core_plugin_api_alpha.TranslationRef<"plugin.rbac", {
|
|
8
|
+
readonly "dialog.cancel": string;
|
|
9
|
+
readonly "dialog.cancelRoleCreation": string;
|
|
10
|
+
readonly "dialog.exitRoleCreation": string;
|
|
11
|
+
readonly "dialog.exitRoleEditing": string;
|
|
12
|
+
readonly "dialog.exitWarning": string;
|
|
13
|
+
readonly "dialog.discard": string;
|
|
14
|
+
readonly "table.title": string;
|
|
15
|
+
readonly "table.searchPlaceholder": string;
|
|
16
|
+
readonly "table.labelRowsSelect": string;
|
|
17
|
+
readonly "table.titleWithCount": string;
|
|
18
|
+
readonly "table.headers.name": string;
|
|
19
|
+
readonly "table.headers.usersAndGroups": string;
|
|
20
|
+
readonly "table.headers.accessiblePlugins": string;
|
|
21
|
+
readonly "table.headers.actions": string;
|
|
22
|
+
readonly "table.emptyContent": string;
|
|
23
|
+
readonly "page.title": string;
|
|
24
|
+
readonly "page.createRole": string;
|
|
25
|
+
readonly "page.editRole": string;
|
|
26
|
+
readonly "toolbar.createButton": string;
|
|
27
|
+
readonly "toolbar.warning.title": string;
|
|
28
|
+
readonly "toolbar.warning.message": string;
|
|
29
|
+
readonly "toolbar.warning.linkText": string;
|
|
30
|
+
readonly "toolbar.warning.note": string;
|
|
31
|
+
readonly "toolbar.warning.noteText": string;
|
|
32
|
+
readonly "errors.createRole": string;
|
|
33
|
+
readonly "errors.editRole": string;
|
|
34
|
+
readonly "errors.notFound": string;
|
|
35
|
+
readonly "errors.unauthorized": string;
|
|
36
|
+
readonly "errors.rbacDisabled": string;
|
|
37
|
+
readonly "errors.rbacDisabledInfo": string;
|
|
38
|
+
readonly "errors.fetchRoles": string;
|
|
39
|
+
readonly "errors.fetchRole": string;
|
|
40
|
+
readonly "errors.fetchPoliciesErr": string;
|
|
41
|
+
readonly "errors.fetchPolicies": string;
|
|
42
|
+
readonly "errors.fetchPlugins": string;
|
|
43
|
+
readonly "errors.fetchConditionalPermissionPolicies": string;
|
|
44
|
+
readonly "errors.fetchConditions": string;
|
|
45
|
+
readonly "errors.fetchUsersAndGroups": string;
|
|
46
|
+
readonly "errors.deleteRole": string;
|
|
47
|
+
readonly "errors.roleCreatedSuccess": string;
|
|
48
|
+
readonly "errors.roleCreatedConditionsSuccess": string;
|
|
49
|
+
readonly "roleForm.titles.createRole": string;
|
|
50
|
+
readonly "roleForm.titles.editRole": string;
|
|
51
|
+
readonly "roleForm.titles.usersAndGroups": string;
|
|
52
|
+
readonly "roleForm.titles.nameAndDescription": string;
|
|
53
|
+
readonly "roleForm.titles.permissionPolicies": string;
|
|
54
|
+
readonly "roleForm.review.reviewAndCreate": string;
|
|
55
|
+
readonly "roleForm.review.reviewAndSave": string;
|
|
56
|
+
readonly "roleForm.review.nameDescriptionOwner": string;
|
|
57
|
+
readonly "roleForm.steps.create": string;
|
|
58
|
+
readonly "roleForm.steps.update": string;
|
|
59
|
+
readonly "roleForm.steps.next": string;
|
|
60
|
+
readonly "roleForm.steps.back": string;
|
|
61
|
+
readonly "roleForm.steps.cancel": string;
|
|
62
|
+
readonly "roleForm.steps.reset": string;
|
|
63
|
+
readonly "roleForm.fields.name.label": string;
|
|
64
|
+
readonly "roleForm.fields.name.helperText": string;
|
|
65
|
+
readonly "roleForm.fields.description.label": string;
|
|
66
|
+
readonly "roleForm.fields.description.helperText": string;
|
|
67
|
+
readonly "roleForm.fields.owner.label": string;
|
|
68
|
+
readonly "roleForm.fields.owner.helperText": string;
|
|
69
|
+
readonly "permissionPolicies.rules": string;
|
|
70
|
+
readonly "permissionPolicies.search": string;
|
|
71
|
+
readonly "permissionPolicies.rule": string;
|
|
72
|
+
readonly "permissionPolicies.permissions": string;
|
|
73
|
+
readonly "permissionPolicies.permissionPolicies": string;
|
|
74
|
+
readonly "permissionPolicies.helperText": string;
|
|
75
|
+
readonly "permissionPolicies.allPlugins": string;
|
|
76
|
+
readonly "permissionPolicies.errorFetchingPolicies": string;
|
|
77
|
+
readonly "permissionPolicies.resourceTypeTooltip": string;
|
|
78
|
+
readonly "permissionPolicies.advancedPermissionsTooltip": string;
|
|
79
|
+
readonly "permissionPolicies.pluginsSelected": string;
|
|
80
|
+
readonly "permissionPolicies.noPluginsSelected": string;
|
|
81
|
+
readonly "permissionPolicies.noRecordsToDisplay": string;
|
|
82
|
+
readonly "permissionPolicies.selectedPluginsAppearHere": string;
|
|
83
|
+
readonly "permissionPolicies.selectPlugins": string;
|
|
84
|
+
readonly "permissionPolicies.noPluginsFound": string;
|
|
85
|
+
readonly "permissionPolicies.plugin": string;
|
|
86
|
+
readonly "permissionPolicies.permission": string;
|
|
87
|
+
readonly "permissionPolicies.policies": string;
|
|
88
|
+
readonly "permissionPolicies.conditional": string;
|
|
89
|
+
readonly "deleteDialog.title": string;
|
|
90
|
+
readonly "deleteDialog.question": string;
|
|
91
|
+
readonly "deleteDialog.confirmation": string;
|
|
92
|
+
readonly "deleteDialog.roleNameLabel": string;
|
|
93
|
+
readonly "deleteDialog.roleNameHelper": string;
|
|
94
|
+
readonly "deleteDialog.deleteButton": string;
|
|
95
|
+
readonly "deleteDialog.cancelButton": string;
|
|
96
|
+
readonly "deleteDialog.successMessage": string;
|
|
97
|
+
readonly "snackbar.success": string;
|
|
98
|
+
readonly "conditionalAccess.allOf": string;
|
|
99
|
+
readonly "conditionalAccess.anyOf": string;
|
|
100
|
+
readonly "conditionalAccess.not": string;
|
|
101
|
+
readonly "conditionalAccess.condition": string;
|
|
102
|
+
readonly "conditionalAccess.addNestedCondition": string;
|
|
103
|
+
readonly "conditionalAccess.addRule": string;
|
|
104
|
+
readonly "conditionalAccess.nestedConditionTooltip": string;
|
|
105
|
+
readonly "conditionalAccess.nestedConditionExample": string;
|
|
106
|
+
readonly "common.update": string;
|
|
107
|
+
readonly "common.delete": string;
|
|
108
|
+
readonly "common.use": string;
|
|
109
|
+
readonly "common.name": string;
|
|
110
|
+
readonly "common.rule": string;
|
|
111
|
+
readonly "common.groups": string;
|
|
112
|
+
readonly "common.group": string;
|
|
113
|
+
readonly "common.users": string;
|
|
114
|
+
readonly "common.user": string;
|
|
115
|
+
readonly "common.editRole": string;
|
|
116
|
+
readonly "common.actions": string;
|
|
117
|
+
readonly "common.deleteRole": string;
|
|
118
|
+
readonly "common.description": string;
|
|
119
|
+
readonly "common.owner": string;
|
|
120
|
+
readonly "common.addRule": string;
|
|
121
|
+
readonly "common.noResults": string;
|
|
122
|
+
readonly "common.exportCSV": string;
|
|
123
|
+
readonly "common.csvFilename": string;
|
|
124
|
+
readonly "common.noMembers": string;
|
|
125
|
+
readonly "common.refresh": string;
|
|
126
|
+
readonly "common.edit": string;
|
|
127
|
+
readonly "common.unauthorizedToEdit": string;
|
|
128
|
+
readonly "common.noRecordsFound": string;
|
|
129
|
+
readonly "common.selectUsersAndGroups": string;
|
|
130
|
+
readonly "common.clearSearch": string;
|
|
131
|
+
readonly "common.closeDrawer": string;
|
|
132
|
+
readonly "common.remove": string;
|
|
133
|
+
readonly "common.selectRule": string;
|
|
134
|
+
readonly "common.removeNestedCondition": string;
|
|
135
|
+
readonly "common.overview": string;
|
|
136
|
+
readonly "common.about": string;
|
|
137
|
+
readonly "common.modifiedBy": string;
|
|
138
|
+
readonly "common.lastModified": string;
|
|
139
|
+
readonly "common.noUsersAndGroupsSelected": string;
|
|
140
|
+
readonly "common.selectedUsersAndGroupsAppearHere": string;
|
|
141
|
+
readonly "common.type": string;
|
|
142
|
+
readonly "common.members": string;
|
|
143
|
+
readonly "common.removeMember": string;
|
|
144
|
+
readonly "common.checkingPermissions": string;
|
|
145
|
+
readonly "common.unauthorizedTo": string;
|
|
146
|
+
readonly "common.performThisAction": string;
|
|
147
|
+
readonly "common.unableToCreatePermissionPolicies": string;
|
|
148
|
+
readonly "common.unableToDeletePermissionPolicies": string;
|
|
149
|
+
readonly "common.unableToRemoveConditions": string;
|
|
150
|
+
readonly "common.unableToUpdateConditions": string;
|
|
151
|
+
readonly "common.unableToAddConditions": string;
|
|
152
|
+
readonly "common.roleActionSuccessfully": string;
|
|
153
|
+
readonly "common.unableToFetchRole": string;
|
|
154
|
+
readonly "common.unableToFetchMembers": string;
|
|
155
|
+
readonly "common.roleAction": string;
|
|
156
|
+
readonly "common.membersCount": string;
|
|
157
|
+
readonly "common.parentGroupCount": string;
|
|
158
|
+
readonly "common.childGroupsCount": string;
|
|
159
|
+
readonly "common.searchAndSelectUsersGroups": string;
|
|
160
|
+
readonly "common.noUsersAndGroupsFound": string;
|
|
161
|
+
readonly "common.errorFetchingUserGroups": string;
|
|
162
|
+
readonly "common.nameRequired": string;
|
|
163
|
+
readonly "common.noMemberSelected": string;
|
|
164
|
+
readonly "common.noPluginSelected": string;
|
|
165
|
+
readonly "common.pluginRequired": string;
|
|
166
|
+
readonly "common.permissionRequired": string;
|
|
167
|
+
readonly "common.editCell": string;
|
|
168
|
+
readonly "common.selectCell": string;
|
|
169
|
+
readonly "common.expandRow": string;
|
|
170
|
+
readonly "common.configureAccessFor": string;
|
|
171
|
+
readonly "common.defaultResourceTypeVisible": string;
|
|
172
|
+
}>;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* @public
|
|
176
|
+
*/
|
|
177
|
+
declare const rbacTranslations: _backstage_core_plugin_api_alpha.TranslationResource<"plugin.rbac">;
|
|
178
|
+
|
|
179
|
+
export { rbacTranslationRef, rbacTranslations };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alpha.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -3,16 +3,20 @@ 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
|
+
import { MarkdownContent } from '@backstage/core-components';
|
|
7
|
+
import { useTranslation } from '../../hooks/useTranslation.esm.js';
|
|
6
8
|
|
|
7
|
-
const tooltipTitle = () => /* @__PURE__ */ jsxs("div", { children: [
|
|
8
|
-
/* @__PURE__ */
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
const tooltipTitle = (t) => /* @__PURE__ */ jsxs("div", { children: [
|
|
10
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body1", component: "p", align: "center", children: /* @__PURE__ */ jsx(
|
|
11
|
+
MarkdownContent,
|
|
12
|
+
{
|
|
13
|
+
content: t("conditionalAccess.nestedConditionTooltip")
|
|
14
|
+
}
|
|
15
|
+
) }),
|
|
16
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body1", component: "p", align: "center", children: t("conditionalAccess.nestedConditionExample") })
|
|
14
17
|
] });
|
|
15
18
|
const AddNestedConditionButton = () => {
|
|
19
|
+
const { t } = useTranslation();
|
|
16
20
|
return /* @__PURE__ */ jsxs(
|
|
17
21
|
Box,
|
|
18
22
|
{
|
|
@@ -22,8 +26,8 @@ const AddNestedConditionButton = () => {
|
|
|
22
26
|
alignItems: "center"
|
|
23
27
|
},
|
|
24
28
|
children: [
|
|
25
|
-
/* @__PURE__ */ jsx(Typography, { variant: "body1", component: "span", children: "
|
|
26
|
-
/* @__PURE__ */ jsx(Tooltip, { title: tooltipTitle(), placement: "top", children: /* @__PURE__ */ jsx(HelpOutlineIcon, { fontSize: "inherit", style: { marginLeft: "0.25rem" } }) })
|
|
29
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body1", component: "span", children: t("conditionalAccess.addNestedCondition") }),
|
|
30
|
+
/* @__PURE__ */ jsx(Tooltip, { title: tooltipTitle(t), placement: "top", children: /* @__PURE__ */ jsx(HelpOutlineIcon, { fontSize: "inherit", style: { marginLeft: "0.25rem" } }) })
|
|
27
31
|
]
|
|
28
32
|
}
|
|
29
33
|
);
|
|
@@ -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 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
|
|
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';\nimport { MarkdownContent } from '@backstage/core-components';\nimport { TranslationFunction } from '@backstage/core-plugin-api/alpha';\nimport { useTranslation } from '../../hooks/useTranslation';\nimport { rbacTranslationRef } from '../../translations';\n\nexport const tooltipTitle = (\n t: TranslationFunction<typeof rbacTranslationRef.T>,\n) => (\n <div>\n <Typography variant=\"body1\" component=\"p\" align=\"center\">\n <MarkdownContent\n content={t('conditionalAccess.nestedConditionTooltip')}\n />\n </Typography>\n <Typography variant=\"body1\" component=\"p\" align=\"center\">\n {t('conditionalAccess.nestedConditionExample')}\n </Typography>\n </div>\n);\n\nexport const AddNestedConditionButton = () => {\n const { t } = useTranslation();\n\n return (\n <Box\n sx={{\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n }}\n >\n <Typography variant=\"body1\" component=\"span\">\n {t('conditionalAccess.addNestedCondition')}\n </Typography>\n <Tooltip title={tooltipTitle(t)} placement=\"top\">\n <HelpOutlineIcon fontSize=\"inherit\" style={{ marginLeft: '0.25rem' }} />\n </Tooltip>\n </Box>\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leRule, getRowStyle, getRowKey, getSimpleRuleErrors, getNestedRuleErrors } from '../../utils/conditional-access-utils.esm.js';
|
|
5
5
|
import { ConditionsFormRowFields } from './ConditionsFormRowFields.esm.js';
|
|
6
6
|
import { criterias } from './const.esm.js';
|
|
7
|
+
import { useTranslation } from '../../hooks/useTranslation.esm.js';
|
|
7
8
|
|
|
8
9
|
const ComplexConditionRow = ({
|
|
9
10
|
conditionRow,
|
|
@@ -22,6 +23,7 @@ const ComplexConditionRow = ({
|
|
|
22
23
|
nestedConditionIndex,
|
|
23
24
|
activeNestedCriteria
|
|
24
25
|
}) => {
|
|
26
|
+
const { t } = useTranslation();
|
|
25
27
|
const handleRemoveSimpleConditionRule = (index, ruleList2) => {
|
|
26
28
|
if (!activeCriteria) {
|
|
27
29
|
return;
|
|
@@ -131,7 +133,7 @@ const ComplexConditionRow = ({
|
|
|
131
133
|
/* @__PURE__ */ jsx(
|
|
132
134
|
IconButton,
|
|
133
135
|
{
|
|
134
|
-
title: "
|
|
136
|
+
title: t("common.remove"),
|
|
135
137
|
sx: {
|
|
136
138
|
color: (theme) => theme.palette.grey[500],
|
|
137
139
|
flexGrow: 0,
|
|
@@ -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 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 mt: '34px',\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,SAChB,EAAC;AAER,IAAa,YAAA,CAAA;AAAA,MACX,CAAC,cAAsC,GAAG;AAAA,QACxC,GAAG,kBAAA;AAAA,QACH,GAAG;AAAA;AACL,KACD,CAAA;AAED,IAAA,SAAA,CAAU,CAAc,UAAA,KAAA;AACtB,MAAM,MAAA,aAAA,GAAgB,EAAE,GAAG,UAAW,EAAA;AAEtC,MAAI,IAAA,aAAA,CAAc,cAAc,CAAG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AA;AAAA,cACtC,QAAU,EAAA,CAAA;AAAA,cACV,SAAW,EAAA,UAAA;AAAA,cACX,EAAI,EAAA;AAAA,aACN;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
|
+
{"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 { useTranslation } from '../../hooks/useTranslation';\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 { t } = useTranslation();\n\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={t('common.remove')}\n sx={{\n color: theme => theme.palette.grey[500],\n flexGrow: 0,\n alignSelf: 'baseline',\n mt: '34px',\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":";;;;;;;;AA4DO,MA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ACA,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;;;;"}
|
|
@@ -8,6 +8,7 @@ import Typography from '@mui/material/Typography';
|
|
|
8
8
|
import { getDefaultRule } from '../../utils/conditional-access-utils.esm.js';
|
|
9
9
|
import { tooltipTitle } from './AddNestedConditionButton.esm.js';
|
|
10
10
|
import { criterias } from './const.esm.js';
|
|
11
|
+
import { useTranslation } from '../../hooks/useTranslation.esm.js';
|
|
11
12
|
|
|
12
13
|
const ComplexConditionRowButtons = ({
|
|
13
14
|
conditionRow,
|
|
@@ -18,6 +19,7 @@ const ComplexConditionRowButtons = ({
|
|
|
18
19
|
isNestedConditionRule,
|
|
19
20
|
handleAddNestedCondition
|
|
20
21
|
}) => {
|
|
22
|
+
const { t } = useTranslation();
|
|
21
23
|
const findFirstNestedConditionIndex = (rules) => {
|
|
22
24
|
return rules.findIndex((e) => isNestedConditionRule(e)) || 0;
|
|
23
25
|
};
|
|
@@ -60,7 +62,7 @@ const ComplexConditionRowButtons = ({
|
|
|
60
62
|
size: "small",
|
|
61
63
|
onClick: handleAddRule,
|
|
62
64
|
startIcon: /* @__PURE__ */ jsx(AddIcon, { fontSize: "small" }),
|
|
63
|
-
children: /* @__PURE__ */ jsx(Typography, { variant: "body2", component: "span", children: "
|
|
65
|
+
children: /* @__PURE__ */ jsx(Typography, { variant: "body2", component: "span", children: t("conditionalAccess.addRule") })
|
|
64
66
|
}
|
|
65
67
|
),
|
|
66
68
|
/* @__PURE__ */ jsxs(
|
|
@@ -73,8 +75,8 @@ const ComplexConditionRowButtons = ({
|
|
|
73
75
|
onClick: () => handleAddNestedCondition(criteria),
|
|
74
76
|
startIcon: /* @__PURE__ */ jsx(AddIcon, { fontSize: "small" }),
|
|
75
77
|
children: [
|
|
76
|
-
/* @__PURE__ */ jsx(Typography, { variant: "body2", component: "span", children: "
|
|
77
|
-
/* @__PURE__ */ jsx(Tooltip, { title: tooltipTitle(), placement: "top", children: /* @__PURE__ */ jsx(HelpOutlineIcon, { fontSize: "inherit", style: { marginLeft: 4 } }) })
|
|
78
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", component: "span", children: t("conditionalAccess.addNestedCondition") }),
|
|
79
|
+
/* @__PURE__ */ jsx(Tooltip, { title: tooltipTitle(t), placement: "top", children: /* @__PURE__ */ jsx(HelpOutlineIcon, { fontSize: "inherit", style: { marginLeft: 4 } }) })
|
|
78
80
|
]
|
|
79
81
|
}
|
|
80
82
|
)
|
|
@@ -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 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';\nimport Typography from '@mui/material/Typography';\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={2}\n sx={{\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'space-between',\n gap: 1,\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 <Typography variant=\"body2\" component=\"span\">\n
|
|
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';\nimport Typography from '@mui/material/Typography';\n\nimport { getDefaultRule } from '../../utils/conditional-access-utils';\nimport { tooltipTitle } from './AddNestedConditionButton';\nimport { criterias } from './const';\nimport { Condition, ConditionsData } from './types';\nimport { useTranslation } from '../../hooks/useTranslation';\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 { t } = useTranslation();\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={2}\n sx={{\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'space-between',\n gap: 1,\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 <Typography variant=\"body2\" component=\"span\">\n {t('conditionalAccess.addRule')}\n </Typography>\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 >\n <Typography variant=\"body2\" component=\"span\">\n {t('conditionalAccess.addNestedCondition')}\n </Typography>\n <Tooltip title={tooltipTitle(t)} placement=\"top\">\n <HelpOutlineIcon fontSize=\"inherit\" style={{ marginLeft: 4 }} />\n </Tooltip>\n </Button>\n </Box>\n )\n );\n};\n"],"names":[],"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,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA;AAC7B,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,IAAA,IAAI,8BAA8B,EAAI,EAAA;AACpC,MAAa,YAAA,CAAA,MAAA;AAAA,QACX,yBAAA;AAAA,QACA,CAAA;AAAA,QACA,eAAe,qBAAqB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,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,YAErC,QAAA,EAAA;AAAA,8BAAA,GAAA,CAAC,cAAW,OAAQ,EAAA,OAAA,EAAQ,WAAU,MACnC,EAAA,QAAA,EAAA,CAAA,CAAE,sCAAsC,CAC3C,EAAA,CAAA;AAAA,kCACC,OAAQ,EAAA,EAAA,KAAA,EAAO,YAAa,CAAA,CAAC,GAAG,SAAU,EAAA,KAAA,EACzC,QAAC,kBAAA,GAAA,CAAA,eAAA,EAAA,EAAgB,UAAS,SAAU,EAAA,KAAA,EAAO,EAAE,UAAY,EAAA,CAAA,IAAK,CAChE,EAAA;AAAA;AAAA;AAAA;AACF;AAAA;AAAA,GACF;AAGN;;;;"}
|
|
@@ -5,6 +5,7 @@ import Drawer from '@mui/material/Drawer';
|
|
|
5
5
|
import IconButton from '@mui/material/IconButton';
|
|
6
6
|
import Typography from '@mui/material/Typography';
|
|
7
7
|
import { ConditionsForm } from './ConditionsForm.esm.js';
|
|
8
|
+
import { useTranslation } from '../../hooks/useTranslation.esm.js';
|
|
8
9
|
|
|
9
10
|
const ConditionalAccessSidebar = ({
|
|
10
11
|
open,
|
|
@@ -14,6 +15,7 @@ const ConditionalAccessSidebar = ({
|
|
|
14
15
|
conditionRulesData,
|
|
15
16
|
conditionsFormVal
|
|
16
17
|
}) => {
|
|
18
|
+
const { t } = useTranslation();
|
|
17
19
|
return /* @__PURE__ */ jsx(
|
|
18
20
|
Drawer,
|
|
19
21
|
{
|
|
@@ -54,7 +56,7 @@ const ConditionalAccessSidebar = ({
|
|
|
54
56
|
children: [
|
|
55
57
|
/* @__PURE__ */ jsxs(Box, { children: [
|
|
56
58
|
/* @__PURE__ */ jsxs(Box, { sx: { display: "flex", gap: "5px" }, children: [
|
|
57
|
-
/* @__PURE__ */ jsx(Typography, { sx: { fontWeight: 500 }, variant: "h5", children: "
|
|
59
|
+
/* @__PURE__ */ jsx(Typography, { sx: { fontWeight: 500 }, variant: "h5", children: t("common.configureAccessFor") }),
|
|
58
60
|
/* @__PURE__ */ jsx(Typography, { style: { fontWeight: 600 }, variant: "h5", children: selPluginResourceType })
|
|
59
61
|
] }),
|
|
60
62
|
/* @__PURE__ */ jsx(
|
|
@@ -67,14 +69,14 @@ const ConditionalAccessSidebar = ({
|
|
|
67
69
|
paddingTop: (theme) => theme.spacing(1)
|
|
68
70
|
},
|
|
69
71
|
align: "left",
|
|
70
|
-
children: "
|
|
72
|
+
children: t("common.defaultResourceTypeVisible")
|
|
71
73
|
}
|
|
72
74
|
)
|
|
73
75
|
] }),
|
|
74
76
|
/* @__PURE__ */ jsx(
|
|
75
77
|
IconButton,
|
|
76
78
|
{
|
|
77
|
-
title: "
|
|
79
|
+
title: t("common.closeDrawer"),
|
|
78
80
|
onClick: onClose,
|
|
79
81
|
color: "inherit",
|
|
80
82
|
children: /* @__PURE__ */ jsx(CloseIcon, { fontSize: "small" })
|
|
@@ -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 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
|
|
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';\nimport { useTranslation } from '../../hooks/useTranslation';\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 const { t } = useTranslation();\n\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 {t('common.configureAccessFor')}\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 {t('common.defaultResourceTypeVisible')}\n </Typography>\n </Box>\n <IconButton\n key=\"dismiss\"\n title={t('common.closeDrawer')}\n onClick={onClose}\n color=\"inherit\"\n >\n <CloseIcon fontSize=\"small\" />\n </IconButton>\n </Box>\n <ConditionsForm\n conditionRulesData={conditionRulesData}\n selPluginResourceType={selPluginResourceType}\n conditionsFormV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;AAAA,aACF;AAAA,4BACA,GAAA;AAAA,cAAC,cAAA;AAAA,cAAA;AAAA,gBACC,kBAAA;AAAA,gBACA,qBAAA;AAAA,gBACA,iBAAA;AAAA,gBACA,OAAA;AAAA,gBACA;AAAA;AAAA;AACF;AAAA;AAAA;AACF;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -16,7 +16,8 @@ import { ComplexConditionRow } from './ComplexConditionRow.esm.js';
|
|
|
16
16
|
import { ComplexConditionRowButtons } from './ComplexConditionRowButtons.esm.js';
|
|
17
17
|
import { ConditionRule } from './ConditionRule.esm.js';
|
|
18
18
|
import { ConditionsFormRowFields } from './ConditionsFormRowFields.esm.js';
|
|
19
|
-
import { criterias,
|
|
19
|
+
import { criterias, getConditionButtons } from './const.esm.js';
|
|
20
|
+
import { useTranslation } from '../../hooks/useTranslation.esm.js';
|
|
20
21
|
import { CriteriaToggleButton } from './CriteriaToggleButton.esm.js';
|
|
21
22
|
import { NotConditionType } from './types.esm.js';
|
|
22
23
|
import Typography from '@mui/material/Typography';
|
|
@@ -31,6 +32,7 @@ const ConditionsFormRow = ({
|
|
|
31
32
|
setErrors,
|
|
32
33
|
setRemoveAllClicked
|
|
33
34
|
}) => {
|
|
35
|
+
const { t } = useTranslation();
|
|
34
36
|
const theme = useTheme();
|
|
35
37
|
const [nestedConditionRow, setNestedConditionRow] = useState([]);
|
|
36
38
|
const [notConditionType, setNotConditionType] = useState(
|
|
@@ -293,7 +295,7 @@ const ConditionsFormRow = ({
|
|
|
293
295
|
width: "60%",
|
|
294
296
|
height: "100%"
|
|
295
297
|
},
|
|
296
|
-
children: nestedConditionButtons.map(({ val, label }) => /* @__PURE__ */ jsx(
|
|
298
|
+
children: nestedConditionButtons(t).map(({ val, label }) => /* @__PURE__ */ jsx(
|
|
297
299
|
CriteriaToggleButton,
|
|
298
300
|
{
|
|
299
301
|
val,
|
|
@@ -308,7 +310,7 @@ const ConditionsFormRow = ({
|
|
|
308
310
|
criteria !== criterias.not && /* @__PURE__ */ jsx(
|
|
309
311
|
IconButton,
|
|
310
312
|
{
|
|
311
|
-
title: "
|
|
313
|
+
title: t("common.removeNestedCondition"),
|
|
312
314
|
sx: {
|
|
313
315
|
color: theme.palette.grey[500],
|
|
314
316
|
flexGrow: 0,
|
|
@@ -415,7 +417,7 @@ const ConditionsFormRow = ({
|
|
|
415
417
|
backgroundColor: theme.palette.background.paper,
|
|
416
418
|
width: "80%"
|
|
417
419
|
},
|
|
418
|
-
children:
|
|
420
|
+
children: getConditionButtons(t).map(({ val, label }) => /* @__PURE__ */ jsx(
|
|
419
421
|
CriteriaToggleButton,
|
|
420
422
|
{
|
|
421
423
|
val,
|
|
@@ -474,7 +476,7 @@ const ConditionsFormRow = ({
|
|
|
474
476
|
{
|
|
475
477
|
value: NotConditionType.SimpleCondition,
|
|
476
478
|
control: /* @__PURE__ */ jsx(Radio, { color: "primary" }),
|
|
477
|
-
label: "
|
|
479
|
+
label: t("common.addRule"),
|
|
478
480
|
sx: {
|
|
479
481
|
marginTop: theme.spacing(1)
|
|
480
482
|
}
|