@strapi/admin 4.11.0-alpha.0 → 4.11.0-beta.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/admin/src/components/AuthenticatedApp/utils/api.js +5 -4
- package/admin/src/content-manager/components/CollectionTypeFormWrapper/index.js +1 -2
- package/admin/src/content-manager/components/DynamicZone/index.js +1 -1
- package/admin/src/content-manager/components/FieldComponent/index.js +1 -1
- package/admin/src/content-manager/components/Inputs/index.js +1 -1
- package/admin/src/content-manager/components/Wysiwyg/WysiwygNav.js +67 -71
- package/admin/src/content-manager/hooks/useFetchContentTypeLayout/index.js +3 -5
- package/admin/src/content-manager/pages/App/useContentManagerInitData.js +2 -3
- package/admin/src/content-manager/pages/ComponentSetttingsView/index.js +2 -5
- package/admin/src/content-manager/pages/EditView/DeleteLink/index.js +1 -1
- package/admin/src/content-manager/pages/EditView/Header/index.js +1 -1
- package/admin/src/content-manager/pages/EditViewLayoutManager/Permissions.js +1 -1
- package/admin/src/content-manager/pages/ListView/index.js +1 -2
- package/admin/src/hooks/index.js +1 -1
- package/admin/src/hooks/marketplace/constants.js +1 -0
- package/admin/src/hooks/{useFetchMarketplacePlugins → marketplace/useFetchMarketplacePlugins}/index.js +21 -1
- package/admin/src/hooks/{useFetchMarketplaceProviders → marketplace/useFetchMarketplaceProviders}/index.js +21 -1
- package/admin/src/hooks/useAdminUsers/__mocks__/index.js +5 -0
- package/admin/src/hooks/useAdminUsers/index.js +1 -0
- package/admin/src/hooks/useAdminUsers/useAdminUsers.js +38 -0
- package/admin/src/hooks/useContentTypes/__mocks__/index.js +6 -0
- package/admin/src/hooks/useContentTypes/index.js +1 -0
- package/admin/src/hooks/useContentTypes/useContentTypes.js +47 -0
- package/admin/src/hooks/useReleaseNotification/utils/api.js +6 -5
- package/admin/src/pages/Admin/Onboarding/index.js +89 -91
- package/admin/src/pages/App/index.js +1 -5
- package/admin/src/pages/AuthPage/components/Register/index.js +3 -4
- package/admin/src/pages/AuthPage/index.js +11 -26
- package/admin/src/pages/HomePage/index.js +3 -2
- package/admin/src/pages/MarketplacePage/components/NpmPackageCard/InstallPluginButton.js +12 -8
- package/admin/src/pages/MarketplacePage/components/NpmPackagesFilters/FiltersPopover.js +39 -41
- package/admin/src/pages/MarketplacePage/utils/useMarketplaceData.js +2 -2
- package/admin/src/pages/SettingsPage/components/Tokens/TokenBox/index.js +28 -26
- package/admin/src/pages/SettingsPage/components/Tokens/TokenDescription/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/urlToFile.js +3 -2
- package/admin/src/pages/SettingsPage/pages/Roles/CreatePage/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/RoleForm/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Users/EditPage/index.js +36 -26
- package/admin/src/pages/SettingsPage/pages/Users/EditPage/utils/api.js +1 -8
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/ModalForm/index.js +6 -7
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/index.js +54 -63
- package/admin/src/pages/SettingsPage/pages/Users/components/MagicLink/MagicLinkWrapper.js +11 -9
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/EventInput/index.js +12 -1
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/index.js +2 -2
- package/admin/src/pages/SettingsPage/pages/Webhooks/ListView/index.js +120 -205
- package/admin/src/pages/UseCasePage/index.js +13 -15
- package/admin/src/translations/en.json +11 -9
- package/build/1387.a86ac314.chunk.js +1 -0
- package/build/{1657.45231968.chunk.js → 1657.ca8562dd.chunk.js} +17 -17
- package/build/3081.c2cdfac8.chunk.js +108 -0
- package/build/{3562.57745ccd.chunk.js → 3562.e0b1a0b3.chunk.js} +6 -6
- package/build/3816.60f858cf.chunk.js +211 -0
- package/build/462.a073ff1f.chunk.js +71 -0
- package/build/{4628.20631dd1.chunk.js → 4628.9cbb6df5.chunk.js} +1 -1
- package/build/5542.002522eb.chunk.js +71 -0
- package/build/5563.79950369.chunk.js +79 -0
- package/build/617.87b2fe96.chunk.js +155 -0
- package/build/6970.7ea35fbd.chunk.js +1 -0
- package/build/7259.5cc67413.chunk.js +1 -0
- package/build/Admin-authenticatedApp.65172a0c.chunk.js +79 -0
- package/build/Admin_homePage.107a9fe0.chunk.js +73 -0
- package/build/Admin_marketplace.717bd7ca.chunk.js +55 -0
- package/build/Admin_pluginsPage.7df6b5a9.chunk.js +6 -0
- package/build/{Admin_profilePage.1b337b73.chunk.js → Admin_profilePage.a8fa3a56.chunk.js} +1 -1
- package/build/Admin_settingsPage.bd715ed3.chunk.js +79 -0
- package/build/{Upload_ConfigureTheView.d429a7fc.chunk.js → Upload_ConfigureTheView.aa64ed9a.chunk.js} +1 -1
- package/build/admin-app.9c79b484.chunk.js +63 -0
- package/build/{admin-edit-roles-page.d0c9497b.chunk.js → admin-edit-roles-page.0d12b741.chunk.js} +43 -41
- package/build/admin-edit-users.f9ce7844.chunk.js +10 -0
- package/build/admin-roles-list.e8bf9685.chunk.js +31 -0
- package/build/admin-users.751b28b2.chunk.js +34 -0
- package/build/audit-logs-settings-page.3c6cea81.chunk.js +129 -0
- package/build/{content-manager.cf467ecc.chunk.js → content-manager.bf060d8e.chunk.js} +95 -95
- package/build/content-type-builder-list-view.1e821eb9.chunk.js +215 -0
- package/build/content-type-builder-translation-en-json.af293c9e.chunk.js +1 -0
- package/build/content-type-builder.b10576e7.chunk.js +126 -0
- package/build/email-settings-page.dba83275.chunk.js +11 -0
- package/build/en-json.19e9ff9b.chunk.js +1 -0
- package/build/i18n-settings-page.55628f74.chunk.js +114 -0
- package/build/index.html +1 -1
- package/build/main.576a9d22.js +2630 -0
- package/build/review-workflows-settings.4b39b837.chunk.js +61 -0
- package/build/{runtime~main.1074f2bb.js → runtime~main.96d92f16.js} +2 -2
- package/build/{sso-settings-page.f44d95d8.chunk.js → sso-settings-page.265e3d72.chunk.js} +1 -1
- package/build/upload-settings.63d99bf5.chunk.js +14 -0
- package/build/upload.c50d8c7a.chunk.js +34 -0
- package/build/users-advanced-settings-page.4f49ca57.chunk.js +9 -0
- package/build/users-email-settings-page.d2429d0a.chunk.js +24 -0
- package/build/users-providers-settings-page.50c5ba27.chunk.js +29 -0
- package/build/{users-roles-settings-page.eeb3a339.chunk.js → users-roles-settings-page.2549794b.chunk.js} +2 -2
- package/build/webhook-edit-page.ddd5963d.chunk.js +128 -0
- package/build/webhook-list-page.e2fca9f8.chunk.js +71 -0
- package/ee/LICENSE +1 -21
- package/ee/admin/content-manager/pages/EditView/InformationBox/InformationBoxEE.js +1 -2
- package/ee/admin/pages/AuthPage/components/Login/index.js +1 -1
- package/ee/admin/pages/AuthPage/components/Providers/SSOProviders.js +1 -1
- package/ee/admin/pages/AuthPage/components/Providers/index.js +1 -1
- package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/hooks/useAuditLogsData.js +36 -28
- package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/utils/getDisplayedFilters.js +1 -1
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/ReviewWorkflows.js +3 -3
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/hooks/useReviewWorkflows.js +32 -21
- package/ee/admin/pages/SettingsPage/pages/Users/ListPage/ModalForm/utils/formDataModel.js +1 -1
- package/ee/admin/pages/SettingsPage/pages/Users/ListPage/ModalForm/utils/roleSettingsForm.js +1 -1
- package/ee/server/services/audit-logs.js +5 -1
- package/package.json +14 -17
- package/webpack.alias.js +0 -2
- package/admin/src/hooks/useFetchMarketplacePlugins/utils/api.js +0 -18
- package/admin/src/hooks/useFetchMarketplaceProviders/utils/api.js +0 -18
- package/admin/src/hooks/useModels/index.js +0 -58
- package/admin/src/hooks/useModels/reducer.js +0 -45
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/utils/api.js +0 -20
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/EventInput/utils/formatValue.js +0 -13
- package/admin/src/pages/SettingsPage/pages/Webhooks/ListView/reducer.js +0 -72
- package/build/1387.84b454d3.chunk.js +0 -1
- package/build/3081.bcf9a12f.chunk.js +0 -108
- package/build/462.8fff7f3b.chunk.js +0 -71
- package/build/5542.b8240e3f.chunk.js +0 -70
- package/build/5563.986609ed.chunk.js +0 -79
- package/build/6404.68405699.chunk.js +0 -100
- package/build/6970.5159b068.chunk.js +0 -1
- package/build/7259.7a48aa2f.chunk.js +0 -1
- package/build/7725.1633e06f.chunk.js +0 -213
- package/build/Admin-authenticatedApp.27a2329f.chunk.js +0 -79
- package/build/Admin_homePage.9f7c0bb1.chunk.js +0 -73
- package/build/Admin_marketplace.5f7b89e5.chunk.js +0 -55
- package/build/Admin_pluginsPage.9e6fa51c.chunk.js +0 -6
- package/build/Admin_settingsPage.9d0419bc.chunk.js +0 -79
- package/build/admin-app.8e1f56bc.chunk.js +0 -63
- package/build/admin-edit-users.2aae89f5.chunk.js +0 -10
- package/build/admin-roles-list.c759daa3.chunk.js +0 -31
- package/build/admin-users.04a823ca.chunk.js +0 -34
- package/build/audit-logs-settings-page.45cb4fb5.chunk.js +0 -76
- package/build/content-type-builder-list-view.5ff685ec.chunk.js +0 -214
- package/build/content-type-builder-translation-en-json.5e5f8607.chunk.js +0 -1
- package/build/content-type-builder.4737a30c.chunk.js +0 -126
- package/build/email-settings-page.dc07d518.chunk.js +0 -10
- package/build/en-json.7edb00f6.chunk.js +0 -1
- package/build/i18n-settings-page.8219dd99.chunk.js +0 -60
- package/build/main.14dca275.js +0 -2592
- package/build/review-workflows-settings.6a662ebd.chunk.js +0 -61
- package/build/upload-settings.dd2d987c.chunk.js +0 -13
- package/build/upload.c8479232.chunk.js +0 -33
- package/build/users-advanced-settings-page.c36cfd59.chunk.js +0 -8
- package/build/users-email-settings-page.2716ce8e.chunk.js +0 -23
- package/build/users-providers-settings-page.0d6304a5.chunk.js +0 -28
- package/build/webhook-edit-page.f4db86f3.chunk.js +0 -75
- package/build/webhook-list-page.30d73114.chunk.js +0 -71
|
@@ -17,7 +17,6 @@ import {
|
|
|
17
17
|
LoadingIndicatorPage,
|
|
18
18
|
Link,
|
|
19
19
|
} from '@strapi/helper-plugin';
|
|
20
|
-
import { useQuery } from 'react-query';
|
|
21
20
|
import { Formik } from 'formik';
|
|
22
21
|
import {
|
|
23
22
|
Box,
|
|
@@ -32,11 +31,13 @@ import {
|
|
|
32
31
|
} from '@strapi/design-system';
|
|
33
32
|
import { ArrowLeft, Check } from '@strapi/icons';
|
|
34
33
|
import MagicLink from 'ee_else_ce/pages/SettingsPage/pages/Users/components/MagicLink';
|
|
34
|
+
|
|
35
35
|
import { formatAPIErrors, getFullName } from '../../../../../utils';
|
|
36
|
-
import {
|
|
36
|
+
import { putUser } from './utils/api';
|
|
37
37
|
import layout from './utils/layout';
|
|
38
38
|
import { editValidation } from '../utils/validations/users';
|
|
39
39
|
import SelectRoles from '../components/SelectRoles';
|
|
40
|
+
import { useAdminUsers } from '../../../../../hooks/useAdminUsers';
|
|
40
41
|
|
|
41
42
|
const fieldsToPick = ['email', 'firstname', 'lastname', 'username', 'isActive', 'roles'];
|
|
42
43
|
|
|
@@ -51,26 +52,35 @@ const EditPage = ({ canUpdate }) => {
|
|
|
51
52
|
const { lockApp, unlockApp } = useOverlayBlocker();
|
|
52
53
|
useFocusWhenNavigate();
|
|
53
54
|
|
|
54
|
-
const {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
const {
|
|
56
|
+
users: [user],
|
|
57
|
+
isLoading,
|
|
58
|
+
} = useAdminUsers(
|
|
59
|
+
{ id },
|
|
60
|
+
{
|
|
61
|
+
onError(error) {
|
|
62
|
+
const { status } = error.response;
|
|
58
63
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
// Redirect the use to the homepage if is not allowed to read
|
|
65
|
+
if (status === 403) {
|
|
66
|
+
toggleNotification({
|
|
67
|
+
type: 'info',
|
|
68
|
+
message: {
|
|
69
|
+
id: 'notification.permission.not-allowed-read',
|
|
70
|
+
defaultMessage: 'You are not allowed to see this document',
|
|
71
|
+
},
|
|
72
|
+
});
|
|
68
73
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
+
push('/');
|
|
75
|
+
} else {
|
|
76
|
+
toggleNotification({
|
|
77
|
+
type: 'warning',
|
|
78
|
+
message: { id: 'notification.error', defaultMessage: 'An error occured' },
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
}
|
|
83
|
+
);
|
|
74
84
|
|
|
75
85
|
const handleSubmit = async (body, actions) => {
|
|
76
86
|
lockApp();
|
|
@@ -113,19 +123,18 @@ const EditPage = ({ canUpdate }) => {
|
|
|
113
123
|
unlockApp();
|
|
114
124
|
};
|
|
115
125
|
|
|
116
|
-
const isLoading = status !== 'success';
|
|
117
126
|
const headerLabel = isLoading
|
|
118
127
|
? { id: 'app.containers.Users.EditPage.header.label-loading', defaultMessage: 'Edit user' }
|
|
119
128
|
: { id: 'app.containers.Users.EditPage.header.label', defaultMessage: 'Edit {name}' };
|
|
120
129
|
|
|
121
|
-
const initialData = Object.keys(pick(
|
|
130
|
+
const initialData = Object.keys(pick(user, fieldsToPick)).reduce((acc, current) => {
|
|
122
131
|
if (current === 'roles') {
|
|
123
|
-
acc[current] = (
|
|
132
|
+
acc[current] = (user?.roles || []).map(({ id }) => id);
|
|
124
133
|
|
|
125
134
|
return acc;
|
|
126
135
|
}
|
|
127
136
|
|
|
128
|
-
acc[current] =
|
|
137
|
+
acc[current] = user?.[current];
|
|
129
138
|
|
|
130
139
|
return acc;
|
|
131
140
|
}, {});
|
|
@@ -138,6 +147,7 @@ const EditPage = ({ canUpdate }) => {
|
|
|
138
147
|
if (isLoading) {
|
|
139
148
|
return (
|
|
140
149
|
<Main aria-busy="true">
|
|
150
|
+
{/* TODO: translate */}
|
|
141
151
|
<SettingsPageTitle name="Users" />
|
|
142
152
|
<HeaderLayout
|
|
143
153
|
primaryAction={
|
|
@@ -200,9 +210,9 @@ const EditPage = ({ canUpdate }) => {
|
|
|
200
210
|
}
|
|
201
211
|
/>
|
|
202
212
|
<ContentLayout>
|
|
203
|
-
{
|
|
213
|
+
{user?.registrationToken && (
|
|
204
214
|
<Box paddingBottom={6}>
|
|
205
|
-
<MagicLink registrationToken={
|
|
215
|
+
<MagicLink registrationToken={user.registrationToken} />
|
|
206
216
|
</Box>
|
|
207
217
|
)}
|
|
208
218
|
<Flex direction="column" alignItems="stretch" gap={7}>
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import { getFetchClient } from '@strapi/helper-plugin';
|
|
2
2
|
|
|
3
|
-
const fetchUser = async (id) => {
|
|
4
|
-
const { get } = getFetchClient();
|
|
5
|
-
const { data } = await get(`/admin/users/${id}`);
|
|
6
|
-
|
|
7
|
-
return data.data;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
3
|
const putUser = async (id, body) => {
|
|
11
4
|
const { put } = getFetchClient();
|
|
12
5
|
|
|
@@ -15,4 +8,4 @@ const putUser = async (id, body) => {
|
|
|
15
8
|
return data.data;
|
|
16
9
|
};
|
|
17
10
|
|
|
18
|
-
export {
|
|
11
|
+
export { putUser };
|
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
Flex,
|
|
16
16
|
Typography,
|
|
17
17
|
} from '@strapi/design-system';
|
|
18
|
-
|
|
19
18
|
import { Formik } from 'formik';
|
|
20
19
|
import {
|
|
21
20
|
Form,
|
|
@@ -24,20 +23,21 @@ import {
|
|
|
24
23
|
useOverlayBlocker,
|
|
25
24
|
useFetchClient,
|
|
26
25
|
} from '@strapi/helper-plugin';
|
|
27
|
-
import {
|
|
26
|
+
import { useMutation } from 'react-query';
|
|
27
|
+
|
|
28
28
|
import formDataModel from 'ee_else_ce/pages/SettingsPage/pages/Users/ListPage/ModalForm/utils/formDataModel';
|
|
29
29
|
import roleSettingsForm from 'ee_else_ce/pages/SettingsPage/pages/Users/ListPage/ModalForm/utils/roleSettingsForm';
|
|
30
30
|
import MagicLink from 'ee_else_ce/pages/SettingsPage/pages/Users/components/MagicLink';
|
|
31
|
+
|
|
31
32
|
import SelectRoles from '../../components/SelectRoles';
|
|
32
33
|
import layout from './utils/layout';
|
|
33
34
|
import schema from './utils/schema';
|
|
34
35
|
import stepper from './utils/stepper';
|
|
35
36
|
|
|
36
|
-
const ModalForm = ({
|
|
37
|
+
const ModalForm = ({ onSuccess, onToggle }) => {
|
|
37
38
|
const [currentStep, setStep] = useState('create');
|
|
38
39
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
39
40
|
const [registrationToken, setRegistrationToken] = useState(null);
|
|
40
|
-
const queryClient = useQueryClient();
|
|
41
41
|
const { formatMessage } = useIntl();
|
|
42
42
|
const toggleNotification = useNotification();
|
|
43
43
|
const { lockApp, unlockApp } = useOverlayBlocker();
|
|
@@ -50,8 +50,7 @@ const ModalForm = ({ queryName, onToggle }) => {
|
|
|
50
50
|
async onSuccess({ data }) {
|
|
51
51
|
setRegistrationToken(data.data.registrationToken);
|
|
52
52
|
|
|
53
|
-
await
|
|
54
|
-
await queryClient.refetchQueries(['ee', 'license-limit-info']);
|
|
53
|
+
await onSuccess();
|
|
55
54
|
|
|
56
55
|
goNext();
|
|
57
56
|
setIsSubmitting(false);
|
|
@@ -216,7 +215,7 @@ const ModalForm = ({ queryName, onToggle }) => {
|
|
|
216
215
|
|
|
217
216
|
ModalForm.propTypes = {
|
|
218
217
|
onToggle: PropTypes.func.isRequired,
|
|
219
|
-
|
|
218
|
+
onSuccess: PropTypes.func.isRequired,
|
|
220
219
|
};
|
|
221
220
|
|
|
222
221
|
export default ModalForm;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
+
import qs from 'qs';
|
|
2
3
|
import {
|
|
3
4
|
DynamicTable,
|
|
4
5
|
SearchURLQuery,
|
|
@@ -8,29 +9,28 @@ import {
|
|
|
8
9
|
useFocusWhenNavigate,
|
|
9
10
|
NoPermissions,
|
|
10
11
|
useAPIErrorHandler,
|
|
12
|
+
useFetchClient,
|
|
11
13
|
} from '@strapi/helper-plugin';
|
|
12
|
-
import {
|
|
13
|
-
ActionLayout,
|
|
14
|
-
ContentLayout,
|
|
15
|
-
HeaderLayout,
|
|
16
|
-
Main,
|
|
17
|
-
useNotifyAT,
|
|
18
|
-
} from '@strapi/design-system';
|
|
14
|
+
import { ActionLayout, ContentLayout, HeaderLayout, Main } from '@strapi/design-system';
|
|
19
15
|
import { useLocation } from 'react-router-dom';
|
|
20
16
|
import { useIntl } from 'react-intl';
|
|
21
|
-
import { useMutation,
|
|
17
|
+
import { useMutation, useQueryClient } from 'react-query';
|
|
22
18
|
import CreateAction from 'ee_else_ce/pages/SettingsPage/pages/Users/ListPage/CreateAction';
|
|
23
19
|
import useLicenseLimitNotification from 'ee_else_ce/hooks/useLicenseLimitNotification';
|
|
20
|
+
|
|
21
|
+
import { useAdminUsers } from '../../../../../hooks/useAdminUsers';
|
|
24
22
|
import adminPermissions from '../../../../../permissions';
|
|
25
23
|
import TableRows from './DynamicTable/TableRows';
|
|
26
24
|
import Filters from '../../../components/Filters';
|
|
27
25
|
import ModalForm from './ModalForm';
|
|
28
26
|
import PaginationFooter from './PaginationFooter';
|
|
29
|
-
import { deleteData, fetchData } from './utils/api';
|
|
30
27
|
import displayedFilters from './utils/displayedFilters';
|
|
31
28
|
import tableHeaders from './utils/tableHeaders';
|
|
32
29
|
|
|
30
|
+
const EE_LICENSE_LIMIT_QUERY_KEY = ['ee', 'license-limit-info'];
|
|
31
|
+
|
|
33
32
|
const ListPage = () => {
|
|
33
|
+
const { post } = useFetchClient();
|
|
34
34
|
const { formatAPIError } = useAPIErrorHandler();
|
|
35
35
|
const [isModalOpened, setIsModalOpen] = useState(false);
|
|
36
36
|
const {
|
|
@@ -42,8 +42,15 @@ const ListPage = () => {
|
|
|
42
42
|
const { search } = useLocation();
|
|
43
43
|
useFocusWhenNavigate();
|
|
44
44
|
useLicenseLimitNotification();
|
|
45
|
-
const {
|
|
46
|
-
|
|
45
|
+
const {
|
|
46
|
+
users,
|
|
47
|
+
pagination,
|
|
48
|
+
isError,
|
|
49
|
+
isLoading,
|
|
50
|
+
refetchQueries: refetchAdminUsers,
|
|
51
|
+
} = useAdminUsers(qs.parse(search, { ignoreQueryPrefix: true }), {
|
|
52
|
+
enabled: canRead,
|
|
53
|
+
});
|
|
47
54
|
|
|
48
55
|
const headers = tableHeaders.map((header) => ({
|
|
49
56
|
...header,
|
|
@@ -58,59 +65,33 @@ const ListPage = () => {
|
|
|
58
65
|
defaultMessage: 'Users',
|
|
59
66
|
});
|
|
60
67
|
|
|
61
|
-
const notifyLoad = () => {
|
|
62
|
-
notifyStatus(
|
|
63
|
-
formatMessage(
|
|
64
|
-
{
|
|
65
|
-
id: 'app.utils.notify.data-loaded',
|
|
66
|
-
defaultMessage: 'The {target} has loaded',
|
|
67
|
-
},
|
|
68
|
-
{ target: title }
|
|
69
|
-
)
|
|
70
|
-
);
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
const { status, data, isFetching } = useQuery(queryName, () => fetchData(search, notifyLoad), {
|
|
74
|
-
enabled: canRead,
|
|
75
|
-
retry: false,
|
|
76
|
-
onError(error) {
|
|
77
|
-
toggleNotification({
|
|
78
|
-
type: 'warning',
|
|
79
|
-
message: {
|
|
80
|
-
id: 'notification.error',
|
|
81
|
-
message: formatAPIError(error),
|
|
82
|
-
defaultMessage: 'An error occured',
|
|
83
|
-
},
|
|
84
|
-
});
|
|
85
|
-
},
|
|
86
|
-
});
|
|
87
|
-
|
|
88
68
|
const handleToggle = () => {
|
|
89
69
|
setIsModalOpen((prev) => !prev);
|
|
90
70
|
};
|
|
91
71
|
|
|
92
|
-
const deleteAllMutation = useMutation(
|
|
93
|
-
async
|
|
94
|
-
await
|
|
95
|
-
|
|
96
|
-
// Toggle enabled/ disabled state on the invite button
|
|
97
|
-
await queryClient.refetchQueries(['ee', 'license-limit-info']);
|
|
72
|
+
const deleteAllMutation = useMutation(
|
|
73
|
+
async (ids) => {
|
|
74
|
+
await post('/admin/users/batch-delete', { ids });
|
|
98
75
|
},
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
message: {
|
|
103
|
-
id: 'notification.error',
|
|
104
|
-
message: formatAPIError(error),
|
|
105
|
-
defaultMessage: 'An error occured',
|
|
106
|
-
},
|
|
107
|
-
});
|
|
108
|
-
},
|
|
109
|
-
});
|
|
76
|
+
{
|
|
77
|
+
async onSuccess() {
|
|
78
|
+
await refetchAdminUsers();
|
|
110
79
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
80
|
+
// Toggle enabled/ disabled state on the invite button
|
|
81
|
+
await queryClient.refetchQueries(EE_LICENSE_LIMIT_QUERY_KEY);
|
|
82
|
+
},
|
|
83
|
+
onError(error) {
|
|
84
|
+
toggleNotification({
|
|
85
|
+
type: 'warning',
|
|
86
|
+
message: {
|
|
87
|
+
id: 'notification.error',
|
|
88
|
+
message: formatAPIError(error),
|
|
89
|
+
defaultMessage: 'An error occured',
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
},
|
|
93
|
+
}
|
|
94
|
+
);
|
|
114
95
|
|
|
115
96
|
return (
|
|
116
97
|
<Main aria-busy={isLoading}>
|
|
@@ -141,7 +122,8 @@ const ListPage = () => {
|
|
|
141
122
|
|
|
142
123
|
<ContentLayout canRead={canRead}>
|
|
143
124
|
{!canRead && <NoPermissions />}
|
|
144
|
-
{
|
|
125
|
+
{/* TODO: Replace error message with something better */}
|
|
126
|
+
{isError && <div>TODO: An error occurred</div>}
|
|
145
127
|
{canRead && (
|
|
146
128
|
<>
|
|
147
129
|
<DynamicTable
|
|
@@ -150,23 +132,32 @@ const ListPage = () => {
|
|
|
150
132
|
onConfirmDeleteAll={deleteAllMutation.mutateAsync}
|
|
151
133
|
onConfirmDelete={(id) => deleteAllMutation.mutateAsync([id])}
|
|
152
134
|
headers={headers}
|
|
153
|
-
rows={
|
|
135
|
+
rows={users}
|
|
154
136
|
withBulkActions
|
|
155
137
|
withMainAction={canDelete}
|
|
156
138
|
>
|
|
157
139
|
<TableRows
|
|
158
140
|
canDelete={canDelete}
|
|
159
141
|
headers={headers}
|
|
160
|
-
rows={
|
|
142
|
+
rows={users}
|
|
161
143
|
withBulkActions
|
|
162
144
|
withMainAction={canDelete}
|
|
163
145
|
/>
|
|
164
146
|
</DynamicTable>
|
|
165
|
-
|
|
147
|
+
|
|
148
|
+
{pagination && <PaginationFooter pagination={pagination} />}
|
|
166
149
|
</>
|
|
167
150
|
)}
|
|
168
151
|
</ContentLayout>
|
|
169
|
-
{isModalOpened &&
|
|
152
|
+
{isModalOpened && (
|
|
153
|
+
<ModalForm
|
|
154
|
+
onSuccess={async () => {
|
|
155
|
+
await refetchAdminUsers();
|
|
156
|
+
await queryClient.refetchQueries(EE_LICENSE_LIMIT_QUERY_KEY);
|
|
157
|
+
}}
|
|
158
|
+
onToggle={handleToggle}
|
|
159
|
+
/>
|
|
160
|
+
)}
|
|
170
161
|
</Main>
|
|
171
162
|
);
|
|
172
163
|
};
|
|
@@ -1,30 +1,32 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { IconButton } from '@strapi/design-system';
|
|
4
|
-
import { useNotification, ContentBox } from '@strapi/helper-plugin';
|
|
4
|
+
import { useNotification, ContentBox, useClipboard } from '@strapi/helper-plugin';
|
|
5
5
|
import { Duplicate } from '@strapi/icons';
|
|
6
|
-
import { CopyToClipboard } from 'react-copy-to-clipboard';
|
|
7
6
|
import { useIntl } from 'react-intl';
|
|
8
7
|
|
|
9
8
|
const MagicLinkWrapper = ({ children, target }) => {
|
|
10
9
|
const toggleNotification = useNotification();
|
|
11
10
|
const { formatMessage } = useIntl();
|
|
12
|
-
|
|
13
|
-
const handleCopy = () => {
|
|
14
|
-
toggleNotification({ type: 'info', message: { id: 'notification.link-copied' } });
|
|
15
|
-
};
|
|
11
|
+
const { copy } = useClipboard();
|
|
16
12
|
|
|
17
13
|
const copyLabel = formatMessage({
|
|
18
14
|
id: 'app.component.CopyToClipboard.label',
|
|
19
15
|
defaultMessage: 'Copy to clipboard',
|
|
20
16
|
});
|
|
21
17
|
|
|
18
|
+
const handleClick = async () => {
|
|
19
|
+
const didCopy = await copy(target);
|
|
20
|
+
|
|
21
|
+
if (didCopy) {
|
|
22
|
+
toggleNotification({ type: 'info', message: { id: 'notification.link-copied' } });
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
22
26
|
return (
|
|
23
27
|
<ContentBox
|
|
24
28
|
endAction={
|
|
25
|
-
<
|
|
26
|
-
<IconButton label={copyLabel} noBorder icon={<Duplicate />} />
|
|
27
|
-
</CopyToClipboard>
|
|
29
|
+
<IconButton label={copyLabel} noBorder icon={<Duplicate />} onClick={handleClick} />
|
|
28
30
|
}
|
|
29
31
|
title={target}
|
|
30
32
|
titleEllipsis
|
|
@@ -5,7 +5,18 @@ import { useFormikContext } from 'formik';
|
|
|
5
5
|
import { useIntl } from 'react-intl';
|
|
6
6
|
import styled from 'styled-components';
|
|
7
7
|
import EventRow from './EventRow';
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
export const formatValue = (value) =>
|
|
10
|
+
value.reduce((acc, curr) => {
|
|
11
|
+
const key = curr.split('.')[0];
|
|
12
|
+
|
|
13
|
+
if (!acc[key]) {
|
|
14
|
+
acc[key] = [];
|
|
15
|
+
}
|
|
16
|
+
acc[key].push(curr);
|
|
17
|
+
|
|
18
|
+
return acc;
|
|
19
|
+
}, {});
|
|
9
20
|
|
|
10
21
|
const StyledTable = styled.table`
|
|
11
22
|
td {
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
import { Main } from '@strapi/design-system';
|
|
15
15
|
import { useMutation, useQuery, useQueryClient } from 'react-query';
|
|
16
16
|
import { useHistory, useRouteMatch } from 'react-router-dom';
|
|
17
|
-
import {
|
|
17
|
+
import { useContentTypes } from '../../../../../hooks/useContentTypes';
|
|
18
18
|
import WebhookForm from './components/WebhookForm';
|
|
19
19
|
import cleanData from './utils/formatData';
|
|
20
20
|
|
|
@@ -27,7 +27,7 @@ const EditView = () => {
|
|
|
27
27
|
const { lockApp, unlockApp } = useOverlayBlocker();
|
|
28
28
|
const toggleNotification = useNotification();
|
|
29
29
|
const queryClient = useQueryClient();
|
|
30
|
-
const { isLoading: isLoadingForModels, collectionTypes } =
|
|
30
|
+
const { isLoading: isLoadingForModels, collectionTypes } = useContentTypes();
|
|
31
31
|
const { put, get, post } = useFetchClient();
|
|
32
32
|
|
|
33
33
|
const isCreating = id === 'create';
|