@strapi/admin 4.11.3 → 4.12.0-beta.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/components/AuthenticatedApp/index.js +2 -2
- package/admin/src/constants.js +83 -83
- package/admin/src/content-manager/components/CollectionTypeFormWrapper/index.js +8 -5
- package/admin/src/content-manager/components/Inputs/index.js +3 -47
- package/admin/src/content-manager/components/RelationInput/RelationInput.js +99 -178
- package/admin/src/content-manager/components/RelationInput/components/Option.js +17 -15
- package/admin/src/content-manager/components/RelationInput/components/RelationList.js +2 -2
- package/admin/src/content-manager/components/SingleTypeFormWrapper/index.js +34 -37
- package/admin/src/content-manager/pages/EditSettingsView/components/ModalForm.js +0 -27
- package/admin/src/content-manager/pages/ListView/components/TableRows/index.js +93 -14
- package/admin/src/content-manager/pages/ListView/index.js +65 -47
- package/admin/src/content-manager/pages/ListView/utils/buildValidGetParams.js +30 -0
- package/admin/src/content-manager/pages/ListView/utils/index.js +1 -1
- package/admin/src/content-manager/utils/mergeMetasWithSchema.js +5 -1
- package/admin/src/hooks/index.js +0 -1
- package/admin/src/hooks/useAdminUsers/useAdminUsers.js +3 -3
- package/admin/src/hooks/useEnterprise/useEnterprise.js +4 -4
- package/admin/src/pages/App/index.js +28 -23
- package/admin/src/pages/AuthPage/components/Register/index.js +5 -1
- package/admin/src/pages/ProfilePage/index.js +6 -1
- package/admin/src/pages/SettingsPage/components/Tokens/Table/index.js +15 -1
- package/admin/src/pages/SettingsPage/components/Tokens/TokenBox/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Roles/ProtectedEditPage/index.js +4 -10
- package/admin/src/pages/SettingsPage/pages/Users/EditPage/index.js +2 -2
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/WebhookForm/utils/makeWebhookValidationSchema.js +11 -5
- package/admin/src/translations/ca.json +1 -0
- package/admin/src/translations/en.json +4 -1
- package/admin/src/translations/es.json +5 -0
- package/admin/src/translations/fr.json +1 -0
- package/admin/src/translations/zh-Hans.json +1 -1
- package/build/0cd5f8915b265d5b1856.png +0 -0
- package/build/2799.cf9b491f.chunk.js +1 -0
- package/build/4485.d3c6dd1d.chunk.js +6 -0
- package/build/539.865446c0.chunk.js +1 -0
- package/build/{5542.64b623c9.chunk.js → 5542.c62d0daf.chunk.js} +1 -1
- package/build/{5563.86f9aa9c.chunk.js → 5563.a146acac.chunk.js} +2 -2
- package/build/7018.f3dad3c1.chunk.js +1 -0
- package/build/7259.0e25ab5d.chunk.js +1 -0
- package/build/9465.d8fc1377.chunk.js +112 -0
- package/build/{6405.27e1bee5.chunk.js → 970.89601f27.chunk.js} +2 -2
- package/build/9944.29289a16.chunk.js +26 -0
- package/build/Admin-authenticatedApp.9d3afb79.chunk.js +79 -0
- package/build/{Admin_settingsPage.4069bb8a.chunk.js → Admin_settingsPage.074655f6.chunk.js} +13 -13
- package/build/admin-app.3ede71ad.chunk.js +61 -0
- package/build/{admin-edit-roles-page.2040034a.chunk.js → admin-edit-roles-page.3fdd6b9d.chunk.js} +11 -11
- package/build/admin-edit-users.78552758.chunk.js +10 -0
- package/build/admin-users.c23322fc.chunk.js +11 -0
- package/build/api-tokens-list-page.a103f526.chunk.js +16 -0
- package/build/audit-logs-settings-page.37fe915c.chunk.js +1 -0
- package/build/ca-json.1fed5d8b.chunk.js +1 -0
- package/build/content-manager.08541eeb.chunk.js +1094 -0
- package/build/{content-type-builder-list-view.0c3ceb4e.chunk.js → content-type-builder-list-view.a200a358.chunk.js} +1 -1
- package/build/content-type-builder-translation-en-json.38e20391.chunk.js +1 -0
- package/build/content-type-builder.de22f7c9.chunk.js +166 -0
- package/build/{email-settings-page.6b38222d.chunk.js → email-settings-page.45695daa.chunk.js} +1 -1
- package/build/en-json.fb9f6ddd.chunk.js +1 -0
- package/build/es-json.42096084.chunk.js +1 -0
- package/build/fr-json.69789980.chunk.js +1 -0
- package/build/{i18n-settings-page.ff863f20.chunk.js → i18n-settings-page.29308d0b.chunk.js} +1 -1
- package/build/index.html +1 -1
- package/build/main.a8ede50d.js +2927 -0
- package/build/review-workflows-settings-create-view.56f61e18.chunk.js +1 -0
- package/build/review-workflows-settings-edit-view.912bc9c0.chunk.js +1 -0
- package/build/review-workflows-settings-list-view.cf6a08d3.chunk.js +56 -0
- package/build/runtime~main.5e9bf4b3.js +2 -0
- package/build/sso-settings-page.0cdb96a6.chunk.js +1 -0
- package/build/transfer-tokens-list-page.7237443d.chunk.js +16 -0
- package/build/{upload-settings.43cf16cd.chunk.js → upload-settings.cb6c14c3.chunk.js} +1 -1
- package/build/{upload.72f8f8fc.chunk.js → upload.7e629643.chunk.js} +2 -2
- package/build/users-advanced-settings-page.750b1f76.chunk.js +9 -0
- package/build/{users-email-settings-page.33359797.chunk.js → users-email-settings-page.e9bcd865.chunk.js} +1 -1
- package/build/{users-providers-settings-page.1e7a4a71.chunk.js → users-providers-settings-page.a94253e9.chunk.js} +1 -1
- package/build/{users-roles-settings-page.235378b6.chunk.js → users-roles-settings-page.d286426a.chunk.js} +5 -5
- package/build/webhook-edit-page.77ef4f1a.chunk.js +33 -0
- package/build/{zh-Hans-json.4cfef87d.chunk.js → zh-Hans-json.fada6f40.chunk.js} +1 -1
- package/ee/admin/constants.js +14 -14
- package/ee/admin/content-manager/pages/EditView/InformationBox/InformationBoxEE.js +84 -30
- package/ee/admin/content-manager/{components/DynamicTable/CellContent/ReviewWorkflowsStage → pages/ListView/ReviewWorkflowsColumn}/ReviewWorkflowsStageEE.js +7 -2
- package/ee/admin/content-manager/pages/ListView/ReviewWorkflowsColumn/constants.js +24 -0
- package/ee/admin/content-manager/pages/ListView/ReviewWorkflowsColumn/index.js +1 -0
- package/ee/admin/hooks/useLicenseLimitNotification/index.js +17 -6
- package/ee/admin/hooks/useLicenseLimits/index.js +1 -32
- package/ee/admin/hooks/useLicenseLimits/useLicenseLimits.js +44 -0
- package/ee/admin/pages/SettingsPage/constants.js +25 -1
- package/ee/admin/pages/SettingsPage/pages/ApplicationInfosPage/components/AdminSeatInfo/index.js +6 -4
- package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/hooks/useAuditLogsData.js +6 -4
- package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/index.js +4 -9
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/actions/index.js +19 -4
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Layout/Layout.js +65 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Layout/index.js +1 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/LimitsModal/LimitsModal.js +111 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/LimitsModal/assets/balloon.png +0 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/LimitsModal/index.js +3 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/ProtectedPage/ProtectedPage.js +21 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/ProtectedPage/index.js +1 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/Stage/Stage.js +4 -4
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/WorkflowAttributes/WorkflowAttributes.js +110 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/WorkflowAttributes/index.js +1 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/constants.js +3 -1
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/hooks/useReviewWorkflows.js +13 -19
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/CreateView/CreateView.js +246 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/CreateView/index.js +13 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/EditView/EditView.js +269 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/EditView/index.js +13 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/ListView/ListView.js +382 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/ListView/index.js +13 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/reducer/index.js +53 -23
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/utils/getWorkflowValidationSchema.js +43 -28
- package/ee/admin/pages/SettingsPage/pages/SingleSignOn/index.js +4 -9
- package/ee/admin/pages/SettingsPage/pages/Users/ListPage/CreateAction/index.js +9 -2
- package/ee/server/config/admin-actions.js +24 -0
- package/ee/server/constants/default-stages.json +8 -4
- package/ee/server/constants/default-workflow.json +3 -1
- package/ee/server/constants/workflows.js +10 -1
- package/ee/server/content-types/workflow/index.js +10 -0
- package/ee/server/content-types/workflow-stage/index.js +3 -1
- package/ee/server/controllers/admin.js +1 -0
- package/ee/server/controllers/workflows/index.js +135 -8
- package/ee/server/controllers/workflows/stages/index.js +38 -38
- package/ee/server/migrations/review-workflows-content-types.js +29 -0
- package/ee/server/migrations/review-workflows-deleted-ct-in-workflows.js +39 -0
- package/ee/server/migrations/review-workflows-stage-attribute.js +49 -0
- package/ee/server/migrations/review-workflows-stages-color.js +2 -2
- package/ee/server/migrations/review-workflows-workflow-name.js +21 -0
- package/ee/server/register.js +12 -2
- package/ee/server/routes/review-workflows.js +44 -10
- package/ee/server/services/index.js +1 -0
- package/ee/server/services/review-workflows/entity-service-decorator.js +28 -24
- package/ee/server/services/review-workflows/review-workflows.js +45 -53
- package/ee/server/services/review-workflows/stages.js +84 -46
- package/ee/server/services/review-workflows/validation.js +60 -0
- package/ee/server/services/review-workflows/workflows/content-types.js +80 -0
- package/ee/server/services/review-workflows/workflows/index.js +207 -0
- package/ee/server/utils/review-workflows.js +30 -25
- package/ee/server/validation/review-workflows.js +49 -10
- package/package.json +13 -14
- package/server/content-types/User.js +10 -0
- package/server/strategies/api-token.js +9 -5
- package/server/strategies/data-transfer.js +9 -5
- package/admin/src/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/getTableColumn.js +0 -2
- package/admin/src/content-manager/components/RelationInput/components/Relation.js +0 -53
- package/admin/src/content-manager/pages/ListView/utils/buildQueryString.js +0 -36
- package/admin/src/content-manager/pages/ListView/utils/createPluginsFilter.js +0 -4
- package/admin/src/hooks/useLicenseLimits/index.js +0 -3
- package/admin/src/pages/App/utils/index.js +0 -3
- package/admin/src/pages/App/utils/unique-identifier.js +0 -12
- package/build/1799.84268ad3.chunk.js +0 -33
- package/build/5932.6a23b88c.chunk.js +0 -1
- package/build/7018.98feed67.chunk.js +0 -1
- package/build/7259.fb69d4bf.chunk.js +0 -1
- package/build/Admin-authenticatedApp.69855f1b.chunk.js +0 -79
- package/build/admin-app.fea867af.chunk.js +0 -61
- package/build/admin-edit-users.53e4290a.chunk.js +0 -10
- package/build/admin-users.3b12dca2.chunk.js +0 -11
- package/build/api-tokens-list-page.201fb67a.chunk.js +0 -16
- package/build/audit-logs-settings-page.b07ad202.chunk.js +0 -1
- package/build/ca-json.43e14418.chunk.js +0 -1
- package/build/content-manager.66cec770.chunk.js +0 -1094
- package/build/content-type-builder-translation-en-json.f592325b.chunk.js +0 -1
- package/build/content-type-builder.e1b6d13b.chunk.js +0 -166
- package/build/en-json.f5fa476a.chunk.js +0 -1
- package/build/es-json.715b6fd8.chunk.js +0 -1
- package/build/fr-json.73494bf5.chunk.js +0 -1
- package/build/main.83edb3fc.js +0 -2926
- package/build/review-workflows-settings.93808ae0.chunk.js +0 -110
- package/build/runtime~main.20c3cac6.js +0 -2
- package/build/sso-settings-page.35b67909.chunk.js +0 -1
- package/build/transfer-tokens-list-page.217573c3.chunk.js +0 -16
- package/build/users-advanced-settings-page.1911adf5.chunk.js +0 -9
- package/build/webhook-edit-page.1ee02c4b.chunk.js +0 -33
- package/ee/admin/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/getTableColumn.js +0 -58
- package/ee/admin/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/index.js +0 -3
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/ProtectedPage.js +0 -20
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/ReviewWorkflows.js +0 -204
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/index.js +0 -3
- package/ee/server/services/review-workflows/workflows.js +0 -25
|
@@ -38,7 +38,7 @@ const AuthenticatedApp = () => {
|
|
|
38
38
|
const [
|
|
39
39
|
{ data: appInfos, status },
|
|
40
40
|
{ data: tagName, isLoading },
|
|
41
|
-
{ data: permissions, status: fetchPermissionsStatus, refetch,
|
|
41
|
+
{ data: permissions, status: fetchPermissionsStatus, refetch, isFetching },
|
|
42
42
|
{ data: userRoles },
|
|
43
43
|
] = useQueries([
|
|
44
44
|
{ queryKey: 'app-infos', queryFn: fetchAppInfo },
|
|
@@ -86,7 +86,7 @@ const AuthenticatedApp = () => {
|
|
|
86
86
|
// We don't need to wait for the release query to be fetched before rendering the plugins
|
|
87
87
|
// however, we need the appInfos and the permissions
|
|
88
88
|
const shouldShowNotDependentQueriesLoader =
|
|
89
|
-
|
|
89
|
+
isFetching || status === 'loading' || fetchPermissionsStatus === 'loading';
|
|
90
90
|
|
|
91
91
|
const shouldShowLoader = isLoading || shouldShowNotDependentQueriesLoader;
|
|
92
92
|
|
package/admin/src/constants.js
CHANGED
|
@@ -1,90 +1,90 @@
|
|
|
1
1
|
export const ADMIN_PERMISSIONS_CE = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
contentManager: {
|
|
3
|
+
main: [],
|
|
4
|
+
collectionTypesConfigurations: [
|
|
5
|
+
{
|
|
6
|
+
action: 'plugin::content-manager.collection-types.configure-view',
|
|
7
|
+
subject: null,
|
|
8
|
+
},
|
|
9
|
+
],
|
|
10
|
+
componentsConfigurations: [
|
|
11
|
+
{
|
|
12
|
+
action: 'plugin::content-manager.components.configure-layout',
|
|
13
|
+
subject: null,
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
singleTypesConfigurations: [
|
|
17
|
+
{
|
|
18
|
+
action: 'plugin::content-manager.single-types.configure-view',
|
|
19
|
+
subject: null,
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
marketplace: {
|
|
24
|
+
main: [{ action: 'admin::marketplace.read', subject: null }],
|
|
25
|
+
read: [{ action: 'admin::marketplace.read', subject: null }],
|
|
26
|
+
},
|
|
27
|
+
settings: {
|
|
28
|
+
roles: {
|
|
29
|
+
main: [
|
|
30
|
+
{ action: 'admin::roles.create', subject: null },
|
|
31
|
+
{ action: 'admin::roles.update', subject: null },
|
|
32
|
+
{ action: 'admin::roles.read', subject: null },
|
|
33
|
+
{ action: 'admin::roles.delete', subject: null },
|
|
9
34
|
],
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
35
|
+
create: [{ action: 'admin::roles.create', subject: null }],
|
|
36
|
+
delete: [{ action: 'admin::roles.delete', subject: null }],
|
|
37
|
+
read: [{ action: 'admin::roles.read', subject: null }],
|
|
38
|
+
update: [{ action: 'admin::roles.update', subject: null }],
|
|
39
|
+
},
|
|
40
|
+
users: {
|
|
41
|
+
main: [
|
|
42
|
+
{ action: 'admin::users.create', subject: null },
|
|
43
|
+
{ action: 'admin::users.read', subject: null },
|
|
44
|
+
{ action: 'admin::users.update', subject: null },
|
|
45
|
+
{ action: 'admin::users.delete', subject: null },
|
|
15
46
|
],
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
47
|
+
create: [{ action: 'admin::users.create', subject: null }],
|
|
48
|
+
delete: [{ action: 'admin::users.delete', subject: null }],
|
|
49
|
+
read: [{ action: 'admin::users.read', subject: null }],
|
|
50
|
+
update: [{ action: 'admin::users.update', subject: null }],
|
|
51
|
+
},
|
|
52
|
+
webhooks: {
|
|
53
|
+
main: [
|
|
54
|
+
{ action: 'admin::webhooks.create', subject: null },
|
|
55
|
+
{ action: 'admin::webhooks.read', subject: null },
|
|
56
|
+
{ action: 'admin::webhooks.update', subject: null },
|
|
57
|
+
{ action: 'admin::webhooks.delete', subject: null },
|
|
58
|
+
],
|
|
59
|
+
create: [{ action: 'admin::webhooks.create', subject: null }],
|
|
60
|
+
delete: [{ action: 'admin::webhooks.delete', subject: null }],
|
|
61
|
+
read: [
|
|
62
|
+
{ action: 'admin::webhooks.read', subject: null },
|
|
63
|
+
// NOTE: We need to check with the API
|
|
64
|
+
{ action: 'admin::webhooks.update', subject: null },
|
|
65
|
+
{ action: 'admin::webhooks.delete', subject: null },
|
|
21
66
|
],
|
|
67
|
+
update: [{ action: 'admin::webhooks.update', subject: null }],
|
|
22
68
|
},
|
|
23
|
-
|
|
24
|
-
main: [{ action: 'admin::
|
|
25
|
-
|
|
69
|
+
'api-tokens': {
|
|
70
|
+
main: [{ action: 'admin::api-tokens.access', subject: null }],
|
|
71
|
+
create: [{ action: 'admin::api-tokens.create', subject: null }],
|
|
72
|
+
delete: [{ action: 'admin::api-tokens.delete', subject: null }],
|
|
73
|
+
read: [{ action: 'admin::api-tokens.read', subject: null }],
|
|
74
|
+
update: [{ action: 'admin::api-tokens.update', subject: null }],
|
|
75
|
+
regenerate: [{ action: 'admin::api-tokens.regenerate', subject: null }],
|
|
26
76
|
},
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
update: [{ action: 'admin::roles.update', subject: null }],
|
|
39
|
-
},
|
|
40
|
-
users: {
|
|
41
|
-
main: [
|
|
42
|
-
{ action: 'admin::users.create', subject: null },
|
|
43
|
-
{ action: 'admin::users.read', subject: null },
|
|
44
|
-
{ action: 'admin::users.update', subject: null },
|
|
45
|
-
{ action: 'admin::users.delete', subject: null },
|
|
46
|
-
],
|
|
47
|
-
create: [{ action: 'admin::users.create', subject: null }],
|
|
48
|
-
delete: [{ action: 'admin::users.delete', subject: null }],
|
|
49
|
-
read: [{ action: 'admin::users.read', subject: null }],
|
|
50
|
-
update: [{ action: 'admin::users.update', subject: null }],
|
|
51
|
-
},
|
|
52
|
-
webhooks: {
|
|
53
|
-
main: [
|
|
54
|
-
{ action: 'admin::webhooks.create', subject: null },
|
|
55
|
-
{ action: 'admin::webhooks.read', subject: null },
|
|
56
|
-
{ action: 'admin::webhooks.update', subject: null },
|
|
57
|
-
{ action: 'admin::webhooks.delete', subject: null },
|
|
58
|
-
],
|
|
59
|
-
create: [{ action: 'admin::webhooks.create', subject: null }],
|
|
60
|
-
delete: [{ action: 'admin::webhooks.delete', subject: null }],
|
|
61
|
-
read: [
|
|
62
|
-
{ action: 'admin::webhooks.read', subject: null },
|
|
63
|
-
// NOTE: We need to check with the API
|
|
64
|
-
{ action: 'admin::webhooks.update', subject: null },
|
|
65
|
-
{ action: 'admin::webhooks.delete', subject: null },
|
|
66
|
-
],
|
|
67
|
-
update: [{ action: 'admin::webhooks.update', subject: null }],
|
|
68
|
-
},
|
|
69
|
-
'api-tokens': {
|
|
70
|
-
main: [{ action: 'admin::api-tokens.access', subject: null }],
|
|
71
|
-
create: [{ action: 'admin::api-tokens.create', subject: null }],
|
|
72
|
-
delete: [{ action: 'admin::api-tokens.delete', subject: null }],
|
|
73
|
-
read: [{ action: 'admin::api-tokens.read', subject: null }],
|
|
74
|
-
update: [{ action: 'admin::api-tokens.update', subject: null }],
|
|
75
|
-
regenerate: [{ action: 'admin::api-tokens.regenerate', subject: null }],
|
|
76
|
-
},
|
|
77
|
-
'transfer-tokens': {
|
|
78
|
-
main: [{ action: 'admin::transfer.tokens.access', subject: null }],
|
|
79
|
-
create: [{ action: 'admin::transfer.tokens.create', subject: null }],
|
|
80
|
-
delete: [{ action: 'admin::transfer.tokens.delete', subject: null }],
|
|
81
|
-
read: [{ action: 'admin::transfer.tokens.read', subject: null }],
|
|
82
|
-
update: [{ action: 'admin::transfer.tokens.update', subject: null }],
|
|
83
|
-
regenerate: [{ action: 'admin::transfer.tokens.regenerate', subject: null }],
|
|
84
|
-
},
|
|
85
|
-
'project-settings': {
|
|
86
|
-
read: [{ action: 'admin::project-settings.read', subject: null }],
|
|
87
|
-
update: [{ action: 'admin::project-settings.update', subject: null }],
|
|
88
|
-
},
|
|
77
|
+
'transfer-tokens': {
|
|
78
|
+
main: [{ action: 'admin::transfer.tokens.access', subject: null }],
|
|
79
|
+
create: [{ action: 'admin::transfer.tokens.create', subject: null }],
|
|
80
|
+
delete: [{ action: 'admin::transfer.tokens.delete', subject: null }],
|
|
81
|
+
read: [{ action: 'admin::transfer.tokens.read', subject: null }],
|
|
82
|
+
update: [{ action: 'admin::transfer.tokens.update', subject: null }],
|
|
83
|
+
regenerate: [{ action: 'admin::transfer.tokens.regenerate', subject: null }],
|
|
84
|
+
},
|
|
85
|
+
'project-settings': {
|
|
86
|
+
read: [{ action: 'admin::project-settings.read', subject: null }],
|
|
87
|
+
update: [{ action: 'admin::project-settings.update', subject: null }],
|
|
89
88
|
},
|
|
90
|
-
}
|
|
89
|
+
},
|
|
90
|
+
};
|
|
@@ -43,7 +43,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
|
|
|
43
43
|
const { setCurrentStep } = useGuidedTour();
|
|
44
44
|
const { trackUsage } = useTracking();
|
|
45
45
|
const { push, replace } = useHistory();
|
|
46
|
-
const [{ rawQuery }] = useQueryParams();
|
|
46
|
+
const [{ query, rawQuery }] = useQueryParams();
|
|
47
47
|
const dispatch = useDispatch();
|
|
48
48
|
const { componentsDataStructure, contentTypeDataStructure, data, isLoading, status } =
|
|
49
49
|
useSelector(selectCrudReducer);
|
|
@@ -244,13 +244,15 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
|
|
|
244
244
|
*/
|
|
245
245
|
const endPoint =
|
|
246
246
|
typeof origin === 'string'
|
|
247
|
-
?
|
|
248
|
-
:
|
|
247
|
+
? getRequestUrl(`collection-types/${slug}/clone/${origin}`)
|
|
248
|
+
: getRequestUrl(`collection-types/${slug}`);
|
|
249
249
|
try {
|
|
250
250
|
// Show a loading button in the EditView/Header.js && lock the app => no navigation
|
|
251
251
|
dispatch(setStatus('submit-pending'));
|
|
252
252
|
|
|
253
|
-
const { data } = await post(endPoint, body
|
|
253
|
+
const { data } = await post(endPoint, body, {
|
|
254
|
+
params: query,
|
|
255
|
+
});
|
|
254
256
|
|
|
255
257
|
trackUsageRef.current('didCreateEntry', trackerProperty);
|
|
256
258
|
toggleNotification({
|
|
@@ -286,11 +288,12 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
|
|
|
286
288
|
replace,
|
|
287
289
|
slug,
|
|
288
290
|
dispatch,
|
|
289
|
-
|
|
291
|
+
query,
|
|
290
292
|
toggleNotification,
|
|
291
293
|
setCurrentStep,
|
|
292
294
|
queryClient,
|
|
293
295
|
post,
|
|
296
|
+
rawQuery,
|
|
294
297
|
]
|
|
295
298
|
);
|
|
296
299
|
|
|
@@ -75,20 +75,9 @@ function Inputs({
|
|
|
75
75
|
return foundAttributeType === 'dynamiczone';
|
|
76
76
|
}, [currentContentTypeLayout, fieldName]);
|
|
77
77
|
|
|
78
|
-
const inputType =
|
|
79
|
-
return getInputType(type);
|
|
80
|
-
}, [type]);
|
|
81
|
-
|
|
82
|
-
const inputValue = useMemo(() => {
|
|
83
|
-
// Fix for input file multipe
|
|
84
|
-
if (type === 'media' && !value) {
|
|
85
|
-
return [];
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return value;
|
|
89
|
-
}, [type, value]);
|
|
78
|
+
const inputType = getInputType(type);
|
|
90
79
|
|
|
91
|
-
const
|
|
80
|
+
const inputValue = type === 'media' && !value ? [] : value;
|
|
92
81
|
|
|
93
82
|
const isUserAllowedToEditField = useMemo(() => {
|
|
94
83
|
const joinedName = fieldName.join('.');
|
|
@@ -159,36 +148,6 @@ function Inputs({
|
|
|
159
148
|
|
|
160
149
|
const { label, description, placeholder, visible } = metadatas;
|
|
161
150
|
|
|
162
|
-
/**
|
|
163
|
-
* It decides whether using the default `step` accoding to its `inputType` or the one
|
|
164
|
-
* obtained from `metadatas`.
|
|
165
|
-
*
|
|
166
|
-
* The `metadatas.step` is returned when the `inputValue` is divisible by it or when the
|
|
167
|
-
* `inputValue` is empty, otherwise the default `step` is returned.
|
|
168
|
-
*/
|
|
169
|
-
const inputStep = useMemo(() => {
|
|
170
|
-
if (!metadatas.step || (inputType !== 'datetime' && inputType !== 'time')) {
|
|
171
|
-
return step;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
if (!inputValue) {
|
|
175
|
-
return metadatas.step;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
let minutes;
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* Wtf is this?
|
|
182
|
-
*/
|
|
183
|
-
if (inputType === 'datetime') {
|
|
184
|
-
minutes = parseInt(inputValue.substr(14, 2), 10);
|
|
185
|
-
} else if (inputType === 'time') {
|
|
186
|
-
minutes = parseInt(inputValue.slice(-2), 10);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
return minutes % metadatas.step === 0 ? metadatas.step : step;
|
|
190
|
-
}, [inputType, inputValue, metadatas.step, step]);
|
|
191
|
-
|
|
192
151
|
if (visible === false) {
|
|
193
152
|
return null;
|
|
194
153
|
}
|
|
@@ -271,7 +230,7 @@ function Inputs({
|
|
|
271
230
|
options={options}
|
|
272
231
|
placeholder={placeholder ? { id: placeholder, defaultMessage: placeholder } : null}
|
|
273
232
|
required={fieldSchema.required || false}
|
|
274
|
-
step={
|
|
233
|
+
step={getStep(type)}
|
|
275
234
|
type={customFieldUid || inputType}
|
|
276
235
|
// validations={validations}
|
|
277
236
|
value={inputValue}
|
|
@@ -317,9 +276,6 @@ const getStep = (type) => {
|
|
|
317
276
|
case 'float':
|
|
318
277
|
case 'decimal':
|
|
319
278
|
return 0.01;
|
|
320
|
-
case 'time':
|
|
321
|
-
case 'datetime':
|
|
322
|
-
return 15;
|
|
323
279
|
default:
|
|
324
280
|
return 1;
|
|
325
281
|
}
|
|
@@ -1,24 +1,17 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useRef, useState, useMemo, useEffect } from 'react';
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
|
+
Status,
|
|
4
5
|
Box,
|
|
5
|
-
Field,
|
|
6
|
-
FieldError,
|
|
7
|
-
FieldHint,
|
|
8
|
-
FieldLabel,
|
|
9
|
-
Icon,
|
|
10
6
|
Link,
|
|
11
|
-
|
|
7
|
+
Icon,
|
|
8
|
+
Flex,
|
|
12
9
|
TextButton,
|
|
13
|
-
Tooltip,
|
|
14
10
|
Typography,
|
|
11
|
+
Tooltip,
|
|
15
12
|
VisuallyHidden,
|
|
13
|
+
Combobox,
|
|
16
14
|
} from '@strapi/design-system';
|
|
17
|
-
/**
|
|
18
|
-
* TODO: this will come in another PR.
|
|
19
|
-
*/
|
|
20
|
-
// eslint-disable-next-line no-restricted-imports
|
|
21
|
-
import { ReactSelect } from '@strapi/helper-plugin';
|
|
22
15
|
import { Cross, Refresh } from '@strapi/icons';
|
|
23
16
|
import PropTypes from 'prop-types';
|
|
24
17
|
import { FixedSizeList as List } from 'react-window';
|
|
@@ -27,7 +20,6 @@ import styled from 'styled-components';
|
|
|
27
20
|
import { usePrev } from '../../hooks';
|
|
28
21
|
|
|
29
22
|
import { Option } from './components/Option';
|
|
30
|
-
import { Relation } from './components/Relation';
|
|
31
23
|
import { RelationItem } from './components/RelationItem';
|
|
32
24
|
import { RelationList } from './components/RelationList';
|
|
33
25
|
import { RELATION_GUTTER, RELATION_ITEM_HEIGHT } from './constants';
|
|
@@ -88,7 +80,7 @@ const RelationInput = ({
|
|
|
88
80
|
searchResults,
|
|
89
81
|
size,
|
|
90
82
|
}) => {
|
|
91
|
-
const [
|
|
83
|
+
const [textValue, setTextValue] = useState('');
|
|
92
84
|
const [overflow, setOverflow] = useState('');
|
|
93
85
|
|
|
94
86
|
const listRef = useRef();
|
|
@@ -158,71 +150,10 @@ const RelationInput = ({
|
|
|
158
150
|
};
|
|
159
151
|
}, [paginatedRelations, relations, numberOfRelationsToDisplay, totalNumberOfRelations]);
|
|
160
152
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* This code is being isolated because it's a hack to fix a placement bug in
|
|
166
|
-
* `react-select` where when the options prop is updated the position of the
|
|
167
|
-
* menu is not recalculated.
|
|
168
|
-
*/
|
|
169
|
-
const [isMenuOpen, setIsMenuOpen] = useState(false);
|
|
170
|
-
|
|
171
|
-
const timeoutRef = useRef();
|
|
172
|
-
const previousOptions = useRef([]);
|
|
173
|
-
|
|
174
|
-
useEffect(() => {
|
|
175
|
-
/**
|
|
176
|
-
* We only really want this effect to fire once when the options
|
|
177
|
-
* change from an empty array to an array with values.
|
|
178
|
-
* Otherwise, it'll fire when the infinite scrolling happens causing
|
|
179
|
-
* the menu to jump to the top all the time when loading more.
|
|
180
|
-
*/
|
|
181
|
-
if (options.length > 0 && previousOptions.current.length === 0) {
|
|
182
|
-
setIsMenuOpen((isCurrentlyOpened) => {
|
|
183
|
-
/**
|
|
184
|
-
* If we're currently open and the options changed
|
|
185
|
-
* we want to close and open to ensure the menu's
|
|
186
|
-
* position is correctly calculated
|
|
187
|
-
*/
|
|
188
|
-
if (isCurrentlyOpened) {
|
|
189
|
-
timeoutRef.current = setTimeout(() => {
|
|
190
|
-
setIsMenuOpen(true);
|
|
191
|
-
}, 10);
|
|
192
|
-
|
|
193
|
-
return false;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
return false;
|
|
197
|
-
});
|
|
153
|
+
const handleMenuOpen = (isOpen) => {
|
|
154
|
+
if (isOpen) {
|
|
155
|
+
onSearch();
|
|
198
156
|
}
|
|
199
|
-
|
|
200
|
-
return () => {
|
|
201
|
-
previousOptions.current = options || [];
|
|
202
|
-
};
|
|
203
|
-
}, [options]);
|
|
204
|
-
|
|
205
|
-
useEffect(() => {
|
|
206
|
-
return () => {
|
|
207
|
-
/**
|
|
208
|
-
* If the component unmounts and a timer is set we should clear that timer
|
|
209
|
-
*/
|
|
210
|
-
if (timeoutRef.current) {
|
|
211
|
-
clearTimeout(timeoutRef.current);
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
}, []);
|
|
215
|
-
|
|
216
|
-
const handleMenuClose = () => {
|
|
217
|
-
setIsMenuOpen(false);
|
|
218
|
-
};
|
|
219
|
-
/**
|
|
220
|
-
* --- ReactSelect Workaround END ---
|
|
221
|
-
*/
|
|
222
|
-
|
|
223
|
-
const handleMenuOpen = () => {
|
|
224
|
-
setIsMenuOpen(true);
|
|
225
|
-
onSearch();
|
|
226
157
|
};
|
|
227
158
|
|
|
228
159
|
/**
|
|
@@ -250,122 +181,112 @@ const RelationInput = ({
|
|
|
250
181
|
};
|
|
251
182
|
|
|
252
183
|
useEffect(() => {
|
|
184
|
+
if (updatedRelationsWith.current === 'onChange') {
|
|
185
|
+
setTextValue('');
|
|
186
|
+
}
|
|
187
|
+
|
|
253
188
|
if (
|
|
254
189
|
updatedRelationsWith.current === 'onChange' &&
|
|
255
190
|
relations.length !== previewRelationsLength
|
|
256
191
|
) {
|
|
257
192
|
listRef.current.scrollToItem(relations.length, 'end');
|
|
193
|
+
updatedRelationsWith.current = undefined;
|
|
258
194
|
} else if (
|
|
259
195
|
updatedRelationsWith.current === 'loadMore' &&
|
|
260
196
|
relations.length !== previewRelationsLength
|
|
261
197
|
) {
|
|
262
198
|
listRef.current.scrollToItem(0, 'start');
|
|
199
|
+
updatedRelationsWith.current = undefined;
|
|
263
200
|
}
|
|
264
|
-
|
|
265
|
-
updatedRelationsWith.current = undefined;
|
|
266
201
|
}, [previewRelationsLength, relations]);
|
|
267
202
|
|
|
268
203
|
const ariaDescriptionId = `${name}-item-instructions`;
|
|
269
204
|
|
|
270
205
|
return (
|
|
271
|
-
<
|
|
272
|
-
<
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
onClick={handleLoadMore}
|
|
321
|
-
loading={paginatedRelations.isLoading || paginatedRelations.isFetchingNextPage}
|
|
322
|
-
startIcon={<Refresh />}
|
|
323
|
-
>
|
|
324
|
-
{labelLoadMore}
|
|
325
|
-
</TextButton>
|
|
326
|
-
)
|
|
327
|
-
}
|
|
328
|
-
>
|
|
329
|
-
{relations.length > 0 && (
|
|
330
|
-
<RelationList overflow={overflow}>
|
|
331
|
-
<VisuallyHidden id={ariaDescriptionId}>{listAriaDescription}</VisuallyHidden>
|
|
332
|
-
<VisuallyHidden aria-live="assertive">{liveText}</VisuallyHidden>
|
|
333
|
-
<List
|
|
334
|
-
height={dynamicListHeight}
|
|
335
|
-
ref={listRef}
|
|
336
|
-
outerRef={outerListRef}
|
|
337
|
-
itemCount={totalNumberOfRelations}
|
|
338
|
-
itemSize={RELATION_ITEM_HEIGHT + RELATION_GUTTER}
|
|
339
|
-
itemData={{
|
|
340
|
-
name,
|
|
341
|
-
ariaDescribedBy: ariaDescriptionId,
|
|
342
|
-
canDrag: canReorder,
|
|
343
|
-
disabled,
|
|
344
|
-
handleCancel: onCancel,
|
|
345
|
-
handleDropItem: onDropItem,
|
|
346
|
-
handleGrabItem: onGrabItem,
|
|
347
|
-
iconButtonAriaLabel,
|
|
348
|
-
labelDisconnectRelation,
|
|
349
|
-
onRelationDisconnect,
|
|
350
|
-
publicationStateTranslations,
|
|
351
|
-
relations,
|
|
352
|
-
updatePositionOfRelation: handleUpdatePositionOfRelation,
|
|
353
|
-
}}
|
|
354
|
-
itemKey={(index) => `${relations[index].mainField}_${relations[index].id}`}
|
|
355
|
-
innerElementType="ol"
|
|
356
|
-
>
|
|
357
|
-
{ListItem}
|
|
358
|
-
</List>
|
|
359
|
-
</RelationList>
|
|
360
|
-
)}
|
|
361
|
-
{(description || error) && (
|
|
362
|
-
<Box paddingTop={2}>
|
|
363
|
-
<FieldHint />
|
|
364
|
-
<FieldError />
|
|
365
|
-
</Box>
|
|
206
|
+
<Flex gap={3} justifyContent="space-between" alignItems="end" wrap="wrap">
|
|
207
|
+
<Flex direction="column" alignItems="stretch" basis={size <= 6 ? '100%' : '70%'} gap={2}>
|
|
208
|
+
<Combobox
|
|
209
|
+
autocomplete="list"
|
|
210
|
+
error={error}
|
|
211
|
+
name={name}
|
|
212
|
+
hint={description}
|
|
213
|
+
id={id}
|
|
214
|
+
required={required}
|
|
215
|
+
label={label}
|
|
216
|
+
labelAction={labelAction}
|
|
217
|
+
disabled={disabled}
|
|
218
|
+
placeholder={placeholder}
|
|
219
|
+
hasMoreItems={searchResults.hasNextPage}
|
|
220
|
+
loading={searchResults.isLoading}
|
|
221
|
+
onOpenChange={handleMenuOpen}
|
|
222
|
+
noOptionsMessage={() => noRelationsMessage}
|
|
223
|
+
loadingMessage={loadingMessage}
|
|
224
|
+
onLoadMore={() => {
|
|
225
|
+
onSearchNextPage();
|
|
226
|
+
}}
|
|
227
|
+
textValue={textValue}
|
|
228
|
+
onChange={(relationId) => {
|
|
229
|
+
if (!relationId) {
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
onRelationConnect(options.find((opt) => opt.id === relationId));
|
|
233
|
+
updatedRelationsWith.current = 'onChange';
|
|
234
|
+
}}
|
|
235
|
+
onTextValueChange={(text) => {
|
|
236
|
+
setTextValue(text);
|
|
237
|
+
}}
|
|
238
|
+
onInputChange={(event) => {
|
|
239
|
+
onSearch(event.currentTarget.value);
|
|
240
|
+
}}
|
|
241
|
+
>
|
|
242
|
+
{options.map((opt) => {
|
|
243
|
+
return <Option key={opt.id} {...opt} />;
|
|
244
|
+
})}
|
|
245
|
+
</Combobox>
|
|
246
|
+
{shouldDisplayLoadMoreButton && (
|
|
247
|
+
<TextButton
|
|
248
|
+
disabled={paginatedRelations.isLoading || paginatedRelations.isFetchingNextPage}
|
|
249
|
+
onClick={handleLoadMore}
|
|
250
|
+
loading={paginatedRelations.isLoading || paginatedRelations.isFetchingNextPage}
|
|
251
|
+
startIcon={<Refresh />}
|
|
252
|
+
>
|
|
253
|
+
{labelLoadMore}
|
|
254
|
+
</TextButton>
|
|
366
255
|
)}
|
|
367
|
-
</
|
|
368
|
-
|
|
256
|
+
</Flex>
|
|
257
|
+
{relations.length > 0 && (
|
|
258
|
+
<RelationList overflow={overflow}>
|
|
259
|
+
<VisuallyHidden id={ariaDescriptionId}>{listAriaDescription}</VisuallyHidden>
|
|
260
|
+
<VisuallyHidden aria-live="assertive">{liveText}</VisuallyHidden>
|
|
261
|
+
<List
|
|
262
|
+
height={dynamicListHeight}
|
|
263
|
+
ref={listRef}
|
|
264
|
+
outerRef={outerListRef}
|
|
265
|
+
itemCount={totalNumberOfRelations}
|
|
266
|
+
itemSize={RELATION_ITEM_HEIGHT + RELATION_GUTTER}
|
|
267
|
+
itemData={{
|
|
268
|
+
name,
|
|
269
|
+
ariaDescribedBy: ariaDescriptionId,
|
|
270
|
+
canDrag: canReorder,
|
|
271
|
+
disabled,
|
|
272
|
+
handleCancel: onCancel,
|
|
273
|
+
handleDropItem: onDropItem,
|
|
274
|
+
handleGrabItem: onGrabItem,
|
|
275
|
+
iconButtonAriaLabel,
|
|
276
|
+
labelDisconnectRelation,
|
|
277
|
+
onRelationDisconnect,
|
|
278
|
+
publicationStateTranslations,
|
|
279
|
+
relations,
|
|
280
|
+
updatePositionOfRelation: handleUpdatePositionOfRelation,
|
|
281
|
+
}}
|
|
282
|
+
itemKey={(index) => `${relations[index].mainField}_${relations[index].id}`}
|
|
283
|
+
innerElementType="ol"
|
|
284
|
+
>
|
|
285
|
+
{ListItem}
|
|
286
|
+
</List>
|
|
287
|
+
</RelationList>
|
|
288
|
+
)}
|
|
289
|
+
</Flex>
|
|
369
290
|
);
|
|
370
291
|
};
|
|
371
292
|
|