@strapi/content-releases 0.0.0-experimental.bd712ad3930045f4a5d2144c119e0b7856e97fc4 → 0.0.0-experimental.c1db72686c9a673017790a59eb40b55c67a61097
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/dist/_chunks/{App-zzUitryC.js → App-dLXY5ei3.js} +570 -542
- package/dist/_chunks/App-dLXY5ei3.js.map +1 -0
- package/dist/_chunks/{App-6gbM0io-.mjs → App-jrh58sXY.mjs} +547 -521
- package/dist/_chunks/App-jrh58sXY.mjs.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-_MxP6-Dt.mjs → PurchaseContentReleases-3tRbmbY3.mjs} +7 -8
- package/dist/_chunks/PurchaseContentReleases-3tRbmbY3.mjs.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-Be3acS2L.js → PurchaseContentReleases-bpIYXOfu.js} +6 -7
- package/dist/_chunks/PurchaseContentReleases-bpIYXOfu.js.map +1 -0
- package/dist/_chunks/{en-1_1re1mc.js → en-HrREghh3.js} +2 -7
- package/dist/_chunks/en-HrREghh3.js.map +1 -0
- package/dist/_chunks/{en-C3sq5KNP.mjs → en-ltT1TlKQ.mjs} +2 -7
- package/dist/_chunks/en-ltT1TlKQ.mjs.map +1 -0
- package/dist/_chunks/index-CVO0Rqdm.js +1336 -0
- package/dist/_chunks/index-CVO0Rqdm.js.map +1 -0
- package/dist/_chunks/index-PiOGBETy.mjs +1315 -0
- package/dist/_chunks/index-PiOGBETy.mjs.map +1 -0
- package/dist/admin/index.js +15 -1
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +16 -2
- package/dist/admin/index.mjs.map +1 -1
- package/dist/server/index.js +673 -847
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +673 -848
- package/dist/server/index.mjs.map +1 -1
- package/package.json +38 -31
- package/dist/_chunks/App-6gbM0io-.mjs.map +0 -1
- package/dist/_chunks/App-zzUitryC.js.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-Be3acS2L.js.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-_MxP6-Dt.mjs.map +0 -1
- package/dist/_chunks/SettingsPage-CTOl3Qtw.js +0 -157
- package/dist/_chunks/SettingsPage-CTOl3Qtw.js.map +0 -1
- package/dist/_chunks/SettingsPage-CuSH193e.mjs +0 -157
- package/dist/_chunks/SettingsPage-CuSH193e.mjs.map +0 -1
- package/dist/_chunks/en-1_1re1mc.js.map +0 -1
- package/dist/_chunks/en-C3sq5KNP.mjs.map +0 -1
- package/dist/_chunks/index-BxRiXenX.js +0 -1118
- package/dist/_chunks/index-BxRiXenX.js.map +0 -1
- package/dist/_chunks/index-CuchqQ4_.mjs +0 -1099
- package/dist/_chunks/index-CuchqQ4_.mjs.map +0 -1
- package/dist/_chunks/validation-schemas-C7P2rhPu.mjs +0 -29
- package/dist/_chunks/validation-schemas-C7P2rhPu.mjs.map +0 -1
- package/dist/_chunks/validation-schemas-bib1fBc7.js +0 -47
- package/dist/_chunks/validation-schemas-bib1fBc7.js.map +0 -1
- package/dist/admin/src/components/RelativeTime.d.ts +0 -28
- package/dist/admin/src/components/ReleaseAction.d.ts +0 -3
- package/dist/admin/src/components/ReleaseActionMenu.d.ts +0 -26
- package/dist/admin/src/components/ReleaseActionModal.d.ts +0 -24
- package/dist/admin/src/components/ReleaseActionOptions.d.ts +0 -9
- package/dist/admin/src/components/ReleaseListCell.d.ts +0 -0
- package/dist/admin/src/components/ReleaseModal.d.ts +0 -17
- package/dist/admin/src/components/ReleasesPanel.d.ts +0 -3
- package/dist/admin/src/constants.d.ts +0 -58
- package/dist/admin/src/index.d.ts +0 -3
- package/dist/admin/src/pages/App.d.ts +0 -1
- package/dist/admin/src/pages/PurchaseContentReleases.d.ts +0 -2
- package/dist/admin/src/pages/ReleaseDetailsPage.d.ts +0 -2
- package/dist/admin/src/pages/ReleasesPage.d.ts +0 -8
- package/dist/admin/src/pages/SettingsPage.d.ts +0 -1
- package/dist/admin/src/pages/tests/mockReleaseDetailsPageData.d.ts +0 -181
- package/dist/admin/src/pages/tests/mockReleasesPageData.d.ts +0 -39
- package/dist/admin/src/pluginId.d.ts +0 -1
- package/dist/admin/src/services/release.d.ts +0 -110
- package/dist/admin/src/store/hooks.d.ts +0 -7
- package/dist/admin/src/utils/api.d.ts +0 -6
- package/dist/admin/src/utils/prefixPluginTranslations.d.ts +0 -3
- package/dist/admin/src/utils/time.d.ts +0 -10
- package/dist/server/src/bootstrap.d.ts +0 -5
- package/dist/server/src/bootstrap.d.ts.map +0 -1
- package/dist/server/src/constants.d.ts +0 -21
- package/dist/server/src/constants.d.ts.map +0 -1
- package/dist/server/src/content-types/index.d.ts +0 -97
- package/dist/server/src/content-types/index.d.ts.map +0 -1
- package/dist/server/src/content-types/release/index.d.ts +0 -48
- package/dist/server/src/content-types/release/index.d.ts.map +0 -1
- package/dist/server/src/content-types/release/schema.d.ts +0 -47
- package/dist/server/src/content-types/release/schema.d.ts.map +0 -1
- package/dist/server/src/content-types/release-action/index.d.ts +0 -48
- package/dist/server/src/content-types/release-action/index.d.ts.map +0 -1
- package/dist/server/src/content-types/release-action/schema.d.ts +0 -47
- package/dist/server/src/content-types/release-action/schema.d.ts.map +0 -1
- package/dist/server/src/controllers/index.d.ts +0 -23
- package/dist/server/src/controllers/index.d.ts.map +0 -1
- package/dist/server/src/controllers/release-action.d.ts +0 -9
- package/dist/server/src/controllers/release-action.d.ts.map +0 -1
- package/dist/server/src/controllers/release.d.ts +0 -17
- package/dist/server/src/controllers/release.d.ts.map +0 -1
- package/dist/server/src/controllers/settings.d.ts +0 -11
- package/dist/server/src/controllers/settings.d.ts.map +0 -1
- package/dist/server/src/controllers/validation/release-action.d.ts +0 -14
- package/dist/server/src/controllers/validation/release-action.d.ts.map +0 -1
- package/dist/server/src/controllers/validation/release.d.ts +0 -3
- package/dist/server/src/controllers/validation/release.d.ts.map +0 -1
- package/dist/server/src/controllers/validation/settings.d.ts +0 -2
- package/dist/server/src/controllers/validation/settings.d.ts.map +0 -1
- package/dist/server/src/destroy.d.ts +0 -5
- package/dist/server/src/destroy.d.ts.map +0 -1
- package/dist/server/src/index.d.ts +0 -2111
- package/dist/server/src/index.d.ts.map +0 -1
- package/dist/server/src/middlewares/documents.d.ts +0 -6
- package/dist/server/src/middlewares/documents.d.ts.map +0 -1
- package/dist/server/src/migrations/database/5.0.0-document-id-in-actions.d.ts +0 -9
- package/dist/server/src/migrations/database/5.0.0-document-id-in-actions.d.ts.map +0 -1
- package/dist/server/src/migrations/index.d.ts +0 -13
- package/dist/server/src/migrations/index.d.ts.map +0 -1
- package/dist/server/src/register.d.ts +0 -5
- package/dist/server/src/register.d.ts.map +0 -1
- package/dist/server/src/routes/index.d.ts +0 -51
- package/dist/server/src/routes/index.d.ts.map +0 -1
- package/dist/server/src/routes/release-action.d.ts +0 -18
- package/dist/server/src/routes/release-action.d.ts.map +0 -1
- package/dist/server/src/routes/release.d.ts +0 -18
- package/dist/server/src/routes/release.d.ts.map +0 -1
- package/dist/server/src/routes/settings.d.ts +0 -18
- package/dist/server/src/routes/settings.d.ts.map +0 -1
- package/dist/server/src/services/index.d.ts +0 -1826
- package/dist/server/src/services/index.d.ts.map +0 -1
- package/dist/server/src/services/release-action.d.ts +0 -36
- package/dist/server/src/services/release-action.d.ts.map +0 -1
- package/dist/server/src/services/release.d.ts +0 -31
- package/dist/server/src/services/release.d.ts.map +0 -1
- package/dist/server/src/services/scheduling.d.ts +0 -18
- package/dist/server/src/services/scheduling.d.ts.map +0 -1
- package/dist/server/src/services/settings.d.ts +0 -13
- package/dist/server/src/services/settings.d.ts.map +0 -1
- package/dist/server/src/services/validation.d.ts +0 -18
- package/dist/server/src/services/validation.d.ts.map +0 -1
- package/dist/server/src/utils/index.d.ts +0 -35
- package/dist/server/src/utils/index.d.ts.map +0 -1
- package/dist/shared/contracts/release-actions.d.ts +0 -132
- package/dist/shared/contracts/release-actions.d.ts.map +0 -1
- package/dist/shared/contracts/releases.d.ts +0 -183
- package/dist/shared/contracts/releases.d.ts.map +0 -1
- package/dist/shared/contracts/settings.d.ts +0 -39
- package/dist/shared/contracts/settings.d.ts.map +0 -1
- package/dist/shared/types.d.ts +0 -24
- package/dist/shared/types.d.ts.map +0 -1
- package/dist/shared/validation-schemas.d.ts +0 -3
- package/dist/shared/validation-schemas.d.ts.map +0 -1
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
-
const
|
|
4
|
+
const helperPlugin = require("@strapi/helper-plugin");
|
|
5
5
|
const reactRouterDom = require("react-router-dom");
|
|
6
|
-
const index = require("./index-
|
|
6
|
+
const index = require("./index-CVO0Rqdm.js");
|
|
7
7
|
const React = require("react");
|
|
8
|
-
const strapiAdmin
|
|
8
|
+
const strapiAdmin = require("@strapi/admin/strapi-admin");
|
|
9
9
|
const designSystem = require("@strapi/design-system");
|
|
10
|
+
const v2 = require("@strapi/design-system/v2");
|
|
10
11
|
const icons = require("@strapi/icons");
|
|
11
|
-
const symbols = require("@strapi/icons/symbols");
|
|
12
12
|
const format = require("date-fns/format");
|
|
13
13
|
const dateFnsTz = require("date-fns-tz");
|
|
14
14
|
const reactIntl = require("react-intl");
|
|
15
|
-
const
|
|
15
|
+
const styled = require("styled-components");
|
|
16
16
|
const dateFns = require("date-fns");
|
|
17
17
|
const formik = require("formik");
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
const yup = require("yup");
|
|
19
|
+
require("@reduxjs/toolkit/query");
|
|
20
|
+
require("axios");
|
|
21
|
+
require("@reduxjs/toolkit/query/react");
|
|
22
|
+
require("react-redux");
|
|
21
23
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
22
24
|
function _interopNamespace(e) {
|
|
23
25
|
if (e && e.__esModule)
|
|
@@ -39,39 +41,30 @@ function _interopNamespace(e) {
|
|
|
39
41
|
}
|
|
40
42
|
const React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
|
41
43
|
const format__default = /* @__PURE__ */ _interopDefault(format);
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
role: "time",
|
|
65
|
-
title: `${formatDate(timestamp)} ${formatTime(timestamp)}`,
|
|
66
|
-
...restProps,
|
|
67
|
-
children: displayText
|
|
68
|
-
}
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
);
|
|
44
|
+
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
45
|
+
const yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
|
|
46
|
+
const RELEASE_SCHEMA = yup__namespace.object().shape({
|
|
47
|
+
name: yup__namespace.string().trim().required(),
|
|
48
|
+
scheduledAt: yup__namespace.string().nullable(),
|
|
49
|
+
isScheduled: yup__namespace.boolean().optional(),
|
|
50
|
+
time: yup__namespace.string().when("isScheduled", {
|
|
51
|
+
is: true,
|
|
52
|
+
then: yup__namespace.string().trim().required(),
|
|
53
|
+
otherwise: yup__namespace.string().nullable()
|
|
54
|
+
}),
|
|
55
|
+
timezone: yup__namespace.string().when("isScheduled", {
|
|
56
|
+
is: true,
|
|
57
|
+
then: yup__namespace.string().required().nullable(),
|
|
58
|
+
otherwise: yup__namespace.string().nullable()
|
|
59
|
+
}),
|
|
60
|
+
date: yup__namespace.string().when("isScheduled", {
|
|
61
|
+
is: true,
|
|
62
|
+
then: yup__namespace.string().required().nullable(),
|
|
63
|
+
otherwise: yup__namespace.string().nullable()
|
|
64
|
+
})
|
|
65
|
+
}).required().noUnknown();
|
|
72
66
|
const ReleaseModal = ({
|
|
73
67
|
handleClose,
|
|
74
|
-
open,
|
|
75
68
|
handleSubmit,
|
|
76
69
|
initialValues,
|
|
77
70
|
isLoading = false
|
|
@@ -79,7 +72,7 @@ const ReleaseModal = ({
|
|
|
79
72
|
const { formatMessage } = reactIntl.useIntl();
|
|
80
73
|
const { pathname } = reactRouterDom.useLocation();
|
|
81
74
|
const isCreatingRelease = pathname === `/plugins/${index.pluginId}`;
|
|
82
|
-
const { timezoneList, systemTimezone = { value: "UTC+00:00-Africa/Abidjan " } } =
|
|
75
|
+
const { timezoneList, systemTimezone = { value: "UTC+00:00-Africa/Abidjan " } } = getTimezones(
|
|
83
76
|
initialValues.scheduledAt ? new Date(initialValues.scheduledAt) : /* @__PURE__ */ new Date()
|
|
84
77
|
);
|
|
85
78
|
const getScheduledTimestamp = (values) => {
|
|
@@ -95,8 +88,8 @@ const ReleaseModal = ({
|
|
|
95
88
|
);
|
|
96
89
|
return currentTimezone?.value || systemTimezone.value;
|
|
97
90
|
};
|
|
98
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
99
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
91
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.ModalLayout, { onClose: handleClose, labelledBy: "title", children: [
|
|
92
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.ModalHeader, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { id: "title", fontWeight: "bold", textColor: "neutral800", children: formatMessage(
|
|
100
93
|
{
|
|
101
94
|
id: "content-releases.modal.title",
|
|
102
95
|
defaultMessage: "{isCreatingRelease, select, true {New release} other {Edit release}}"
|
|
@@ -117,121 +110,135 @@ const ReleaseModal = ({
|
|
|
117
110
|
...initialValues,
|
|
118
111
|
timezone: initialValues.timezone ? getTimezoneWithOffset() : systemTimezone.value
|
|
119
112
|
},
|
|
120
|
-
validationSchema:
|
|
113
|
+
validationSchema: RELEASE_SCHEMA,
|
|
121
114
|
validateOnChange: false,
|
|
122
|
-
children: ({ values, errors, handleChange, setFieldValue }) => {
|
|
123
|
-
|
|
124
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
125
|
-
|
|
126
|
-
|
|
115
|
+
children: ({ values, errors, handleChange, setFieldValue }) => /* @__PURE__ */ jsxRuntime.jsxs(formik.Form, { children: [
|
|
116
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.ModalBody, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
|
|
117
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
118
|
+
designSystem.TextInput,
|
|
119
|
+
{
|
|
120
|
+
label: formatMessage({
|
|
127
121
|
id: "content-releases.modal.form.input.label.release-name",
|
|
128
122
|
defaultMessage: "Name"
|
|
129
|
-
})
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
123
|
+
}),
|
|
124
|
+
name: "name",
|
|
125
|
+
value: values.name,
|
|
126
|
+
error: errors.name,
|
|
127
|
+
onChange: handleChange,
|
|
128
|
+
required: true
|
|
129
|
+
}
|
|
130
|
+
),
|
|
131
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "max-content", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
132
|
+
designSystem.Checkbox,
|
|
133
|
+
{
|
|
134
|
+
name: "isScheduled",
|
|
135
|
+
value: values.isScheduled,
|
|
136
|
+
onChange: (event) => {
|
|
137
|
+
setFieldValue("isScheduled", event.target.checked);
|
|
138
|
+
if (!event.target.checked) {
|
|
139
|
+
setFieldValue("date", null);
|
|
140
|
+
setFieldValue("time", "");
|
|
141
|
+
setFieldValue("timezone", null);
|
|
142
|
+
} else {
|
|
143
|
+
setFieldValue("date", initialValues.date);
|
|
144
|
+
setFieldValue("time", initialValues.time);
|
|
145
|
+
setFieldValue("timezone", initialValues.timezone ?? systemTimezone?.value);
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
149
|
+
designSystem.Typography,
|
|
150
|
+
{
|
|
151
|
+
textColor: values.isScheduled ? "primary600" : "neutral800",
|
|
152
|
+
fontWeight: values.isScheduled ? "semiBold" : "regular",
|
|
153
|
+
children: formatMessage({
|
|
154
|
+
id: "modal.form.input.label.schedule-release",
|
|
155
|
+
defaultMessage: "Schedule release"
|
|
156
|
+
})
|
|
157
|
+
}
|
|
158
|
+
)
|
|
159
|
+
}
|
|
160
|
+
) }),
|
|
161
|
+
values.isScheduled && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
162
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, alignItems: "start", children: [
|
|
163
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
164
|
+
designSystem.DatePicker,
|
|
165
|
+
{
|
|
166
|
+
label: formatMessage({
|
|
170
167
|
id: "content-releases.modal.form.input.label.date",
|
|
171
168
|
defaultMessage: "Date"
|
|
172
|
-
})
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
169
|
+
}),
|
|
170
|
+
name: "date",
|
|
171
|
+
error: errors.date,
|
|
172
|
+
onChange: (date) => {
|
|
173
|
+
const isoFormatDate = date ? dateFns.formatISO(date, { representation: "date" }) : null;
|
|
174
|
+
setFieldValue("date", isoFormatDate);
|
|
175
|
+
},
|
|
176
|
+
clearLabel: formatMessage({
|
|
177
|
+
id: "content-releases.modal.form.input.clearLabel",
|
|
178
|
+
defaultMessage: "Clear"
|
|
179
|
+
}),
|
|
180
|
+
onClear: () => {
|
|
181
|
+
setFieldValue("date", null);
|
|
182
|
+
},
|
|
183
|
+
selectedDate: values.date || void 0,
|
|
184
|
+
required: true,
|
|
185
|
+
minDate: dateFnsTz.utcToZonedTime(/* @__PURE__ */ new Date(), values.timezone.split("&")[1])
|
|
186
|
+
}
|
|
187
|
+
) }),
|
|
188
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
189
|
+
designSystem.TimePicker,
|
|
190
|
+
{
|
|
191
|
+
label: formatMessage({
|
|
195
192
|
id: "content-releases.modal.form.input.label.time",
|
|
196
193
|
defaultMessage: "Time"
|
|
197
|
-
})
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
222
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { name: "submit", loading: isLoading, type: "submit", children: formatMessage(
|
|
194
|
+
}),
|
|
195
|
+
name: "time",
|
|
196
|
+
error: errors.time,
|
|
197
|
+
onChange: (time) => {
|
|
198
|
+
setFieldValue("time", time);
|
|
199
|
+
},
|
|
200
|
+
clearLabel: formatMessage({
|
|
201
|
+
id: "content-releases.modal.form.input.clearLabel",
|
|
202
|
+
defaultMessage: "Clear"
|
|
203
|
+
}),
|
|
204
|
+
onClear: () => {
|
|
205
|
+
setFieldValue("time", "");
|
|
206
|
+
},
|
|
207
|
+
value: values.time || void 0,
|
|
208
|
+
required: true
|
|
209
|
+
}
|
|
210
|
+
) })
|
|
211
|
+
] }),
|
|
212
|
+
/* @__PURE__ */ jsxRuntime.jsx(TimezoneComponent, { timezoneOptions: timezoneList })
|
|
213
|
+
] })
|
|
214
|
+
] }) }),
|
|
215
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
216
|
+
designSystem.ModalFooter,
|
|
217
|
+
{
|
|
218
|
+
startActions: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: handleClose, variant: "tertiary", name: "cancel", children: formatMessage({ id: "cancel", defaultMessage: "Cancel" }) }),
|
|
219
|
+
endActions: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { name: "submit", loading: isLoading, type: "submit", children: formatMessage(
|
|
223
220
|
{
|
|
224
221
|
id: "content-releases.modal.form.button.submit",
|
|
225
222
|
defaultMessage: "{isCreatingRelease, select, true {Continue} other {Save}}"
|
|
226
223
|
},
|
|
227
224
|
{ isCreatingRelease }
|
|
228
225
|
) })
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
}
|
|
226
|
+
}
|
|
227
|
+
)
|
|
228
|
+
] })
|
|
232
229
|
}
|
|
233
230
|
)
|
|
234
|
-
] })
|
|
231
|
+
] });
|
|
232
|
+
};
|
|
233
|
+
const getTimezones = (selectedDate) => {
|
|
234
|
+
const timezoneList = Intl.supportedValuesOf("timeZone").map((timezone) => {
|
|
235
|
+
const utcOffset = index.getTimezoneOffset(timezone, selectedDate);
|
|
236
|
+
return { offset: utcOffset, value: `${utcOffset}&${timezone}` };
|
|
237
|
+
});
|
|
238
|
+
const systemTimezone = timezoneList.find(
|
|
239
|
+
(timezone) => timezone.value.split("&")[1] === Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
240
|
+
);
|
|
241
|
+
return { timezoneList, systemTimezone };
|
|
235
242
|
};
|
|
236
243
|
const TimezoneComponent = ({ timezoneOptions }) => {
|
|
237
244
|
const { values, errors, setFieldValue } = formik.useFormikContext();
|
|
@@ -239,7 +246,7 @@ const TimezoneComponent = ({ timezoneOptions }) => {
|
|
|
239
246
|
const [timezoneList, setTimezoneList] = React__namespace.useState(timezoneOptions);
|
|
240
247
|
React__namespace.useEffect(() => {
|
|
241
248
|
if (values.date) {
|
|
242
|
-
const { timezoneList: timezoneList2 } =
|
|
249
|
+
const { timezoneList: timezoneList2 } = getTimezones(new Date(values.date));
|
|
243
250
|
setTimezoneList(timezoneList2);
|
|
244
251
|
const updatedTimezone = values.timezone && timezoneList2.find((tz) => tz.value.split("&")[1] === values.timezone.split("&")[1]);
|
|
245
252
|
if (updatedTimezone) {
|
|
@@ -247,40 +254,36 @@ const TimezoneComponent = ({ timezoneOptions }) => {
|
|
|
247
254
|
}
|
|
248
255
|
}
|
|
249
256
|
}, [setFieldValue, values.date, values.timezone]);
|
|
250
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
{
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
};
|
|
276
|
-
const useTypedDispatch = reactRedux.useDispatch;
|
|
277
|
-
const isBaseQueryError = (error) => {
|
|
278
|
-
return typeof error !== "undefined" && error.name !== void 0;
|
|
257
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
258
|
+
designSystem.Combobox,
|
|
259
|
+
{
|
|
260
|
+
label: formatMessage({
|
|
261
|
+
id: "content-releases.modal.form.input.label.timezone",
|
|
262
|
+
defaultMessage: "Timezone"
|
|
263
|
+
}),
|
|
264
|
+
autocomplete: { type: "list", filter: "contains" },
|
|
265
|
+
name: "timezone",
|
|
266
|
+
value: values.timezone || void 0,
|
|
267
|
+
textValue: values.timezone ? values.timezone.replace(/&/, " ") : void 0,
|
|
268
|
+
onChange: (timezone) => {
|
|
269
|
+
setFieldValue("timezone", timezone);
|
|
270
|
+
},
|
|
271
|
+
onTextValueChange: (timezone) => {
|
|
272
|
+
setFieldValue("timezone", timezone);
|
|
273
|
+
},
|
|
274
|
+
onClear: () => {
|
|
275
|
+
setFieldValue("timezone", "");
|
|
276
|
+
},
|
|
277
|
+
error: errors.timezone,
|
|
278
|
+
required: true,
|
|
279
|
+
children: timezoneList.map((timezone) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.ComboboxOption, { value: timezone.value, children: timezone.value.replace(/&/, " ") }, timezone.value))
|
|
280
|
+
}
|
|
281
|
+
);
|
|
279
282
|
};
|
|
280
|
-
const LinkCard =
|
|
283
|
+
const LinkCard = styled__default.default(v2.Link)`
|
|
281
284
|
display: block;
|
|
282
285
|
`;
|
|
283
|
-
const RelativeTime =
|
|
286
|
+
const RelativeTime = styled__default.default(helperPlugin.RelativeTime)`
|
|
284
287
|
display: inline-block;
|
|
285
288
|
&::first-letter {
|
|
286
289
|
text-transform: uppercase;
|
|
@@ -314,7 +317,7 @@ const getBadgeProps = (status) => {
|
|
|
314
317
|
const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
315
318
|
const { formatMessage } = reactIntl.useIntl();
|
|
316
319
|
if (isError) {
|
|
317
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
320
|
+
return /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.AnErrorOccurred, {});
|
|
318
321
|
}
|
|
319
322
|
if (releases?.length === 0) {
|
|
320
323
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -329,11 +332,11 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
329
332
|
target: sectionTitle
|
|
330
333
|
}
|
|
331
334
|
),
|
|
332
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
335
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.EmptyDocuments, { width: "10rem" })
|
|
333
336
|
}
|
|
334
337
|
);
|
|
335
338
|
}
|
|
336
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid
|
|
339
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid, { gap: 4, children: releases.map(({ id, name, scheduledAt, status }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.GridItem, { col: 3, s: 6, xs: 12, children: /* @__PURE__ */ jsxRuntime.jsx(LinkCard, { href: `content-releases/${id}`, isExternal: false, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
337
340
|
designSystem.Flex,
|
|
338
341
|
{
|
|
339
342
|
direction: "column",
|
|
@@ -348,7 +351,7 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
348
351
|
gap: 4,
|
|
349
352
|
children: [
|
|
350
353
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "start", gap: 1, children: [
|
|
351
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, {
|
|
354
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { as: "h3", variant: "delta", fontWeight: "bold", children: name }),
|
|
352
355
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: scheduledAt ? /* @__PURE__ */ jsxRuntime.jsx(RelativeTime, { timestamp: new Date(scheduledAt) }) : formatMessage({
|
|
353
356
|
id: "content-releases.pages.Releases.not-scheduled",
|
|
354
357
|
defaultMessage: "Not scheduled"
|
|
@@ -359,7 +362,7 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
359
362
|
}
|
|
360
363
|
) }) }, id)) });
|
|
361
364
|
};
|
|
362
|
-
const StyledAlert =
|
|
365
|
+
const StyledAlert = styled__default.default(designSystem.Alert)`
|
|
363
366
|
button {
|
|
364
367
|
display: none;
|
|
365
368
|
}
|
|
@@ -369,34 +372,33 @@ const StyledAlert = styledComponents.styled(designSystem.Alert)`
|
|
|
369
372
|
`;
|
|
370
373
|
const INITIAL_FORM_VALUES = {
|
|
371
374
|
name: "",
|
|
372
|
-
date:
|
|
375
|
+
date: null,
|
|
373
376
|
time: "",
|
|
374
377
|
isScheduled: true,
|
|
375
378
|
scheduledAt: null,
|
|
376
379
|
timezone: null
|
|
377
380
|
};
|
|
378
381
|
const ReleasesPage = () => {
|
|
382
|
+
const tabRef = React__namespace.useRef(null);
|
|
379
383
|
const location = reactRouterDom.useLocation();
|
|
380
384
|
const [releaseModalShown, setReleaseModalShown] = React__namespace.useState(false);
|
|
381
|
-
const
|
|
385
|
+
const toggleNotification = helperPlugin.useNotification();
|
|
382
386
|
const { formatMessage } = reactIntl.useIntl();
|
|
383
|
-
const
|
|
384
|
-
const { formatAPIError } =
|
|
385
|
-
const [{ query }, setQuery] =
|
|
387
|
+
const { push, replace } = reactRouterDom.useHistory();
|
|
388
|
+
const { formatAPIError } = helperPlugin.useAPIErrorHandler();
|
|
389
|
+
const [{ query }, setQuery] = helperPlugin.useQueryParams();
|
|
386
390
|
const response = index.useGetReleasesQuery(query);
|
|
387
391
|
const [createRelease, { isLoading: isSubmittingForm }] = index.useCreateReleaseMutation();
|
|
388
|
-
const { getFeature } =
|
|
392
|
+
const { getFeature } = strapiAdmin.useLicenseLimits();
|
|
389
393
|
const { maximumReleases = 3 } = getFeature("cms-content-releases");
|
|
390
|
-
const { trackUsage } =
|
|
391
|
-
const {
|
|
392
|
-
allowedActions: { canCreate }
|
|
393
|
-
} = strapiAdmin.useRBAC(index.PERMISSIONS);
|
|
394
|
+
const { trackUsage } = helperPlugin.useTracking();
|
|
394
395
|
const { isLoading, isSuccess, isError } = response;
|
|
395
396
|
const activeTab = response?.currentData?.meta?.activeTab || "pending";
|
|
397
|
+
const activeTabIndex = ["pending", "done"].indexOf(activeTab);
|
|
396
398
|
React__namespace.useEffect(() => {
|
|
397
399
|
if (location?.state?.errors) {
|
|
398
400
|
toggleNotification({
|
|
399
|
-
type: "
|
|
401
|
+
type: "warning",
|
|
400
402
|
title: formatMessage({
|
|
401
403
|
id: "content-releases.pages.Releases.notification.error.title",
|
|
402
404
|
defaultMessage: "Your request could not be processed."
|
|
@@ -406,25 +408,30 @@ const ReleasesPage = () => {
|
|
|
406
408
|
defaultMessage: "Please try again or open another release."
|
|
407
409
|
})
|
|
408
410
|
});
|
|
409
|
-
|
|
411
|
+
replace({ state: null });
|
|
410
412
|
}
|
|
411
|
-
}, [formatMessage, location?.state?.errors,
|
|
413
|
+
}, [formatMessage, location?.state?.errors, replace, toggleNotification]);
|
|
414
|
+
React__namespace.useEffect(() => {
|
|
415
|
+
if (tabRef.current) {
|
|
416
|
+
tabRef.current._handlers.setSelectedTabIndex(activeTabIndex);
|
|
417
|
+
}
|
|
418
|
+
}, [activeTabIndex]);
|
|
412
419
|
const toggleAddReleaseModal = () => {
|
|
413
420
|
setReleaseModalShown((prev) => !prev);
|
|
414
421
|
};
|
|
415
422
|
if (isLoading) {
|
|
416
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
423
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Main, { "aria-busy": isLoading, children: /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.LoadingIndicatorPage, {}) });
|
|
417
424
|
}
|
|
418
425
|
const totalPendingReleases = isSuccess && response.currentData?.meta?.pendingReleasesCount || 0;
|
|
419
426
|
const hasReachedMaximumPendingReleases = totalPendingReleases >= maximumReleases;
|
|
420
|
-
const handleTabChange = (
|
|
427
|
+
const handleTabChange = (index2) => {
|
|
421
428
|
setQuery({
|
|
422
429
|
...query,
|
|
423
430
|
page: 1,
|
|
424
431
|
pageSize: response?.currentData?.meta?.pagination?.pageSize || 16,
|
|
425
432
|
filters: {
|
|
426
433
|
releasedAt: {
|
|
427
|
-
$notNull:
|
|
434
|
+
$notNull: index2 === 0 ? false : true
|
|
428
435
|
}
|
|
429
436
|
}
|
|
430
437
|
});
|
|
@@ -444,22 +451,22 @@ const ReleasesPage = () => {
|
|
|
444
451
|
})
|
|
445
452
|
});
|
|
446
453
|
trackUsage("didCreateRelease");
|
|
447
|
-
|
|
448
|
-
} else if (
|
|
454
|
+
push(`/plugins/content-releases/${response2.data.data.id}`);
|
|
455
|
+
} else if (index.isAxiosError(response2.error)) {
|
|
449
456
|
toggleNotification({
|
|
450
|
-
type: "
|
|
457
|
+
type: "warning",
|
|
451
458
|
message: formatAPIError(response2.error)
|
|
452
459
|
});
|
|
453
460
|
} else {
|
|
454
461
|
toggleNotification({
|
|
455
|
-
type: "
|
|
462
|
+
type: "warning",
|
|
456
463
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
457
464
|
});
|
|
458
465
|
}
|
|
459
466
|
};
|
|
460
467
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { "aria-busy": isLoading, children: [
|
|
461
468
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
462
|
-
|
|
469
|
+
designSystem.HeaderLayout,
|
|
463
470
|
{
|
|
464
471
|
title: formatMessage({
|
|
465
472
|
id: "content-releases.pages.Releases.title",
|
|
@@ -469,7 +476,7 @@ const ReleasesPage = () => {
|
|
|
469
476
|
id: "content-releases.pages.Releases.header-subtitle",
|
|
470
477
|
defaultMessage: "Create and manage content updates"
|
|
471
478
|
}),
|
|
472
|
-
primaryAction:
|
|
479
|
+
primaryAction: /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.CheckPermissions, { permissions: index.PERMISSIONS.create, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
473
480
|
designSystem.Button,
|
|
474
481
|
{
|
|
475
482
|
startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Plus, {}),
|
|
@@ -480,15 +487,15 @@ const ReleasesPage = () => {
|
|
|
480
487
|
defaultMessage: "New release"
|
|
481
488
|
})
|
|
482
489
|
}
|
|
483
|
-
)
|
|
490
|
+
) })
|
|
484
491
|
}
|
|
485
492
|
),
|
|
486
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
493
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.ContentLayout, { children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
487
494
|
hasReachedMaximumPendingReleases && /* @__PURE__ */ jsxRuntime.jsx(
|
|
488
495
|
StyledAlert,
|
|
489
496
|
{
|
|
490
497
|
marginBottom: 6,
|
|
491
|
-
action: /* @__PURE__ */ jsxRuntime.jsx(
|
|
498
|
+
action: /* @__PURE__ */ jsxRuntime.jsx(v2.Link, { href: "https://strapi.io/pricing-cloud", isExternal: true, children: formatMessage({
|
|
492
499
|
id: "content-releases.pages.Releases.max-limit-reached.action",
|
|
493
500
|
defaultMessage: "Explore plans"
|
|
494
501
|
}) }),
|
|
@@ -508,17 +515,21 @@ const ReleasesPage = () => {
|
|
|
508
515
|
})
|
|
509
516
|
}
|
|
510
517
|
),
|
|
511
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
518
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
519
|
+
designSystem.TabGroup,
|
|
520
|
+
{
|
|
521
|
+
label: formatMessage({
|
|
522
|
+
id: "content-releases.pages.Releases.tab-group.label",
|
|
523
|
+
defaultMessage: "Releases list"
|
|
524
|
+
}),
|
|
525
|
+
variant: "simple",
|
|
526
|
+
initialSelectedTabIndex: activeTabIndex,
|
|
527
|
+
onTabChange: handleTabChange,
|
|
528
|
+
ref: tabRef,
|
|
529
|
+
children: [
|
|
530
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { paddingBottom: 8, children: [
|
|
531
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tabs, { children: [
|
|
532
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tab, { children: formatMessage(
|
|
522
533
|
{
|
|
523
534
|
id: "content-releases.pages.Releases.tab.pending",
|
|
524
535
|
defaultMessage: "Pending ({count})"
|
|
@@ -527,48 +538,55 @@ const ReleasesPage = () => {
|
|
|
527
538
|
count: totalPendingReleases
|
|
528
539
|
}
|
|
529
540
|
) }),
|
|
530
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
541
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tab, { children: formatMessage({
|
|
531
542
|
id: "content-releases.pages.Releases.tab.done",
|
|
532
543
|
defaultMessage: "Done"
|
|
533
544
|
}) })
|
|
534
|
-
]
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
545
|
+
] }),
|
|
546
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Divider, {})
|
|
547
|
+
] }),
|
|
548
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.TabPanels, { children: [
|
|
549
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.TabPanel, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
550
|
+
ReleasesGrid,
|
|
551
|
+
{
|
|
552
|
+
sectionTitle: "pending",
|
|
553
|
+
releases: response?.currentData?.data,
|
|
554
|
+
isError
|
|
555
|
+
}
|
|
556
|
+
) }),
|
|
557
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.TabPanel, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
558
|
+
ReleasesGrid,
|
|
559
|
+
{
|
|
560
|
+
sectionTitle: "done",
|
|
561
|
+
releases: response?.currentData?.data,
|
|
562
|
+
isError
|
|
563
|
+
}
|
|
564
|
+
) })
|
|
565
|
+
] })
|
|
566
|
+
]
|
|
567
|
+
}
|
|
568
|
+
),
|
|
569
|
+
response.currentData?.meta?.pagination?.total ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { paddingTop: 4, alignItems: "flex-end", justifyContent: "space-between", children: [
|
|
570
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
571
|
+
helperPlugin.PageSizeURLQuery,
|
|
541
572
|
{
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
isError
|
|
573
|
+
options: ["8", "16", "32", "64"],
|
|
574
|
+
defaultValue: response?.currentData?.meta?.pagination?.pageSize.toString()
|
|
545
575
|
}
|
|
546
|
-
)
|
|
547
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
548
|
-
|
|
576
|
+
),
|
|
577
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
578
|
+
helperPlugin.PaginationURLQuery,
|
|
549
579
|
{
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
580
|
+
pagination: {
|
|
581
|
+
pageCount: response?.currentData?.meta?.pagination?.pageCount || 0
|
|
582
|
+
}
|
|
553
583
|
}
|
|
554
|
-
)
|
|
555
|
-
] })
|
|
556
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
557
|
-
strapiAdmin.Pagination.Root,
|
|
558
|
-
{
|
|
559
|
-
...response?.currentData?.meta?.pagination,
|
|
560
|
-
defaultPageSize: response?.currentData?.meta?.pagination?.pageSize,
|
|
561
|
-
children: [
|
|
562
|
-
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.PageSize, { options: ["8", "16", "32", "64"] }),
|
|
563
|
-
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.Links, {})
|
|
564
|
-
]
|
|
565
|
-
}
|
|
566
|
-
)
|
|
584
|
+
)
|
|
585
|
+
] }) : null
|
|
567
586
|
] }) }),
|
|
568
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
587
|
+
releaseModalShown && /* @__PURE__ */ jsxRuntime.jsx(
|
|
569
588
|
ReleaseModal,
|
|
570
589
|
{
|
|
571
|
-
open: releaseModalShown,
|
|
572
590
|
handleClose: toggleAddReleaseModal,
|
|
573
591
|
handleSubmit: handleAddRelease,
|
|
574
592
|
isLoading: isSubmittingForm,
|
|
@@ -577,13 +595,13 @@ const ReleasesPage = () => {
|
|
|
577
595
|
)
|
|
578
596
|
] });
|
|
579
597
|
};
|
|
580
|
-
const ReleaseInfoWrapper =
|
|
598
|
+
const ReleaseInfoWrapper = styled__default.default(designSystem.Flex)`
|
|
581
599
|
align-self: stretch;
|
|
582
600
|
border-bottom-right-radius: ${({ theme }) => theme.borderRadius};
|
|
583
601
|
border-bottom-left-radius: ${({ theme }) => theme.borderRadius};
|
|
584
602
|
border-top: 1px solid ${({ theme }) => theme.colors.neutral150};
|
|
585
603
|
`;
|
|
586
|
-
const StyledMenuItem =
|
|
604
|
+
const StyledMenuItem = styled__default.default(v2.Menu.Item)`
|
|
587
605
|
svg path {
|
|
588
606
|
fill: ${({ theme, disabled }) => disabled && theme.colors.neutral500};
|
|
589
607
|
}
|
|
@@ -592,95 +610,60 @@ const StyledMenuItem = styledComponents.styled(designSystem.MenuItem)`
|
|
|
592
610
|
}
|
|
593
611
|
|
|
594
612
|
&:hover {
|
|
595
|
-
background: ${({ theme,
|
|
613
|
+
background: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}100`]};
|
|
596
614
|
}
|
|
597
615
|
`;
|
|
598
|
-
const PencilIcon =
|
|
616
|
+
const PencilIcon = styled__default.default(icons.Pencil)`
|
|
599
617
|
width: ${({ theme }) => theme.spaces[3]};
|
|
600
618
|
height: ${({ theme }) => theme.spaces[3]};
|
|
601
619
|
path {
|
|
602
620
|
fill: ${({ theme }) => theme.colors.neutral600};
|
|
603
621
|
}
|
|
604
622
|
`;
|
|
605
|
-
const TrashIcon =
|
|
623
|
+
const TrashIcon = styled__default.default(icons.Trash)`
|
|
606
624
|
width: ${({ theme }) => theme.spaces[3]};
|
|
607
625
|
height: ${({ theme }) => theme.spaces[3]};
|
|
608
626
|
path {
|
|
609
627
|
fill: ${({ theme }) => theme.colors.danger600};
|
|
610
628
|
}
|
|
611
629
|
`;
|
|
612
|
-
const TypographyMaxWidth =
|
|
630
|
+
const TypographyMaxWidth = styled__default.default(designSystem.Typography)`
|
|
613
631
|
max-width: 300px;
|
|
614
632
|
`;
|
|
615
|
-
const EntryValidationText = ({ action, schema,
|
|
633
|
+
const EntryValidationText = ({ action, schema, components, entry }) => {
|
|
616
634
|
const { formatMessage } = reactIntl.useIntl();
|
|
617
|
-
const { validate
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
635
|
+
const { validate } = strapiAdmin.unstable_useDocument();
|
|
636
|
+
const { errors } = validate(entry, {
|
|
637
|
+
contentType: schema,
|
|
638
|
+
components,
|
|
639
|
+
isCreatingEntry: false
|
|
640
|
+
});
|
|
641
|
+
if (Object.keys(errors).length > 0) {
|
|
642
|
+
const validationErrorsMessages = Object.entries(errors).map(
|
|
643
|
+
([key, value]) => formatMessage(
|
|
644
|
+
{ id: `${value.id}.withField`, defaultMessage: value.defaultMessage },
|
|
645
|
+
{ field: key }
|
|
646
|
+
)
|
|
647
|
+
).join(" ");
|
|
648
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
649
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Icon, { color: "danger600", as: icons.CrossCircle }),
|
|
650
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tooltip, { description: validationErrorsMessages, children: /* @__PURE__ */ jsxRuntime.jsx(TypographyMaxWidth, { textColor: "danger600", variant: "omega", fontWeight: "semiBold", ellipsis: true, children: validationErrorsMessages }) })
|
|
651
|
+
] });
|
|
629
652
|
}
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
)
|
|
640
|
-
|
|
641
|
-
/* @__PURE__ */ jsxRuntime.jsx(icons.CrossCircle, { fill: "danger600" }),
|
|
642
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tooltip, { description: validationErrorsMessages, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
643
|
-
TypographyMaxWidth,
|
|
644
|
-
{
|
|
645
|
-
textColor: "danger600",
|
|
646
|
-
variant: "omega",
|
|
647
|
-
fontWeight: "semiBold",
|
|
648
|
-
ellipsis: true,
|
|
649
|
-
children: validationErrorsMessages
|
|
650
|
-
}
|
|
651
|
-
) })
|
|
652
|
-
] });
|
|
653
|
-
}
|
|
654
|
-
if (status === "draft") {
|
|
655
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
656
|
-
/* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
|
657
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
|
|
658
|
-
id: "content-releases.pages.ReleaseDetails.entry-validation.ready-to-publish",
|
|
659
|
-
defaultMessage: "Ready to publish"
|
|
660
|
-
}) })
|
|
661
|
-
] });
|
|
662
|
-
}
|
|
663
|
-
if (status === "modified") {
|
|
664
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
665
|
-
/* @__PURE__ */ jsxRuntime.jsx(icons.ArrowsCounterClockwise, { fill: "alternative600" }),
|
|
666
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
|
|
667
|
-
id: "content-releases.pages.ReleaseDetails.entry-validation.modified",
|
|
668
|
-
defaultMessage: "Ready to publish changes"
|
|
669
|
-
}) })
|
|
670
|
-
] });
|
|
671
|
-
}
|
|
672
|
-
if (status === "published") {
|
|
673
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
674
|
-
/* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
|
675
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
|
|
676
|
-
id: "content-releases.pages.ReleaseDetails.entry-validation.already-published",
|
|
677
|
-
defaultMessage: "Already published"
|
|
678
|
-
}) })
|
|
679
|
-
] });
|
|
680
|
-
}
|
|
653
|
+
if (action == "publish") {
|
|
654
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
655
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Icon, { color: "success600", as: icons.CheckCircle }),
|
|
656
|
+
entry.publishedAt ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "success600", fontWeight: "bold", children: formatMessage({
|
|
657
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.already-published",
|
|
658
|
+
defaultMessage: "Already published"
|
|
659
|
+
}) }) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
|
|
660
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.ready-to-publish",
|
|
661
|
+
defaultMessage: "Ready to publish"
|
|
662
|
+
}) })
|
|
663
|
+
] });
|
|
681
664
|
}
|
|
682
665
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
683
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
666
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Icon, { color: "success600", as: icons.CheckCircle }),
|
|
684
667
|
!entry.publishedAt ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "success600", fontWeight: "bold", children: formatMessage({
|
|
685
668
|
id: "content-releases.pages.ReleaseDetails.entry-validation.already-unpublished",
|
|
686
669
|
defaultMessage: "Already unpublished"
|
|
@@ -700,23 +683,20 @@ const ReleaseDetailsLayout = ({
|
|
|
700
683
|
const {
|
|
701
684
|
data,
|
|
702
685
|
isLoading: isLoadingDetails,
|
|
686
|
+
isError,
|
|
703
687
|
error
|
|
704
|
-
} = index.useGetReleaseQuery(
|
|
705
|
-
{ id: releaseId },
|
|
706
|
-
{
|
|
707
|
-
skip: !releaseId
|
|
708
|
-
}
|
|
709
|
-
);
|
|
688
|
+
} = index.useGetReleaseQuery({ id: releaseId });
|
|
710
689
|
const [publishRelease, { isLoading: isPublishing }] = index.usePublishReleaseMutation();
|
|
711
|
-
const
|
|
712
|
-
const { formatAPIError } =
|
|
713
|
-
const {
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
const
|
|
690
|
+
const toggleNotification = helperPlugin.useNotification();
|
|
691
|
+
const { formatAPIError } = helperPlugin.useAPIErrorHandler();
|
|
692
|
+
const {
|
|
693
|
+
allowedActions: { canUpdate, canDelete }
|
|
694
|
+
} = helperPlugin.useRBAC(index.PERMISSIONS);
|
|
695
|
+
const dispatch = index.useTypedDispatch();
|
|
696
|
+
const { trackUsage } = helperPlugin.useTracking();
|
|
717
697
|
const release = data?.data;
|
|
718
|
-
const handlePublishRelease =
|
|
719
|
-
const response = await publishRelease({ id });
|
|
698
|
+
const handlePublishRelease = async () => {
|
|
699
|
+
const response = await publishRelease({ id: releaseId });
|
|
720
700
|
if ("data" in response) {
|
|
721
701
|
toggleNotification({
|
|
722
702
|
type: "success",
|
|
@@ -731,14 +711,14 @@ const ReleaseDetailsLayout = ({
|
|
|
731
711
|
totalPublishedEntries,
|
|
732
712
|
totalUnpublishedEntries
|
|
733
713
|
});
|
|
734
|
-
} else if (
|
|
714
|
+
} else if (index.isAxiosError(response.error)) {
|
|
735
715
|
toggleNotification({
|
|
736
|
-
type: "
|
|
716
|
+
type: "warning",
|
|
737
717
|
message: formatAPIError(response.error)
|
|
738
718
|
});
|
|
739
719
|
} else {
|
|
740
720
|
toggleNotification({
|
|
741
|
-
type: "
|
|
721
|
+
type: "warning",
|
|
742
722
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
743
723
|
});
|
|
744
724
|
}
|
|
@@ -764,20 +744,21 @@ const ReleaseDetailsLayout = ({
|
|
|
764
744
|
return release.createdBy.email;
|
|
765
745
|
};
|
|
766
746
|
if (isLoadingDetails) {
|
|
767
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
747
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Main, { "aria-busy": isLoadingDetails, children: /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.LoadingIndicatorPage, {}) });
|
|
768
748
|
}
|
|
769
|
-
if (
|
|
749
|
+
if (isError || !release) {
|
|
770
750
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
771
|
-
reactRouterDom.
|
|
751
|
+
reactRouterDom.Redirect,
|
|
772
752
|
{
|
|
773
|
-
to:
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
753
|
+
to: {
|
|
754
|
+
pathname: "/plugins/content-releases",
|
|
755
|
+
state: {
|
|
756
|
+
errors: [
|
|
757
|
+
{
|
|
758
|
+
code: error?.code
|
|
759
|
+
}
|
|
760
|
+
]
|
|
761
|
+
}
|
|
781
762
|
}
|
|
782
763
|
}
|
|
783
764
|
);
|
|
@@ -814,90 +795,106 @@ const ReleaseDetailsLayout = ({
|
|
|
814
795
|
) : "";
|
|
815
796
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { "aria-busy": isLoadingDetails, children: [
|
|
816
797
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
817
|
-
|
|
798
|
+
designSystem.HeaderLayout,
|
|
818
799
|
{
|
|
819
800
|
title: release.name,
|
|
820
801
|
subtitle: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, lineHeight: 6, children: [
|
|
821
802
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", variant: "epsilon", children: numberOfEntriesText + (isScheduled ? ` - ${scheduledText}` : "") }),
|
|
822
803
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { ...getBadgeProps(release.status), children: release.status })
|
|
823
804
|
] }),
|
|
824
|
-
navigationAction: /* @__PURE__ */ jsxRuntime.jsx(
|
|
805
|
+
navigationAction: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Link, { startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowLeft, {}), to: "/plugins/content-releases", children: formatMessage({
|
|
806
|
+
id: "global.back",
|
|
807
|
+
defaultMessage: "Back"
|
|
808
|
+
}) }),
|
|
825
809
|
primaryAction: !release.releasedAt && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
826
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
onSelect:
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
id: "content-releases.header.actions.delete",
|
|
857
|
-
defaultMessage: "Delete"
|
|
810
|
+
/* @__PURE__ */ jsxRuntime.jsxs(v2.Menu.Root, { children: [
|
|
811
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
812
|
+
v2.Menu.Trigger,
|
|
813
|
+
{
|
|
814
|
+
as: designSystem.IconButton,
|
|
815
|
+
paddingLeft: 2,
|
|
816
|
+
paddingRight: 2,
|
|
817
|
+
"aria-label": formatMessage({
|
|
818
|
+
id: "content-releases.header.actions.open-release-actions",
|
|
819
|
+
defaultMessage: "Release edit and delete menu"
|
|
820
|
+
}),
|
|
821
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.More, {}),
|
|
822
|
+
variant: "tertiary"
|
|
823
|
+
}
|
|
824
|
+
),
|
|
825
|
+
/* @__PURE__ */ jsxRuntime.jsxs(v2.Menu.Content, { top: 1, popoverPlacement: "bottom-end", children: [
|
|
826
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
827
|
+
designSystem.Flex,
|
|
828
|
+
{
|
|
829
|
+
alignItems: "center",
|
|
830
|
+
justifyContent: "center",
|
|
831
|
+
direction: "column",
|
|
832
|
+
padding: 1,
|
|
833
|
+
width: "100%",
|
|
834
|
+
children: [
|
|
835
|
+
/* @__PURE__ */ jsxRuntime.jsx(StyledMenuItem, { disabled: !canUpdate, onSelect: toggleEditReleaseModal, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 2, hasRadius: true, width: "100%", children: [
|
|
836
|
+
/* @__PURE__ */ jsxRuntime.jsx(PencilIcon, {}),
|
|
837
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { ellipsis: true, children: formatMessage({
|
|
838
|
+
id: "content-releases.header.actions.edit",
|
|
839
|
+
defaultMessage: "Edit"
|
|
858
840
|
}) })
|
|
841
|
+
] }) }),
|
|
842
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
843
|
+
StyledMenuItem,
|
|
844
|
+
{
|
|
845
|
+
disabled: !canDelete,
|
|
846
|
+
onSelect: toggleWarningSubmit,
|
|
847
|
+
variant: "danger",
|
|
848
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 2, hasRadius: true, width: "100%", children: [
|
|
849
|
+
/* @__PURE__ */ jsxRuntime.jsx(TrashIcon, {}),
|
|
850
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { ellipsis: true, textColor: "danger600", children: formatMessage({
|
|
851
|
+
id: "content-releases.header.actions.delete",
|
|
852
|
+
defaultMessage: "Delete"
|
|
853
|
+
}) })
|
|
854
|
+
] })
|
|
855
|
+
}
|
|
856
|
+
)
|
|
857
|
+
]
|
|
858
|
+
}
|
|
859
|
+
),
|
|
860
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
861
|
+
ReleaseInfoWrapper,
|
|
862
|
+
{
|
|
863
|
+
direction: "column",
|
|
864
|
+
justifyContent: "center",
|
|
865
|
+
alignItems: "flex-start",
|
|
866
|
+
gap: 1,
|
|
867
|
+
padding: 5,
|
|
868
|
+
children: [
|
|
869
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", children: formatMessage({
|
|
870
|
+
id: "content-releases.header.actions.created",
|
|
871
|
+
defaultMessage: "Created"
|
|
872
|
+
}) }),
|
|
873
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", color: "neutral300", children: [
|
|
874
|
+
/* @__PURE__ */ jsxRuntime.jsx(helperPlugin.RelativeTime, { timestamp: new Date(release.createdAt) }),
|
|
875
|
+
formatMessage(
|
|
876
|
+
{
|
|
877
|
+
id: "content-releases.header.actions.created.description",
|
|
878
|
+
defaultMessage: "{hasCreatedByUser, select, true { by {createdBy}} other { by deleted user}}"
|
|
879
|
+
},
|
|
880
|
+
{ createdBy: getCreatedByUser(), hasCreatedByUser }
|
|
881
|
+
)
|
|
859
882
|
] })
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
direction: "column",
|
|
866
|
-
justifyContent: "center",
|
|
867
|
-
alignItems: "flex-start",
|
|
868
|
-
gap: 1,
|
|
869
|
-
padding: 5,
|
|
870
|
-
children: [
|
|
871
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", children: formatMessage({
|
|
872
|
-
id: "content-releases.header.actions.created",
|
|
873
|
-
defaultMessage: "Created"
|
|
874
|
-
}) }),
|
|
875
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", color: "neutral300", children: [
|
|
876
|
-
/* @__PURE__ */ jsxRuntime.jsx(RelativeTime$1, { timestamp: new Date(release.createdAt) }),
|
|
877
|
-
formatMessage(
|
|
878
|
-
{
|
|
879
|
-
id: "content-releases.header.actions.created.description",
|
|
880
|
-
defaultMessage: "{hasCreatedByUser, select, true { by {createdBy}} other { by deleted user}}"
|
|
881
|
-
},
|
|
882
|
-
{ createdBy: getCreatedByUser(), hasCreatedByUser }
|
|
883
|
-
)
|
|
884
|
-
] })
|
|
885
|
-
]
|
|
886
|
-
}
|
|
887
|
-
)
|
|
888
|
-
]
|
|
889
|
-
}
|
|
890
|
-
),
|
|
883
|
+
]
|
|
884
|
+
}
|
|
885
|
+
)
|
|
886
|
+
] })
|
|
887
|
+
] }),
|
|
891
888
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { size: "S", variant: "tertiary", onClick: handleRefresh, children: formatMessage({
|
|
892
889
|
id: "content-releases.header.actions.refresh",
|
|
893
890
|
defaultMessage: "Refresh"
|
|
894
891
|
}) }),
|
|
895
|
-
|
|
892
|
+
/* @__PURE__ */ jsxRuntime.jsx(helperPlugin.CheckPermissions, { permissions: index.PERMISSIONS.publish, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
896
893
|
designSystem.Button,
|
|
897
894
|
{
|
|
898
895
|
size: "S",
|
|
899
896
|
variant: "default",
|
|
900
|
-
onClick: handlePublishRelease
|
|
897
|
+
onClick: handlePublishRelease,
|
|
901
898
|
loading: isPublishing,
|
|
902
899
|
disabled: release.actions.meta.count === 0,
|
|
903
900
|
children: formatMessage({
|
|
@@ -905,7 +902,7 @@ const ReleaseDetailsLayout = ({
|
|
|
905
902
|
defaultMessage: "Publish"
|
|
906
903
|
})
|
|
907
904
|
}
|
|
908
|
-
)
|
|
905
|
+
) })
|
|
909
906
|
] })
|
|
910
907
|
}
|
|
911
908
|
),
|
|
@@ -932,32 +929,47 @@ const getGroupByOptionLabel = (value) => {
|
|
|
932
929
|
defaultMessage: "Content-Types"
|
|
933
930
|
};
|
|
934
931
|
};
|
|
935
|
-
const
|
|
932
|
+
const DEFAULT_RELEASE_DETAILS_HEADER = [
|
|
933
|
+
{
|
|
934
|
+
key: "__name__",
|
|
935
|
+
fieldSchema: { type: "string" },
|
|
936
|
+
metadatas: {
|
|
937
|
+
label: {
|
|
938
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.name",
|
|
939
|
+
defaultMessage: "name"
|
|
940
|
+
},
|
|
941
|
+
searchable: false,
|
|
942
|
+
sortable: false
|
|
943
|
+
},
|
|
944
|
+
name: "name"
|
|
945
|
+
}
|
|
946
|
+
];
|
|
947
|
+
const ReleaseDetailsBody = () => {
|
|
936
948
|
const { formatMessage } = reactIntl.useIntl();
|
|
937
|
-
const
|
|
938
|
-
const {
|
|
939
|
-
const
|
|
949
|
+
const { releaseId } = reactRouterDom.useParams();
|
|
950
|
+
const [{ query }, setQuery] = helperPlugin.useQueryParams();
|
|
951
|
+
const toggleNotification = helperPlugin.useNotification();
|
|
952
|
+
const { formatAPIError } = helperPlugin.useAPIErrorHandler();
|
|
940
953
|
const {
|
|
941
954
|
data: releaseData,
|
|
942
955
|
isLoading: isReleaseLoading,
|
|
956
|
+
isError: isReleaseError,
|
|
943
957
|
error: releaseError
|
|
944
958
|
} = index.useGetReleaseQuery({ id: releaseId });
|
|
945
959
|
const {
|
|
946
960
|
allowedActions: { canUpdate }
|
|
947
|
-
} =
|
|
948
|
-
const runHookWaterfall =
|
|
949
|
-
const {
|
|
950
|
-
displayedHeaders
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
hasI18nEnabled: false
|
|
960
|
-
});
|
|
961
|
+
} = helperPlugin.useRBAC(index.PERMISSIONS);
|
|
962
|
+
const { runHookWaterfall } = helperPlugin.useStrapiApp();
|
|
963
|
+
const {
|
|
964
|
+
displayedHeaders,
|
|
965
|
+
hasI18nEnabled
|
|
966
|
+
} = runHookWaterfall(
|
|
967
|
+
"ContentReleases/pages/ReleaseDetails/add-locale-in-releases",
|
|
968
|
+
{
|
|
969
|
+
displayedHeaders: DEFAULT_RELEASE_DETAILS_HEADER,
|
|
970
|
+
hasI18nEnabled: false
|
|
971
|
+
}
|
|
972
|
+
);
|
|
961
973
|
const release = releaseData?.data;
|
|
962
974
|
const selectedGroupBy = query?.groupBy || "contentType";
|
|
963
975
|
const {
|
|
@@ -986,59 +998,65 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
986
998
|
// We are passing the action path to found the position in the cache of the action for optimistic updates
|
|
987
999
|
});
|
|
988
1000
|
if ("error" in response) {
|
|
989
|
-
if (
|
|
1001
|
+
if (index.isAxiosError(response.error)) {
|
|
990
1002
|
toggleNotification({
|
|
991
|
-
type: "
|
|
1003
|
+
type: "warning",
|
|
992
1004
|
message: formatAPIError(response.error)
|
|
993
1005
|
});
|
|
994
1006
|
} else {
|
|
995
1007
|
toggleNotification({
|
|
996
|
-
type: "
|
|
1008
|
+
type: "warning",
|
|
997
1009
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
998
1010
|
});
|
|
999
1011
|
}
|
|
1000
1012
|
}
|
|
1001
1013
|
};
|
|
1002
1014
|
if (isLoading || isReleaseLoading) {
|
|
1003
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1015
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.ContentLayout, { children: /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.LoadingIndicatorPage, {}) });
|
|
1004
1016
|
}
|
|
1005
1017
|
const releaseActions = data?.data;
|
|
1006
1018
|
const releaseMeta = data?.meta;
|
|
1007
1019
|
const contentTypes = releaseMeta?.contentTypes || {};
|
|
1008
1020
|
const components = releaseMeta?.components || {};
|
|
1009
|
-
if (
|
|
1021
|
+
if (isReleaseError || !release) {
|
|
1010
1022
|
const errorsArray = [];
|
|
1011
|
-
if (releaseError
|
|
1023
|
+
if (releaseError) {
|
|
1012
1024
|
errorsArray.push({
|
|
1013
1025
|
code: releaseError.code
|
|
1014
1026
|
});
|
|
1015
1027
|
}
|
|
1016
|
-
if (releaseActionsError
|
|
1028
|
+
if (releaseActionsError) {
|
|
1017
1029
|
errorsArray.push({
|
|
1018
1030
|
code: releaseActionsError.code
|
|
1019
1031
|
});
|
|
1020
1032
|
}
|
|
1021
1033
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1022
|
-
reactRouterDom.
|
|
1034
|
+
reactRouterDom.Redirect,
|
|
1023
1035
|
{
|
|
1024
|
-
to:
|
|
1025
|
-
|
|
1026
|
-
|
|
1036
|
+
to: {
|
|
1037
|
+
pathname: "/plugins/content-releases",
|
|
1038
|
+
state: {
|
|
1039
|
+
errors: errorsArray
|
|
1040
|
+
}
|
|
1027
1041
|
}
|
|
1028
1042
|
}
|
|
1029
1043
|
);
|
|
1030
1044
|
}
|
|
1031
1045
|
if (isError || !releaseActions) {
|
|
1032
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1046
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.ContentLayout, { children: /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.AnErrorOccurred, {}) });
|
|
1033
1047
|
}
|
|
1034
1048
|
if (Object.keys(releaseActions).length === 0) {
|
|
1035
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1036
|
-
|
|
1049
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.ContentLayout, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1050
|
+
helperPlugin.NoContent,
|
|
1037
1051
|
{
|
|
1052
|
+
content: {
|
|
1053
|
+
id: "content-releases.pages.Details.tab.emptyEntries",
|
|
1054
|
+
defaultMessage: "This release is empty. Open the Content Manager, select an entry and add it to the release."
|
|
1055
|
+
},
|
|
1038
1056
|
action: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1039
|
-
|
|
1057
|
+
v2.LinkButton,
|
|
1040
1058
|
{
|
|
1041
|
-
|
|
1059
|
+
as: reactRouterDom.Link,
|
|
1042
1060
|
to: {
|
|
1043
1061
|
pathname: "/content-manager"
|
|
1044
1062
|
},
|
|
@@ -1049,52 +1067,19 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1049
1067
|
defaultMessage: "Open the Content Manager"
|
|
1050
1068
|
})
|
|
1051
1069
|
}
|
|
1052
|
-
)
|
|
1053
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(symbols.EmptyDocuments, { width: "16rem" }),
|
|
1054
|
-
content: formatMessage({
|
|
1055
|
-
id: "content-releases.pages.Details.tab.emptyEntries",
|
|
1056
|
-
defaultMessage: "This release is empty. Open the Content Manager, select an entry and add it to the release."
|
|
1057
|
-
})
|
|
1070
|
+
)
|
|
1058
1071
|
}
|
|
1059
1072
|
) });
|
|
1060
1073
|
}
|
|
1061
|
-
const groupByLabel = formatMessage({
|
|
1062
|
-
id: "content-releases.pages.ReleaseDetails.groupBy.aria-label",
|
|
1063
|
-
defaultMessage: "Group by"
|
|
1064
|
-
});
|
|
1065
|
-
const headers = [
|
|
1066
|
-
...displayedHeaders,
|
|
1067
|
-
{
|
|
1068
|
-
label: {
|
|
1069
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.content-type",
|
|
1070
|
-
defaultMessage: "content-type"
|
|
1071
|
-
},
|
|
1072
|
-
name: "content-type"
|
|
1073
|
-
},
|
|
1074
|
-
{
|
|
1075
|
-
label: {
|
|
1076
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.action",
|
|
1077
|
-
defaultMessage: "action"
|
|
1078
|
-
},
|
|
1079
|
-
name: "action"
|
|
1080
|
-
},
|
|
1081
|
-
...!release.releasedAt ? [
|
|
1082
|
-
{
|
|
1083
|
-
label: {
|
|
1084
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.status",
|
|
1085
|
-
defaultMessage: "status"
|
|
1086
|
-
},
|
|
1087
|
-
name: "status"
|
|
1088
|
-
}
|
|
1089
|
-
] : []
|
|
1090
|
-
];
|
|
1091
1074
|
const options = hasI18nEnabled ? GROUP_BY_OPTIONS : GROUP_BY_OPTIONS_NO_LOCALE;
|
|
1092
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1075
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.ContentLayout, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 8, direction: "column", alignItems: "stretch", children: [
|
|
1093
1076
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1094
1077
|
designSystem.SingleSelect,
|
|
1095
1078
|
{
|
|
1096
|
-
|
|
1097
|
-
|
|
1079
|
+
"aria-label": formatMessage({
|
|
1080
|
+
id: "content-releases.pages.ReleaseDetails.groupBy.aria-label",
|
|
1081
|
+
defaultMessage: "Group by"
|
|
1082
|
+
}),
|
|
1098
1083
|
customizeContent: (value) => formatMessage(
|
|
1099
1084
|
{
|
|
1100
1085
|
id: `content-releases.pages.ReleaseDetails.groupBy.label`,
|
|
@@ -1112,19 +1097,63 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1112
1097
|
Object.keys(releaseActions).map((key) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, direction: "column", alignItems: "stretch", children: [
|
|
1113
1098
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { role: "separator", "aria-label": key, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { children: key }) }),
|
|
1114
1099
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1115
|
-
|
|
1100
|
+
helperPlugin.Table.Root,
|
|
1116
1101
|
{
|
|
1117
1102
|
rows: releaseActions[key].map((item) => ({
|
|
1118
1103
|
...item,
|
|
1119
1104
|
id: Number(item.entry.id)
|
|
1120
1105
|
})),
|
|
1121
|
-
|
|
1122
|
-
isLoading
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1126
|
-
|
|
1127
|
-
|
|
1106
|
+
colCount: releaseActions[key].length,
|
|
1107
|
+
isLoading,
|
|
1108
|
+
isFetching,
|
|
1109
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(helperPlugin.Table.Content, { children: [
|
|
1110
|
+
/* @__PURE__ */ jsxRuntime.jsxs(helperPlugin.Table.Head, { children: [
|
|
1111
|
+
displayedHeaders.map(({ key: key2, fieldSchema, metadatas, name }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1112
|
+
helperPlugin.Table.HeaderCell,
|
|
1113
|
+
{
|
|
1114
|
+
fieldSchemaType: fieldSchema.type,
|
|
1115
|
+
label: formatMessage(metadatas.label),
|
|
1116
|
+
name
|
|
1117
|
+
},
|
|
1118
|
+
key2
|
|
1119
|
+
)),
|
|
1120
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1121
|
+
helperPlugin.Table.HeaderCell,
|
|
1122
|
+
{
|
|
1123
|
+
fieldSchemaType: "string",
|
|
1124
|
+
label: formatMessage({
|
|
1125
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.content-type",
|
|
1126
|
+
defaultMessage: "content-type"
|
|
1127
|
+
}),
|
|
1128
|
+
name: "content-type"
|
|
1129
|
+
}
|
|
1130
|
+
),
|
|
1131
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1132
|
+
helperPlugin.Table.HeaderCell,
|
|
1133
|
+
{
|
|
1134
|
+
fieldSchemaType: "string",
|
|
1135
|
+
label: formatMessage({
|
|
1136
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.action",
|
|
1137
|
+
defaultMessage: "action"
|
|
1138
|
+
}),
|
|
1139
|
+
name: "action"
|
|
1140
|
+
}
|
|
1141
|
+
),
|
|
1142
|
+
!release.releasedAt && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1143
|
+
helperPlugin.Table.HeaderCell,
|
|
1144
|
+
{
|
|
1145
|
+
fieldSchemaType: "string",
|
|
1146
|
+
label: formatMessage({
|
|
1147
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.status",
|
|
1148
|
+
defaultMessage: "status"
|
|
1149
|
+
}),
|
|
1150
|
+
name: "status"
|
|
1151
|
+
}
|
|
1152
|
+
)
|
|
1153
|
+
] }),
|
|
1154
|
+
/* @__PURE__ */ jsxRuntime.jsx(helperPlugin.Table.LoadingBody, {}),
|
|
1155
|
+
/* @__PURE__ */ jsxRuntime.jsx(helperPlugin.Table.Body, { children: releaseActions[key].map(
|
|
1156
|
+
({ id, contentType, locale, type, entry }, actionIndex) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
1128
1157
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "25%", maxWidth: "200px", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { ellipsis: true, children: `${contentType.mainFieldValue || entry.id}` }) }),
|
|
1129
1158
|
hasI18nEnabled && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "10%", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: `${locale?.name ? locale.name : "-"}` }) }),
|
|
1130
1159
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "10%", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: contentType.displayName || "" }) }),
|
|
@@ -1153,8 +1182,7 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1153
1182
|
action: type,
|
|
1154
1183
|
schema: contentTypes?.[contentType.uid],
|
|
1155
1184
|
components,
|
|
1156
|
-
entry
|
|
1157
|
-
status
|
|
1185
|
+
entry
|
|
1158
1186
|
}
|
|
1159
1187
|
) }),
|
|
1160
1188
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsxs(index.ReleaseActionMenu.Root, { children: [
|
|
@@ -1162,7 +1190,7 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1162
1190
|
index.ReleaseActionMenu.ReleaseActionEntryLinkItem,
|
|
1163
1191
|
{
|
|
1164
1192
|
contentTypeUid: contentType.uid,
|
|
1165
|
-
|
|
1193
|
+
entryId: entry.id,
|
|
1166
1194
|
locale: locale?.code
|
|
1167
1195
|
}
|
|
1168
1196
|
),
|
|
@@ -1181,39 +1209,34 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1181
1209
|
}
|
|
1182
1210
|
)
|
|
1183
1211
|
] }, `releases-group-${key}`)),
|
|
1184
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
)
|
|
1212
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { paddingTop: 4, alignItems: "flex-end", justifyContent: "space-between", children: [
|
|
1213
|
+
/* @__PURE__ */ jsxRuntime.jsx(helperPlugin.PageSizeURLQuery, { defaultValue: releaseMeta?.pagination?.pageSize.toString() }),
|
|
1214
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1215
|
+
helperPlugin.PaginationURLQuery,
|
|
1216
|
+
{
|
|
1217
|
+
pagination: {
|
|
1218
|
+
pageCount: releaseMeta?.pagination?.pageCount || 0
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
)
|
|
1222
|
+
] })
|
|
1195
1223
|
] }) });
|
|
1196
1224
|
};
|
|
1197
1225
|
const ReleaseDetailsPage = () => {
|
|
1198
1226
|
const { formatMessage } = reactIntl.useIntl();
|
|
1199
1227
|
const { releaseId } = reactRouterDom.useParams();
|
|
1200
|
-
const
|
|
1201
|
-
const { formatAPIError } =
|
|
1202
|
-
const
|
|
1228
|
+
const toggleNotification = helperPlugin.useNotification();
|
|
1229
|
+
const { formatAPIError } = helperPlugin.useAPIErrorHandler();
|
|
1230
|
+
const { replace } = reactRouterDom.useHistory();
|
|
1203
1231
|
const [releaseModalShown, setReleaseModalShown] = React__namespace.useState(false);
|
|
1204
1232
|
const [showWarningSubmit, setWarningSubmit] = React__namespace.useState(false);
|
|
1205
1233
|
const {
|
|
1206
1234
|
isLoading: isLoadingDetails,
|
|
1207
1235
|
data,
|
|
1208
1236
|
isSuccess: isSuccessDetails
|
|
1209
|
-
} = index.useGetReleaseQuery(
|
|
1210
|
-
{ id: releaseId },
|
|
1211
|
-
{
|
|
1212
|
-
skip: !releaseId
|
|
1213
|
-
}
|
|
1214
|
-
);
|
|
1237
|
+
} = index.useGetReleaseQuery({ id: releaseId });
|
|
1215
1238
|
const [updateRelease, { isLoading: isSubmittingForm }] = index.useUpdateReleaseMutation();
|
|
1216
|
-
const [deleteRelease] = index.useDeleteReleaseMutation();
|
|
1239
|
+
const [deleteRelease, { isLoading: isDeletingRelease }] = index.useDeleteReleaseMutation();
|
|
1217
1240
|
const toggleEditReleaseModal = () => {
|
|
1218
1241
|
setReleaseModalShown((prev) => !prev);
|
|
1219
1242
|
};
|
|
@@ -1224,18 +1247,15 @@ const ReleaseDetailsPage = () => {
|
|
|
1224
1247
|
{
|
|
1225
1248
|
toggleEditReleaseModal,
|
|
1226
1249
|
toggleWarningSubmit,
|
|
1227
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1250
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.ContentLayout, { children: /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.LoadingIndicatorPage, {}) })
|
|
1228
1251
|
}
|
|
1229
1252
|
);
|
|
1230
1253
|
}
|
|
1231
|
-
if (!releaseId) {
|
|
1232
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: ".." });
|
|
1233
|
-
}
|
|
1234
1254
|
const releaseData = isSuccessDetails && data?.data || null;
|
|
1235
1255
|
const title = releaseData?.name || "";
|
|
1236
1256
|
const timezone = releaseData?.timezone ?? null;
|
|
1237
1257
|
const scheduledAt = releaseData?.scheduledAt && timezone ? dateFnsTz.utcToZonedTime(releaseData.scheduledAt, timezone) : null;
|
|
1238
|
-
const date = scheduledAt ? format__default.default(scheduledAt, "yyyy-MM-dd") :
|
|
1258
|
+
const date = scheduledAt ? format__default.default(scheduledAt, "yyyy-MM-dd") : null;
|
|
1239
1259
|
const time = scheduledAt ? format__default.default(scheduledAt, "HH:mm") : "";
|
|
1240
1260
|
const handleEditRelease = async (values) => {
|
|
1241
1261
|
const response = await updateRelease({
|
|
@@ -1253,14 +1273,14 @@ const ReleaseDetailsPage = () => {
|
|
|
1253
1273
|
})
|
|
1254
1274
|
});
|
|
1255
1275
|
toggleEditReleaseModal();
|
|
1256
|
-
} else if (
|
|
1276
|
+
} else if (index.isAxiosError(response.error)) {
|
|
1257
1277
|
toggleNotification({
|
|
1258
|
-
type: "
|
|
1278
|
+
type: "warning",
|
|
1259
1279
|
message: formatAPIError(response.error)
|
|
1260
1280
|
});
|
|
1261
1281
|
} else {
|
|
1262
1282
|
toggleNotification({
|
|
1263
|
-
type: "
|
|
1283
|
+
type: "warning",
|
|
1264
1284
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
1265
1285
|
});
|
|
1266
1286
|
}
|
|
@@ -1270,15 +1290,15 @@ const ReleaseDetailsPage = () => {
|
|
|
1270
1290
|
id: releaseId
|
|
1271
1291
|
});
|
|
1272
1292
|
if ("data" in response) {
|
|
1273
|
-
|
|
1274
|
-
} else if (
|
|
1293
|
+
replace("/plugins/content-releases");
|
|
1294
|
+
} else if (index.isAxiosError(response.error)) {
|
|
1275
1295
|
toggleNotification({
|
|
1276
|
-
type: "
|
|
1296
|
+
type: "warning",
|
|
1277
1297
|
message: formatAPIError(response.error)
|
|
1278
1298
|
});
|
|
1279
1299
|
} else {
|
|
1280
1300
|
toggleNotification({
|
|
1281
|
-
type: "
|
|
1301
|
+
type: "warning",
|
|
1282
1302
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
1283
1303
|
});
|
|
1284
1304
|
}
|
|
@@ -1289,11 +1309,10 @@ const ReleaseDetailsPage = () => {
|
|
|
1289
1309
|
toggleEditReleaseModal,
|
|
1290
1310
|
toggleWarningSubmit,
|
|
1291
1311
|
children: [
|
|
1292
|
-
/* @__PURE__ */ jsxRuntime.jsx(ReleaseDetailsBody, {
|
|
1293
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1312
|
+
/* @__PURE__ */ jsxRuntime.jsx(ReleaseDetailsBody, {}),
|
|
1313
|
+
releaseModalShown && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1294
1314
|
ReleaseModal,
|
|
1295
1315
|
{
|
|
1296
|
-
open: releaseModalShown,
|
|
1297
1316
|
handleClose: toggleEditReleaseModal,
|
|
1298
1317
|
handleSubmit: handleEditRelease,
|
|
1299
1318
|
isLoading: isLoadingDetails || isSubmittingForm,
|
|
@@ -1307,19 +1326,28 @@ const ReleaseDetailsPage = () => {
|
|
|
1307
1326
|
}
|
|
1308
1327
|
}
|
|
1309
1328
|
),
|
|
1310
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1329
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1330
|
+
helperPlugin.ConfirmDialog,
|
|
1331
|
+
{
|
|
1332
|
+
bodyText: {
|
|
1333
|
+
id: "content-releases.dialog.confirmation-message",
|
|
1334
|
+
defaultMessage: "Are you sure you want to delete this release?"
|
|
1335
|
+
},
|
|
1336
|
+
isOpen: showWarningSubmit,
|
|
1337
|
+
isConfirmButtonLoading: isDeletingRelease,
|
|
1338
|
+
onToggleDialog: toggleWarningSubmit,
|
|
1339
|
+
onConfirm: handleDeleteRelease
|
|
1340
|
+
}
|
|
1341
|
+
)
|
|
1314
1342
|
]
|
|
1315
1343
|
}
|
|
1316
1344
|
);
|
|
1317
1345
|
};
|
|
1318
1346
|
const App = () => {
|
|
1319
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1320
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, {
|
|
1321
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, {
|
|
1347
|
+
return /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.CheckPagePermissions, { permissions: index.PERMISSIONS.main, children: /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.Switch, { children: [
|
|
1348
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { exact: true, path: `/plugins/${index.pluginId}`, component: ReleasesPage }),
|
|
1349
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { exact: true, path: `/plugins/${index.pluginId}/:releaseId`, component: ReleaseDetailsPage })
|
|
1322
1350
|
] }) });
|
|
1323
1351
|
};
|
|
1324
1352
|
exports.App = App;
|
|
1325
|
-
//# sourceMappingURL=App-
|
|
1353
|
+
//# sourceMappingURL=App-dLXY5ei3.js.map
|