@strapi/admin 4.9.0-exp.90df253ba90fd6879eb56a720a1f80d04ff745b8 → 4.10.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/admin/src/content-manager/components/DynamicTable/CellContent/PublicationState/PublicationState.js +26 -0
- package/admin/src/content-manager/components/DynamicTable/CellContent/PublicationState/index.js +1 -0
- package/admin/src/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/ReviewWorkflowsStage.js +15 -0
- package/admin/src/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/index.js +1 -0
- package/admin/src/content-manager/components/DynamicTable/index.js +43 -49
- package/admin/src/content-manager/components/DynamicZone/components/DynamicComponent.js +2 -0
- package/admin/src/content-manager/components/DynamicZone/utils/select.js +1 -1
- package/admin/src/content-manager/components/FieldComponent/utils/select.js +2 -1
- package/admin/src/content-manager/components/Inputs/utils/getInputType.js +1 -1
- package/admin/src/content-manager/components/Inputs/utils/select.js +1 -1
- package/admin/src/content-manager/hooks/useContentTypeLayout/index.js +1 -2
- package/admin/src/content-manager/hooks/useFetchContentTypeLayout/utils/formatLayouts.js +4 -1
- package/admin/src/content-manager/pages/CollectionTypeRecursivePath/index.js +1 -2
- package/admin/src/content-manager/pages/EditSettingsView/init.js +3 -1
- package/admin/src/content-manager/pages/EditSettingsView/utils/createPossibleMainFieldsForModelsAndComponents.js +2 -4
- package/admin/src/content-manager/pages/EditView/DeleteLink/utils/select.js +1 -1
- package/admin/src/content-manager/pages/EditView/Information/index.js +77 -53
- package/admin/src/content-manager/pages/EditView/InformationBox/InformationBoxCE.js +13 -0
- package/admin/src/content-manager/pages/EditView/InformationBox/index.js +3 -0
- package/admin/src/content-manager/pages/EditView/index.js +3 -4
- package/admin/src/content-manager/pages/EditView/utils/createAttributesLayout.js +2 -1
- package/admin/src/content-manager/pages/EditView/utils/getFieldsActionMatchingPermissions.js +2 -1
- package/admin/src/content-manager/pages/ListView/index.js +6 -9
- package/admin/src/content-manager/utils/checkIfAttributeIsDisplayable.js +1 -1
- package/admin/src/content-manager/utils/createDefaultForm.js +2 -2
- package/admin/src/content-manager/utils/formatLayoutToApi.js +2 -1
- package/admin/src/content-manager/utils/getFieldName.js +1 -1
- package/admin/src/content-manager/utils/mergeMetasWithSchema.js +1 -1
- package/admin/src/content-manager/utils/paths.js +1 -1
- package/admin/src/content-manager/utils/removePasswordFieldsFromData.js +1 -1
- package/admin/src/hooks/useRegenerate/index.js +1 -1
- package/admin/src/hooks/useSettingsForm/index.js +3 -3
- package/admin/src/hooks/useSettingsForm/reducer.js +3 -1
- package/admin/src/hooks/useSettingsMenu/reducer.js +1 -1
- package/admin/src/index.js +1 -0
- package/admin/src/pages/AuthPage/reducer.js +1 -1
- package/admin/src/pages/SettingsPage/components/Tokens/TokenTypeSelect/index.js +5 -7
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/CollapsableContentType/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/reducer.js +1 -1
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/utils/transformPermissionsData.js +6 -8
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/ConditionsModal/utils/createDefaultConditionsForm.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/ContentTypeCollapse/Collapse/utils/generateCheckboxesActions.js +2 -1
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/ContentTypeCollapse/CollapsePropertyMatrix/ActionRow/utils/getRowLabelCheckboxeState.js +2 -1
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/GlobalActions/utils/getRowLabelCheckboxesState.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/Permissions/reducer.js +6 -1
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/Permissions/utils/createDefaultCTFormFromLayout.js +5 -1
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/Permissions/utils/createDefaultPluginsFormFromLayout.js +1 -2
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/Permissions/utils/formatContentTypesPermissionToAPI.js +2 -2
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/Permissions/utils/updateConditionsToFalse.js +4 -1
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/Permissions/utils/updateValues.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/PluginsAndSettings/SubCategory/utils/formatActions.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/utils/createArrayOfValues.js +2 -1
- package/admin/src/pages/SettingsPage/pages/Roles/ListPage/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/components/FormTransferTokenContainer/index.js +0 -41
- package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/index.js +4 -6
- package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/utils/schema.js +0 -1
- package/admin/src/pages/SettingsPage/pages/Users/ProtectedEditPage/index.js +2 -2
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/utils/formatData.js +1 -7
- package/admin/src/permissions/index.js +1 -1
- package/admin/src/translations/en.json +6 -0
- package/admin/src/utils/getAttributesToDisplay.js +2 -4
- package/admin/src/utils/getExistingActions.js +1 -3
- package/admin/src/utils/sortLinks.js +1 -1
- package/build/{8580.b0dcf37c.chunk.js → 2263.4c5916f9.chunk.js} +61 -61
- package/build/4649.213b8a3b.chunk.js +30 -0
- package/build/6985.66cca29c.chunk.js +1 -0
- package/build/7259.aefb51e8.chunk.js +1 -0
- package/build/{7112.2bf13da3.chunk.js → 9505.dbe702ab.chunk.js} +6 -6
- package/build/{Admin-authenticatedApp.5aa08bf5.chunk.js → Admin-authenticatedApp.f50ad423.chunk.js} +3 -3
- package/build/{Admin_marketplace.0f6c8ee2.chunk.js → Admin_marketplace.02608d56.chunk.js} +1 -1
- package/build/{Admin_profilePage.d2a8f9ab.chunk.js → Admin_profilePage.76afeca0.chunk.js} +1 -1
- package/build/Admin_settingsPage.147755cd.chunk.js +9 -0
- package/build/admin-app.55dd7921.chunk.js +112 -0
- package/build/admin-edit-roles-page.cf543488.chunk.js +216 -0
- package/build/admin-edit-users.31c20712.chunk.js +10 -0
- package/build/admin-roles-list.489c501f.chunk.js +2 -0
- package/build/{admin-users.af8c3123.chunk.js → admin-users.3e111a7d.chunk.js} +1 -1
- package/build/{api-tokens-create-page.2a6e22bd.chunk.js → api-tokens-create-page.4328b852.chunk.js} +1 -1
- package/build/{api-tokens-edit-page.fa38cd63.chunk.js → api-tokens-edit-page.bce5050f.chunk.js} +1 -1
- package/build/content-manager.4480ae88.chunk.js +1137 -0
- package/build/content-type-builder-translation-en-json.7961593e.chunk.js +1 -0
- package/build/content-type-builder.af9abf1e.chunk.js +126 -0
- package/build/en-json.697b4bcf.chunk.js +1 -0
- package/build/index.html +1 -1
- package/build/main.af8c0f31.js +3790 -0
- package/build/review-workflows-settings.7a7dc773.chunk.js +57 -0
- package/build/runtime~main.5a95bee6.js +2 -0
- package/build/sso-settings-page.272b87c8.chunk.js +1 -0
- package/build/{upload-settings.0200561d.chunk.js → upload-settings.0875e973.chunk.js} +1 -1
- package/build/upload-translation-fr-json.baab9911.chunk.js +1 -0
- package/build/users-advanced-settings-page.1d3c14c7.chunk.js +1 -0
- package/build/{users-email-settings-page.a3c80419.chunk.js → users-email-settings-page.e8db68c4.chunk.js} +1 -1
- package/build/users-providers-settings-page.14cac425.chunk.js +1 -0
- package/build/users-roles-settings-page.2ea4de84.chunk.js +30 -0
- package/build/{webhook-edit-page.a2a2b7bb.chunk.js → webhook-edit-page.329141a5.chunk.js} +3 -3
- package/ee/admin/content-manager/pages/EditView/InformationBox/InformationBoxEE.js +92 -0
- package/ee/admin/content-manager/pages/EditView/InformationBox/index.js +3 -0
- package/ee/admin/hooks/useSettingsMenu/utils/customAdminLinks.js +12 -12
- package/ee/admin/hooks/useSettingsMenu/utils/customGlobalLinks.js +21 -13
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/ReviewWorkflows.js +195 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/actions/index.js +42 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/AddStage/AddStage.js +87 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/AddStage/index.js +1 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/Stage/Stage.js +90 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/Stage/index.js +1 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/Stages.js +92 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/index.js +1 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/constants.js +6 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/hooks/useReviewWorkflows.js +35 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/index.js +3 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/reducer/index.js +121 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/utils/getWorkflowValidationSchema.js +25 -0
- package/ee/admin/pages/SettingsPage/utils/customRoutes.js +16 -2
- package/ee/admin/permissions/customPermissions.js +3 -0
- package/ee/server/bootstrap.js +16 -0
- package/ee/server/config/admin-actions.js +10 -0
- package/ee/server/constants/default-stages.json +14 -0
- package/ee/server/constants/default-workflow.json +1 -0
- package/ee/server/constants/workflows.js +8 -0
- package/ee/server/content-types/index.js +9 -0
- package/ee/server/content-types/workflow/index.js +34 -0
- package/ee/server/content-types/workflow-stage/index.js +41 -0
- package/ee/server/controllers/index.js +2 -0
- package/ee/server/controllers/workflows/index.js +36 -0
- package/ee/server/controllers/workflows/stages/index.js +95 -0
- package/ee/server/index.js +1 -0
- package/ee/server/middlewares/review-workflows.js +40 -0
- package/ee/server/migrations/review-workflows.js +39 -0
- package/ee/server/register.js +7 -0
- package/ee/server/routes/index.js +104 -0
- package/ee/server/services/index.js +4 -0
- package/ee/server/services/review-workflows/entity-service-decorator.js +42 -0
- package/ee/server/services/review-workflows/review-workflows.js +175 -0
- package/ee/server/services/review-workflows/stages.js +148 -0
- package/ee/server/services/review-workflows/workflows.js +25 -0
- package/ee/server/utils/index.js +8 -0
- package/ee/server/utils/persisted-tables.js +49 -0
- package/ee/server/utils/review-workflows.js +25 -0
- package/ee/server/utils/test.js +11 -0
- package/ee/server/validation/review-workflows.js +24 -0
- package/package.json +13 -13
- package/server/controllers/transfer/runner.js +2 -4
- package/server/routes/transfer.js +4 -13
- package/server/services/constants.js +0 -4
- package/server/services/permission/permissions-manager/sanitize.js +2 -0
- package/server/services/transfer/permission.js +1 -1
- package/server/services/transfer/token.js +31 -33
- package/server/validation/transfer/token.js +2 -10
- package/build/2637.679b590b.chunk.js +0 -1
- package/build/5563.451e91ee.chunk.js +0 -30
- package/build/7259.7744297b.chunk.js +0 -1
- package/build/Admin_settingsPage.489ec4eb.chunk.js +0 -9
- package/build/admin-app.4b313104.chunk.js +0 -112
- package/build/admin-edit-roles-page.3b196317.chunk.js +0 -216
- package/build/admin-edit-users.af3b0f15.chunk.js +0 -10
- package/build/admin-roles-list.0ad504a7.chunk.js +0 -2
- package/build/content-manager.f530e141.chunk.js +0 -1139
- package/build/content-type-builder-translation-en-json.e577d595.chunk.js +0 -1
- package/build/content-type-builder.6ecd201d.chunk.js +0 -126
- package/build/en-json.01a88a30.chunk.js +0 -1
- package/build/main.43b93ff3.js +0 -3843
- package/build/runtime~main.a40b1b57.js +0 -2
- package/build/sso-settings-page.5a8588ef.chunk.js +0 -1
- package/build/upload-translation-fr-json.84429734.chunk.js +0 -1
- package/build/users-advanced-settings-page.c0cae03a.chunk.js +0 -1
- package/build/users-providers-settings-page.5f86e45c.chunk.js +0 -1
- package/build/users-roles-settings-page.b02986df.chunk.js +0 -30
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { useIntl } from 'react-intl';
|
|
4
|
+
import { Status, Typography } from '@strapi/design-system';
|
|
5
|
+
|
|
6
|
+
import { getTrad } from '../../../../utils';
|
|
7
|
+
|
|
8
|
+
export function PublicationState({ isPublished }) {
|
|
9
|
+
const { formatMessage } = useIntl();
|
|
10
|
+
const variant = isPublished ? 'success' : 'secondary';
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<Status showBullet={false} variant={variant} size="S" width="min-content">
|
|
14
|
+
<Typography fontWeight="bold" textColor={`${variant}700`}>
|
|
15
|
+
{formatMessage({
|
|
16
|
+
id: getTrad(`containers.List.${isPublished ? 'published' : 'draft'}`),
|
|
17
|
+
defaultMessage: isPublished ? 'Published' : 'Draft',
|
|
18
|
+
})}
|
|
19
|
+
</Typography>
|
|
20
|
+
</Status>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
PublicationState.propTypes = {
|
|
25
|
+
isPublished: PropTypes.bool.isRequired,
|
|
26
|
+
};
|
package/admin/src/content-manager/components/DynamicTable/CellContent/PublicationState/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './PublicationState';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { Typography } from '@strapi/design-system';
|
|
4
|
+
|
|
5
|
+
export function ReviewWorkflowsStage({ name }) {
|
|
6
|
+
return (
|
|
7
|
+
<Typography fontWeight="regular" textColor="neutral700">
|
|
8
|
+
{name}
|
|
9
|
+
</Typography>
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
ReviewWorkflowsStage.propTypes = {
|
|
14
|
+
name: PropTypes.string.isRequired,
|
|
15
|
+
};
|
package/admin/src/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ReviewWorkflowsStage';
|
|
@@ -3,9 +3,6 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import { useIntl } from 'react-intl';
|
|
4
4
|
import { DynamicTable as Table, useStrapiApp } from '@strapi/helper-plugin';
|
|
5
5
|
import { useSelector } from 'react-redux';
|
|
6
|
-
import styled from 'styled-components';
|
|
7
|
-
|
|
8
|
-
import { Status, Typography } from '@strapi/design-system';
|
|
9
6
|
|
|
10
7
|
import { INJECT_COLUMN_IN_TABLE } from '../../../exposedHooks';
|
|
11
8
|
import { selectDisplayedHeaders } from '../../pages/ListView/selectors';
|
|
@@ -13,10 +10,8 @@ import { getTrad } from '../../utils';
|
|
|
13
10
|
import TableRows from './TableRows';
|
|
14
11
|
import ConfirmDialogDeleteAll from './ConfirmDialogDeleteAll';
|
|
15
12
|
import ConfirmDialogDelete from './ConfirmDialogDelete';
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
width: min-content;
|
|
19
|
-
`;
|
|
13
|
+
import { PublicationState } from './CellContent/PublicationState/PublicationState';
|
|
14
|
+
import { ReviewWorkflowsStage } from './CellContent/ReviewWorkflowsStage';
|
|
20
15
|
|
|
21
16
|
const DynamicTable = ({
|
|
22
17
|
canCreate,
|
|
@@ -31,7 +26,8 @@ const DynamicTable = ({
|
|
|
31
26
|
rows,
|
|
32
27
|
}) => {
|
|
33
28
|
const { runHookWaterfall } = useStrapiApp();
|
|
34
|
-
const hasDraftAndPublish = layout.contentType.options
|
|
29
|
+
const hasDraftAndPublish = layout.contentType.options?.draftAndPublish ?? false;
|
|
30
|
+
const hasReviewWorkflows = layout.contentType.options?.reviewWorkflows ?? false;
|
|
35
31
|
const { formatMessage } = useIntl();
|
|
36
32
|
const displayedHeaders = useSelector(selectDisplayedHeaders);
|
|
37
33
|
|
|
@@ -42,43 +38,23 @@ const DynamicTable = ({
|
|
|
42
38
|
});
|
|
43
39
|
|
|
44
40
|
const formattedHeaders = headers.displayedHeaders.map((header) => {
|
|
45
|
-
const { metadatas } = header;
|
|
46
|
-
|
|
47
|
-
if (header.fieldSchema.type === 'relation') {
|
|
48
|
-
const sortFieldValue = `${header.name}.${header.metadatas.mainField.name}`;
|
|
49
|
-
|
|
50
|
-
return {
|
|
51
|
-
...header,
|
|
52
|
-
metadatas: {
|
|
53
|
-
...metadatas,
|
|
54
|
-
label: formatMessage({
|
|
55
|
-
id: getTrad(`containers.ListPage.table-headers.${header.name}`),
|
|
56
|
-
defaultMessage: metadatas.label,
|
|
57
|
-
}),
|
|
58
|
-
},
|
|
59
|
-
name: sortFieldValue,
|
|
60
|
-
};
|
|
61
|
-
}
|
|
41
|
+
const { fieldSchema, metadatas, name } = header;
|
|
62
42
|
|
|
63
43
|
return {
|
|
64
44
|
...header,
|
|
65
45
|
metadatas: {
|
|
66
46
|
...metadatas,
|
|
67
47
|
label: formatMessage({
|
|
68
|
-
id: getTrad(`containers.ListPage.table-headers.${
|
|
48
|
+
id: getTrad(`containers.ListPage.table-headers.${name}`),
|
|
69
49
|
defaultMessage: metadatas.label,
|
|
70
50
|
}),
|
|
71
51
|
},
|
|
52
|
+
name: fieldSchema.type === 'relation' ? `${name}.${metadatas.mainField.name}` : name,
|
|
72
53
|
};
|
|
73
54
|
});
|
|
74
55
|
|
|
75
|
-
if (
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return [
|
|
80
|
-
...formattedHeaders,
|
|
81
|
-
{
|
|
56
|
+
if (hasDraftAndPublish) {
|
|
57
|
+
formattedHeaders.push({
|
|
82
58
|
key: '__published_at_temp_key__',
|
|
83
59
|
name: 'publishedAt',
|
|
84
60
|
fieldSchema: {
|
|
@@ -92,24 +68,42 @@ const DynamicTable = ({
|
|
|
92
68
|
searchable: false,
|
|
93
69
|
sortable: true,
|
|
94
70
|
},
|
|
95
|
-
cellFormatter(
|
|
96
|
-
|
|
97
|
-
|
|
71
|
+
cellFormatter({ publishedAt }) {
|
|
72
|
+
return <PublicationState isPublished={!!publishedAt} />;
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
}
|
|
98
76
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
})}
|
|
106
|
-
</Typography>
|
|
107
|
-
</StyledStatus>
|
|
108
|
-
);
|
|
77
|
+
if (hasReviewWorkflows) {
|
|
78
|
+
formattedHeaders.push({
|
|
79
|
+
key: '__strapi_reviewWorkflows_stage_temp_key__',
|
|
80
|
+
name: 'strapi_reviewWorkflows_stage',
|
|
81
|
+
fieldSchema: {
|
|
82
|
+
type: 'custom',
|
|
109
83
|
},
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
84
|
+
metadatas: {
|
|
85
|
+
label: formatMessage({
|
|
86
|
+
id: getTrad(`containers.ListPage.table-headers.reviewWorkflows.stage`),
|
|
87
|
+
defaultMessage: 'Review stage',
|
|
88
|
+
}),
|
|
89
|
+
searchable: false,
|
|
90
|
+
sortable: false,
|
|
91
|
+
},
|
|
92
|
+
cellFormatter({ strapi_reviewWorkflows_stage }) {
|
|
93
|
+
return <ReviewWorkflowsStage name={strapi_reviewWorkflows_stage.name} />;
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return formattedHeaders;
|
|
99
|
+
}, [
|
|
100
|
+
runHookWaterfall,
|
|
101
|
+
displayedHeaders,
|
|
102
|
+
layout,
|
|
103
|
+
hasDraftAndPublish,
|
|
104
|
+
hasReviewWorkflows,
|
|
105
|
+
formatMessage,
|
|
106
|
+
]);
|
|
113
107
|
|
|
114
108
|
return (
|
|
115
109
|
<Table
|
|
@@ -41,6 +41,8 @@ const IconButtonCustom = styled(IconButton)`
|
|
|
41
41
|
}
|
|
42
42
|
`;
|
|
43
43
|
|
|
44
|
+
// TODO: Delete once https://github.com/strapi/design-system/pull/858
|
|
45
|
+
// is merged and released.
|
|
44
46
|
const StyledBox = styled(Box)`
|
|
45
47
|
> div:first-child {
|
|
46
48
|
box-shadow: ${({ theme }) => theme.shadows.tableShadow};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { useCallback } from 'react';
|
|
2
|
-
import { get } from 'lodash';
|
|
3
2
|
import { useSelector } from 'react-redux';
|
|
4
3
|
import selectLayout from '../../pages/EditViewLayoutManager/selectors';
|
|
5
4
|
|
|
@@ -8,7 +7,7 @@ const useContentTypeLayout = () => {
|
|
|
8
7
|
|
|
9
8
|
const getComponentLayout = useCallback(
|
|
10
9
|
(componentUid) => {
|
|
11
|
-
return
|
|
10
|
+
return currentLayout?.components?.[componentUid] ?? {};
|
|
12
11
|
},
|
|
13
12
|
[currentLayout]
|
|
14
13
|
);
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import cloneDeep from 'lodash/cloneDeep';
|
|
2
|
+
import get from 'lodash/get';
|
|
3
|
+
import set from 'lodash/set';
|
|
4
|
+
|
|
2
5
|
import { mergeMetasWithSchema } from '../../../utils';
|
|
3
6
|
|
|
4
7
|
const getRelationModel = (targetModel, models) => models.find((model) => model.uid === targetModel);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { memo, useMemo } from 'react';
|
|
2
2
|
import { Switch, Route } from 'react-router-dom';
|
|
3
3
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
4
|
-
import { get } from 'lodash';
|
|
5
4
|
import PropTypes from 'prop-types';
|
|
6
5
|
import { LoadingIndicatorPage, CheckPagePermissions } from '@strapi/helper-plugin';
|
|
7
6
|
import permissions from '../../../permissions';
|
|
@@ -43,7 +42,7 @@ const CollectionTypeRecursivePath = ({
|
|
|
43
42
|
return { rawContentTypeLayout, rawComponentsLayouts };
|
|
44
43
|
}, [layout]);
|
|
45
44
|
|
|
46
|
-
const uid =
|
|
45
|
+
const uid = layout?.contentType?.uid ?? null;
|
|
47
46
|
|
|
48
47
|
// This statement is needed in order to prevent the CollectionTypeFormWrapper effects clean up phase to be run twice.
|
|
49
48
|
// What can happen is that when navigating from one entry to another the cleanup phase of the fetch data effect is run twice : once when
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { get } from 'lodash';
|
|
2
|
-
|
|
3
1
|
const createPossibleMainFieldsForModelsAndComponents = (array) => {
|
|
4
2
|
return array.reduce((acc, current) => {
|
|
5
|
-
const attributes =
|
|
3
|
+
const attributes = current?.attributes ?? {};
|
|
6
4
|
const possibleMainFields = Object.keys(attributes).filter((attr) => {
|
|
7
5
|
return ![
|
|
8
6
|
'boolean',
|
|
@@ -14,7 +12,7 @@ const createPossibleMainFieldsForModelsAndComponents = (array) => {
|
|
|
14
12
|
'relation',
|
|
15
13
|
'text',
|
|
16
14
|
'richtext',
|
|
17
|
-
].includes(
|
|
15
|
+
].includes(attributes?.[attr]?.type ?? '');
|
|
18
16
|
});
|
|
19
17
|
|
|
20
18
|
acc[current.uid] = possibleMainFields;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useRef } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
3
|
import { useIntl } from 'react-intl';
|
|
4
4
|
import { useCMEditViewDataManager } from '@strapi/helper-plugin';
|
|
5
5
|
import { Box, Divider, Flex, Typography } from '@strapi/design-system';
|
|
@@ -8,23 +8,44 @@ import { getTrad } from '../../../utils';
|
|
|
8
8
|
import getUnits from './utils/getUnits';
|
|
9
9
|
import { getFullName } from '../../../../utils';
|
|
10
10
|
|
|
11
|
+
const Title = () => {
|
|
12
|
+
const { formatMessage } = useIntl();
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<Flex direction="column" alignItems="stretch" gap={2}>
|
|
16
|
+
<Typography variant="sigma" textColor="neutral600" id="additional-information">
|
|
17
|
+
{formatMessage({
|
|
18
|
+
id: getTrad('containers.Edit.information'),
|
|
19
|
+
defaultMessage: 'Information',
|
|
20
|
+
})}
|
|
21
|
+
</Typography>
|
|
22
|
+
|
|
23
|
+
<Box>
|
|
24
|
+
<Divider />
|
|
25
|
+
</Box>
|
|
26
|
+
</Flex>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
|
|
11
30
|
const KeyValuePair = ({ label, value }) => {
|
|
12
31
|
return (
|
|
13
32
|
<Flex justifyContent="space-between">
|
|
14
|
-
<Typography as="dt" fontWeight="bold" textColor="
|
|
33
|
+
<Typography as="dt" fontWeight="bold" textColor="neutral800" variant="pi">
|
|
15
34
|
{label}
|
|
16
35
|
</Typography>
|
|
17
|
-
<Typography as="dd">
|
|
36
|
+
<Typography as="dd" variant="pi" textColor="neutral600">
|
|
37
|
+
{value}
|
|
38
|
+
</Typography>
|
|
18
39
|
</Flex>
|
|
19
40
|
);
|
|
20
41
|
};
|
|
21
42
|
|
|
22
43
|
KeyValuePair.propTypes = {
|
|
23
|
-
label:
|
|
24
|
-
value:
|
|
44
|
+
label: PropTypes.string.isRequired,
|
|
45
|
+
value: PropTypes.string.isRequired,
|
|
25
46
|
};
|
|
26
47
|
|
|
27
|
-
const
|
|
48
|
+
const Body = () => {
|
|
28
49
|
const { formatMessage, formatRelativeTime } = useIntl();
|
|
29
50
|
const { initialData, isCreatingEntry } = useCMEditViewDataManager();
|
|
30
51
|
const currentTime = useRef(Date.now());
|
|
@@ -49,57 +70,60 @@ const Information = () => {
|
|
|
49
70
|
const created = getFieldInfo('createdAt', 'createdBy');
|
|
50
71
|
|
|
51
72
|
return (
|
|
52
|
-
<Flex direction="column" alignItems="stretch" gap={
|
|
53
|
-
<
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
73
|
+
<Flex direction="column" alignItems="stretch" gap={4}>
|
|
74
|
+
<Flex direction="column" alignItems="stretch" gap={2} as="dl">
|
|
75
|
+
<KeyValuePair
|
|
76
|
+
label={formatMessage({
|
|
77
|
+
id: getTrad('containers.Edit.information.created'),
|
|
78
|
+
defaultMessage: 'Created',
|
|
79
|
+
})}
|
|
80
|
+
value={created.at}
|
|
81
|
+
/>
|
|
59
82
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
83
|
+
<KeyValuePair
|
|
84
|
+
label={formatMessage({
|
|
85
|
+
id: getTrad('containers.Edit.information.by'),
|
|
86
|
+
defaultMessage: 'By',
|
|
87
|
+
})}
|
|
88
|
+
value={created.by}
|
|
89
|
+
/>
|
|
90
|
+
</Flex>
|
|
63
91
|
|
|
64
|
-
<Flex direction="column" alignItems="stretch" gap={
|
|
65
|
-
<
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
/>
|
|
81
|
-
</Flex>
|
|
82
|
-
|
|
83
|
-
<Flex direction="column" alignItems="stretch" gap={2} as="dl">
|
|
84
|
-
<KeyValuePair
|
|
85
|
-
label={formatMessage({
|
|
86
|
-
id: getTrad('containers.Edit.information.lastUpdate'),
|
|
87
|
-
defaultMessage: 'Last update',
|
|
88
|
-
})}
|
|
89
|
-
value={updated.at}
|
|
90
|
-
/>
|
|
91
|
-
|
|
92
|
-
<KeyValuePair
|
|
93
|
-
label={formatMessage({
|
|
94
|
-
id: getTrad('containers.Edit.information.by'),
|
|
95
|
-
defaultMessage: 'By',
|
|
96
|
-
})}
|
|
97
|
-
value={updated.by}
|
|
98
|
-
/>
|
|
99
|
-
</Flex>
|
|
92
|
+
<Flex direction="column" alignItems="stretch" gap={2} as="dl">
|
|
93
|
+
<KeyValuePair
|
|
94
|
+
label={formatMessage({
|
|
95
|
+
id: getTrad('containers.Edit.information.lastUpdate'),
|
|
96
|
+
defaultMessage: 'Last update',
|
|
97
|
+
})}
|
|
98
|
+
value={updated.at}
|
|
99
|
+
/>
|
|
100
|
+
|
|
101
|
+
<KeyValuePair
|
|
102
|
+
label={formatMessage({
|
|
103
|
+
id: getTrad('containers.Edit.information.by'),
|
|
104
|
+
defaultMessage: 'By',
|
|
105
|
+
})}
|
|
106
|
+
value={updated.by}
|
|
107
|
+
/>
|
|
100
108
|
</Flex>
|
|
101
109
|
</Flex>
|
|
102
110
|
);
|
|
103
111
|
};
|
|
104
112
|
|
|
105
|
-
|
|
113
|
+
const Root = ({ children }) => {
|
|
114
|
+
return (
|
|
115
|
+
<Flex direction="column" alignItems="stretch" gap={4}>
|
|
116
|
+
{children}
|
|
117
|
+
</Flex>
|
|
118
|
+
);
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
Root.propTypes = {
|
|
122
|
+
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export default {
|
|
126
|
+
Root,
|
|
127
|
+
Title,
|
|
128
|
+
Body,
|
|
129
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import Information from '../Information';
|
|
4
|
+
|
|
5
|
+
// This component is overwritten by the EE counterpart
|
|
6
|
+
export function InformationBoxCE() {
|
|
7
|
+
return (
|
|
8
|
+
<Information.Root>
|
|
9
|
+
<Information.Title />
|
|
10
|
+
<Information.Body />
|
|
11
|
+
</Information.Root>
|
|
12
|
+
);
|
|
13
|
+
}
|
|
@@ -8,19 +8,18 @@ import {
|
|
|
8
8
|
LoadingIndicatorPage,
|
|
9
9
|
} from '@strapi/helper-plugin';
|
|
10
10
|
import { useIntl } from 'react-intl';
|
|
11
|
-
import { ContentLayout, Box, Grid, GridItem, Main
|
|
11
|
+
import { ContentLayout, Box, Flex, Grid, GridItem, Main } from '@strapi/design-system';
|
|
12
12
|
import { Pencil, Layer } from '@strapi/icons';
|
|
13
|
+
import InformationBox from 'ee_else_ce/content-manager/pages/EditView/InformationBox';
|
|
13
14
|
import { InjectionZone } from '../../../shared/components';
|
|
14
15
|
import permissions from '../../../permissions';
|
|
15
16
|
import DynamicZone from '../../components/DynamicZone';
|
|
16
|
-
|
|
17
17
|
import CollectionTypeFormWrapper from '../../components/CollectionTypeFormWrapper';
|
|
18
18
|
import EditViewDataManagerProvider from '../../components/EditViewDataManagerProvider';
|
|
19
19
|
import SingleTypeFormWrapper from '../../components/SingleTypeFormWrapper';
|
|
20
20
|
import { getTrad } from '../../utils';
|
|
21
21
|
import useLazyComponents from '../../hooks/useLazyComponents';
|
|
22
22
|
import DraftAndPublishBadge from './DraftAndPublishBadge';
|
|
23
|
-
import Information from './Information';
|
|
24
23
|
import Header from './Header';
|
|
25
24
|
import { getFieldsActionMatchingPermissions } from './utils';
|
|
26
25
|
import DeleteLink from './DeleteLink';
|
|
@@ -180,7 +179,7 @@ const EditView = ({ allowedActions, isSingleType, goBack, slug, id, origin, user
|
|
|
180
179
|
paddingTop={6}
|
|
181
180
|
shadow="tableShadow"
|
|
182
181
|
>
|
|
183
|
-
<
|
|
182
|
+
<InformationBox />
|
|
184
183
|
<InjectionZone area="contentManager.editView.informations" />
|
|
185
184
|
</Box>
|
|
186
185
|
<Box as="aside" aria-labelledby="links">
|
|
@@ -6,7 +6,6 @@ import isEqual from 'react-fast-compare';
|
|
|
6
6
|
import { bindActionCreators, compose } from 'redux';
|
|
7
7
|
import { useIntl } from 'react-intl';
|
|
8
8
|
import { useHistory, useLocation, Link as ReactRouterLink } from 'react-router-dom';
|
|
9
|
-
import get from 'lodash/get';
|
|
10
9
|
import { stringify } from 'qs';
|
|
11
10
|
import axios from 'axios';
|
|
12
11
|
|
|
@@ -74,12 +73,11 @@ function ListView({
|
|
|
74
73
|
slug,
|
|
75
74
|
}) {
|
|
76
75
|
const { total } = pagination;
|
|
76
|
+
const { contentType } = layout;
|
|
77
77
|
const {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
},
|
|
82
|
-
} = layout;
|
|
78
|
+
metadatas,
|
|
79
|
+
settings: { bulkable: isBulkable, filterable: isFilterable, searchable: isSearchable },
|
|
80
|
+
} = contentType;
|
|
83
81
|
|
|
84
82
|
const toggleNotification = useNotification();
|
|
85
83
|
const { trackUsage } = useTracking();
|
|
@@ -98,8 +96,7 @@ function ListView({
|
|
|
98
96
|
const { pathname } = useLocation();
|
|
99
97
|
const { push } = useHistory();
|
|
100
98
|
const { formatMessage } = useIntl();
|
|
101
|
-
const
|
|
102
|
-
const hasDraftAndPublish = get(contentType, 'options.draftAndPublish', false);
|
|
99
|
+
const hasDraftAndPublish = contentType.options?.draftAndPublish ?? false;
|
|
103
100
|
const fetchClient = useFetchClient();
|
|
104
101
|
const { post, del } = fetchClient;
|
|
105
102
|
|
|
@@ -137,7 +134,7 @@ function ListView({
|
|
|
137
134
|
return;
|
|
138
135
|
}
|
|
139
136
|
|
|
140
|
-
const resStatus =
|
|
137
|
+
const resStatus = err?.response?.status ?? null;
|
|
141
138
|
|
|
142
139
|
if (resStatus === 403) {
|
|
143
140
|
await fetchPermissionsRef.current();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import get from 'lodash/get';
|
|
2
2
|
|
|
3
3
|
const createDefaultForm = (attributes, allComponentsSchema) => {
|
|
4
4
|
return Object.keys(attributes).reduce((acc, current) => {
|
|
@@ -10,7 +10,7 @@ const createDefaultForm = (attributes, allComponentsSchema) => {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
if (type === 'component') {
|
|
13
|
-
const currentComponentSchema =
|
|
13
|
+
const currentComponentSchema = allComponentsSchema?.[component]?.attributes ?? {};
|
|
14
14
|
const currentComponentDefaultForm = createDefaultForm(
|
|
15
15
|
currentComponentSchema,
|
|
16
16
|
allComponentsSchema
|