@strapi/admin 4.12.6 → 4.13.0-alpha.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/StrapiApp.js +1 -1
- package/admin/src/components/AuthenticatedApp/index.js +118 -0
- package/admin/src/components/AuthenticatedApp/utils/api.js +85 -0
- package/admin/src/components/AuthenticatedApp/utils/checkLatestStrapiVersion.js +11 -0
- package/admin/src/components/GuidedTour/Modal/index.js +3 -1
- package/admin/src/components/NpsSurvey/hooks/useNpsSurveySettings.js +17 -0
- package/admin/src/components/NpsSurvey/index.js +365 -0
- package/admin/src/components/PluginsInitializer/index.js +68 -0
- package/admin/src/components/PluginsInitializer/init.js +11 -0
- package/admin/src/components/PluginsInitializer/reducer.js +22 -0
- package/admin/src/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/getTableColumns.js +2 -0
- package/admin/src/content-manager/components/DynamicZone/components/DynamicZoneLabel.js +1 -1
- package/admin/src/content-manager/components/EditViewDataManagerProvider/reducer.js +8 -1
- package/admin/src/content-manager/components/Filter/CustomInputs/AdminUsersFilter.js +42 -0
- package/admin/src/content-manager/components/Filter/Filter.js +54 -0
- package/admin/src/content-manager/components/Filter/index.js +1 -0
- package/admin/src/content-manager/components/InputUID/index.js +222 -216
- package/admin/src/content-manager/components/RelationInput/RelationInput.js +4 -0
- package/admin/src/content-manager/components/RepeatableComponent/index.js +32 -2
- package/admin/src/content-manager/components/Wysiwyg/Editor.js +432 -68
- package/admin/src/content-manager/components/Wysiwyg/WysiwygStyles.js +0 -7
- package/admin/src/content-manager/components/Wysiwyg/index.js +147 -152
- package/admin/src/content-manager/hooks/useAllowedAttributes.js +47 -0
- package/admin/src/content-manager/pages/App/index.js +16 -5
- package/admin/src/content-manager/pages/EditView/Information/index.js +9 -8
- package/admin/src/content-manager/pages/ListSettingsView/components/Settings.js +40 -7
- package/admin/src/content-manager/pages/ListSettingsView/index.js +6 -2
- package/admin/src/content-manager/pages/ListView/components/BulkActionButtons/SelectedEntriesModal/index.js +2 -2
- package/admin/src/content-manager/pages/ListView/components/FieldPicker/index.js +67 -69
- package/admin/src/content-manager/pages/ListView/components/TableRows/index.js +1 -1
- package/admin/src/content-manager/pages/ListView/components/ViewSettingsMenu/index.js +80 -0
- package/admin/src/content-manager/pages/ListView/index.js +236 -67
- package/admin/src/content-manager/utils/getDisplayName.js +33 -0
- package/admin/src/content-manager/utils/index.js +1 -0
- package/admin/src/hooks/useSettingsForm/index.js +3 -14
- package/admin/src/hooks/useSettingsMenu/index.js +2 -2
- package/admin/src/hooks/useSettingsMenu/utils/formatLinks.js +3 -1
- package/admin/src/hooks/useSettingsMenu/utils/sortLinks.js +3 -1
- package/admin/src/index.js +1 -1
- package/admin/src/layouts/AppLayout/index.js +33 -0
- package/admin/src/pages/Admin/Onboarding/index.js +3 -1
- package/admin/src/pages/Admin/index.js +73 -77
- package/admin/src/pages/App/constants.js +1 -1
- package/admin/src/pages/App/index.js +122 -160
- package/admin/src/pages/AuthPage/components/Register/index.js +5 -0
- package/admin/src/pages/AuthPage/index.js +4 -2
- package/admin/src/pages/HomePage/index.js +3 -1
- package/admin/src/pages/InstalledPluginsPage/index.js +3 -1
- package/admin/src/pages/{InternalErrorPage.js → InternalErrorPage/index.js} +4 -3
- package/admin/src/pages/{NotFoundPage.js → NotFoundPage/index.js} +3 -1
- package/admin/src/pages/ProfilePage/index.js +4 -2
- package/admin/src/pages/SettingsPage/constants.js +132 -67
- package/admin/src/pages/SettingsPage/index.js +18 -23
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Users/EditPage/index.js +1 -2
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/DynamicTable/TableRows/index.js +1 -1
- package/admin/src/pages/UseCasePage/index.js +175 -0
- package/admin/src/plugins.js +7 -8
- package/admin/src/translations/en.json +10 -1
- package/admin/src/utils/checkFormValidity.js +15 -0
- package/admin/src/utils/createRoute.js +7 -5
- package/admin/src/utils/formatAPIErrors.js +3 -1
- package/admin/src/utils/getAttributesToDisplay.js +19 -0
- package/admin/src/utils/getExistingActions.js +32 -0
- package/admin/src/utils/getFullName.js +1 -1
- package/admin/src/utils/index.js +9 -0
- package/admin/src/utils/makeUniqueRoutes.js +6 -0
- package/admin/src/utils/sortLinks.js +3 -1
- package/admin/src/utils/uniqueAdminHash.js +9 -2
- package/build/{1049.9d69d231.chunk.js → 1049.ec69f5e0.chunk.js} +1 -1
- package/build/1227.9f37e1dc.chunk.js +1 -0
- package/build/1386.ea73b677.chunk.js +7 -0
- package/build/{2225.33287e1b.chunk.js → 2225.649fb7bc.chunk.js} +2 -2
- package/build/{2237.03792b63.chunk.js → 2237.b832ae6e.chunk.js} +4 -4
- package/build/{2379.401f56f3.chunk.js → 2379.1f98a31a.chunk.js} +1 -1
- package/build/{2395.e6a79fbb.chunk.js → 2395.0e5e8ded.chunk.js} +1 -1
- package/build/{2801.31393ffe.chunk.js → 2801.8e1aa82a.chunk.js} +1 -1
- package/build/3483.19381b40.chunk.js +1 -0
- package/build/3739.63e352f1.chunk.js +103 -0
- package/build/4174.f1f39e40.chunk.js +1 -0
- package/build/448.829e1344.chunk.js +1 -0
- package/build/4546.a5946d22.chunk.js +1 -0
- package/build/4724.aea5c8c1.chunk.js +6 -0
- package/build/{502.8dd074ff.chunk.js → 502.7bba43b1.chunk.js} +1 -1
- package/build/6158.c3c13c20.chunk.js +1 -0
- package/build/6691.4985ef22.chunk.js +105 -0
- package/build/{7464.592a9295.chunk.js → 7464.eb057bec.chunk.js} +1 -1
- package/build/78.dcc6df5c.chunk.js +1 -0
- package/build/{8276.e519a707.chunk.js → 8276.be3ed581.chunk.js} +2 -2
- package/build/{2747.d1442a90.chunk.js → 9806.5d5a0e8d.chunk.js} +64 -72
- package/build/9944.7af075a5.chunk.js +26 -0
- package/build/Admin-authenticatedApp.43b6ec9a.chunk.js +79 -0
- package/build/Admin_InternalErrorPage.38155af3.chunk.js +1 -0
- package/build/Admin_homePage.6f128523.chunk.js +81 -0
- package/build/Admin_marketplace.061a6e5a.chunk.js +55 -0
- package/build/Admin_pluginsPage.16f837b8.chunk.js +6 -0
- package/build/Admin_profilePage.678bce24.chunk.js +13 -0
- package/build/Admin_settingsPage.af7309e4.chunk.js +111 -0
- package/build/{Upload_ConfigureTheView.345ac1e0.chunk.js → Upload_ConfigureTheView.3fc1c100.chunk.js} +1 -1
- package/build/admin-app.d63bd229.chunk.js +36 -0
- package/build/{admin-edit-roles-page.24bdf746.chunk.js → admin-edit-roles-page.38a6c863.chunk.js} +3 -3
- package/build/admin-edit-users.545fc882.chunk.js +10 -0
- package/build/{admin-roles-list.23ddff26.chunk.js → admin-roles-list.1e2e814d.chunk.js} +1 -1
- package/build/admin-users.b8ea5677.chunk.js +11 -0
- package/build/{api-tokens-create-page.46c2ea84.chunk.js → api-tokens-create-page.e0c15627.chunk.js} +1 -1
- package/build/{api-tokens-edit-page.58139df9.chunk.js → api-tokens-edit-page.9f2dce47.chunk.js} +1 -1
- package/build/{api-tokens-list-page.0af7d431.chunk.js → api-tokens-list-page.d747051c.chunk.js} +2 -2
- package/build/{audit-logs-settings-page.0f73ccf8.chunk.js → audit-logs-settings-page.96f9d608.chunk.js} +1 -1
- package/build/content-manager.ccff1078.chunk.js +1097 -0
- package/build/{content-type-builder-list-view.bf9be456.chunk.js → content-type-builder-list-view.b71cf240.chunk.js} +1 -1
- package/build/{content-type-builder.66066281.chunk.js → content-type-builder.e5669749.chunk.js} +18 -18
- package/build/{email-settings-page.2f7e35c0.chunk.js → email-settings-page.2809f0bf.chunk.js} +1 -1
- package/build/en-json.e12fd5fc.chunk.js +1 -0
- package/build/{i18n-settings-page.47f78016.chunk.js → i18n-settings-page.5f716172.chunk.js} +1 -1
- package/build/index.html +1 -1
- package/build/main.c6c9e04c.js +2859 -0
- package/build/{review-workflows-settings-create-view.d24a32b9.chunk.js → review-workflows-settings-create-view.4a156a19.chunk.js} +1 -1
- package/build/{review-workflows-settings-edit-view.6044b022.chunk.js → review-workflows-settings-edit-view.ce984d1f.chunk.js} +1 -1
- package/build/{review-workflows-settings-list-view.3f0ef4bc.chunk.js → review-workflows-settings-list-view.419b8deb.chunk.js} +2 -2
- package/build/runtime~main.dcf1cb45.js +2 -0
- package/build/{sso-settings-page.4dba0670.chunk.js → sso-settings-page.45153df5.chunk.js} +1 -1
- package/build/{transfer-tokens-create-page.1597e6ab.chunk.js → transfer-tokens-create-page.ebba16d8.chunk.js} +1 -1
- package/build/{transfer-tokens-edit-page.8741529f.chunk.js → transfer-tokens-edit-page.d7bb2b3e.chunk.js} +1 -1
- package/build/{transfer-tokens-list-page.d6986b03.chunk.js → transfer-tokens-list-page.cfe1736c.chunk.js} +2 -2
- package/build/{upload-settings.7f93d4c0.chunk.js → upload-settings.cc5ad813.chunk.js} +1 -1
- package/build/{upload.37488080.chunk.js → upload.756efc28.chunk.js} +1 -1
- package/build/{users-advanced-settings-page.17052d72.chunk.js → users-advanced-settings-page.818d84eb.chunk.js} +1 -1
- package/build/{users-email-settings-page.3de8ea50.chunk.js → users-email-settings-page.c1967c09.chunk.js} +1 -1
- package/build/{users-providers-settings-page.0eaa916d.chunk.js → users-providers-settings-page.11893e08.chunk.js} +1 -1
- package/build/{users-roles-settings-page.957ad48b.chunk.js → users-roles-settings-page.2b051e6a.chunk.js} +1 -1
- package/build/webhook-edit-page.de45c635.chunk.js +33 -0
- package/build/{webhook-list-page.65e1b5bb.chunk.js → webhook-list-page.ca91df8b.chunk.js} +1 -1
- package/ee/admin/content-manager/components/Filter/CustomInputs/ReviewWorkflows/AssigneeFilter.js +42 -0
- package/ee/admin/content-manager/components/Filter/CustomInputs/ReviewWorkflows/StageFilter.js +70 -0
- package/ee/admin/content-manager/components/Filter/CustomInputs/ReviewWorkflows/constants.js +71 -0
- package/ee/admin/content-manager/pages/EditView/InformationBox/InformationBoxEE.js +9 -217
- package/ee/admin/content-manager/pages/EditView/InformationBox/components/AssigneeSelect/AssigneeSelect.js +147 -0
- package/ee/admin/content-manager/pages/EditView/InformationBox/components/AssigneeSelect/index.js +1 -0
- package/ee/admin/content-manager/pages/EditView/InformationBox/components/StageSelect/StageSelect.js +243 -0
- package/ee/admin/content-manager/pages/EditView/InformationBox/components/StageSelect/index.js +1 -0
- package/ee/admin/content-manager/pages/EditView/InformationBox/constants.js +2 -0
- package/ee/admin/content-manager/pages/ListSettingsView/constants.js +7 -0
- package/ee/admin/content-manager/pages/ListView/ReviewWorkflowsColumn/ReviewWorkflowsAssigneeEE.js +21 -0
- package/ee/admin/content-manager/pages/ListView/ReviewWorkflowsColumn/constants.js +44 -17
- package/ee/admin/content-manager/pages/ListView/ReviewWorkflowsColumn/index.js +1 -0
- package/ee/admin/pages/App/constants.js +5 -6
- package/ee/admin/pages/SettingsPage/constants.js +42 -27
- package/ee/server/constants/workflows.js +1 -0
- package/ee/server/controllers/index.js +1 -0
- package/ee/server/controllers/workflows/assignees/index.js +44 -0
- package/ee/server/routes/review-workflows.js +17 -0
- package/ee/server/services/index.js +1 -0
- package/ee/server/services/review-workflows/assignees.js +54 -0
- package/ee/server/services/review-workflows/metrics/index.js +5 -0
- package/ee/server/services/review-workflows/review-workflows.js +20 -11
- package/ee/server/validation/review-workflows.js +8 -0
- package/index.js +2 -6
- package/package.json +9 -9
- package/scripts/build.js +15 -15
- package/scripts/create-dev-plugins-file.js +5 -38
- package/server/controllers/role.js +2 -0
- package/server/controllers/user.js +2 -0
- package/server/services/permission/permissions-manager/index.js +3 -1
- package/server/services/permission/permissions-manager/sanitize.js +19 -7
- package/server/services/permission/permissions-manager/validate.js +218 -0
- package/utils/create-cache-dir.js +62 -16
- package/utils/create-plugins-exclude-path.js +3 -23
- package/utils/get-plugins.js +110 -0
- package/utils/index.js +1 -1
- package/webpack.config.js +10 -13
- package/admin/src/components/AuthenticatedApp.js +0 -229
- package/admin/src/content-manager/components/AttributeFilter/Filters.js +0 -58
- package/admin/src/content-manager/components/AttributeFilter/hooks/useAllowedAttributes.js +0 -42
- package/admin/src/content-manager/components/AttributeFilter/index.js +0 -40
- package/admin/src/content-manager/components/Wysiwyg/EditorStylesContainer.js +0 -344
- package/admin/src/pages/UseCasePage.js +0 -174
- package/build/2166.c837469a.chunk.js +0 -1
- package/build/3483.8517171f.chunk.js +0 -1
- package/build/3984.dda474f7.chunk.js +0 -1
- package/build/4546.7a3c0d03.chunk.js +0 -1
- package/build/5483.5bfbb00d.chunk.js +0 -6
- package/build/6158.c974fd83.chunk.js +0 -1
- package/build/748.fd2e5afd.chunk.js +0 -105
- package/build/773.6381d62d.chunk.js +0 -18
- package/build/7826.399afe81.chunk.js +0 -103
- package/build/8261.2525d35c.chunk.js +0 -7
- package/build/8299.62b67c72.chunk.js +0 -1
- package/build/Admin-AuthPage.90d64342.chunk.js +0 -35
- package/build/Admin-AuthenticatedApp.379ac945.chunk.js +0 -24
- package/build/Admin-UseCasePage.1f757db5.chunk.js +0 -13
- package/build/Admin_GuidedTourModal.8ccf1fbc.chunk.js +0 -12
- package/build/Admin_InternalErrorPage.9de92c6d.chunk.js +0 -9
- package/build/Admin_NotFoundPage.21620424.chunk.js +0 -9
- package/build/Admin_Onboarding.dbfa32f6.chunk.js +0 -43
- package/build/Admin_homePage.2000cbe9.chunk.js +0 -86
- package/build/Admin_marketplace.ec80e29b.chunk.js +0 -63
- package/build/Admin_pluginsPage.0c6851f8.chunk.js +0 -14
- package/build/Admin_profilePage.78cd8495.chunk.js +0 -21
- package/build/Admin_settingsPage.1760c3ce.chunk.js +0 -119
- package/build/StrapiApp.221fac30.chunk.js +0 -5
- package/build/admin-edit-users.5d10d444.chunk.js +0 -10
- package/build/admin-users.2b3e4305.chunk.js +0 -11
- package/build/content-manager.fb0833bd.chunk.js +0 -1099
- package/build/en-json.08c05fcf.chunk.js +0 -1
- package/build/main.ee3c1938.js +0 -2859
- package/build/runtime~main.397ee447.js +0 -2
- package/build/webhook-edit-page.665210af.chunk.js +0 -33
- package/scripts/create-plugins-file.js +0 -92
- package/utils/get-plugins-path.js +0 -41
- /package/server/services/permission/permissions-manager/{query-builers.js → query-builders.js} +0 -0
package/ee/admin/content-manager/pages/EditView/InformationBox/components/StageSelect/StageSelect.js
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
SingleSelect,
|
|
5
|
+
SingleSelectOption,
|
|
6
|
+
Field,
|
|
7
|
+
FieldError,
|
|
8
|
+
Flex,
|
|
9
|
+
Loader,
|
|
10
|
+
Typography,
|
|
11
|
+
} from '@strapi/design-system';
|
|
12
|
+
import {
|
|
13
|
+
useCMEditViewDataManager,
|
|
14
|
+
useAPIErrorHandler,
|
|
15
|
+
useFetchClient,
|
|
16
|
+
useNotification,
|
|
17
|
+
} from '@strapi/helper-plugin';
|
|
18
|
+
import { useIntl } from 'react-intl';
|
|
19
|
+
import { useMutation } from 'react-query';
|
|
20
|
+
|
|
21
|
+
import { useLicenseLimits } from '../../../../../../hooks/useLicenseLimits';
|
|
22
|
+
import * as LimitsModal from '../../../../../../pages/SettingsPage/pages/ReviewWorkflows/components/LimitsModal';
|
|
23
|
+
import {
|
|
24
|
+
CHARGEBEE_STAGES_PER_WORKFLOW_ENTITLEMENT_NAME,
|
|
25
|
+
CHARGEBEE_WORKFLOW_ENTITLEMENT_NAME,
|
|
26
|
+
} from '../../../../../../pages/SettingsPage/pages/ReviewWorkflows/constants';
|
|
27
|
+
import { useReviewWorkflows } from '../../../../../../pages/SettingsPage/pages/ReviewWorkflows/hooks/useReviewWorkflows';
|
|
28
|
+
import { getStageColorByHex } from '../../../../../../pages/SettingsPage/pages/ReviewWorkflows/utils/colors';
|
|
29
|
+
import { STAGE_ATTRIBUTE_NAME } from '../../constants';
|
|
30
|
+
|
|
31
|
+
export function StageSelect() {
|
|
32
|
+
const {
|
|
33
|
+
initialData,
|
|
34
|
+
layout: { uid },
|
|
35
|
+
isSingleType,
|
|
36
|
+
onChange,
|
|
37
|
+
} = useCMEditViewDataManager();
|
|
38
|
+
const { put } = useFetchClient();
|
|
39
|
+
const { formatMessage } = useIntl();
|
|
40
|
+
const { formatAPIError } = useAPIErrorHandler();
|
|
41
|
+
const toggleNotification = useNotification();
|
|
42
|
+
const {
|
|
43
|
+
meta,
|
|
44
|
+
workflows: [workflow],
|
|
45
|
+
isLoading,
|
|
46
|
+
} = useReviewWorkflows({ filters: { contentTypes: uid } });
|
|
47
|
+
const { getFeature } = useLicenseLimits();
|
|
48
|
+
const [showLimitModal, setShowLimitModal] = React.useState(false);
|
|
49
|
+
|
|
50
|
+
const limits = getFeature('review-workflows');
|
|
51
|
+
// it is possible to rely on initialData here, because it always will
|
|
52
|
+
// be updated at the same time when modifiedData is updated, otherwise
|
|
53
|
+
// the entity is flagged as modified
|
|
54
|
+
const activeWorkflowStage = initialData?.[STAGE_ATTRIBUTE_NAME] ?? null;
|
|
55
|
+
|
|
56
|
+
const mutation = useMutation(
|
|
57
|
+
async ({ entityId, stageId, uid }) => {
|
|
58
|
+
const typeSlug = isSingleType ? 'single-types' : 'collection-types';
|
|
59
|
+
|
|
60
|
+
const {
|
|
61
|
+
data: { data: createdEntity },
|
|
62
|
+
} = await put(`/admin/content-manager/${typeSlug}/${uid}/${entityId}/stage`, {
|
|
63
|
+
data: { id: stageId },
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
// initialData and modifiedData have to stay in sync, otherwise the entity would be flagged
|
|
67
|
+
// as modified, which is what the boolean flag is for
|
|
68
|
+
onChange(
|
|
69
|
+
{ target: { name: STAGE_ATTRIBUTE_NAME, value: createdEntity[STAGE_ATTRIBUTE_NAME] } },
|
|
70
|
+
true
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
return createdEntity;
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
onSuccess() {
|
|
77
|
+
toggleNotification({
|
|
78
|
+
type: 'success',
|
|
79
|
+
message: {
|
|
80
|
+
id: 'content-manager.reviewWorkflows.stage.notification.saved',
|
|
81
|
+
defaultMessage: 'Review stage updated',
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
const handleChange = async ({ value: stageId }) => {
|
|
89
|
+
try {
|
|
90
|
+
/**
|
|
91
|
+
* If the current license has a limit:
|
|
92
|
+
* check if the total count of workflows exceeds that limit and display
|
|
93
|
+
* the limits modal.
|
|
94
|
+
*
|
|
95
|
+
* If the current license does not have a limit (e.g. offline license):
|
|
96
|
+
* do nothing (for now).
|
|
97
|
+
*
|
|
98
|
+
*/
|
|
99
|
+
|
|
100
|
+
if (
|
|
101
|
+
limits?.[CHARGEBEE_WORKFLOW_ENTITLEMENT_NAME] &&
|
|
102
|
+
parseInt(limits[CHARGEBEE_WORKFLOW_ENTITLEMENT_NAME], 10) < meta.workflowCount
|
|
103
|
+
) {
|
|
104
|
+
setShowLimitModal('workflow');
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* If the current license has a limit:
|
|
108
|
+
* check if the total count of stages exceeds that limit and display
|
|
109
|
+
* the limits modal.
|
|
110
|
+
*
|
|
111
|
+
* If the current license does not have a limit (e.g. offline license):
|
|
112
|
+
* do nothing (for now).
|
|
113
|
+
*
|
|
114
|
+
*/
|
|
115
|
+
} else if (
|
|
116
|
+
limits?.[CHARGEBEE_STAGES_PER_WORKFLOW_ENTITLEMENT_NAME] &&
|
|
117
|
+
parseInt(limits[CHARGEBEE_STAGES_PER_WORKFLOW_ENTITLEMENT_NAME], 10) <
|
|
118
|
+
workflow.stages.length
|
|
119
|
+
) {
|
|
120
|
+
setShowLimitModal('stage');
|
|
121
|
+
} else {
|
|
122
|
+
mutation.mutateAsync({
|
|
123
|
+
entityId: initialData.id,
|
|
124
|
+
stageId,
|
|
125
|
+
uid,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
} catch (error) {
|
|
129
|
+
// react-query@v3: the error doesn't have to be handled here
|
|
130
|
+
// see: https://github.com/TanStack/query/issues/121
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
const { themeColorName } = activeWorkflowStage?.color
|
|
135
|
+
? getStageColorByHex(activeWorkflowStage?.color)
|
|
136
|
+
: {};
|
|
137
|
+
|
|
138
|
+
return (
|
|
139
|
+
<>
|
|
140
|
+
<Field name={STAGE_ATTRIBUTE_NAME} id={STAGE_ATTRIBUTE_NAME}>
|
|
141
|
+
<Flex direction="column" gap={2} alignItems="stretch">
|
|
142
|
+
<SingleSelect
|
|
143
|
+
error={(mutation.error && formatAPIError(mutation.error)) || null}
|
|
144
|
+
name={STAGE_ATTRIBUTE_NAME}
|
|
145
|
+
id={STAGE_ATTRIBUTE_NAME}
|
|
146
|
+
value={activeWorkflowStage?.id}
|
|
147
|
+
onChange={(value) => handleChange({ value })}
|
|
148
|
+
label={formatMessage({
|
|
149
|
+
id: 'content-manager.reviewWorkflows.stage.label',
|
|
150
|
+
defaultMessage: 'Review stage',
|
|
151
|
+
})}
|
|
152
|
+
startIcon={
|
|
153
|
+
<Flex
|
|
154
|
+
as="span"
|
|
155
|
+
height={2}
|
|
156
|
+
background={activeWorkflowStage?.color}
|
|
157
|
+
borderColor={themeColorName === 'neutral0' ? 'neutral150' : 'transparent'}
|
|
158
|
+
hasRadius
|
|
159
|
+
shrink={0}
|
|
160
|
+
width={2}
|
|
161
|
+
marginRight="-3px"
|
|
162
|
+
/>
|
|
163
|
+
}
|
|
164
|
+
// eslint-disable-next-line react/no-unstable-nested-components
|
|
165
|
+
customizeContent={() => (
|
|
166
|
+
<Flex as="span" justifyContent="space-between" alignItems="center" width="100%">
|
|
167
|
+
<Typography textColor="neutral800" ellipsis>
|
|
168
|
+
{activeWorkflowStage?.name}
|
|
169
|
+
</Typography>
|
|
170
|
+
{isLoading ? <Loader small style={{ display: 'flex' }} /> : null}
|
|
171
|
+
</Flex>
|
|
172
|
+
)}
|
|
173
|
+
>
|
|
174
|
+
{workflow
|
|
175
|
+
? workflow.stages.map(({ id, color, name }) => {
|
|
176
|
+
const { themeColorName } = getStageColorByHex(color);
|
|
177
|
+
|
|
178
|
+
return (
|
|
179
|
+
<SingleSelectOption
|
|
180
|
+
key={id}
|
|
181
|
+
startIcon={
|
|
182
|
+
<Flex
|
|
183
|
+
height={2}
|
|
184
|
+
background={color}
|
|
185
|
+
borderColor={themeColorName === 'neutral0' ? 'neutral150' : 'transparent'}
|
|
186
|
+
hasRadius
|
|
187
|
+
shrink={0}
|
|
188
|
+
width={2}
|
|
189
|
+
/>
|
|
190
|
+
}
|
|
191
|
+
value={id}
|
|
192
|
+
textValue={name}
|
|
193
|
+
>
|
|
194
|
+
{name}
|
|
195
|
+
</SingleSelectOption>
|
|
196
|
+
);
|
|
197
|
+
})
|
|
198
|
+
: []}
|
|
199
|
+
</SingleSelect>
|
|
200
|
+
<FieldError />
|
|
201
|
+
</Flex>
|
|
202
|
+
</Field>
|
|
203
|
+
|
|
204
|
+
<LimitsModal.Root
|
|
205
|
+
isOpen={showLimitModal === 'workflow'}
|
|
206
|
+
onClose={() => setShowLimitModal(false)}
|
|
207
|
+
>
|
|
208
|
+
<LimitsModal.Title>
|
|
209
|
+
{formatMessage({
|
|
210
|
+
id: 'content-manager.reviewWorkflows.workflows.limit.title',
|
|
211
|
+
defaultMessage: 'You’ve reached the limit of workflows in your plan',
|
|
212
|
+
})}
|
|
213
|
+
</LimitsModal.Title>
|
|
214
|
+
|
|
215
|
+
<LimitsModal.Body>
|
|
216
|
+
{formatMessage({
|
|
217
|
+
id: 'content-manager.reviewWorkflows.workflows.limit.body',
|
|
218
|
+
defaultMessage: 'Delete a workflow or contact Sales to enable more workflows.',
|
|
219
|
+
})}
|
|
220
|
+
</LimitsModal.Body>
|
|
221
|
+
</LimitsModal.Root>
|
|
222
|
+
|
|
223
|
+
<LimitsModal.Root
|
|
224
|
+
isOpen={showLimitModal === 'stage'}
|
|
225
|
+
onClose={() => setShowLimitModal(false)}
|
|
226
|
+
>
|
|
227
|
+
<LimitsModal.Title>
|
|
228
|
+
{formatMessage({
|
|
229
|
+
id: 'content-manager.reviewWorkflows.stages.limit.title',
|
|
230
|
+
defaultMessage: 'You have reached the limit of stages for this workflow in your plan',
|
|
231
|
+
})}
|
|
232
|
+
</LimitsModal.Title>
|
|
233
|
+
|
|
234
|
+
<LimitsModal.Body>
|
|
235
|
+
{formatMessage({
|
|
236
|
+
id: 'content-manager.reviewWorkflows.stages.limit.body',
|
|
237
|
+
defaultMessage: 'Try deleting some stages or contact Sales to enable more stages.',
|
|
238
|
+
})}
|
|
239
|
+
</LimitsModal.Body>
|
|
240
|
+
</LimitsModal.Root>
|
|
241
|
+
</>
|
|
242
|
+
);
|
|
243
|
+
}
|
package/ee/admin/content-manager/pages/EditView/InformationBox/components/StageSelect/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './StageSelect';
|
package/ee/admin/content-manager/pages/ListView/ReviewWorkflowsColumn/ReviewWorkflowsAssigneeEE.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { Typography } from '@strapi/design-system';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import { useIntl } from 'react-intl';
|
|
6
|
+
|
|
7
|
+
import { getDisplayName } from '../../../../../../admin/src/content-manager/utils';
|
|
8
|
+
|
|
9
|
+
export function ReviewWorkflowsAssigneeEE({ user }) {
|
|
10
|
+
const { formatMessage } = useIntl();
|
|
11
|
+
|
|
12
|
+
return <Typography textColor="neutral800">{getDisplayName(user, formatMessage)}</Typography>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
ReviewWorkflowsAssigneeEE.propTypes = {
|
|
16
|
+
user: PropTypes.shape({
|
|
17
|
+
firstname: PropTypes.string,
|
|
18
|
+
lastname: PropTypes.string,
|
|
19
|
+
username: PropTypes.string,
|
|
20
|
+
}).isRequired,
|
|
21
|
+
};
|
|
@@ -1,24 +1,51 @@
|
|
|
1
1
|
import getTrad from '../../../../../../admin/src/content-manager/utils/getTrad';
|
|
2
|
+
import {
|
|
3
|
+
ASSIGNEE_ATTRIBUTE_NAME,
|
|
4
|
+
STAGE_ATTRIBUTE_NAME,
|
|
5
|
+
} from '../../EditView/InformationBox/constants';
|
|
2
6
|
|
|
3
|
-
export const REVIEW_WORKFLOW_COLUMNS_EE =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
export const REVIEW_WORKFLOW_COLUMNS_EE = [
|
|
8
|
+
{
|
|
9
|
+
key: `__${STAGE_ATTRIBUTE_NAME}_temp_key__`,
|
|
10
|
+
name: STAGE_ATTRIBUTE_NAME,
|
|
11
|
+
fieldSchema: {
|
|
12
|
+
type: 'relation',
|
|
13
|
+
},
|
|
14
|
+
metadatas: {
|
|
15
|
+
// formatMessage() will be applied when the column is rendered
|
|
16
|
+
label: {
|
|
17
|
+
id: getTrad(`containers.ListPage.table-headers.reviewWorkflows.stage`),
|
|
18
|
+
defaultMessage: 'Review stage',
|
|
19
|
+
},
|
|
20
|
+
searchable: false,
|
|
21
|
+
sortable: true,
|
|
22
|
+
mainField: {
|
|
23
|
+
name: 'name',
|
|
24
|
+
schema: {
|
|
25
|
+
type: 'string',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
8
29
|
},
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
30
|
+
{
|
|
31
|
+
key: `__${ASSIGNEE_ATTRIBUTE_NAME}_temp_key__`,
|
|
32
|
+
name: ASSIGNEE_ATTRIBUTE_NAME,
|
|
33
|
+
fieldSchema: {
|
|
34
|
+
type: 'relation',
|
|
14
35
|
},
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
36
|
+
metadatas: {
|
|
37
|
+
label: {
|
|
38
|
+
id: getTrad(`containers.ListPage.table-headers.reviewWorkflows.assignee`),
|
|
39
|
+
defaultMessage: 'Assignee',
|
|
40
|
+
},
|
|
41
|
+
searchable: false,
|
|
42
|
+
sortable: true,
|
|
43
|
+
mainField: {
|
|
44
|
+
name: 'firstname',
|
|
45
|
+
schema: {
|
|
46
|
+
type: 'string',
|
|
47
|
+
},
|
|
21
48
|
},
|
|
22
49
|
},
|
|
23
50
|
},
|
|
24
|
-
|
|
51
|
+
];
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { AuthResponse } from '../AuthResponse';
|
|
2
2
|
|
|
3
|
-
export const
|
|
3
|
+
export const ROUTES_EE = [
|
|
4
4
|
{
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
path: '/auth/login/:authResponse',
|
|
5
|
+
Component: () => ({ default: AuthResponse }),
|
|
6
|
+
to: '/auth/login/:authResponse',
|
|
7
|
+
exact: true,
|
|
9
8
|
},
|
|
10
9
|
];
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export const SETTINGS_ROUTES_EE = [
|
|
1
|
+
export const ROUTES_EE = [
|
|
4
2
|
...(window.strapi.features.isEnabled(window.strapi.features.AUDIT_LOGS)
|
|
5
3
|
? [
|
|
6
4
|
{
|
|
7
|
-
|
|
8
|
-
import(
|
|
5
|
+
async Component() {
|
|
6
|
+
const component = await import(
|
|
9
7
|
/* webpackChunkName: "audit-logs-settings-page" */ './pages/AuditLogs/ProtectedListPage'
|
|
10
|
-
)
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
return component;
|
|
11
|
+
},
|
|
12
|
+
to: '/settings/audit-logs',
|
|
13
|
+
exact: true,
|
|
13
14
|
},
|
|
14
15
|
]
|
|
15
16
|
: []),
|
|
@@ -17,30 +18,39 @@ export const SETTINGS_ROUTES_EE = [
|
|
|
17
18
|
...(window.strapi.features.isEnabled(window.strapi.features.REVIEW_WORKFLOWS)
|
|
18
19
|
? [
|
|
19
20
|
{
|
|
20
|
-
|
|
21
|
-
import(
|
|
21
|
+
async Component() {
|
|
22
|
+
const component = await import(
|
|
22
23
|
/* webpackChunkName: "review-workflows-settings-list-view" */ './pages/ReviewWorkflows/pages/ListView'
|
|
23
|
-
)
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
return component;
|
|
27
|
+
},
|
|
28
|
+
to: '/settings/review-workflows',
|
|
29
|
+
exact: true,
|
|
26
30
|
},
|
|
27
31
|
|
|
28
32
|
{
|
|
29
|
-
|
|
30
|
-
import(
|
|
33
|
+
async Component() {
|
|
34
|
+
const component = await import(
|
|
31
35
|
/* webpackChunkName: "review-workflows-settings-create-view" */ './pages/ReviewWorkflows/pages/CreateView'
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
return component;
|
|
39
|
+
},
|
|
40
|
+
to: '/settings/review-workflows/create',
|
|
41
|
+
exact: true,
|
|
35
42
|
},
|
|
36
43
|
|
|
37
44
|
{
|
|
38
|
-
|
|
39
|
-
import(
|
|
45
|
+
async Component() {
|
|
46
|
+
const component = await import(
|
|
40
47
|
/* webpackChunkName: "review-workflows-settings-edit-view" */ './pages/ReviewWorkflows/pages/EditView'
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
return component;
|
|
51
|
+
},
|
|
52
|
+
to: '/settings/review-workflows/:workflowId',
|
|
53
|
+
exact: true,
|
|
44
54
|
},
|
|
45
55
|
]
|
|
46
56
|
: []),
|
|
@@ -48,10 +58,15 @@ export const SETTINGS_ROUTES_EE = [
|
|
|
48
58
|
...(window.strapi.features.isEnabled(window.strapi.features.SSO)
|
|
49
59
|
? [
|
|
50
60
|
{
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
61
|
+
async Component() {
|
|
62
|
+
const component = await import(
|
|
63
|
+
/* webpackChunkName: "sso-settings-page" */ './pages/SingleSignOn'
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
return component;
|
|
67
|
+
},
|
|
68
|
+
to: '/settings/single-sign-on',
|
|
69
|
+
exact: true,
|
|
55
70
|
},
|
|
56
71
|
]
|
|
57
72
|
: []),
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { getService } = require('../../../utils');
|
|
4
|
+
const { validateUpdateAssigneeOnEntity } = require('../../../validation/review-workflows');
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
/**
|
|
8
|
+
* Updates an entity's assignee.
|
|
9
|
+
* @async
|
|
10
|
+
* @param {Object} ctx - The Koa context object.
|
|
11
|
+
* @param {Object} ctx.params - An object containing the parameters from the request URL.
|
|
12
|
+
* @param {string} ctx.params.model_uid - The model UID of the entity.
|
|
13
|
+
* @param {string} ctx.params.id - The ID of the entity to update.
|
|
14
|
+
* @param {Object} ctx.request.body.data - Optional data object containing the new assignee ID for the entity.
|
|
15
|
+
* @param {string} ctx.request.body.data.id - The ID of the new assignee for the entity.
|
|
16
|
+
* @throws {ApplicationError} If review workflows is not activated on the specified model UID.
|
|
17
|
+
* @throws {ValidationError} If the `data` object in the request body fails to pass validation.
|
|
18
|
+
* @returns {Promise<void>} A promise that resolves when the entity's assignee has been updated.
|
|
19
|
+
*/
|
|
20
|
+
async updateEntity(ctx) {
|
|
21
|
+
const assigneeService = getService('assignees');
|
|
22
|
+
const workflowService = getService('workflows');
|
|
23
|
+
|
|
24
|
+
const { model_uid: model, id } = ctx.params;
|
|
25
|
+
|
|
26
|
+
const { sanitizeOutput } = strapi
|
|
27
|
+
.plugin('content-manager')
|
|
28
|
+
.service('permission-checker')
|
|
29
|
+
.create({ userAbility: ctx.state.userAbility, model });
|
|
30
|
+
|
|
31
|
+
// TODO: check if user has update permission on the entity
|
|
32
|
+
|
|
33
|
+
const { id: assigneeId } = await validateUpdateAssigneeOnEntity(
|
|
34
|
+
ctx.request?.body?.data,
|
|
35
|
+
'You should pass a valid id to the body of the put request.'
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
await workflowService.assertContentTypeBelongsToWorkflow(model);
|
|
39
|
+
|
|
40
|
+
const entity = await assigneeService.updateEntityAssignee(id, model, assigneeId);
|
|
41
|
+
|
|
42
|
+
ctx.body = { data: await sanitizeOutput(entity) };
|
|
43
|
+
},
|
|
44
|
+
};
|
|
@@ -142,5 +142,22 @@ module.exports = {
|
|
|
142
142
|
],
|
|
143
143
|
},
|
|
144
144
|
},
|
|
145
|
+
{
|
|
146
|
+
method: 'PUT',
|
|
147
|
+
path: '/content-manager/(collection|single)-types/:model_uid/:id/assignee',
|
|
148
|
+
handler: 'assignees.updateEntity',
|
|
149
|
+
config: {
|
|
150
|
+
middlewares: [enableFeatureMiddleware('review-workflows')],
|
|
151
|
+
policies: [
|
|
152
|
+
'admin::isAuthenticatedAdmin',
|
|
153
|
+
{
|
|
154
|
+
name: 'admin::hasPermissions',
|
|
155
|
+
config: {
|
|
156
|
+
actions: ['admin::users.read', 'admin::review-workflows.read'],
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
],
|
|
160
|
+
},
|
|
161
|
+
},
|
|
145
162
|
],
|
|
146
163
|
};
|
|
@@ -8,6 +8,7 @@ module.exports = {
|
|
|
8
8
|
'seat-enforcement': require('./seat-enforcement'),
|
|
9
9
|
workflows: require('./review-workflows/workflows'),
|
|
10
10
|
stages: require('./review-workflows/stages'),
|
|
11
|
+
assignees: require('./review-workflows/assignees'),
|
|
11
12
|
'review-workflows': require('./review-workflows/review-workflows'),
|
|
12
13
|
'review-workflows-validation': require('./review-workflows/validation'),
|
|
13
14
|
'review-workflows-decorator': require('./review-workflows/entity-service-decorator'),
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { ApplicationError } = require('@strapi/utils').errors;
|
|
4
|
+
const { isNil } = require('lodash/fp');
|
|
5
|
+
const { ENTITY_ASSIGNEE_ATTRIBUTE } = require('../../constants/workflows');
|
|
6
|
+
const { getService } = require('../../utils');
|
|
7
|
+
|
|
8
|
+
module.exports = ({ strapi }) => {
|
|
9
|
+
const metrics = getService('review-workflows-metrics', { strapi });
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
async findEntityAssigneeId(id, model) {
|
|
13
|
+
const entity = await strapi.entityService.findOne(model, id, {
|
|
14
|
+
populate: [ENTITY_ASSIGNEE_ATTRIBUTE],
|
|
15
|
+
fields: [],
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
return entity?.[ENTITY_ASSIGNEE_ATTRIBUTE]?.id ?? null;
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Update the assignee of an entity
|
|
23
|
+
*/
|
|
24
|
+
async updateEntityAssignee(id, model, assigneeId) {
|
|
25
|
+
if (isNil(assigneeId)) {
|
|
26
|
+
return this.deleteEntityAssignee(id, model);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const userExists = await getService('user', { strapi }).exists({ id: assigneeId });
|
|
30
|
+
|
|
31
|
+
if (!userExists) {
|
|
32
|
+
throw new ApplicationError(`Selected user does not exist`);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
metrics.sendDidEditAssignee(await this.findEntityAssigneeId(id, model), assigneeId);
|
|
36
|
+
|
|
37
|
+
return strapi.entityService.update(model, id, {
|
|
38
|
+
data: { [ENTITY_ASSIGNEE_ATTRIBUTE]: assigneeId },
|
|
39
|
+
populate: [ENTITY_ASSIGNEE_ATTRIBUTE],
|
|
40
|
+
fields: [],
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
async deleteEntityAssignee(id, model) {
|
|
45
|
+
metrics.sendDidEditAssignee(await this.findEntityAssigneeId(id, model), null);
|
|
46
|
+
|
|
47
|
+
return strapi.entityService.update(model, id, {
|
|
48
|
+
data: { [ENTITY_ASSIGNEE_ATTRIBUTE]: null },
|
|
49
|
+
populate: [ENTITY_ASSIGNEE_ATTRIBUTE],
|
|
50
|
+
fields: [],
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
};
|
|
@@ -24,6 +24,10 @@ const sendDidEditWorkflow = async () => {
|
|
|
24
24
|
strapi.telemetry.send('didEditWorkflow', {});
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
+
const sendDidEditAssignee = async (fromId, toId) => {
|
|
28
|
+
strapi.telemetry.send('didEditAssignee', { from: fromId, to: toId });
|
|
29
|
+
};
|
|
30
|
+
|
|
27
31
|
const sendDidSendReviewWorkflowPropertiesOnceAWeek = async (
|
|
28
32
|
numberOfActiveWorkflows,
|
|
29
33
|
avgStagesCount,
|
|
@@ -48,4 +52,5 @@ module.exports = {
|
|
|
48
52
|
sendDidCreateWorkflow,
|
|
49
53
|
sendDidEditWorkflow,
|
|
50
54
|
sendDidSendReviewWorkflowPropertiesOnceAWeek,
|
|
55
|
+
sendDidEditAssignee,
|
|
51
56
|
};
|