@strapi/admin 4.6.0 → 4.6.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/.browserslistrc +2 -1
- package/admin/src/components/AuthenticatedApp/utils/api.js +5 -4
- package/admin/src/components/LeftMenu/index.js +9 -3
- package/admin/src/content-manager/components/CollectionTypeFormWrapper/index.js +20 -16
- package/admin/src/content-manager/components/DynamicTable/CellContent/RelationMultiple/index.js +5 -5
- package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/findLeafByPathAndReplace.js +1 -3
- package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/schema.js +6 -5
- package/admin/src/content-manager/components/InputUID/index.js +4 -4
- package/admin/src/content-manager/components/Inputs/index.js +0 -2
- package/admin/src/content-manager/components/SingleTypeFormWrapper/index.js +35 -14
- package/admin/src/content-manager/hooks/useFetchContentTypeLayout/index.js +4 -3
- package/admin/src/content-manager/hooks/useLazyComponents/index.js +9 -13
- package/admin/src/content-manager/hooks/useRelation/useRelation.js +4 -4
- package/admin/src/content-manager/pages/App/useModels.js +8 -3
- package/admin/src/content-manager/pages/App/utils/getContentTypeLinks.js +3 -2
- package/admin/src/content-manager/pages/ComponentSetttingsView/index.js +4 -4
- package/admin/src/content-manager/pages/EditSettingsView/utils/api.js +4 -2
- package/admin/src/content-manager/pages/ListSettingsView/utils/api.js +4 -2
- package/admin/src/content-manager/pages/ListView/index.js +9 -9
- package/admin/src/core/utils/index.js +0 -1
- package/admin/src/hooks/useFetchEnabledPlugins/utils/api.js +3 -2
- package/admin/src/hooks/useInjectReducer/index.js +1 -0
- package/admin/src/hooks/useInjectReducer/useInjectReducer.js +19 -0
- package/admin/src/hooks/useRegenerate/index.js +3 -3
- package/admin/src/hooks/useRolesList/index.js +5 -3
- package/admin/src/index.js +4 -3
- package/admin/src/pages/ProfilePage/utils/api.js +5 -3
- package/admin/src/pages/SettingsPage/{pages/Users/ListPage → components}/Filters/index.js +0 -0
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/index.js +6 -5
- package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/index.js +4 -3
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/api.js +5 -3
- package/admin/src/pages/SettingsPage/pages/Users/EditPage/utils/api.js +6 -3
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/ModalForm/index.js +9 -3
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/utils/api.js +6 -3
- package/admin/src/pages/SettingsPage/pages/Users/components/SelectRoles/index.js +3 -2
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/index.js +3 -2
- package/admin/src/translations/en.json +7 -5
- package/admin/src/translations/eu.json +796 -0
- package/admin/src/translations/languageNativeNames.js +1 -0
- package/admin/src/translations/ru.json +9 -9
- package/build/1412.936ed920.chunk.js +159 -0
- package/build/1683.c8aa7b7c.chunk.js +268 -0
- package/build/2607.2e48dbf8.chunk.js +66 -0
- package/build/2743.6d1632f9.chunk.js +45 -0
- package/build/3075.dc3894fe.chunk.js +108 -0
- package/build/3632.0317b618.chunk.js +138 -0
- package/build/4318.f96a9d4d.chunk.js +30 -0
- package/build/{5910.a5374848.chunk.js → 4855.bd092921.chunk.js} +65 -65
- package/build/8633.00ccd382.chunk.js +1 -0
- package/build/9707.7290fd92.chunk.js +96 -0
- package/build/Admin-authenticatedApp.ce646f66.chunk.js +75 -0
- package/build/{Admin_homePage.79ab880c.chunk.js → Admin_homePage.b1730882.chunk.js} +1 -1
- package/build/{Admin_marketplace.eabf21b2.chunk.js → Admin_marketplace.ea0316c2.chunk.js} +2 -2
- package/build/Admin_pluginsPage.5c24f963.chunk.js +6 -0
- package/build/Admin_profilePage.59af1978.chunk.js +15 -0
- package/build/Admin_settingsPage.d1493824.chunk.js +178 -0
- package/build/admin-app.25934eaa.chunk.js +112 -0
- package/build/admin-edit-roles-page.446b69dc.chunk.js +1 -0
- package/build/admin-edit-users.2ed69bfd.chunk.js +10 -0
- package/build/admin-users.fc003b10.chunk.js +11 -0
- package/build/{api-tokens-create-page.0e686c30.chunk.js → api-tokens-create-page.d248362d.chunk.js} +1 -1
- package/build/{api-tokens-edit-page.d6c7487b.chunk.js → api-tokens-edit-page.8516fa20.chunk.js} +1 -1
- package/build/api-tokens-list-page.44a79fda.chunk.js +16 -0
- package/build/audit-logs-settings-page.c3dce30d.chunk.js +1 -0
- package/build/content-manager.35ff9726.chunk.js +1139 -0
- package/build/{content-type-builder-list-view.4243b2b1.chunk.js → content-type-builder-list-view.79e84b36.chunk.js} +1 -6
- package/build/{content-type-builder.365b6bf4.chunk.js → content-type-builder.855db321.chunk.js} +16 -15
- package/build/{email-settings-page.379552b1.chunk.js → email-settings-page.d1fcc7a3.chunk.js} +4 -9
- package/build/en-json.1f137a90.chunk.js +1 -0
- package/build/eu-json.fceecd8b.chunk.js +1 -0
- package/build/i18n-settings-page.b8d8753e.chunk.js +60 -0
- package/build/index.html +1 -1
- package/build/main.7b151630.js +4377 -0
- package/build/ru-json.aa5cd123.chunk.js +1 -0
- package/build/runtime~main.a20d633b.js +2 -0
- package/build/sso-settings-page.b85ad080.chunk.js +41 -0
- package/build/upload-settings.ef64bbf9.chunk.js +84 -0
- package/build/upload.c5730dfa.chunk.js +33 -0
- package/build/users-advanced-settings-page.fce9908e.chunk.js +8 -0
- package/build/users-email-settings-page.343d0ad2.chunk.js +23 -0
- package/build/users-providers-settings-page.e5a9a3f1.chunk.js +99 -0
- package/build/users-roles-settings-page.66312f31.chunk.js +30 -0
- package/build/webhook-edit-page.73e51e64.chunk.js +75 -0
- package/build/{webhook-list-page.f75ba3f2.chunk.js → webhook-list-page.1134f130.chunk.js} +1 -1
- package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/ComboboxFilter/index.js +41 -0
- package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/Modal/ActionBody.js +1 -3
- package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/TableRows/index.js +1 -1
- package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/hooks/useAuditLogsData.js +47 -0
- package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/index.js +30 -31
- package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/utils/getActionTypesDefaultMessages.js +7 -9
- package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/utils/getDisplayedFilters.js +88 -0
- package/ee/admin/pages/SettingsPage/pages/Roles/ListPage/index.js +4 -2
- package/ee/server/migrations/audit-logs-table.js +45 -0
- package/ee/server/register.js +2 -0
- package/ee/server/services/audit-logs.js +11 -1
- package/package.json +27 -27
- package/server/controllers/admin.js +16 -0
- package/admin/src/content-manager/components/InputJSON/FieldWrapper.js +0 -40
- package/admin/src/content-manager/components/InputJSON/Label.js +0 -35
- package/admin/src/content-manager/components/InputJSON/components.js +0 -36
- package/admin/src/content-manager/components/InputJSON/index.js +0 -223
- package/admin/src/content-manager/components/InputJSON/jsonlint.js +0 -680
- package/admin/src/core/utils/axiosInstance.js +0 -40
- package/build/2607.ce06608e.chunk.js +0 -66
- package/build/2743.dea372fb.chunk.js +0 -42
- package/build/3075.03ebe93d.chunk.js +0 -115
- package/build/3632.963ac97d.chunk.js +0 -138
- package/build/4318.8cb388a5.chunk.js +0 -30
- package/build/4656.a0d43cca.chunk.js +0 -159
- package/build/8633.4af74a50.chunk.js +0 -1
- package/build/9641.a311b612.chunk.js +0 -276
- package/build/9707.62831b4d.chunk.js +0 -101
- package/build/Admin-authenticatedApp.50dc27f9.chunk.js +0 -75
- package/build/Admin_pluginsPage.953e796b.chunk.js +0 -6
- package/build/Admin_profilePage.5c2efda5.chunk.js +0 -15
- package/build/Admin_settingsPage.19cfb9ca.chunk.js +0 -178
- package/build/admin-app.34295b50.chunk.js +0 -112
- package/build/admin-edit-roles-page.d50d9654.chunk.js +0 -1
- package/build/admin-edit-users.912b856d.chunk.js +0 -10
- package/build/admin-users.e36e7111.chunk.js +0 -11
- package/build/api-tokens-list-page.1cd86136.chunk.js +0 -16
- package/build/audit-logs-settings-page.308a6250.chunk.js +0 -1
- package/build/codemirror-addon-closebrackets.71aa4bbd.chunk.js +0 -2
- package/build/codemirror-addon-lint-js.405f70fb.chunk.js +0 -1
- package/build/codemirror-addon-lint.8487ad3d.chunk.js +0 -1
- package/build/codemirror-addon-mark-selection.1928c849.chunk.js +0 -1
- package/build/codemirror-css.359a2a4b.chunk.js +0 -345
- package/build/codemirror-javacript.af237b68.chunk.js +0 -1
- package/build/codemirror-theme.2fe63a16.chunk.js +0 -33
- package/build/content-manager.851f40ce.chunk.js +0 -1170
- package/build/en-json.38d182e5.chunk.js +0 -1
- package/build/i18n-settings-page.3ab28b1a.chunk.js +0 -65
- package/build/main.9f31732e.js +0 -4454
- package/build/ru-json.3b411a39.chunk.js +0 -1
- package/build/runtime~main.2b8e2318.js +0 -2
- package/build/sso-settings-page.b64a44e8.chunk.js +0 -41
- package/build/upload-settings.6c26ff37.chunk.js +0 -89
- package/build/upload.2c69d238.chunk.js +0 -38
- package/build/users-advanced-settings-page.c4270682.chunk.js +0 -13
- package/build/users-email-settings-page.60422a2f.chunk.js +0 -28
- package/build/users-providers-settings-page.e1834060.chunk.js +0 -104
- package/build/users-roles-settings-page.3ef35132.chunk.js +0 -30
- package/build/webhook-edit-page.c0080dc1.chunk.js +0 -75
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getFetchClient } from '@strapi/helper-plugin';
|
|
2
2
|
import generateModelsLinks from './generateModelsLinks';
|
|
3
3
|
import checkPermissions from './checkPermissions';
|
|
4
4
|
import { getRequestUrl } from '../../../utils';
|
|
5
5
|
|
|
6
6
|
const getContentTypeLinks = async (models, userPermissions, toggleNotification) => {
|
|
7
|
+
const { get } = getFetchClient();
|
|
7
8
|
try {
|
|
8
9
|
const {
|
|
9
10
|
data: { data: contentTypeConfigurations },
|
|
10
|
-
} = await
|
|
11
|
+
} = await get(getRequestUrl('content-types-settings'));
|
|
11
12
|
|
|
12
13
|
const { collectionTypesSectionLinks, singleTypesSectionLinks } = generateModelsLinks(
|
|
13
14
|
models,
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React, { memo, useEffect, useMemo, useReducer } from 'react';
|
|
2
2
|
import { useParams } from 'react-router-dom';
|
|
3
|
-
import { CheckPagePermissions, LoadingIndicatorPage } from '@strapi/helper-plugin';
|
|
3
|
+
import { CheckPagePermissions, LoadingIndicatorPage, useFetchClient } from '@strapi/helper-plugin';
|
|
4
4
|
import { useSelector, shallowEqual } from 'react-redux';
|
|
5
5
|
import axios from 'axios';
|
|
6
|
-
import { axiosInstance } from '../../../core/utils';
|
|
7
6
|
import { getRequestUrl, mergeMetasWithSchema } from '../../utils';
|
|
8
7
|
import { makeSelectModelAndComponentSchemas } from '../App/selectors';
|
|
9
8
|
import permissions from '../../../permissions';
|
|
@@ -18,6 +17,7 @@ const ComponentSettingsView = () => {
|
|
|
18
17
|
const schemasSelector = useMemo(makeSelectModelAndComponentSchemas, []);
|
|
19
18
|
const { schemas } = useSelector((state) => schemasSelector(state), shallowEqual);
|
|
20
19
|
const { uid } = useParams();
|
|
20
|
+
const { get } = useFetchClient();
|
|
21
21
|
|
|
22
22
|
useEffect(() => {
|
|
23
23
|
const CancelToken = axios.CancelToken;
|
|
@@ -29,7 +29,7 @@ const ComponentSettingsView = () => {
|
|
|
29
29
|
|
|
30
30
|
const {
|
|
31
31
|
data: { data },
|
|
32
|
-
} = await
|
|
32
|
+
} = await get(getRequestUrl(`components/${uid}/configuration`), {
|
|
33
33
|
cancelToken: source.token,
|
|
34
34
|
});
|
|
35
35
|
|
|
@@ -48,7 +48,7 @@ const ComponentSettingsView = () => {
|
|
|
48
48
|
return () => {
|
|
49
49
|
source.cancel('Operation canceled by the user.');
|
|
50
50
|
};
|
|
51
|
-
}, [uid, schemas]);
|
|
51
|
+
}, [uid, schemas, get]);
|
|
52
52
|
|
|
53
53
|
if (isLoading) {
|
|
54
54
|
return <LoadingIndicatorPage />;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getFetchClient } from '@strapi/helper-plugin';
|
|
2
2
|
import { getRequestUrl } from '../../../utils';
|
|
3
3
|
|
|
4
4
|
const putCMSettingsEV = (body, slug, isContentTypeView) => {
|
|
5
|
-
|
|
5
|
+
const { put } = getFetchClient();
|
|
6
|
+
|
|
7
|
+
return put(
|
|
6
8
|
getRequestUrl(
|
|
7
9
|
isContentTypeView ? `content-types/${slug}/configuration` : `components/${slug}/configuration`
|
|
8
10
|
),
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getFetchClient } from '@strapi/helper-plugin';
|
|
2
2
|
import { getRequestUrl } from '../../../utils';
|
|
3
3
|
|
|
4
4
|
const putCMSettingsLV = (body, slug) => {
|
|
5
|
-
|
|
5
|
+
const { put } = getFetchClient();
|
|
6
|
+
|
|
7
|
+
return put(getRequestUrl(`content-types/${slug}/configuration`), body);
|
|
6
8
|
};
|
|
7
9
|
|
|
8
10
|
export default putCMSettingsLV;
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
NoPermissions,
|
|
15
15
|
CheckPermissions,
|
|
16
16
|
SearchURLQuery,
|
|
17
|
+
useFetchClient,
|
|
17
18
|
useFocusWhenNavigate,
|
|
18
19
|
useQueryParams,
|
|
19
20
|
useNotification,
|
|
@@ -33,8 +34,6 @@ import ArrowLeft from '@strapi/icons/ArrowLeft';
|
|
|
33
34
|
import Plus from '@strapi/icons/Plus';
|
|
34
35
|
import Cog from '@strapi/icons/Cog';
|
|
35
36
|
|
|
36
|
-
import { axiosInstance } from '../../../core/utils';
|
|
37
|
-
|
|
38
37
|
import DynamicTable from '../../components/DynamicTable';
|
|
39
38
|
import AttributeFilter from '../../components/AttributeFilter';
|
|
40
39
|
import { InjectionZone } from '../../../shared/components';
|
|
@@ -97,6 +96,8 @@ function ListView({
|
|
|
97
96
|
const { formatMessage } = useIntl();
|
|
98
97
|
const contentType = layout.contentType;
|
|
99
98
|
const hasDraftAndPublish = get(contentType, 'options.draftAndPublish', false);
|
|
99
|
+
const fetchClient = useFetchClient();
|
|
100
|
+
const { post, del } = fetchClient;
|
|
100
101
|
|
|
101
102
|
// FIXME
|
|
102
103
|
// Using a ref to avoid requests being fired multiple times on slug on change
|
|
@@ -112,7 +113,7 @@ function ListView({
|
|
|
112
113
|
|
|
113
114
|
const {
|
|
114
115
|
data: { results, pagination: paginationResult },
|
|
115
|
-
} = await
|
|
116
|
+
} = await fetchClient.get(endPoint, opts);
|
|
116
117
|
|
|
117
118
|
notifyStatus(
|
|
118
119
|
formatMessage(
|
|
@@ -154,13 +155,13 @@ function ListView({
|
|
|
154
155
|
});
|
|
155
156
|
}
|
|
156
157
|
},
|
|
157
|
-
[formatMessage, getData, getDataSucceeded, notifyStatus, push, toggleNotification]
|
|
158
|
+
[formatMessage, getData, getDataSucceeded, notifyStatus, push, toggleNotification, fetchClient]
|
|
158
159
|
);
|
|
159
160
|
|
|
160
161
|
const handleConfirmDeleteAllData = useCallback(
|
|
161
162
|
async (ids) => {
|
|
162
163
|
try {
|
|
163
|
-
await
|
|
164
|
+
await post(getRequestUrl(`collection-types/${slug}/actions/bulkDelete`), {
|
|
164
165
|
ids,
|
|
165
166
|
});
|
|
166
167
|
|
|
@@ -174,13 +175,13 @@ function ListView({
|
|
|
174
175
|
});
|
|
175
176
|
}
|
|
176
177
|
},
|
|
177
|
-
[fetchData, params, slug, toggleNotification]
|
|
178
|
+
[fetchData, params, slug, toggleNotification, post]
|
|
178
179
|
);
|
|
179
180
|
|
|
180
181
|
const handleConfirmDeleteData = useCallback(
|
|
181
182
|
async (idToDelete) => {
|
|
182
183
|
try {
|
|
183
|
-
await
|
|
184
|
+
await del(getRequestUrl(`collection-types/${slug}/${idToDelete}`));
|
|
184
185
|
|
|
185
186
|
const requestUrl = getRequestUrl(`collection-types/${slug}${params}`);
|
|
186
187
|
fetchData(requestUrl);
|
|
@@ -202,7 +203,7 @@ function ListView({
|
|
|
202
203
|
});
|
|
203
204
|
}
|
|
204
205
|
},
|
|
205
|
-
[slug, params, fetchData, toggleNotification, formatMessage]
|
|
206
|
+
[slug, params, fetchData, toggleNotification, formatMessage, del]
|
|
206
207
|
);
|
|
207
208
|
|
|
208
209
|
useEffect(() => {
|
|
@@ -221,7 +222,6 @@ function ListView({
|
|
|
221
222
|
|
|
222
223
|
source.cancel('Operation canceled by the user.');
|
|
223
224
|
};
|
|
224
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
225
225
|
}, [canRead, getData, slug, params, getDataSucceeded, fetchData]);
|
|
226
226
|
|
|
227
227
|
const defaultHeaderLayoutTitle = formatMessage({
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getFetchClient } from '@strapi/helper-plugin';
|
|
2
2
|
|
|
3
3
|
const fetchEnabledPlugins = async () => {
|
|
4
|
-
const {
|
|
4
|
+
const { get } = getFetchClient();
|
|
5
|
+
const { data } = await get('/admin/plugins');
|
|
5
6
|
|
|
6
7
|
return data;
|
|
7
8
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useInjectReducer';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { useStore } from 'react-redux';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Inject a new reducer into the global redux-store.
|
|
6
|
+
*
|
|
7
|
+
* @export
|
|
8
|
+
* @param {string} namespace - Store namespace of the injected reducer
|
|
9
|
+
* @param {Function} reducer - Reducer function
|
|
10
|
+
* @return void
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export function useInjectReducer(namespace, reducer) {
|
|
14
|
+
const store = useStore();
|
|
15
|
+
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
store.injectReducer(namespace, reducer);
|
|
18
|
+
}, [store, namespace, reducer]);
|
|
19
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { get } from 'lodash';
|
|
3
|
-
import { useNotification } from '@strapi/helper-plugin';
|
|
4
|
-
import { axiosInstance } from '../../core/utils';
|
|
3
|
+
import { useFetchClient, useNotification } from '@strapi/helper-plugin';
|
|
5
4
|
|
|
6
5
|
const useRegenerate = (id, onRegenerate) => {
|
|
7
6
|
const [isLoadingConfirmation, setIsLoadingConfirmation] = useState(false);
|
|
8
7
|
const toggleNotification = useNotification();
|
|
8
|
+
const { post } = useFetchClient();
|
|
9
9
|
|
|
10
10
|
const regenerateData = async () => {
|
|
11
11
|
try {
|
|
@@ -13,7 +13,7 @@ const useRegenerate = (id, onRegenerate) => {
|
|
|
13
13
|
data: {
|
|
14
14
|
data: { accessKey },
|
|
15
15
|
},
|
|
16
|
-
} = await
|
|
16
|
+
} = await post(`/admin/api-tokens/${id}/regenerate`);
|
|
17
17
|
setIsLoadingConfirmation(false);
|
|
18
18
|
onRegenerate(accessKey);
|
|
19
19
|
} catch (error) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { useEffect, useReducer, useCallback } from 'react';
|
|
2
|
-
import { useNotification } from '@strapi/helper-plugin';
|
|
2
|
+
import { getFetchClient, useNotification } from '@strapi/helper-plugin';
|
|
3
3
|
import get from 'lodash/get';
|
|
4
|
-
import { axiosInstance } from '../../core/utils';
|
|
5
4
|
import init from './init';
|
|
6
5
|
import reducer, { initialState } from './reducer';
|
|
7
6
|
|
|
@@ -19,6 +18,9 @@ const useRolesList = (shouldFetchData = true) => {
|
|
|
19
18
|
}, [shouldFetchData]);
|
|
20
19
|
|
|
21
20
|
const fetchRolesList = useCallback(async () => {
|
|
21
|
+
// TODO: evaluate to replace it with a useFetchClient when we work on the useCallback to remove
|
|
22
|
+
const fetchClient = getFetchClient();
|
|
23
|
+
|
|
22
24
|
try {
|
|
23
25
|
dispatch({
|
|
24
26
|
type: 'GET_DATA',
|
|
@@ -26,7 +28,7 @@ const useRolesList = (shouldFetchData = true) => {
|
|
|
26
28
|
|
|
27
29
|
const {
|
|
28
30
|
data: { data },
|
|
29
|
-
} = await
|
|
31
|
+
} = await fetchClient.get('/admin/roles');
|
|
30
32
|
|
|
31
33
|
dispatch({
|
|
32
34
|
type: 'GET_DATA_SUCCEEDED',
|
package/admin/src/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import ReactDOM from 'react-dom';
|
|
2
|
-
import
|
|
2
|
+
import { getFetchClient } from '@strapi/helper-plugin';
|
|
3
3
|
import { Components, Fields, Middlewares, Reducers } from './core/apis';
|
|
4
|
-
import
|
|
4
|
+
import appCustomisations from './app';
|
|
5
5
|
// eslint-disable-next-line import/extensions
|
|
6
6
|
import plugins from './plugins';
|
|
7
7
|
import appReducers from './reducers';
|
|
@@ -29,12 +29,13 @@ const reducers = Reducers({ appReducers });
|
|
|
29
29
|
const MOUNT_NODE = document.getElementById('app');
|
|
30
30
|
|
|
31
31
|
const run = async () => {
|
|
32
|
+
const { get } = getFetchClient();
|
|
32
33
|
try {
|
|
33
34
|
const {
|
|
34
35
|
data: {
|
|
35
36
|
data: { isEE, features },
|
|
36
37
|
},
|
|
37
|
-
} = await
|
|
38
|
+
} = await get('/admin/project-type');
|
|
38
39
|
|
|
39
40
|
window.strapi.isEE = isEE;
|
|
40
41
|
window.strapi.features = {
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import omit from 'lodash/omit';
|
|
2
|
-
import {
|
|
2
|
+
import { getFetchClient } from '@strapi/helper-plugin';
|
|
3
3
|
|
|
4
4
|
const fetchUser = async () => {
|
|
5
|
-
const {
|
|
5
|
+
const { get } = getFetchClient();
|
|
6
|
+
const { data } = await get('/admin/users/me');
|
|
6
7
|
|
|
7
8
|
return data.data;
|
|
8
9
|
};
|
|
9
10
|
|
|
10
11
|
const putUser = async (body) => {
|
|
11
12
|
const dataToSend = omit(body, ['confirmPassword', 'currentTheme']);
|
|
12
|
-
const {
|
|
13
|
+
const { put } = getFetchClient();
|
|
14
|
+
const { data } = await put('/admin/users/me', dataToSend);
|
|
13
15
|
|
|
14
16
|
return { ...data.data, currentTheme: body.currentTheme };
|
|
15
17
|
};
|
|
File without changes
|
|
@@ -9,13 +9,13 @@ import {
|
|
|
9
9
|
useTracking,
|
|
10
10
|
useGuidedTour,
|
|
11
11
|
useRBAC,
|
|
12
|
+
useFetchClient,
|
|
12
13
|
} from '@strapi/helper-plugin';
|
|
13
14
|
import { Main } from '@strapi/design-system/Main';
|
|
14
15
|
import { Formik } from 'formik';
|
|
15
16
|
import { useRouteMatch, useHistory } from 'react-router-dom';
|
|
16
17
|
import { useQuery } from 'react-query';
|
|
17
18
|
import { formatAPIErrors } from '../../../../../utils';
|
|
18
|
-
import { axiosInstance } from '../../../../../core/utils';
|
|
19
19
|
import { schema } from './utils';
|
|
20
20
|
import LoadingView from './components/LoadingView';
|
|
21
21
|
import FormHead from './components/FormHead';
|
|
@@ -50,6 +50,7 @@ const ApiTokenCreateView = () => {
|
|
|
50
50
|
const {
|
|
51
51
|
params: { id },
|
|
52
52
|
} = useRouteMatch('/settings/api-tokens/:id');
|
|
53
|
+
const { get, post, put } = useFetchClient();
|
|
53
54
|
|
|
54
55
|
const isCreating = id === 'create';
|
|
55
56
|
|
|
@@ -58,7 +59,7 @@ const ApiTokenCreateView = () => {
|
|
|
58
59
|
async () => {
|
|
59
60
|
const [permissions, routes] = await Promise.all(
|
|
60
61
|
['/admin/content-api/permissions', '/admin/content-api/routes'].map(async (url) => {
|
|
61
|
-
const { data } = await
|
|
62
|
+
const { data } = await get(url);
|
|
62
63
|
|
|
63
64
|
return data.data;
|
|
64
65
|
})
|
|
@@ -112,7 +113,7 @@ const ApiTokenCreateView = () => {
|
|
|
112
113
|
async () => {
|
|
113
114
|
const {
|
|
114
115
|
data: { data },
|
|
115
|
-
} = await
|
|
116
|
+
} = await get(`/admin/api-tokens/${id}`);
|
|
116
117
|
|
|
117
118
|
setApiToken({
|
|
118
119
|
...data,
|
|
@@ -160,12 +161,12 @@ const ApiTokenCreateView = () => {
|
|
|
160
161
|
const {
|
|
161
162
|
data: { data: response },
|
|
162
163
|
} = isCreating
|
|
163
|
-
? await
|
|
164
|
+
? await post(`/admin/api-tokens`, {
|
|
164
165
|
...body,
|
|
165
166
|
lifespan: lifespanVal,
|
|
166
167
|
permissions: body.type === 'custom' ? state.selectedActions : null,
|
|
167
168
|
})
|
|
168
|
-
: await
|
|
169
|
+
: await put(`/admin/api-tokens/${id}`, {
|
|
169
170
|
name: body.name,
|
|
170
171
|
description: body.description,
|
|
171
172
|
type: body.type,
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
DynamicTable,
|
|
15
15
|
useTracking,
|
|
16
16
|
useGuidedTour,
|
|
17
|
+
useFetchClient,
|
|
17
18
|
LinkButton,
|
|
18
19
|
} from '@strapi/helper-plugin';
|
|
19
20
|
import { HeaderLayout, ContentLayout } from '@strapi/design-system/Layout';
|
|
@@ -21,7 +22,6 @@ import { Main } from '@strapi/design-system/Main';
|
|
|
21
22
|
import { Button } from '@strapi/design-system/Button';
|
|
22
23
|
import Plus from '@strapi/icons/Plus';
|
|
23
24
|
|
|
24
|
-
import { axiosInstance } from '../../../../../core/utils';
|
|
25
25
|
import adminPermissions from '../../../../../permissions';
|
|
26
26
|
import tableHeaders from './utils/tableHeaders';
|
|
27
27
|
import TableRows from './DynamicTable';
|
|
@@ -38,6 +38,7 @@ const ApiTokenListView = () => {
|
|
|
38
38
|
const { trackUsage } = useTracking();
|
|
39
39
|
const { startSection } = useGuidedTour();
|
|
40
40
|
const startSectionRef = useRef(startSection);
|
|
41
|
+
const { get, del } = useFetchClient();
|
|
41
42
|
|
|
42
43
|
useEffect(() => {
|
|
43
44
|
if (startSectionRef.current) {
|
|
@@ -67,7 +68,7 @@ const ApiTokenListView = () => {
|
|
|
67
68
|
trackUsage('willAccessTokenList');
|
|
68
69
|
const {
|
|
69
70
|
data: { data },
|
|
70
|
-
} = await
|
|
71
|
+
} = await get(`/admin/api-tokens`);
|
|
71
72
|
|
|
72
73
|
trackUsage('didAccessTokenList', { number: data.length });
|
|
73
74
|
|
|
@@ -90,7 +91,7 @@ const ApiTokenListView = () => {
|
|
|
90
91
|
|
|
91
92
|
const deleteMutation = useMutation(
|
|
92
93
|
async (id) => {
|
|
93
|
-
await
|
|
94
|
+
await del(`/admin/api-tokens/${id}`);
|
|
94
95
|
},
|
|
95
96
|
{
|
|
96
97
|
async onSuccess() {
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getFetchClient } from '@strapi/helper-plugin';
|
|
2
2
|
import prefixAllUrls from './prefixAllUrls';
|
|
3
3
|
|
|
4
4
|
const fetchProjectSettings = async () => {
|
|
5
|
-
const {
|
|
5
|
+
const { get } = getFetchClient();
|
|
6
|
+
const { data } = await get('/admin/project-settings');
|
|
6
7
|
|
|
7
8
|
return prefixAllUrls(data);
|
|
8
9
|
};
|
|
9
10
|
|
|
10
11
|
const postProjectSettings = async (body) => {
|
|
11
|
-
const {
|
|
12
|
+
const { post } = getFetchClient();
|
|
13
|
+
const { data } = await post('/admin/project-settings', body, {
|
|
12
14
|
headers: {
|
|
13
15
|
'Content-Type': 'multipart/form-data',
|
|
14
16
|
},
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getFetchClient } from '@strapi/helper-plugin';
|
|
2
2
|
|
|
3
3
|
const fetchUser = async (id) => {
|
|
4
|
-
const {
|
|
4
|
+
const { get } = getFetchClient();
|
|
5
|
+
const { data } = await get(`/admin/users/${id}`);
|
|
5
6
|
|
|
6
7
|
return data.data;
|
|
7
8
|
};
|
|
8
9
|
|
|
9
10
|
const putUser = async (id, body) => {
|
|
10
|
-
const {
|
|
11
|
+
const { put } = getFetchClient();
|
|
12
|
+
|
|
13
|
+
const { data } = await put(`/admin/users/${id}`, body);
|
|
11
14
|
|
|
12
15
|
return data.data;
|
|
13
16
|
};
|
|
@@ -15,12 +15,17 @@ import { Stack } from '@strapi/design-system/Stack';
|
|
|
15
15
|
import { Typography } from '@strapi/design-system/Typography';
|
|
16
16
|
|
|
17
17
|
import { Formik } from 'formik';
|
|
18
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
Form,
|
|
20
|
+
GenericInput,
|
|
21
|
+
useNotification,
|
|
22
|
+
useOverlayBlocker,
|
|
23
|
+
useFetchClient,
|
|
24
|
+
} from '@strapi/helper-plugin';
|
|
19
25
|
import { useQueryClient, useMutation } from 'react-query';
|
|
20
26
|
import formDataModel from 'ee_else_ce/pages/SettingsPage/pages/Users/ListPage/ModalForm/utils/formDataModel';
|
|
21
27
|
import roleSettingsForm from 'ee_else_ce/pages/SettingsPage/pages/Users/ListPage/ModalForm/utils/roleSettingsForm';
|
|
22
28
|
import MagicLink from 'ee_else_ce/pages/SettingsPage/pages/Users/components/MagicLink';
|
|
23
|
-
import { axiosInstance } from '../../../../../../core/utils';
|
|
24
29
|
import SelectRoles from '../../components/SelectRoles';
|
|
25
30
|
import layout from './utils/layout';
|
|
26
31
|
import schema from './utils/schema';
|
|
@@ -34,9 +39,10 @@ const ModalForm = ({ queryName, onToggle }) => {
|
|
|
34
39
|
const { formatMessage } = useIntl();
|
|
35
40
|
const toggleNotification = useNotification();
|
|
36
41
|
const { lockApp, unlockApp } = useOverlayBlocker();
|
|
42
|
+
const { post } = useFetchClient();
|
|
37
43
|
const postMutation = useMutation(
|
|
38
44
|
(body) => {
|
|
39
|
-
return
|
|
45
|
+
return post('/admin/users', body);
|
|
40
46
|
},
|
|
41
47
|
{
|
|
42
48
|
async onSuccess({ data }) {
|
|
@@ -18,7 +18,7 @@ import { useIntl } from 'react-intl';
|
|
|
18
18
|
import { useMutation, useQuery, useQueryClient } from 'react-query';
|
|
19
19
|
import adminPermissions from '../../../../../permissions';
|
|
20
20
|
import TableRows from './DynamicTable/TableRows';
|
|
21
|
-
import Filters from '
|
|
21
|
+
import Filters from '../../../components/Filters';
|
|
22
22
|
import ModalForm from './ModalForm';
|
|
23
23
|
import PaginationFooter from './PaginationFooter';
|
|
24
24
|
import { deleteData, fetchData } from './utils/api';
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getFetchClient } from '@strapi/helper-plugin';
|
|
2
2
|
|
|
3
3
|
const fetchData = async (search, notify) => {
|
|
4
|
+
const { get } = getFetchClient();
|
|
4
5
|
const {
|
|
5
6
|
data: { data },
|
|
6
|
-
} = await
|
|
7
|
+
} = await get(`/admin/users${search}`);
|
|
7
8
|
|
|
8
9
|
notify();
|
|
9
10
|
|
|
@@ -11,7 +12,9 @@ const fetchData = async (search, notify) => {
|
|
|
11
12
|
};
|
|
12
13
|
|
|
13
14
|
const deleteData = async (ids) => {
|
|
14
|
-
|
|
15
|
+
const { post } = getFetchClient();
|
|
16
|
+
|
|
17
|
+
await post('/admin/users/batch-delete', { ids });
|
|
15
18
|
};
|
|
16
19
|
|
|
17
20
|
export { deleteData, fetchData };
|
|
@@ -5,7 +5,7 @@ import { Select, Option } from '@strapi/design-system/Select';
|
|
|
5
5
|
import { useQuery } from 'react-query';
|
|
6
6
|
import styled, { keyframes } from 'styled-components';
|
|
7
7
|
import LoadingIcon from '@strapi/icons/Loader';
|
|
8
|
-
import {
|
|
8
|
+
import { getFetchClient } from '@strapi/helper-plugin';
|
|
9
9
|
|
|
10
10
|
const rotation = keyframes`
|
|
11
11
|
from {
|
|
@@ -27,7 +27,8 @@ const Loader = () => (
|
|
|
27
27
|
);
|
|
28
28
|
|
|
29
29
|
const fetchData = async () => {
|
|
30
|
-
const {
|
|
30
|
+
const { get } = getFetchClient();
|
|
31
|
+
const { data } = await get('/admin/roles');
|
|
31
32
|
|
|
32
33
|
return data.data;
|
|
33
34
|
};
|
|
@@ -11,12 +11,12 @@ import {
|
|
|
11
11
|
to,
|
|
12
12
|
useNotification,
|
|
13
13
|
useOverlayBlocker,
|
|
14
|
+
useFetchClient,
|
|
14
15
|
} from '@strapi/helper-plugin';
|
|
15
16
|
import { Main } from '@strapi/design-system/Main';
|
|
16
17
|
import { useMutation, useQuery, useQueryClient } from 'react-query';
|
|
17
18
|
import { useHistory, useRouteMatch } from 'react-router-dom';
|
|
18
19
|
import { useModels } from '../../../../../hooks';
|
|
19
|
-
import { axiosInstance } from '../../../../../core/utils';
|
|
20
20
|
import WebhookForm from './components/WebhookForm';
|
|
21
21
|
import cleanData from './utils/formatData';
|
|
22
22
|
|
|
@@ -30,6 +30,7 @@ const EditView = () => {
|
|
|
30
30
|
const toggleNotification = useNotification();
|
|
31
31
|
const queryClient = useQueryClient();
|
|
32
32
|
const { isLoading: isLoadingForModels, collectionTypes } = useModels();
|
|
33
|
+
const { post } = useFetchClient();
|
|
33
34
|
|
|
34
35
|
const isCreating = id === 'create';
|
|
35
36
|
|
|
@@ -64,7 +65,7 @@ const EditView = () => {
|
|
|
64
65
|
data: triggerResponse,
|
|
65
66
|
isIdle: isTriggerIdle,
|
|
66
67
|
mutate,
|
|
67
|
-
} = useMutation(() =>
|
|
68
|
+
} = useMutation(() => post(`/admin/webhooks/${id}/trigger`));
|
|
68
69
|
|
|
69
70
|
const triggerWebhook = () =>
|
|
70
71
|
mutate(null, {
|
|
@@ -181,15 +181,16 @@
|
|
|
181
181
|
"Settings.permissions.auditLogs.action": "Action",
|
|
182
182
|
"Settings.permissions.auditLogs.date": "Date",
|
|
183
183
|
"Settings.permissions.auditLogs.user": "User",
|
|
184
|
+
"Settings.permissions.auditLogs.user.fullname": "{firstname} {lastname}",
|
|
184
185
|
"Settings.permissions.auditLogs.userId": "User ID",
|
|
185
186
|
"Settings.permissions.auditLogs.details": "Log Details",
|
|
186
187
|
"Settings.permissions.auditLogs.payload": "Payload",
|
|
187
188
|
"Settings.permissions.auditLogs.listview.header.subtitle": "Logs of all the activities that happened in your environment",
|
|
188
|
-
"Settings.permissions.auditLogs.entry.create": "Create entry ({model})",
|
|
189
|
-
"Settings.permissions.auditLogs.entry.update": "Update entry ({model})",
|
|
190
|
-
"Settings.permissions.auditLogs.entry.delete": "Delete entry ({model})",
|
|
191
|
-
"Settings.permissions.auditLogs.entry.publish": "Publish entry ({model})",
|
|
192
|
-
"Settings.permissions.auditLogs.entry.unpublish": "Unpublish entry ({model})",
|
|
189
|
+
"Settings.permissions.auditLogs.entry.create": "Create entry{model, select, undefined {} other { ({model})}}",
|
|
190
|
+
"Settings.permissions.auditLogs.entry.update": "Update entry{model, select, undefined {} other { ({model})}}",
|
|
191
|
+
"Settings.permissions.auditLogs.entry.delete": "Delete entry{model, select, undefined {} other { ({model})}}",
|
|
192
|
+
"Settings.permissions.auditLogs.entry.publish": "Publish entry {model, select, undefined {} other {({model})}}",
|
|
193
|
+
"Settings.permissions.auditLogs.entry.unpublish": "Unpublish entry{model, select, undefined {} other { ({model})}}",
|
|
193
194
|
"Settings.permissions.auditLogs.media.create": "Create media",
|
|
194
195
|
"Settings.permissions.auditLogs.media.update": "Update media",
|
|
195
196
|
"Settings.permissions.auditLogs.media.delete": "Delete media",
|
|
@@ -210,6 +211,7 @@
|
|
|
210
211
|
"Settings.permissions.auditLogs.permission.create": "Create permission",
|
|
211
212
|
"Settings.permissions.auditLogs.permission.update": "Update permission",
|
|
212
213
|
"Settings.permissions.auditLogs.permission.delete": "Delete permission",
|
|
214
|
+
"Settings.permissions.auditLogs.filters.combobox.aria-label": "Search and select an option to filter",
|
|
213
215
|
"Settings.profile.form.notify.data.loaded": "Your profile data has been loaded",
|
|
214
216
|
"Settings.profile.form.section.experience.clear.select": "Clear the interface language selected",
|
|
215
217
|
"Settings.profile.form.section.experience.here": "here",
|