@strapi/admin 4.6.0-beta.2 → 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/ConfigurationsProvider/index.js +21 -18
- package/admin/src/components/ConfigurationsProvider/reducer.js +1 -0
- package/admin/src/components/LeftMenu/index.js +62 -53
- package/admin/src/components/UnauthenticatedLogo/index.js +1 -1
- 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/Hint/index.js +4 -17
- package/admin/src/content-manager/components/InputUID/index.js +7 -18
- package/admin/src/content-manager/components/Inputs/index.js +0 -2
- package/admin/src/content-manager/components/PreviewWysiwyg/Wrapper.js +22 -27
- package/admin/src/content-manager/components/SingleTypeFormWrapper/index.js +35 -14
- package/admin/src/content-manager/components/Wysiwyg/EditorLayout.js +19 -28
- package/admin/src/content-manager/components/Wysiwyg/index.js +4 -8
- 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/LeftMenu/index.js +3 -8
- package/admin/src/content-manager/pages/App/LeftMenu/utils/index.js +1 -0
- package/admin/src/content-manager/pages/App/LeftMenu/utils/matchByTitle.js +24 -0
- 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/EditView/{Informations → Information}/index.js +55 -39
- package/admin/src/content-manager/pages/EditView/{Informations → Information}/utils/getUnits.js +0 -0
- package/admin/src/content-manager/pages/EditView/index.js +3 -3
- 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/store/configureStore.js +22 -4
- 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/hooks/useSettingsMenu/init.js +2 -25
- package/admin/src/hooks/useSettingsMenu/utils/adminLinks.js +4 -0
- package/admin/src/hooks/useSettingsMenu/utils/customAdminLinks.js +1 -0
- package/admin/src/hooks/useSettingsMenu/utils/defaultAdminLinks.js +21 -0
- package/admin/src/index.js +5 -4
- package/admin/src/pages/App/index.js +6 -2
- 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/components/CustomizationInfos/index.js +142 -0
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/{Form → CustomizationInfos}/init.js +3 -0
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/{Form → CustomizationInfos}/reducer.js +20 -0
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoInput/index.js +21 -17
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/index.js +68 -42
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/api.js +9 -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/components/EventInput/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/index.js +3 -2
- package/admin/src/pages/SettingsPage/utils/defaultRoutes.js +0 -11
- package/admin/src/permissions/defaultPermissions.js +4 -0
- package/admin/src/translations/en.json +29 -21
- 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/{3557.e7115160.chunk.js → 4855.bd092921.chunk.js} +131 -91
- package/build/{5015.f5e15fdb.chunk.js → 5015.8e3fe50b.chunk.js} +1 -1
- 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.b1730882.chunk.js +77 -0
- package/build/Admin_marketplace.ea0316c2.chunk.js +26 -0
- 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/{Upload_ConfigureTheView.9bdf41b5.chunk.js → Upload_ConfigureTheView.3f2b6e6a.chunk.js} +1 -1
- 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.79e84b36.chunk.js +193 -0
- package/build/{content-type-builder-translation-de-json.29df67b8.chunk.js → content-type-builder-translation-de-json.0979cccb.chunk.js} +1 -1
- package/build/{content-type-builder-translation-dk-json.e22d2527.chunk.js → content-type-builder-translation-dk-json.e05583e9.chunk.js} +1 -1
- package/build/content-type-builder-translation-en-json.e577d595.chunk.js +1 -0
- package/build/{content-type-builder-translation-es-json.1044b252.chunk.js → content-type-builder-translation-es-json.fe4daad8.chunk.js} +1 -1
- package/build/{content-type-builder-translation-fr-json.2183e6b3.chunk.js → content-type-builder-translation-fr-json.b1eb52f6.chunk.js} +1 -1
- package/build/{content-type-builder-translation-id-json.ba3e8891.chunk.js → content-type-builder-translation-id-json.ee3b36bb.chunk.js} +1 -1
- package/build/{content-type-builder-translation-it-json.d4661201.chunk.js → content-type-builder-translation-it-json.13b3c26a.chunk.js} +1 -1
- package/build/{content-type-builder-translation-ko-json.57ff7f51.chunk.js → content-type-builder-translation-ko-json.8a274be5.chunk.js} +1 -1
- package/build/{content-type-builder-translation-pl-json.a057b51e.chunk.js → content-type-builder-translation-pl-json.24a34349.chunk.js} +1 -1
- package/build/{content-type-builder-translation-pt-BR-json.446df9da.chunk.js → content-type-builder-translation-pt-BR-json.97f71a9d.chunk.js} +1 -1
- package/build/{content-type-builder-translation-ru-json.8c51843e.chunk.js → content-type-builder-translation-ru-json.54d11230.chunk.js} +1 -1
- package/build/{content-type-builder-translation-sv-json.af6ecca1.chunk.js → content-type-builder-translation-sv-json.59f5e1e5.chunk.js} +1 -1
- package/build/{content-type-builder-translation-tr-json.da83a07e.chunk.js → content-type-builder-translation-tr-json.cea4d226.chunk.js} +1 -1
- package/build/{content-type-builder-translation-zh-json.42f94cb3.chunk.js → content-type-builder-translation-zh-json.faedd610.chunk.js} +1 -1
- package/build/content-type-builder.855db321.chunk.js +126 -0
- package/build/email-settings-page.d1fcc7a3.chunk.js +10 -0
- 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/{i18n-translation-de-json.dc876c08.chunk.js → i18n-translation-de-json.362384a6.chunk.js} +1 -1
- package/build/{i18n-translation-dk-json.49aaf933.chunk.js → i18n-translation-dk-json.89401417.chunk.js} +1 -1
- package/build/{i18n-translation-en-json.ac9ebc1b.chunk.js → i18n-translation-en-json.60af6722.chunk.js} +1 -1
- package/build/{i18n-translation-es-json.57072ed3.chunk.js → i18n-translation-es-json.87b494d1.chunk.js} +1 -1
- package/build/{i18n-translation-fr-json.84733f34.chunk.js → i18n-translation-fr-json.57ddc77e.chunk.js} +1 -1
- package/build/{i18n-translation-ko-json.fc73fe20.chunk.js → i18n-translation-ko-json.ef4f9471.chunk.js} +1 -1
- package/build/{i18n-translation-pl-json.16e5df90.chunk.js → i18n-translation-pl-json.dfac513d.chunk.js} +1 -1
- package/build/{i18n-translation-tr-json.cb39c048.chunk.js → i18n-translation-tr-json.10f0600d.chunk.js} +1 -1
- package/build/{i18n-translation-zh-Hans-json.2cf82d2d.chunk.js → i18n-translation-zh-Hans-json.757ce62d.chunk.js} +1 -1
- package/build/{i18n-translation-zh-json.ed1d272e.chunk.js → i18n-translation-zh-json.bef2dc07.chunk.js} +1 -1
- 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.1134f130.chunk.js +42 -0
- package/ee/admin/hooks/useSettingsMenu/utils/customAdminLinks.js +17 -0
- package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/ComboboxFilter/index.js +41 -0
- package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/Modal/ActionBody.js +1 -3
- package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/Modal/ActionItem.js +0 -0
- package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/Modal/index.js +5 -1
- package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/PaginationFooter/index.js +0 -0
- package/{admin/src → 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/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/hooks/useFormatTimeStamp.js +0 -0
- package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/index.js +35 -36
- package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/utils/getActionTypesDefaultMessages.js +10 -9
- package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/utils/getDisplayedFilters.js +88 -0
- package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/utils/tableHeaders.js +0 -0
- package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ProtectedListPage/index.js +1 -1
- package/ee/admin/pages/SettingsPage/pages/Roles/ListPage/index.js +4 -2
- package/ee/admin/pages/SettingsPage/{SingleSignOn → pages/SingleSignOn}/index.js +3 -3
- package/ee/admin/pages/SettingsPage/{SingleSignOn → pages/SingleSignOn}/utils/schema.js +0 -0
- package/ee/admin/pages/SettingsPage/utils/customRoutes.js +28 -16
- package/ee/server/bootstrap.js +2 -0
- package/ee/server/migrations/audit-logs-table.js +45 -0
- package/ee/server/register.js +2 -0
- package/ee/server/routes/index.js +94 -10
- package/ee/server/services/audit-logs.js +30 -2
- package/ee/server/services/passport/sso.js +13 -1
- package/ee/server/services/passport.js +1 -4
- package/package.json +27 -32
- package/server/controllers/admin.js +19 -2
- package/server/register.js +7 -7
- package/server/services/project-settings.js +10 -6
- package/server/services/user.js +3 -1
- package/server/validation/project-settings.js +19 -10
- package/strapi-server.js +1 -1
- 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/store/createReducer.js +0 -5
- package/admin/src/core/utils/axiosInstance.js +0 -38
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/Form/index.js +0 -85
- package/build/2235.746d3cf7.chunk.js +0 -106
- package/build/2598.01c96bd5.chunk.js +0 -159
- package/build/2743.692b1f21.chunk.js +0 -42
- package/build/4318.87affaf2.chunk.js +0 -30
- package/build/4958.1979bbf5.chunk.js +0 -276
- package/build/5052.c2eacff2.chunk.js +0 -65
- package/build/7295.4e2dfbbb.chunk.js +0 -114
- package/build/805.da20168c.chunk.js +0 -138
- package/build/8633.6f546066.chunk.js +0 -1
- package/build/874.be41e4b3.chunk.js +0 -104
- package/build/9707.a07db355.chunk.js +0 -101
- package/build/Admin-authenticatedApp.9933974c.chunk.js +0 -75
- package/build/Admin_homePage.045bb0c8.chunk.js +0 -77
- package/build/Admin_marketplace.bf3ac090.chunk.js +0 -26
- package/build/Admin_pluginsPage.d2a9a619.chunk.js +0 -6
- package/build/Admin_profilePage.5e830ceb.chunk.js +0 -15
- package/build/Admin_settingsPage.53fa00a4.chunk.js +0 -178
- package/build/admin-app.8ed108ca.chunk.js +0 -112
- package/build/admin-audit-logs.68f833bf.chunk.js +0 -1
- package/build/admin-edit-roles-page.32bfe5ea.chunk.js +0 -1
- package/build/admin-edit-users.795f155c.chunk.js +0 -10
- package/build/admin-users.cbd9bcf7.chunk.js +0 -11
- package/build/api-tokens-list-page.a55e427c.chunk.js +0 -16
- 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.ad929a94.chunk.js +0 -1174
- package/build/content-type-builder-list-view.3048854d.chunk.js +0 -198
- package/build/content-type-builder-translation-en-json.08e28f4e.chunk.js +0 -1
- package/build/content-type-builder.4edd1c22.chunk.js +0 -127
- package/build/email-settings-page.7c9e6c5e.chunk.js +0 -15
- package/build/en-json.d65a13ef.chunk.js +0 -1
- package/build/i18n-settings-page.fbccdf12.chunk.js +0 -1
- package/build/main.6bbf9950.js +0 -4417
- package/build/ru-json.3b411a39.chunk.js +0 -1
- package/build/runtime~main.c2bf62af.js +0 -2
- package/build/sso-settings-page.4031de9e.chunk.js +0 -41
- package/build/upload-settings.657790fd.chunk.js +0 -89
- package/build/upload.608a9856.chunk.js +0 -38
- package/build/users-advanced-settings-page.e3ab865f.chunk.js +0 -13
- package/build/users-email-settings-page.57adf9b7.chunk.js +0 -28
- package/build/users-providers-settings-page.7d1fb45c.chunk.js +0 -1
- package/build/users-roles-settings-page.ad28ab42.chunk.js +0 -30
- package/build/webhook-edit-page.1dd6d040.chunk.js +0 -75
- package/build/webhook-list-page.98afa3ea.chunk.js +0 -42
- package/ee/server/routes/features-routes.js +0 -66
|
@@ -1,25 +1,40 @@
|
|
|
1
1
|
import React, { useRef } from 'react';
|
|
2
|
+
import propTypes from 'prop-types';
|
|
2
3
|
import { useIntl } from 'react-intl';
|
|
3
4
|
import { useCMEditViewDataManager } from '@strapi/helper-plugin';
|
|
4
|
-
import { Box } from '@strapi/design-system
|
|
5
|
-
|
|
6
|
-
import { Typography } from '@strapi/design-system/Typography';
|
|
7
|
-
import { Flex } from '@strapi/design-system/Flex';
|
|
8
|
-
import { Stack } from '@strapi/design-system/Stack';
|
|
5
|
+
import { Box, Divider, Flex, Stack, Typography } from '@strapi/design-system';
|
|
6
|
+
|
|
9
7
|
import { getTrad } from '../../../utils';
|
|
10
8
|
import getUnits from './utils/getUnits';
|
|
11
9
|
import { getFullName } from '../../../../utils';
|
|
12
10
|
|
|
13
|
-
const
|
|
11
|
+
const KeyValuePair = ({ label, value }) => {
|
|
12
|
+
return (
|
|
13
|
+
<Flex justifyContent="space-between">
|
|
14
|
+
<Typography as="dt" fontWeight="bold" textColor="neutral600">
|
|
15
|
+
{label}
|
|
16
|
+
</Typography>
|
|
17
|
+
<Typography as="dd">{value}</Typography>
|
|
18
|
+
</Flex>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
KeyValuePair.propTypes = {
|
|
23
|
+
label: propTypes.string.isRequired,
|
|
24
|
+
value: propTypes.string.isRequired,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const Information = () => {
|
|
14
28
|
const { formatMessage, formatRelativeTime } = useIntl();
|
|
15
29
|
const { initialData, isCreatingEntry } = useCMEditViewDataManager();
|
|
16
30
|
const currentTime = useRef(Date.now());
|
|
17
31
|
|
|
18
32
|
const getFieldInfo = (atField, byField) => {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
const
|
|
33
|
+
const { firstname, lastname, username } = initialData[byField] ?? {};
|
|
34
|
+
|
|
35
|
+
const userFirstname = firstname ?? '';
|
|
36
|
+
const userLastname = lastname ?? '';
|
|
37
|
+
const user = username ?? getFullName(userFirstname, userLastname);
|
|
23
38
|
const timestamp = initialData[atField] ? new Date(initialData[atField]).getTime() : Date.now();
|
|
24
39
|
const elapsed = timestamp - currentTime.current;
|
|
25
40
|
const { unit, value } = getUnits(-elapsed);
|
|
@@ -34,56 +49,57 @@ const Informations = () => {
|
|
|
34
49
|
const created = getFieldInfo('createdAt', 'createdBy');
|
|
35
50
|
|
|
36
51
|
return (
|
|
37
|
-
<
|
|
38
|
-
<Typography variant="sigma" textColor="neutral600" id="additional-
|
|
52
|
+
<Stack spacing={2}>
|
|
53
|
+
<Typography variant="sigma" textColor="neutral600" id="additional-information">
|
|
39
54
|
{formatMessage({
|
|
40
55
|
id: getTrad('containers.Edit.information'),
|
|
41
56
|
defaultMessage: 'Information',
|
|
42
57
|
})}
|
|
43
58
|
</Typography>
|
|
44
|
-
|
|
59
|
+
|
|
60
|
+
<Box paddingBottom={4}>
|
|
45
61
|
<Divider />
|
|
46
62
|
</Box>
|
|
63
|
+
|
|
47
64
|
<Stack spacing={4}>
|
|
48
|
-
<
|
|
49
|
-
<
|
|
50
|
-
{formatMessage({
|
|
65
|
+
<Stack spacing={2} as="dl">
|
|
66
|
+
<KeyValuePair
|
|
67
|
+
label={formatMessage({
|
|
51
68
|
id: getTrad('containers.Edit.information.created'),
|
|
52
69
|
defaultMessage: 'Created',
|
|
53
70
|
})}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
{formatMessage({
|
|
71
|
+
value={created.at}
|
|
72
|
+
/>
|
|
73
|
+
|
|
74
|
+
<KeyValuePair
|
|
75
|
+
label={formatMessage({
|
|
60
76
|
id: getTrad('containers.Edit.information.by'),
|
|
61
77
|
defaultMessage: 'By',
|
|
62
78
|
})}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
</
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
79
|
+
value={created.by}
|
|
80
|
+
/>
|
|
81
|
+
</Stack>
|
|
82
|
+
|
|
83
|
+
<Stack spacing={2} as="dl">
|
|
84
|
+
<KeyValuePair
|
|
85
|
+
label={formatMessage({
|
|
69
86
|
id: getTrad('containers.Edit.information.lastUpdate'),
|
|
70
87
|
defaultMessage: 'Last update',
|
|
71
88
|
})}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
{formatMessage({
|
|
89
|
+
value={updated.at}
|
|
90
|
+
/>
|
|
91
|
+
|
|
92
|
+
<KeyValuePair
|
|
93
|
+
label={formatMessage({
|
|
78
94
|
id: getTrad('containers.Edit.information.by'),
|
|
79
95
|
defaultMessage: 'By',
|
|
80
96
|
})}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
</
|
|
97
|
+
value={updated.by}
|
|
98
|
+
/>
|
|
99
|
+
</Stack>
|
|
84
100
|
</Stack>
|
|
85
|
-
</
|
|
101
|
+
</Stack>
|
|
86
102
|
);
|
|
87
103
|
};
|
|
88
104
|
|
|
89
|
-
export default
|
|
105
|
+
export default Information;
|
package/admin/src/content-manager/pages/EditView/{Informations → Information}/utils/getUnits.js
RENAMED
|
File without changes
|
|
@@ -25,7 +25,7 @@ import SingleTypeFormWrapper from '../../components/SingleTypeFormWrapper';
|
|
|
25
25
|
import { getTrad } from '../../utils';
|
|
26
26
|
import useLazyComponents from '../../hooks/useLazyComponents';
|
|
27
27
|
import DraftAndPublishBadge from './DraftAndPublishBadge';
|
|
28
|
-
import
|
|
28
|
+
import Information from './Information';
|
|
29
29
|
import Header from './Header';
|
|
30
30
|
import { getFieldsActionMatchingPermissions } from './utils';
|
|
31
31
|
import DeleteLink from './DeleteLink';
|
|
@@ -175,7 +175,7 @@ const EditView = ({ allowedActions, isSingleType, goBack, slug, id, origin, user
|
|
|
175
175
|
<DraftAndPublishBadge />
|
|
176
176
|
<Box
|
|
177
177
|
as="aside"
|
|
178
|
-
aria-labelledby="additional-
|
|
178
|
+
aria-labelledby="additional-information"
|
|
179
179
|
background="neutral0"
|
|
180
180
|
borderColor="neutral150"
|
|
181
181
|
hasRadius
|
|
@@ -185,7 +185,7 @@ const EditView = ({ allowedActions, isSingleType, goBack, slug, id, origin, user
|
|
|
185
185
|
paddingTop={6}
|
|
186
186
|
shadow="tableShadow"
|
|
187
187
|
>
|
|
188
|
-
<
|
|
188
|
+
<Information />
|
|
189
189
|
<InjectionZone area="contentManager.editView.informations" />
|
|
190
190
|
</Box>
|
|
191
191
|
<Box as="aside" aria-labelledby="links">
|
|
@@ -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,5 +1,4 @@
|
|
|
1
|
-
import { createStore, applyMiddleware, compose } from 'redux';
|
|
2
|
-
import createReducer from './createReducer';
|
|
1
|
+
import { createStore, applyMiddleware, compose, combineReducers } from 'redux';
|
|
3
2
|
|
|
4
3
|
const configureStore = (appMiddlewares, appReducers) => {
|
|
5
4
|
let composeEnhancers = compose;
|
|
@@ -19,11 +18,30 @@ const configureStore = (appMiddlewares, appReducers) => {
|
|
|
19
18
|
composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({});
|
|
20
19
|
}
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
createReducer(appReducers),
|
|
21
|
+
const store = createStore(
|
|
22
|
+
createReducer(appReducers, {}),
|
|
24
23
|
{},
|
|
25
24
|
composeEnhancers(applyMiddleware(...middlewares))
|
|
26
25
|
);
|
|
26
|
+
|
|
27
|
+
// Add a dictionary to keep track of the registered async reducers
|
|
28
|
+
store.asyncReducers = {};
|
|
29
|
+
|
|
30
|
+
// Create an inject reducer function
|
|
31
|
+
// This function adds the async reducer, and creates a new combined reducer
|
|
32
|
+
store.injectReducer = (key, asyncReducer) => {
|
|
33
|
+
store.asyncReducers[key] = asyncReducer;
|
|
34
|
+
store.replaceReducer(createReducer(appReducers, store.asyncReducers));
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
return store;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const createReducer = (appReducers, asyncReducers) => {
|
|
41
|
+
return combineReducers({
|
|
42
|
+
...appReducers,
|
|
43
|
+
...asyncReducers,
|
|
44
|
+
});
|
|
27
45
|
};
|
|
28
46
|
|
|
29
47
|
export default configureStore;
|
|
@@ -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',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import omit from 'lodash/omit';
|
|
2
2
|
import sortLinks from './utils/sortLinks';
|
|
3
|
-
import adminPermissions from '../../permissions';
|
|
4
3
|
import formatLinks from './utils/formatLinks';
|
|
4
|
+
import adminLinks from './utils/adminLinks';
|
|
5
5
|
import globalLinks from './utils/globalLinks';
|
|
6
6
|
|
|
7
7
|
const init = (initialState, { settings, shouldUpdateStrapi }) => {
|
|
@@ -23,30 +23,7 @@ const init = (initialState, { settings, shouldUpdateStrapi }) => {
|
|
|
23
23
|
{
|
|
24
24
|
id: 'permissions',
|
|
25
25
|
intlLabel: { id: 'Settings.permissions', defaultMessage: 'Administration Panel' },
|
|
26
|
-
links:
|
|
27
|
-
{
|
|
28
|
-
intlLabel: { id: 'global.auditLogs', defaultMessage: 'Audit Logs' },
|
|
29
|
-
to: '/settings/audit-logs?pageSize=50&page=1&sort=date:DESC',
|
|
30
|
-
id: 'auditLogs',
|
|
31
|
-
isDisplayed: false,
|
|
32
|
-
permissions: adminPermissions.settings.auditLogs.main,
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
intlLabel: { id: 'global.roles', defaultMessage: 'Roles' },
|
|
36
|
-
to: '/settings/roles',
|
|
37
|
-
id: 'roles',
|
|
38
|
-
isDisplayed: false,
|
|
39
|
-
permissions: adminPermissions.settings.roles.main,
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
intlLabel: { id: 'global.users' },
|
|
43
|
-
// Init the search params directly
|
|
44
|
-
to: '/settings/users?pageSize=10&page=1&sort=firstname',
|
|
45
|
-
id: 'users',
|
|
46
|
-
isDisplayed: false,
|
|
47
|
-
permissions: adminPermissions.settings.users.main,
|
|
48
|
-
},
|
|
49
|
-
],
|
|
26
|
+
links: adminLinks,
|
|
50
27
|
},
|
|
51
28
|
...otherSections,
|
|
52
29
|
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default [];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import adminPermissions from '../../../permissions';
|
|
2
|
+
|
|
3
|
+
const defaultAdminLinks = [
|
|
4
|
+
{
|
|
5
|
+
intlLabel: { id: 'global.roles', defaultMessage: 'Roles' },
|
|
6
|
+
to: '/settings/roles',
|
|
7
|
+
id: 'roles',
|
|
8
|
+
isDisplayed: false,
|
|
9
|
+
permissions: adminPermissions.settings.roles.main,
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
intlLabel: { id: 'global.users' },
|
|
13
|
+
// Init the search params directly
|
|
14
|
+
to: '/settings/users?pageSize=10&page=1&sort=firstname',
|
|
15
|
+
id: 'users',
|
|
16
|
+
isDisplayed: false,
|
|
17
|
+
permissions: adminPermissions.settings.users.main,
|
|
18
|
+
},
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
export default defaultAdminLinks;
|
package/admin/src/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ReactDOM from 'react-dom';
|
|
2
|
+
import { getFetchClient } from '@strapi/helper-plugin';
|
|
2
3
|
import { Components, Fields, Middlewares, Reducers } from './core/apis';
|
|
3
|
-
import { axiosInstance } from './core/utils';
|
|
4
4
|
import appCustomisations from './app';
|
|
5
5
|
// eslint-disable-next-line import/extensions
|
|
6
6
|
import plugins from './plugins';
|
|
@@ -12,6 +12,7 @@ window.strapi = {
|
|
|
12
12
|
telemetryDisabled: process.env.STRAPI_TELEMETRY_DISABLED ?? false,
|
|
13
13
|
features: {
|
|
14
14
|
SSO: 'sso',
|
|
15
|
+
AUDIT_LOGS: 'audit-logs',
|
|
15
16
|
},
|
|
16
17
|
projectType: 'Community',
|
|
17
18
|
};
|
|
@@ -28,18 +29,18 @@ const reducers = Reducers({ appReducers });
|
|
|
28
29
|
const MOUNT_NODE = document.getElementById('app');
|
|
29
30
|
|
|
30
31
|
const run = async () => {
|
|
32
|
+
const { get } = getFetchClient();
|
|
31
33
|
try {
|
|
32
34
|
const {
|
|
33
35
|
data: {
|
|
34
36
|
data: { isEE, features },
|
|
35
37
|
},
|
|
36
|
-
} = await
|
|
38
|
+
} = await get('/admin/project-type');
|
|
37
39
|
|
|
38
40
|
window.strapi.isEE = isEE;
|
|
39
41
|
window.strapi.features = {
|
|
40
42
|
...window.strapi.features,
|
|
41
|
-
|
|
42
|
-
isEnabled: (f) => features.includes(f),
|
|
43
|
+
isEnabled: (featureName) => features.some((feature) => feature.name === featureName),
|
|
43
44
|
};
|
|
44
45
|
|
|
45
46
|
window.strapi.projectType = isEE ? 'Enterprise' : 'Community';
|
|
@@ -80,11 +80,15 @@ function App() {
|
|
|
80
80
|
try {
|
|
81
81
|
const {
|
|
82
82
|
data: {
|
|
83
|
-
data: { hasAdmin, uuid, menuLogo },
|
|
83
|
+
data: { hasAdmin, uuid, menuLogo, authLogo },
|
|
84
84
|
},
|
|
85
85
|
} = await axios.get(`${strapi.backendURL}/admin/init`);
|
|
86
86
|
|
|
87
|
-
updateProjectSettings({
|
|
87
|
+
updateProjectSettings({
|
|
88
|
+
menuLogo: prefixFileUrlWithBackendUrl(menuLogo),
|
|
89
|
+
authLogo: prefixFileUrlWithBackendUrl(authLogo),
|
|
90
|
+
});
|
|
91
|
+
|
|
88
92
|
const deviceId = await getUID();
|
|
89
93
|
|
|
90
94
|
if (uuid) {
|
|
@@ -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() {
|