@akemona-org/strapi-admin 3.7.0 → 3.7.2
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/admin/src/app.js +15 -15
- package/admin/src/components/Header/index.js +4 -4
- package/admin/src/components/LeftMenu/LeftMenuFooter/Wrapper.js +1 -1
- package/admin/src/components/LeftMenu/LeftMenuFooter/index.js +6 -1
- package/admin/src/components/LeftMenu/LeftMenuHeader/Wrapper.js +3 -3
- package/admin/src/components/LeftMenu/LeftMenuLink/A.js +7 -7
- package/admin/src/components/LeftMenu/LeftMenuLink/LeftMenuLinkContent.js +1 -1
- package/admin/src/components/LeftMenu/LeftMenuLinkHeader/Title.js +1 -1
- package/admin/src/components/LeftMenu/LeftMenuLinkHeader/index.js +2 -2
- package/admin/src/components/LeftMenu/LeftMenuLinkSection/index.js +1 -1
- package/admin/src/components/LeftMenu/LinksContainer/index.js +2 -2
- package/admin/src/components/Notifications/Notification/Li.js +15 -15
- package/admin/src/components/Roles/ConditionsModal/ConditionsSelect/ClearIndicator.js +1 -1
- package/admin/src/components/Roles/ConditionsModal/ConditionsSelect/MenuList/index.js +7 -6
- package/admin/src/components/Roles/ConditionsModal/ConditionsSelect/MenuList/utils/createCollapsesObject.js +1 -1
- package/admin/src/components/Roles/ConditionsModal/ConditionsSelect/SingleValue.js +1 -1
- package/admin/src/components/Roles/ConditionsModal/index.js +2 -2
- package/admin/src/components/Roles/ConditionsModal/utils/selectStyle.js +8 -8
- package/admin/src/components/Roles/ContentTypeCollapse/Collapse/index.js +4 -7
- package/admin/src/components/Roles/ContentTypeCollapse/Collapse/utils/generateCheckboxesActions.js +1 -1
- package/admin/src/components/Roles/ContentTypeCollapse/CollapsePropertyMatrix/ActionRow/index.js +1 -1
- package/admin/src/components/Roles/ContentTypeCollapse/CollapsePropertyMatrix/ActionRow/utils/getRowLabelCheckboxeState.js +1 -1
- package/admin/src/components/Roles/ContentTypeCollapse/CollapsePropertyMatrix/Header/index.js +1 -1
- package/admin/src/components/Roles/ContentTypeCollapse/CollapsePropertyMatrix/SubActionRow/index.js +6 -10
- package/admin/src/components/Roles/ContentTypeCollapse/CollapsePropertyMatrix/utils/generateHeadersFromActions.js +1 -1
- package/admin/src/components/Roles/ContentTypeCollapse/utils/activeStyle.js +1 -1
- package/admin/src/components/Roles/ContentTypeCollapse/utils/getAvailableActions.js +1 -1
- package/admin/src/components/Roles/ContentTypeCollapses/index.js +1 -1
- package/admin/src/components/Roles/Curve/index.js +1 -1
- package/admin/src/components/Roles/GlobalActions/utils/findDisplayedActions.js +1 -1
- package/admin/src/components/Roles/GlobalActions/utils/getRowLabelCheckboxesState.js +2 -2
- package/admin/src/components/Roles/Permissions/index.js +5 -4
- package/admin/src/components/Roles/Permissions/reducer.js +4 -4
- package/admin/src/components/Roles/Permissions/utils/createDefaultCTFormFromLayout.js +1 -1
- package/admin/src/components/Roles/Permissions/utils/findMatchingPermissions.js +1 -1
- package/admin/src/components/Roles/Permissions/utils/formatContentTypesPermissionToAPI.js +2 -2
- package/admin/src/components/Roles/Permissions/utils/formatLayoutForSettingsAndPlugins.js +1 -1
- package/admin/src/components/Roles/Permissions/utils/formatPermissionsToAPI.js +1 -1
- package/admin/src/components/Roles/Permissions/utils/formatSettingsPermissionsToAPI.js +4 -4
- package/admin/src/components/Roles/Permissions/utils/updateConditionsToFalse.js +2 -2
- package/admin/src/components/Roles/PluginsAndSettings/Row/Wrapper.js +1 -1
- package/admin/src/components/Roles/PluginsAndSettings/SubCategory/index.js +4 -7
- package/admin/src/components/Roles/PluginsAndSettings/SubCategory/utils/formatActions.js +2 -2
- package/admin/src/components/Roles/PluginsAndSettings/SubCategory/utils/getConditionsButtonState.js +2 -2
- package/admin/src/components/Roles/PluginsAndSettings/index.js +1 -1
- package/admin/src/components/Roles/RoleForm/NameInput.js +1 -1
- package/admin/src/components/Roles/RoleList/RoleDescription.js +1 -1
- package/admin/src/components/Roles/Tabs/index.js +1 -1
- package/admin/src/components/Roles/utils/createArrayOfValues.js +2 -2
- package/admin/src/components/Roles/utils/getCheckboxState.js +3 -3
- package/admin/src/components/Roles/utils/removeConditionKeyFromData.js +1 -1
- package/admin/src/components/Users/FilterPicker/Card/Input.js +1 -1
- package/admin/src/components/Users/FilterPicker/Card/index.js +2 -2
- package/admin/src/components/Users/FilterPicker/Card/init.js +1 -1
- package/admin/src/components/Users/FilterPicker/Card/reducer.js +1 -1
- package/admin/src/components/Users/FilterPicker/index.js +1 -1
- package/admin/src/components/Users/List/index.js +5 -5
- package/admin/src/components/Users/List/init.js +1 -1
- package/admin/src/components/Users/List/reducer.js +1 -1
- package/admin/src/components/Users/List/utils/checkIfAllEntriesAreSelected.js +1 -1
- package/admin/src/components/Users/List/utils/headers.js +2 -2
- package/admin/src/components/Users/List/utils/updateRows.js +1 -1
- package/admin/src/components/Users/ModalCreateBody/index.js +3 -3
- package/admin/src/components/Users/ModalCreateBody/init.js +1 -1
- package/admin/src/components/Users/ModalCreateBody/reducer.js +1 -1
- package/admin/src/components/Users/ModalCreateBody/utils/schema.js +2 -8
- package/admin/src/components/Users/RoleSettingsModalSection/index.js +1 -1
- package/admin/src/components/Users/SelectRoles/ClearIndicator.js +1 -1
- package/admin/src/components/Users/SelectRoles/MultiValueContainer.js +1 -1
- package/admin/src/components/Users/SelectRoles/index.js +3 -3
- package/admin/src/components/Users/SelectRoles/utils/styles.js +4 -4
- package/admin/src/components/Users/SortPicker/Button.js +1 -1
- package/admin/src/components/Users/SortPicker/List.js +1 -1
- package/admin/src/components/Users/SortPicker/ListWrapper.js +1 -1
- package/admin/src/components/Users/SortPicker/index.js +2 -2
- package/admin/src/components/Webhooks/EventInput/EventRow.js +2 -2
- package/admin/src/components/Webhooks/EventInput/index.js +5 -5
- package/admin/src/components/Webhooks/EventInput/utils/formatValue.js +1 -1
- package/admin/src/components/Webhooks/HeadersInput/index.js +6 -6
- package/admin/src/components/Webhooks/Inputs/index.js +2 -2
- package/admin/src/components/Webhooks/ListRow/index.js +3 -3
- package/admin/src/configureStore.js +1 -1
- package/admin/src/containers/Admin/Content.js +5 -5
- package/admin/src/containers/Admin/Logout/index.js +1 -1
- package/admin/src/containers/Admin/Wrapper.js +1 -1
- package/admin/src/containers/Admin/reducer.js +1 -1
- package/admin/src/containers/Admin/selectors.js +2 -2
- package/admin/src/containers/App/selectors.js +9 -8
- package/admin/src/containers/App/styles/website.css +5 -5
- package/admin/src/containers/ApplicationInfosPage/index.js +4 -4
- package/admin/src/containers/AuthPage/components/ForgotPassword/index.js +1 -1
- package/admin/src/containers/AuthPage/components/Login/BaseLogin.js +1 -1
- package/admin/src/containers/AuthPage/components/Login/index.js +2 -2
- package/admin/src/containers/AuthPage/components/Register/index.js +3 -3
- package/admin/src/containers/AuthPage/components/ResetPassword/index.js +1 -1
- package/admin/src/containers/AuthPage/init.js +1 -1
- package/admin/src/containers/AuthPage/reducer.js +1 -1
- package/admin/src/containers/AuthPage/utils/forms.js +2 -8
- package/admin/src/containers/HomePage/index.js +15 -16
- package/admin/src/containers/InstalledPluginsPage/Row.js +1 -1
- package/admin/src/containers/InstalledPluginsPage/index.js +1 -1
- package/admin/src/containers/InstalledPluginsPage/utils/generateRows.js +1 -1
- package/admin/src/containers/LanguageProvider/hooks/useChangeLanguage.js +1 -1
- package/admin/src/containers/LanguageProvider/index.js +1 -1
- package/admin/src/containers/LanguageProvider/selectors.js +3 -10
- package/admin/src/containers/LeftMenu/Wrapper.js +5 -5
- package/admin/src/containers/LeftMenu/reducer.js +1 -1
- package/admin/src/containers/LeftMenu/selectors.js +1 -1
- package/admin/src/containers/LeftMenu/utils/generateModelsLinks.js +2 -2
- package/admin/src/containers/LeftMenu/utils/getCtOrStLinks.js +5 -4
- package/admin/src/containers/LeftMenu/utils/getGeneralLinks.js +1 -1
- package/admin/src/containers/LeftMenu/utils/getSettingsMenuLinksPermissions.js +1 -1
- package/admin/src/containers/LeftMenu/utils/toPluginLinks.js +2 -2
- package/admin/src/containers/LocaleToggle/index.js +2 -2
- package/admin/src/containers/LocaleToggle/selectors.js +4 -7
- package/admin/src/containers/MarketplacePage/PluginCard/index.js +3 -3
- package/admin/src/containers/MarketplacePage/index.js +2 -2
- package/admin/src/containers/NewNotification/Notification/index.js +4 -12
- package/admin/src/containers/NewNotification/Notification/styledComponents.js +1 -1
- package/admin/src/containers/NewNotification/index.js +2 -2
- package/admin/src/containers/NewNotification/reducer.js +2 -2
- package/admin/src/containers/NotFoundPage/index.js +1 -1
- package/admin/src/containers/NotificationProvider/actions.js +1 -1
- package/admin/src/containers/NotificationProvider/index.js +1 -1
- package/admin/src/containers/NotificationProvider/selectors.js +3 -3
- package/admin/src/containers/Onboarding/StaticLinks/index.js +2 -2
- package/admin/src/containers/Onboarding/Video.js +1 -1
- package/admin/src/containers/Onboarding/index.js +2 -2
- package/admin/src/containers/Onboarding/init.js +1 -1
- package/admin/src/containers/Onboarding/reducer.js +6 -6
- package/admin/src/containers/Onboarding/utils/formatAndStoreVideoArray.js +2 -2
- package/admin/src/containers/PermissionsManager/index.js +1 -1
- package/admin/src/containers/PermissionsManager/reducer.js +2 -2
- package/admin/src/containers/PrivateRoute/index.js +1 -1
- package/admin/src/containers/ProfilePage/index.js +4 -4
- package/admin/src/containers/Roles/EditPage/index.js +1 -1
- package/admin/src/containers/Roles/ListPage/index.js +5 -5
- package/admin/src/containers/SettingsPage/components/ApplicationDetailLink/Icon.js +1 -1
- package/admin/src/containers/SettingsPage/components/MenuWrapper/index.js +1 -1
- package/admin/src/containers/SettingsPage/index.js +3 -3
- package/admin/src/containers/SettingsPage/utils/createPluginsLinksRoutes.js +3 -3
- package/admin/src/containers/SettingsPage/utils/findFirstAllowedEndpoint.js +3 -3
- package/admin/src/containers/SettingsPage/utils/getSectionsToDisplay.js +2 -2
- package/admin/src/containers/SettingsPage/utils/makeUniqueRoutes.js +2 -2
- package/admin/src/containers/Users/EditPage/index.js +2 -2
- package/admin/src/containers/Users/ListPage/Header.js +2 -2
- package/admin/src/containers/Users/ListPage/index.js +4 -4
- package/admin/src/containers/Users/ListPage/init.js +1 -1
- package/admin/src/containers/Users/ListPage/reducer.js +1 -1
- package/admin/src/containers/Users/ListPage/utils/getFilters.js +1 -1
- package/admin/src/containers/Webhooks/EditView/index.js +11 -17
- package/admin/src/containers/Webhooks/EditView/reducer.js +4 -4
- package/admin/src/containers/Webhooks/EditView/utils/formatData.js +2 -2
- package/admin/src/containers/Webhooks/EditView/utils/schema.js +1 -1
- package/admin/src/containers/Webhooks/ListView/index.js +5 -5
- package/admin/src/containers/Webhooks/ListView/reducer.js +5 -5
- package/admin/src/contexts/MarketPlace/index.js +2 -10
- package/admin/src/hooks/useFetchPermissionsLayout/index.js +1 -1
- package/admin/src/hooks/useFetchPermissionsLayout/reducer.js +1 -1
- package/admin/src/hooks/useFetchPluginsFromMarketPlace/index.js +1 -1
- package/admin/src/hooks/useFetchRole/index.js +4 -4
- package/admin/src/hooks/useFetchRole/reducer.js +1 -1
- package/admin/src/hooks/useModels/index.js +1 -1
- package/admin/src/hooks/useModels/reducer.js +3 -3
- package/admin/src/hooks/useRolesList/reducer.js +1 -1
- package/admin/src/hooks/useSettingsForm/index.js +2 -2
- package/admin/src/hooks/useSettingsForm/reducer.js +1 -1
- package/admin/src/hooks/useSettingsMenu/index.js +2 -2
- package/admin/src/hooks/useSettingsMenu/reducer.js +3 -3
- package/admin/src/hooks/useSettingsMenu/utils/formatLinks.js +3 -3
- package/admin/src/plugins.js +2 -2
- package/admin/src/public-path.js +1 -3
- package/admin/src/utils/ComponentApi.js +3 -3
- package/admin/src/utils/FieldApi.js +3 -3
- package/admin/src/utils/Plugin.js +1 -1
- package/admin/src/utils/Strapi.js +2 -2
- package/admin/src/utils/checkStore.js +1 -4
- package/admin/src/utils/getAttributesToDisplay.js +1 -1
- package/admin/src/utils/getExistingActions.js +2 -2
- package/admin/src/utils/getRequestUrl.js +1 -1
- package/admin/src/utils/injectReducer.js +26 -25
- package/admin/src/utils/injectSaga.js +28 -27
- package/admin/src/utils/reducerInjectors.js +1 -5
- package/admin/src/utils/retrieveGlobalLinks.js +1 -1
- package/admin/src/utils/retrievePluginsMenu.js +1 -1
- package/admin/src/utils/sagaInjectors.js +4 -7
- package/admin/src/utils/sortLinks.js +1 -1
- package/admin/src/validations/users/profile.js +1 -5
- package/admin/src/validations/users/roles.js +1 -4
- package/config/admin-conditions.js +3 -3
- package/config/migrations/permissions-fields-to-properties.js +4 -4
- package/controllers/admin.js +1 -1
- package/controllers/formatters/format-actions-by-sections.js +1 -1
- package/doc/customize-menu.md +3 -3
- package/domain/action/index.js +3 -3
- package/domain/condition/index.js +2 -2
- package/domain/permission/index.js +3 -3
- package/domain/user.js +2 -2
- package/index.js +16 -14
- package/middlewares/auth/index.js +1 -1
- package/package.json +4 -4
- package/services/action.js +1 -1
- package/services/condition.js +1 -1
- package/services/passport/local-strategy.js +2 -2
- package/services/passport.js +2 -4
- package/services/permission/engine.js +9 -9
- package/services/permission/queries.js +11 -12
- package/services/permission/sections-builder/utils.js +5 -5
- package/services/token.js +2 -2
- package/utils/index.js +1 -1
- package/validation/common-functions/check-fields-are-correctly-nested.js +3 -2
- package/validation/common-functions/check-fields-dont-have-duplicates.js +1 -1
- package/webpack.config.js +2 -2
|
@@ -32,8 +32,8 @@ const Permissions = forwardRef(({ layout, isFormDisabled, permissions }, ref) =>
|
|
|
32
32
|
if (isEmpty(contentTypesDiff)) {
|
|
33
33
|
didUpdateConditions = false;
|
|
34
34
|
} else {
|
|
35
|
-
didUpdateConditions = Object.values(contentTypesDiff).some(permission => {
|
|
36
|
-
return Object.values(permission).some(permissionValue =>
|
|
35
|
+
didUpdateConditions = Object.values(contentTypesDiff).some((permission) => {
|
|
36
|
+
return Object.values(permission).some((permissionValue) =>
|
|
37
37
|
has(permissionValue, 'conditions')
|
|
38
38
|
);
|
|
39
39
|
});
|
|
@@ -74,7 +74,7 @@ const Permissions = forwardRef(({ layout, isFormDisabled, permissions }, ref) =>
|
|
|
74
74
|
});
|
|
75
75
|
};
|
|
76
76
|
|
|
77
|
-
const handleChangeConditions = conditions => {
|
|
77
|
+
const handleChangeConditions = (conditions) => {
|
|
78
78
|
dispatch({ type: 'ON_CHANGE_CONDITIONS', conditions });
|
|
79
79
|
};
|
|
80
80
|
|
|
@@ -102,7 +102,8 @@ const Permissions = forwardRef(({ layout, isFormDisabled, permissions }, ref) =>
|
|
|
102
102
|
onChangeConditions: handleChangeConditions,
|
|
103
103
|
onChangeSimpleCheckbox: handleChangeSimpleCheckbox,
|
|
104
104
|
onChangeParentCheckbox: handleChangeParentCheckbox,
|
|
105
|
-
onChangeCollectionTypeLeftActionRowCheckbox:
|
|
105
|
+
onChangeCollectionTypeLeftActionRowCheckbox:
|
|
106
|
+
handleChangeCollectionTypeLeftActionRowCheckbox,
|
|
106
107
|
onChangeCollectionTypeGlobalActionCheckbox: handleChangeCollectionTypeGlobalActionCheckbox,
|
|
107
108
|
}}
|
|
108
109
|
>
|
|
@@ -11,7 +11,7 @@ const initialState = {
|
|
|
11
11
|
|
|
12
12
|
/* eslint-disable consistent-return */
|
|
13
13
|
const reducer = (state, action) =>
|
|
14
|
-
produce(state, draftState => {
|
|
14
|
+
produce(state, (draftState) => {
|
|
15
15
|
switch (action.type) {
|
|
16
16
|
// This action is called when a checkbox in the <GlobalActions />
|
|
17
17
|
// changes
|
|
@@ -19,7 +19,7 @@ const reducer = (state, action) =>
|
|
|
19
19
|
const { collectionTypeKind, actionId, value } = action;
|
|
20
20
|
const pathToData = ['modifiedData', collectionTypeKind];
|
|
21
21
|
|
|
22
|
-
Object.keys(get(state, pathToData)).forEach(collectionType => {
|
|
22
|
+
Object.keys(get(state, pathToData)).forEach((collectionType) => {
|
|
23
23
|
const collectionTypeActionData = get(
|
|
24
24
|
state,
|
|
25
25
|
[...pathToData, collectionType, actionId],
|
|
@@ -49,7 +49,7 @@ const reducer = (state, action) =>
|
|
|
49
49
|
|
|
50
50
|
const objToUpdate = get(nextModifiedDataState, pathToModifiedDataCollectionType, {});
|
|
51
51
|
|
|
52
|
-
Object.keys(objToUpdate).forEach(actionId => {
|
|
52
|
+
Object.keys(objToUpdate).forEach((actionId) => {
|
|
53
53
|
// When a ct has multiple properties (ex: locales, field)
|
|
54
54
|
// We need to make sure that we add any new property to the modifiedData
|
|
55
55
|
// object.
|
|
@@ -83,7 +83,7 @@ const reducer = (state, action) =>
|
|
|
83
83
|
break;
|
|
84
84
|
}
|
|
85
85
|
case 'ON_CHANGE_CONDITIONS': {
|
|
86
|
-
Object.entries(action.conditions).forEach(array => {
|
|
86
|
+
Object.entries(action.conditions).forEach((array) => {
|
|
87
87
|
const [stringPathToData, conditionsToUpdate] = array;
|
|
88
88
|
|
|
89
89
|
set(
|
|
@@ -134,7 +134,7 @@ const createDefaultCTFormFromLayout = (
|
|
|
134
134
|
const currentSubjectLayout = subjectLayouts[currentCTUID];
|
|
135
135
|
const properties = currentSubjectLayout.properties.map(({ value }) => value);
|
|
136
136
|
const doesNothaveProperty = properties.every(
|
|
137
|
-
property => (applyToProperties || []).indexOf(property) === -1
|
|
137
|
+
(property) => (applyToProperties || []).indexOf(property) === -1
|
|
138
138
|
);
|
|
139
139
|
|
|
140
140
|
const matchingPermission = findMatchingPermission(initialPermissions, actionId, currentCTUID);
|
|
@@ -71,7 +71,7 @@ const createPermissionWithoutProperties = (action, subject, { conditions }) => {
|
|
|
71
71
|
const createSubjectPermissions = (subject, actions) => {
|
|
72
72
|
const permissions = Object.entries(actions).reduce((acc, current) => {
|
|
73
73
|
const [actionName, permissions] = current;
|
|
74
|
-
const shouldCreatePermission = createArrayOfValues(permissions).some(val => val);
|
|
74
|
+
const shouldCreatePermission = createArrayOfValues(permissions).some((val) => val);
|
|
75
75
|
|
|
76
76
|
if (!shouldCreatePermission) {
|
|
77
77
|
return acc;
|
|
@@ -106,7 +106,7 @@ const createSubjectPermissions = (subject, actions) => {
|
|
|
106
106
|
* @param {object} contentTypesPermissions
|
|
107
107
|
* @returns {array<object>}
|
|
108
108
|
*/
|
|
109
|
-
const formatContentTypesPermissionToAPI = contentTypesPermissions => {
|
|
109
|
+
const formatContentTypesPermissionToAPI = (contentTypesPermissions) => {
|
|
110
110
|
const permissions = Object.entries(contentTypesPermissions).reduce((allPermissions, current) => {
|
|
111
111
|
const [subject, currentSubjectActions] = current;
|
|
112
112
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import formatContentTypesPermissionToAPI from './formatContentTypesPermissionToAPI';
|
|
2
2
|
import formatSettingsPermissionsToAPI from './formatSettingsPermissionsToAPI';
|
|
3
3
|
|
|
4
|
-
const formatPermissionsToAPI = modifiedData => {
|
|
4
|
+
const formatPermissionsToAPI = (modifiedData) => {
|
|
5
5
|
const pluginsPermissions = formatSettingsPermissionsToAPI(modifiedData.plugins);
|
|
6
6
|
const settingsPermissions = formatSettingsPermissionsToAPI(modifiedData.settings);
|
|
7
7
|
const collectionTypesPermissions = formatContentTypesPermissionToAPI(
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @param {object} conditions
|
|
4
4
|
* @config {boolean}
|
|
5
5
|
*/
|
|
6
|
-
const createConditionsArray = conditions => {
|
|
6
|
+
const createConditionsArray = (conditions) => {
|
|
7
7
|
return Object.entries(conditions)
|
|
8
8
|
.filter(([, conditionValue]) => {
|
|
9
9
|
return conditionValue;
|
|
@@ -11,7 +11,7 @@ const createConditionsArray = conditions => {
|
|
|
11
11
|
.map(([conditionName]) => conditionName);
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
const createPermission = array => {
|
|
14
|
+
const createPermission = (array) => {
|
|
15
15
|
const [actionName, { conditions }] = array;
|
|
16
16
|
|
|
17
17
|
return {
|
|
@@ -22,7 +22,7 @@ const createPermission = array => {
|
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
const createPermissionsArrayFromCategory = categoryPermissions => {
|
|
25
|
+
const createPermissionsArrayFromCategory = (categoryPermissions) => {
|
|
26
26
|
return Object.values(categoryPermissions).reduce((acc, current) => {
|
|
27
27
|
const permissions = Object.entries(current).reduce((acc1, current1) => {
|
|
28
28
|
const [
|
|
@@ -47,7 +47,7 @@ const createPermissionsArrayFromCategory = categoryPermissions => {
|
|
|
47
47
|
}, []);
|
|
48
48
|
};
|
|
49
49
|
|
|
50
|
-
const formatSettingsPermissionsToAPI = settingsPermissionsObject => {
|
|
50
|
+
const formatSettingsPermissionsToAPI = (settingsPermissionsObject) => {
|
|
51
51
|
return Object.values(settingsPermissionsObject).reduce((acc, current) => {
|
|
52
52
|
const currentCategoryPermissions = createPermissionsArrayFromCategory(current);
|
|
53
53
|
|
|
@@ -6,7 +6,7 @@ import { createArrayOfValues } from '../../utils';
|
|
|
6
6
|
* @param {object} obj the modifiedData state
|
|
7
7
|
* @returns {object} the mutated modifiedData
|
|
8
8
|
*/
|
|
9
|
-
const updateConditionsToFalse = obj => {
|
|
9
|
+
const updateConditionsToFalse = (obj) => {
|
|
10
10
|
return Object.keys(obj).reduce((acc, current) => {
|
|
11
11
|
const currentValue = obj[current];
|
|
12
12
|
|
|
@@ -16,7 +16,7 @@ const updateConditionsToFalse = obj => {
|
|
|
16
16
|
|
|
17
17
|
if (isObject(currentValue) && has(currentValue, 'conditions')) {
|
|
18
18
|
const isActionEnabled = createArrayOfValues(omit(currentValue, 'conditions')).some(
|
|
19
|
-
val => val
|
|
19
|
+
(val) => val
|
|
20
20
|
);
|
|
21
21
|
|
|
22
22
|
if (!isActionEnabled) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
2
|
import { Text } from '@buffetjs/core';
|
|
3
3
|
|
|
4
|
-
const activeStyle = theme => `
|
|
4
|
+
const activeStyle = (theme) => `
|
|
5
5
|
background-color: ${theme.main.colors.lightestBlue};
|
|
6
6
|
border: 1px solid ${theme.main.colors.darkBlue};
|
|
7
7
|
${Text} {
|
|
@@ -24,11 +24,8 @@ const Border = styled.div`
|
|
|
24
24
|
|
|
25
25
|
const SubCategory = ({ categoryName, isFormDisabled, subCategoryName, actions, pathToData }) => {
|
|
26
26
|
const [modalState, setModalState] = useState({ isOpen: false, isMounted: false });
|
|
27
|
-
const {
|
|
28
|
-
|
|
29
|
-
onChangeParentCheckbox,
|
|
30
|
-
onChangeSimpleCheckbox,
|
|
31
|
-
} = usePermissionsDataManager();
|
|
27
|
+
const { modifiedData, onChangeParentCheckbox, onChangeSimpleCheckbox } =
|
|
28
|
+
usePermissionsDataManager();
|
|
32
29
|
const { formatMessage } = useIntl();
|
|
33
30
|
|
|
34
31
|
const mainData = get(modifiedData, pathToData, {});
|
|
@@ -43,11 +40,11 @@ const SubCategory = ({ categoryName, isFormDisabled, subCategoryName, actions, p
|
|
|
43
40
|
const { hasAllActionsSelected, hasSomeActionsSelected } = getCheckboxState(dataWithoutCondition);
|
|
44
41
|
|
|
45
42
|
const handleToggleModalIsOpen = () => {
|
|
46
|
-
setModalState(prevState => ({ isMounted: true, isOpen: !prevState.isOpen }));
|
|
43
|
+
setModalState((prevState) => ({ isMounted: true, isOpen: !prevState.isOpen }));
|
|
47
44
|
};
|
|
48
45
|
|
|
49
46
|
const handleModalClose = () => {
|
|
50
|
-
setModalState(prevState => ({ ...prevState, isMounted: false }));
|
|
47
|
+
setModalState((prevState) => ({ ...prevState, isMounted: false }));
|
|
51
48
|
};
|
|
52
49
|
|
|
53
50
|
// We need to format the actions so it matches the shape of the ConditionsModal actions props
|
|
@@ -10,11 +10,11 @@ import { createArrayOfValues } from '../../../utils';
|
|
|
10
10
|
* @param {array} pathToData
|
|
11
11
|
*/
|
|
12
12
|
const formatActions = (actions, modifiedData, pathToData) => {
|
|
13
|
-
return actions.map(action => {
|
|
13
|
+
return actions.map((action) => {
|
|
14
14
|
const checkboxName = [...pathToData, action.action, 'properties', 'enabled'];
|
|
15
15
|
const checkboxValue = get(modifiedData, checkboxName, false);
|
|
16
16
|
const conditionValue = get(modifiedData, [...pathToData, action.action, 'conditions'], {});
|
|
17
|
-
const hasConditions = createArrayOfValues(conditionValue).some(val => val);
|
|
17
|
+
const hasConditions = createArrayOfValues(conditionValue).some((val) => val);
|
|
18
18
|
|
|
19
19
|
return {
|
|
20
20
|
...action,
|
package/admin/src/components/Roles/PluginsAndSettings/SubCategory/utils/getConditionsButtonState.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createArrayOfValues } from '../../../utils';
|
|
2
2
|
|
|
3
|
-
const getConditionsButtonState = valueObj => {
|
|
3
|
+
const getConditionsButtonState = (valueObj) => {
|
|
4
4
|
const relatedData = Object.entries(valueObj).reduce((acc, current) => {
|
|
5
5
|
const [catName, { conditions }] = current;
|
|
6
6
|
|
|
@@ -11,7 +11,7 @@ const getConditionsButtonState = valueObj => {
|
|
|
11
11
|
|
|
12
12
|
const arrayOfValues = createArrayOfValues(relatedData);
|
|
13
13
|
|
|
14
|
-
return arrayOfValues.some(val => val);
|
|
14
|
+
return arrayOfValues.some((val) => val);
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
export default getConditionsButtonState;
|
|
@@ -7,7 +7,7 @@ import PermissionRow from './Row';
|
|
|
7
7
|
const PluginsAndSettingsPermissions = ({ isFormDisabled, kind, layout }) => {
|
|
8
8
|
const [openedCategory, setOpenedCategory] = useState(null);
|
|
9
9
|
|
|
10
|
-
const handleOpenCategory = categoryName => {
|
|
10
|
+
const handleOpenCategory = (categoryName) => {
|
|
11
11
|
setOpenedCategory(categoryName === openedCategory ? null : categoryName);
|
|
12
12
|
};
|
|
13
13
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import SizedInput from '../../SizedInput';
|
|
3
3
|
|
|
4
|
-
const NameInput = inputProps => <SizedInput name="name" type="text" {...inputProps} />;
|
|
4
|
+
const NameInput = (inputProps) => <SizedInput name="name" type="text" {...inputProps} />;
|
|
5
5
|
|
|
6
6
|
export default NameInput;
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { Text } from '@buffetjs/core';
|
|
4
4
|
|
|
5
|
-
const RoleDescription = styled(props => <Text {...props} ellipsis />)`
|
|
5
|
+
const RoleDescription = styled((props) => <Text {...props} ellipsis />)`
|
|
6
6
|
max-width: 25rem;
|
|
7
7
|
`;
|
|
8
8
|
|
|
@@ -12,7 +12,7 @@ const Tabs = ({ children, isLoading, tabsLabel }) => {
|
|
|
12
12
|
const [selectedTabIndex, setSelectedTabIndex] = useState(0);
|
|
13
13
|
const selectedChild = React.Children.toArray(children)[selectedTabIndex];
|
|
14
14
|
|
|
15
|
-
const handleSelectedTab = index => {
|
|
15
|
+
const handleSelectedTab = (index) => {
|
|
16
16
|
if (index !== selectedTabIndex) {
|
|
17
17
|
setSelectedTabIndex(index);
|
|
18
18
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { flattenDeep, isObject } from 'lodash';
|
|
2
2
|
|
|
3
|
-
const createArrayOfValues = obj => {
|
|
3
|
+
const createArrayOfValues = (obj) => {
|
|
4
4
|
if (!isObject(obj)) {
|
|
5
5
|
return [];
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
return flattenDeep(
|
|
9
|
-
Object.values(obj).map(value => {
|
|
9
|
+
Object.values(obj).map((value) => {
|
|
10
10
|
if (isObject(value)) {
|
|
11
11
|
return createArrayOfValues(value);
|
|
12
12
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import createArrayOfValues from './createArrayOfValues';
|
|
2
2
|
import removeConditionKeyFromData from './removeConditionKeyFromData';
|
|
3
3
|
|
|
4
|
-
const getCheckboxState = dataObj => {
|
|
4
|
+
const getCheckboxState = (dataObj) => {
|
|
5
5
|
const dataWithoutCondition = removeConditionKeyFromData(dataObj);
|
|
6
6
|
|
|
7
7
|
const arrayOfValues = createArrayOfValues(dataWithoutCondition);
|
|
@@ -10,8 +10,8 @@ const getCheckboxState = dataObj => {
|
|
|
10
10
|
return { hasAllActionsSelected: false, hasSomeActionsSelected: false };
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
const hasAllActionsSelected = arrayOfValues.every(val => val);
|
|
14
|
-
const hasSomeActionsSelected = arrayOfValues.some(val => val) && !hasAllActionsSelected;
|
|
13
|
+
const hasAllActionsSelected = arrayOfValues.every((val) => val);
|
|
14
|
+
const hasSomeActionsSelected = arrayOfValues.some((val) => val) && !hasAllActionsSelected;
|
|
15
15
|
|
|
16
16
|
return { hasAllActionsSelected, hasSomeActionsSelected };
|
|
17
17
|
};
|
|
@@ -33,9 +33,9 @@ const Card = ({ onChange }) => {
|
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
const renderFiltersOptions = () => {
|
|
36
|
-
return form[name].allowedFilters.map(filter => (
|
|
36
|
+
return form[name].allowedFilters.map((filter) => (
|
|
37
37
|
<FormattedMessage id={filter.id} key={filter.id}>
|
|
38
|
-
{msg => <option value={filter.value}>{msg}</option>}
|
|
38
|
+
{(msg) => <option value={filter.value}>{msg}</option>}
|
|
39
39
|
</FormattedMessage>
|
|
40
40
|
));
|
|
41
41
|
};
|
|
@@ -12,7 +12,7 @@ const initialState = {
|
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
const reducer = (state, action) =>
|
|
15
|
-
produce(state, draftState => {
|
|
15
|
+
produce(state, (draftState) => {
|
|
16
16
|
switch (action.type) {
|
|
17
17
|
case 'ON_CHANGE': {
|
|
18
18
|
set(draftState, ['modifiedData', ...action.keys.split('.')], action.value);
|
|
@@ -58,8 +58,8 @@ const List = forwardRef(
|
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
const handleClickDelete = useCallback(
|
|
61
|
-
id => {
|
|
62
|
-
const rowIndex = rows.findIndex(obj => obj.id === id);
|
|
61
|
+
(id) => {
|
|
62
|
+
const rowIndex = rows.findIndex((obj) => obj.id === id);
|
|
63
63
|
|
|
64
64
|
dispatch({
|
|
65
65
|
type: 'ON_CLICK_DELETE',
|
|
@@ -88,7 +88,7 @@ const List = forwardRef(
|
|
|
88
88
|
onChange(selectedIds);
|
|
89
89
|
};
|
|
90
90
|
|
|
91
|
-
const handleClick = id => {
|
|
91
|
+
const handleClick = (id) => {
|
|
92
92
|
push(`${SETTINGS_BASE_URL}/users/${id}`);
|
|
93
93
|
};
|
|
94
94
|
|
|
@@ -107,13 +107,13 @@ const List = forwardRef(
|
|
|
107
107
|
rowLinks={[
|
|
108
108
|
{
|
|
109
109
|
icon: canUpdate ? <FontAwesomeIcon icon={faPencilAlt} /> : null,
|
|
110
|
-
onClick: data => {
|
|
110
|
+
onClick: (data) => {
|
|
111
111
|
handleClick(data.id);
|
|
112
112
|
},
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
115
|
icon: canDelete ? <FontAwesomeIcon icon={faTrashAlt} /> : null,
|
|
116
|
-
onClick: data => {
|
|
116
|
+
onClick: (data) => {
|
|
117
117
|
handleClickDelete(data.id);
|
|
118
118
|
},
|
|
119
119
|
},
|
|
@@ -7,7 +7,7 @@ const initialState = {
|
|
|
7
7
|
|
|
8
8
|
const reducer = (state, action) =>
|
|
9
9
|
// eslint-disable-next-line consistent-return
|
|
10
|
-
produce(state, draftState => {
|
|
10
|
+
produce(state, (draftState) => {
|
|
11
11
|
switch (action.type) {
|
|
12
12
|
case 'ON_CHANGE': {
|
|
13
13
|
draftState.rows.forEach((row, index) => {
|
|
@@ -18,9 +18,9 @@ const headers = [
|
|
|
18
18
|
value: 'email',
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
|
-
cellFormatter: cellData => {
|
|
21
|
+
cellFormatter: (cellData) => {
|
|
22
22
|
// Only display the role's name
|
|
23
|
-
return cellData.map(role => role.name).join(',\n');
|
|
23
|
+
return cellData.map((role) => role.name).join(',\n');
|
|
24
24
|
},
|
|
25
25
|
name: 'roles',
|
|
26
26
|
value: 'roles',
|
|
@@ -38,7 +38,7 @@ const ModalCreateBody = forwardRef(
|
|
|
38
38
|
});
|
|
39
39
|
};
|
|
40
40
|
|
|
41
|
-
const handleSubmit = async e => {
|
|
41
|
+
const handleSubmit = async (e) => {
|
|
42
42
|
e.persist();
|
|
43
43
|
e.preventDefault();
|
|
44
44
|
const errors = await checkFormValidity(modifiedData, schema);
|
|
@@ -51,7 +51,7 @@ const ModalCreateBody = forwardRef(
|
|
|
51
51
|
setIsSubmiting(true);
|
|
52
52
|
|
|
53
53
|
const requestURL = '/admin/users';
|
|
54
|
-
const cleanedRoles = modifiedData.roles.map(role => role.id);
|
|
54
|
+
const cleanedRoles = modifiedData.roles.map((role) => role.id);
|
|
55
55
|
|
|
56
56
|
const { data } = await request(requestURL, {
|
|
57
57
|
method: 'POST',
|
|
@@ -136,7 +136,7 @@ const ModalCreateBody = forwardRef(
|
|
|
136
136
|
|
|
137
137
|
ModalCreateBody.defaultProps = {
|
|
138
138
|
isDisabled: false,
|
|
139
|
-
onSubmit: e => e.preventDefault(),
|
|
139
|
+
onSubmit: (e) => e.preventDefault(),
|
|
140
140
|
registrationToken: '',
|
|
141
141
|
setIsSubmiting: () => {},
|
|
142
142
|
showMagicLink: false,
|
|
@@ -4,14 +4,8 @@ import { translatedErrors } from 'strapi-helper-plugin';
|
|
|
4
4
|
const schema = yup.object().shape({
|
|
5
5
|
firstname: yup.string().required(translatedErrors.required),
|
|
6
6
|
lastname: yup.string().required(translatedErrors.required),
|
|
7
|
-
email: yup
|
|
8
|
-
|
|
9
|
-
.email(translatedErrors.email)
|
|
10
|
-
.required(translatedErrors.required),
|
|
11
|
-
roles: yup
|
|
12
|
-
.array()
|
|
13
|
-
.min(1, translatedErrors.min)
|
|
14
|
-
.required(translatedErrors.required),
|
|
7
|
+
email: yup.string().email(translatedErrors.email).required(translatedErrors.required),
|
|
8
|
+
roles: yup.array().min(1, translatedErrors.min).required(translatedErrors.required),
|
|
15
9
|
});
|
|
16
10
|
|
|
17
11
|
export default schema;
|
|
@@ -17,7 +17,7 @@ const RoleSettingsModalSection = ({ isDisabled, modifiedData, onChange, formErro
|
|
|
17
17
|
<Wrapper>
|
|
18
18
|
<Padded top size="smd">
|
|
19
19
|
<Row>
|
|
20
|
-
{Object.keys(roleSettingsForm).map(inputName => {
|
|
20
|
+
{Object.keys(roleSettingsForm).map((inputName) => {
|
|
21
21
|
const value = modifiedData[inputName];
|
|
22
22
|
const { description, type, Component } = roleSettingsForm[inputName];
|
|
23
23
|
const error = formErrors[inputName];
|
|
@@ -7,7 +7,7 @@ const MultiValueContainer = ({ data, selectProps }) => {
|
|
|
7
7
|
const Component = components.MultiValueContainer;
|
|
8
8
|
|
|
9
9
|
const handleClick = () => {
|
|
10
|
-
const newValue = selectProps.value.filter(option => option.id !== data.id);
|
|
10
|
+
const newValue = selectProps.value.filter((option) => option.id !== data.id);
|
|
11
11
|
|
|
12
12
|
selectProps.onChange(newValue);
|
|
13
13
|
};
|
|
@@ -27,9 +27,9 @@ const SelectRoles = ({ error, isDisabled, name, onChange, value }) => {
|
|
|
27
27
|
MultiValueContainer,
|
|
28
28
|
}}
|
|
29
29
|
error={error}
|
|
30
|
-
getOptionLabel={option => option.name}
|
|
31
|
-
getOptionValue={option => option.id}
|
|
32
|
-
onChange={data => {
|
|
30
|
+
getOptionLabel={(option) => option.name}
|
|
31
|
+
getOptionValue={(option) => option.id}
|
|
32
|
+
onChange={(data) => {
|
|
33
33
|
onChange({ target: { name, value: data } });
|
|
34
34
|
}}
|
|
35
35
|
isClearable
|
|
@@ -47,7 +47,7 @@ const styles = {
|
|
|
47
47
|
backgroundColor,
|
|
48
48
|
};
|
|
49
49
|
},
|
|
50
|
-
menu: base => {
|
|
50
|
+
menu: (base) => {
|
|
51
51
|
return {
|
|
52
52
|
...base,
|
|
53
53
|
width: 'calc(100% - 0px)',
|
|
@@ -62,7 +62,7 @@ const styles = {
|
|
|
62
62
|
fontSize: '13px',
|
|
63
63
|
};
|
|
64
64
|
},
|
|
65
|
-
menuList: base => ({
|
|
65
|
+
menuList: (base) => ({
|
|
66
66
|
...base,
|
|
67
67
|
maxHeight: '112px',
|
|
68
68
|
paddingTop: 2,
|
|
@@ -83,13 +83,13 @@ const styles = {
|
|
|
83
83
|
cursor: 'pointer',
|
|
84
84
|
};
|
|
85
85
|
},
|
|
86
|
-
placeholder: base => ({
|
|
86
|
+
placeholder: (base) => ({
|
|
87
87
|
...base,
|
|
88
88
|
marginTop: 0,
|
|
89
89
|
marginLeft: 8,
|
|
90
90
|
color: '#aaa',
|
|
91
91
|
}),
|
|
92
|
-
valueContainer: base => ({
|
|
92
|
+
valueContainer: (base) => ({
|
|
93
93
|
...base,
|
|
94
94
|
padding: '2px 4px 4px 4px',
|
|
95
95
|
lineHeight: '18px',
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { FormattedMessage } from 'react-intl';
|
|
3
3
|
import { Carret } from 'strapi-helper-plugin';
|
|
4
4
|
|
|
5
|
-
const Button = isOpen => {
|
|
5
|
+
const Button = (isOpen) => {
|
|
6
6
|
return (
|
|
7
7
|
<>
|
|
8
8
|
<FormattedMessage id="app.components.Users.SortPicker.button-label" />
|
|
@@ -3,7 +3,7 @@ import styled from 'styled-components';
|
|
|
3
3
|
import { themePropTypes } from 'strapi-helper-plugin';
|
|
4
4
|
import { Text } from '@buffetjs/core';
|
|
5
5
|
|
|
6
|
-
const ListWrapper = styled(props => <Text as="ul" fontSize="md" {...props} />)`
|
|
6
|
+
const ListWrapper = styled((props) => <Text as="ul" fontSize="md" {...props} />)`
|
|
7
7
|
margin-bottom: 0;
|
|
8
8
|
padding: 0;
|
|
9
9
|
min-width: 230px;
|