@strapi/admin 4.10.2-alpha.0 → 4.10.4
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/Wysiwyg/WysiwygNav.js +156 -155
- package/admin/src/content-manager/pages/ListSettingsView/{utils/excludedSortOptions.js → constants.js} +1 -1
- package/admin/src/content-manager/pages/ListSettingsView/index.js +33 -36
- package/admin/src/pages/Admin/index.js +3 -0
- package/admin/src/pages/AuthPage/components/Register/index.js +1 -1
- package/admin/src/pages/MarketplacePage/components/NpmPackagesFilters/FilterSelect.js +1 -1
- package/admin/src/pages/MarketplacePage/components/NpmPackagesFilters/FiltersPopover.js +52 -41
- package/admin/src/pages/MarketplacePage/components/SortSelect/index.js +16 -0
- package/admin/src/pages/SettingsPage/pages/Users/components/SelectRoles/index.js +2 -2
- package/admin/src/translations/en.json +1 -0
- package/admin/src/translations/ru.json +7 -0
- package/build/{1387.84b454d3.chunk.js → 1387.437eb420.chunk.js} +1 -1
- package/build/{1657.45231968.chunk.js → 1657.85034334.chunk.js} +52 -52
- package/build/3081.c2cdfac8.chunk.js +108 -0
- package/build/3816.2b58bc1a.chunk.js +214 -0
- package/build/462.a073ff1f.chunk.js +71 -0
- package/build/{4628.20631dd1.chunk.js → 4628.9cbb6df5.chunk.js} +1 -1
- package/build/5542.5328b662.chunk.js +71 -0
- package/build/{5563.986609ed.chunk.js → 5563.44e0ef15.chunk.js} +22 -22
- package/build/617.ce23dea8.chunk.js +155 -0
- package/build/6858.85d76858.chunk.js +50 -0
- package/build/6970.e8422af3.chunk.js +1 -0
- package/build/{7259.7a48aa2f.chunk.js → 7259.3ed2b60e.chunk.js} +1 -1
- package/build/{Admin-authenticatedApp.2fab70e4.chunk.js → Admin-authenticatedApp.dbb99d34.chunk.js} +2 -2
- package/build/Admin_homePage.e15dcf28.chunk.js +73 -0
- package/build/Admin_marketplace.87f51b29.chunk.js +55 -0
- package/build/Admin_pluginsPage.7df6b5a9.chunk.js +6 -0
- package/build/{Admin_profilePage.1b337b73.chunk.js → Admin_profilePage.1687246a.chunk.js} +1 -1
- package/build/Admin_settingsPage.20884a40.chunk.js +79 -0
- package/build/Upload_ConfigureTheView.aa64ed9a.chunk.js +1 -0
- package/build/{admin-app.9bfe4ec7.chunk.js → admin-app.d4fd9379.chunk.js} +4 -4
- package/build/{admin-edit-roles-page.d0c9497b.chunk.js → admin-edit-roles-page.6fe9de49.chunk.js} +43 -41
- package/build/{admin-edit-users.ba27c532.chunk.js → admin-edit-users.49363035.chunk.js} +4 -4
- package/build/admin-roles-list.a323aa9f.chunk.js +31 -0
- package/build/admin-users.16bb6e77.chunk.js +34 -0
- package/build/audit-logs-settings-page.48b921f9.chunk.js +129 -0
- package/build/content-manager.a837bfcd.chunk.js +1123 -0
- package/build/content-type-builder-list-view.1e821eb9.chunk.js +215 -0
- package/build/{content-type-builder-translation-en-json.446b611d.chunk.js → content-type-builder-translation-en-json.5e5f8607.chunk.js} +1 -1
- package/build/{content-type-builder.4737a30c.chunk.js → content-type-builder.51c64fe5.chunk.js} +4 -4
- package/build/email-settings-page.5bc22e5a.chunk.js +11 -0
- package/build/en-json.1f6af924.chunk.js +1 -0
- package/build/i18n-settings-page.1581894e.chunk.js +114 -0
- package/build/i18n-translation-ru-json.401bc498.chunk.js +1 -0
- package/build/index.html +1 -1
- package/build/main.31bdf27e.js +2679 -0
- package/build/review-workflows-settings.26409ce4.chunk.js +61 -0
- package/build/ru-json.678cd48b.chunk.js +1 -0
- package/build/{runtime~main.c9593d59.js → runtime~main.a096f3d0.js} +2 -2
- package/build/{sso-settings-page.f44d95d8.chunk.js → sso-settings-page.c9d7c8df.chunk.js} +1 -1
- package/build/upload-settings.4d962053.chunk.js +14 -0
- package/build/upload.4dcd513f.chunk.js +34 -0
- package/build/users-advanced-settings-page.dd2a4954.chunk.js +9 -0
- package/build/users-email-settings-page.510648ab.chunk.js +24 -0
- package/build/users-permissions-translation-ru-json.8e883c67.chunk.js +1 -0
- package/build/users-providers-settings-page.0ee7d54f.chunk.js +29 -0
- package/build/webhook-edit-page.36c9f20d.chunk.js +128 -0
- package/build/webhook-list-page.0983d83f.chunk.js +71 -0
- package/ee/admin/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/ReviewWorkflowsStageEE.js +22 -5
- package/ee/admin/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/getTableColumn.js +7 -3
- package/ee/admin/content-manager/pages/EditView/InformationBox/InformationBoxEE.js +20 -3
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/ReviewWorkflows.js +34 -25
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/actions/index.js +11 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/StageDragPreview/StageDragPreview.js +45 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/StageDragPreview/index.js +1 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/Stage/Stage.js +290 -63
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/Stage/components/OptionColor/OptionColor.js +37 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/Stage/components/OptionColor/index.js +1 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/Stage/components/SingleValueColor/SingleValueColor.js +44 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/Stage/components/SingleValueColor/index.js +1 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/Stages.js +2 -1
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/constants.js +26 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/reducer/index.js +36 -2
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/utils/colors.js +39 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/utils/getWorkflowValidationSchema.js +9 -0
- package/ee/server/constants/workflows.js +1 -0
- package/ee/server/content-types/workflow-stage/index.js +7 -0
- package/ee/server/controllers/authentication/middlewares.js +1 -1
- package/ee/server/migrations/review-workflows-stages-color.js +20 -0
- package/ee/server/register.js +2 -0
- package/ee/server/routes/audit-logs.js +43 -0
- package/ee/server/routes/index.js +5 -226
- package/ee/server/routes/license-limit.js +29 -0
- package/ee/server/routes/review-workflows.js +112 -0
- package/ee/server/routes/sso.js +60 -0
- package/ee/server/routes/utils.js +15 -0
- package/ee/server/services/review-workflows/stages.js +1 -1
- package/ee/server/validation/review-workflows.js +7 -1
- package/package.json +17 -17
- package/server/routes/index.js +16 -11
- package/webpack.alias.js +0 -1
- package/admin/src/content-manager/pages/ListSettingsView/utils/api.js +0 -10
- package/build/3081.bcf9a12f.chunk.js +0 -108
- package/build/462.8fff7f3b.chunk.js +0 -71
- package/build/5542.b8240e3f.chunk.js +0 -70
- package/build/6404.68405699.chunk.js +0 -100
- package/build/7725.f717acdd.chunk.js +0 -213
- package/build/Admin_homePage.9f7c0bb1.chunk.js +0 -73
- package/build/Admin_marketplace.a60cde15.chunk.js +0 -31
- package/build/Admin_pluginsPage.9e6fa51c.chunk.js +0 -6
- package/build/Admin_settingsPage.56e9641c.chunk.js +0 -79
- package/build/Upload_ConfigureTheView.4fc648b5.chunk.js +0 -1
- package/build/admin-roles-list.c759daa3.chunk.js +0 -31
- package/build/admin-users.ad5dd832.chunk.js +0 -34
- package/build/audit-logs-settings-page.45cb4fb5.chunk.js +0 -76
- package/build/content-manager.a0ff6cad.chunk.js +0 -1111
- package/build/content-type-builder-list-view.5ff685ec.chunk.js +0 -214
- package/build/email-settings-page.dc07d518.chunk.js +0 -10
- package/build/en-json.c7fc79af.chunk.js +0 -1
- package/build/i18n-settings-page.8219dd99.chunk.js +0 -60
- package/build/main.964e7203.js +0 -2597
- package/build/review-workflows-settings.089d7ec5.chunk.js +0 -106
- package/build/ru-json.e0662702.chunk.js +0 -1
- package/build/upload-settings.dd2d987c.chunk.js +0 -13
- package/build/upload.c8479232.chunk.js +0 -33
- package/build/users-advanced-settings-page.c36cfd59.chunk.js +0 -8
- package/build/users-email-settings-page.2716ce8e.chunk.js +0 -23
- package/build/users-permissions-translation-ru-json.20e177db.chunk.js +0 -1
- package/build/users-providers-settings-page.0d6304a5.chunk.js +0 -28
- package/build/webhook-edit-page.f4db86f3.chunk.js +0 -75
- package/build/webhook-list-page.30d73114.chunk.js +0 -71
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { components } from 'react-select';
|
|
4
|
+
import { Flex, Typography } from '@strapi/design-system';
|
|
5
|
+
|
|
6
|
+
import { getStageColorByHex } from '../../../../../utils/colors';
|
|
7
|
+
|
|
8
|
+
export function OptionColor({ children, ...props }) {
|
|
9
|
+
const { color } = props.data;
|
|
10
|
+
const { themeColorName } = getStageColorByHex(color);
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<components.Option {...props}>
|
|
14
|
+
<Flex alignItems="center" gap={2}>
|
|
15
|
+
<Flex
|
|
16
|
+
height={2}
|
|
17
|
+
background={color}
|
|
18
|
+
borderColor={themeColorName === 'neutral0' ? 'neutral150' : 'transparent'}
|
|
19
|
+
hasRadius
|
|
20
|
+
shrink={0}
|
|
21
|
+
width={2}
|
|
22
|
+
/>
|
|
23
|
+
|
|
24
|
+
<Typography textColor="neutral800" ellipsis>
|
|
25
|
+
{children}
|
|
26
|
+
</Typography>
|
|
27
|
+
</Flex>
|
|
28
|
+
</components.Option>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
OptionColor.propTypes = {
|
|
33
|
+
children: PropTypes.node.isRequired,
|
|
34
|
+
data: PropTypes.shape({
|
|
35
|
+
color: PropTypes.string,
|
|
36
|
+
}).isRequired,
|
|
37
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './OptionColor';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { components } from 'react-select';
|
|
4
|
+
import { Flex, Typography } from '@strapi/design-system';
|
|
5
|
+
|
|
6
|
+
import { getStageColorByHex } from '../../../../../utils/colors';
|
|
7
|
+
|
|
8
|
+
export function SingleValueColor({ children, ...props }) {
|
|
9
|
+
const { color } = props.data;
|
|
10
|
+
// in case an entity was not assigned to a stage (which displays an error)
|
|
11
|
+
// there is no color to display and we have to make sure the component does
|
|
12
|
+
// not crash
|
|
13
|
+
const { themeColorName } = color ? getStageColorByHex(color) : {};
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<components.SingleValue {...props}>
|
|
17
|
+
<Flex alignItems="center" gap={2}>
|
|
18
|
+
<Flex
|
|
19
|
+
height={2}
|
|
20
|
+
background={color}
|
|
21
|
+
borderColor={themeColorName === 'neutral0' ? 'neutral150' : 'transparent'}
|
|
22
|
+
hasRadius
|
|
23
|
+
shrink={0}
|
|
24
|
+
width={2}
|
|
25
|
+
/>
|
|
26
|
+
|
|
27
|
+
<Typography textColor="neutral800" ellipsis>
|
|
28
|
+
{children}
|
|
29
|
+
</Typography>
|
|
30
|
+
</Flex>
|
|
31
|
+
</components.SingleValue>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
SingleValueColor.defaultProps = {
|
|
36
|
+
children: null,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
SingleValueColor.propTypes = {
|
|
40
|
+
children: PropTypes.node,
|
|
41
|
+
data: PropTypes.shape({
|
|
42
|
+
color: PropTypes.string,
|
|
43
|
+
}).isRequired,
|
|
44
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './SingleValueColor';
|
|
@@ -45,11 +45,12 @@ function Stages({ stages }) {
|
|
|
45
45
|
return (
|
|
46
46
|
<Box key={`stage-${id}`} as="li">
|
|
47
47
|
<Stage
|
|
48
|
-
{...stage}
|
|
49
48
|
id={id}
|
|
50
49
|
index={index}
|
|
51
50
|
canDelete={stages.length > 1}
|
|
52
51
|
isOpen={!stage.id}
|
|
52
|
+
canReorder={stages.length > 1}
|
|
53
|
+
stagesCount={stages.length}
|
|
53
54
|
/>
|
|
54
55
|
</Box>
|
|
55
56
|
);
|
|
@@ -1,6 +1,32 @@
|
|
|
1
|
+
import { lightTheme } from '@strapi/design-system';
|
|
2
|
+
|
|
1
3
|
export const REDUX_NAMESPACE = 'settings_review-workflows';
|
|
2
4
|
|
|
3
5
|
export const ACTION_SET_WORKFLOWS = `Settings/Review_Workflows/SET_WORKFLOWS`;
|
|
4
6
|
export const ACTION_DELETE_STAGE = `Settings/Review_Workflows/WORKFLOW_DELETE_STAGE`;
|
|
5
7
|
export const ACTION_ADD_STAGE = `Settings/Review_Workflows/WORKFLOW_ADD_STAGE`;
|
|
6
8
|
export const ACTION_UPDATE_STAGE = `Settings/Review_Workflows/WORKFLOW_UPDATE_STAGE`;
|
|
9
|
+
export const ACTION_UPDATE_STAGE_POSITION = `Settings/Review_Workflows/WORKFLOW_UPDATE_STAGE_POSITION`;
|
|
10
|
+
|
|
11
|
+
export const STAGE_COLORS = {
|
|
12
|
+
primary600: 'Blue',
|
|
13
|
+
primary200: 'Lilac',
|
|
14
|
+
alternative600: 'Violet',
|
|
15
|
+
alternative200: 'Lavender',
|
|
16
|
+
success600: 'Green',
|
|
17
|
+
success200: 'Pale Green',
|
|
18
|
+
danger500: 'Cherry',
|
|
19
|
+
danger200: 'Pink',
|
|
20
|
+
warning600: 'Orange',
|
|
21
|
+
warning200: 'Yellow',
|
|
22
|
+
secondary600: 'Teal',
|
|
23
|
+
secondary200: 'Baby Blue',
|
|
24
|
+
neutral400: 'Gray',
|
|
25
|
+
neutral0: 'White',
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const STAGE_COLOR_DEFAULT = lightTheme.colors.primary600;
|
|
29
|
+
|
|
30
|
+
export const DRAG_DROP_TYPES = {
|
|
31
|
+
STAGE: 'stage',
|
|
32
|
+
};
|
|
@@ -6,6 +6,8 @@ import {
|
|
|
6
6
|
ACTION_DELETE_STAGE,
|
|
7
7
|
ACTION_ADD_STAGE,
|
|
8
8
|
ACTION_UPDATE_STAGE,
|
|
9
|
+
ACTION_UPDATE_STAGE_POSITION,
|
|
10
|
+
STAGE_COLOR_DEFAULT,
|
|
9
11
|
} from '../constants';
|
|
10
12
|
|
|
11
13
|
export const initialState = {
|
|
@@ -29,8 +31,18 @@ export function reducer(state = initialState, action) {
|
|
|
29
31
|
|
|
30
32
|
draft.status = status;
|
|
31
33
|
|
|
32
|
-
if (workflows) {
|
|
33
|
-
|
|
34
|
+
if (workflows?.length > 0) {
|
|
35
|
+
let defaultWorkflow = workflows[0];
|
|
36
|
+
|
|
37
|
+
// A safety net in case a stage does not have a color assigned;
|
|
38
|
+
// this normallly should not happen
|
|
39
|
+
defaultWorkflow = {
|
|
40
|
+
...defaultWorkflow,
|
|
41
|
+
stages: defaultWorkflow.stages.map((stage) => ({
|
|
42
|
+
...stage,
|
|
43
|
+
color: stage?.color ?? STAGE_COLOR_DEFAULT,
|
|
44
|
+
})),
|
|
45
|
+
};
|
|
34
46
|
|
|
35
47
|
draft.serverState.workflows = workflows;
|
|
36
48
|
draft.serverState.currentWorkflow = defaultWorkflow;
|
|
@@ -69,6 +81,7 @@ export function reducer(state = initialState, action) {
|
|
|
69
81
|
|
|
70
82
|
draft.clientState.currentWorkflow.data.stages.push({
|
|
71
83
|
...payload,
|
|
84
|
+
color: payload?.color ?? STAGE_COLOR_DEFAULT,
|
|
72
85
|
__temp_key__: newTempKey,
|
|
73
86
|
});
|
|
74
87
|
|
|
@@ -91,6 +104,27 @@ export function reducer(state = initialState, action) {
|
|
|
91
104
|
break;
|
|
92
105
|
}
|
|
93
106
|
|
|
107
|
+
case ACTION_UPDATE_STAGE_POSITION: {
|
|
108
|
+
const {
|
|
109
|
+
currentWorkflow: {
|
|
110
|
+
data: { stages },
|
|
111
|
+
},
|
|
112
|
+
} = state.clientState;
|
|
113
|
+
const { newIndex, oldIndex } = payload;
|
|
114
|
+
|
|
115
|
+
if (newIndex >= 0 && newIndex < stages.length) {
|
|
116
|
+
const stage = stages[oldIndex];
|
|
117
|
+
let newStages = [...stages];
|
|
118
|
+
|
|
119
|
+
newStages.splice(oldIndex, 1);
|
|
120
|
+
newStages.splice(newIndex, 0, stage);
|
|
121
|
+
|
|
122
|
+
draft.clientState.currentWorkflow.data.stages = newStages;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
|
|
94
128
|
default:
|
|
95
129
|
break;
|
|
96
130
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { lightTheme } from '@strapi/design-system';
|
|
2
|
+
|
|
3
|
+
import { STAGE_COLORS } from '../constants';
|
|
4
|
+
|
|
5
|
+
export function getStageColorByHex(hex) {
|
|
6
|
+
if (!hex) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// there are multiple colors with the same hex code in the design tokens. In order to find
|
|
11
|
+
// the correct one we have to find all matching colors and then check, which ones are usable
|
|
12
|
+
// for stages.
|
|
13
|
+
const themeColors = Object.entries(lightTheme.colors).filter(
|
|
14
|
+
([, value]) => value.toUpperCase() === hex.toUpperCase()
|
|
15
|
+
);
|
|
16
|
+
const themeColorName = themeColors.reduce((acc, [name]) => {
|
|
17
|
+
if (STAGE_COLORS?.[name]) {
|
|
18
|
+
acc = name;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return acc;
|
|
22
|
+
}, null);
|
|
23
|
+
|
|
24
|
+
if (!themeColorName) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
themeColorName,
|
|
30
|
+
name: STAGE_COLORS[themeColorName],
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function getAvailableStageColors() {
|
|
35
|
+
return Object.entries(STAGE_COLORS).map(([themeColorName, name]) => ({
|
|
36
|
+
hex: lightTheme.colors[themeColorName].toUpperCase(),
|
|
37
|
+
name,
|
|
38
|
+
}));
|
|
39
|
+
}
|
package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/utils/getWorkflowValidationSchema.js
CHANGED
|
@@ -19,6 +19,15 @@ export function getWorkflowValidationSchema({ formatMessage }) {
|
|
|
19
19
|
defaultMessage: 'Name can not be longer than 255 characters',
|
|
20
20
|
})
|
|
21
21
|
),
|
|
22
|
+
color: yup
|
|
23
|
+
.string()
|
|
24
|
+
.required(
|
|
25
|
+
formatMessage({
|
|
26
|
+
id: 'Settings.review-workflows.validation.stage.color',
|
|
27
|
+
defaultMessage: 'Color is required',
|
|
28
|
+
})
|
|
29
|
+
)
|
|
30
|
+
.matches(/^#(?:[0-9a-fA-F]{3}){1,2}$/i),
|
|
22
31
|
})
|
|
23
32
|
),
|
|
24
33
|
});
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const { STAGE_DEFAULT_COLOR } = require('../../constants/workflows');
|
|
4
|
+
|
|
3
5
|
module.exports = {
|
|
4
6
|
schema: {
|
|
5
7
|
collectionName: 'strapi_workflows_stages',
|
|
@@ -24,6 +26,11 @@ module.exports = {
|
|
|
24
26
|
type: 'string',
|
|
25
27
|
configurable: false,
|
|
26
28
|
},
|
|
29
|
+
color: {
|
|
30
|
+
type: 'string',
|
|
31
|
+
configurable: false,
|
|
32
|
+
default: STAGE_DEFAULT_COLOR,
|
|
33
|
+
},
|
|
27
34
|
workflow: {
|
|
28
35
|
type: 'relation',
|
|
29
36
|
target: 'admin::workflow',
|
|
@@ -95,7 +95,7 @@ const redirectWithAuth = (ctx) => {
|
|
|
95
95
|
params: { provider },
|
|
96
96
|
} = ctx;
|
|
97
97
|
const redirectUrls = utils.getPrefixedRedirectUrls();
|
|
98
|
-
const domain = strapi.config.get('
|
|
98
|
+
const domain = strapi.config.get('admin.auth.domain');
|
|
99
99
|
const { user } = ctx.state;
|
|
100
100
|
|
|
101
101
|
const jwt = getService('token').createJwtToken(user);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { STAGE_DEFAULT_COLOR } = require('../constants/workflows');
|
|
4
|
+
|
|
5
|
+
async function migrateReviewWorkflowStagesColor({ oldContentTypes, contentTypes }) {
|
|
6
|
+
// Look for CT's color attribute
|
|
7
|
+
const hadColor = !!oldContentTypes?.['admin::workflow-stage']?.attributes?.color;
|
|
8
|
+
const hasColor = !!contentTypes['admin::workflow-stage']?.attributes?.color;
|
|
9
|
+
|
|
10
|
+
// Add the default stage color if color attribute was added
|
|
11
|
+
if (!hadColor || hasColor) {
|
|
12
|
+
await strapi.query('admin::workflow-stage').updateMany({
|
|
13
|
+
data: {
|
|
14
|
+
color: STAGE_DEFAULT_COLOR,
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
module.exports = migrateReviewWorkflowStagesColor;
|
package/ee/server/register.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
const { features } = require('@strapi/strapi/lib/utils/ee');
|
|
4
4
|
const executeCERegister = require('../../server/register');
|
|
5
5
|
const migrateAuditLogsTable = require('./migrations/audit-logs-table');
|
|
6
|
+
const migrateReviewWorkflowStagesColor = require('./migrations/review-workflows-stages-color');
|
|
6
7
|
const createAuditLogsService = require('./services/audit-logs');
|
|
7
8
|
const reviewWorkflowsMiddlewares = require('./middlewares/review-workflows');
|
|
8
9
|
const { getService } = require('./utils');
|
|
@@ -17,6 +18,7 @@ module.exports = async ({ strapi }) => {
|
|
|
17
18
|
await auditLogsService.register();
|
|
18
19
|
}
|
|
19
20
|
if (features.isEnabled('review-workflows')) {
|
|
21
|
+
strapi.hook('strapi::content-types.afterSync').register(migrateReviewWorkflowStagesColor);
|
|
20
22
|
const reviewWorkflowService = getService('review-workflows');
|
|
21
23
|
|
|
22
24
|
reviewWorkflowsMiddlewares.contentTypeMiddleware(strapi);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { enableFeatureMiddleware } = require('./utils');
|
|
4
|
+
|
|
5
|
+
module.exports = {
|
|
6
|
+
type: 'admin',
|
|
7
|
+
routes: [
|
|
8
|
+
{
|
|
9
|
+
method: 'GET',
|
|
10
|
+
path: '/audit-logs',
|
|
11
|
+
handler: 'auditLogs.findMany',
|
|
12
|
+
config: {
|
|
13
|
+
middlewares: [enableFeatureMiddleware('audit-logs')],
|
|
14
|
+
policies: [
|
|
15
|
+
'admin::isAuthenticatedAdmin',
|
|
16
|
+
{
|
|
17
|
+
name: 'admin::hasPermissions',
|
|
18
|
+
config: {
|
|
19
|
+
actions: ['admin::audit-logs.read'],
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
method: 'GET',
|
|
27
|
+
path: '/audit-logs/:id',
|
|
28
|
+
handler: 'auditLogs.findOne',
|
|
29
|
+
config: {
|
|
30
|
+
middlewares: [enableFeatureMiddleware('audit-logs')],
|
|
31
|
+
policies: [
|
|
32
|
+
'admin::isAuthenticatedAdmin',
|
|
33
|
+
{
|
|
34
|
+
name: 'admin::hasPermissions',
|
|
35
|
+
config: {
|
|
36
|
+
actions: ['admin::audit-logs.read'],
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
};
|
|
@@ -1,229 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
ctx.status = 404;
|
|
3
|
+
module.exports = {
|
|
4
|
+
sso: require('./sso'),
|
|
5
|
+
'license-limit': require('./license-limit'),
|
|
6
|
+
'audit-logs': require('./audit-logs'),
|
|
7
|
+
'review-workflows': require('./review-workflows'),
|
|
11
8
|
};
|
|
12
|
-
|
|
13
|
-
module.exports = [
|
|
14
|
-
// SSO
|
|
15
|
-
{
|
|
16
|
-
method: 'GET',
|
|
17
|
-
path: '/providers',
|
|
18
|
-
handler: 'authentication.getProviders',
|
|
19
|
-
config: {
|
|
20
|
-
middlewares: [enableFeatureMiddleware('sso')],
|
|
21
|
-
auth: false,
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
method: 'GET',
|
|
26
|
-
path: '/connect/:provider',
|
|
27
|
-
handler: 'authentication.providerLogin',
|
|
28
|
-
config: {
|
|
29
|
-
middlewares: [enableFeatureMiddleware('sso')],
|
|
30
|
-
auth: false,
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
method: 'POST',
|
|
35
|
-
path: '/connect/:provider',
|
|
36
|
-
handler: 'authentication.providerLogin',
|
|
37
|
-
config: {
|
|
38
|
-
middlewares: [enableFeatureMiddleware('sso')],
|
|
39
|
-
auth: false,
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
method: 'GET',
|
|
44
|
-
path: '/providers/options',
|
|
45
|
-
handler: 'authentication.getProviderLoginOptions',
|
|
46
|
-
config: {
|
|
47
|
-
middlewares: [enableFeatureMiddleware('sso')],
|
|
48
|
-
policies: [
|
|
49
|
-
'admin::isAuthenticatedAdmin',
|
|
50
|
-
{ name: 'admin::hasPermissions', config: { actions: ['admin::provider-login.read'] } },
|
|
51
|
-
],
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
method: 'PUT',
|
|
56
|
-
path: '/providers/options',
|
|
57
|
-
handler: 'authentication.updateProviderLoginOptions',
|
|
58
|
-
config: {
|
|
59
|
-
middlewares: [enableFeatureMiddleware('sso')],
|
|
60
|
-
policies: [
|
|
61
|
-
'admin::isAuthenticatedAdmin',
|
|
62
|
-
{ name: 'admin::hasPermissions', config: { actions: ['admin::provider-login.update'] } },
|
|
63
|
-
],
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
// Audit logs
|
|
68
|
-
{
|
|
69
|
-
method: 'GET',
|
|
70
|
-
path: '/audit-logs',
|
|
71
|
-
handler: 'auditLogs.findMany',
|
|
72
|
-
config: {
|
|
73
|
-
middlewares: [enableFeatureMiddleware('audit-logs')],
|
|
74
|
-
policies: [
|
|
75
|
-
'admin::isAuthenticatedAdmin',
|
|
76
|
-
{
|
|
77
|
-
name: 'admin::hasPermissions',
|
|
78
|
-
config: {
|
|
79
|
-
actions: ['admin::audit-logs.read'],
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
],
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
method: 'GET',
|
|
87
|
-
path: '/audit-logs/:id',
|
|
88
|
-
handler: 'auditLogs.findOne',
|
|
89
|
-
config: {
|
|
90
|
-
middlewares: [enableFeatureMiddleware('audit-logs')],
|
|
91
|
-
policies: [
|
|
92
|
-
'admin::isAuthenticatedAdmin',
|
|
93
|
-
{
|
|
94
|
-
name: 'admin::hasPermissions',
|
|
95
|
-
config: {
|
|
96
|
-
actions: ['admin::audit-logs.read'],
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
],
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
|
|
103
|
-
// License limit infos
|
|
104
|
-
{
|
|
105
|
-
method: 'GET',
|
|
106
|
-
path: '/license-limit-information',
|
|
107
|
-
handler: 'admin.licenseLimitInformation',
|
|
108
|
-
config: {
|
|
109
|
-
policies: [
|
|
110
|
-
'admin::isAuthenticatedAdmin',
|
|
111
|
-
{
|
|
112
|
-
name: 'admin::hasPermissions',
|
|
113
|
-
config: {
|
|
114
|
-
actions: [
|
|
115
|
-
'admin::users.create',
|
|
116
|
-
'admin::users.read',
|
|
117
|
-
'admin::users.update',
|
|
118
|
-
'admin::users.delete',
|
|
119
|
-
],
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
],
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
|
-
|
|
126
|
-
// Review workflow
|
|
127
|
-
{
|
|
128
|
-
method: 'GET',
|
|
129
|
-
path: '/review-workflows/workflows',
|
|
130
|
-
handler: 'workflows.find',
|
|
131
|
-
config: {
|
|
132
|
-
middlewares: [enableFeatureMiddleware('review-workflows')],
|
|
133
|
-
policies: [
|
|
134
|
-
'admin::isAuthenticatedAdmin',
|
|
135
|
-
{
|
|
136
|
-
name: 'admin::hasPermissions',
|
|
137
|
-
config: {
|
|
138
|
-
actions: ['admin::review-workflows.read'],
|
|
139
|
-
},
|
|
140
|
-
},
|
|
141
|
-
],
|
|
142
|
-
},
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
method: 'GET',
|
|
146
|
-
path: '/review-workflows/workflows/:id',
|
|
147
|
-
handler: 'workflows.findById',
|
|
148
|
-
config: {
|
|
149
|
-
middlewares: [enableFeatureMiddleware('review-workflows')],
|
|
150
|
-
policies: [
|
|
151
|
-
'admin::isAuthenticatedAdmin',
|
|
152
|
-
{
|
|
153
|
-
name: 'admin::hasPermissions',
|
|
154
|
-
config: {
|
|
155
|
-
actions: ['admin::review-workflows.read'],
|
|
156
|
-
},
|
|
157
|
-
},
|
|
158
|
-
],
|
|
159
|
-
},
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
method: 'GET',
|
|
163
|
-
path: '/review-workflows/workflows/:workflow_id/stages',
|
|
164
|
-
handler: 'stages.find',
|
|
165
|
-
config: {
|
|
166
|
-
middlewares: [enableFeatureMiddleware('review-workflows')],
|
|
167
|
-
policies: [
|
|
168
|
-
'admin::isAuthenticatedAdmin',
|
|
169
|
-
{
|
|
170
|
-
name: 'admin::hasPermissions',
|
|
171
|
-
config: {
|
|
172
|
-
actions: ['admin::review-workflows.read'],
|
|
173
|
-
},
|
|
174
|
-
},
|
|
175
|
-
],
|
|
176
|
-
},
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
method: 'PUT',
|
|
180
|
-
path: '/review-workflows/workflows/:workflow_id/stages',
|
|
181
|
-
handler: 'stages.replace',
|
|
182
|
-
config: {
|
|
183
|
-
middlewares: [enableFeatureMiddleware('review-workflows')],
|
|
184
|
-
policies: [
|
|
185
|
-
'admin::isAuthenticatedAdmin',
|
|
186
|
-
{
|
|
187
|
-
name: 'admin::hasPermissions',
|
|
188
|
-
config: {
|
|
189
|
-
actions: ['admin::review-workflows.read'],
|
|
190
|
-
},
|
|
191
|
-
},
|
|
192
|
-
],
|
|
193
|
-
},
|
|
194
|
-
},
|
|
195
|
-
{
|
|
196
|
-
method: 'GET',
|
|
197
|
-
path: '/review-workflows/workflows/:workflow_id/stages/:id',
|
|
198
|
-
handler: 'stages.findById',
|
|
199
|
-
config: {
|
|
200
|
-
middlewares: [enableFeatureMiddleware('review-workflows')],
|
|
201
|
-
policies: [
|
|
202
|
-
'admin::isAuthenticatedAdmin',
|
|
203
|
-
{
|
|
204
|
-
name: 'admin::hasPermissions',
|
|
205
|
-
config: {
|
|
206
|
-
actions: ['admin::review-workflows.read'],
|
|
207
|
-
},
|
|
208
|
-
},
|
|
209
|
-
],
|
|
210
|
-
},
|
|
211
|
-
},
|
|
212
|
-
{
|
|
213
|
-
method: 'PUT',
|
|
214
|
-
path: '/content-manager/(collection|single)-types/:model_uid/:id/stage',
|
|
215
|
-
handler: 'stages.updateEntity',
|
|
216
|
-
config: {
|
|
217
|
-
middlewares: [enableFeatureMiddleware('review-workflows')],
|
|
218
|
-
policies: [
|
|
219
|
-
'admin::isAuthenticatedAdmin',
|
|
220
|
-
{
|
|
221
|
-
name: 'admin::hasPermissions',
|
|
222
|
-
config: {
|
|
223
|
-
actions: ['admin::review-workflows.read'],
|
|
224
|
-
},
|
|
225
|
-
},
|
|
226
|
-
],
|
|
227
|
-
},
|
|
228
|
-
},
|
|
229
|
-
];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
type: 'admin',
|
|
5
|
+
routes: [
|
|
6
|
+
// License limit infos
|
|
7
|
+
{
|
|
8
|
+
method: 'GET',
|
|
9
|
+
path: '/license-limit-information',
|
|
10
|
+
handler: 'admin.licenseLimitInformation',
|
|
11
|
+
config: {
|
|
12
|
+
policies: [
|
|
13
|
+
'admin::isAuthenticatedAdmin',
|
|
14
|
+
{
|
|
15
|
+
name: 'admin::hasPermissions',
|
|
16
|
+
config: {
|
|
17
|
+
actions: [
|
|
18
|
+
'admin::users.create',
|
|
19
|
+
'admin::users.read',
|
|
20
|
+
'admin::users.update',
|
|
21
|
+
'admin::users.delete',
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
};
|