@strapi/admin 4.6.1 → 4.9.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/assets/images/onboarding-preview.png +0 -0
- package/admin/src/content-manager/components/CollectionTypeFormWrapper/index.js +4 -14
- package/admin/src/content-manager/components/DynamicTable/CellContent/RelationMultiple/index.js +1 -1
- package/admin/src/content-manager/components/DynamicZone/components/DynamicComponent.js +2 -0
- package/admin/src/content-manager/components/EditViewDataManagerProvider/reducer.js +39 -9
- package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/cleanData.js +9 -15
- package/admin/src/content-manager/components/SingleTypeFormWrapper/index.js +4 -12
- package/admin/src/content-manager/pages/EditView/DeleteLink/index.js +6 -8
- package/admin/src/content-manager/pages/ListView/index.js +6 -11
- package/admin/src/index.js +1 -0
- package/admin/src/pages/Admin/Onboarding/constants.js +46 -0
- package/admin/src/pages/Admin/Onboarding/index.js +161 -89
- package/admin/src/pages/Admin/index.js +5 -2
- package/admin/src/pages/SettingsPage/components/SettingsNav/index.js +15 -2
- package/admin/src/pages/SettingsPage/pages/Users/components/MagicLink/MagicLinkWrapper.js +3 -20
- package/admin/src/permissions/defaultPermissions.js +2 -15
- package/admin/src/translations/ar.json +4 -4
- package/admin/src/translations/ca.json +4 -4
- package/admin/src/translations/cs.json +4 -4
- package/admin/src/translations/de.json +4 -4
- package/admin/src/translations/dk.json +4 -4
- package/admin/src/translations/en.json +14 -5
- package/admin/src/translations/es.json +4 -4
- package/admin/src/translations/eu.json +4 -4
- package/admin/src/translations/fr.json +4 -4
- package/admin/src/translations/gu.json +4 -4
- package/admin/src/translations/he.json +4 -4
- package/admin/src/translations/hi.json +4 -4
- package/admin/src/translations/hu.json +4 -4
- package/admin/src/translations/id.json +4 -4
- package/admin/src/translations/it.json +4 -4
- package/admin/src/translations/ja.json +4 -4
- package/admin/src/translations/ko.json +4 -4
- package/admin/src/translations/ml.json +4 -4
- package/admin/src/translations/ms.json +4 -4
- package/admin/src/translations/nl.json +4 -4
- package/admin/src/translations/no.json +4 -4
- package/admin/src/translations/pl.json +4 -4
- package/admin/src/translations/pt-BR.json +4 -4
- package/admin/src/translations/pt.json +4 -4
- package/admin/src/translations/ru.json +785 -789
- package/admin/src/translations/sa.json +4 -4
- package/admin/src/translations/sk.json +4 -4
- package/admin/src/translations/sv.json +4 -4
- package/admin/src/translations/th.json +4 -4
- package/admin/src/translations/tr.json +4 -4
- package/admin/src/translations/uk.json +4 -4
- package/admin/src/translations/vi.json +4 -4
- package/admin/src/translations/zh-Hans.json +4 -4
- package/admin/src/translations/zh.json +4 -4
- package/build/1683.d59d0f23.chunk.js +268 -0
- package/build/19eb2dfcf2603eb55733.png +0 -0
- package/build/{4855.bd092921.chunk.js → 2223.1bfea951.chunk.js} +88 -88
- package/build/2743.646a1015.chunk.js +45 -0
- package/build/3075.3ee481f1.chunk.js +108 -0
- package/build/3632.2e378cf8.chunk.js +138 -0
- package/build/{4318.f96a9d4d.chunk.js → 4318.cd55ce02.chunk.js} +1 -1
- package/build/9707.b36ed71e.chunk.js +96 -0
- package/build/Admin-authenticatedApp.a73577e1.chunk.js +79 -0
- package/build/{Admin_InternalErrorPage.157152a8.chunk.js → Admin_InternalErrorPage.178ddb90.chunk.js} +1 -1
- package/build/{Admin_homePage.b1730882.chunk.js → Admin_homePage.c2f5f27d.chunk.js} +2 -2
- package/build/{Admin_marketplace.ea0316c2.chunk.js → Admin_marketplace.1df49c42.chunk.js} +1 -1
- package/build/{Admin_pluginsPage.5c24f963.chunk.js → Admin_pluginsPage.8d824408.chunk.js} +2 -2
- package/build/{Admin_profilePage.59af1978.chunk.js → Admin_profilePage.cb667bc5.chunk.js} +2 -2
- package/build/Admin_settingsPage.f90615fb.chunk.js +178 -0
- package/build/{Upload_ConfigureTheView.3f2b6e6a.chunk.js → Upload_ConfigureTheView.d306009d.chunk.js} +1 -1
- package/build/admin-app.06f07029.chunk.js +112 -0
- package/build/admin-edit-roles-page.35199b9d.chunk.js +1 -0
- package/build/admin-edit-users.9e48b00d.chunk.js +10 -0
- package/build/admin-users.cf7b4151.chunk.js +11 -0
- package/build/{api-tokens-create-page.d248362d.chunk.js → api-tokens-create-page.a31c7fba.chunk.js} +1 -1
- package/build/{api-tokens-edit-page.8516fa20.chunk.js → api-tokens-edit-page.64fef287.chunk.js} +1 -1
- package/build/{api-tokens-list-page.44a79fda.chunk.js → api-tokens-list-page.e600ad3e.chunk.js} +2 -2
- package/build/ar-json.39e54aba.chunk.js +1 -0
- package/build/{audit-logs-settings-page.c3dce30d.chunk.js → audit-logs-settings-page.d4da4579.chunk.js} +1 -1
- package/build/{ca-json.f6a0f472.chunk.js → ca-json.4d999055.chunk.js} +1 -1
- package/build/content-manager.255c3a59.chunk.js +1139 -0
- package/build/{content-type-builder-list-view.79e84b36.chunk.js → content-type-builder-list-view.8d7a3d68.chunk.js} +5 -5
- package/build/content-type-builder.3c8558a5.chunk.js +126 -0
- package/build/cs-json.4b44411c.chunk.js +1 -0
- package/build/{de-json.30e1f35b.chunk.js → de-json.866f8a28.chunk.js} +1 -1
- package/build/{dk-json.e6d9ffa4.chunk.js → dk-json.10f7b1d1.chunk.js} +1 -1
- package/build/email-settings-page.b19f2eb2.chunk.js +10 -0
- package/build/en-json.1997583c.chunk.js +1 -0
- package/build/es-json.ea15c957.chunk.js +1 -0
- package/build/{eu-json.fceecd8b.chunk.js → eu-json.3bc24d60.chunk.js} +1 -1
- package/build/{fr-json.78545ef8.chunk.js → fr-json.e88fbdfd.chunk.js} +1 -1
- package/build/{gu-json.676518f2.chunk.js → gu-json.94f0d242.chunk.js} +1 -1
- package/build/{he-json.ad22e8cc.chunk.js → he-json.f0de8cdb.chunk.js} +1 -1
- package/build/{hi-json.19b51c09.chunk.js → hi-json.df3a7be2.chunk.js} +1 -1
- package/build/{hu-json.f947088f.chunk.js → hu-json.680e6eef.chunk.js} +1 -1
- package/build/{i18n-settings-page.b8d8753e.chunk.js → i18n-settings-page.a6b49eac.chunk.js} +1 -1
- package/build/{id-json.504daa84.chunk.js → id-json.e0d83d41.chunk.js} +1 -1
- package/build/index.html +1 -1
- package/build/{it-json.2fd90f4d.chunk.js → it-json.8be59205.chunk.js} +1 -1
- package/build/{ja-json.c9f12d0b.chunk.js → ja-json.97ee41ba.chunk.js} +1 -1
- package/build/{ko-json.ef463065.chunk.js → ko-json.4cbbf4f2.chunk.js} +1 -1
- package/build/main.7f308c20.js +4322 -0
- package/build/{ml-json.490f666c.chunk.js → ml-json.e3747091.chunk.js} +1 -1
- package/build/ms-json.0eddffd9.chunk.js +1 -0
- package/build/{nl-json.c416295a.chunk.js → nl-json.371a15ee.chunk.js} +1 -1
- package/build/{no-json.1a2258ba.chunk.js → no-json.9b3cd181.chunk.js} +1 -1
- package/build/{pl-json.8cf0c871.chunk.js → pl-json.e535cbce.chunk.js} +1 -1
- package/build/{pt-BR-json.51fab8d0.chunk.js → pt-BR-json.e5fafa46.chunk.js} +1 -1
- package/build/pt-json.ee554a41.chunk.js +1 -0
- package/build/review-workflows-settings.7b4be1b0.chunk.js +63 -0
- package/build/{ru-json.aa5cd123.chunk.js → ru-json.866f0ff1.chunk.js} +1 -1
- package/build/runtime~main.bf374148.js +2 -0
- package/build/{sa-json.f3fa5407.chunk.js → sa-json.7efeb257.chunk.js} +1 -1
- package/build/{sk-json.9ec60d9f.chunk.js → sk-json.7bbeb0af.chunk.js} +1 -1
- package/build/{sso-settings-page.b85ad080.chunk.js → sso-settings-page.ad2143dd.chunk.js} +1 -1
- package/build/{sv-json.c6b0c237.chunk.js → sv-json.dc40951f.chunk.js} +1 -1
- package/build/{th-json.6e68155c.chunk.js → th-json.f664b96d.chunk.js} +1 -1
- package/build/{tr-json.9f41dc08.chunk.js → tr-json.b79eae31.chunk.js} +1 -1
- package/build/uk-json.b7e38370.chunk.js +1 -0
- package/build/upload-settings.eb1a7908.chunk.js +84 -0
- package/build/upload.700e2c84.chunk.js +33 -0
- package/build/{users-advanced-settings-page.fce9908e.chunk.js → users-advanced-settings-page.aae212f2.chunk.js} +1 -1
- package/build/{users-email-settings-page.343d0ad2.chunk.js → users-email-settings-page.8a9b0da1.chunk.js} +1 -1
- package/build/{users-providers-settings-page.e5a9a3f1.chunk.js → users-providers-settings-page.e6be909d.chunk.js} +10 -10
- package/build/{users-roles-settings-page.66312f31.chunk.js → users-roles-settings-page.97d06a80.chunk.js} +3 -3
- package/build/vi-json.ee4c5537.chunk.js +1 -0
- package/build/webhook-edit-page.9eb0f789.chunk.js +75 -0
- package/build/webhook-list-page.66082323.chunk.js +42 -0
- package/build/{zh-Hans-json.9c0eac99.chunk.js → zh-Hans-json.30a18940.chunk.js} +1 -1
- package/build/{zh-json.f88f563d.chunk.js → zh-json.49d84433.chunk.js} +1 -1
- 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 +137 -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 +77 -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 +63 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/index.js +3 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/reducer/index.js +102 -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 +7 -0
- package/ee/server/bootstrap.js +7 -1
- 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 +7 -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 +36 -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 +57 -0
- package/ee/server/index.js +1 -0
- package/ee/server/routes/index.js +87 -0
- package/ee/server/services/index.js +3 -0
- package/ee/server/services/review-workflows/review-workflows.js +54 -0
- package/ee/server/services/review-workflows/stages.js +133 -0
- package/ee/server/services/review-workflows/workflows.js +25 -0
- package/ee/server/utils/index.js +8 -0
- package/ee/server/utils/test.js +11 -0
- package/ee/server/validation/review-workflows.js +17 -0
- package/package.json +15 -15
- package/server/config/admin-actions.js +0 -16
- package/server/controllers/admin.js +0 -55
- package/server/routes/admin.js +0 -28
- package/webpack.config.js +0 -3
- package/build/1683.c8aa7b7c.chunk.js +0 -268
- package/build/2743.6d1632f9.chunk.js +0 -45
- package/build/3075.dc3894fe.chunk.js +0 -108
- package/build/3632.0317b618.chunk.js +0 -138
- package/build/9707.7290fd92.chunk.js +0 -96
- package/build/Admin-authenticatedApp.ce646f66.chunk.js +0 -75
- package/build/Admin_settingsPage.d1493824.chunk.js +0 -178
- package/build/admin-app.25934eaa.chunk.js +0 -112
- package/build/admin-edit-roles-page.446b69dc.chunk.js +0 -1
- package/build/admin-edit-users.2ed69bfd.chunk.js +0 -10
- package/build/admin-users.fc003b10.chunk.js +0 -11
- package/build/ar-json.932794f7.chunk.js +0 -1
- package/build/content-manager.35ff9726.chunk.js +0 -1139
- package/build/content-type-builder.855db321.chunk.js +0 -126
- package/build/cs-json.79879fb6.chunk.js +0 -1
- package/build/email-settings-page.d1fcc7a3.chunk.js +0 -10
- package/build/en-json.1f137a90.chunk.js +0 -1
- package/build/es-json.e275481d.chunk.js +0 -1
- package/build/main.7b151630.js +0 -4377
- package/build/ms-json.db87d8d3.chunk.js +0 -1
- package/build/pt-json.62927d1e.chunk.js +0 -1
- package/build/runtime~main.a20d633b.js +0 -2
- package/build/uk-json.b2fcd567.chunk.js +0 -1
- package/build/upload-settings.ef64bbf9.chunk.js +0 -84
- package/build/upload.c5730dfa.chunk.js +0 -33
- package/build/vi-json.f08d7d03.chunk.js +0 -1
- package/build/webhook-edit-page.73e51e64.chunk.js +0 -75
- package/build/webhook-list-page.1134f130.chunk.js +0 -42
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
schema: {
|
|
5
|
+
collectionName: 'strapi_workflows_stages',
|
|
6
|
+
info: {
|
|
7
|
+
name: 'Workflow Stage',
|
|
8
|
+
description: '',
|
|
9
|
+
singularName: 'workflow-stage',
|
|
10
|
+
pluralName: 'workflow-stages',
|
|
11
|
+
displayName: 'Stages',
|
|
12
|
+
},
|
|
13
|
+
options: {},
|
|
14
|
+
pluginOptions: {
|
|
15
|
+
'content-manager': {
|
|
16
|
+
visible: false,
|
|
17
|
+
},
|
|
18
|
+
'content-type-builder': {
|
|
19
|
+
visible: false,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
attributes: {
|
|
23
|
+
name: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
configurable: false,
|
|
26
|
+
},
|
|
27
|
+
workflow: {
|
|
28
|
+
type: 'relation',
|
|
29
|
+
target: 'admin::workflow',
|
|
30
|
+
relation: 'manyToOne',
|
|
31
|
+
inversedBy: 'stages',
|
|
32
|
+
configurable: false,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { getService } = require('../../utils');
|
|
4
|
+
|
|
5
|
+
module.exports = {
|
|
6
|
+
/**
|
|
7
|
+
* List all workflows
|
|
8
|
+
* @param {import('koa').BaseContext} ctx - koa context
|
|
9
|
+
*/
|
|
10
|
+
async find(ctx) {
|
|
11
|
+
const { populate } = ctx.query;
|
|
12
|
+
const workflowService = getService('workflows');
|
|
13
|
+
const data = await workflowService.find({
|
|
14
|
+
populate,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
ctx.body = {
|
|
18
|
+
data,
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
/**
|
|
22
|
+
* Get one workflow based on its id contained in request parameters
|
|
23
|
+
* @param {import('koa').BaseContext} ctx - koa context
|
|
24
|
+
*/
|
|
25
|
+
async findById(ctx) {
|
|
26
|
+
const { id } = ctx.params;
|
|
27
|
+
const { populate } = ctx.query;
|
|
28
|
+
|
|
29
|
+
const workflowService = getService('workflows');
|
|
30
|
+
const data = await workflowService.findById(id, { populate });
|
|
31
|
+
|
|
32
|
+
ctx.body = {
|
|
33
|
+
data,
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { getService } = require('../../../utils');
|
|
4
|
+
const { validateUpdateStages } = require('../../../validation/review-workflows');
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
/**
|
|
8
|
+
* List all stages
|
|
9
|
+
* @param {import('koa').BaseContext} ctx - koa context
|
|
10
|
+
*/
|
|
11
|
+
async find(ctx) {
|
|
12
|
+
const { workflow_id: workflowId } = ctx.params;
|
|
13
|
+
const { populate } = ctx.query;
|
|
14
|
+
const stagesService = getService('stages');
|
|
15
|
+
|
|
16
|
+
const data = await stagesService.find({
|
|
17
|
+
workflowId,
|
|
18
|
+
populate,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
ctx.body = {
|
|
22
|
+
data,
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
/**
|
|
26
|
+
* Get one stage
|
|
27
|
+
* @param {import('koa').BaseContext} ctx - koa context
|
|
28
|
+
*/
|
|
29
|
+
async findById(ctx) {
|
|
30
|
+
const { id, workflow_id: workflowId } = ctx.params;
|
|
31
|
+
const { populate } = ctx.query;
|
|
32
|
+
const stagesService = getService('stages');
|
|
33
|
+
|
|
34
|
+
const data = await stagesService.findById(id, {
|
|
35
|
+
workflowId,
|
|
36
|
+
populate,
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
ctx.body = {
|
|
40
|
+
data,
|
|
41
|
+
};
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
async replace(ctx) {
|
|
45
|
+
const { workflow_id: workflowId } = ctx.params;
|
|
46
|
+
const stagesService = getService('stages');
|
|
47
|
+
const {
|
|
48
|
+
body: { data: stages },
|
|
49
|
+
} = ctx.request;
|
|
50
|
+
|
|
51
|
+
const stagesValidated = await validateUpdateStages(stages);
|
|
52
|
+
|
|
53
|
+
const data = await stagesService.replaceWorkflowStages(workflowId, stagesValidated);
|
|
54
|
+
|
|
55
|
+
ctx.body = { data };
|
|
56
|
+
},
|
|
57
|
+
};
|
package/ee/server/index.js
CHANGED
|
@@ -148,4 +148,91 @@ module.exports = [
|
|
|
148
148
|
],
|
|
149
149
|
},
|
|
150
150
|
},
|
|
151
|
+
|
|
152
|
+
// Review workflow
|
|
153
|
+
{
|
|
154
|
+
method: 'GET',
|
|
155
|
+
path: '/review-workflows/workflows',
|
|
156
|
+
handler: 'workflows.find',
|
|
157
|
+
config: {
|
|
158
|
+
middlewares: [enableFeatureMiddleware('review-workflows')],
|
|
159
|
+
policies: [
|
|
160
|
+
'admin::isAuthenticatedAdmin',
|
|
161
|
+
{
|
|
162
|
+
name: 'admin::hasPermissions',
|
|
163
|
+
config: {
|
|
164
|
+
actions: ['admin::review-workflows.read'],
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
],
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
method: 'GET',
|
|
172
|
+
path: '/review-workflows/workflows/:id',
|
|
173
|
+
handler: 'workflows.findById',
|
|
174
|
+
config: {
|
|
175
|
+
middlewares: [enableFeatureMiddleware('review-workflows')],
|
|
176
|
+
policies: [
|
|
177
|
+
'admin::isAuthenticatedAdmin',
|
|
178
|
+
{
|
|
179
|
+
name: 'admin::hasPermissions',
|
|
180
|
+
config: {
|
|
181
|
+
actions: ['admin::review-workflows.read'],
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
],
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
method: 'GET',
|
|
189
|
+
path: '/review-workflows/workflows/:workflow_id/stages',
|
|
190
|
+
handler: 'stages.find',
|
|
191
|
+
config: {
|
|
192
|
+
middlewares: [enableFeatureMiddleware('review-workflows')],
|
|
193
|
+
policies: [
|
|
194
|
+
'admin::isAuthenticatedAdmin',
|
|
195
|
+
{
|
|
196
|
+
name: 'admin::hasPermissions',
|
|
197
|
+
config: {
|
|
198
|
+
actions: ['admin::review-workflows.read'],
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
],
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
method: 'PUT',
|
|
206
|
+
path: '/review-workflows/workflows/:workflow_id/stages',
|
|
207
|
+
handler: 'stages.replace',
|
|
208
|
+
config: {
|
|
209
|
+
middlewares: [enableFeatureMiddleware('review-workflows')],
|
|
210
|
+
policies: [
|
|
211
|
+
'admin::isAuthenticatedAdmin',
|
|
212
|
+
{
|
|
213
|
+
name: 'admin::hasPermissions',
|
|
214
|
+
config: {
|
|
215
|
+
actions: ['admin::review-workflows.read'],
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
],
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
method: 'GET',
|
|
223
|
+
path: '/review-workflows/workflows/:workflow_id/stages/:id',
|
|
224
|
+
handler: 'stages.findById',
|
|
225
|
+
config: {
|
|
226
|
+
middlewares: [enableFeatureMiddleware('review-workflows')],
|
|
227
|
+
policies: [
|
|
228
|
+
'admin::isAuthenticatedAdmin',
|
|
229
|
+
{
|
|
230
|
+
name: 'admin::hasPermissions',
|
|
231
|
+
config: {
|
|
232
|
+
actions: ['admin::review-workflows.read'],
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
],
|
|
236
|
+
},
|
|
237
|
+
},
|
|
151
238
|
];
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { getService } = require('../../utils');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Map every stage in the array to be ordered in the relation
|
|
7
|
+
* @param {Object[]} stages
|
|
8
|
+
* @param {number} stages.id
|
|
9
|
+
* @return {Object[]}
|
|
10
|
+
*/
|
|
11
|
+
function buildStagesConnectArray(stages) {
|
|
12
|
+
return stages.map((stage, index) => {
|
|
13
|
+
const connect = {
|
|
14
|
+
id: stage.id,
|
|
15
|
+
position: {},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
if (index === 0) {
|
|
19
|
+
connect.position.start = true;
|
|
20
|
+
} else {
|
|
21
|
+
connect.position.after = stages[index - 1].id;
|
|
22
|
+
}
|
|
23
|
+
return connect;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
module.exports = ({ strapi }) => {
|
|
28
|
+
const workflowsService = getService('workflows', { strapi });
|
|
29
|
+
const stagesService = getService('stages', { strapi });
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
async bootstrap() {
|
|
33
|
+
const wfCount = await workflowsService.count();
|
|
34
|
+
const stagesCount = await stagesService.count();
|
|
35
|
+
|
|
36
|
+
// Check if there is nothing about review-workflow in DB
|
|
37
|
+
// If any, the feature has already been initialized with a workflow and stages
|
|
38
|
+
if (wfCount === 0 && stagesCount === 0) {
|
|
39
|
+
const defaultStages = require('../../constants/default-stages.json');
|
|
40
|
+
const defaultWorkflow = require('../../constants/default-workflow.json');
|
|
41
|
+
|
|
42
|
+
const stages = await stagesService.createMany(defaultStages, { fields: ['id'] });
|
|
43
|
+
const workflow = {
|
|
44
|
+
...defaultWorkflow,
|
|
45
|
+
stages: {
|
|
46
|
+
connect: buildStagesConnectArray(stages),
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
await workflowsService.create(workflow);
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
mapAsync,
|
|
5
|
+
errors: { ApplicationError },
|
|
6
|
+
} = require('@strapi/utils');
|
|
7
|
+
|
|
8
|
+
const { STAGE_MODEL_UID } = require('../../constants/workflows');
|
|
9
|
+
const { getService } = require('../../utils');
|
|
10
|
+
|
|
11
|
+
module.exports = ({ strapi }) => {
|
|
12
|
+
const workflowsService = getService('workflows', { strapi });
|
|
13
|
+
|
|
14
|
+
return {
|
|
15
|
+
find({ workflowId, populate }) {
|
|
16
|
+
const params = {
|
|
17
|
+
filters: { workflow: workflowId },
|
|
18
|
+
populate,
|
|
19
|
+
};
|
|
20
|
+
return strapi.entityService.findMany(STAGE_MODEL_UID, params);
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
findById(id, { workflowId, populate }) {
|
|
24
|
+
const params = {
|
|
25
|
+
filters: { workflow: workflowId },
|
|
26
|
+
populate,
|
|
27
|
+
};
|
|
28
|
+
return strapi.entityService.findOne(STAGE_MODEL_UID, id, params);
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
createMany(stagesList, { fields }) {
|
|
32
|
+
const params = {
|
|
33
|
+
select: fields,
|
|
34
|
+
};
|
|
35
|
+
return Promise.all(
|
|
36
|
+
stagesList.map((stage) =>
|
|
37
|
+
strapi.entityService.create(STAGE_MODEL_UID, { data: stage, ...params })
|
|
38
|
+
)
|
|
39
|
+
);
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
update(stageId, stageData) {
|
|
43
|
+
return strapi.entityService.update(STAGE_MODEL_UID, stageId, { data: stageData });
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
delete(stageId) {
|
|
47
|
+
return strapi.entityService.delete(STAGE_MODEL_UID, stageId);
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
count() {
|
|
51
|
+
return strapi.entityService.count(STAGE_MODEL_UID);
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
async replaceWorkflowStages(workflowId, stages) {
|
|
55
|
+
const workflow = await workflowsService.findById(workflowId, { populate: ['stages'] });
|
|
56
|
+
|
|
57
|
+
const { created, updated, deleted } = getDiffBetweenStages(workflow.stages, stages);
|
|
58
|
+
|
|
59
|
+
assertAtLeastOneStageRemain(workflow.stages, { created, deleted });
|
|
60
|
+
|
|
61
|
+
return strapi.db.transaction(async () => {
|
|
62
|
+
const newStages = await this.createMany(created, { fields: ['id'] });
|
|
63
|
+
const stagesIds = stages.map((stage) => stage.id ?? newStages.shift().id);
|
|
64
|
+
|
|
65
|
+
await mapAsync(updated, (stage) => this.update(stage.id, stage));
|
|
66
|
+
await mapAsync(deleted, (stage) => this.delete(stage.id));
|
|
67
|
+
return workflowsService.update(workflowId, {
|
|
68
|
+
stages: stagesIds,
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Compares two arrays of stages and returns an object indicating the differences.
|
|
77
|
+
*
|
|
78
|
+
* The function compares the `id` properties of each stage in `sourceStages` and `comparisonStages` to determine if the stage is present in both arrays.
|
|
79
|
+
* If a stage with the same `id` is found in both arrays but the `name` property is different, the stage is considered updated.
|
|
80
|
+
* If a stage with a particular `id` is only found in `comparisonStages`, it is considered created.
|
|
81
|
+
* If a stage with a particular `id` is only found in `sourceStages`, it is considered deleted.
|
|
82
|
+
*
|
|
83
|
+
* @typedef {{id: Number, name: String, workflow: Number}} Stage
|
|
84
|
+
* @typedef {{created: Stage[], updated: Stage[], deleted: Stage[]}} DiffStages
|
|
85
|
+
*
|
|
86
|
+
* The DiffStages object has three properties: `created`, `updated`, and `deleted`.
|
|
87
|
+
* `created` is an array of stages that are in `comparisonStages` but not in `sourceStages`.
|
|
88
|
+
* `updated` is an array of stages that have different names in `comparisonStages` and `sourceStages`.
|
|
89
|
+
* `deleted` is an array of stages that are in `sourceStages` but not in `comparisonStages`.
|
|
90
|
+
*
|
|
91
|
+
* @param {Stage[]} sourceStages
|
|
92
|
+
* @param {Stage[]} comparisonStages
|
|
93
|
+
* @returns { DiffStages }
|
|
94
|
+
*/
|
|
95
|
+
function getDiffBetweenStages(sourceStages, comparisonStages) {
|
|
96
|
+
const result = comparisonStages.reduce(
|
|
97
|
+
(acc, stageToCompare) => {
|
|
98
|
+
const srcStage = sourceStages.find((stage) => stage.id === stageToCompare.id);
|
|
99
|
+
|
|
100
|
+
if (!srcStage) {
|
|
101
|
+
acc.created.push(stageToCompare);
|
|
102
|
+
} else if (srcStage.name !== stageToCompare.name) {
|
|
103
|
+
acc.updated.push(stageToCompare);
|
|
104
|
+
}
|
|
105
|
+
return acc;
|
|
106
|
+
},
|
|
107
|
+
{ created: [], updated: [] }
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
result.deleted = sourceStages.filter(
|
|
111
|
+
(srcStage) => !comparisonStages.some((cmpStage) => cmpStage.id === srcStage.id)
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
return result;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Asserts that at least one stage remains in the workflow after applying deletions and additions.
|
|
119
|
+
*
|
|
120
|
+
* @param {Array} workflowStages - An array of stages in the current workflow.
|
|
121
|
+
* @param {Object} diffStages - An object containing the stages to be deleted and created.
|
|
122
|
+
* @param {Array} diffStages.deleted - An array of stages that are planned to be deleted from the workflow.
|
|
123
|
+
* @param {Array} diffStages.created - An array of stages that are planned to be created in the workflow.
|
|
124
|
+
*
|
|
125
|
+
* @throws {ApplicationError} If the number of remaining stages in the workflow after applying deletions and additions is less than 1.
|
|
126
|
+
*/
|
|
127
|
+
function assertAtLeastOneStageRemain(workflowStages, diffStages) {
|
|
128
|
+
const remainingStagesCount =
|
|
129
|
+
workflowStages.length - diffStages.deleted.length + diffStages.created.length;
|
|
130
|
+
if (remainingStagesCount < 1) {
|
|
131
|
+
throw new ApplicationError('At least one stage must remain in the workflow.');
|
|
132
|
+
}
|
|
133
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { WORKFLOW_MODEL_UID } = require('../../constants/workflows');
|
|
4
|
+
|
|
5
|
+
module.exports = ({ strapi }) => ({
|
|
6
|
+
find(opts) {
|
|
7
|
+
return strapi.entityService.findMany(WORKFLOW_MODEL_UID, opts);
|
|
8
|
+
},
|
|
9
|
+
|
|
10
|
+
findById(id, opts) {
|
|
11
|
+
return strapi.entityService.findOne(WORKFLOW_MODEL_UID, id, opts);
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
create(workflowData) {
|
|
15
|
+
return strapi.entityService.create(WORKFLOW_MODEL_UID, { data: workflowData });
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
count() {
|
|
19
|
+
return strapi.entityService.count(WORKFLOW_MODEL_UID);
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
update(id, workflowData) {
|
|
23
|
+
return strapi.entityService.update(WORKFLOW_MODEL_UID, id, { data: workflowData });
|
|
24
|
+
},
|
|
25
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { yup, validateYupSchema } = require('@strapi/utils');
|
|
4
|
+
|
|
5
|
+
const stageObject = yup.object().shape({
|
|
6
|
+
id: yup.number().integer().min(1),
|
|
7
|
+
name: yup.string().max(255).required(),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
const validateUpdateStagesSchema = yup.array().of(stageObject).required();
|
|
11
|
+
|
|
12
|
+
module.exports = {
|
|
13
|
+
validateUpdateStages: validateYupSchema(validateUpdateStagesSchema, {
|
|
14
|
+
strict: false,
|
|
15
|
+
stripUnknown: true,
|
|
16
|
+
}),
|
|
17
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/admin",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.9.0-alpha.0",
|
|
4
4
|
"description": "Strapi Admin",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -46,15 +46,15 @@
|
|
|
46
46
|
"@casl/ability": "^5.4.3",
|
|
47
47
|
"@fingerprintjs/fingerprintjs": "3.3.6",
|
|
48
48
|
"@pmmmwh/react-refresh-webpack-plugin": "0.5.10",
|
|
49
|
-
"@strapi/babel-plugin-switch-ee-ce": "4.
|
|
50
|
-
"@strapi/data-transfer": "4.
|
|
49
|
+
"@strapi/babel-plugin-switch-ee-ce": "4.9.0-alpha.0",
|
|
50
|
+
"@strapi/data-transfer": "4.9.0-alpha.0",
|
|
51
51
|
"@strapi/design-system": "1.6.3",
|
|
52
|
-
"@strapi/helper-plugin": "4.
|
|
52
|
+
"@strapi/helper-plugin": "4.9.0-alpha.0",
|
|
53
53
|
"@strapi/icons": "1.6.3",
|
|
54
|
-
"@strapi/permissions": "4.
|
|
55
|
-
"@strapi/provider-audit-logs-local": "4.
|
|
56
|
-
"@strapi/typescript-utils": "4.
|
|
57
|
-
"@strapi/utils": "4.
|
|
54
|
+
"@strapi/permissions": "4.9.0-alpha.0",
|
|
55
|
+
"@strapi/provider-audit-logs-local": "4.9.0-alpha.0",
|
|
56
|
+
"@strapi/typescript-utils": "4.9.0-alpha.0",
|
|
57
|
+
"@strapi/utils": "4.9.0-alpha.0",
|
|
58
58
|
"axios": "1.2.2",
|
|
59
59
|
"babel-loader": "^9.1.2",
|
|
60
60
|
"babel-plugin-styled-components": "2.0.2",
|
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
"find-root": "1.1.0",
|
|
74
74
|
"fork-ts-checker-webpack-plugin": "7.2.1",
|
|
75
75
|
"formik": "^2.2.6",
|
|
76
|
+
"fractional-indexing": "3.2.0",
|
|
76
77
|
"fs-extra": "10.0.0",
|
|
77
78
|
"highlight.js": "^10.4.1",
|
|
78
79
|
"history": "^4.9.0",
|
|
@@ -100,8 +101,6 @@
|
|
|
100
101
|
"markdown-it-sup": "1.0.0",
|
|
101
102
|
"match-sorter": "^4.0.2",
|
|
102
103
|
"mini-css-extract-plugin": "2.7.2",
|
|
103
|
-
"msw": "0.49.1",
|
|
104
|
-
"node-polyfill-webpack-plugin": "2.0.1",
|
|
105
104
|
"node-schedule": "2.1.0",
|
|
106
105
|
"p-map": "4.0.0",
|
|
107
106
|
"passport-local": "1.0.0",
|
|
@@ -115,15 +114,15 @@
|
|
|
115
114
|
"react-error-boundary": "3.1.4",
|
|
116
115
|
"react-fast-compare": "^3.2.0",
|
|
117
116
|
"react-helmet": "^6.1.0",
|
|
118
|
-
"react-intl": "6.2.
|
|
117
|
+
"react-intl": "6.2.8",
|
|
119
118
|
"react-is": "^17.0.2",
|
|
120
119
|
"react-query": "3.24.3",
|
|
121
|
-
"react-redux": "
|
|
120
|
+
"react-redux": "8.0.5",
|
|
122
121
|
"react-refresh": "0.14.0",
|
|
123
122
|
"react-router": "5.2.0",
|
|
124
123
|
"react-router-dom": "5.3.4",
|
|
125
124
|
"react-window": "1.8.7",
|
|
126
|
-
"redux": "^4.
|
|
125
|
+
"redux": "^4.2.1",
|
|
127
126
|
"reselect": "^4.0.0",
|
|
128
127
|
"rimraf": "3.0.2",
|
|
129
128
|
"sanitize-html": "2.7.3",
|
|
@@ -145,9 +144,10 @@
|
|
|
145
144
|
"@testing-library/user-event": "14.4.3",
|
|
146
145
|
"duplicate-dependencies-webpack-plugin": "^1.0.2",
|
|
147
146
|
"glob": "8.0.3",
|
|
147
|
+
"msw": "1.0.1",
|
|
148
148
|
"react-test-renderer": "^17.0.2",
|
|
149
149
|
"speed-measure-webpack-plugin": "1.5.0",
|
|
150
|
-
"webpack-bundle-analyzer": "^4.
|
|
150
|
+
"webpack-bundle-analyzer": "^4.8.0"
|
|
151
151
|
},
|
|
152
152
|
"peerDependencies": {
|
|
153
153
|
"@strapi/strapi": "^4.3.4"
|
|
@@ -165,5 +165,5 @@
|
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
},
|
|
168
|
-
"gitHead": "
|
|
168
|
+
"gitHead": "35f783d0dc07db101e7e62cb4d682f751551f452"
|
|
169
169
|
}
|
|
@@ -10,22 +10,6 @@ module.exports = {
|
|
|
10
10
|
category: 'plugins and marketplace',
|
|
11
11
|
subCategory: 'marketplace',
|
|
12
12
|
},
|
|
13
|
-
{
|
|
14
|
-
uid: 'marketplace.plugins.install',
|
|
15
|
-
displayName: 'Install (only for dev env)',
|
|
16
|
-
pluginName: 'admin',
|
|
17
|
-
section: 'settings',
|
|
18
|
-
category: 'plugins and marketplace',
|
|
19
|
-
subCategory: 'plugins',
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
uid: 'marketplace.plugins.uninstall',
|
|
23
|
-
displayName: 'Uninstall (only for dev env)',
|
|
24
|
-
pluginName: 'admin',
|
|
25
|
-
section: 'settings',
|
|
26
|
-
category: 'plugins and marketplace',
|
|
27
|
-
subCategory: 'plugins',
|
|
28
|
-
},
|
|
29
13
|
{
|
|
30
14
|
uid: 'webhooks.create',
|
|
31
15
|
displayName: 'Create',
|