@strapi/admin 4.11.4 → 4.12.0-beta.1

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.
Files changed (213) hide show
  1. package/admin/src/constants.js +83 -83
  2. package/admin/src/content-manager/components/CollectionTypeFormWrapper/index.js +8 -5
  3. package/admin/src/content-manager/components/Inputs/index.js +3 -47
  4. package/admin/src/content-manager/components/SingleTypeFormWrapper/index.js +34 -37
  5. package/admin/src/content-manager/pages/EditSettingsView/components/ModalForm.js +0 -27
  6. package/admin/src/content-manager/pages/EditView/Information/index.js +1 -1
  7. package/admin/src/content-manager/pages/EditView/InformationBox/InformationBoxCE.js +1 -2
  8. package/admin/src/content-manager/pages/EditView/InformationBox/index.js +1 -3
  9. package/admin/src/content-manager/pages/EditView/index.js +14 -2
  10. package/admin/src/content-manager/pages/ListView/components/TableRows/index.js +93 -14
  11. package/admin/src/content-manager/pages/ListView/index.js +65 -59
  12. package/admin/src/content-manager/pages/ListView/utils/buildValidGetParams.js +30 -0
  13. package/admin/src/content-manager/pages/ListView/utils/index.js +1 -1
  14. package/admin/src/content-manager/utils/mergeMetasWithSchema.js +5 -1
  15. package/admin/src/hooks/index.js +0 -1
  16. package/admin/src/hooks/useAdminUsers/useAdminUsers.js +3 -3
  17. package/admin/src/hooks/useEnterprise/useEnterprise.js +4 -4
  18. package/admin/src/hooks/useSettingsMenu/index.js +35 -21
  19. package/admin/src/pages/App/index.js +28 -23
  20. package/admin/src/pages/AuthPage/components/Login/index.js +3 -5
  21. package/admin/src/pages/AuthPage/components/Register/index.js +5 -1
  22. package/admin/src/pages/AuthPage/constants.js +3 -2
  23. package/admin/src/pages/AuthPage/index.js +18 -1
  24. package/admin/src/pages/HomePage/index.js +19 -7
  25. package/admin/src/pages/ProfilePage/index.js +12 -12
  26. package/admin/src/pages/SettingsPage/components/SettingsNav/index.js +13 -11
  27. package/admin/src/pages/SettingsPage/components/Tokens/TokenBox/index.js +1 -1
  28. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/index.js +17 -1
  29. package/admin/src/pages/SettingsPage/pages/Users/EditPage/index.js +16 -3
  30. package/admin/src/pages/SettingsPage/pages/Users/ListPage/CreateAction/index.js +2 -4
  31. package/admin/src/pages/SettingsPage/pages/Users/ListPage/ModalForm/index.js +15 -1
  32. package/admin/src/pages/SettingsPage/pages/Users/ListPage/index.js +36 -5
  33. package/admin/src/pages/SettingsPage/pages/Users/components/MagicLink/index.js +3 -5
  34. package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/EventTable/index.js +1 -3
  35. package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/WebhookForm/index.js +16 -1
  36. package/admin/src/translations/zh-Hans.json +1 -1
  37. package/build/0cd5f8915b265d5b1856.png +0 -0
  38. package/build/1049.758a01f5.chunk.js +1 -0
  39. package/build/{3528.4845cf92.chunk.js → 1386.762d6eb8.chunk.js} +1 -1
  40. package/build/1727.b49f0713.chunk.js +1 -0
  41. package/build/190.66d89241.chunk.js +117 -0
  42. package/build/{5563.86f9aa9c.chunk.js → 2225.15d1df72.chunk.js} +3 -3
  43. package/build/2379.d33a2e16.chunk.js +1 -0
  44. package/build/2395.b0419a54.chunk.js +26 -0
  45. package/build/2801.18ac397d.chunk.js +1 -0
  46. package/build/{7394.423886bd.chunk.js → 3100.21c343fa.chunk.js} +1 -1
  47. package/build/311.cb0884bb.chunk.js +1 -0
  48. package/build/3483.e182b190.chunk.js +1 -0
  49. package/build/3984.ea7b8036.chunk.js +1 -0
  50. package/build/4546.ff9fdf30.chunk.js +1 -0
  51. package/build/502.ccb38223.chunk.js +1 -0
  52. package/build/5483.ed2c7efa.chunk.js +6 -0
  53. package/build/{5542.c62d0daf.chunk.js → 5542.2415a393.chunk.js} +6 -6
  54. package/build/6158.f9d82db9.chunk.js +1 -0
  55. package/build/7030.b98dcedf.chunk.js +1 -0
  56. package/build/7464.c6d0565c.chunk.js +1 -0
  57. package/build/8276.23e0763b.chunk.js +26 -0
  58. package/build/918.54414509.chunk.js +1 -0
  59. package/build/{9932.7e2b71de.chunk.js → 9932.b5a3bb3a.chunk.js} +81 -81
  60. package/build/9944.7af075a5.chunk.js +26 -0
  61. package/build/{Admin-authenticatedApp.cb649fc1.chunk.js → Admin-authenticatedApp.2ffa318a.chunk.js} +5 -5
  62. package/build/Admin_InternalErrorPage.f45f2462.chunk.js +1 -0
  63. package/build/{Admin_homePage.be30ef4e.chunk.js → Admin_homePage.ac9dfb86.chunk.js} +23 -15
  64. package/build/{Admin_marketplace.74a58e20.chunk.js → Admin_marketplace.f0b87fce.chunk.js} +1 -1
  65. package/build/{Admin_pluginsPage.ce464189.chunk.js → Admin_pluginsPage.8728ff6e.chunk.js} +1 -1
  66. package/build/{Admin_profilePage.2131eb68.chunk.js → Admin_profilePage.a968035f.chunk.js} +2 -2
  67. package/build/Admin_settingsPage.3ad19487.chunk.js +79 -0
  68. package/build/Upload_ConfigureTheView.345ac1e0.chunk.js +1 -0
  69. package/build/admin-app.088bcd33.chunk.js +36 -0
  70. package/build/{admin-edit-roles-page.3fdd6b9d.chunk.js → admin-edit-roles-page.a49b9f4f.chunk.js} +4 -4
  71. package/build/admin-edit-users.67704088.chunk.js +10 -0
  72. package/build/{admin-roles-list.e17b00d7.chunk.js → admin-roles-list.0c129e98.chunk.js} +1 -1
  73. package/build/admin-users.3279ffb0.chunk.js +11 -0
  74. package/build/api-tokens-create-page.46c2ea84.chunk.js +1 -0
  75. package/build/{api-tokens-edit-page.9a1dd2fa.chunk.js → api-tokens-edit-page.58139df9.chunk.js} +1 -1
  76. package/build/{api-tokens-list-page.a103f526.chunk.js → api-tokens-list-page.505bf7e0.chunk.js} +2 -2
  77. package/build/audit-logs-settings-page.4b422831.chunk.js +1 -0
  78. package/build/content-manager.9b569036.chunk.js +1094 -0
  79. package/build/{content-type-builder-list-view.a200a358.chunk.js → content-type-builder-list-view.bf9be456.chunk.js} +9 -9
  80. package/build/content-type-builder-translation-en-json.38e20391.chunk.js +1 -0
  81. package/build/{content-type-builder-translation-zh-json.ad24dbeb.chunk.js → content-type-builder-translation-zh-json.958d90e1.chunk.js} +1 -1
  82. package/build/content-type-builder.3963fb2d.chunk.js +166 -0
  83. package/build/{email-settings-page.45695daa.chunk.js → email-settings-page.d494d1eb.chunk.js} +2 -2
  84. package/build/{i18n-settings-page.29308d0b.chunk.js → i18n-settings-page.47f78016.chunk.js} +1 -1
  85. package/build/index.html +1 -1
  86. package/build/main.98c989b0.js +2908 -0
  87. package/build/review-workflows-settings-create-view.60bc516c.chunk.js +1 -0
  88. package/build/review-workflows-settings-edit-view.898ea409.chunk.js +1 -0
  89. package/build/review-workflows-settings-list-view.240cacdf.chunk.js +56 -0
  90. package/build/runtime~main.44bf2a37.js +2 -0
  91. package/build/sso-settings-page.ed6f3f15.chunk.js +1 -0
  92. package/build/transfer-tokens-create-page.1597e6ab.chunk.js +1 -0
  93. package/build/transfer-tokens-edit-page.8741529f.chunk.js +1 -0
  94. package/build/{transfer-tokens-list-page.7237443d.chunk.js → transfer-tokens-list-page.22147d2c.chunk.js} +2 -2
  95. package/build/upload-settings.cac210a0.chunk.js +14 -0
  96. package/build/upload.8d01c525.chunk.js +26 -0
  97. package/build/{users-advanced-settings-page.750b1f76.chunk.js → users-advanced-settings-page.18379a56.chunk.js} +1 -1
  98. package/build/users-email-settings-page.a87978e5.chunk.js +9 -0
  99. package/build/users-providers-settings-page.8876c1ee.chunk.js +14 -0
  100. package/build/{users-roles-settings-page.1f505119.chunk.js → users-roles-settings-page.0431f48c.chunk.js} +2 -2
  101. package/build/webhook-edit-page.a91f27a1.chunk.js +33 -0
  102. package/build/{webhook-list-page.940a40f1.chunk.js → webhook-list-page.65e1b5bb.chunk.js} +1 -1
  103. package/build/{zh-Hans-json.4cfef87d.chunk.js → zh-Hans-json.fada6f40.chunk.js} +1 -1
  104. package/ee/admin/constants.js +14 -14
  105. package/ee/admin/content-manager/pages/EditView/InformationBox/InformationBoxEE.js +88 -31
  106. package/ee/admin/content-manager/pages/EditView/InformationBox/index.js +1 -3
  107. package/ee/admin/content-manager/{components/DynamicTable/CellContent/ReviewWorkflowsStage → pages/ListView/ReviewWorkflowsColumn}/ReviewWorkflowsStageEE.js +7 -2
  108. package/ee/admin/content-manager/pages/ListView/ReviewWorkflowsColumn/constants.js +24 -0
  109. package/ee/admin/content-manager/pages/ListView/ReviewWorkflowsColumn/index.js +1 -0
  110. package/ee/admin/hooks/useLicenseLimitNotification/index.js +17 -6
  111. package/ee/admin/hooks/useLicenseLimits/index.js +1 -32
  112. package/ee/admin/hooks/useLicenseLimits/useLicenseLimits.js +44 -0
  113. package/ee/admin/pages/AuthPage/components/Login/index.js +3 -5
  114. package/ee/admin/pages/HomePage/index.js +11 -0
  115. package/ee/admin/pages/SettingsPage/constants.js +25 -1
  116. package/ee/admin/pages/SettingsPage/pages/ApplicationInfosPage/components/AdminSeatInfo/index.js +7 -7
  117. package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/hooks/useAuditLogsData.js +6 -4
  118. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/actions/index.js +19 -4
  119. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Layout/Layout.js +65 -0
  120. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Layout/index.js +1 -0
  121. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/LimitsModal/LimitsModal.js +111 -0
  122. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/LimitsModal/assets/balloon.png +0 -0
  123. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/LimitsModal/index.js +3 -0
  124. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/ProtectedPage/ProtectedPage.js +21 -0
  125. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/ProtectedPage/index.js +1 -0
  126. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/Stage/Stage.js +5 -5
  127. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/WorkflowAttributes/WorkflowAttributes.js +110 -0
  128. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/WorkflowAttributes/index.js +1 -0
  129. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/constants.js +3 -1
  130. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/hooks/useReviewWorkflows.js +13 -19
  131. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/CreateView/CreateView.js +246 -0
  132. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/CreateView/index.js +13 -0
  133. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/EditView/EditView.js +287 -0
  134. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/EditView/index.js +13 -0
  135. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/ListView/ListView.js +382 -0
  136. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/ListView/index.js +13 -0
  137. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/reducer/index.js +53 -23
  138. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/utils/getWorkflowValidationSchema.js +43 -28
  139. package/ee/admin/pages/SettingsPage/pages/Users/ListPage/CreateAction/index.js +11 -6
  140. package/ee/admin/pages/SettingsPage/pages/Users/ListPage/index.js +13 -0
  141. package/ee/admin/pages/SettingsPage/pages/Users/components/MagicLink/index.js +3 -5
  142. package/ee/admin/pages/SettingsPage/pages/Webhooks/EditView/components/EventTable/index.js +1 -3
  143. package/ee/server/config/admin-actions.js +24 -0
  144. package/ee/server/constants/default-stages.json +8 -4
  145. package/ee/server/constants/default-workflow.json +3 -1
  146. package/ee/server/constants/workflows.js +10 -1
  147. package/ee/server/content-types/workflow/index.js +10 -0
  148. package/ee/server/content-types/workflow-stage/index.js +3 -1
  149. package/ee/server/controllers/admin.js +1 -0
  150. package/ee/server/controllers/workflows/index.js +135 -8
  151. package/ee/server/controllers/workflows/stages/index.js +38 -38
  152. package/ee/server/migrations/review-workflows-content-types.js +29 -0
  153. package/ee/server/migrations/review-workflows-deleted-ct-in-workflows.js +39 -0
  154. package/ee/server/migrations/review-workflows-stage-attribute.js +49 -0
  155. package/ee/server/migrations/review-workflows-stages-color.js +2 -2
  156. package/ee/server/migrations/review-workflows-workflow-name.js +21 -0
  157. package/ee/server/register.js +12 -2
  158. package/ee/server/routes/review-workflows.js +44 -10
  159. package/ee/server/services/index.js +1 -0
  160. package/ee/server/services/review-workflows/entity-service-decorator.js +8 -13
  161. package/ee/server/services/review-workflows/review-workflows.js +45 -53
  162. package/ee/server/services/review-workflows/stages.js +84 -46
  163. package/ee/server/services/review-workflows/validation.js +60 -0
  164. package/ee/server/services/review-workflows/workflows/content-types.js +80 -0
  165. package/ee/server/services/review-workflows/workflows/index.js +207 -0
  166. package/ee/server/utils/review-workflows.js +30 -25
  167. package/ee/server/validation/review-workflows.js +49 -10
  168. package/index.js +0 -14
  169. package/package.json +12 -21
  170. package/webpack.alias.js +0 -3
  171. package/webpack.config.js +1 -75
  172. package/admin/src/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/getTableColumn.js +0 -2
  173. package/admin/src/content-manager/pages/ListView/utils/buildQueryString.js +0 -36
  174. package/admin/src/content-manager/pages/ListView/utils/createPluginsFilter.js +0 -4
  175. package/admin/src/hooks/useLicenseLimits/index.js +0 -3
  176. package/admin/src/pages/App/utils/index.js +0 -3
  177. package/admin/src/pages/App/utils/unique-identifier.js +0 -12
  178. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/AdminSeatInfo/index.js +0 -5
  179. package/build/1386.3b2aa6a7.chunk.js +0 -3
  180. package/build/1799.44d2e264.chunk.js +0 -33
  181. package/build/1970.39a2d75e.chunk.js +0 -1
  182. package/build/3269.1ea0f5a6.chunk.js +0 -1
  183. package/build/5932.6a23b88c.chunk.js +0 -1
  184. package/build/7018.98feed67.chunk.js +0 -1
  185. package/build/7259.fb69d4bf.chunk.js +0 -1
  186. package/build/Admin_InternalErrorPage.8911cb49.chunk.js +0 -1
  187. package/build/Admin_settingsPage.4069bb8a.chunk.js +0 -79
  188. package/build/Upload_ConfigureTheView.7a1cb9c9.chunk.js +0 -1
  189. package/build/admin-app.fea867af.chunk.js +0 -61
  190. package/build/admin-edit-users.200551e3.chunk.js +0 -10
  191. package/build/admin-users.3b12dca2.chunk.js +0 -11
  192. package/build/api-tokens-create-page.3dd4e921.chunk.js +0 -1
  193. package/build/audit-logs-settings-page.f538490f.chunk.js +0 -1
  194. package/build/content-manager.c40f5ff9.chunk.js +0 -1088
  195. package/build/content-type-builder-translation-en-json.f592325b.chunk.js +0 -1
  196. package/build/content-type-builder.bd1bbff1.chunk.js +0 -166
  197. package/build/main.ee36abd9.js +0 -2927
  198. package/build/review-workflows-settings.93808ae0.chunk.js +0 -110
  199. package/build/runtime~main.efd966f6.js +0 -2
  200. package/build/sso-settings-page.0cdb96a6.chunk.js +0 -1
  201. package/build/transfer-tokens-create-page.de14cad4.chunk.js +0 -1
  202. package/build/transfer-tokens-edit-page.4f5e39af.chunk.js +0 -1
  203. package/build/upload-settings.cb6c14c3.chunk.js +0 -14
  204. package/build/upload.7e629643.chunk.js +0 -26
  205. package/build/users-email-settings-page.e9bcd865.chunk.js +0 -9
  206. package/build/users-providers-settings-page.a94253e9.chunk.js +0 -14
  207. package/build/webhook-edit-page.77ef4f1a.chunk.js +0 -33
  208. package/ee/admin/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/getTableColumn.js +0 -58
  209. package/ee/admin/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/index.js +0 -3
  210. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/ProtectedPage.js +0 -20
  211. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/ReviewWorkflows.js +0 -204
  212. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/index.js +0 -3
  213. package/ee/server/services/review-workflows/workflows.js +0 -25
@@ -4,20 +4,35 @@ import isEqual from 'lodash/isEqual';
4
4
  import {
5
5
  ACTION_ADD_STAGE,
6
6
  ACTION_DELETE_STAGE,
7
- ACTION_SET_WORKFLOWS,
7
+ ACTION_RESET_WORKFLOW,
8
+ ACTION_SET_WORKFLOW,
8
9
  ACTION_UPDATE_STAGE,
9
10
  ACTION_UPDATE_STAGE_POSITION,
11
+ ACTION_UPDATE_WORKFLOW,
10
12
  STAGE_COLOR_DEFAULT,
11
13
  } from '../constants';
12
14
 
13
15
  export const initialState = {
14
16
  status: 'loading',
15
17
  serverState: {
16
- currentWorkflow: null,
17
- workflows: [],
18
+ workflow: null,
18
19
  },
19
20
  clientState: {
20
- currentWorkflow: { data: null, isDirty: false, hasDeletedServerStages: false },
21
+ currentWorkflow: {
22
+ data: {
23
+ name: '',
24
+ contentTypes: [],
25
+ stages: [
26
+ {
27
+ color: STAGE_COLOR_DEFAULT,
28
+ name: '',
29
+ __temp_key__: 1,
30
+ },
31
+ ],
32
+ },
33
+ isDirty: false,
34
+ hasDeletedServerStages: false,
35
+ },
21
36
  },
22
37
  };
23
38
 
@@ -26,29 +41,31 @@ export function reducer(state = initialState, action) {
26
41
  const { payload } = action;
27
42
 
28
43
  switch (action.type) {
29
- case ACTION_SET_WORKFLOWS: {
30
- const { status, workflows } = payload;
44
+ case ACTION_SET_WORKFLOW: {
45
+ const { status, workflow } = payload;
31
46
 
32
47
  draft.status = status;
33
48
 
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) => ({
49
+ if (workflow) {
50
+ draft.serverState.workflow = workflow;
51
+ draft.clientState.currentWorkflow.data = {
52
+ ...workflow,
53
+ stages: workflow.stages.map((stage) => ({
42
54
  ...stage,
55
+ // A safety net in case a stage does not have a color assigned;
56
+ // this normallly should not happen
43
57
  color: stage?.color ?? STAGE_COLOR_DEFAULT,
44
58
  })),
45
59
  };
46
-
47
- draft.serverState.workflows = workflows;
48
- draft.serverState.currentWorkflow = defaultWorkflow;
49
- draft.clientState.currentWorkflow.data = defaultWorkflow;
50
- draft.clientState.currentWorkflow.hasDeletedServerStages = false;
51
60
  }
61
+
62
+ draft.clientState.currentWorkflow.hasDeletedServerStages = false;
63
+ break;
64
+ }
65
+
66
+ case ACTION_RESET_WORKFLOW: {
67
+ draft.clientState.currentWorkflow.data = initialState.clientState.currentWorkflow.data;
68
+ draft.serverState = initialState.serverState;
52
69
  break;
53
70
  }
54
71
 
@@ -61,8 +78,9 @@ export function reducer(state = initialState, action) {
61
78
  );
62
79
 
63
80
  if (!currentWorkflow.hasDeletedServerStages) {
64
- draft.clientState.currentWorkflow.hasDeletedServerStages =
65
- !!state.serverState.currentWorkflow.stages.find((stage) => stage.id === stageId);
81
+ draft.clientState.currentWorkflow.hasDeletedServerStages = !!(
82
+ state.serverState.currentWorkflow?.stages ?? []
83
+ ).find((stage) => stage.id === stageId);
66
84
  }
67
85
 
68
86
  break;
@@ -125,15 +143,27 @@ export function reducer(state = initialState, action) {
125
143
  break;
126
144
  }
127
145
 
146
+ case ACTION_UPDATE_WORKFLOW: {
147
+ draft.clientState.currentWorkflow.data = {
148
+ ...draft.clientState.currentWorkflow.data,
149
+ ...payload,
150
+ };
151
+
152
+ break;
153
+ }
154
+
128
155
  default:
129
156
  break;
130
157
  }
131
158
 
132
- if (state.clientState.currentWorkflow.data) {
159
+ if (state.clientState.currentWorkflow.data && draft.serverState.workflow) {
133
160
  draft.clientState.currentWorkflow.isDirty = !isEqual(
134
161
  current(draft.clientState.currentWorkflow).data,
135
- draft.serverState.currentWorkflow
162
+ draft.serverState.workflow
136
163
  );
164
+ } else {
165
+ // if there is no workflow on the server, the workflow is awalys considered dirty
166
+ draft.clientState.currentWorkflow.isDirty = true;
137
167
  }
138
168
  });
139
169
  }
@@ -2,33 +2,48 @@ import * as yup from 'yup';
2
2
 
3
3
  export function getWorkflowValidationSchema({ formatMessage }) {
4
4
  return yup.object({
5
- stages: yup.array().of(
6
- yup.object().shape({
7
- name: yup
8
- .string()
9
- .required(
10
- formatMessage({
11
- id: 'Settings.review-workflows.validation.stage.name',
12
- defaultMessage: 'Name is required',
13
- })
14
- )
15
- .max(
16
- 255,
17
- formatMessage({
18
- id: 'Settings.review-workflows.validation.stage.max-length',
19
- defaultMessage: 'Name can not be longer than 255 characters',
20
- })
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),
31
- })
32
- ),
5
+ contentTypes: yup.array().of(yup.string()),
6
+ name: yup
7
+ .string()
8
+ .max(
9
+ 255,
10
+ formatMessage({
11
+ id: 'Settings.review-workflows.validation.name.max-length',
12
+ defaultMessage: 'Name can not be longer than 255 characters',
13
+ })
14
+ )
15
+ .required(),
16
+
17
+ stages: yup
18
+ .array()
19
+ .of(
20
+ yup.object().shape({
21
+ name: yup
22
+ .string()
23
+ .required(
24
+ formatMessage({
25
+ id: 'Settings.review-workflows.validation.stage.name',
26
+ defaultMessage: 'Name is required',
27
+ })
28
+ )
29
+ .max(
30
+ 255,
31
+ formatMessage({
32
+ id: 'Settings.review-workflows.validation.stage.max-length',
33
+ defaultMessage: 'Name can not be longer than 255 characters',
34
+ })
35
+ ),
36
+ color: yup
37
+ .string()
38
+ .required(
39
+ formatMessage({
40
+ id: 'Settings.review-workflows.validation.stage.color',
41
+ defaultMessage: 'Color is required',
42
+ })
43
+ )
44
+ .matches(/^#(?:[0-9a-fA-F]{3}){1,2}$/i),
45
+ })
46
+ )
47
+ .min(1),
33
48
  });
34
49
  }
@@ -8,10 +8,17 @@ import { useIntl } from 'react-intl';
8
8
 
9
9
  import { useLicenseLimits } from '../../../../../../hooks';
10
10
 
11
- const CreateAction = ({ onClick }) => {
11
+ export const CreateActionEE = ({ onClick }) => {
12
12
  const { formatMessage } = useIntl();
13
- const { license } = useLicenseLimits();
14
- const { permittedSeats, shouldStopCreate } = license?.data ?? {};
13
+ const {
14
+ license: { permittedSeats, shouldStopCreate },
15
+ isError,
16
+ isLoading,
17
+ } = useLicenseLimits();
18
+
19
+ if (isError || isLoading) {
20
+ return null;
21
+ }
15
22
 
16
23
  return (
17
24
  <Flex gap={2}>
@@ -47,8 +54,6 @@ const CreateAction = ({ onClick }) => {
47
54
  );
48
55
  };
49
56
 
50
- CreateAction.propTypes = {
57
+ CreateActionEE.propTypes = {
51
58
  onClick: PropTypes.func.isRequired,
52
59
  };
53
-
54
- export default CreateAction;
@@ -0,0 +1,13 @@
1
+ import * as React from 'react';
2
+
3
+ // eslint-disable-next-line import/no-cycle
4
+ import { UserListPageCE } from '../../../../../../../admin/src/pages/SettingsPage/pages/Users/ListPage';
5
+ import { useLicenseLimitNotification } from '../../../../../hooks';
6
+
7
+ function UserListPageEE() {
8
+ useLicenseLimitNotification();
9
+
10
+ return <UserListPageCE />;
11
+ }
12
+
13
+ export default UserListPageEE;
@@ -7,7 +7,7 @@ import basename from '../../../../../../../../admin/src/core/utils/basename';
7
7
  import MagicLinkWrapper from '../../../../../../../../admin/src/pages/SettingsPage/pages/Users/components/MagicLink/MagicLinkWrapper';
8
8
 
9
9
  // FIXME replace with parts compo when ready
10
- const MagicLink = ({ registrationToken }) => {
10
+ export const MagicLinkEE = ({ registrationToken }) => {
11
11
  const { formatMessage } = useIntl();
12
12
 
13
13
  if (registrationToken) {
@@ -34,12 +34,10 @@ const MagicLink = ({ registrationToken }) => {
34
34
  );
35
35
  };
36
36
 
37
- MagicLink.defaultProps = {
37
+ MagicLinkEE.defaultProps = {
38
38
  registrationToken: '',
39
39
  };
40
40
 
41
- MagicLink.propTypes = {
41
+ MagicLinkEE.propTypes = {
42
42
  registrationToken: PropTypes.string,
43
43
  };
44
-
45
- export default MagicLink;
@@ -1,3 +1 @@
1
- import { EventTableEE } from './EventTableEE';
2
-
3
- export default EventTableEE;
1
+ export * from './EventTableEE';
@@ -30,6 +30,30 @@ module.exports = {
30
30
  },
31
31
  ],
32
32
  reviewWorkflows: [
33
+ {
34
+ uid: 'review-workflows.create',
35
+ displayName: 'Create',
36
+ pluginName: 'admin',
37
+ section: 'settings',
38
+ category: 'review workflows',
39
+ subCategory: 'options',
40
+ },
41
+ {
42
+ uid: 'review-workflows.update',
43
+ displayName: 'Update',
44
+ pluginName: 'admin',
45
+ section: 'settings',
46
+ category: 'review workflows',
47
+ subCategory: 'options',
48
+ },
49
+ {
50
+ uid: 'review-workflows.delete',
51
+ displayName: 'Delete',
52
+ pluginName: 'admin',
53
+ section: 'settings',
54
+ category: 'review workflows',
55
+ subCategory: 'options',
56
+ },
33
57
  {
34
58
  uid: 'review-workflows.read',
35
59
  displayName: 'Read',
@@ -1,14 +1,18 @@
1
1
  [
2
2
  {
3
- "name": "To do"
3
+ "name": "To do",
4
+ "color": "#4945FF"
4
5
  },
5
6
  {
6
- "name": "Ready to review"
7
+ "name": "Ready to review",
8
+ "color": "#9736E8"
7
9
  },
8
10
  {
9
- "name": "In progress"
11
+ "name": "In progress",
12
+ "color": "#EE5E52"
10
13
  },
11
14
  {
12
- "name": "Reviewed"
15
+ "name": "Reviewed",
16
+ "color": "#328048"
13
17
  }
14
18
  ]
@@ -1 +1,3 @@
1
- {}
1
+ {
2
+ "name": "Default"
3
+ }
@@ -5,5 +5,14 @@ module.exports = {
5
5
  WORKFLOW_MODEL_UID: 'admin::workflow',
6
6
  STAGE_MODEL_UID: 'admin::workflow-stage',
7
7
  STAGE_DEFAULT_COLOR: '#4945FF',
8
- ENTITY_STAGE_ATTRIBUTE: 'strapi_reviewWorkflows_stage',
8
+ ENTITY_STAGE_ATTRIBUTE: 'strapi_stage',
9
+ MAX_WORKFLOWS: 200,
10
+ MAX_STAGES_PER_WORKFLOW: 200,
11
+ ERRORS: {
12
+ WORKFLOW_WITHOUT_STAGES: 'A workflow must have at least one stage.',
13
+ WORKFLOWS_LIMIT:
14
+ 'You’ve reached the limit of workflows in your plan. Delete a workflow or contact Sales to enable more workflows.',
15
+ STAGES_LIMIT:
16
+ 'You’ve reached the limit of stages for this workflow in your plan. Try deleting some stages or contact Sales to enable more stages.',
17
+ },
9
18
  };
@@ -20,12 +20,22 @@ module.exports = {
20
20
  },
21
21
  },
22
22
  attributes: {
23
+ name: {
24
+ type: 'string',
25
+ required: true,
26
+ unique: true,
27
+ },
23
28
  stages: {
24
29
  type: 'relation',
25
30
  target: 'admin::workflow-stage',
26
31
  relation: 'oneToMany',
27
32
  mappedBy: 'workflow',
28
33
  },
34
+ contentTypes: {
35
+ type: 'json',
36
+ required: true,
37
+ default: [],
38
+ },
29
39
  },
30
40
  },
31
41
  };
@@ -12,7 +12,9 @@ module.exports = {
12
12
  pluralName: 'workflow-stages',
13
13
  displayName: 'Stages',
14
14
  },
15
- options: {},
15
+ options: {
16
+ version: '1.1.0',
17
+ },
16
18
  pluginOptions: {
17
19
  'content-manager': {
18
20
  visible: false,
@@ -42,6 +42,7 @@ module.exports = {
42
42
  shouldStopCreate: isNil(permittedSeats) ? false : currentActiveUserCount >= permittedSeats,
43
43
  licenseLimitStatus,
44
44
  isHostedOnStrapiCloud: env('STRAPI_HOSTING', null) === 'strapi.cloud',
45
+ features: ee.features.list() ?? [],
45
46
  };
46
47
 
47
48
  return { data };
@@ -1,36 +1,163 @@
1
1
  'use strict';
2
2
 
3
+ const { mapAsync } = require('@strapi/utils');
3
4
  const { getService } = require('../../utils');
4
5
 
6
+ const {
7
+ validateWorkflowCreate,
8
+ validateWorkflowUpdate,
9
+ } = require('../../validation/review-workflows');
10
+ const { WORKFLOW_MODEL_UID } = require('../../constants/workflows');
11
+
12
+ /**
13
+ *
14
+ * @param { Strapi } strapi - Strapi instance
15
+ * @param userAbility
16
+ * @return { PermissionChecker }
17
+ */
18
+ function getWorkflowsPermissionChecker({ strapi }, userAbility) {
19
+ return strapi
20
+ .plugin('content-manager')
21
+ .service('permission-checker')
22
+ .create({ userAbility, model: WORKFLOW_MODEL_UID });
23
+ }
24
+
5
25
  module.exports = {
6
26
  /**
7
- * List all workflows
27
+ * Create a new workflow
8
28
  * @param {import('koa').BaseContext} ctx - koa context
9
29
  */
10
- async find(ctx) {
11
- const { populate } = ctx.query;
30
+ async create(ctx) {
31
+ const { body, query } = ctx.request;
32
+ const { sanitizeCreateInput, sanitizeOutput, sanitizedQuery } = getWorkflowsPermissionChecker(
33
+ { strapi },
34
+ ctx.state.userAbility
35
+ );
36
+ const { populate } = await sanitizedQuery.create(query);
37
+
38
+ const workflowBody = await validateWorkflowCreate(body.data);
39
+
40
+ const workflowService = getService('workflows');
41
+ const createdWorkflow = await workflowService.create({
42
+ data: await sanitizeCreateInput(workflowBody),
43
+ populate,
44
+ });
45
+
46
+ ctx.body = {
47
+ data: await sanitizeOutput(createdWorkflow),
48
+ };
49
+ },
50
+
51
+ /**
52
+ * Update a workflow
53
+ * @param {import('koa').BaseContext} ctx - koa context
54
+ */
55
+ async update(ctx) {
56
+ const { id } = ctx.params;
57
+ const { body, query } = ctx.request;
12
58
  const workflowService = getService('workflows');
13
- const data = await workflowService.find({
59
+ const { sanitizeUpdateInput, sanitizeOutput, sanitizedQuery } = getWorkflowsPermissionChecker(
60
+ { strapi },
61
+ ctx.state.userAbility
62
+ );
63
+ const { populate } = await sanitizedQuery.update(query);
64
+
65
+ const workflowBody = await validateWorkflowUpdate(body.data);
66
+
67
+ const workflow = await workflowService.findById(id, { populate: ['stages'] });
68
+ if (!workflow) {
69
+ return ctx.notFound();
70
+ }
71
+ const getPermittedFieldToUpdate = sanitizeUpdateInput(workflow);
72
+
73
+ const dataToUpdate = await getPermittedFieldToUpdate(workflowBody);
74
+
75
+ const updatedWorkflow = await workflowService.update(workflow, {
76
+ data: dataToUpdate,
14
77
  populate,
15
78
  });
16
79
 
17
80
  ctx.body = {
18
- data,
81
+ data: await sanitizeOutput(updatedWorkflow),
82
+ };
83
+ },
84
+
85
+ /**
86
+ * Delete a workflow
87
+ * @param {import('koa').BaseContext} ctx - koa context
88
+ */
89
+ async delete(ctx) {
90
+ const { id } = ctx.params;
91
+ const { query } = ctx.request;
92
+ const workflowService = getService('workflows');
93
+ const { sanitizeOutput, sanitizedQuery } = getWorkflowsPermissionChecker(
94
+ { strapi },
95
+ ctx.state.userAbility
96
+ );
97
+ const { populate } = await sanitizedQuery.delete(query);
98
+
99
+ const workflow = await workflowService.findById(id, { populate: ['stages'] });
100
+ if (!workflow) {
101
+ return ctx.notFound("Workflow doesn't exist");
102
+ }
103
+
104
+ const deletedWorkflow = await workflowService.delete(workflow, { populate });
105
+
106
+ ctx.body = {
107
+ data: await sanitizeOutput(deletedWorkflow),
108
+ };
109
+ },
110
+
111
+ /**
112
+ * List all workflows
113
+ * @param {import('koa').BaseContext} ctx - koa context
114
+ */
115
+ async find(ctx) {
116
+ const { query } = ctx.request;
117
+ const workflowService = getService('workflows');
118
+ const { sanitizeOutput, sanitizedQuery } = getWorkflowsPermissionChecker(
119
+ { strapi },
120
+ ctx.state.userAbility
121
+ );
122
+ const { populate, filters, sort } = await sanitizedQuery.read(query);
123
+
124
+ const [workflows, workflowCount] = await Promise.all([
125
+ workflowService.find({ populate, filters, sort }),
126
+ workflowService.count(),
127
+ ]);
128
+
129
+ ctx.body = {
130
+ data: await mapAsync(workflows, sanitizeOutput),
131
+ meta: {
132
+ workflowCount,
133
+ },
19
134
  };
20
135
  },
21
136
  /**
22
137
  * Get one workflow based on its id contained in request parameters
138
+ * Returns count of workflows in meta, used to prevent workflow edition when
139
+ * max workflow count is reached for the current plan
23
140
  * @param {import('koa').BaseContext} ctx - koa context
24
141
  */
25
142
  async findById(ctx) {
26
143
  const { id } = ctx.params;
27
- const { populate } = ctx.query;
144
+ const { query } = ctx.request;
145
+ const { sanitizeOutput, sanitizedQuery } = getWorkflowsPermissionChecker(
146
+ { strapi },
147
+ ctx.state.userAbility
148
+ );
149
+ const { populate } = await sanitizedQuery.read(query);
28
150
 
29
151
  const workflowService = getService('workflows');
30
- const data = await workflowService.findById(id, { populate });
152
+
153
+ const [workflow, workflowCount] = await Promise.all([
154
+ workflowService.findById(id, { populate }),
155
+ workflowService.count(),
156
+ ]);
31
157
 
32
158
  ctx.body = {
33
- data,
159
+ data: await sanitizeOutput(workflow),
160
+ meta: { workflowCount },
34
161
  };
35
162
  },
36
163
  };