@strapi/plugin-users-permissions 4.10.0-beta.0 → 4.10.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +2 -0
- package/.eslintrc.js +14 -0
- package/admin/src/pages/Roles/ListPage/index.js +20 -3
- package/admin/src/pages/Roles/index.js +2 -2
- package/jest.config.front.js +1 -6
- package/package.json +13 -12
package/.eslintignore
ADDED
package/.eslintrc.js
ADDED
|
@@ -28,11 +28,12 @@ import {
|
|
|
28
28
|
useQueryParams,
|
|
29
29
|
EmptyStateLayout,
|
|
30
30
|
ConfirmDialog,
|
|
31
|
+
useFilter,
|
|
32
|
+
useCollator,
|
|
31
33
|
} from '@strapi/helper-plugin';
|
|
32
34
|
import { useIntl } from 'react-intl';
|
|
33
35
|
import { useHistory } from 'react-router-dom';
|
|
34
36
|
import { useMutation, useQuery, useQueryClient } from 'react-query';
|
|
35
|
-
import matchSorter from 'match-sorter';
|
|
36
37
|
|
|
37
38
|
import { fetchData, deleteData } from './utils/api';
|
|
38
39
|
import { getTrad } from '../../../utils';
|
|
@@ -42,7 +43,7 @@ import TableBody from './components/TableBody';
|
|
|
42
43
|
|
|
43
44
|
const RoleListPage = () => {
|
|
44
45
|
const { trackUsage } = useTracking();
|
|
45
|
-
const { formatMessage } = useIntl();
|
|
46
|
+
const { formatMessage, locale } = useIntl();
|
|
46
47
|
const { push } = useHistory();
|
|
47
48
|
const toggleNotification = useNotification();
|
|
48
49
|
const { notifyStatus } = useNotifyAT();
|
|
@@ -78,6 +79,17 @@ const RoleListPage = () => {
|
|
|
78
79
|
enabled: canRead,
|
|
79
80
|
});
|
|
80
81
|
|
|
82
|
+
const { includes } = useFilter(locale, {
|
|
83
|
+
sensitivity: 'base',
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* @type {Intl.Collator}
|
|
88
|
+
*/
|
|
89
|
+
const formatter = useCollator(locale, {
|
|
90
|
+
sensitivity: 'base',
|
|
91
|
+
});
|
|
92
|
+
|
|
81
93
|
const isLoading = isLoadingForData || isFetching;
|
|
82
94
|
|
|
83
95
|
const handleNewRoleClick = () => {
|
|
@@ -118,7 +130,12 @@ const RoleListPage = () => {
|
|
|
118
130
|
setIsConfirmButtonLoading(false);
|
|
119
131
|
};
|
|
120
132
|
|
|
121
|
-
const sortedRoles =
|
|
133
|
+
const sortedRoles = (roles || [])
|
|
134
|
+
.filter((role) => includes(role.name, _q) || includes(role.description, _q))
|
|
135
|
+
.sort(
|
|
136
|
+
(a, b) => formatter.compare(a.name, b.name) || formatter.compare(a.description, b.description)
|
|
137
|
+
);
|
|
138
|
+
|
|
122
139
|
const emptyContent = _q && !sortedRoles.length ? 'search' : 'roles';
|
|
123
140
|
|
|
124
141
|
const colCount = 4;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Switch, Route } from 'react-router-dom';
|
|
3
|
-
import { CheckPagePermissions,
|
|
3
|
+
import { CheckPagePermissions, AnErrorOccurred } from '@strapi/helper-plugin';
|
|
4
4
|
import pluginId from '../../pluginId';
|
|
5
5
|
import pluginPermissions from '../../permissions';
|
|
6
6
|
import ProtectedRolesListPage from './ProtectedListPage';
|
|
@@ -18,7 +18,7 @@ const Roles = () => {
|
|
|
18
18
|
/>
|
|
19
19
|
<Route path={`/settings/${pluginId}/roles/:id`} component={ProtectedRolesEditPage} exact />
|
|
20
20
|
<Route path={`/settings/${pluginId}/roles`} component={ProtectedRolesListPage} exact />
|
|
21
|
-
<Route path="" component={
|
|
21
|
+
<Route path="" component={AnErrorOccurred} />
|
|
22
22
|
</Switch>
|
|
23
23
|
</CheckPagePermissions>
|
|
24
24
|
);
|
package/jest.config.front.js
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const baseConfig = require('../../../jest.base-config.front');
|
|
4
|
-
const pkg = require('./package.json');
|
|
5
|
-
|
|
6
3
|
module.exports = {
|
|
7
|
-
|
|
8
|
-
displayName: (pkg.strapi && pkg.strapi.name) || pkg.name,
|
|
9
|
-
roots: [__dirname],
|
|
4
|
+
preset: '../../../jest-preset.front.js',
|
|
10
5
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/plugin-users-permissions",
|
|
3
|
-
"version": "4.10.0-beta.
|
|
3
|
+
"version": "4.10.0-beta.1",
|
|
4
4
|
"description": "Protect your API with a full-authentication process based on JWT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,17 +20,19 @@
|
|
|
20
20
|
}
|
|
21
21
|
],
|
|
22
22
|
"scripts": {
|
|
23
|
-
"test:unit": "jest
|
|
24
|
-
"test:
|
|
25
|
-
"test:front
|
|
26
|
-
"test:front:
|
|
27
|
-
"test:front:
|
|
23
|
+
"test:unit": "run -T jest",
|
|
24
|
+
"test:unit:watch": "run -T jest --watch",
|
|
25
|
+
"test:front": "run -T cross-env IS_EE=true jest --config ./jest.config.front.js",
|
|
26
|
+
"test:front:watch": "run -T cross-env IS_EE=true jest --config ./jest.config.front.js --watchAll",
|
|
27
|
+
"test:front:ce": "run -T cross-env IS_EE=false jest --config ./jest.config.front.js",
|
|
28
|
+
"test:front:watch:ce": "run -T cross-env IS_EE=false jest --config ./jest.config.front.js --watchAll",
|
|
29
|
+
"lint": "run -T eslint ."
|
|
28
30
|
},
|
|
29
31
|
"dependencies": {
|
|
30
32
|
"@strapi/design-system": "1.6.6",
|
|
31
|
-
"@strapi/helper-plugin": "4.10.0-beta.
|
|
33
|
+
"@strapi/helper-plugin": "4.10.0-beta.1",
|
|
32
34
|
"@strapi/icons": "1.6.6",
|
|
33
|
-
"@strapi/utils": "4.10.0-beta.
|
|
35
|
+
"@strapi/utils": "4.10.0-beta.1",
|
|
34
36
|
"bcryptjs": "2.4.3",
|
|
35
37
|
"formik": "2.2.9",
|
|
36
38
|
"grant-koa": "5.4.8",
|
|
@@ -40,7 +42,6 @@
|
|
|
40
42
|
"koa": "^2.13.4",
|
|
41
43
|
"koa2-ratelimit": "^1.1.2",
|
|
42
44
|
"lodash": "4.17.21",
|
|
43
|
-
"match-sorter": "^4.0.2",
|
|
44
45
|
"prop-types": "^15.7.2",
|
|
45
46
|
"purest": "4.0.2",
|
|
46
47
|
"react-intl": "6.3.2",
|
|
@@ -65,8 +66,8 @@
|
|
|
65
66
|
"peerDependencies": {
|
|
66
67
|
"react": "^17.0.2",
|
|
67
68
|
"react-dom": "^17.0.2",
|
|
68
|
-
"react-router-dom": "5.3.4",
|
|
69
|
-
"styled-components": "5.3.3"
|
|
69
|
+
"react-router-dom": "^5.3.4",
|
|
70
|
+
"styled-components": "^5.3.3"
|
|
70
71
|
},
|
|
71
72
|
"engines": {
|
|
72
73
|
"node": ">=14.19.1 <=18.x.x",
|
|
@@ -79,5 +80,5 @@
|
|
|
79
80
|
"required": true,
|
|
80
81
|
"kind": "plugin"
|
|
81
82
|
},
|
|
82
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "95d581b31bee464af42e5d8db408fa578d8532c7"
|
|
83
84
|
}
|