@strapi/content-releases 0.0.0-experimental.d8a676a242377cee820b59b21a05d47290d9ac73 → 0.0.0-experimental.defd8568ae03ef8d52f86e1f3541979f953c3941
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-p8aKBitd.js → App-C0DlH0im.js} +343 -323
- package/dist/_chunks/App-C0DlH0im.js.map +1 -0
- package/dist/_chunks/{App-bpzO2Ljh.mjs → App-O0ZO-S35.mjs} +328 -308
- package/dist/_chunks/App-O0ZO-S35.mjs.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-YhAPgpG9.js → PurchaseContentReleases-DAHdUpAA.js} +5 -5
- package/dist/_chunks/PurchaseContentReleases-DAHdUpAA.js.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-Clm0iACO.mjs → PurchaseContentReleases-Ex09YpKR.mjs} +6 -6
- package/dist/_chunks/PurchaseContentReleases-Ex09YpKR.mjs.map +1 -0
- package/dist/_chunks/{en-WuuhP6Bn.mjs → en-B9Ur3VsE.mjs} +11 -3
- package/dist/_chunks/en-B9Ur3VsE.mjs.map +1 -0
- package/dist/_chunks/{en-gcJJ5htG.js → en-DtFJ5ViE.js} +11 -3
- package/dist/_chunks/en-DtFJ5ViE.js.map +1 -0
- package/dist/_chunks/{index-AECgcaDa.mjs → index-DjDPK8kb.mjs} +337 -109
- package/dist/_chunks/index-DjDPK8kb.mjs.map +1 -0
- package/dist/_chunks/{index-fP3qoWZ4.js → index-DoZNNtsb.js} +340 -112
- package/dist/_chunks/index-DoZNNtsb.js.map +1 -0
- package/dist/admin/index.js +1 -15
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +2 -16
- package/dist/admin/index.mjs.map +1 -1
- package/dist/admin/src/components/CMReleasesContainer.d.ts +22 -0
- package/dist/admin/src/components/RelativeTime.d.ts +28 -0
- package/dist/admin/src/components/ReleaseAction.d.ts +3 -0
- package/dist/admin/src/components/ReleaseActionMenu.d.ts +26 -0
- package/dist/admin/src/components/ReleaseActionOptions.d.ts +9 -0
- package/dist/admin/src/components/ReleaseListCell.d.ts +0 -0
- package/dist/admin/src/components/ReleaseModal.d.ts +16 -0
- package/dist/admin/src/constants.d.ts +58 -0
- package/dist/admin/src/index.d.ts +3 -0
- package/dist/admin/src/pages/App.d.ts +1 -0
- package/dist/admin/src/pages/PurchaseContentReleases.d.ts +2 -0
- package/dist/admin/src/pages/ReleaseDetailsPage.d.ts +2 -0
- package/dist/admin/src/pages/ReleasesPage.d.ts +8 -0
- package/dist/admin/src/pages/tests/mockReleaseDetailsPageData.d.ts +181 -0
- package/dist/admin/src/pages/tests/mockReleasesPageData.d.ts +39 -0
- package/dist/admin/src/pluginId.d.ts +1 -0
- package/dist/admin/src/services/axios.d.ts +29 -0
- package/dist/admin/src/services/release.d.ts +429 -0
- package/dist/admin/src/store/hooks.d.ts +7 -0
- package/dist/admin/src/utils/prefixPluginTranslations.d.ts +3 -0
- package/dist/admin/src/utils/time.d.ts +1 -0
- package/dist/server/index.js +358 -237
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +359 -237
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/bootstrap.d.ts +5 -0
- package/dist/server/src/bootstrap.d.ts.map +1 -0
- package/dist/server/src/constants.d.ts +12 -0
- package/dist/server/src/constants.d.ts.map +1 -0
- package/dist/server/src/content-types/index.d.ts +99 -0
- package/dist/server/src/content-types/index.d.ts.map +1 -0
- package/dist/server/src/content-types/release/index.d.ts +48 -0
- package/dist/server/src/content-types/release/index.d.ts.map +1 -0
- package/dist/server/src/content-types/release/schema.d.ts +47 -0
- package/dist/server/src/content-types/release/schema.d.ts.map +1 -0
- package/dist/server/src/content-types/release-action/index.d.ts +50 -0
- package/dist/server/src/content-types/release-action/index.d.ts.map +1 -0
- package/dist/server/src/content-types/release-action/schema.d.ts +49 -0
- package/dist/server/src/content-types/release-action/schema.d.ts.map +1 -0
- package/dist/server/src/controllers/index.d.ts +20 -0
- package/dist/server/src/controllers/index.d.ts.map +1 -0
- package/dist/server/src/controllers/release-action.d.ts +10 -0
- package/dist/server/src/controllers/release-action.d.ts.map +1 -0
- package/dist/server/src/controllers/release.d.ts +12 -0
- package/dist/server/src/controllers/release.d.ts.map +1 -0
- package/dist/server/src/controllers/validation/release-action.d.ts +8 -0
- package/dist/server/src/controllers/validation/release-action.d.ts.map +1 -0
- package/dist/server/src/controllers/validation/release.d.ts +2 -0
- package/dist/server/src/controllers/validation/release.d.ts.map +1 -0
- package/dist/server/src/destroy.d.ts +5 -0
- package/dist/server/src/destroy.d.ts.map +1 -0
- package/dist/server/src/index.d.ts +2096 -0
- package/dist/server/src/index.d.ts.map +1 -0
- package/dist/server/src/migrations/index.d.ts +13 -0
- package/dist/server/src/migrations/index.d.ts.map +1 -0
- package/dist/server/src/register.d.ts +5 -0
- package/dist/server/src/register.d.ts.map +1 -0
- package/dist/server/src/routes/index.d.ts +35 -0
- package/dist/server/src/routes/index.d.ts.map +1 -0
- package/dist/server/src/routes/release-action.d.ts +18 -0
- package/dist/server/src/routes/release-action.d.ts.map +1 -0
- package/dist/server/src/routes/release.d.ts +18 -0
- package/dist/server/src/routes/release.d.ts.map +1 -0
- package/dist/server/src/services/index.d.ts +1826 -0
- package/dist/server/src/services/index.d.ts.map +1 -0
- package/dist/server/src/services/release.d.ts +66 -0
- package/dist/server/src/services/release.d.ts.map +1 -0
- package/dist/server/src/services/scheduling.d.ts +18 -0
- package/dist/server/src/services/scheduling.d.ts.map +1 -0
- package/dist/server/src/services/validation.d.ts +18 -0
- package/dist/server/src/services/validation.d.ts.map +1 -0
- package/dist/server/src/utils/index.d.ts +14 -0
- package/dist/server/src/utils/index.d.ts.map +1 -0
- package/dist/shared/contracts/release-actions.d.ts +131 -0
- package/dist/shared/contracts/release-actions.d.ts.map +1 -0
- package/dist/shared/contracts/releases.d.ts +182 -0
- package/dist/shared/contracts/releases.d.ts.map +1 -0
- package/dist/shared/types.d.ts +24 -0
- package/dist/shared/types.d.ts.map +1 -0
- package/dist/shared/validation-schemas.d.ts +2 -0
- package/dist/shared/validation-schemas.d.ts.map +1 -0
- package/package.json +26 -31
- package/dist/_chunks/App-bpzO2Ljh.mjs.map +0 -1
- package/dist/_chunks/App-p8aKBitd.js.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-Clm0iACO.mjs.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-YhAPgpG9.js.map +0 -1
- package/dist/_chunks/en-WuuhP6Bn.mjs.map +0 -1
- package/dist/_chunks/en-gcJJ5htG.js.map +0 -1
- package/dist/_chunks/index-AECgcaDa.mjs.map +0 -1
- package/dist/_chunks/index-fP3qoWZ4.js.map +0 -1
|
@@ -1,14 +1,14 @@
|
|
|
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 strapiAdmin = require("@strapi/admin/strapi-admin");
|
|
5
5
|
const reactRouterDom = require("react-router-dom");
|
|
6
|
-
const index = require("./index-
|
|
6
|
+
const index = require("./index-DoZNNtsb.js");
|
|
7
7
|
const React = require("react");
|
|
8
|
-
const strapiAdmin = require("@strapi/admin/strapi-admin");
|
|
9
8
|
const designSystem = require("@strapi/design-system");
|
|
10
|
-
const v2 = require("@strapi/design-system/v2");
|
|
11
9
|
const icons = require("@strapi/icons");
|
|
10
|
+
const symbols = require("@strapi/icons/symbols");
|
|
11
|
+
const strapiAdmin$1 = require("@strapi/plugin-content-manager/strapi-admin");
|
|
12
12
|
const format = require("date-fns/format");
|
|
13
13
|
const dateFnsTz = require("date-fns-tz");
|
|
14
14
|
const reactIntl = require("react-intl");
|
|
@@ -16,10 +16,8 @@ const styled = require("styled-components");
|
|
|
16
16
|
const dateFns = require("date-fns");
|
|
17
17
|
const formik = require("formik");
|
|
18
18
|
const yup = require("yup");
|
|
19
|
-
require("
|
|
20
|
-
require("
|
|
21
|
-
require("@reduxjs/toolkit/query/react");
|
|
22
|
-
require("react-redux");
|
|
19
|
+
const reactRedux = require("react-redux");
|
|
20
|
+
const ee = require("@strapi/admin/strapi-admin/ee");
|
|
23
21
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
24
22
|
function _interopNamespace(e) {
|
|
25
23
|
if (e && e.__esModule)
|
|
@@ -43,6 +41,36 @@ const React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
|
|
43
41
|
const format__default = /* @__PURE__ */ _interopDefault(format);
|
|
44
42
|
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
45
43
|
const yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
|
|
44
|
+
const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
|
|
45
|
+
const RelativeTime$1 = React__namespace.forwardRef(
|
|
46
|
+
({ timestamp, customIntervals = [], ...restProps }, forwardedRef) => {
|
|
47
|
+
const { formatRelativeTime, formatDate, formatTime } = reactIntl.useIntl();
|
|
48
|
+
const interval = dateFns.intervalToDuration({
|
|
49
|
+
start: timestamp,
|
|
50
|
+
end: Date.now()
|
|
51
|
+
// see https://github.com/date-fns/date-fns/issues/2891 – No idea why it's all partial it returns it every time.
|
|
52
|
+
});
|
|
53
|
+
const unit = intervals.find((intervalUnit) => {
|
|
54
|
+
return interval[intervalUnit] > 0 && Object.keys(interval).includes(intervalUnit);
|
|
55
|
+
});
|
|
56
|
+
const relativeTime = dateFns.isPast(timestamp) ? -interval[unit] : interval[unit];
|
|
57
|
+
const customInterval = customIntervals.find(
|
|
58
|
+
(custom) => interval[custom.unit] < custom.threshold
|
|
59
|
+
);
|
|
60
|
+
const displayText = customInterval ? customInterval.text : formatRelativeTime(relativeTime, unit, { numeric: "auto" });
|
|
61
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
62
|
+
"time",
|
|
63
|
+
{
|
|
64
|
+
ref: forwardedRef,
|
|
65
|
+
dateTime: timestamp.toISOString(),
|
|
66
|
+
role: "time",
|
|
67
|
+
title: `${formatDate(timestamp)} ${formatTime(timestamp)}`,
|
|
68
|
+
...restProps,
|
|
69
|
+
children: displayText
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
);
|
|
46
74
|
const RELEASE_SCHEMA = yup__namespace.object().shape({
|
|
47
75
|
name: yup__namespace.string().trim().required(),
|
|
48
76
|
scheduledAt: yup__namespace.string().nullable(),
|
|
@@ -72,7 +100,6 @@ const ReleaseModal = ({
|
|
|
72
100
|
const { formatMessage } = reactIntl.useIntl();
|
|
73
101
|
const { pathname } = reactRouterDom.useLocation();
|
|
74
102
|
const isCreatingRelease = pathname === `/plugins/${index.pluginId}`;
|
|
75
|
-
const IsSchedulingEnabled = window.strapi.future.isEnabled("contentReleasesScheduling");
|
|
76
103
|
const { timezoneList, systemTimezone = { value: "UTC+00:00-Africa/Abidjan " } } = getTimezones(
|
|
77
104
|
initialValues.scheduledAt ? new Date(initialValues.scheduledAt) : /* @__PURE__ */ new Date()
|
|
78
105
|
);
|
|
@@ -80,9 +107,8 @@ const ReleaseModal = ({
|
|
|
80
107
|
const { date, time, timezone } = values;
|
|
81
108
|
if (!date || !time || !timezone)
|
|
82
109
|
return null;
|
|
83
|
-
const formattedDate = dateFns.parse(time, "HH:mm", new Date(date));
|
|
84
110
|
const timezoneWithoutOffset = timezone.split("&")[1];
|
|
85
|
-
return dateFnsTz.zonedTimeToUtc(
|
|
111
|
+
return dateFnsTz.zonedTimeToUtc(`${date} ${time}`, timezoneWithoutOffset);
|
|
86
112
|
};
|
|
87
113
|
const getTimezoneWithOffset = () => {
|
|
88
114
|
const currentTimezone = timezoneList.find(
|
|
@@ -130,93 +156,88 @@ const ReleaseModal = ({
|
|
|
130
156
|
required: true
|
|
131
157
|
}
|
|
132
158
|
),
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
159
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "max-content", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
160
|
+
designSystem.Checkbox,
|
|
161
|
+
{
|
|
162
|
+
name: "isScheduled",
|
|
163
|
+
value: values.isScheduled,
|
|
164
|
+
onChange: (event) => {
|
|
165
|
+
setFieldValue("isScheduled", event.target.checked);
|
|
166
|
+
if (!event.target.checked) {
|
|
167
|
+
setFieldValue("date", null);
|
|
168
|
+
setFieldValue("time", "");
|
|
169
|
+
setFieldValue("timezone", null);
|
|
170
|
+
} else {
|
|
171
|
+
setFieldValue("date", initialValues.date);
|
|
172
|
+
setFieldValue("time", initialValues.time);
|
|
173
|
+
setFieldValue("timezone", initialValues.timezone ?? systemTimezone?.value);
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
177
|
+
designSystem.Typography,
|
|
178
|
+
{
|
|
179
|
+
textColor: values.isScheduled ? "primary600" : "neutral800",
|
|
180
|
+
fontWeight: values.isScheduled ? "semiBold" : "regular",
|
|
181
|
+
children: formatMessage({
|
|
182
|
+
id: "modal.form.input.label.schedule-release",
|
|
183
|
+
defaultMessage: "Schedule release"
|
|
184
|
+
})
|
|
185
|
+
}
|
|
186
|
+
)
|
|
187
|
+
}
|
|
188
|
+
) }),
|
|
189
|
+
values.isScheduled && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
190
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, alignItems: "start", children: [
|
|
191
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
192
|
+
designSystem.DatePicker,
|
|
193
|
+
{
|
|
194
|
+
label: formatMessage({
|
|
195
|
+
id: "content-releases.modal.form.input.label.date",
|
|
196
|
+
defaultMessage: "Date"
|
|
197
|
+
}),
|
|
198
|
+
name: "date",
|
|
199
|
+
error: errors.date,
|
|
200
|
+
onChange: (date) => {
|
|
201
|
+
const isoFormatDate = date ? dateFns.formatISO(date, { representation: "date" }) : null;
|
|
202
|
+
setFieldValue("date", isoFormatDate);
|
|
203
|
+
},
|
|
204
|
+
clearLabel: formatMessage({
|
|
205
|
+
id: "content-releases.modal.form.input.clearLabel",
|
|
206
|
+
defaultMessage: "Clear"
|
|
207
|
+
}),
|
|
208
|
+
onClear: () => {
|
|
142
209
|
setFieldValue("date", null);
|
|
210
|
+
},
|
|
211
|
+
selectedDate: values.date || void 0,
|
|
212
|
+
required: true,
|
|
213
|
+
minDate: dateFnsTz.utcToZonedTime(/* @__PURE__ */ new Date(), values.timezone.split("&")[1])
|
|
214
|
+
}
|
|
215
|
+
) }),
|
|
216
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
217
|
+
designSystem.TimePicker,
|
|
218
|
+
{
|
|
219
|
+
label: formatMessage({
|
|
220
|
+
id: "content-releases.modal.form.input.label.time",
|
|
221
|
+
defaultMessage: "Time"
|
|
222
|
+
}),
|
|
223
|
+
name: "time",
|
|
224
|
+
error: errors.time,
|
|
225
|
+
onChange: (time) => {
|
|
226
|
+
setFieldValue("time", time);
|
|
227
|
+
},
|
|
228
|
+
clearLabel: formatMessage({
|
|
229
|
+
id: "content-releases.modal.form.input.clearLabel",
|
|
230
|
+
defaultMessage: "Clear"
|
|
231
|
+
}),
|
|
232
|
+
onClear: () => {
|
|
143
233
|
setFieldValue("time", "");
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
);
|
|
152
|
-
}
|
|
153
|
-
},
|
|
154
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
155
|
-
designSystem.Typography,
|
|
156
|
-
{
|
|
157
|
-
textColor: values.isScheduled ? "primary600" : "neutral800",
|
|
158
|
-
fontWeight: values.isScheduled ? "semiBold" : "regular",
|
|
159
|
-
children: formatMessage({
|
|
160
|
-
id: "modal.form.input.label.schedule-release",
|
|
161
|
-
defaultMessage: "Schedule release"
|
|
162
|
-
})
|
|
163
|
-
}
|
|
164
|
-
)
|
|
165
|
-
}
|
|
166
|
-
) }),
|
|
167
|
-
values.isScheduled && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
168
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, alignItems: "start", children: [
|
|
169
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
170
|
-
designSystem.DatePicker,
|
|
171
|
-
{
|
|
172
|
-
label: formatMessage({
|
|
173
|
-
id: "content-releases.modal.form.input.label.date",
|
|
174
|
-
defaultMessage: "Date"
|
|
175
|
-
}),
|
|
176
|
-
name: "date",
|
|
177
|
-
error: errors.date,
|
|
178
|
-
onChange: (date) => {
|
|
179
|
-
const isoFormatDate = date ? dateFns.formatISO(date, { representation: "date" }) : null;
|
|
180
|
-
setFieldValue("date", isoFormatDate);
|
|
181
|
-
},
|
|
182
|
-
clearLabel: formatMessage({
|
|
183
|
-
id: "content-releases.modal.form.input.clearLabel",
|
|
184
|
-
defaultMessage: "Clear"
|
|
185
|
-
}),
|
|
186
|
-
onClear: () => {
|
|
187
|
-
setFieldValue("date", null);
|
|
188
|
-
},
|
|
189
|
-
selectedDate: values.date || void 0,
|
|
190
|
-
required: true,
|
|
191
|
-
minDate: dateFnsTz.utcToZonedTime(/* @__PURE__ */ new Date(), values.timezone.split("&")[1])
|
|
192
|
-
}
|
|
193
|
-
) }),
|
|
194
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
195
|
-
designSystem.TimePicker,
|
|
196
|
-
{
|
|
197
|
-
label: formatMessage({
|
|
198
|
-
id: "content-releases.modal.form.input.label.time",
|
|
199
|
-
defaultMessage: "Time"
|
|
200
|
-
}),
|
|
201
|
-
name: "time",
|
|
202
|
-
error: errors.time,
|
|
203
|
-
onChange: (time) => {
|
|
204
|
-
setFieldValue("time", time);
|
|
205
|
-
},
|
|
206
|
-
clearLabel: formatMessage({
|
|
207
|
-
id: "content-releases.modal.form.input.clearLabel",
|
|
208
|
-
defaultMessage: "Clear"
|
|
209
|
-
}),
|
|
210
|
-
onClear: () => {
|
|
211
|
-
setFieldValue("time", "");
|
|
212
|
-
},
|
|
213
|
-
value: values.time || void 0,
|
|
214
|
-
required: true
|
|
215
|
-
}
|
|
216
|
-
) })
|
|
217
|
-
] }),
|
|
218
|
-
/* @__PURE__ */ jsxRuntime.jsx(TimezoneComponent, { timezoneOptions: timezoneList })
|
|
219
|
-
] })
|
|
234
|
+
},
|
|
235
|
+
value: values.time || void 0,
|
|
236
|
+
required: true
|
|
237
|
+
}
|
|
238
|
+
) })
|
|
239
|
+
] }),
|
|
240
|
+
/* @__PURE__ */ jsxRuntime.jsx(TimezoneComponent, { timezoneOptions: timezoneList })
|
|
220
241
|
] })
|
|
221
242
|
] }) }),
|
|
222
243
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -287,11 +308,15 @@ const TimezoneComponent = ({ timezoneOptions }) => {
|
|
|
287
308
|
}
|
|
288
309
|
);
|
|
289
310
|
};
|
|
290
|
-
const
|
|
311
|
+
const useTypedDispatch = reactRedux.useDispatch;
|
|
312
|
+
const LinkCard = styled__default.default(designSystem.Link)`
|
|
291
313
|
display: block;
|
|
292
314
|
`;
|
|
293
|
-
const
|
|
294
|
-
|
|
315
|
+
const RelativeTime = styled__default.default(RelativeTime$1)`
|
|
316
|
+
display: inline-block;
|
|
317
|
+
&::first-letter {
|
|
318
|
+
text-transform: uppercase;
|
|
319
|
+
}
|
|
295
320
|
`;
|
|
296
321
|
const getBadgeProps = (status) => {
|
|
297
322
|
let color;
|
|
@@ -320,9 +345,8 @@ const getBadgeProps = (status) => {
|
|
|
320
345
|
};
|
|
321
346
|
const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
322
347
|
const { formatMessage } = reactIntl.useIntl();
|
|
323
|
-
const IsSchedulingEnabled = window.strapi.future.isEnabled("contentReleasesScheduling");
|
|
324
348
|
if (isError) {
|
|
325
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
349
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Error, {});
|
|
326
350
|
}
|
|
327
351
|
if (releases?.length === 0) {
|
|
328
352
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -337,11 +361,11 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
337
361
|
target: sectionTitle
|
|
338
362
|
}
|
|
339
363
|
),
|
|
340
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
364
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(symbols.EmptyDocuments, { width: "16rem" })
|
|
341
365
|
}
|
|
342
366
|
);
|
|
343
367
|
}
|
|
344
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid, { gap: 4, children: releases.map(({ id, name,
|
|
368
|
+
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(
|
|
345
369
|
designSystem.Flex,
|
|
346
370
|
{
|
|
347
371
|
direction: "column",
|
|
@@ -357,16 +381,10 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
357
381
|
children: [
|
|
358
382
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "start", gap: 1, children: [
|
|
359
383
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { as: "h3", variant: "delta", fontWeight: "bold", children: name }),
|
|
360
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children:
|
|
384
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: scheduledAt ? /* @__PURE__ */ jsxRuntime.jsx(RelativeTime, { timestamp: new Date(scheduledAt) }) : formatMessage({
|
|
361
385
|
id: "content-releases.pages.Releases.not-scheduled",
|
|
362
386
|
defaultMessage: "Not scheduled"
|
|
363
|
-
})
|
|
364
|
-
{
|
|
365
|
-
id: "content-releases.page.Releases.release-item.entries",
|
|
366
|
-
defaultMessage: "{number, plural, =0 {No entries} one {# entry} other {# entries}}"
|
|
367
|
-
},
|
|
368
|
-
{ number: actions.meta.count }
|
|
369
|
-
) })
|
|
387
|
+
}) })
|
|
370
388
|
] }),
|
|
371
389
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { ...getBadgeProps(status), children: status })
|
|
372
390
|
]
|
|
@@ -385,8 +403,7 @@ const INITIAL_FORM_VALUES = {
|
|
|
385
403
|
name: "",
|
|
386
404
|
date: null,
|
|
387
405
|
time: "",
|
|
388
|
-
|
|
389
|
-
isScheduled: window.strapi.future.isEnabled("contentReleasesScheduling"),
|
|
406
|
+
isScheduled: true,
|
|
390
407
|
scheduledAt: null,
|
|
391
408
|
timezone: null
|
|
392
409
|
};
|
|
@@ -394,23 +411,26 @@ const ReleasesPage = () => {
|
|
|
394
411
|
const tabRef = React__namespace.useRef(null);
|
|
395
412
|
const location = reactRouterDom.useLocation();
|
|
396
413
|
const [releaseModalShown, setReleaseModalShown] = React__namespace.useState(false);
|
|
397
|
-
const toggleNotification =
|
|
414
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
398
415
|
const { formatMessage } = reactIntl.useIntl();
|
|
399
|
-
const
|
|
400
|
-
const { formatAPIError } =
|
|
401
|
-
const [{ query }, setQuery] =
|
|
416
|
+
const navigate = reactRouterDom.useNavigate();
|
|
417
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
418
|
+
const [{ query }, setQuery] = strapiAdmin.useQueryParams();
|
|
402
419
|
const response = index.useGetReleasesQuery(query);
|
|
403
420
|
const [createRelease, { isLoading: isSubmittingForm }] = index.useCreateReleaseMutation();
|
|
404
|
-
const { getFeature } =
|
|
421
|
+
const { getFeature } = ee.useLicenseLimits();
|
|
405
422
|
const { maximumReleases = 3 } = getFeature("cms-content-releases");
|
|
406
|
-
const { trackUsage } =
|
|
423
|
+
const { trackUsage } = strapiAdmin.useTracking();
|
|
424
|
+
const {
|
|
425
|
+
allowedActions: { canCreate }
|
|
426
|
+
} = strapiAdmin.useRBAC(index.PERMISSIONS);
|
|
407
427
|
const { isLoading, isSuccess, isError } = response;
|
|
408
428
|
const activeTab = response?.currentData?.meta?.activeTab || "pending";
|
|
409
429
|
const activeTabIndex = ["pending", "done"].indexOf(activeTab);
|
|
410
430
|
React__namespace.useEffect(() => {
|
|
411
431
|
if (location?.state?.errors) {
|
|
412
432
|
toggleNotification({
|
|
413
|
-
type: "
|
|
433
|
+
type: "danger",
|
|
414
434
|
title: formatMessage({
|
|
415
435
|
id: "content-releases.pages.Releases.notification.error.title",
|
|
416
436
|
defaultMessage: "Your request could not be processed."
|
|
@@ -420,9 +440,9 @@ const ReleasesPage = () => {
|
|
|
420
440
|
defaultMessage: "Please try again or open another release."
|
|
421
441
|
})
|
|
422
442
|
});
|
|
423
|
-
|
|
443
|
+
navigate("", { replace: true, state: null });
|
|
424
444
|
}
|
|
425
|
-
}, [formatMessage, location?.state?.errors,
|
|
445
|
+
}, [formatMessage, location?.state?.errors, navigate, toggleNotification]);
|
|
426
446
|
React__namespace.useEffect(() => {
|
|
427
447
|
if (tabRef.current) {
|
|
428
448
|
tabRef.current._handlers.setSelectedTabIndex(activeTabIndex);
|
|
@@ -432,7 +452,7 @@ const ReleasesPage = () => {
|
|
|
432
452
|
setReleaseModalShown((prev) => !prev);
|
|
433
453
|
};
|
|
434
454
|
if (isLoading) {
|
|
435
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
455
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
|
|
436
456
|
}
|
|
437
457
|
const totalPendingReleases = isSuccess && response.currentData?.meta?.pendingReleasesCount || 0;
|
|
438
458
|
const hasReachedMaximumPendingReleases = totalPendingReleases >= maximumReleases;
|
|
@@ -463,15 +483,15 @@ const ReleasesPage = () => {
|
|
|
463
483
|
})
|
|
464
484
|
});
|
|
465
485
|
trackUsage("didCreateRelease");
|
|
466
|
-
|
|
486
|
+
navigate(response2.data.data.id.toString());
|
|
467
487
|
} else if (index.isAxiosError(response2.error)) {
|
|
468
488
|
toggleNotification({
|
|
469
|
-
type: "
|
|
489
|
+
type: "danger",
|
|
470
490
|
message: formatAPIError(response2.error)
|
|
471
491
|
});
|
|
472
492
|
} else {
|
|
473
493
|
toggleNotification({
|
|
474
|
-
type: "
|
|
494
|
+
type: "danger",
|
|
475
495
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
476
496
|
});
|
|
477
497
|
}
|
|
@@ -488,7 +508,7 @@ const ReleasesPage = () => {
|
|
|
488
508
|
id: "content-releases.pages.Releases.header-subtitle",
|
|
489
509
|
defaultMessage: "Create and manage content updates"
|
|
490
510
|
}),
|
|
491
|
-
primaryAction:
|
|
511
|
+
primaryAction: canCreate ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
492
512
|
designSystem.Button,
|
|
493
513
|
{
|
|
494
514
|
startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Plus, {}),
|
|
@@ -499,7 +519,7 @@ const ReleasesPage = () => {
|
|
|
499
519
|
defaultMessage: "New release"
|
|
500
520
|
})
|
|
501
521
|
}
|
|
502
|
-
)
|
|
522
|
+
) : null
|
|
503
523
|
}
|
|
504
524
|
),
|
|
505
525
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.ContentLayout, { children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -507,7 +527,7 @@ const ReleasesPage = () => {
|
|
|
507
527
|
StyledAlert,
|
|
508
528
|
{
|
|
509
529
|
marginBottom: 6,
|
|
510
|
-
action: /* @__PURE__ */ jsxRuntime.jsx(
|
|
530
|
+
action: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Link, { href: "https://strapi.io/pricing-cloud", isExternal: true, children: formatMessage({
|
|
511
531
|
id: "content-releases.pages.Releases.max-limit-reached.action",
|
|
512
532
|
defaultMessage: "Explore plans"
|
|
513
533
|
}) }),
|
|
@@ -578,23 +598,17 @@ const ReleasesPage = () => {
|
|
|
578
598
|
]
|
|
579
599
|
}
|
|
580
600
|
),
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
pagination: {
|
|
593
|
-
pageCount: response?.currentData?.meta?.pagination?.pageCount || 0
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
)
|
|
597
|
-
] }) : null
|
|
601
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
602
|
+
strapiAdmin.Pagination.Root,
|
|
603
|
+
{
|
|
604
|
+
...response?.currentData?.meta?.pagination,
|
|
605
|
+
defaultPageSize: response?.currentData?.meta?.pagination?.pageSize,
|
|
606
|
+
children: [
|
|
607
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.PageSize, { options: ["8", "16", "32", "64"] }),
|
|
608
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.Links, {})
|
|
609
|
+
]
|
|
610
|
+
}
|
|
611
|
+
)
|
|
598
612
|
] }) }),
|
|
599
613
|
releaseModalShown && /* @__PURE__ */ jsxRuntime.jsx(
|
|
600
614
|
ReleaseModal,
|
|
@@ -613,7 +627,7 @@ const ReleaseInfoWrapper = styled__default.default(designSystem.Flex)`
|
|
|
613
627
|
border-bottom-left-radius: ${({ theme }) => theme.borderRadius};
|
|
614
628
|
border-top: 1px solid ${({ theme }) => theme.colors.neutral150};
|
|
615
629
|
`;
|
|
616
|
-
const StyledMenuItem = styled__default.default(
|
|
630
|
+
const StyledMenuItem = styled__default.default(designSystem.Menu.Item)`
|
|
617
631
|
svg path {
|
|
618
632
|
fill: ${({ theme, disabled }) => disabled && theme.colors.neutral500};
|
|
619
633
|
}
|
|
@@ -642,14 +656,18 @@ const TrashIcon = styled__default.default(icons.Trash)`
|
|
|
642
656
|
const TypographyMaxWidth = styled__default.default(designSystem.Typography)`
|
|
643
657
|
max-width: 300px;
|
|
644
658
|
`;
|
|
645
|
-
const EntryValidationText = ({ action, schema,
|
|
659
|
+
const EntryValidationText = ({ action, schema, entry }) => {
|
|
646
660
|
const { formatMessage } = reactIntl.useIntl();
|
|
647
|
-
const { validate } = strapiAdmin.unstable_useDocument(
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
661
|
+
const { validate } = strapiAdmin$1.unstable_useDocument(
|
|
662
|
+
{
|
|
663
|
+
collectionType: schema?.kind ?? "",
|
|
664
|
+
model: schema?.uid ?? ""
|
|
665
|
+
},
|
|
666
|
+
{
|
|
667
|
+
skip: !schema
|
|
668
|
+
}
|
|
669
|
+
);
|
|
670
|
+
const errors = validate(entry) ?? {};
|
|
653
671
|
if (Object.keys(errors).length > 0) {
|
|
654
672
|
const validationErrorsMessages = Object.entries(errors).map(
|
|
655
673
|
([key, value]) => formatMessage(
|
|
@@ -658,13 +676,13 @@ const EntryValidationText = ({ action, schema, components, entry }) => {
|
|
|
658
676
|
)
|
|
659
677
|
).join(" ");
|
|
660
678
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
661
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
679
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.CrossCircle, { fill: "danger600" }),
|
|
662
680
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tooltip, { description: validationErrorsMessages, children: /* @__PURE__ */ jsxRuntime.jsx(TypographyMaxWidth, { textColor: "danger600", variant: "omega", fontWeight: "semiBold", ellipsis: true, children: validationErrorsMessages }) })
|
|
663
681
|
] });
|
|
664
682
|
}
|
|
665
683
|
if (action == "publish") {
|
|
666
684
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
667
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
685
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
|
668
686
|
entry.publishedAt ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "success600", fontWeight: "bold", children: formatMessage({
|
|
669
687
|
id: "content-releases.pages.ReleaseDetails.entry-validation.already-published",
|
|
670
688
|
defaultMessage: "Already published"
|
|
@@ -675,7 +693,7 @@ const EntryValidationText = ({ action, schema, components, entry }) => {
|
|
|
675
693
|
] });
|
|
676
694
|
}
|
|
677
695
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
678
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
696
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
|
679
697
|
!entry.publishedAt ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "success600", fontWeight: "bold", children: formatMessage({
|
|
680
698
|
id: "content-releases.pages.ReleaseDetails.entry-validation.already-unpublished",
|
|
681
699
|
defaultMessage: "Already unpublished"
|
|
@@ -697,18 +715,22 @@ const ReleaseDetailsLayout = ({
|
|
|
697
715
|
isLoading: isLoadingDetails,
|
|
698
716
|
isError,
|
|
699
717
|
error
|
|
700
|
-
} = index.useGetReleaseQuery(
|
|
718
|
+
} = index.useGetReleaseQuery(
|
|
719
|
+
{ id: releaseId },
|
|
720
|
+
{
|
|
721
|
+
skip: !releaseId
|
|
722
|
+
}
|
|
723
|
+
);
|
|
701
724
|
const [publishRelease, { isLoading: isPublishing }] = index.usePublishReleaseMutation();
|
|
702
|
-
const toggleNotification =
|
|
703
|
-
const { formatAPIError } =
|
|
704
|
-
const {
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
const
|
|
708
|
-
const { trackUsage } = helperPlugin.useTracking();
|
|
725
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
726
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
727
|
+
const { allowedActions } = strapiAdmin.useRBAC(index.PERMISSIONS);
|
|
728
|
+
const { canUpdate, canDelete, canPublish } = allowedActions;
|
|
729
|
+
const dispatch = useTypedDispatch();
|
|
730
|
+
const { trackUsage } = strapiAdmin.useTracking();
|
|
709
731
|
const release = data?.data;
|
|
710
|
-
const handlePublishRelease = async () => {
|
|
711
|
-
const response = await publishRelease({ id
|
|
732
|
+
const handlePublishRelease = (id) => async () => {
|
|
733
|
+
const response = await publishRelease({ id });
|
|
712
734
|
if ("data" in response) {
|
|
713
735
|
toggleNotification({
|
|
714
736
|
type: "success",
|
|
@@ -725,18 +747,23 @@ const ReleaseDetailsLayout = ({
|
|
|
725
747
|
});
|
|
726
748
|
} else if (index.isAxiosError(response.error)) {
|
|
727
749
|
toggleNotification({
|
|
728
|
-
type: "
|
|
750
|
+
type: "danger",
|
|
729
751
|
message: formatAPIError(response.error)
|
|
730
752
|
});
|
|
731
753
|
} else {
|
|
732
754
|
toggleNotification({
|
|
733
|
-
type: "
|
|
755
|
+
type: "danger",
|
|
734
756
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
735
757
|
});
|
|
736
758
|
}
|
|
737
759
|
};
|
|
738
760
|
const handleRefresh = () => {
|
|
739
|
-
dispatch(
|
|
761
|
+
dispatch(
|
|
762
|
+
index.releaseApi.util.invalidateTags([
|
|
763
|
+
{ type: "ReleaseAction", id: "LIST" },
|
|
764
|
+
{ type: "Release", id: releaseId }
|
|
765
|
+
])
|
|
766
|
+
);
|
|
740
767
|
};
|
|
741
768
|
const getCreatedByUser = () => {
|
|
742
769
|
if (!release?.createdBy) {
|
|
@@ -751,28 +778,25 @@ const ReleaseDetailsLayout = ({
|
|
|
751
778
|
return release.createdBy.email;
|
|
752
779
|
};
|
|
753
780
|
if (isLoadingDetails) {
|
|
754
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
781
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
|
|
755
782
|
}
|
|
756
783
|
if (isError || !release) {
|
|
757
784
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
758
|
-
reactRouterDom.
|
|
785
|
+
reactRouterDom.Navigate,
|
|
759
786
|
{
|
|
760
|
-
to:
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
]
|
|
768
|
-
}
|
|
787
|
+
to: "..",
|
|
788
|
+
state: {
|
|
789
|
+
errors: [
|
|
790
|
+
{
|
|
791
|
+
code: error?.code
|
|
792
|
+
}
|
|
793
|
+
]
|
|
769
794
|
}
|
|
770
795
|
}
|
|
771
796
|
);
|
|
772
797
|
}
|
|
773
798
|
const totalEntries = release.actions.meta.count || 0;
|
|
774
799
|
const hasCreatedByUser = Boolean(getCreatedByUser());
|
|
775
|
-
const IsSchedulingEnabled = window.strapi.future.isEnabled("contentReleasesScheduling");
|
|
776
800
|
const isScheduled = release.scheduledAt && release.timezone;
|
|
777
801
|
const numberOfEntriesText = formatMessage(
|
|
778
802
|
{
|
|
@@ -807,17 +831,14 @@ const ReleaseDetailsLayout = ({
|
|
|
807
831
|
{
|
|
808
832
|
title: release.name,
|
|
809
833
|
subtitle: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, lineHeight: 6, children: [
|
|
810
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", variant: "epsilon", children: numberOfEntriesText + (
|
|
834
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", variant: "epsilon", children: numberOfEntriesText + (isScheduled ? ` - ${scheduledText}` : "") }),
|
|
811
835
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { ...getBadgeProps(release.status), children: release.status })
|
|
812
836
|
] }),
|
|
813
|
-
navigationAction: /* @__PURE__ */ jsxRuntime.jsx(
|
|
814
|
-
id: "global.back",
|
|
815
|
-
defaultMessage: "Back"
|
|
816
|
-
}) }),
|
|
837
|
+
navigationAction: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.BackButton, {}),
|
|
817
838
|
primaryAction: !release.releasedAt && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
818
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
839
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Root, { children: [
|
|
819
840
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
820
|
-
|
|
841
|
+
designSystem.Menu.Trigger,
|
|
821
842
|
{
|
|
822
843
|
as: designSystem.IconButton,
|
|
823
844
|
paddingLeft: 2,
|
|
@@ -830,7 +851,7 @@ const ReleaseDetailsLayout = ({
|
|
|
830
851
|
variant: "tertiary"
|
|
831
852
|
}
|
|
832
853
|
),
|
|
833
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
854
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Content, { top: 1, popoverPlacement: "bottom-end", maxHeight: void 0, children: [
|
|
834
855
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
835
856
|
designSystem.Flex,
|
|
836
857
|
{
|
|
@@ -879,7 +900,7 @@ const ReleaseDetailsLayout = ({
|
|
|
879
900
|
defaultMessage: "Created"
|
|
880
901
|
}) }),
|
|
881
902
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", color: "neutral300", children: [
|
|
882
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
903
|
+
/* @__PURE__ */ jsxRuntime.jsx(RelativeTime$1, { timestamp: new Date(release.createdAt) }),
|
|
883
904
|
formatMessage(
|
|
884
905
|
{
|
|
885
906
|
id: "content-releases.header.actions.created.description",
|
|
@@ -897,12 +918,12 @@ const ReleaseDetailsLayout = ({
|
|
|
897
918
|
id: "content-releases.header.actions.refresh",
|
|
898
919
|
defaultMessage: "Refresh"
|
|
899
920
|
}) }),
|
|
900
|
-
|
|
921
|
+
canPublish ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
901
922
|
designSystem.Button,
|
|
902
923
|
{
|
|
903
924
|
size: "S",
|
|
904
925
|
variant: "default",
|
|
905
|
-
onClick: handlePublishRelease,
|
|
926
|
+
onClick: handlePublishRelease(release.id.toString()),
|
|
906
927
|
loading: isPublishing,
|
|
907
928
|
disabled: release.actions.meta.count === 0,
|
|
908
929
|
children: formatMessage({
|
|
@@ -910,7 +931,7 @@ const ReleaseDetailsLayout = ({
|
|
|
910
931
|
defaultMessage: "Publish"
|
|
911
932
|
})
|
|
912
933
|
}
|
|
913
|
-
)
|
|
934
|
+
) : null
|
|
914
935
|
] })
|
|
915
936
|
}
|
|
916
937
|
),
|
|
@@ -918,6 +939,7 @@ const ReleaseDetailsLayout = ({
|
|
|
918
939
|
] });
|
|
919
940
|
};
|
|
920
941
|
const GROUP_BY_OPTIONS = ["contentType", "locale", "action"];
|
|
942
|
+
const GROUP_BY_OPTIONS_NO_LOCALE = ["contentType", "action"];
|
|
921
943
|
const getGroupByOptionLabel = (value) => {
|
|
922
944
|
if (value === "locale") {
|
|
923
945
|
return {
|
|
@@ -936,12 +958,11 @@ const getGroupByOptionLabel = (value) => {
|
|
|
936
958
|
defaultMessage: "Content-Types"
|
|
937
959
|
};
|
|
938
960
|
};
|
|
939
|
-
const ReleaseDetailsBody = () => {
|
|
961
|
+
const ReleaseDetailsBody = ({ releaseId }) => {
|
|
940
962
|
const { formatMessage } = reactIntl.useIntl();
|
|
941
|
-
const {
|
|
942
|
-
const
|
|
943
|
-
const
|
|
944
|
-
const { formatAPIError } = helperPlugin.useAPIErrorHandler();
|
|
963
|
+
const [{ query }, setQuery] = strapiAdmin.useQueryParams();
|
|
964
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
965
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
945
966
|
const {
|
|
946
967
|
data: releaseData,
|
|
947
968
|
isLoading: isReleaseLoading,
|
|
@@ -950,7 +971,21 @@ const ReleaseDetailsBody = () => {
|
|
|
950
971
|
} = index.useGetReleaseQuery({ id: releaseId });
|
|
951
972
|
const {
|
|
952
973
|
allowedActions: { canUpdate }
|
|
953
|
-
} =
|
|
974
|
+
} = strapiAdmin.useRBAC(index.PERMISSIONS);
|
|
975
|
+
const runHookWaterfall = strapiAdmin.useStrapiApp("ReleaseDetailsPage", (state) => state.runHookWaterfall);
|
|
976
|
+
const { hasI18nEnabled } = runHookWaterfall(
|
|
977
|
+
"ContentReleases/pages/ReleaseDetails/add-locale-in-releases",
|
|
978
|
+
{
|
|
979
|
+
displayedHeaders: {
|
|
980
|
+
label: formatMessage({
|
|
981
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.locale",
|
|
982
|
+
defaultMessage: "locale"
|
|
983
|
+
}),
|
|
984
|
+
name: "locale"
|
|
985
|
+
},
|
|
986
|
+
hasI18nEnabled: false
|
|
987
|
+
}
|
|
988
|
+
);
|
|
954
989
|
const release = releaseData?.data;
|
|
955
990
|
const selectedGroupBy = query?.groupBy || "contentType";
|
|
956
991
|
const {
|
|
@@ -981,19 +1016,19 @@ const ReleaseDetailsBody = () => {
|
|
|
981
1016
|
if ("error" in response) {
|
|
982
1017
|
if (index.isAxiosError(response.error)) {
|
|
983
1018
|
toggleNotification({
|
|
984
|
-
type: "
|
|
1019
|
+
type: "danger",
|
|
985
1020
|
message: formatAPIError(response.error)
|
|
986
1021
|
});
|
|
987
1022
|
} else {
|
|
988
1023
|
toggleNotification({
|
|
989
|
-
type: "
|
|
1024
|
+
type: "danger",
|
|
990
1025
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
991
1026
|
});
|
|
992
1027
|
}
|
|
993
1028
|
}
|
|
994
1029
|
};
|
|
995
1030
|
if (isLoading || isReleaseLoading) {
|
|
996
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1031
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
|
|
997
1032
|
}
|
|
998
1033
|
const releaseActions = data?.data;
|
|
999
1034
|
const releaseMeta = data?.meta;
|
|
@@ -1012,30 +1047,24 @@ const ReleaseDetailsBody = () => {
|
|
|
1012
1047
|
});
|
|
1013
1048
|
}
|
|
1014
1049
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1015
|
-
reactRouterDom.
|
|
1050
|
+
reactRouterDom.Navigate,
|
|
1016
1051
|
{
|
|
1017
|
-
to:
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
errors: errorsArray
|
|
1021
|
-
}
|
|
1052
|
+
to: "..",
|
|
1053
|
+
state: {
|
|
1054
|
+
errors: errorsArray
|
|
1022
1055
|
}
|
|
1023
1056
|
}
|
|
1024
1057
|
);
|
|
1025
1058
|
}
|
|
1026
1059
|
if (isError || !releaseActions) {
|
|
1027
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1060
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Error, {});
|
|
1028
1061
|
}
|
|
1029
1062
|
if (Object.keys(releaseActions).length === 0) {
|
|
1030
1063
|
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.ContentLayout, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1031
|
-
|
|
1064
|
+
designSystem.EmptyStateLayout,
|
|
1032
1065
|
{
|
|
1033
|
-
content: {
|
|
1034
|
-
id: "content-releases.pages.Details.tab.emptyEntries",
|
|
1035
|
-
defaultMessage: "This release is empty. Open the Content Manager, select an entry and add it to the release."
|
|
1036
|
-
},
|
|
1037
1066
|
action: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1038
|
-
|
|
1067
|
+
designSystem.LinkButton,
|
|
1039
1068
|
{
|
|
1040
1069
|
as: reactRouterDom.Link,
|
|
1041
1070
|
to: {
|
|
@@ -1048,18 +1077,59 @@ const ReleaseDetailsBody = () => {
|
|
|
1048
1077
|
defaultMessage: "Open the Content Manager"
|
|
1049
1078
|
})
|
|
1050
1079
|
}
|
|
1051
|
-
)
|
|
1080
|
+
),
|
|
1081
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(symbols.EmptyDocuments, { width: "16rem" }),
|
|
1082
|
+
content: formatMessage({
|
|
1083
|
+
id: "content-releases.pages.Details.tab.emptyEntries",
|
|
1084
|
+
defaultMessage: "This release is empty. Open the Content Manager, select an entry and add it to the release."
|
|
1085
|
+
})
|
|
1052
1086
|
}
|
|
1053
1087
|
) });
|
|
1054
1088
|
}
|
|
1089
|
+
const groupByLabel = formatMessage({
|
|
1090
|
+
id: "content-releases.pages.ReleaseDetails.groupBy.aria-label",
|
|
1091
|
+
defaultMessage: "Group by"
|
|
1092
|
+
});
|
|
1093
|
+
const headers = [
|
|
1094
|
+
// ...displayedHeaders,
|
|
1095
|
+
{
|
|
1096
|
+
label: formatMessage({
|
|
1097
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.name",
|
|
1098
|
+
defaultMessage: "name"
|
|
1099
|
+
}),
|
|
1100
|
+
name: "name"
|
|
1101
|
+
},
|
|
1102
|
+
{
|
|
1103
|
+
label: formatMessage({
|
|
1104
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.content-type",
|
|
1105
|
+
defaultMessage: "content-type"
|
|
1106
|
+
}),
|
|
1107
|
+
name: "content-type"
|
|
1108
|
+
},
|
|
1109
|
+
{
|
|
1110
|
+
label: formatMessage({
|
|
1111
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.action",
|
|
1112
|
+
defaultMessage: "action"
|
|
1113
|
+
}),
|
|
1114
|
+
name: "action"
|
|
1115
|
+
},
|
|
1116
|
+
...!release.releasedAt ? [
|
|
1117
|
+
{
|
|
1118
|
+
label: formatMessage({
|
|
1119
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.status",
|
|
1120
|
+
defaultMessage: "status"
|
|
1121
|
+
}),
|
|
1122
|
+
name: "status"
|
|
1123
|
+
}
|
|
1124
|
+
] : []
|
|
1125
|
+
];
|
|
1126
|
+
const options = hasI18nEnabled ? GROUP_BY_OPTIONS : GROUP_BY_OPTIONS_NO_LOCALE;
|
|
1055
1127
|
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.ContentLayout, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 8, direction: "column", alignItems: "stretch", children: [
|
|
1056
1128
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1057
1129
|
designSystem.SingleSelect,
|
|
1058
1130
|
{
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
defaultMessage: "Group by"
|
|
1062
|
-
}),
|
|
1131
|
+
placeholder: groupByLabel,
|
|
1132
|
+
"aria-label": groupByLabel,
|
|
1063
1133
|
customizeContent: (value) => formatMessage(
|
|
1064
1134
|
{
|
|
1065
1135
|
id: `content-releases.pages.ReleaseDetails.groupBy.label`,
|
|
@@ -1071,84 +1141,27 @@ const ReleaseDetailsBody = () => {
|
|
|
1071
1141
|
),
|
|
1072
1142
|
value: formatMessage(getGroupByOptionLabel(selectedGroupBy)),
|
|
1073
1143
|
onChange: (value) => setQuery({ groupBy: value }),
|
|
1074
|
-
children:
|
|
1144
|
+
children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: option, children: formatMessage(getGroupByOptionLabel(option)) }, option))
|
|
1075
1145
|
}
|
|
1076
1146
|
) }),
|
|
1077
1147
|
Object.keys(releaseActions).map((key) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, direction: "column", alignItems: "stretch", children: [
|
|
1078
1148
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { role: "separator", "aria-label": key, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { children: key }) }),
|
|
1079
1149
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1080
|
-
|
|
1150
|
+
strapiAdmin.Table.Root,
|
|
1081
1151
|
{
|
|
1082
1152
|
rows: releaseActions[key].map((item) => ({
|
|
1083
1153
|
...item,
|
|
1084
1154
|
id: Number(item.entry.id)
|
|
1085
1155
|
})),
|
|
1086
|
-
|
|
1087
|
-
isLoading,
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1091
|
-
|
|
1092
|
-
helperPlugin.Table.HeaderCell,
|
|
1093
|
-
{
|
|
1094
|
-
fieldSchemaType: "string",
|
|
1095
|
-
label: formatMessage({
|
|
1096
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.name",
|
|
1097
|
-
defaultMessage: "name"
|
|
1098
|
-
}),
|
|
1099
|
-
name: "name"
|
|
1100
|
-
}
|
|
1101
|
-
),
|
|
1102
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1103
|
-
helperPlugin.Table.HeaderCell,
|
|
1104
|
-
{
|
|
1105
|
-
fieldSchemaType: "string",
|
|
1106
|
-
label: formatMessage({
|
|
1107
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.locale",
|
|
1108
|
-
defaultMessage: "locale"
|
|
1109
|
-
}),
|
|
1110
|
-
name: "locale"
|
|
1111
|
-
}
|
|
1112
|
-
),
|
|
1113
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1114
|
-
helperPlugin.Table.HeaderCell,
|
|
1115
|
-
{
|
|
1116
|
-
fieldSchemaType: "string",
|
|
1117
|
-
label: formatMessage({
|
|
1118
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.content-type",
|
|
1119
|
-
defaultMessage: "content-type"
|
|
1120
|
-
}),
|
|
1121
|
-
name: "content-type"
|
|
1122
|
-
}
|
|
1123
|
-
),
|
|
1124
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1125
|
-
helperPlugin.Table.HeaderCell,
|
|
1126
|
-
{
|
|
1127
|
-
fieldSchemaType: "string",
|
|
1128
|
-
label: formatMessage({
|
|
1129
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.action",
|
|
1130
|
-
defaultMessage: "action"
|
|
1131
|
-
}),
|
|
1132
|
-
name: "action"
|
|
1133
|
-
}
|
|
1134
|
-
),
|
|
1135
|
-
!release.releasedAt && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1136
|
-
helperPlugin.Table.HeaderCell,
|
|
1137
|
-
{
|
|
1138
|
-
fieldSchemaType: "string",
|
|
1139
|
-
label: formatMessage({
|
|
1140
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.status",
|
|
1141
|
-
defaultMessage: "status"
|
|
1142
|
-
}),
|
|
1143
|
-
name: "status"
|
|
1144
|
-
}
|
|
1145
|
-
)
|
|
1146
|
-
] }),
|
|
1147
|
-
/* @__PURE__ */ jsxRuntime.jsx(helperPlugin.Table.LoadingBody, {}),
|
|
1148
|
-
/* @__PURE__ */ jsxRuntime.jsx(helperPlugin.Table.Body, { children: releaseActions[key].map(
|
|
1156
|
+
headers,
|
|
1157
|
+
isLoading: isLoading || isFetching,
|
|
1158
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(strapiAdmin.Table.Content, { children: [
|
|
1159
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Head, { children: headers.map((header) => /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.HeaderCell, { ...header }, header.name)) }),
|
|
1160
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Loading, {}),
|
|
1161
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Body, { children: releaseActions[key].map(
|
|
1149
1162
|
({ id, contentType, locale, type, entry }, actionIndex) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
1150
1163
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "25%", maxWidth: "200px", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { ellipsis: true, children: `${contentType.mainFieldValue || entry.id}` }) }),
|
|
1151
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "10%", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: `${locale?.name ? locale.name : "-"}` }) }),
|
|
1164
|
+
hasI18nEnabled && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "10%", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: `${locale?.name ? locale.name : "-"}` }) }),
|
|
1152
1165
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "10%", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: contentType.displayName || "" }) }),
|
|
1153
1166
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "20%", children: release.releasedAt ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage(
|
|
1154
1167
|
{
|
|
@@ -1202,34 +1215,39 @@ const ReleaseDetailsBody = () => {
|
|
|
1202
1215
|
}
|
|
1203
1216
|
)
|
|
1204
1217
|
] }, `releases-group-${key}`)),
|
|
1205
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
}
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1218
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1219
|
+
strapiAdmin.Pagination.Root,
|
|
1220
|
+
{
|
|
1221
|
+
...releaseMeta?.pagination,
|
|
1222
|
+
defaultPageSize: releaseMeta?.pagination?.pageSize,
|
|
1223
|
+
children: [
|
|
1224
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.PageSize, {}),
|
|
1225
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.Links, {})
|
|
1226
|
+
]
|
|
1227
|
+
}
|
|
1228
|
+
)
|
|
1216
1229
|
] }) });
|
|
1217
1230
|
};
|
|
1218
1231
|
const ReleaseDetailsPage = () => {
|
|
1219
1232
|
const { formatMessage } = reactIntl.useIntl();
|
|
1220
1233
|
const { releaseId } = reactRouterDom.useParams();
|
|
1221
|
-
const toggleNotification =
|
|
1222
|
-
const { formatAPIError } =
|
|
1223
|
-
const
|
|
1234
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
1235
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
1236
|
+
const navigate = reactRouterDom.useNavigate();
|
|
1224
1237
|
const [releaseModalShown, setReleaseModalShown] = React__namespace.useState(false);
|
|
1225
1238
|
const [showWarningSubmit, setWarningSubmit] = React__namespace.useState(false);
|
|
1226
1239
|
const {
|
|
1227
1240
|
isLoading: isLoadingDetails,
|
|
1228
1241
|
data,
|
|
1229
1242
|
isSuccess: isSuccessDetails
|
|
1230
|
-
} = index.useGetReleaseQuery(
|
|
1243
|
+
} = index.useGetReleaseQuery(
|
|
1244
|
+
{ id: releaseId },
|
|
1245
|
+
{
|
|
1246
|
+
skip: !releaseId
|
|
1247
|
+
}
|
|
1248
|
+
);
|
|
1231
1249
|
const [updateRelease, { isLoading: isSubmittingForm }] = index.useUpdateReleaseMutation();
|
|
1232
|
-
const [deleteRelease
|
|
1250
|
+
const [deleteRelease] = index.useDeleteReleaseMutation();
|
|
1233
1251
|
const toggleEditReleaseModal = () => {
|
|
1234
1252
|
setReleaseModalShown((prev) => !prev);
|
|
1235
1253
|
};
|
|
@@ -1240,15 +1258,18 @@ const ReleaseDetailsPage = () => {
|
|
|
1240
1258
|
{
|
|
1241
1259
|
toggleEditReleaseModal,
|
|
1242
1260
|
toggleWarningSubmit,
|
|
1243
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1261
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {})
|
|
1244
1262
|
}
|
|
1245
1263
|
);
|
|
1246
1264
|
}
|
|
1265
|
+
if (!releaseId) {
|
|
1266
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: ".." });
|
|
1267
|
+
}
|
|
1247
1268
|
const releaseData = isSuccessDetails && data?.data || null;
|
|
1248
1269
|
const title = releaseData?.name || "";
|
|
1249
1270
|
const timezone = releaseData?.timezone ?? null;
|
|
1250
1271
|
const scheduledAt = releaseData?.scheduledAt && timezone ? dateFnsTz.utcToZonedTime(releaseData.scheduledAt, timezone) : null;
|
|
1251
|
-
const date = scheduledAt ?
|
|
1272
|
+
const date = scheduledAt ? format__default.default(scheduledAt, "yyyy-MM-dd") : null;
|
|
1252
1273
|
const time = scheduledAt ? format__default.default(scheduledAt, "HH:mm") : "";
|
|
1253
1274
|
const handleEditRelease = async (values) => {
|
|
1254
1275
|
const response = await updateRelease({
|
|
@@ -1265,33 +1286,33 @@ const ReleaseDetailsPage = () => {
|
|
|
1265
1286
|
defaultMessage: "Release updated."
|
|
1266
1287
|
})
|
|
1267
1288
|
});
|
|
1289
|
+
toggleEditReleaseModal();
|
|
1268
1290
|
} else if (index.isAxiosError(response.error)) {
|
|
1269
1291
|
toggleNotification({
|
|
1270
|
-
type: "
|
|
1292
|
+
type: "danger",
|
|
1271
1293
|
message: formatAPIError(response.error)
|
|
1272
1294
|
});
|
|
1273
1295
|
} else {
|
|
1274
1296
|
toggleNotification({
|
|
1275
|
-
type: "
|
|
1297
|
+
type: "danger",
|
|
1276
1298
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
1277
1299
|
});
|
|
1278
1300
|
}
|
|
1279
|
-
toggleEditReleaseModal();
|
|
1280
1301
|
};
|
|
1281
1302
|
const handleDeleteRelease = async () => {
|
|
1282
1303
|
const response = await deleteRelease({
|
|
1283
1304
|
id: releaseId
|
|
1284
1305
|
});
|
|
1285
1306
|
if ("data" in response) {
|
|
1286
|
-
|
|
1307
|
+
navigate("..");
|
|
1287
1308
|
} else if (index.isAxiosError(response.error)) {
|
|
1288
1309
|
toggleNotification({
|
|
1289
|
-
type: "
|
|
1310
|
+
type: "danger",
|
|
1290
1311
|
message: formatAPIError(response.error)
|
|
1291
1312
|
});
|
|
1292
1313
|
} else {
|
|
1293
1314
|
toggleNotification({
|
|
1294
|
-
type: "
|
|
1315
|
+
type: "danger",
|
|
1295
1316
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
1296
1317
|
});
|
|
1297
1318
|
}
|
|
@@ -1302,7 +1323,7 @@ const ReleaseDetailsPage = () => {
|
|
|
1302
1323
|
toggleEditReleaseModal,
|
|
1303
1324
|
toggleWarningSubmit,
|
|
1304
1325
|
children: [
|
|
1305
|
-
/* @__PURE__ */ jsxRuntime.jsx(ReleaseDetailsBody, {}),
|
|
1326
|
+
/* @__PURE__ */ jsxRuntime.jsx(ReleaseDetailsBody, { releaseId }),
|
|
1306
1327
|
releaseModalShown && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1307
1328
|
ReleaseModal,
|
|
1308
1329
|
{
|
|
@@ -1320,16 +1341,15 @@ const ReleaseDetailsPage = () => {
|
|
|
1320
1341
|
}
|
|
1321
1342
|
),
|
|
1322
1343
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1323
|
-
|
|
1344
|
+
strapiAdmin.ConfirmDialog,
|
|
1324
1345
|
{
|
|
1325
|
-
|
|
1346
|
+
isOpen: showWarningSubmit,
|
|
1347
|
+
onClose: toggleWarningSubmit,
|
|
1348
|
+
onConfirm: handleDeleteRelease,
|
|
1349
|
+
children: formatMessage({
|
|
1326
1350
|
id: "content-releases.dialog.confirmation-message",
|
|
1327
1351
|
defaultMessage: "Are you sure you want to delete this release?"
|
|
1328
|
-
}
|
|
1329
|
-
isOpen: showWarningSubmit,
|
|
1330
|
-
isConfirmButtonLoading: isDeletingRelease,
|
|
1331
|
-
onToggleDialog: toggleWarningSubmit,
|
|
1332
|
-
onConfirm: handleDeleteRelease
|
|
1352
|
+
})
|
|
1333
1353
|
}
|
|
1334
1354
|
)
|
|
1335
1355
|
]
|
|
@@ -1337,10 +1357,10 @@ const ReleaseDetailsPage = () => {
|
|
|
1337
1357
|
);
|
|
1338
1358
|
};
|
|
1339
1359
|
const App = () => {
|
|
1340
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1341
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, {
|
|
1342
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, {
|
|
1360
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Protect, { permissions: index.PERMISSIONS.main, children: /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.Routes, { children: [
|
|
1361
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { index: true, element: /* @__PURE__ */ jsxRuntime.jsx(ReleasesPage, {}) }),
|
|
1362
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: ":releaseId", element: /* @__PURE__ */ jsxRuntime.jsx(ReleaseDetailsPage, {}) })
|
|
1343
1363
|
] }) });
|
|
1344
1364
|
};
|
|
1345
1365
|
exports.App = App;
|
|
1346
|
-
//# sourceMappingURL=App-
|
|
1366
|
+
//# sourceMappingURL=App-C0DlH0im.js.map
|