@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
package/.browserslistrc
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
|
+
import { getFetchClient } from '@strapi/helper-plugin';
|
|
2
3
|
import checkLatestStrapiVersion from './checkLatestStrapiVersion';
|
|
3
|
-
import { axiosInstance } from '../../../core/utils';
|
|
4
4
|
import packageJSON from '../../../../../package.json';
|
|
5
5
|
|
|
6
6
|
const strapiVersion = packageJSON.version;
|
|
7
7
|
const showUpdateNotif = !JSON.parse(localStorage.getItem('STRAPI_UPDATE_NOTIF'));
|
|
8
|
+
const { get } = getFetchClient();
|
|
8
9
|
|
|
9
10
|
const fetchStrapiLatestRelease = async (toggleNotification) => {
|
|
10
11
|
try {
|
|
@@ -38,7 +39,7 @@ const fetchStrapiLatestRelease = async (toggleNotification) => {
|
|
|
38
39
|
|
|
39
40
|
const fetchAppInfo = async () => {
|
|
40
41
|
try {
|
|
41
|
-
const { data, headers } = await
|
|
42
|
+
const { data, headers } = await get('/admin/information');
|
|
42
43
|
|
|
43
44
|
if (!headers['content-type'].includes('application/json')) {
|
|
44
45
|
throw new Error('Not found');
|
|
@@ -52,7 +53,7 @@ const fetchAppInfo = async () => {
|
|
|
52
53
|
|
|
53
54
|
const fetchCurrentUserPermissions = async () => {
|
|
54
55
|
try {
|
|
55
|
-
const { data, headers } = await
|
|
56
|
+
const { data, headers } = await get('/admin/users/me/permissions');
|
|
56
57
|
|
|
57
58
|
if (!headers['content-type'].includes('application/json')) {
|
|
58
59
|
throw new Error('Not found');
|
|
@@ -70,7 +71,7 @@ const fetchUserRoles = async () => {
|
|
|
70
71
|
data: {
|
|
71
72
|
data: { roles },
|
|
72
73
|
},
|
|
73
|
-
} = await
|
|
74
|
+
} = await get('/admin/users/me');
|
|
74
75
|
|
|
75
76
|
return roles;
|
|
76
77
|
} catch (err) {
|
|
@@ -1,45 +1,48 @@
|
|
|
1
|
-
import React, { useMemo, useReducer
|
|
1
|
+
import React, { useCallback, useMemo, useReducer } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { ConfigurationsContext } from '../../contexts';
|
|
4
4
|
import reducer, { initialState } from './reducer';
|
|
5
5
|
|
|
6
6
|
const ConfigurationsProvider = ({
|
|
7
7
|
children,
|
|
8
|
-
authLogo,
|
|
8
|
+
authLogo: defaultAuthLogo,
|
|
9
9
|
menuLogo: defaultMenuLogo,
|
|
10
10
|
showReleaseNotification,
|
|
11
11
|
showTutorials,
|
|
12
12
|
}) => {
|
|
13
|
-
const [{ menuLogo }, dispatch] = useReducer(reducer, initialState);
|
|
13
|
+
const [{ menuLogo, authLogo }, dispatch] = useReducer(reducer, initialState);
|
|
14
14
|
|
|
15
|
-
const updateProjectSettings = (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
15
|
+
const updateProjectSettings = useCallback(
|
|
16
|
+
({ menuLogo, authLogo }) => {
|
|
17
|
+
return dispatch({
|
|
18
|
+
type: 'UPDATE_PROJECT_SETTINGS',
|
|
19
|
+
values: {
|
|
20
|
+
menuLogo: menuLogo || defaultMenuLogo,
|
|
21
|
+
authLogo: authLogo || defaultAuthLogo,
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
[defaultAuthLogo, defaultMenuLogo]
|
|
26
|
+
);
|
|
25
27
|
|
|
26
28
|
const configurationValue = useMemo(() => {
|
|
27
29
|
return {
|
|
28
30
|
logos: {
|
|
29
31
|
menu: { custom: menuLogo, default: defaultMenuLogo },
|
|
30
|
-
auth: { custom:
|
|
32
|
+
auth: { custom: authLogo, default: defaultAuthLogo },
|
|
31
33
|
},
|
|
32
|
-
updateProjectSettings
|
|
34
|
+
updateProjectSettings,
|
|
33
35
|
showReleaseNotification,
|
|
34
36
|
showTutorials,
|
|
35
37
|
};
|
|
36
38
|
}, [
|
|
37
|
-
authLogo,
|
|
38
39
|
menuLogo,
|
|
40
|
+
defaultMenuLogo,
|
|
41
|
+
authLogo,
|
|
42
|
+
defaultAuthLogo,
|
|
43
|
+
updateProjectSettings,
|
|
39
44
|
showReleaseNotification,
|
|
40
45
|
showTutorials,
|
|
41
|
-
updateProjectSettingsRef,
|
|
42
|
-
defaultMenuLogo,
|
|
43
46
|
]);
|
|
44
47
|
|
|
45
48
|
return (
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
NavSection,
|
|
13
13
|
NavUser,
|
|
14
14
|
NavCondense,
|
|
15
|
+
NavFooter,
|
|
15
16
|
} from '@strapi/design-system/v2/MainNav';
|
|
16
17
|
import { FocusTrap } from '@strapi/design-system/FocusTrap';
|
|
17
18
|
import { Box } from '@strapi/design-system/Box';
|
|
@@ -19,9 +20,14 @@ import { Typography } from '@strapi/design-system/Typography';
|
|
|
19
20
|
import { Stack } from '@strapi/design-system/Stack';
|
|
20
21
|
import Write from '@strapi/icons/Write';
|
|
21
22
|
import Exit from '@strapi/icons/Exit';
|
|
22
|
-
import {
|
|
23
|
+
import {
|
|
24
|
+
auth,
|
|
25
|
+
usePersistentState,
|
|
26
|
+
useAppInfos,
|
|
27
|
+
useTracking,
|
|
28
|
+
getFetchClient,
|
|
29
|
+
} from '@strapi/helper-plugin';
|
|
23
30
|
import { useConfigurations } from '../../hooks';
|
|
24
|
-
import { axiosInstance } from '../../core/utils';
|
|
25
31
|
|
|
26
32
|
const LinkUserWrapper = styled(Box)`
|
|
27
33
|
width: ${150 / 16}rem;
|
|
@@ -63,6 +69,7 @@ const LeftMenu = ({ generalSectionLinks, pluginsSectionLinks }) => {
|
|
|
63
69
|
const { trackUsage } = useTracking();
|
|
64
70
|
const { pathname } = useLocation();
|
|
65
71
|
const history = useHistory();
|
|
72
|
+
const { post } = getFetchClient();
|
|
66
73
|
|
|
67
74
|
const initials = userDisplayName
|
|
68
75
|
.split(' ')
|
|
@@ -73,7 +80,7 @@ const LeftMenu = ({ generalSectionLinks, pluginsSectionLinks }) => {
|
|
|
73
80
|
const handleToggleUserLinks = () => setUserLinksVisible((prev) => !prev);
|
|
74
81
|
|
|
75
82
|
const handleLogout = async () => {
|
|
76
|
-
await
|
|
83
|
+
await post('/admin/logout');
|
|
77
84
|
auth.clearAppStorage();
|
|
78
85
|
handleToggleUserLinks();
|
|
79
86
|
history.push('/auth/login');
|
|
@@ -183,57 +190,59 @@ const LeftMenu = ({ generalSectionLinks, pluginsSectionLinks }) => {
|
|
|
183
190
|
) : null}
|
|
184
191
|
</NavSections>
|
|
185
192
|
|
|
186
|
-
<
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
{userDisplayName}
|
|
193
|
-
</NavUser>
|
|
194
|
-
{userLinksVisible && (
|
|
195
|
-
<LinkUserWrapper
|
|
196
|
-
onBlur={handleBlur}
|
|
197
|
-
padding={1}
|
|
198
|
-
shadow="tableShadow"
|
|
199
|
-
background="neutral0"
|
|
200
|
-
hasRadius
|
|
193
|
+
<NavFooter>
|
|
194
|
+
<NavUser
|
|
195
|
+
id="main-nav-user-button"
|
|
196
|
+
ref={buttonRef}
|
|
197
|
+
onClick={handleToggleUserLinks}
|
|
198
|
+
initials={initials}
|
|
201
199
|
>
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
200
|
+
{userDisplayName}
|
|
201
|
+
</NavUser>
|
|
202
|
+
{userLinksVisible && (
|
|
203
|
+
<LinkUserWrapper
|
|
204
|
+
onBlur={handleBlur}
|
|
205
|
+
padding={1}
|
|
206
|
+
shadow="tableShadow"
|
|
207
|
+
background="neutral0"
|
|
208
|
+
hasRadius
|
|
209
|
+
>
|
|
210
|
+
<FocusTrap onEscape={handleToggleUserLinks}>
|
|
211
|
+
<Stack spacing={0}>
|
|
212
|
+
<LinkUser tabIndex={0} onClick={handleToggleUserLinks} to="/me">
|
|
213
|
+
<Typography>
|
|
214
|
+
{formatMessage({
|
|
215
|
+
id: 'global.profile',
|
|
216
|
+
defaultMessage: 'Profile',
|
|
217
|
+
})}
|
|
218
|
+
</Typography>
|
|
219
|
+
</LinkUser>
|
|
220
|
+
<LinkUser tabIndex={0} onClick={handleLogout} logout="logout" to="/auth/login">
|
|
221
|
+
<Typography textColor="danger600">
|
|
222
|
+
{formatMessage({
|
|
223
|
+
id: 'app.components.LeftMenu.logout',
|
|
224
|
+
defaultMessage: 'Logout',
|
|
225
|
+
})}
|
|
226
|
+
</Typography>
|
|
227
|
+
<Exit />
|
|
228
|
+
</LinkUser>
|
|
229
|
+
</Stack>
|
|
230
|
+
</FocusTrap>
|
|
231
|
+
</LinkUserWrapper>
|
|
232
|
+
)}
|
|
233
|
+
|
|
234
|
+
<NavCondense onClick={() => setCondensed((s) => !s)}>
|
|
235
|
+
{condensed
|
|
236
|
+
? formatMessage({
|
|
237
|
+
id: 'app.components.LeftMenu.expand',
|
|
238
|
+
defaultMessage: 'Expand the navbar',
|
|
239
|
+
})
|
|
240
|
+
: formatMessage({
|
|
241
|
+
id: 'app.components.LeftMenu.collapse',
|
|
242
|
+
defaultMessage: 'Collapse the navbar',
|
|
243
|
+
})}
|
|
244
|
+
</NavCondense>
|
|
245
|
+
</NavFooter>
|
|
237
246
|
</MainNav>
|
|
238
247
|
);
|
|
239
248
|
};
|
|
@@ -10,11 +10,11 @@ import {
|
|
|
10
10
|
formatContentTypeData,
|
|
11
11
|
contentManagementUtilRemoveFieldsFromData,
|
|
12
12
|
useGuidedTour,
|
|
13
|
+
useFetchClient,
|
|
13
14
|
} from '@strapi/helper-plugin';
|
|
14
15
|
import { useSelector, useDispatch } from 'react-redux';
|
|
15
16
|
import PropTypes from 'prop-types';
|
|
16
17
|
import isEqual from 'react-fast-compare';
|
|
17
|
-
import { axiosInstance } from '../../../core/utils';
|
|
18
18
|
import {
|
|
19
19
|
createDefaultForm,
|
|
20
20
|
getTrad,
|
|
@@ -51,6 +51,9 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
|
|
|
51
51
|
|
|
52
52
|
const allLayoutDataRef = useRef(allLayoutData);
|
|
53
53
|
|
|
54
|
+
const fetchClient = useFetchClient();
|
|
55
|
+
const { put, post, del } = fetchClient;
|
|
56
|
+
|
|
54
57
|
const isCreatingEntry = id === null;
|
|
55
58
|
|
|
56
59
|
const requestURL = useMemo(() => {
|
|
@@ -137,7 +140,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
|
|
|
137
140
|
dispatch(getData());
|
|
138
141
|
|
|
139
142
|
try {
|
|
140
|
-
const { data } = await
|
|
143
|
+
const { data } = await fetchClient.get(requestURL, { cancelToken: source.token });
|
|
141
144
|
|
|
142
145
|
dispatch(getDataSucceeded(cleanReceivedData(cleanClonedData(data))));
|
|
143
146
|
} catch (err) {
|
|
@@ -187,6 +190,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
|
|
|
187
190
|
source.cancel('Operation canceled by the user.');
|
|
188
191
|
};
|
|
189
192
|
}, [
|
|
193
|
+
fetchClient,
|
|
190
194
|
cleanClonedData,
|
|
191
195
|
cleanReceivedData,
|
|
192
196
|
push,
|
|
@@ -216,12 +220,12 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
|
|
|
216
220
|
|
|
217
221
|
const onDelete = useCallback(
|
|
218
222
|
async (trackerProperty) => {
|
|
223
|
+
console.log('onDelete');
|
|
224
|
+
|
|
219
225
|
try {
|
|
220
226
|
trackUsageRef.current('willDeleteEntry', trackerProperty);
|
|
221
227
|
|
|
222
|
-
const { data } = await
|
|
223
|
-
getRequestUrl(`collection-types/${slug}/${id}`)
|
|
224
|
-
);
|
|
228
|
+
const { data } = await del(getRequestUrl(`collection-types/${slug}/${id}`));
|
|
225
229
|
|
|
226
230
|
toggleNotification({
|
|
227
231
|
type: 'success',
|
|
@@ -237,7 +241,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
|
|
|
237
241
|
return Promise.reject(err);
|
|
238
242
|
}
|
|
239
243
|
},
|
|
240
|
-
[id, slug, toggleNotification]
|
|
244
|
+
[id, slug, toggleNotification, del]
|
|
241
245
|
);
|
|
242
246
|
|
|
243
247
|
const onDeleteSucceeded = useCallback(() => {
|
|
@@ -247,12 +251,11 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
|
|
|
247
251
|
const onPost = useCallback(
|
|
248
252
|
async (body, trackerProperty) => {
|
|
249
253
|
const endPoint = `${getRequestUrl(`collection-types/${slug}`)}${rawQuery}`;
|
|
250
|
-
|
|
251
254
|
try {
|
|
252
255
|
// Show a loading button in the EditView/Header.js && lock the app => no navigation
|
|
253
256
|
dispatch(setStatus('submit-pending'));
|
|
254
257
|
|
|
255
|
-
const { data } = await
|
|
258
|
+
const { data } = await post(endPoint, body);
|
|
256
259
|
|
|
257
260
|
trackUsageRef.current('didCreateEntry', trackerProperty);
|
|
258
261
|
toggleNotification({
|
|
@@ -291,6 +294,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
|
|
|
291
294
|
toggleNotification,
|
|
292
295
|
setCurrentStep,
|
|
293
296
|
queryClient,
|
|
297
|
+
post,
|
|
294
298
|
]
|
|
295
299
|
);
|
|
296
300
|
|
|
@@ -303,7 +307,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
|
|
|
303
307
|
);
|
|
304
308
|
dispatch(setStatus('draft-relation-check-pending'));
|
|
305
309
|
|
|
306
|
-
const numberOfDraftRelations = await
|
|
310
|
+
const numberOfDraftRelations = await fetchClient.get(endPoint);
|
|
307
311
|
trackUsageRef.current('didCheckDraftRelations');
|
|
308
312
|
|
|
309
313
|
dispatch(setStatus('resolved'));
|
|
@@ -315,7 +319,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
|
|
|
315
319
|
|
|
316
320
|
return Promise.reject(err);
|
|
317
321
|
}
|
|
318
|
-
}, [displayErrors, id, slug, dispatch]);
|
|
322
|
+
}, [displayErrors, id, slug, dispatch, fetchClient]);
|
|
319
323
|
|
|
320
324
|
const onPublish = useCallback(async () => {
|
|
321
325
|
try {
|
|
@@ -324,7 +328,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
|
|
|
324
328
|
|
|
325
329
|
dispatch(setStatus('publish-pending'));
|
|
326
330
|
|
|
327
|
-
const { data } = await
|
|
331
|
+
const { data } = await post(endPoint);
|
|
328
332
|
|
|
329
333
|
trackUsageRef.current('didPublishEntry');
|
|
330
334
|
|
|
@@ -343,7 +347,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
|
|
|
343
347
|
|
|
344
348
|
return Promise.reject(err);
|
|
345
349
|
}
|
|
346
|
-
}, [cleanReceivedData, displayErrors, id, slug, dispatch, toggleNotification]);
|
|
350
|
+
}, [cleanReceivedData, displayErrors, id, slug, dispatch, toggleNotification, post]);
|
|
347
351
|
|
|
348
352
|
const onPut = useCallback(
|
|
349
353
|
async (body, trackerProperty) => {
|
|
@@ -354,7 +358,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
|
|
|
354
358
|
|
|
355
359
|
dispatch(setStatus('submit-pending'));
|
|
356
360
|
|
|
357
|
-
const { data } = await
|
|
361
|
+
const { data } = await put(endPoint, body);
|
|
358
362
|
|
|
359
363
|
trackUsageRef.current('didEditEntry', { trackerProperty });
|
|
360
364
|
toggleNotification({
|
|
@@ -379,7 +383,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
|
|
|
379
383
|
return Promise.reject(err);
|
|
380
384
|
}
|
|
381
385
|
},
|
|
382
|
-
[cleanReceivedData, displayErrors, slug, id, dispatch, toggleNotification, queryClient]
|
|
386
|
+
[cleanReceivedData, displayErrors, slug, id, dispatch, toggleNotification, queryClient, put]
|
|
383
387
|
);
|
|
384
388
|
|
|
385
389
|
const onUnpublish = useCallback(async () => {
|
|
@@ -390,7 +394,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
|
|
|
390
394
|
try {
|
|
391
395
|
trackUsageRef.current('willUnpublishEntry');
|
|
392
396
|
|
|
393
|
-
const { data } = await
|
|
397
|
+
const { data } = await post(endPoint);
|
|
394
398
|
|
|
395
399
|
trackUsageRef.current('didUnpublishEntry');
|
|
396
400
|
toggleNotification({
|
|
@@ -408,7 +412,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
|
|
|
408
412
|
|
|
409
413
|
return Promise.reject(err);
|
|
410
414
|
}
|
|
411
|
-
}, [cleanReceivedData, displayErrors, id, slug, dispatch, toggleNotification]);
|
|
415
|
+
}, [cleanReceivedData, displayErrors, id, slug, dispatch, toggleNotification, post]);
|
|
412
416
|
|
|
413
417
|
return children({
|
|
414
418
|
componentsDataStructure,
|
package/admin/src/content-manager/components/DynamicTable/CellContent/RelationMultiple/index.js
CHANGED
|
@@ -10,19 +10,18 @@ import { SimpleMenu, MenuItem } from '@strapi/design-system/SimpleMenu';
|
|
|
10
10
|
import { Loader } from '@strapi/design-system/Loader';
|
|
11
11
|
import styled from 'styled-components';
|
|
12
12
|
import { useNotifyAT } from '@strapi/design-system/LiveRegions';
|
|
13
|
-
import { stopPropagation } from '@strapi/helper-plugin';
|
|
13
|
+
import { stopPropagation, useFetchClient } from '@strapi/helper-plugin';
|
|
14
14
|
import CellValue from '../CellValue';
|
|
15
|
-
import { axiosInstance } from '../../../../../core/utils';
|
|
16
15
|
import { getRequestUrl, getTrad } from '../../../../utils';
|
|
17
16
|
|
|
18
17
|
const TypographyMaxWidth = styled(Typography)`
|
|
19
18
|
max-width: 500px;
|
|
20
19
|
`;
|
|
21
20
|
|
|
22
|
-
const fetchRelation = async (endPoint, notifyStatus) => {
|
|
21
|
+
const fetchRelation = async (endPoint, notifyStatus, get) => {
|
|
23
22
|
const {
|
|
24
23
|
data: { results, pagination },
|
|
25
|
-
} = await
|
|
24
|
+
} = await get(endPoint);
|
|
26
25
|
|
|
27
26
|
notifyStatus();
|
|
28
27
|
|
|
@@ -37,6 +36,7 @@ const RelationMultiple = ({ fieldSchema, metadatas, name, entityId, value, conte
|
|
|
37
36
|
[entityId, name, contentType]
|
|
38
37
|
);
|
|
39
38
|
const [isOpen, setIsOpen] = useState(false);
|
|
39
|
+
const { get } = useFetchClient();
|
|
40
40
|
|
|
41
41
|
const Label = (
|
|
42
42
|
<Flex gap={1} wrap="nowrap">
|
|
@@ -61,7 +61,7 @@ const RelationMultiple = ({ fieldSchema, metadatas, name, entityId, value, conte
|
|
|
61
61
|
|
|
62
62
|
const { data, status } = useQuery(
|
|
63
63
|
[fieldSchema.targetModel, entityId],
|
|
64
|
-
() => fetchRelation(relationFetchEndpoint, notify),
|
|
64
|
+
() => fetchRelation(relationFetchEndpoint, notify, get),
|
|
65
65
|
{
|
|
66
66
|
enabled: isOpen,
|
|
67
67
|
staleTime: 0,
|
|
@@ -21,11 +21,9 @@ export const findLeafByPathAndReplace = (endpath, replaceWith) => {
|
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* If this is the last item in the array of paths
|
|
24
|
-
* and the current path is not undefined in the accumulator
|
|
25
24
|
* then we assume it's a leaf and we can replace it.
|
|
26
25
|
*/
|
|
27
|
-
|
|
28
|
-
if (ind === currentArr.length - 1 && endpath === curr && acc[curr] !== undefined) {
|
|
26
|
+
if (ind === currentArr.length - 1 && endpath === curr) {
|
|
29
27
|
set(acc, curr, replaceWith);
|
|
30
28
|
|
|
31
29
|
return acc;
|
|
@@ -216,10 +216,6 @@ const createYupSchemaAttribute = (type, validations, options) => {
|
|
|
216
216
|
schema = yup
|
|
217
217
|
.mixed(errorsTrads.json)
|
|
218
218
|
.test('isJSON', errorsTrads.json, (value) => {
|
|
219
|
-
if (value === undefined) {
|
|
220
|
-
return true;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
219
|
try {
|
|
224
220
|
JSON.parse(value);
|
|
225
221
|
|
|
@@ -228,7 +224,12 @@ const createYupSchemaAttribute = (type, validations, options) => {
|
|
|
228
224
|
return false;
|
|
229
225
|
}
|
|
230
226
|
})
|
|
231
|
-
.nullable()
|
|
227
|
+
.nullable()
|
|
228
|
+
.test('required', errorsTrads.required, (value) => {
|
|
229
|
+
if (validations.required && !value.length) return false;
|
|
230
|
+
|
|
231
|
+
return true;
|
|
232
|
+
});
|
|
232
233
|
}
|
|
233
234
|
|
|
234
235
|
if (type === 'email') {
|
|
@@ -1,18 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { useIntl } from 'react-intl';
|
|
4
3
|
import { Typography } from '@strapi/design-system/Typography';
|
|
5
4
|
|
|
6
|
-
export const Hint = ({ id, error, name,
|
|
7
|
-
|
|
8
|
-
const hint = description
|
|
9
|
-
? formatMessage(
|
|
10
|
-
{ id: description.id, defaultMessage: description.defaultMessage },
|
|
11
|
-
{ ...description.values }
|
|
12
|
-
)
|
|
13
|
-
: '';
|
|
14
|
-
|
|
15
|
-
if (!hint || error) {
|
|
5
|
+
export const Hint = ({ id, error, name, hint }) => {
|
|
6
|
+
if (hint.length === 0 || error) {
|
|
16
7
|
return null;
|
|
17
8
|
}
|
|
18
9
|
|
|
@@ -25,16 +16,12 @@ export const Hint = ({ id, error, name, description }) => {
|
|
|
25
16
|
|
|
26
17
|
Hint.defaultProps = {
|
|
27
18
|
id: undefined,
|
|
28
|
-
description: undefined,
|
|
29
19
|
error: undefined,
|
|
20
|
+
hint: '',
|
|
30
21
|
};
|
|
31
22
|
|
|
32
23
|
Hint.propTypes = {
|
|
33
|
-
|
|
34
|
-
id: PropTypes.string.isRequired,
|
|
35
|
-
defaultMessage: PropTypes.string.isRequired,
|
|
36
|
-
values: PropTypes.object,
|
|
37
|
-
}),
|
|
24
|
+
hint: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
|
|
38
25
|
error: PropTypes.string,
|
|
39
26
|
id: PropTypes.string,
|
|
40
27
|
name: PropTypes.string.isRequired,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useState, useRef } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { useCMEditViewDataManager } from '@strapi/helper-plugin';
|
|
3
|
+
import { useCMEditViewDataManager, useFetchClient } from '@strapi/helper-plugin';
|
|
4
4
|
import { useIntl } from 'react-intl';
|
|
5
5
|
import get from 'lodash/get';
|
|
6
6
|
import { TextInput } from '@strapi/design-system/TextInput';
|
|
@@ -9,7 +9,6 @@ import Refresh from '@strapi/icons/Refresh';
|
|
|
9
9
|
import CheckCircle from '@strapi/icons/CheckCircle';
|
|
10
10
|
import ExclamationMarkCircle from '@strapi/icons/ExclamationMarkCircle';
|
|
11
11
|
import Loader from '@strapi/icons/Loader';
|
|
12
|
-
import { axiosInstance } from '../../../core/utils';
|
|
13
12
|
import { getRequestUrl } from '../../utils';
|
|
14
13
|
import useDebounce from './useDebounce';
|
|
15
14
|
import UID_REGEX from './regex';
|
|
@@ -23,7 +22,7 @@ import {
|
|
|
23
22
|
const InputUID = ({
|
|
24
23
|
attribute,
|
|
25
24
|
contentTypeUID,
|
|
26
|
-
|
|
25
|
+
hint,
|
|
27
26
|
disabled,
|
|
28
27
|
error,
|
|
29
28
|
intlLabel,
|
|
@@ -46,6 +45,7 @@ const InputUID = ({
|
|
|
46
45
|
const debouncedTargetFieldValue = useDebounce(modifiedData[attribute.targetField], 300);
|
|
47
46
|
const [isCustomized, setIsCustomized] = useState(false);
|
|
48
47
|
const [regenerateLabel, setRegenerateLabel] = useState(null);
|
|
48
|
+
const { post } = useFetchClient();
|
|
49
49
|
|
|
50
50
|
const label = intlLabel.id
|
|
51
51
|
? formatMessage(
|
|
@@ -54,13 +54,6 @@ const InputUID = ({
|
|
|
54
54
|
)
|
|
55
55
|
: name;
|
|
56
56
|
|
|
57
|
-
const hint = description
|
|
58
|
-
? formatMessage(
|
|
59
|
-
{ id: description.id, defaultMessage: description.defaultMessage },
|
|
60
|
-
{ ...description.values }
|
|
61
|
-
)
|
|
62
|
-
: '';
|
|
63
|
-
|
|
64
57
|
const formattedPlaceholder = placeholder
|
|
65
58
|
? formatMessage(
|
|
66
59
|
{ id: placeholder.id, defaultMessage: placeholder.defaultMessage },
|
|
@@ -74,7 +67,7 @@ const InputUID = ({
|
|
|
74
67
|
try {
|
|
75
68
|
const {
|
|
76
69
|
data: { data },
|
|
77
|
-
} = await
|
|
70
|
+
} = await post(requestURL, {
|
|
78
71
|
contentTypeUID,
|
|
79
72
|
field: name,
|
|
80
73
|
data: modifiedData,
|
|
@@ -96,7 +89,7 @@ const InputUID = ({
|
|
|
96
89
|
}
|
|
97
90
|
|
|
98
91
|
try {
|
|
99
|
-
const { data } = await
|
|
92
|
+
const { data } = await post(requestURL, {
|
|
100
93
|
contentTypeUID,
|
|
101
94
|
field: name,
|
|
102
95
|
value: value ? value.trim() : '',
|
|
@@ -251,11 +244,6 @@ InputUID.propTypes = {
|
|
|
251
244
|
required: PropTypes.bool,
|
|
252
245
|
}).isRequired,
|
|
253
246
|
contentTypeUID: PropTypes.string.isRequired,
|
|
254
|
-
description: PropTypes.shape({
|
|
255
|
-
id: PropTypes.string.isRequired,
|
|
256
|
-
defaultMessage: PropTypes.string.isRequired,
|
|
257
|
-
values: PropTypes.object,
|
|
258
|
-
}),
|
|
259
247
|
disabled: PropTypes.bool,
|
|
260
248
|
error: PropTypes.string,
|
|
261
249
|
intlLabel: PropTypes.shape({
|
|
@@ -273,16 +261,17 @@ InputUID.propTypes = {
|
|
|
273
261
|
values: PropTypes.object,
|
|
274
262
|
}),
|
|
275
263
|
required: PropTypes.bool,
|
|
264
|
+
hint: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
|
|
276
265
|
};
|
|
277
266
|
|
|
278
267
|
InputUID.defaultProps = {
|
|
279
|
-
description: undefined,
|
|
280
268
|
disabled: false,
|
|
281
269
|
error: undefined,
|
|
282
270
|
labelAction: undefined,
|
|
283
271
|
placeholder: undefined,
|
|
284
272
|
value: '',
|
|
285
273
|
required: false,
|
|
274
|
+
hint: '',
|
|
286
275
|
};
|
|
287
276
|
|
|
288
277
|
export default InputUID;
|
|
@@ -9,7 +9,6 @@ import { GenericInput, NotAllowedInput, useLibrary } from '@strapi/helper-plugin
|
|
|
9
9
|
import { useContentTypeLayout } from '../../hooks';
|
|
10
10
|
import { getFieldName } from '../../utils';
|
|
11
11
|
import Wysiwyg from '../Wysiwyg';
|
|
12
|
-
import InputJSON from '../InputJSON';
|
|
13
12
|
import InputUID from '../InputUID';
|
|
14
13
|
import { RelationInputDataManager } from '../RelationInputDataManager';
|
|
15
14
|
|
|
@@ -250,7 +249,6 @@ function Inputs({
|
|
|
250
249
|
}
|
|
251
250
|
|
|
252
251
|
const customInputs = {
|
|
253
|
-
json: InputJSON,
|
|
254
252
|
uid: InputUID,
|
|
255
253
|
media: fields.media,
|
|
256
254
|
wysiwyg: Wysiwyg,
|