@strapi/admin 4.11.0-beta.1 → 4.11.0-exp.9xg4-3qfm-9w8f.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.
- package/admin/src/components/Providers/index.js +32 -32
- package/admin/src/components/Theme/index.js +3 -5
- package/admin/src/content-manager/components/DynamicTable/ConfirmDialogDeleteAll/index.js +73 -0
- package/admin/src/content-manager/components/DynamicTable/index.js +4 -20
- package/admin/src/content-manager/components/EditViewDataManagerProvider/index.js +21 -7
- package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/index.js +1 -0
- package/admin/src/content-manager/{utils → components/EditViewDataManagerProvider/utils}/schema.js +1 -1
- package/admin/src/content-manager/components/Inputs/index.js +11 -18
- package/admin/src/content-manager/components/Inputs/utils/getStep.js +13 -0
- package/admin/src/content-manager/components/Inputs/utils/index.js +1 -0
- package/admin/src/content-manager/pages/ListView/index.js +2 -118
- package/admin/src/content-manager/utils/index.js +0 -2
- package/admin/src/hooks/useContentTypes/useContentTypes.js +0 -2
- package/admin/src/index.js +4 -3
- package/admin/src/injectionZones.js +1 -6
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/index.js +1 -1
- package/admin/src/translations/en.json +1 -5
- package/build/{1657.ca8562dd.chunk.js → 1657.3f2b2c11.chunk.js} +1 -9
- package/build/3081.7e9329cb.chunk.js +105 -0
- package/build/462.6f8cbd19.chunk.js +71 -0
- package/build/5542.64b623c9.chunk.js +63 -0
- package/build/617.0518c0ba.chunk.js +155 -0
- package/build/6858.85d76858.chunk.js +50 -0
- package/build/6970.6a329e15.chunk.js +1 -0
- package/build/9036.f7ce35cc.chunk.js +211 -0
- package/build/{Admin-authenticatedApp.990df65d.chunk.js → Admin-authenticatedApp.e7ca2959.chunk.js} +2 -2
- package/build/{Admin_homePage.107a9fe0.chunk.js → Admin_homePage.94dc81b1.chunk.js} +16 -16
- package/build/Admin_marketplace.1b0c3d3b.chunk.js +55 -0
- package/build/Admin_pluginsPage.a28b96d5.chunk.js +6 -0
- package/build/{Admin_profilePage.75bc083a.chunk.js → Admin_profilePage.a8fa3a56.chunk.js} +1 -1
- package/build/Admin_settingsPage.ee76d19e.chunk.js +79 -0
- package/build/admin-app.bd209f08.chunk.js +63 -0
- package/build/admin-roles-list.af53b372.chunk.js +23 -0
- package/build/admin-users.0fc77b35.chunk.js +26 -0
- package/build/audit-logs-settings-page.6bc76e7d.chunk.js +121 -0
- package/build/content-manager.8bfce7f0.chunk.js +1123 -0
- package/build/content-type-builder-list-view.26aab6f3.chunk.js +215 -0
- package/build/email-settings-page.63f269ff.chunk.js +11 -0
- package/build/{en-json.0f5cc115.chunk.js → en-json.ba3290b8.chunk.js} +1 -1
- package/build/i18n-settings-page.2ac4ca58.chunk.js +114 -0
- package/build/i18n-translation-en-json.60af6722.chunk.js +1 -0
- package/build/index.html +1 -1
- package/build/main.aca47de6.js +2633 -0
- package/build/{review-workflows-settings.4b39b837.chunk.js → review-workflows-settings.56cab253.chunk.js} +1 -1
- package/build/{runtime~main.55d43bd7.js → runtime~main.0dfc909e.js} +1 -1
- package/build/upload-settings.1d187578.chunk.js +14 -0
- package/build/upload.bc340679.chunk.js +26 -0
- package/build/users-advanced-settings-page.7b4bf63a.chunk.js +9 -0
- package/build/users-email-settings-page.035a026c.chunk.js +24 -0
- package/build/users-providers-settings-page.6873dce9.chunk.js +29 -0
- package/build/{users-roles-settings-page.c773086b.chunk.js → users-roles-settings-page.2549794b.chunk.js} +1 -1
- package/build/{webhook-edit-page.ddd5963d.chunk.js → webhook-edit-page.0bc97587.chunk.js} +1 -1
- package/build/webhook-list-page.0861d3e9.chunk.js +63 -0
- package/ee/server/services/review-workflows/review-workflows.js +4 -0
- package/package.json +17 -19
- package/server/controllers/webhooks.js +6 -6
- package/admin/src/content-manager/components/DynamicTable/BulkActionsBar/index.js +0 -307
- package/build/3081.c2cdfac8.chunk.js +0 -108
- package/build/3562.e0b1a0b3.chunk.js +0 -50
- package/build/456.9b85d4c6.chunk.js +0 -39
- package/build/462.a073ff1f.chunk.js +0 -71
- package/build/5542.002522eb.chunk.js +0 -71
- package/build/617.87b2fe96.chunk.js +0 -155
- package/build/6970.7ea35fbd.chunk.js +0 -1
- package/build/Admin_marketplace.1436fc2b.chunk.js +0 -55
- package/build/Admin_pluginsPage.e1afd5ed.chunk.js +0 -6
- package/build/Admin_settingsPage.bd715ed3.chunk.js +0 -79
- package/build/admin-app.8b102fe2.chunk.js +0 -63
- package/build/admin-roles-list.e8bf9685.chunk.js +0 -31
- package/build/admin-users.751b28b2.chunk.js +0 -34
- package/build/audit-logs-settings-page.3c6cea81.chunk.js +0 -129
- package/build/content-manager.89099707.chunk.js +0 -1123
- package/build/content-type-builder-list-view.1e821eb9.chunk.js +0 -215
- package/build/email-settings-page.4368689f.chunk.js +0 -11
- package/build/i18n-settings-page.7988d872.chunk.js +0 -114
- package/build/i18n-translation-en-json.1ec7becf.chunk.js +0 -1
- package/build/main.5a232c3d.js +0 -2630
- package/build/upload-settings.63d99bf5.chunk.js +0 -14
- package/build/upload.c50d8c7a.chunk.js +0 -34
- package/build/users-advanced-settings-page.2cfb5d24.chunk.js +0 -9
- package/build/users-email-settings-page.bd6c774a.chunk.js +0 -24
- package/build/users-providers-settings-page.528f0036.chunk.js +0 -29
- package/build/webhook-list-page.b0f5a02c.chunk.js +0 -71
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/admin",
|
|
3
|
-
"version": "4.11.0-
|
|
3
|
+
"version": "4.11.0-exp.9xg4-3qfm-9w8f.1",
|
|
4
4
|
"description": "Strapi Admin",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -48,15 +48,15 @@
|
|
|
48
48
|
"@casl/ability": "^5.4.3",
|
|
49
49
|
"@fingerprintjs/fingerprintjs": "3.4.1",
|
|
50
50
|
"@pmmmwh/react-refresh-webpack-plugin": "0.5.10",
|
|
51
|
-
"@strapi/babel-plugin-switch-ee-ce": "4.11.0-
|
|
52
|
-
"@strapi/data-transfer": "4.11.0-
|
|
53
|
-
"@strapi/design-system": "
|
|
54
|
-
"@strapi/helper-plugin": "4.11.0-
|
|
55
|
-
"@strapi/icons": "
|
|
56
|
-
"@strapi/permissions": "4.11.0-
|
|
57
|
-
"@strapi/provider-audit-logs-local": "4.11.0-
|
|
58
|
-
"@strapi/typescript-utils": "4.11.0-
|
|
59
|
-
"@strapi/utils": "4.11.0-
|
|
51
|
+
"@strapi/babel-plugin-switch-ee-ce": "4.11.0-exp.9xg4-3qfm-9w8f.1",
|
|
52
|
+
"@strapi/data-transfer": "4.11.0-exp.9xg4-3qfm-9w8f.1",
|
|
53
|
+
"@strapi/design-system": "1.7.10",
|
|
54
|
+
"@strapi/helper-plugin": "4.11.0-exp.9xg4-3qfm-9w8f.1",
|
|
55
|
+
"@strapi/icons": "1.7.10",
|
|
56
|
+
"@strapi/permissions": "4.11.0-exp.9xg4-3qfm-9w8f.1",
|
|
57
|
+
"@strapi/provider-audit-logs-local": "4.11.0-exp.9xg4-3qfm-9w8f.1",
|
|
58
|
+
"@strapi/typescript-utils": "4.11.0-exp.9xg4-3qfm-9w8f.1",
|
|
59
|
+
"@strapi/utils": "4.11.0-exp.9xg4-3qfm-9w8f.1",
|
|
60
60
|
"axios": "1.4.0",
|
|
61
61
|
"babel-loader": "^9.1.2",
|
|
62
62
|
"babel-plugin-styled-components": "2.1.1",
|
|
@@ -80,7 +80,6 @@
|
|
|
80
80
|
"fs-extra": "10.0.0",
|
|
81
81
|
"highlight.js": "^10.4.1",
|
|
82
82
|
"history": "^4.9.0",
|
|
83
|
-
"hoist-non-react-statics": "^3.3.0",
|
|
84
83
|
"html-loader": "^4.2.0",
|
|
85
84
|
"html-webpack-plugin": "5.5.0",
|
|
86
85
|
"immer": "9.0.19",
|
|
@@ -107,16 +106,16 @@
|
|
|
107
106
|
"p-map": "4.0.0",
|
|
108
107
|
"passport-local": "1.0.0",
|
|
109
108
|
"pluralize": "8.0.0",
|
|
110
|
-
"prop-types": "^15.
|
|
109
|
+
"prop-types": "^15.8.1",
|
|
111
110
|
"qs": "6.11.1",
|
|
112
|
-
"react": "^
|
|
111
|
+
"react": "^18.2.0",
|
|
113
112
|
"react-dnd": "15.1.2",
|
|
114
113
|
"react-dnd-html5-backend": "15.1.3",
|
|
115
|
-
"react-dom": "^
|
|
114
|
+
"react-dom": "^18.2.0",
|
|
116
115
|
"react-error-boundary": "3.1.4",
|
|
117
116
|
"react-helmet": "^6.1.0",
|
|
118
117
|
"react-intl": "6.4.1",
|
|
119
|
-
"react-is": "^
|
|
118
|
+
"react-is": "^18.2.0",
|
|
120
119
|
"react-query": "3.39.3",
|
|
121
120
|
"react-redux": "8.0.5",
|
|
122
121
|
"react-refresh": "0.14.0",
|
|
@@ -139,9 +138,8 @@
|
|
|
139
138
|
"yup": "^0.32.9"
|
|
140
139
|
},
|
|
141
140
|
"devDependencies": {
|
|
142
|
-
"@testing-library/dom": "
|
|
143
|
-
"@testing-library/react": "
|
|
144
|
-
"@testing-library/react-hooks": "8.0.1",
|
|
141
|
+
"@testing-library/dom": "9.2.0",
|
|
142
|
+
"@testing-library/react": "14.0.0",
|
|
145
143
|
"@testing-library/user-event": "14.4.3",
|
|
146
144
|
"duplicate-dependencies-webpack-plugin": "^1.0.2",
|
|
147
145
|
"glob": "8.0.3",
|
|
@@ -165,5 +163,5 @@
|
|
|
165
163
|
}
|
|
166
164
|
}
|
|
167
165
|
},
|
|
168
|
-
"gitHead": "
|
|
166
|
+
"gitHead": "54c4fa25b2706612f85aaf103f54c071c281f23b"
|
|
169
167
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const _ = require('lodash');
|
|
4
|
-
const { yup,
|
|
4
|
+
const { yup, validateYupSchema } = require('@strapi/utils');
|
|
5
5
|
|
|
6
6
|
const urlRegex =
|
|
7
7
|
/^(?:([a-z0-9+.-]+):\/\/)(?:\S+(?::\S*)?@)?(?:(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9_]-*)*[a-z\u00a1-\uffff0-9_]+)(?:\.(?:[a-z\u00a1-\uffff0-9_]-*)*[a-z\u00a1-\uffff0-9_]+)*\.?)(?::\d{2,5})?(?:[/?#]\S*)?$/;
|
|
@@ -23,7 +23,7 @@ const webhookValidator = yup
|
|
|
23
23
|
)
|
|
24
24
|
.required();
|
|
25
25
|
}),
|
|
26
|
-
events: yup.array().of(yup.string()
|
|
26
|
+
events: yup.array().of(yup.string()).required(),
|
|
27
27
|
})
|
|
28
28
|
.noUnknown();
|
|
29
29
|
|
|
@@ -111,10 +111,10 @@ module.exports = {
|
|
|
111
111
|
for (const id of ids) {
|
|
112
112
|
const webhook = await strapi.webhookStore.findWebhook(id);
|
|
113
113
|
|
|
114
|
-
if (
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
114
|
+
if (webhook) {
|
|
115
|
+
await strapi.webhookStore.deleteWebhook(id);
|
|
116
|
+
strapi.webhookRunner.remove(webhook);
|
|
117
|
+
}
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
ctx.send({ data: ids });
|
|
@@ -1,307 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { Button, Dialog, DialogBody, DialogFooter, Flex, Typography } from '@strapi/design-system';
|
|
4
|
-
import { Check, ExclamationMarkCircle, Trash } from '@strapi/icons';
|
|
5
|
-
import { useIntl } from 'react-intl';
|
|
6
|
-
import { useSelector } from 'react-redux';
|
|
7
|
-
import { useTracking } from '@strapi/helper-plugin';
|
|
8
|
-
import { getTrad } from '../../../utils';
|
|
9
|
-
import InjectionZoneList from '../../InjectionZoneList';
|
|
10
|
-
import { listViewDomain } from '../../../pages/ListView/selectors';
|
|
11
|
-
|
|
12
|
-
const ConfirmBulkActionDialog = ({ onToggleDialog, isOpen, dialogBody, endAction }) => {
|
|
13
|
-
const { formatMessage } = useIntl();
|
|
14
|
-
|
|
15
|
-
return (
|
|
16
|
-
<Dialog
|
|
17
|
-
onClose={onToggleDialog}
|
|
18
|
-
title={formatMessage({
|
|
19
|
-
id: 'app.components.ConfirmDialog.title',
|
|
20
|
-
defaultMessage: 'Confirmation',
|
|
21
|
-
})}
|
|
22
|
-
labelledBy="confirmation"
|
|
23
|
-
describedBy="confirm-description"
|
|
24
|
-
isOpen={isOpen}
|
|
25
|
-
>
|
|
26
|
-
<DialogBody icon={<ExclamationMarkCircle />}>
|
|
27
|
-
<Flex direction="column" alignItems="stretch" gap={2}>
|
|
28
|
-
{dialogBody}
|
|
29
|
-
</Flex>
|
|
30
|
-
</DialogBody>
|
|
31
|
-
<DialogFooter
|
|
32
|
-
startAction={
|
|
33
|
-
<Button onClick={onToggleDialog} variant="tertiary">
|
|
34
|
-
{formatMessage({
|
|
35
|
-
id: 'app.components.Button.cancel',
|
|
36
|
-
defaultMessage: 'Cancel',
|
|
37
|
-
})}
|
|
38
|
-
</Button>
|
|
39
|
-
}
|
|
40
|
-
endAction={endAction}
|
|
41
|
-
/>
|
|
42
|
-
</Dialog>
|
|
43
|
-
);
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
ConfirmBulkActionDialog.propTypes = {
|
|
47
|
-
isOpen: PropTypes.bool.isRequired,
|
|
48
|
-
onToggleDialog: PropTypes.func.isRequired,
|
|
49
|
-
dialogBody: PropTypes.node.isRequired,
|
|
50
|
-
endAction: PropTypes.node.isRequired,
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
const confirmDialogsPropTypes = {
|
|
54
|
-
isConfirmButtonLoading: PropTypes.bool.isRequired,
|
|
55
|
-
isOpen: PropTypes.bool.isRequired,
|
|
56
|
-
onConfirm: PropTypes.func.isRequired,
|
|
57
|
-
onToggleDialog: PropTypes.func.isRequired,
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
const ConfirmDialogPublishAll = ({ isOpen, onToggleDialog, isConfirmButtonLoading, onConfirm }) => {
|
|
61
|
-
const { formatMessage } = useIntl();
|
|
62
|
-
|
|
63
|
-
return (
|
|
64
|
-
<ConfirmBulkActionDialog
|
|
65
|
-
isOpen={isOpen}
|
|
66
|
-
onToggleDialog={onToggleDialog}
|
|
67
|
-
dialogBody={
|
|
68
|
-
<>
|
|
69
|
-
<Typography id="confirm-description" textAlign="center">
|
|
70
|
-
{formatMessage({
|
|
71
|
-
id: getTrad('popUpWarning.bodyMessage.contentType.publish.all'),
|
|
72
|
-
defaultMessage: 'Are you sure you want to publish these entries?',
|
|
73
|
-
})}
|
|
74
|
-
</Typography>
|
|
75
|
-
<InjectionZoneList area="contentManager.listView.publishModalAdditionalInfos" />
|
|
76
|
-
</>
|
|
77
|
-
}
|
|
78
|
-
endAction={
|
|
79
|
-
<Button
|
|
80
|
-
onClick={onConfirm}
|
|
81
|
-
variant="secondary"
|
|
82
|
-
startIcon={<Check />}
|
|
83
|
-
loading={isConfirmButtonLoading}
|
|
84
|
-
>
|
|
85
|
-
{formatMessage({
|
|
86
|
-
id: 'app.utils.publish',
|
|
87
|
-
defaultMessage: 'Publish',
|
|
88
|
-
})}
|
|
89
|
-
</Button>
|
|
90
|
-
}
|
|
91
|
-
/>
|
|
92
|
-
);
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
ConfirmDialogPublishAll.propTypes = confirmDialogsPropTypes;
|
|
96
|
-
|
|
97
|
-
const ConfirmDialogUnpublishAll = ({
|
|
98
|
-
isOpen,
|
|
99
|
-
onToggleDialog,
|
|
100
|
-
isConfirmButtonLoading,
|
|
101
|
-
onConfirm,
|
|
102
|
-
}) => {
|
|
103
|
-
const { formatMessage } = useIntl();
|
|
104
|
-
|
|
105
|
-
return (
|
|
106
|
-
<ConfirmBulkActionDialog
|
|
107
|
-
isOpen={isOpen}
|
|
108
|
-
onToggleDialog={onToggleDialog}
|
|
109
|
-
dialogBody={
|
|
110
|
-
<>
|
|
111
|
-
<Typography id="confirm-description" textAlign="center">
|
|
112
|
-
{formatMessage({
|
|
113
|
-
id: getTrad('popUpWarning.bodyMessage.contentType.unpublish.all'),
|
|
114
|
-
defaultMessage: 'Are you sure you want to unpublish these entries?',
|
|
115
|
-
})}
|
|
116
|
-
</Typography>
|
|
117
|
-
<InjectionZoneList area="contentManager.listView.unpublishModalAdditionalInfos" />
|
|
118
|
-
</>
|
|
119
|
-
}
|
|
120
|
-
endAction={
|
|
121
|
-
<Button
|
|
122
|
-
onClick={onConfirm}
|
|
123
|
-
variant="secondary"
|
|
124
|
-
startIcon={<Check />}
|
|
125
|
-
loading={isConfirmButtonLoading}
|
|
126
|
-
>
|
|
127
|
-
{formatMessage({
|
|
128
|
-
id: 'app.utils.unpublish',
|
|
129
|
-
defaultMessage: 'Unpublish',
|
|
130
|
-
})}
|
|
131
|
-
</Button>
|
|
132
|
-
}
|
|
133
|
-
/>
|
|
134
|
-
);
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
ConfirmDialogUnpublishAll.propTypes = confirmDialogsPropTypes;
|
|
138
|
-
|
|
139
|
-
const ConfirmDialogDeleteAll = ({ isOpen, onToggleDialog, isConfirmButtonLoading, onConfirm }) => {
|
|
140
|
-
const { formatMessage } = useIntl();
|
|
141
|
-
|
|
142
|
-
return (
|
|
143
|
-
<ConfirmBulkActionDialog
|
|
144
|
-
isOpen={isOpen}
|
|
145
|
-
onToggleDialog={onToggleDialog}
|
|
146
|
-
dialogBody={
|
|
147
|
-
<>
|
|
148
|
-
<Typography id="confirm-description" textAlign="center">
|
|
149
|
-
{formatMessage({
|
|
150
|
-
id: getTrad('popUpWarning.bodyMessage.contentType.delete.all'),
|
|
151
|
-
defaultMessage: 'Are you sure you want to delete these entries?',
|
|
152
|
-
})}
|
|
153
|
-
</Typography>
|
|
154
|
-
<InjectionZoneList area="contentManager.listView.deleteModalAdditionalInfos" />
|
|
155
|
-
</>
|
|
156
|
-
}
|
|
157
|
-
endAction={
|
|
158
|
-
<Button
|
|
159
|
-
onClick={onConfirm}
|
|
160
|
-
variant="danger-light"
|
|
161
|
-
startIcon={<Trash />}
|
|
162
|
-
id="confirm-delete"
|
|
163
|
-
loading={isConfirmButtonLoading}
|
|
164
|
-
>
|
|
165
|
-
{formatMessage({
|
|
166
|
-
id: 'app.components.Button.confirm',
|
|
167
|
-
defaultMessage: 'Confirm',
|
|
168
|
-
})}
|
|
169
|
-
</Button>
|
|
170
|
-
}
|
|
171
|
-
/>
|
|
172
|
-
);
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
ConfirmDialogDeleteAll.propTypes = confirmDialogsPropTypes;
|
|
176
|
-
|
|
177
|
-
const BulkActionsBar = ({
|
|
178
|
-
showPublish,
|
|
179
|
-
showDelete,
|
|
180
|
-
onConfirmDeleteAll,
|
|
181
|
-
onConfirmPublishAll,
|
|
182
|
-
onConfirmUnpublishAll,
|
|
183
|
-
selectedEntries,
|
|
184
|
-
clearSelectedEntries,
|
|
185
|
-
}) => {
|
|
186
|
-
const { formatMessage } = useIntl();
|
|
187
|
-
const { trackUsage } = useTracking();
|
|
188
|
-
const { data } = useSelector(listViewDomain());
|
|
189
|
-
|
|
190
|
-
const [isConfirmButtonLoading, setIsConfirmButtonLoading] = useState(false);
|
|
191
|
-
const [dialogToOpen, setDialogToOpen] = useState(null);
|
|
192
|
-
|
|
193
|
-
// Filters for Bulk actions
|
|
194
|
-
const selectedEntriesObjects = data.filter((entry) => selectedEntries.includes(entry.id));
|
|
195
|
-
const publishButtonIsShown =
|
|
196
|
-
showPublish && selectedEntriesObjects.some((entry) => !entry.publishedAt);
|
|
197
|
-
const unpublishButtonIsShown =
|
|
198
|
-
showPublish && selectedEntriesObjects.some((entry) => entry.publishedAt);
|
|
199
|
-
|
|
200
|
-
const toggleDeleteModal = () => {
|
|
201
|
-
if (dialogToOpen === 'delete') {
|
|
202
|
-
setDialogToOpen(null);
|
|
203
|
-
} else {
|
|
204
|
-
setDialogToOpen('delete');
|
|
205
|
-
trackUsage('willBulkDeleteEntries');
|
|
206
|
-
}
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
const togglePublishModal = () => {
|
|
210
|
-
if (dialogToOpen === 'publish') {
|
|
211
|
-
setDialogToOpen(null);
|
|
212
|
-
} else {
|
|
213
|
-
setDialogToOpen('publish');
|
|
214
|
-
trackUsage('willBulkPublishEntries');
|
|
215
|
-
}
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
const toggleUnpublishModal = () => {
|
|
219
|
-
if (dialogToOpen === 'unpublish') {
|
|
220
|
-
setDialogToOpen(null);
|
|
221
|
-
} else {
|
|
222
|
-
setDialogToOpen('unpublish');
|
|
223
|
-
trackUsage('willBulkUnpublishEntries');
|
|
224
|
-
}
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
const handleBulkAction = async (confirmAction, toggleModal) => {
|
|
228
|
-
try {
|
|
229
|
-
setIsConfirmButtonLoading(true);
|
|
230
|
-
await confirmAction(selectedEntries);
|
|
231
|
-
setIsConfirmButtonLoading(false);
|
|
232
|
-
toggleModal();
|
|
233
|
-
clearSelectedEntries();
|
|
234
|
-
} catch (error) {
|
|
235
|
-
setIsConfirmButtonLoading(false);
|
|
236
|
-
toggleModal();
|
|
237
|
-
}
|
|
238
|
-
};
|
|
239
|
-
|
|
240
|
-
const handleBulkDelete = () => handleBulkAction(onConfirmDeleteAll, toggleDeleteModal);
|
|
241
|
-
const handleBulkPublish = () => handleBulkAction(onConfirmPublishAll, togglePublishModal);
|
|
242
|
-
const handleBulkUnpublish = () => handleBulkAction(onConfirmUnpublishAll, toggleUnpublishModal);
|
|
243
|
-
|
|
244
|
-
return (
|
|
245
|
-
<>
|
|
246
|
-
{publishButtonIsShown && (
|
|
247
|
-
<>
|
|
248
|
-
<Button variant="tertiary" onClick={togglePublishModal}>
|
|
249
|
-
{formatMessage({ id: 'app.utils.publish', defaultMessage: 'Publish' })}
|
|
250
|
-
</Button>
|
|
251
|
-
<ConfirmDialogPublishAll
|
|
252
|
-
isOpen={dialogToOpen === 'publish'}
|
|
253
|
-
onToggleDialog={togglePublishModal}
|
|
254
|
-
isConfirmButtonLoading={isConfirmButtonLoading}
|
|
255
|
-
onConfirm={handleBulkPublish}
|
|
256
|
-
/>
|
|
257
|
-
</>
|
|
258
|
-
)}
|
|
259
|
-
{unpublishButtonIsShown && (
|
|
260
|
-
<>
|
|
261
|
-
<Button variant="tertiary" onClick={toggleUnpublishModal}>
|
|
262
|
-
{formatMessage({ id: 'app.utils.unpublish', defaultMessage: 'Unpublish' })}
|
|
263
|
-
</Button>
|
|
264
|
-
<ConfirmDialogUnpublishAll
|
|
265
|
-
isOpen={dialogToOpen === 'unpublish'}
|
|
266
|
-
onToggleDialog={toggleUnpublishModal}
|
|
267
|
-
isConfirmButtonLoading={isConfirmButtonLoading}
|
|
268
|
-
onConfirm={handleBulkUnpublish}
|
|
269
|
-
/>
|
|
270
|
-
</>
|
|
271
|
-
)}
|
|
272
|
-
{showDelete && (
|
|
273
|
-
<>
|
|
274
|
-
<Button variant="danger-light" onClick={toggleDeleteModal}>
|
|
275
|
-
{formatMessage({ id: 'global.delete', defaultMessage: 'Delete' })}
|
|
276
|
-
</Button>
|
|
277
|
-
<ConfirmDialogDeleteAll
|
|
278
|
-
isOpen={dialogToOpen === 'delete'}
|
|
279
|
-
onToggleDialog={toggleDeleteModal}
|
|
280
|
-
isConfirmButtonLoading={isConfirmButtonLoading}
|
|
281
|
-
onConfirm={handleBulkDelete}
|
|
282
|
-
/>
|
|
283
|
-
</>
|
|
284
|
-
)}
|
|
285
|
-
</>
|
|
286
|
-
);
|
|
287
|
-
};
|
|
288
|
-
|
|
289
|
-
BulkActionsBar.defaultProps = {
|
|
290
|
-
showPublish: false,
|
|
291
|
-
showDelete: false,
|
|
292
|
-
onConfirmDeleteAll() {},
|
|
293
|
-
onConfirmPublishAll() {},
|
|
294
|
-
onConfirmUnpublishAll() {},
|
|
295
|
-
};
|
|
296
|
-
|
|
297
|
-
BulkActionsBar.propTypes = {
|
|
298
|
-
showPublish: PropTypes.bool,
|
|
299
|
-
showDelete: PropTypes.bool,
|
|
300
|
-
onConfirmDeleteAll: PropTypes.func,
|
|
301
|
-
onConfirmPublishAll: PropTypes.func,
|
|
302
|
-
onConfirmUnpublishAll: PropTypes.func,
|
|
303
|
-
selectedEntries: PropTypes.array.isRequired,
|
|
304
|
-
clearSelectedEntries: PropTypes.func.isRequired,
|
|
305
|
-
};
|
|
306
|
-
|
|
307
|
-
export default BulkActionsBar;
|