@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
@@ -1,22 +1,40 @@
1
1
  import React from 'react';
2
2
 
3
- import { BaseCheckbox, IconButton, Tbody, Td, Tr, Flex } from '@strapi/design-system';
4
- import { useTracking, useFetchClient, useAPIErrorHandler } from '@strapi/helper-plugin';
3
+ import {
4
+ BaseCheckbox,
5
+ IconButton,
6
+ Tbody,
7
+ Td,
8
+ Tr,
9
+ Flex,
10
+ Status,
11
+ Typography,
12
+ } from '@strapi/design-system';
13
+ import {
14
+ useTracking,
15
+ useFetchClient,
16
+ useAPIErrorHandler,
17
+ useQueryParams,
18
+ } from '@strapi/helper-plugin';
5
19
  import { Trash, Duplicate, Pencil } from '@strapi/icons';
6
20
  import { AxiosError } from 'axios';
7
21
  import PropTypes from 'prop-types';
8
22
  import { useIntl } from 'react-intl';
9
23
  import { Link, useHistory } from 'react-router-dom';
10
24
 
25
+ import { useEnterprise } from '../../../../../hooks/useEnterprise';
11
26
  import { getFullName } from '../../../../../utils';
12
27
  import { usePluginsQueryParams } from '../../../../hooks';
13
28
  import { getTrad } from '../../../../utils';
14
29
  import CellContent from '../CellContent';
15
30
 
31
+ const REVIEW_WORKFLOW_COLUMNS_CE = () => null;
32
+
16
33
  export const TableRows = ({
17
34
  canCreate,
18
35
  canDelete,
19
36
  contentType,
37
+ features: { hasDraftAndPublish, hasReviewWorkflows },
20
38
  headers,
21
39
  entriesToDelete,
22
40
  onClickDelete,
@@ -32,7 +50,20 @@ export const TableRows = ({
32
50
 
33
51
  const { trackUsage } = useTracking();
34
52
  const pluginsQueryParams = usePluginsQueryParams();
53
+ const [{ query }] = useQueryParams();
35
54
  const { formatAPIError } = useAPIErrorHandler(getTrad);
55
+ const ReviewWorkflowsStage = useEnterprise(
56
+ REVIEW_WORKFLOW_COLUMNS_CE,
57
+ async () =>
58
+ (
59
+ await import(
60
+ '../../../../../../../ee/admin/content-manager/pages/ListView/ReviewWorkflowsColumn'
61
+ )
62
+ ).ReviewWorkflowsStageEE,
63
+ {
64
+ enabled: hasReviewWorkflows,
65
+ }
66
+ );
36
67
 
37
68
  /**
38
69
  *
@@ -53,7 +84,9 @@ export const TableRows = ({
53
84
  const handleCloneClick = (id) => async () => {
54
85
  try {
55
86
  const { data } = await post(
56
- `/content-manager/collection-types/${contentType.uid}/auto-clone/${id}?${pluginsQueryParams}`
87
+ `/content-manager/collection-types/${contentType.uid}/auto-clone/${id}`,
88
+ {},
89
+ { params: { plugins: query?.plugins } }
57
90
  );
58
91
 
59
92
  if ('id' in data) {
@@ -74,6 +107,11 @@ export const TableRows = ({
74
107
  }
75
108
  };
76
109
 
110
+ // block rendering until the review stage component is fully loaded in EE
111
+ if (!ReviewWorkflowsStage) {
112
+ return null;
113
+ }
114
+
77
115
  /**
78
116
  * Table Cells with actions e.g edit, delete, duplicate have `stopPropagation`
79
117
  * to prevent the row from being selected.
@@ -113,20 +151,57 @@ export const TableRows = ({
113
151
  />
114
152
  </Td>
115
153
  )}
154
+
116
155
  {headers.map(({ key, cellFormatter, name, ...rest }) => {
156
+ if (hasDraftAndPublish && name === 'publishedAt') {
157
+ return (
158
+ <Td key={key}>
159
+ <Status
160
+ width="min-content"
161
+ showBullet={false}
162
+ variant={data.publishedAt ? 'success' : 'secondary'}
163
+ size="S"
164
+ >
165
+ <Typography
166
+ fontWeight="bold"
167
+ textColor={`${data.publishedAt ? 'success' : 'secondary'}700`}
168
+ >
169
+ {formatMessage({
170
+ id: getTrad(
171
+ `containers.List.${data.publishedAt ? 'published' : 'draft'}`
172
+ ),
173
+ defaultMessage: data.publishedAt ? 'Published' : 'Draft',
174
+ })}
175
+ </Typography>
176
+ </Status>
177
+ </Td>
178
+ );
179
+ }
180
+
181
+ if (hasReviewWorkflows && name === 'strapi_reviewWorkflows_stage') {
182
+ return (
183
+ <Td key={key}>
184
+ {data.strapi_stage ? (
185
+ <ReviewWorkflowsStage
186
+ color={data.strapi_stage.color}
187
+ name={data.strapi_stage.name}
188
+ />
189
+ ) : (
190
+ <Typography textColor="neutral800">-</Typography>
191
+ )}
192
+ </Td>
193
+ );
194
+ }
195
+
117
196
  return (
118
197
  <Td key={key}>
119
- {typeof cellFormatter === 'function' ? (
120
- cellFormatter(data, { key, name, ...rest })
121
- ) : (
122
- <CellContent
123
- content={data[name.split('.')[0]]}
124
- name={name}
125
- contentType={contentType}
126
- {...rest}
127
- rowId={data.id}
128
- />
129
- )}
198
+ <CellContent
199
+ content={data[name.split('.')[0]]}
200
+ name={name}
201
+ contentType={contentType}
202
+ {...rest}
203
+ rowId={data.id}
204
+ />
130
205
  </Td>
131
206
  );
132
207
  })}
@@ -212,6 +287,10 @@ TableRows.propTypes = {
212
287
  uid: PropTypes.string.isRequired,
213
288
  }).isRequired,
214
289
  entriesToDelete: PropTypes.array,
290
+ features: PropTypes.shape({
291
+ hasDraftAndPublish: PropTypes.bool.isRequired,
292
+ hasReviewWorkflows: PropTypes.bool.isRequired,
293
+ }).isRequired,
215
294
  headers: PropTypes.array.isRequired,
216
295
  onClickDelete: PropTypes.func,
217
296
  onSelectRow: PropTypes.func,
@@ -10,8 +10,6 @@ import {
10
10
  HeaderLayout,
11
11
  useNotifyAT,
12
12
  Flex,
13
- Typography,
14
- Status,
15
13
  } from '@strapi/design-system';
16
14
  import {
17
15
  NoPermissions,
@@ -33,7 +31,6 @@ import {
33
31
  } from '@strapi/helper-plugin';
34
32
  import { ArrowLeft, Cog, Plus } from '@strapi/icons';
35
33
  import axios from 'axios';
36
- import getReviewWorkflowsColumn from 'ee_else_ce/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/getTableColumn';
37
34
  import isEqual from 'lodash/isEqual';
38
35
  import PropTypes from 'prop-types';
39
36
  import { stringify } from 'qs';
@@ -45,6 +42,7 @@ import { bindActionCreators, compose } from 'redux';
45
42
  import styled from 'styled-components';
46
43
 
47
44
  import { INJECT_COLUMN_IN_TABLE } from '../../../exposedHooks';
45
+ import { useEnterprise } from '../../../hooks/useEnterprise';
48
46
  import { selectAdminPermissions } from '../../../pages/App/selectors';
49
47
  import { InjectionZone } from '../../../shared/components';
50
48
  import AttributeFilter from '../../components/AttributeFilter';
@@ -57,7 +55,7 @@ import { ConfirmDialogDeleteAll } from './components/ConfirmDialogDeleteAll';
57
55
  import { FieldPicker } from './components/FieldPicker';
58
56
  import { TableRows } from './components/TableRows';
59
57
  import makeSelectListView, { selectDisplayedHeaders } from './selectors';
60
- import { buildQueryString } from './utils';
58
+ import { buildValidGetParams } from './utils';
61
59
 
62
60
  const ConfigureLayoutBox = styled(Box)`
63
61
  svg {
@@ -67,6 +65,8 @@ const ConfigureLayoutBox = styled(Box)`
67
65
  }
68
66
  `;
69
67
 
68
+ const REVIEW_WORKFLOW_COLUMNS_CE = null;
69
+
70
70
  function ListView({
71
71
  canCreate,
72
72
  canDelete,
@@ -101,14 +101,30 @@ function ListView({
101
101
  useFocusWhenNavigate();
102
102
 
103
103
  const [{ query }] = useQueryParams();
104
- const params = buildQueryString(query);
104
+ const params = React.useMemo(() => buildValidGetParams(query), [query]);
105
105
  const pluginsQueryParams = stringify({ plugins: query.plugins }, { encode: false });
106
106
 
107
107
  const { pathname } = useLocation();
108
108
  const { push } = useHistory();
109
109
  const { formatMessage } = useIntl();
110
- const hasDraftAndPublish = options?.draftAndPublish || false;
111
110
  const fetchClient = useFetchClient();
111
+
112
+ const hasDraftAndPublish = options?.draftAndPublish ?? false;
113
+ const hasReviewWorkflows = options?.reviewWorkflows ?? false;
114
+
115
+ const reviewWorkflowColumns = useEnterprise(
116
+ REVIEW_WORKFLOW_COLUMNS_CE,
117
+ async () =>
118
+ (
119
+ await import(
120
+ '../../../../../ee/admin/content-manager/pages/ListView/ReviewWorkflowsColumn/constants'
121
+ )
122
+ ).REVIEW_WORKFLOW_COLUMNS_EE,
123
+ {
124
+ enabled: !!options?.reviewWorkflows,
125
+ }
126
+ );
127
+
112
128
  const { post, del } = fetchClient;
113
129
 
114
130
  const bulkPublishMutation = useMutation(
@@ -121,7 +137,7 @@ function ListView({
121
137
  message: { id: 'content-manager.success.record.publish', defaultMessage: 'Published' },
122
138
  });
123
139
 
124
- fetchData(`/content-manager/collection-types/${slug}${params}`);
140
+ fetchData(`/content-manager/collection-types/${slug}`, { params });
125
141
  },
126
142
  onError(error) {
127
143
  toggleNotification({
@@ -144,7 +160,7 @@ function ListView({
144
160
  },
145
161
  });
146
162
 
147
- fetchData(`/content-manager/collection-types/${slug}${params}`);
163
+ fetchData(`/content-manager/collection-types/${slug}`, { params });
148
164
  },
149
165
  onError(error) {
150
166
  toggleNotification({
@@ -159,19 +175,17 @@ function ListView({
159
175
  // Using a ref to avoid requests being fired multiple times on slug on change
160
176
  // We need it because the hook as mulitple dependencies so it may run before the permissions have checked
161
177
  const requestUrlRef = React.useRef('');
162
-
163
178
  /**
164
179
  * TODO: re-write all of this, it's a mess.
165
180
  */
166
181
  const fetchData = React.useCallback(
167
- async (endPoint, source) => {
182
+ async (endPoint, options) => {
168
183
  getData();
169
184
 
170
185
  try {
171
- const opts = source ? { cancelToken: source.token } : null;
172
186
  const {
173
187
  data: { results, pagination: paginationResult },
174
- } = await fetchClient.get(endPoint, opts);
188
+ } = await fetchClient.get(endPoint, options);
175
189
 
176
190
  notifyStatus(
177
191
  formatMessage(
@@ -218,12 +232,12 @@ function ListView({
218
232
  const handleConfirmDeleteAllData = React.useCallback(
219
233
  async (ids) => {
220
234
  try {
221
- await post(getRequestUrl(`collection-types/${slug}/actions/bulkDelete`), {
235
+ await post(`/content-manager/collection-types/${slug}/actions/bulkDelete`, {
222
236
  ids,
223
237
  });
224
238
 
225
- const requestUrl = getRequestUrl(`collection-types/${slug}${params}`);
226
- fetchData(requestUrl);
239
+ fetchData(`/content-manager/collection-types/${slug}`, { params });
240
+
227
241
  trackUsageRef.current('didBulkDeleteEntries');
228
242
  } catch (err) {
229
243
  toggleNotification({
@@ -232,16 +246,16 @@ function ListView({
232
246
  });
233
247
  }
234
248
  },
235
- [fetchData, params, slug, toggleNotification, formatAPIError, post]
249
+ [slug, toggleNotification, formatAPIError, post, fetchData, params]
236
250
  );
237
251
 
238
252
  const handleConfirmDeleteData = React.useCallback(
239
253
  async (idToDelete) => {
240
254
  try {
241
- await del(getRequestUrl(`collection-types/${slug}/${idToDelete}`));
255
+ await del(`/content-manager/collection-types/${slug}/${idToDelete}`);
242
256
 
243
- const requestUrl = getRequestUrl(`collection-types/${slug}${params}`);
244
- fetchData(requestUrl);
257
+ const requestUrl = getRequestUrl(`collection-types/${slug}`);
258
+ fetchData(requestUrl, { params });
245
259
 
246
260
  toggleNotification({
247
261
  type: 'success',
@@ -254,7 +268,7 @@ function ListView({
254
268
  });
255
269
  }
256
270
  },
257
- [slug, params, fetchData, toggleNotification, formatAPIError, del]
271
+ [slug, toggleNotification, formatAPIError, del, fetchData, params]
258
272
  );
259
273
 
260
274
  /**
@@ -326,10 +340,10 @@ function ListView({
326
340
  const source = CancelToken.source();
327
341
 
328
342
  const shouldSendRequest = canRead;
329
- const requestUrl = getRequestUrl(`collection-types/${slug}${params}`);
343
+ const requestUrl = getRequestUrl(`collection-types/${slug}`);
330
344
 
331
345
  if (shouldSendRequest && requestUrl.includes(requestUrlRef.current)) {
332
- fetchData(requestUrl, source);
346
+ fetchData(requestUrl, { cancelToken: source.token, params });
333
347
  }
334
348
 
335
349
  return () => {
@@ -388,24 +402,8 @@ function ListView({
388
402
  };
389
403
  });
390
404
 
391
- if (!hasDraftAndPublish) {
392
- return formattedHeaders;
393
- }
394
-
395
- // this should not exist. Ideally we would use registerHook() similar to what has been done
396
- // in the i18n plugin. In order to do that review-workflows should have been a plugin. In
397
- // a future iteration we need to find a better pattern.
398
-
399
- // In CE this will return null - in EE a column definition including the custom formatting component.
400
- const reviewWorkflowColumn = getReviewWorkflowsColumn(layout);
401
-
402
- if (reviewWorkflowColumn) {
403
- formattedHeaders.push(reviewWorkflowColumn);
404
- }
405
-
406
- return [
407
- ...formattedHeaders,
408
- {
405
+ if (hasDraftAndPublish) {
406
+ formattedHeaders.push({
409
407
  key: '__published_at_temp_key__',
410
408
  name: 'publishedAt',
411
409
  fieldSchema: {
@@ -419,25 +417,29 @@ function ListView({
419
417
  searchable: false,
420
418
  sortable: true,
421
419
  },
422
- // eslint-disable-next-line react/no-unstable-nested-components
423
- cellFormatter(cellData) {
424
- const isPublished = cellData.publishedAt;
425
- const variant = isPublished ? 'success' : 'secondary';
426
-
427
- return (
428
- <Status width="min-content" showBullet={false} variant={variant} size="S">
429
- <Typography fontWeight="bold" textColor={`${variant}700`}>
430
- {formatMessage({
431
- id: getTrad(`containers.List.${isPublished ? 'published' : 'draft'}`),
432
- defaultMessage: isPublished ? 'Published' : 'Draft',
433
- })}
434
- </Typography>
435
- </Status>
436
- );
437
- },
438
- },
439
- ];
440
- }, [runHookWaterfall, displayedHeaders, layout, hasDraftAndPublish, formatMessage]);
420
+ });
421
+ }
422
+
423
+ if (reviewWorkflowColumns) {
424
+ // Make sure the column header label is translated
425
+ if (typeof reviewWorkflowColumns.metadatas.label !== 'string') {
426
+ reviewWorkflowColumns.metadatas.label = formatMessage(
427
+ reviewWorkflowColumns.metadatas.label
428
+ );
429
+ }
430
+
431
+ formattedHeaders.push(reviewWorkflowColumns);
432
+ }
433
+
434
+ return formattedHeaders;
435
+ }, [
436
+ runHookWaterfall,
437
+ displayedHeaders,
438
+ layout,
439
+ reviewWorkflowColumns,
440
+ hasDraftAndPublish,
441
+ formatMessage,
442
+ ]);
441
443
 
442
444
  const subtitle = canRead
443
445
  ? formatMessage(
@@ -580,6 +582,10 @@ function ListView({
580
582
  canCreate={canCreate}
581
583
  canDelete={canDelete}
582
584
  contentType={contentType}
585
+ features={{
586
+ hasDraftAndPublish,
587
+ hasReviewWorkflows,
588
+ }}
583
589
  headers={tableHeaders}
584
590
  rows={data}
585
591
  withBulkActions
@@ -0,0 +1,30 @@
1
+ const createPluginsFilter = (obj = {}) =>
2
+ Object.values(obj).reduce((acc, current) => Object.assign(acc, current), {});
3
+
4
+ /**
5
+ * @description
6
+ * Creates a valid query params object for get requests
7
+ * ie. plugins[18n][locale]=en becomes locale=en
8
+ * @param {object} [query={}] - The query params
9
+ * @returns {object} - The modified query params
10
+ */
11
+ const buildValidGetParams = (query = {}) => {
12
+ // Extract pluginOptions from the query, they shouldn't be part of the URL
13
+ const {
14
+ plugins: _,
15
+ _q: searchQuery,
16
+ ...validQueryParams
17
+ } = {
18
+ ...query,
19
+ ...createPluginsFilter(query.plugins),
20
+ };
21
+
22
+ if (searchQuery) {
23
+ // Encode the search query here since the paramsSerializer will not
24
+ validQueryParams._q = encodeURIComponent(searchQuery);
25
+ }
26
+
27
+ return validQueryParams;
28
+ };
29
+
30
+ export default buildValidGetParams;
@@ -1 +1 @@
1
- export { default as buildQueryString } from './buildQueryString';
1
+ export { default as buildValidGetParams } from './buildValidGetParams';
@@ -1,3 +1,4 @@
1
+ import merge from 'lodash/merge';
1
2
  import set from 'lodash/set';
2
3
 
3
4
  const mergeMetasWithSchema = (data, schemas, mainSchemaKey) => {
@@ -6,7 +7,10 @@ const mergeMetasWithSchema = (data, schemas, mainSchemaKey) => {
6
7
  const mainUID = data[mainSchemaKey].uid;
7
8
  const mainSchema = findSchema(mainUID);
8
9
 
9
- set(merged, [mainSchemaKey], { ...data[mainSchemaKey], ...mainSchema });
10
+ // TODO
11
+ // In order to merge all the layers of the schema objects, we used the Lodash function "merge".
12
+ // If the destructuration is used, it will only merge the first layer of properties and overwrite the nested objects.
13
+ set(merged, [mainSchemaKey], merge({}, mainSchema, data[mainSchemaKey]));
10
14
 
11
15
  Object.keys(data.components).forEach((compoUID) => {
12
16
  const compoSchema = findSchema(compoUID);
@@ -3,7 +3,6 @@ export { useContentTypes } from './useContentTypes';
3
3
  export { default as useFetchPermissionsLayout } from './useFetchPermissionsLayout';
4
4
  export { default as useFetchRole } from './useFetchRole';
5
5
  export { default as useLicenseLimitNotification } from './useLicenseLimitNotification';
6
- export { default as useLicenseLimit } from './useLicenseLimits';
7
6
  export { default as useMenu } from './useMenu';
8
7
  export { default as usePermissionsDataManager } from './usePermissionsDataManager';
9
8
  export { default as useRegenerate } from './useRegenerate';
@@ -1,10 +1,8 @@
1
1
  import { useFetchClient } from '@strapi/helper-plugin';
2
- import { stringify } from 'qs';
3
2
  import { useQuery } from 'react-query';
4
3
 
5
4
  export function useAdminUsers(params = {}, queryOptions = {}) {
6
5
  const { id = '', ...queryParams } = params;
7
- const queryString = stringify(queryParams, { encode: false });
8
6
 
9
7
  const { get } = useFetchClient();
10
8
 
@@ -13,7 +11,9 @@ export function useAdminUsers(params = {}, queryOptions = {}) {
13
11
  async () => {
14
12
  const {
15
13
  data: { data },
16
- } = await get(`/admin/users/${id}${queryString ? `?${queryString}` : ''}`);
14
+ } = await get(`/admin/users/${id}`, {
15
+ params: queryParams,
16
+ });
17
17
 
18
18
  return data;
19
19
  },
@@ -9,7 +9,7 @@ function isEnterprise() {
9
9
  export function useEnterprise(
10
10
  ceData,
11
11
  eeCallback,
12
- { defaultValue = null, combine = (ceData, eeData) => eeData } = {}
12
+ { defaultValue = null, combine = (ceData, eeData) => eeData, enabled = true } = {}
13
13
  ) {
14
14
  const eeCallbackRef = useCallbackRef(eeCallback);
15
15
  const combineCallbackRef = useCallbackRef(combine);
@@ -17,7 +17,7 @@ export function useEnterprise(
17
17
  // We have to use a nested object here, because functions (e.g. Components)
18
18
  // can not be stored as value directly
19
19
  const [{ data }, setData] = React.useState({
20
- data: isEnterprise() ? defaultValue : ceData,
20
+ data: isEnterprise() && enabled ? defaultValue : ceData,
21
21
  });
22
22
 
23
23
  React.useEffect(() => {
@@ -27,10 +27,10 @@ export function useEnterprise(
27
27
  setData({ data: combineCallbackRef(ceData, eeData) });
28
28
  }
29
29
 
30
- if (isEnterprise()) {
30
+ if (isEnterprise() && enabled) {
31
31
  importEE();
32
32
  }
33
- }, [ceData, eeCallbackRef, combineCallbackRef]);
33
+ }, [ceData, eeCallbackRef, combineCallbackRef, enabled]);
34
34
 
35
35
  return data;
36
36
  }
@@ -1,4 +1,4 @@
1
- import { useState, useEffect } from 'react';
1
+ import { useState, useEffect, useCallback } from 'react';
2
2
 
3
3
  import { hasPermissions, useRBACProvider, useStrapiApp, useAppInfo } from '@strapi/helper-plugin';
4
4
  import { useSelector } from 'react-redux';
@@ -19,25 +19,15 @@ const useSettingsMenu = () => {
19
19
  const { shouldUpdateStrapi } = useAppInfo();
20
20
  const { settings } = useStrapiApp();
21
21
  const permissions = useSelector(selectAdminPermissions);
22
+
22
23
  const { global: globalLinks, admin: adminLinks } = useEnterprise(
23
24
  LINKS_CE,
24
25
  async () => (await import('../../../../ee/admin/hooks/useSettingsMenu/constants')).LINKS_EE,
25
26
  {
26
27
  combine(ceLinks, eeLinks) {
27
- function addPermissions(link) {
28
- if (!link.id) {
29
- throw new Error('The settings menu item must have an id attribute.');
30
- }
31
-
32
- return {
33
- ...link,
34
- permissions: permissions.settings?.[link.id]?.main,
35
- };
36
- }
37
-
38
28
  return {
39
- admin: [...eeLinks.admin, ...ceLinks.admin].map(addPermissions),
40
- global: [...ceLinks.global, ...eeLinks.global].map(addPermissions),
29
+ admin: [...eeLinks.admin, ...ceLinks.admin],
30
+ global: [...ceLinks.global, ...eeLinks.global],
41
31
  };
42
32
  },
43
33
  defaultValue: {
@@ -47,6 +37,20 @@ const useSettingsMenu = () => {
47
37
  }
48
38
  );
49
39
 
40
+ const addPermissions = useCallback(
41
+ (link) => {
42
+ if (!link.id) {
43
+ throw new Error('The settings menu item must have an id attribute.');
44
+ }
45
+
46
+ return {
47
+ ...link,
48
+ permissions: permissions.settings?.[link.id]?.main,
49
+ };
50
+ },
51
+ [permissions.settings]
52
+ );
53
+
50
54
  useEffect(() => {
51
55
  const getData = async () => {
52
56
  const buildMenuPermissions = (sections) =>
@@ -86,26 +90,36 @@ const useSettingsMenu = () => {
86
90
  };
87
91
 
88
92
  const { global, ...otherSections } = settings;
93
+
89
94
  const sections = formatLinks([
90
95
  {
91
96
  ...settings.global,
92
- links: sortLinks([...settings.global.links, ...globalLinks]).map((link) => ({
93
- ...link,
94
- hasNotification: link.id === '000-application-infos' && shouldUpdateStrapi,
95
- })),
97
+ links: sortLinks([...settings.global.links, ...globalLinks.map(addPermissions)]).map(
98
+ (link) => ({
99
+ ...link,
100
+ hasNotification: link.id === '000-application-infos' && shouldUpdateStrapi,
101
+ })
102
+ ),
96
103
  },
97
104
  {
98
105
  id: 'permissions',
99
106
  intlLabel: { id: 'Settings.permissions', defaultMessage: 'Administration Panel' },
100
- links: adminLinks,
107
+ links: adminLinks.map(addPermissions),
101
108
  },
102
109
  ...Object.values(otherSections),
103
110
  ]);
104
111
 
105
112
  getData();
106
- }, [adminLinks, globalLinks, userPermissions, settings, shouldUpdateStrapi]);
113
+ }, [adminLinks, globalLinks, userPermissions, settings, shouldUpdateStrapi, addPermissions]);
114
+
115
+ const filterMenu = (menuItem) => {
116
+ return {
117
+ ...menuItem,
118
+ links: menuItem.links.filter((link) => link.isDisplayed),
119
+ };
120
+ };
107
121
 
108
- return { isLoading, menu };
122
+ return { isLoading, menu: menu.map(filterMenu) };
109
123
  };
110
124
 
111
125
  export default useSettingsMenu;