@strapi/admin 4.12.0 → 4.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/admin/src/components/LeftMenu/index.js +1 -1
- package/admin/src/components/PluginsInitializer/index.js +23 -0
- package/admin/src/content-manager/components/CollectionTypeFormWrapper/index.js +9 -14
- package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/cleanData.js +1 -1
- package/admin/src/content-manager/components/InputUID/index.js +2 -3
- package/admin/src/content-manager/components/RelationInput/RelationInput.js +1 -1
- package/admin/src/content-manager/components/RelationInputDataManager/utils/getRelationLink.js +1 -3
- package/admin/src/content-manager/components/RelationInputDataManager/utils/select.js +4 -6
- package/admin/src/content-manager/components/SingleTypeFormWrapper/index.js +7 -9
- package/admin/src/content-manager/pages/App/utils/getContentTypeLinks.js +1 -3
- package/admin/src/content-manager/pages/EditSettingsView/index.js +31 -18
- package/admin/src/content-manager/pages/ListSettingsView/components/EditFieldForm.js +1 -3
- package/admin/src/content-manager/pages/ListSettingsView/components/Settings.js +1 -3
- package/admin/src/content-manager/pages/ListSettingsView/components/SortDisplayedFields.js +14 -32
- package/admin/src/content-manager/pages/ListSettingsView/index.js +50 -40
- package/admin/src/content-manager/pages/ListView/components/BulkActionButtons/SelectedEntriesModal/index.js +7 -2
- package/admin/src/content-manager/pages/ListView/components/CellContent/RelationMultiple/index.js +2 -2
- package/admin/src/content-manager/pages/ListView/index.js +10 -4
- package/admin/src/content-manager/sharedReducers/crudReducer/reducer.js +1 -1
- package/admin/src/content-manager/utils/checkIfAttributeIsDisplayable.js +2 -4
- package/admin/src/content-manager/utils/index.js +0 -1
- package/admin/src/hooks/index.js +0 -3
- package/admin/src/hooks/useAdminRolePermissions/__mocks__/index.js +5 -0
- package/admin/src/hooks/useAdminRolePermissions/index.js +34 -0
- package/admin/src/hooks/useAdminRoles/__mocks__/index.js +5 -0
- package/admin/src/hooks/useAdminRoles/index.js +40 -0
- package/admin/src/pages/AuthPage/components/Register/index.js +4 -0
- package/admin/src/pages/AuthPage/constants.js +2 -2
- package/admin/src/pages/InstalledPluginsPage/Plugins.js +2 -2
- package/admin/src/pages/InstalledPluginsPage/hooks/usePlugins/index.js +29 -0
- package/admin/src/pages/MarketplacePage/hooks/useFetchMarketplacePlugins/index.js +44 -0
- package/admin/src/pages/MarketplacePage/hooks/useFetchMarketplaceProviders/index.js +44 -0
- package/admin/src/pages/MarketplacePage/utils/useMarketplaceData.js +2 -2
- package/admin/src/pages/SettingsPage/pages/Roles/CreatePage/index.js +24 -9
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/RoleForm/index.js +1 -0
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/index.js +34 -20
- package/admin/src/pages/SettingsPage/pages/Roles/ListPage/index.js +31 -84
- package/admin/src/pages/SettingsPage/pages/Roles/hooks/useAdminRolePermissionLayout/index.js +23 -0
- package/admin/src/translations/ar.json +9 -3
- package/admin/src/translations/ca.json +8 -2
- package/admin/src/translations/de.json +8 -2
- package/admin/src/translations/dk.json +8 -2
- package/admin/src/translations/en.json +9 -3
- package/admin/src/translations/es.json +9 -3
- package/admin/src/translations/eu.json +8 -2
- package/admin/src/translations/fr.json +9 -2
- package/admin/src/translations/gu.json +8 -2
- package/admin/src/translations/hi.json +9 -3
- package/admin/src/translations/hu.json +9 -3
- package/admin/src/translations/ja.json +12 -6
- package/admin/src/translations/ko.json +12 -6
- package/admin/src/translations/ml.json +8 -2
- package/admin/src/translations/nl.json +8 -2
- package/admin/src/translations/pl.json +8 -2
- package/admin/src/translations/pt-BR.json +8 -2
- package/admin/src/translations/ru.json +8 -2
- package/admin/src/translations/sa.json +9 -3
- package/admin/src/translations/sk.json +8 -2
- package/admin/src/translations/sv.json +7 -2
- package/admin/src/translations/tr.json +8 -2
- package/admin/src/translations/zh-Hans.json +8 -2
- package/admin/src/translations/zh.json +8 -2
- package/admin/src/utils/index.js +0 -1
- package/build/1049.f76cb14b.chunk.js +1 -0
- package/build/1386.879bcd90.chunk.js +7 -0
- package/build/{2225.15d1df72.chunk.js → 2225.c6244756.chunk.js} +1 -1
- package/build/2379.f1641312.chunk.js +1 -0
- package/build/2395.46f8d0c1.chunk.js +26 -0
- package/build/2801.5cef5ec8.chunk.js +1 -0
- package/build/{3483.e2ee2547.chunk.js → 3483.03c24f96.chunk.js} +1 -1
- package/build/3929.5632f24d.chunk.js +114 -0
- package/build/4546.cfafae68.chunk.js +1 -0
- package/build/6691.4985ef22.chunk.js +105 -0
- package/build/7464.3e64a1d5.chunk.js +1 -0
- package/build/8276.10a3f883.chunk.js +26 -0
- package/build/{9806.aa25371d.chunk.js → 9806.3392505e.chunk.js} +2 -2
- package/build/{Admin-authenticatedApp.376233ff.chunk.js → Admin-authenticatedApp.3c585a0d.chunk.js} +3 -3
- package/build/{Admin_marketplace.f0b87fce.chunk.js → Admin_marketplace.dde9c148.chunk.js} +6 -6
- package/build/Admin_pluginsPage.bbe79434.chunk.js +6 -0
- package/build/{Admin_profilePage.a968035f.chunk.js → Admin_profilePage.192edc52.chunk.js} +1 -1
- package/build/{Admin_settingsPage.8c600d1a.chunk.js → Admin_settingsPage.97cb9d41.chunk.js} +1 -1
- package/build/admin-app.91898385.chunk.js +36 -0
- package/build/admin-edit-roles-page.6d567273.chunk.js +267 -0
- package/build/{admin-edit-users.67704088.chunk.js → admin-edit-users.79eeb125.chunk.js} +1 -1
- package/build/admin-roles-list.23ddff26.chunk.js +22 -0
- package/build/{admin-users.3279ffb0.chunk.js → admin-users.123aa08e.chunk.js} +1 -1
- package/build/ar-json.74e40bc7.chunk.js +1 -0
- package/build/{ca-json.a53c10b6.chunk.js → ca-json.fc6001d3.chunk.js} +1 -1
- package/build/content-manager.2af15f57.chunk.js +1099 -0
- package/build/{de-json.b3be02c7.chunk.js → de-json.e72545cf.chunk.js} +1 -1
- package/build/dk-json.e77140ef.chunk.js +1 -0
- package/build/{en-json.e34140fc.chunk.js → en-json.08c05fcf.chunk.js} +1 -1
- package/build/es-json.b1f2284b.chunk.js +1 -0
- package/build/{eu-json.633025f0.chunk.js → eu-json.63d0a898.chunk.js} +1 -1
- package/build/{fr-json.aa8839d2.chunk.js → fr-json.33c6428b.chunk.js} +1 -1
- package/build/{gu-json.5bd62812.chunk.js → gu-json.7efe8cc2.chunk.js} +1 -1
- package/build/{hi-json.9104eb78.chunk.js → hi-json.0d633692.chunk.js} +1 -1
- package/build/{hu-json.9f4aae42.chunk.js → hu-json.c74b6a1e.chunk.js} +1 -1
- package/build/index.html +1 -1
- package/build/{ja-json.91286391.chunk.js → ja-json.e1959a1c.chunk.js} +1 -1
- package/build/{ko-json.fcf3ec4b.chunk.js → ko-json.ce5d6d94.chunk.js} +1 -1
- package/build/main.f13fc96c.js +2856 -0
- package/build/{ml-json.557aa14c.chunk.js → ml-json.940d7ace.chunk.js} +1 -1
- package/build/{nl-json.b2b16eea.chunk.js → nl-json.fe38f0fb.chunk.js} +1 -1
- package/build/{pl-json.f094a417.chunk.js → pl-json.d55e8e78.chunk.js} +1 -1
- package/build/{pt-BR-json.dec7fb01.chunk.js → pt-BR-json.ae0a0d2e.chunk.js} +1 -1
- package/build/review-workflows-settings-create-view.cb08cfa2.chunk.js +1 -0
- package/build/review-workflows-settings-edit-view.3c7cbe63.chunk.js +1 -0
- package/build/review-workflows-settings-list-view.1611dc1f.chunk.js +56 -0
- package/build/{ru-json.8193d8c4.chunk.js → ru-json.1c976644.chunk.js} +1 -1
- package/build/{runtime~main.58ec8df6.js → runtime~main.2902859a.js} +1 -1
- package/build/{sa-json.a56836f1.chunk.js → sa-json.2c03ef4e.chunk.js} +1 -1
- package/build/sk-json.b41847e8.chunk.js +1 -0
- package/build/sso-settings-page.12b6d8ae.chunk.js +1 -0
- package/build/{sv-json.fd0e86c6.chunk.js → sv-json.568cb7ae.chunk.js} +1 -1
- package/build/{tr-json.56c32cf6.chunk.js → tr-json.c9f22432.chunk.js} +1 -1
- package/build/upload-settings.7f93d4c0.chunk.js +14 -0
- package/build/upload.37488080.chunk.js +58 -0
- package/build/users-advanced-settings-page.f0760eb8.chunk.js +9 -0
- package/build/users-email-settings-page.ff4b32f3.chunk.js +9 -0
- package/build/users-providers-settings-page.48de0306.chunk.js +14 -0
- package/build/users-roles-settings-page.3f9f063e.chunk.js +30 -0
- package/build/{zh-Hans-json.36d81cdc.chunk.js → zh-Hans-json.937b395b.chunk.js} +1 -1
- package/build/{zh-json.1cc86ff0.chunk.js → zh-json.bfc2e036.chunk.js} +1 -1
- package/ee/admin/hooks/useAuthProviders/index.js +1 -3
- package/ee/admin/pages/AuthResponse/index.js +1 -3
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/Stage/Stage.js +35 -32
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/CreateView/CreateView.js +1 -7
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/EditView/EditView.js +16 -14
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/ListView/ListView.js +32 -31
- package/ee/admin/pages/SettingsPage/pages/SingleSignOn/index.js +16 -26
- package/ee/server/config/admin-actions.js +6 -6
- package/ee/server/services/review-workflows/entity-service-decorator.js +4 -3
- package/index.js +2 -0
- package/package.json +16 -16
- package/scripts/build.js +1 -0
- package/server/controllers/role.js +9 -1
- package/server/middlewares/rateLimit.js +6 -2
- package/server/services/role.js +3 -2
- package/server/services/transfer/token.js +27 -4
- package/server/validation/authentication/register.js +2 -2
- package/webpack.config.js +2 -1
- package/admin/src/content-manager/components/SingleTypeFormWrapper/utils/getRequestUrl.js +0 -5
- package/admin/src/content-manager/components/SingleTypeFormWrapper/utils/index.js +0 -2
- package/admin/src/content-manager/pages/EditSettingsView/utils/api.js +0 -16
- package/admin/src/content-manager/pages/ListSettingsView/init.js +0 -9
- package/admin/src/content-manager/utils/getRequestUrl.js +0 -4
- package/admin/src/hooks/marketplace/useFetchMarketplacePlugins/index.js +0 -44
- package/admin/src/hooks/marketplace/useFetchMarketplaceProviders/index.js +0 -44
- package/admin/src/hooks/useFetchEnabledPlugins/index.js +0 -24
- package/admin/src/hooks/useFetchEnabledPlugins/utils/api.js +0 -10
- package/admin/src/hooks/useFetchPermissionsLayout/index.js +0 -42
- package/admin/src/hooks/useFetchPermissionsLayout/reducer.js +0 -35
- package/admin/src/hooks/useFetchRole/index.js +0 -68
- package/admin/src/hooks/useFetchRole/reducer.js +0 -33
- package/admin/src/hooks/useRolesList/index.js +0 -58
- package/admin/src/hooks/useRolesList/init.js +0 -5
- package/admin/src/hooks/useRolesList/reducer.js +0 -31
- package/admin/src/utils/getRequestUrl.js +0 -3
- package/build/1049.758a01f5.chunk.js +0 -1
- package/build/1386.762d6eb8.chunk.js +0 -7
- package/build/2379.0ca87a89.chunk.js +0 -1
- package/build/2395.df7a044a.chunk.js +0 -26
- package/build/2801.b1140c9b.chunk.js +0 -1
- package/build/4546.ff9fdf30.chunk.js +0 -1
- package/build/6691.f880a0b6.chunk.js +0 -105
- package/build/7065.ec811562.chunk.js +0 -114
- package/build/7464.8a6c1e6c.chunk.js +0 -1
- package/build/8276.6c7b8e6e.chunk.js +0 -26
- package/build/Admin_pluginsPage.8728ff6e.chunk.js +0 -6
- package/build/admin-app.1c3f7fd6.chunk.js +0 -36
- package/build/admin-edit-roles-page.a49b9f4f.chunk.js +0 -267
- package/build/admin-roles-list.0c129e98.chunk.js +0 -23
- package/build/ar-json.f530bc3f.chunk.js +0 -1
- package/build/content-manager.e9205db1.chunk.js +0 -1103
- package/build/dk-json.842aa391.chunk.js +0 -1
- package/build/es-json.f57b5335.chunk.js +0 -1
- package/build/main.1e3b0985.js +0 -2856
- package/build/review-workflows-settings-create-view.05758184.chunk.js +0 -1
- package/build/review-workflows-settings-edit-view.c33f7c58.chunk.js +0 -1
- package/build/review-workflows-settings-list-view.f055e1be.chunk.js +0 -56
- package/build/sk-json.bf2f057a.chunk.js +0 -1
- package/build/sso-settings-page.7c9b2fd9.chunk.js +0 -1
- package/build/upload-settings.cac210a0.chunk.js +0 -14
- package/build/upload.cbfeefa5.chunk.js +0 -58
- package/build/users-advanced-settings-page.18379a56.chunk.js +0 -9
- package/build/users-email-settings-page.a87978e5.chunk.js +0 -9
- package/build/users-providers-settings-page.8876c1ee.chunk.js +0 -14
- package/build/users-roles-settings-page.0431f48c.chunk.js +0 -30
- /package/admin/src/{hooks/marketplace → pages/MarketplacePage}/constants.js +0 -0
|
@@ -214,7 +214,7 @@ const LeftMenu = ({ generalSectionLinks, pluginsSectionLinks }) => {
|
|
|
214
214
|
})}
|
|
215
215
|
</Typography>
|
|
216
216
|
</LinkUser>
|
|
217
|
-
<LinkUser tabIndex={0} onClick={handleLogout}
|
|
217
|
+
<LinkUser tabIndex={0} onClick={handleLogout} to="/auth/login">
|
|
218
218
|
<Typography textColor="danger600">
|
|
219
219
|
{formatMessage({
|
|
220
220
|
id: 'app.components.LeftMenu.logout',
|
|
@@ -18,6 +18,29 @@ const PluginsInitializer = () => {
|
|
|
18
18
|
(plugin) => plugins[plugin].isReady === false
|
|
19
19
|
);
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* I have spent some time trying to understand what is happening here, and wanted to
|
|
24
|
+
* leave that knowledge for my future me:
|
|
25
|
+
*
|
|
26
|
+
* `initializer` is an undocumented property of the `registerPlugin` API. At the time
|
|
27
|
+
* of writing it seems only to be used by the i18n plugin.
|
|
28
|
+
*
|
|
29
|
+
* How does it work?
|
|
30
|
+
*
|
|
31
|
+
* Every plugin that has an `initializer` component defined, receives the
|
|
32
|
+
* `setPlugin` function as a component prop. In the case of i18n the plugin fetches locales
|
|
33
|
+
* first and calls `setPlugin` with `pluginId` once they are loaded, which then triggers the
|
|
34
|
+
* reducer of the admin app defined above.
|
|
35
|
+
*
|
|
36
|
+
* Once all plugins are set to `isReady: true` the app renders.
|
|
37
|
+
*
|
|
38
|
+
* This API is used to block rendering of the admin app. We should remove that in v5 completely
|
|
39
|
+
* and make sure plugins can inject data into the global store before they are initialized, to avoid
|
|
40
|
+
* having a new prop-callback based communication channel between plugins and the core admin app.
|
|
41
|
+
*
|
|
42
|
+
*/
|
|
43
|
+
|
|
21
44
|
if (hasApluginNotReady) {
|
|
22
45
|
const initializers = Object.keys(plugins).reduce((acc, current) => {
|
|
23
46
|
const InitializerComponent = plugins[current].initializer;
|
|
@@ -28,12 +28,7 @@ import {
|
|
|
28
28
|
submitSucceeded,
|
|
29
29
|
} from '../../sharedReducers/crudReducer/actions';
|
|
30
30
|
import selectCrudReducer from '../../sharedReducers/crudReducer/selectors';
|
|
31
|
-
import {
|
|
32
|
-
createDefaultForm,
|
|
33
|
-
getRequestUrl,
|
|
34
|
-
getTrad,
|
|
35
|
-
removePasswordFieldsFromData,
|
|
36
|
-
} from '../../utils';
|
|
31
|
+
import { createDefaultForm, getTrad, removePasswordFieldsFromData } from '../../utils';
|
|
37
32
|
|
|
38
33
|
// This container is used to handle the CRUD
|
|
39
34
|
const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }) => {
|
|
@@ -60,7 +55,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
|
|
|
60
55
|
const isCreatingEntry = id === null;
|
|
61
56
|
|
|
62
57
|
const requestURL =
|
|
63
|
-
isCreatingEntry && !origin ? null :
|
|
58
|
+
isCreatingEntry && !origin ? null : `/content-manager/collection-types/${slug}/${origin || id}`;
|
|
64
59
|
|
|
65
60
|
const cleanReceivedData = useCallback((data) => {
|
|
66
61
|
const cleaned = removePasswordFieldsFromData(
|
|
@@ -190,7 +185,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
|
|
|
190
185
|
try {
|
|
191
186
|
trackUsageRef.current('willDeleteEntry', trackerProperty);
|
|
192
187
|
|
|
193
|
-
const { data } = await del(
|
|
188
|
+
const { data } = await del(`/content-manager/collection-types/${slug}/${id}`);
|
|
194
189
|
|
|
195
190
|
toggleNotification({
|
|
196
191
|
type: 'success',
|
|
@@ -220,8 +215,8 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
|
|
|
220
215
|
* are correctly attached to the entry.
|
|
221
216
|
*/
|
|
222
217
|
const endPoint = isCloning
|
|
223
|
-
?
|
|
224
|
-
:
|
|
218
|
+
? `/content-manager/collection-types/${slug}/clone/${origin}`
|
|
219
|
+
: `/content-manager/collection-types/${slug}`;
|
|
225
220
|
try {
|
|
226
221
|
// Show a loading button in the EditView/Header.js && lock the app => no navigation
|
|
227
222
|
dispatch(setStatus('submit-pending'));
|
|
@@ -279,7 +274,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
|
|
|
279
274
|
try {
|
|
280
275
|
trackUsageRef.current('willCheckDraftRelations');
|
|
281
276
|
|
|
282
|
-
const endPoint =
|
|
277
|
+
const endPoint = `/content-manager/collection-types/${slug}/${id}/actions/countDraftRelations`;
|
|
283
278
|
dispatch(setStatus('draft-relation-check-pending'));
|
|
284
279
|
|
|
285
280
|
const numberOfDraftRelations = await fetchClient.get(endPoint);
|
|
@@ -299,7 +294,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
|
|
|
299
294
|
const onPublish = useCallback(async () => {
|
|
300
295
|
try {
|
|
301
296
|
trackUsageRef.current('willPublishEntry');
|
|
302
|
-
const endPoint =
|
|
297
|
+
const endPoint = `/content-manager/collection-types/${slug}/${id}/actions/publish`;
|
|
303
298
|
|
|
304
299
|
dispatch(setStatus('publish-pending'));
|
|
305
300
|
|
|
@@ -326,7 +321,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
|
|
|
326
321
|
|
|
327
322
|
const onPut = useCallback(
|
|
328
323
|
async (body, trackerProperty) => {
|
|
329
|
-
const endPoint =
|
|
324
|
+
const endPoint = `/content-manager/collection-types/${slug}/${id}`;
|
|
330
325
|
|
|
331
326
|
try {
|
|
332
327
|
trackUsageRef.current('willEditEntry', trackerProperty);
|
|
@@ -362,7 +357,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
|
|
|
362
357
|
);
|
|
363
358
|
|
|
364
359
|
const onUnpublish = useCallback(async () => {
|
|
365
|
-
const endPoint =
|
|
360
|
+
const endPoint = `/content-manager/collection-types/${slug}/${id}/actions/unpublish`;
|
|
366
361
|
|
|
367
362
|
dispatch(setStatus('unpublish-pending'));
|
|
368
363
|
|
|
@@ -91,7 +91,7 @@ const cleanData = ({ browserState, serverState }, currentSchema, componentsSchem
|
|
|
91
91
|
/**
|
|
92
92
|
* Because of how repeatable components work when you dig into them the server
|
|
93
93
|
* will have no object to compare too therefore no relation array will be setup
|
|
94
|
-
* because the component has not been
|
|
94
|
+
* because the component has not been initialized, therefore we can safely assume
|
|
95
95
|
* it needs to be added and provide a default empty array.
|
|
96
96
|
*/
|
|
97
97
|
let actualOldValue = get(rootServerState, trueInitialDataPath, []);
|
|
@@ -12,7 +12,6 @@ import PropTypes from 'prop-types';
|
|
|
12
12
|
import { useIntl } from 'react-intl';
|
|
13
13
|
|
|
14
14
|
import useDebounce from '../../../hooks/useDebounce';
|
|
15
|
-
import { getRequestUrl } from '../../utils';
|
|
16
15
|
|
|
17
16
|
import { FieldActionWrapper, LoadingWrapper, TextValidation } from './endActionStyle';
|
|
18
17
|
import UID_REGEX from './regex';
|
|
@@ -67,7 +66,7 @@ const InputUID = ({
|
|
|
67
66
|
try {
|
|
68
67
|
const {
|
|
69
68
|
data: { data },
|
|
70
|
-
} = await post(
|
|
69
|
+
} = await post('/content-manager/uid/generate', {
|
|
71
70
|
contentTypeUID,
|
|
72
71
|
field: name,
|
|
73
72
|
data: modifiedData,
|
|
@@ -92,7 +91,7 @@ const InputUID = ({
|
|
|
92
91
|
setIsLoading(true);
|
|
93
92
|
|
|
94
93
|
try {
|
|
95
|
-
const { data } = await post(
|
|
94
|
+
const { data } = await post('/content-manager/uid/check-availability', {
|
|
96
95
|
contentTypeUID,
|
|
97
96
|
field: name,
|
|
98
97
|
value: value ? value.trim() : '',
|
|
@@ -373,7 +373,7 @@ RelationInput.propTypes = {
|
|
|
373
373
|
};
|
|
374
374
|
|
|
375
375
|
/**
|
|
376
|
-
* This is in a
|
|
376
|
+
* This is in a separate component to enforce passing all the props the component requires to react-window
|
|
377
377
|
* to ensure drag & drop correctly works.
|
|
378
378
|
*/
|
|
379
379
|
const ListItem = ({ data, index, style }) => {
|
|
@@ -4,8 +4,6 @@ import { useCMEditViewDataManager } from '@strapi/helper-plugin';
|
|
|
4
4
|
import get from 'lodash/get';
|
|
5
5
|
import { useRouteMatch } from 'react-router-dom';
|
|
6
6
|
|
|
7
|
-
import { getRequestUrl } from '../../../utils';
|
|
8
|
-
|
|
9
7
|
function useSelect({
|
|
10
8
|
componentUid,
|
|
11
9
|
isUserAllowedToEditField,
|
|
@@ -78,20 +76,20 @@ function useSelect({
|
|
|
78
76
|
// if no componentId exists in modifiedData it means that the user just created it
|
|
79
77
|
// there then are no relations to request
|
|
80
78
|
return componentId
|
|
81
|
-
?
|
|
79
|
+
? `/content-manager/relations/${componentUid}/${componentId}/${fieldNameKeys.at(-1)}`
|
|
82
80
|
: null;
|
|
83
81
|
}
|
|
84
82
|
|
|
85
|
-
return
|
|
83
|
+
return `/content-manager/relations/${slug}/${entityId}/${name.split('.').at(-1)}`;
|
|
86
84
|
}, [isCreatingEntry, origin, componentUid, slug, entityId, name, componentId, fieldNameKeys]);
|
|
87
85
|
|
|
88
86
|
// /content-manager/relations/[model]/[field-name]
|
|
89
87
|
const relationSearchEndpoint = useMemo(() => {
|
|
90
88
|
if (componentUid) {
|
|
91
|
-
return
|
|
89
|
+
return `/content-manager/relations/${componentUid}/${name.split('.').at(-1)}`;
|
|
92
90
|
}
|
|
93
91
|
|
|
94
|
-
return
|
|
92
|
+
return `/content-manager/relations/${slug}/${name.split('.').at(-1)}`;
|
|
95
93
|
}, [componentUid, slug, name]);
|
|
96
94
|
|
|
97
95
|
return {
|
|
@@ -29,8 +29,6 @@ import {
|
|
|
29
29
|
import selectCrudReducer from '../../sharedReducers/crudReducer/selectors';
|
|
30
30
|
import { createDefaultForm, getTrad, removePasswordFieldsFromData } from '../../utils';
|
|
31
31
|
|
|
32
|
-
import { getRequestUrl } from './utils';
|
|
33
|
-
|
|
34
32
|
// This container is used to handle the CRUD
|
|
35
33
|
const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
|
|
36
34
|
const queryClient = useQueryClient();
|
|
@@ -110,7 +108,7 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
|
|
|
110
108
|
setIsCreatingEntry(true);
|
|
111
109
|
|
|
112
110
|
try {
|
|
113
|
-
const { data } = await fetchClient.get(
|
|
111
|
+
const { data } = await fetchClient.get(`/content-manager/single-types/${slug}`, {
|
|
114
112
|
cancelToken: source.token,
|
|
115
113
|
params,
|
|
116
114
|
});
|
|
@@ -158,7 +156,7 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
|
|
|
158
156
|
try {
|
|
159
157
|
trackUsageRef.current('willDeleteEntry', trackerProperty);
|
|
160
158
|
|
|
161
|
-
const { data } = await del(
|
|
159
|
+
const { data } = await del(`/content-manager/single-types/${slug}`, {
|
|
162
160
|
params,
|
|
163
161
|
});
|
|
164
162
|
|
|
@@ -186,7 +184,7 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
|
|
|
186
184
|
|
|
187
185
|
const onPost = useCallback(
|
|
188
186
|
async (body, trackerProperty) => {
|
|
189
|
-
const endPoint =
|
|
187
|
+
const endPoint = `/content-manager/single-types/${slug}`;
|
|
190
188
|
|
|
191
189
|
try {
|
|
192
190
|
dispatch(setStatus('submit-pending'));
|
|
@@ -237,7 +235,7 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
|
|
|
237
235
|
try {
|
|
238
236
|
trackUsageRef.current('willCheckDraftRelations');
|
|
239
237
|
|
|
240
|
-
const endPoint =
|
|
238
|
+
const endPoint = `/content-manager/single-types/${slug}/actions/countDraftRelations`;
|
|
241
239
|
dispatch(setStatus('draft-relation-check-pending'));
|
|
242
240
|
|
|
243
241
|
const numberOfDraftRelations = await fetchClient.get(endPoint);
|
|
@@ -257,7 +255,7 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
|
|
|
257
255
|
const onPublish = useCallback(async () => {
|
|
258
256
|
try {
|
|
259
257
|
trackUsageRef.current('willPublishEntry');
|
|
260
|
-
const endPoint =
|
|
258
|
+
const endPoint = `/content-manager/single-types/${slug}/actions/publish`;
|
|
261
259
|
|
|
262
260
|
dispatch(setStatus('publish-pending'));
|
|
263
261
|
|
|
@@ -291,7 +289,7 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
|
|
|
291
289
|
|
|
292
290
|
const onPut = useCallback(
|
|
293
291
|
async (body, trackerProperty) => {
|
|
294
|
-
const endPoint =
|
|
292
|
+
const endPoint = `/content-manager/single-types/${slug}`;
|
|
295
293
|
|
|
296
294
|
try {
|
|
297
295
|
trackUsageRef.current('willEditEntry', trackerProperty);
|
|
@@ -330,7 +328,7 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
|
|
|
330
328
|
|
|
331
329
|
// The publish and unpublish method could be refactored but let's leave the duplication for now
|
|
332
330
|
const onUnpublish = useCallback(async () => {
|
|
333
|
-
const endPoint =
|
|
331
|
+
const endPoint = `/content-manager/single-types/${slug}/actions/unpublish`;
|
|
334
332
|
|
|
335
333
|
dispatch(setStatus('unpublish-pending'));
|
|
336
334
|
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { getFetchClient } from '@strapi/helper-plugin';
|
|
2
2
|
|
|
3
|
-
import { getRequestUrl } from '../../../utils';
|
|
4
|
-
|
|
5
3
|
import checkPermissions from './checkPermissions';
|
|
6
4
|
import generateModelsLinks from './generateModelsLinks';
|
|
7
5
|
|
|
@@ -10,7 +8,7 @@ const getContentTypeLinks = async ({ models, userPermissions, toggleNotification
|
|
|
10
8
|
try {
|
|
11
9
|
const {
|
|
12
10
|
data: { data: contentTypeConfigurations },
|
|
13
|
-
} = await get(
|
|
11
|
+
} = await get('/content-manager/content-types-settings');
|
|
14
12
|
|
|
15
13
|
const { collectionTypeSectionLinks, singleTypeSectionLinks } = generateModelsLinks(
|
|
16
14
|
models,
|
|
@@ -14,14 +14,16 @@ import {
|
|
|
14
14
|
Select,
|
|
15
15
|
Typography,
|
|
16
16
|
} from '@strapi/design-system';
|
|
17
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
ConfirmDialog,
|
|
19
|
+
Link,
|
|
20
|
+
useFetchClient,
|
|
21
|
+
useNotification,
|
|
22
|
+
useTracking,
|
|
23
|
+
} from '@strapi/helper-plugin';
|
|
18
24
|
import { ArrowLeft, Check } from '@strapi/icons';
|
|
19
25
|
import cloneDeep from 'lodash/cloneDeep';
|
|
20
|
-
import flatMap from 'lodash/flatMap';
|
|
21
|
-
import get from 'lodash/get';
|
|
22
26
|
import isEqual from 'lodash/isEqual';
|
|
23
|
-
import pick from 'lodash/pick';
|
|
24
|
-
import set from 'lodash/set';
|
|
25
27
|
import upperFirst from 'lodash/upperFirst';
|
|
26
28
|
import PropTypes from 'prop-types';
|
|
27
29
|
import { useIntl } from 'react-intl';
|
|
@@ -37,7 +39,6 @@ import ModalForm from './components/FormModal';
|
|
|
37
39
|
import { LayoutDndProvider } from './components/LayoutDndProvider';
|
|
38
40
|
import init from './init';
|
|
39
41
|
import reducer, { initialState } from './reducer';
|
|
40
|
-
import putCMSettingsEV from './utils/api';
|
|
41
42
|
import { unformatLayout } from './utils/layout';
|
|
42
43
|
|
|
43
44
|
const EditSettingsView = ({ mainLayout, components, isContentTypeView, slug, updateLayout }) => {
|
|
@@ -52,12 +53,13 @@ const EditSettingsView = ({ mainLayout, components, isContentTypeView, slug, upd
|
|
|
52
53
|
const [isConfirmDialogOpen, setIsConfirmDialogOpen] = useState(false);
|
|
53
54
|
const { componentLayouts, initialData, modifiedData, metaToEdit, metaForm } = reducerState;
|
|
54
55
|
const { formatMessage } = useIntl();
|
|
55
|
-
const modelName =
|
|
56
|
-
const attributes =
|
|
56
|
+
const modelName = mainLayout.info.displayName;
|
|
57
|
+
const attributes = modifiedData?.attributes ?? {};
|
|
57
58
|
const fieldSizes = useSelector(selectFieldSizes);
|
|
59
|
+
const { put } = useFetchClient();
|
|
58
60
|
|
|
59
61
|
const entryTitleOptions = Object.keys(attributes).filter((attr) => {
|
|
60
|
-
const type =
|
|
62
|
+
const type = attributes?.[attr]?.type ?? '';
|
|
61
63
|
|
|
62
64
|
return (
|
|
63
65
|
![
|
|
@@ -74,10 +76,10 @@ const EditSettingsView = ({ mainLayout, components, isContentTypeView, slug, upd
|
|
|
74
76
|
].includes(type) && !!type
|
|
75
77
|
);
|
|
76
78
|
});
|
|
77
|
-
const editLayout =
|
|
78
|
-
const displayedFields = flatMap(
|
|
79
|
+
const editLayout = modifiedData.layouts.edit;
|
|
80
|
+
const displayedFields = editLayout.flatMap((layout) => layout.rowContent);
|
|
79
81
|
const editLayoutFields = Object.keys(modifiedData.attributes)
|
|
80
|
-
.filter((attr) =>
|
|
82
|
+
.filter((attr) => (modifiedData?.metadatas?.[attr]?.edit?.visible ?? false) === true)
|
|
81
83
|
.filter((attr) => displayedFields.findIndex((el) => el.name === attr) === -1)
|
|
82
84
|
.sort();
|
|
83
85
|
|
|
@@ -128,7 +130,12 @@ const EditSettingsView = ({ mainLayout, components, isContentTypeView, slug, upd
|
|
|
128
130
|
|
|
129
131
|
const submitMutation = useMutation(
|
|
130
132
|
(body) => {
|
|
131
|
-
return
|
|
133
|
+
return put(
|
|
134
|
+
isContentTypeView
|
|
135
|
+
? `/content-manager/content-types/${slug}/configuration`
|
|
136
|
+
: `/content-manager/components/${slug}/configuration`,
|
|
137
|
+
body
|
|
138
|
+
);
|
|
132
139
|
},
|
|
133
140
|
{
|
|
134
141
|
onSuccess({ data }) {
|
|
@@ -149,9 +156,15 @@ const EditSettingsView = ({ mainLayout, components, isContentTypeView, slug, upd
|
|
|
149
156
|
const { isLoading: isSubmittingForm } = submitMutation;
|
|
150
157
|
|
|
151
158
|
const handleConfirm = () => {
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
|
|
159
|
+
const { layouts, metadatas, settings } = cloneDeep(modifiedData);
|
|
160
|
+
submitMutation.mutate({
|
|
161
|
+
layouts: {
|
|
162
|
+
...layouts,
|
|
163
|
+
edit: unformatLayout(layouts.edit),
|
|
164
|
+
},
|
|
165
|
+
metadatas,
|
|
166
|
+
settings,
|
|
167
|
+
});
|
|
155
168
|
};
|
|
156
169
|
|
|
157
170
|
const handleMoveRelation = (fromIndex, toIndex) => {
|
|
@@ -357,8 +370,8 @@ const EditSettingsView = ({ mainLayout, components, isContentTypeView, slug, upd
|
|
|
357
370
|
onToggle={handleToggleModal}
|
|
358
371
|
onMetaChange={handleMetaChange}
|
|
359
372
|
onSizeChange={handleSizeChange}
|
|
360
|
-
type={
|
|
361
|
-
customFieldUid={
|
|
373
|
+
type={attributes?.[metaToEdit]?.type ?? ''}
|
|
374
|
+
customFieldUid={attributes?.[metaToEdit]?.customField ?? ''}
|
|
362
375
|
/>
|
|
363
376
|
)}
|
|
364
377
|
</Main>
|
|
@@ -29,7 +29,7 @@ const HeaderContainer = styled(Flex)`
|
|
|
29
29
|
}
|
|
30
30
|
`;
|
|
31
31
|
|
|
32
|
-
const EditFieldForm = ({
|
|
32
|
+
export const EditFieldForm = ({
|
|
33
33
|
attributes,
|
|
34
34
|
fieldForm,
|
|
35
35
|
fieldToEdit,
|
|
@@ -142,5 +142,3 @@ EditFieldForm.propTypes = {
|
|
|
142
142
|
onSubmit: PropTypes.func.isRequired,
|
|
143
143
|
type: PropTypes.string.isRequired,
|
|
144
144
|
};
|
|
145
|
-
|
|
146
|
-
export default EditFieldForm;
|
|
@@ -15,7 +15,7 @@ import { useIntl } from 'react-intl';
|
|
|
15
15
|
|
|
16
16
|
import { getTrad } from '../../../utils';
|
|
17
17
|
|
|
18
|
-
const Settings = ({ modifiedData, onChange, sortOptions }) => {
|
|
18
|
+
export const Settings = ({ modifiedData, onChange, sortOptions }) => {
|
|
19
19
|
const { formatMessage } = useIntl();
|
|
20
20
|
const { settings, metadatas } = modifiedData;
|
|
21
21
|
|
|
@@ -168,5 +168,3 @@ Settings.propTypes = {
|
|
|
168
168
|
onChange: PropTypes.func.isRequired,
|
|
169
169
|
sortOptions: PropTypes.array,
|
|
170
170
|
};
|
|
171
|
-
|
|
172
|
-
export default Settings;
|
|
@@ -5,19 +5,12 @@ import { Menu } from '@strapi/design-system/v2';
|
|
|
5
5
|
import { Plus } from '@strapi/icons';
|
|
6
6
|
import { PropTypes } from 'prop-types';
|
|
7
7
|
import { useIntl } from 'react-intl';
|
|
8
|
-
import styled from 'styled-components';
|
|
9
8
|
|
|
10
9
|
import { getTrad } from '../../../utils';
|
|
11
10
|
|
|
12
11
|
import DraggableCard from './DraggableCard';
|
|
13
12
|
|
|
14
|
-
const
|
|
15
|
-
flex: ${({ size }) => size};
|
|
16
|
-
overflow-x: scroll;
|
|
17
|
-
overflow-y: hidden;
|
|
18
|
-
`;
|
|
19
|
-
|
|
20
|
-
const SortDisplayedFields = ({
|
|
13
|
+
export const SortDisplayedFields = ({
|
|
21
14
|
displayedFields,
|
|
22
15
|
listRemainingFields,
|
|
23
16
|
metadatas,
|
|
@@ -48,25 +41,16 @@ const SortDisplayedFields = ({
|
|
|
48
41
|
}, [displayedFields, lastAction]);
|
|
49
42
|
|
|
50
43
|
return (
|
|
51
|
-
|
|
52
|
-
<
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
paddingTop={4}
|
|
62
|
-
paddingLeft={4}
|
|
63
|
-
paddingRight={4}
|
|
64
|
-
borderColor="neutral300"
|
|
65
|
-
borderStyle="dashed"
|
|
66
|
-
borderWidth="1px"
|
|
67
|
-
hasRadius
|
|
68
|
-
>
|
|
69
|
-
<ScrollableContainer size="1" paddingBottom={4} ref={scrollableContainerRef}>
|
|
44
|
+
<Flex alignItems="stretch" direction="column" gap={4}>
|
|
45
|
+
<Typography variant="delta" as="h2">
|
|
46
|
+
{formatMessage({
|
|
47
|
+
id: getTrad('containers.SettingPage.view'),
|
|
48
|
+
defaultMessage: 'View',
|
|
49
|
+
})}
|
|
50
|
+
</Typography>
|
|
51
|
+
|
|
52
|
+
<Flex padding={4} borderColor="neutral300" borderStyle="dashed" borderWidth="1px" hasRadius>
|
|
53
|
+
<Box flex="1" overflow="scroll hidden" ref={scrollableContainerRef}>
|
|
70
54
|
<Flex gap={3}>
|
|
71
55
|
{displayedFields.map((field, index) => (
|
|
72
56
|
<DraggableCard
|
|
@@ -82,7 +66,8 @@ const SortDisplayedFields = ({
|
|
|
82
66
|
/>
|
|
83
67
|
))}
|
|
84
68
|
</Flex>
|
|
85
|
-
</
|
|
69
|
+
</Box>
|
|
70
|
+
|
|
86
71
|
<Menu.Root>
|
|
87
72
|
<Menu.Trigger
|
|
88
73
|
paddingLeft={2}
|
|
@@ -90,7 +75,6 @@ const SortDisplayedFields = ({
|
|
|
90
75
|
justifyContent="center"
|
|
91
76
|
endIcon={null}
|
|
92
77
|
disabled={listRemainingFields.length <= 0}
|
|
93
|
-
marginBottom={4}
|
|
94
78
|
variant="tertiary"
|
|
95
79
|
>
|
|
96
80
|
<VisuallyHidden as="span">
|
|
@@ -110,7 +94,7 @@ const SortDisplayedFields = ({
|
|
|
110
94
|
</Menu.Content>
|
|
111
95
|
</Menu.Root>
|
|
112
96
|
</Flex>
|
|
113
|
-
|
|
97
|
+
</Flex>
|
|
114
98
|
);
|
|
115
99
|
};
|
|
116
100
|
|
|
@@ -129,5 +113,3 @@ SortDisplayedFields.propTypes = {
|
|
|
129
113
|
onMoveField: PropTypes.func.isRequired,
|
|
130
114
|
onRemoveField: PropTypes.func.isRequired,
|
|
131
115
|
};
|
|
132
|
-
|
|
133
|
-
export default SortDisplayedFields;
|