@strapi/content-releases 0.0.0-experimental.d8a676a242377cee820b59b21a05d47290d9ac73 → 0.0.0-experimental.dd3311938ac827f1fa8560c8840a9a394f5896c0
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-DUmziQ17.js} +393 -373
- package/dist/_chunks/App-DUmziQ17.js.map +1 -0
- package/dist/_chunks/{App-bpzO2Ljh.mjs → App-D_6Y9N2F.mjs} +372 -351
- package/dist/_chunks/App-D_6Y9N2F.mjs.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-YhAPgpG9.js → PurchaseContentReleases-Be3acS2L.js} +8 -7
- package/dist/_chunks/PurchaseContentReleases-Be3acS2L.js.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-Clm0iACO.mjs → PurchaseContentReleases-_MxP6-Dt.mjs} +9 -8
- package/dist/_chunks/PurchaseContentReleases-_MxP6-Dt.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-BomF0-yY.mjs} +224 -219
- package/dist/_chunks/index-BomF0-yY.mjs.map +1 -0
- package/dist/_chunks/{index-fP3qoWZ4.js → index-C5Hc767q.js} +224 -221
- package/dist/_chunks/index-C5Hc767q.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/release.d.ts +105 -0
- package/dist/admin/src/store/hooks.d.ts +7 -0
- package/dist/admin/src/utils/api.d.ts +6 -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 +29 -36
- 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,25 +1,23 @@
|
|
|
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-C5Hc767q.js");
|
|
7
7
|
const React = require("react");
|
|
8
|
-
const strapiAdmin = require("@strapi/
|
|
8
|
+
const strapiAdmin$1 = require("@strapi/content-manager/strapi-admin");
|
|
9
9
|
const designSystem = require("@strapi/design-system");
|
|
10
|
-
const v2 = require("@strapi/design-system/v2");
|
|
11
10
|
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 styledComponents = 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)
|
|
@@ -41,8 +39,37 @@ function _interopNamespace(e) {
|
|
|
41
39
|
}
|
|
42
40
|
const React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
|
43
41
|
const format__default = /* @__PURE__ */ _interopDefault(format);
|
|
44
|
-
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
45
42
|
const yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
|
|
43
|
+
const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
|
|
44
|
+
const RelativeTime$1 = React__namespace.forwardRef(
|
|
45
|
+
({ timestamp, customIntervals = [], ...restProps }, forwardedRef) => {
|
|
46
|
+
const { formatRelativeTime, formatDate, formatTime } = reactIntl.useIntl();
|
|
47
|
+
const interval = dateFns.intervalToDuration({
|
|
48
|
+
start: timestamp,
|
|
49
|
+
end: Date.now()
|
|
50
|
+
// see https://github.com/date-fns/date-fns/issues/2891 – No idea why it's all partial it returns it every time.
|
|
51
|
+
});
|
|
52
|
+
const unit = intervals.find((intervalUnit) => {
|
|
53
|
+
return interval[intervalUnit] > 0 && Object.keys(interval).includes(intervalUnit);
|
|
54
|
+
});
|
|
55
|
+
const relativeTime = dateFns.isPast(timestamp) ? -interval[unit] : interval[unit];
|
|
56
|
+
const customInterval = customIntervals.find(
|
|
57
|
+
(custom) => interval[custom.unit] < custom.threshold
|
|
58
|
+
);
|
|
59
|
+
const displayText = customInterval ? customInterval.text : formatRelativeTime(relativeTime, unit, { numeric: "auto" });
|
|
60
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
61
|
+
"time",
|
|
62
|
+
{
|
|
63
|
+
ref: forwardedRef,
|
|
64
|
+
dateTime: timestamp.toISOString(),
|
|
65
|
+
role: "time",
|
|
66
|
+
title: `${formatDate(timestamp)} ${formatTime(timestamp)}`,
|
|
67
|
+
...restProps,
|
|
68
|
+
children: displayText
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
);
|
|
46
73
|
const RELEASE_SCHEMA = yup__namespace.object().shape({
|
|
47
74
|
name: yup__namespace.string().trim().required(),
|
|
48
75
|
scheduledAt: yup__namespace.string().nullable(),
|
|
@@ -72,7 +99,6 @@ const ReleaseModal = ({
|
|
|
72
99
|
const { formatMessage } = reactIntl.useIntl();
|
|
73
100
|
const { pathname } = reactRouterDom.useLocation();
|
|
74
101
|
const isCreatingRelease = pathname === `/plugins/${index.pluginId}`;
|
|
75
|
-
const IsSchedulingEnabled = window.strapi.future.isEnabled("contentReleasesScheduling");
|
|
76
102
|
const { timezoneList, systemTimezone = { value: "UTC+00:00-Africa/Abidjan " } } = getTimezones(
|
|
77
103
|
initialValues.scheduledAt ? new Date(initialValues.scheduledAt) : /* @__PURE__ */ new Date()
|
|
78
104
|
);
|
|
@@ -80,9 +106,8 @@ const ReleaseModal = ({
|
|
|
80
106
|
const { date, time, timezone } = values;
|
|
81
107
|
if (!date || !time || !timezone)
|
|
82
108
|
return null;
|
|
83
|
-
const formattedDate = dateFns.parse(time, "HH:mm", new Date(date));
|
|
84
109
|
const timezoneWithoutOffset = timezone.split("&")[1];
|
|
85
|
-
return dateFnsTz.zonedTimeToUtc(
|
|
110
|
+
return dateFnsTz.zonedTimeToUtc(`${date} ${time}`, timezoneWithoutOffset);
|
|
86
111
|
};
|
|
87
112
|
const getTimezoneWithOffset = () => {
|
|
88
113
|
const currentTimezone = timezoneList.find(
|
|
@@ -114,23 +139,17 @@ const ReleaseModal = ({
|
|
|
114
139
|
},
|
|
115
140
|
validationSchema: RELEASE_SCHEMA,
|
|
116
141
|
validateOnChange: false,
|
|
117
|
-
children: ({ values, errors, handleChange, setFieldValue }) =>
|
|
118
|
-
|
|
119
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
120
|
-
designSystem.
|
|
121
|
-
|
|
122
|
-
label: formatMessage({
|
|
142
|
+
children: ({ values, errors, handleChange, setFieldValue }) => {
|
|
143
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(formik.Form, { children: [
|
|
144
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.ModalBody, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
|
|
145
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { name: "name", error: errors.name, required: true, children: [
|
|
146
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
123
147
|
id: "content-releases.modal.form.input.label.release-name",
|
|
124
148
|
defaultMessage: "Name"
|
|
125
|
-
}),
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
onChange: handleChange,
|
|
130
|
-
required: true
|
|
131
|
-
}
|
|
132
|
-
),
|
|
133
|
-
IsSchedulingEnabled && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
149
|
+
}) }),
|
|
150
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.TextInput, { value: values.name, onChange: handleChange }),
|
|
151
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
152
|
+
] }),
|
|
134
153
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "max-content", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
135
154
|
designSystem.Checkbox,
|
|
136
155
|
{
|
|
@@ -166,73 +185,73 @@ const ReleaseModal = ({
|
|
|
166
185
|
) }),
|
|
167
186
|
values.isScheduled && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
168
187
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, alignItems: "start", children: [
|
|
169
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.
|
|
170
|
-
designSystem.
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
}
|
|
193
|
-
) }),
|
|
194
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.
|
|
195
|
-
designSystem.
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
}
|
|
216
|
-
) })
|
|
188
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { name: "date", error: errors.date, required: true, children: [
|
|
189
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
190
|
+
id: "content-releases.modal.form.input.label.date",
|
|
191
|
+
defaultMessage: "Date"
|
|
192
|
+
}) }),
|
|
193
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
194
|
+
designSystem.DatePicker,
|
|
195
|
+
{
|
|
196
|
+
onChange: (date) => {
|
|
197
|
+
const isoFormatDate = date ? dateFns.formatISO(date, { representation: "date" }) : null;
|
|
198
|
+
setFieldValue("date", isoFormatDate);
|
|
199
|
+
},
|
|
200
|
+
clearLabel: formatMessage({
|
|
201
|
+
id: "content-releases.modal.form.input.clearLabel",
|
|
202
|
+
defaultMessage: "Clear"
|
|
203
|
+
}),
|
|
204
|
+
onClear: () => {
|
|
205
|
+
setFieldValue("date", null);
|
|
206
|
+
},
|
|
207
|
+
value: values.date ? new Date(values.date) : /* @__PURE__ */ new Date(),
|
|
208
|
+
minDate: dateFnsTz.utcToZonedTime(/* @__PURE__ */ new Date(), values.timezone.split("&")[1])
|
|
209
|
+
}
|
|
210
|
+
),
|
|
211
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
212
|
+
] }) }),
|
|
213
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { name: "time", error: errors.time, required: true, children: [
|
|
214
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
215
|
+
id: "content-releases.modal.form.input.label.time",
|
|
216
|
+
defaultMessage: "Time"
|
|
217
|
+
}) }),
|
|
218
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
219
|
+
designSystem.TimePicker,
|
|
220
|
+
{
|
|
221
|
+
onChange: (time) => {
|
|
222
|
+
setFieldValue("time", time);
|
|
223
|
+
},
|
|
224
|
+
clearLabel: formatMessage({
|
|
225
|
+
id: "content-releases.modal.form.input.clearLabel",
|
|
226
|
+
defaultMessage: "Clear"
|
|
227
|
+
}),
|
|
228
|
+
onClear: () => {
|
|
229
|
+
setFieldValue("time", "");
|
|
230
|
+
},
|
|
231
|
+
value: values.time || void 0
|
|
232
|
+
}
|
|
233
|
+
),
|
|
234
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
235
|
+
] }) })
|
|
217
236
|
] }),
|
|
218
237
|
/* @__PURE__ */ jsxRuntime.jsx(TimezoneComponent, { timezoneOptions: timezoneList })
|
|
219
238
|
] })
|
|
220
|
-
] })
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
)
|
|
235
|
-
|
|
239
|
+
] }) }),
|
|
240
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
241
|
+
designSystem.ModalFooter,
|
|
242
|
+
{
|
|
243
|
+
startActions: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: handleClose, variant: "tertiary", name: "cancel", children: formatMessage({ id: "cancel", defaultMessage: "Cancel" }) }),
|
|
244
|
+
endActions: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { name: "submit", loading: isLoading, type: "submit", children: formatMessage(
|
|
245
|
+
{
|
|
246
|
+
id: "content-releases.modal.form.button.submit",
|
|
247
|
+
defaultMessage: "{isCreatingRelease, select, true {Continue} other {Save}}"
|
|
248
|
+
},
|
|
249
|
+
{ isCreatingRelease }
|
|
250
|
+
) })
|
|
251
|
+
}
|
|
252
|
+
)
|
|
253
|
+
] });
|
|
254
|
+
}
|
|
236
255
|
}
|
|
237
256
|
)
|
|
238
257
|
] });
|
|
@@ -261,37 +280,44 @@ const TimezoneComponent = ({ timezoneOptions }) => {
|
|
|
261
280
|
}
|
|
262
281
|
}
|
|
263
282
|
}, [setFieldValue, values.date, values.timezone]);
|
|
264
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
265
|
-
designSystem.
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
}
|
|
288
|
-
);
|
|
283
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { name: "timezone", error: errors.timezone, required: true, children: [
|
|
284
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
285
|
+
id: "content-releases.modal.form.input.label.timezone",
|
|
286
|
+
defaultMessage: "Timezone"
|
|
287
|
+
}) }),
|
|
288
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
289
|
+
designSystem.Combobox,
|
|
290
|
+
{
|
|
291
|
+
autocomplete: { type: "list", filter: "contains" },
|
|
292
|
+
value: values.timezone || void 0,
|
|
293
|
+
textValue: values.timezone ? values.timezone.replace(/&/, " ") : void 0,
|
|
294
|
+
onChange: (timezone) => {
|
|
295
|
+
setFieldValue("timezone", timezone);
|
|
296
|
+
},
|
|
297
|
+
onTextValueChange: (timezone) => {
|
|
298
|
+
setFieldValue("timezone", timezone);
|
|
299
|
+
},
|
|
300
|
+
onClear: () => {
|
|
301
|
+
setFieldValue("timezone", "");
|
|
302
|
+
},
|
|
303
|
+
children: timezoneList.map((timezone) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.ComboboxOption, { value: timezone.value, children: timezone.value.replace(/&/, " ") }, timezone.value))
|
|
304
|
+
}
|
|
305
|
+
),
|
|
306
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
307
|
+
] });
|
|
308
|
+
};
|
|
309
|
+
const useTypedDispatch = reactRedux.useDispatch;
|
|
310
|
+
const isBaseQueryError = (error) => {
|
|
311
|
+
return typeof error !== "undefined" && error.name !== void 0;
|
|
289
312
|
};
|
|
290
|
-
const LinkCard =
|
|
313
|
+
const LinkCard = styledComponents.styled(designSystem.Link)`
|
|
291
314
|
display: block;
|
|
292
315
|
`;
|
|
293
|
-
const
|
|
294
|
-
|
|
316
|
+
const RelativeTime = styledComponents.styled(RelativeTime$1)`
|
|
317
|
+
display: inline-block;
|
|
318
|
+
&::first-letter {
|
|
319
|
+
text-transform: uppercase;
|
|
320
|
+
}
|
|
295
321
|
`;
|
|
296
322
|
const getBadgeProps = (status) => {
|
|
297
323
|
let color;
|
|
@@ -320,9 +346,8 @@ const getBadgeProps = (status) => {
|
|
|
320
346
|
};
|
|
321
347
|
const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
322
348
|
const { formatMessage } = reactIntl.useIntl();
|
|
323
|
-
const IsSchedulingEnabled = window.strapi.future.isEnabled("contentReleasesScheduling");
|
|
324
349
|
if (isError) {
|
|
325
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
350
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Error, {});
|
|
326
351
|
}
|
|
327
352
|
if (releases?.length === 0) {
|
|
328
353
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -337,11 +362,11 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
337
362
|
target: sectionTitle
|
|
338
363
|
}
|
|
339
364
|
),
|
|
340
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
365
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(symbols.EmptyDocuments, { width: "16rem" })
|
|
341
366
|
}
|
|
342
367
|
);
|
|
343
368
|
}
|
|
344
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid, { gap: 4, children: releases.map(({ id, name,
|
|
369
|
+
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, { tag: reactRouterDom.NavLink, to: `${id}`, isExternal: false, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
345
370
|
designSystem.Flex,
|
|
346
371
|
{
|
|
347
372
|
direction: "column",
|
|
@@ -356,24 +381,18 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
356
381
|
gap: 4,
|
|
357
382
|
children: [
|
|
358
383
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "start", gap: 1, children: [
|
|
359
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, {
|
|
360
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children:
|
|
384
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "h3", variant: "delta", fontWeight: "bold", children: name }),
|
|
385
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: scheduledAt ? /* @__PURE__ */ jsxRuntime.jsx(RelativeTime, { timestamp: new Date(scheduledAt) }) : formatMessage({
|
|
361
386
|
id: "content-releases.pages.Releases.not-scheduled",
|
|
362
387
|
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
|
-
) })
|
|
388
|
+
}) })
|
|
370
389
|
] }),
|
|
371
390
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { ...getBadgeProps(status), children: status })
|
|
372
391
|
]
|
|
373
392
|
}
|
|
374
393
|
) }) }, id)) });
|
|
375
394
|
};
|
|
376
|
-
const StyledAlert =
|
|
395
|
+
const StyledAlert = styledComponents.styled(designSystem.Alert)`
|
|
377
396
|
button {
|
|
378
397
|
display: none;
|
|
379
398
|
}
|
|
@@ -383,10 +402,9 @@ const StyledAlert = styled__default.default(designSystem.Alert)`
|
|
|
383
402
|
`;
|
|
384
403
|
const INITIAL_FORM_VALUES = {
|
|
385
404
|
name: "",
|
|
386
|
-
date:
|
|
405
|
+
date: void 0,
|
|
387
406
|
time: "",
|
|
388
|
-
|
|
389
|
-
isScheduled: window.strapi.future.isEnabled("contentReleasesScheduling"),
|
|
407
|
+
isScheduled: true,
|
|
390
408
|
scheduledAt: null,
|
|
391
409
|
timezone: null
|
|
392
410
|
};
|
|
@@ -394,23 +412,26 @@ const ReleasesPage = () => {
|
|
|
394
412
|
const tabRef = React__namespace.useRef(null);
|
|
395
413
|
const location = reactRouterDom.useLocation();
|
|
396
414
|
const [releaseModalShown, setReleaseModalShown] = React__namespace.useState(false);
|
|
397
|
-
const toggleNotification =
|
|
415
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
398
416
|
const { formatMessage } = reactIntl.useIntl();
|
|
399
|
-
const
|
|
400
|
-
const { formatAPIError } =
|
|
401
|
-
const [{ query }, setQuery] =
|
|
417
|
+
const navigate = reactRouterDom.useNavigate();
|
|
418
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
419
|
+
const [{ query }, setQuery] = strapiAdmin.useQueryParams();
|
|
402
420
|
const response = index.useGetReleasesQuery(query);
|
|
403
421
|
const [createRelease, { isLoading: isSubmittingForm }] = index.useCreateReleaseMutation();
|
|
404
|
-
const { getFeature } =
|
|
422
|
+
const { getFeature } = ee.useLicenseLimits();
|
|
405
423
|
const { maximumReleases = 3 } = getFeature("cms-content-releases");
|
|
406
|
-
const { trackUsage } =
|
|
424
|
+
const { trackUsage } = strapiAdmin.useTracking();
|
|
425
|
+
const {
|
|
426
|
+
allowedActions: { canCreate }
|
|
427
|
+
} = strapiAdmin.useRBAC(index.PERMISSIONS);
|
|
407
428
|
const { isLoading, isSuccess, isError } = response;
|
|
408
429
|
const activeTab = response?.currentData?.meta?.activeTab || "pending";
|
|
409
430
|
const activeTabIndex = ["pending", "done"].indexOf(activeTab);
|
|
410
431
|
React__namespace.useEffect(() => {
|
|
411
432
|
if (location?.state?.errors) {
|
|
412
433
|
toggleNotification({
|
|
413
|
-
type: "
|
|
434
|
+
type: "danger",
|
|
414
435
|
title: formatMessage({
|
|
415
436
|
id: "content-releases.pages.Releases.notification.error.title",
|
|
416
437
|
defaultMessage: "Your request could not be processed."
|
|
@@ -420,9 +441,9 @@ const ReleasesPage = () => {
|
|
|
420
441
|
defaultMessage: "Please try again or open another release."
|
|
421
442
|
})
|
|
422
443
|
});
|
|
423
|
-
|
|
444
|
+
navigate("", { replace: true, state: null });
|
|
424
445
|
}
|
|
425
|
-
}, [formatMessage, location?.state?.errors,
|
|
446
|
+
}, [formatMessage, location?.state?.errors, navigate, toggleNotification]);
|
|
426
447
|
React__namespace.useEffect(() => {
|
|
427
448
|
if (tabRef.current) {
|
|
428
449
|
tabRef.current._handlers.setSelectedTabIndex(activeTabIndex);
|
|
@@ -432,7 +453,7 @@ const ReleasesPage = () => {
|
|
|
432
453
|
setReleaseModalShown((prev) => !prev);
|
|
433
454
|
};
|
|
434
455
|
if (isLoading) {
|
|
435
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
456
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
|
|
436
457
|
}
|
|
437
458
|
const totalPendingReleases = isSuccess && response.currentData?.meta?.pendingReleasesCount || 0;
|
|
438
459
|
const hasReachedMaximumPendingReleases = totalPendingReleases >= maximumReleases;
|
|
@@ -463,22 +484,22 @@ const ReleasesPage = () => {
|
|
|
463
484
|
})
|
|
464
485
|
});
|
|
465
486
|
trackUsage("didCreateRelease");
|
|
466
|
-
|
|
467
|
-
} else if (
|
|
487
|
+
navigate(response2.data.data.id.toString());
|
|
488
|
+
} else if (strapiAdmin.isFetchError(response2.error)) {
|
|
468
489
|
toggleNotification({
|
|
469
|
-
type: "
|
|
490
|
+
type: "danger",
|
|
470
491
|
message: formatAPIError(response2.error)
|
|
471
492
|
});
|
|
472
493
|
} else {
|
|
473
494
|
toggleNotification({
|
|
474
|
-
type: "
|
|
495
|
+
type: "danger",
|
|
475
496
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
476
497
|
});
|
|
477
498
|
}
|
|
478
499
|
};
|
|
479
500
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { "aria-busy": isLoading, children: [
|
|
480
501
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
481
|
-
|
|
502
|
+
strapiAdmin.Layouts.Header,
|
|
482
503
|
{
|
|
483
504
|
title: formatMessage({
|
|
484
505
|
id: "content-releases.pages.Releases.title",
|
|
@@ -488,7 +509,7 @@ const ReleasesPage = () => {
|
|
|
488
509
|
id: "content-releases.pages.Releases.header-subtitle",
|
|
489
510
|
defaultMessage: "Create and manage content updates"
|
|
490
511
|
}),
|
|
491
|
-
primaryAction:
|
|
512
|
+
primaryAction: canCreate ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
492
513
|
designSystem.Button,
|
|
493
514
|
{
|
|
494
515
|
startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Plus, {}),
|
|
@@ -499,15 +520,15 @@ const ReleasesPage = () => {
|
|
|
499
520
|
defaultMessage: "New release"
|
|
500
521
|
})
|
|
501
522
|
}
|
|
502
|
-
)
|
|
523
|
+
) : null
|
|
503
524
|
}
|
|
504
525
|
),
|
|
505
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
526
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
506
527
|
hasReachedMaximumPendingReleases && /* @__PURE__ */ jsxRuntime.jsx(
|
|
507
528
|
StyledAlert,
|
|
508
529
|
{
|
|
509
530
|
marginBottom: 6,
|
|
510
|
-
action: /* @__PURE__ */ jsxRuntime.jsx(
|
|
531
|
+
action: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Link, { href: "https://strapi.io/pricing-cloud", isExternal: true, children: formatMessage({
|
|
511
532
|
id: "content-releases.pages.Releases.max-limit-reached.action",
|
|
512
533
|
defaultMessage: "Explore plans"
|
|
513
534
|
}) }),
|
|
@@ -578,23 +599,17 @@ const ReleasesPage = () => {
|
|
|
578
599
|
]
|
|
579
600
|
}
|
|
580
601
|
),
|
|
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
|
|
602
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
603
|
+
strapiAdmin.Pagination.Root,
|
|
604
|
+
{
|
|
605
|
+
...response?.currentData?.meta?.pagination,
|
|
606
|
+
defaultPageSize: response?.currentData?.meta?.pagination?.pageSize,
|
|
607
|
+
children: [
|
|
608
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.PageSize, { options: ["8", "16", "32", "64"] }),
|
|
609
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.Links, {})
|
|
610
|
+
]
|
|
611
|
+
}
|
|
612
|
+
)
|
|
598
613
|
] }) }),
|
|
599
614
|
releaseModalShown && /* @__PURE__ */ jsxRuntime.jsx(
|
|
600
615
|
ReleaseModal,
|
|
@@ -607,13 +622,13 @@ const ReleasesPage = () => {
|
|
|
607
622
|
)
|
|
608
623
|
] });
|
|
609
624
|
};
|
|
610
|
-
const ReleaseInfoWrapper =
|
|
625
|
+
const ReleaseInfoWrapper = styledComponents.styled(designSystem.Flex)`
|
|
611
626
|
align-self: stretch;
|
|
612
627
|
border-bottom-right-radius: ${({ theme }) => theme.borderRadius};
|
|
613
628
|
border-bottom-left-radius: ${({ theme }) => theme.borderRadius};
|
|
614
629
|
border-top: 1px solid ${({ theme }) => theme.colors.neutral150};
|
|
615
630
|
`;
|
|
616
|
-
const StyledMenuItem =
|
|
631
|
+
const StyledMenuItem = styledComponents.styled(designSystem.Menu.Item)`
|
|
617
632
|
svg path {
|
|
618
633
|
fill: ${({ theme, disabled }) => disabled && theme.colors.neutral500};
|
|
619
634
|
}
|
|
@@ -622,49 +637,54 @@ const StyledMenuItem = styled__default.default(v2.Menu.Item)`
|
|
|
622
637
|
}
|
|
623
638
|
|
|
624
639
|
&:hover {
|
|
625
|
-
background: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}100`]};
|
|
640
|
+
background: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}100`]};
|
|
626
641
|
}
|
|
627
642
|
`;
|
|
628
|
-
const PencilIcon =
|
|
643
|
+
const PencilIcon = styledComponents.styled(icons.Pencil)`
|
|
629
644
|
width: ${({ theme }) => theme.spaces[3]};
|
|
630
645
|
height: ${({ theme }) => theme.spaces[3]};
|
|
631
646
|
path {
|
|
632
647
|
fill: ${({ theme }) => theme.colors.neutral600};
|
|
633
648
|
}
|
|
634
649
|
`;
|
|
635
|
-
const TrashIcon =
|
|
650
|
+
const TrashIcon = styledComponents.styled(icons.Trash)`
|
|
636
651
|
width: ${({ theme }) => theme.spaces[3]};
|
|
637
652
|
height: ${({ theme }) => theme.spaces[3]};
|
|
638
653
|
path {
|
|
639
654
|
fill: ${({ theme }) => theme.colors.danger600};
|
|
640
655
|
}
|
|
641
656
|
`;
|
|
642
|
-
const TypographyMaxWidth =
|
|
657
|
+
const TypographyMaxWidth = styledComponents.styled(designSystem.Typography)`
|
|
643
658
|
max-width: 300px;
|
|
644
659
|
`;
|
|
645
|
-
const EntryValidationText = ({ action, schema,
|
|
660
|
+
const EntryValidationText = ({ action, schema, entry }) => {
|
|
646
661
|
const { formatMessage } = reactIntl.useIntl();
|
|
647
|
-
const { validate } = strapiAdmin.unstable_useDocument(
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
662
|
+
const { validate } = strapiAdmin$1.unstable_useDocument(
|
|
663
|
+
{
|
|
664
|
+
collectionType: schema?.kind ?? "",
|
|
665
|
+
model: schema?.uid ?? ""
|
|
666
|
+
},
|
|
667
|
+
{
|
|
668
|
+
skip: !schema
|
|
669
|
+
}
|
|
670
|
+
);
|
|
671
|
+
const errors = validate(entry) ?? {};
|
|
653
672
|
if (Object.keys(errors).length > 0) {
|
|
654
673
|
const validationErrorsMessages = Object.entries(errors).map(
|
|
655
674
|
([key, value]) => formatMessage(
|
|
675
|
+
// @ts-expect-error – TODO: fix this will better checks
|
|
656
676
|
{ id: `${value.id}.withField`, defaultMessage: value.defaultMessage },
|
|
657
677
|
{ field: key }
|
|
658
678
|
)
|
|
659
679
|
).join(" ");
|
|
660
680
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
661
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
681
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.CrossCircle, { fill: "danger600" }),
|
|
662
682
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tooltip, { description: validationErrorsMessages, children: /* @__PURE__ */ jsxRuntime.jsx(TypographyMaxWidth, { textColor: "danger600", variant: "omega", fontWeight: "semiBold", ellipsis: true, children: validationErrorsMessages }) })
|
|
663
683
|
] });
|
|
664
684
|
}
|
|
665
685
|
if (action == "publish") {
|
|
666
686
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
667
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
687
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
|
668
688
|
entry.publishedAt ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "success600", fontWeight: "bold", children: formatMessage({
|
|
669
689
|
id: "content-releases.pages.ReleaseDetails.entry-validation.already-published",
|
|
670
690
|
defaultMessage: "Already published"
|
|
@@ -675,7 +695,7 @@ const EntryValidationText = ({ action, schema, components, entry }) => {
|
|
|
675
695
|
] });
|
|
676
696
|
}
|
|
677
697
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
678
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
698
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
|
679
699
|
!entry.publishedAt ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "success600", fontWeight: "bold", children: formatMessage({
|
|
680
700
|
id: "content-releases.pages.ReleaseDetails.entry-validation.already-unpublished",
|
|
681
701
|
defaultMessage: "Already unpublished"
|
|
@@ -695,20 +715,23 @@ const ReleaseDetailsLayout = ({
|
|
|
695
715
|
const {
|
|
696
716
|
data,
|
|
697
717
|
isLoading: isLoadingDetails,
|
|
698
|
-
isError,
|
|
699
718
|
error
|
|
700
|
-
} = index.useGetReleaseQuery(
|
|
719
|
+
} = index.useGetReleaseQuery(
|
|
720
|
+
{ id: releaseId },
|
|
721
|
+
{
|
|
722
|
+
skip: !releaseId
|
|
723
|
+
}
|
|
724
|
+
);
|
|
701
725
|
const [publishRelease, { isLoading: isPublishing }] = index.usePublishReleaseMutation();
|
|
702
|
-
const toggleNotification =
|
|
703
|
-
const { formatAPIError } =
|
|
704
|
-
const {
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
const
|
|
708
|
-
const { trackUsage } = helperPlugin.useTracking();
|
|
726
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
727
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
728
|
+
const { allowedActions } = strapiAdmin.useRBAC(index.PERMISSIONS);
|
|
729
|
+
const { canUpdate, canDelete, canPublish } = allowedActions;
|
|
730
|
+
const dispatch = useTypedDispatch();
|
|
731
|
+
const { trackUsage } = strapiAdmin.useTracking();
|
|
709
732
|
const release = data?.data;
|
|
710
|
-
const handlePublishRelease = async () => {
|
|
711
|
-
const response = await publishRelease({ id
|
|
733
|
+
const handlePublishRelease = (id) => async () => {
|
|
734
|
+
const response = await publishRelease({ id });
|
|
712
735
|
if ("data" in response) {
|
|
713
736
|
toggleNotification({
|
|
714
737
|
type: "success",
|
|
@@ -723,20 +746,25 @@ const ReleaseDetailsLayout = ({
|
|
|
723
746
|
totalPublishedEntries,
|
|
724
747
|
totalUnpublishedEntries
|
|
725
748
|
});
|
|
726
|
-
} else if (
|
|
749
|
+
} else if (strapiAdmin.isFetchError(response.error)) {
|
|
727
750
|
toggleNotification({
|
|
728
|
-
type: "
|
|
751
|
+
type: "danger",
|
|
729
752
|
message: formatAPIError(response.error)
|
|
730
753
|
});
|
|
731
754
|
} else {
|
|
732
755
|
toggleNotification({
|
|
733
|
-
type: "
|
|
756
|
+
type: "danger",
|
|
734
757
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
735
758
|
});
|
|
736
759
|
}
|
|
737
760
|
};
|
|
738
761
|
const handleRefresh = () => {
|
|
739
|
-
dispatch(
|
|
762
|
+
dispatch(
|
|
763
|
+
index.releaseApi.util.invalidateTags([
|
|
764
|
+
{ type: "ReleaseAction", id: "LIST" },
|
|
765
|
+
{ type: "Release", id: releaseId }
|
|
766
|
+
])
|
|
767
|
+
);
|
|
740
768
|
};
|
|
741
769
|
const getCreatedByUser = () => {
|
|
742
770
|
if (!release?.createdBy) {
|
|
@@ -751,28 +779,26 @@ const ReleaseDetailsLayout = ({
|
|
|
751
779
|
return release.createdBy.email;
|
|
752
780
|
};
|
|
753
781
|
if (isLoadingDetails) {
|
|
754
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
782
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
|
|
755
783
|
}
|
|
756
|
-
if (
|
|
784
|
+
if (isBaseQueryError(error) && "code" in error || !release) {
|
|
757
785
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
758
|
-
reactRouterDom.
|
|
786
|
+
reactRouterDom.Navigate,
|
|
759
787
|
{
|
|
760
|
-
to:
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
}
|
|
788
|
+
to: "..",
|
|
789
|
+
state: {
|
|
790
|
+
errors: [
|
|
791
|
+
{
|
|
792
|
+
// @ts-expect-error – TODO: fix this weird error flow
|
|
793
|
+
code: error?.code
|
|
794
|
+
}
|
|
795
|
+
]
|
|
769
796
|
}
|
|
770
797
|
}
|
|
771
798
|
);
|
|
772
799
|
}
|
|
773
800
|
const totalEntries = release.actions.meta.count || 0;
|
|
774
801
|
const hasCreatedByUser = Boolean(getCreatedByUser());
|
|
775
|
-
const IsSchedulingEnabled = window.strapi.future.isEnabled("contentReleasesScheduling");
|
|
776
802
|
const isScheduled = release.scheduledAt && release.timezone;
|
|
777
803
|
const numberOfEntriesText = formatMessage(
|
|
778
804
|
{
|
|
@@ -803,34 +829,30 @@ const ReleaseDetailsLayout = ({
|
|
|
803
829
|
) : "";
|
|
804
830
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { "aria-busy": isLoadingDetails, children: [
|
|
805
831
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
806
|
-
|
|
832
|
+
strapiAdmin.Layouts.Header,
|
|
807
833
|
{
|
|
808
834
|
title: release.name,
|
|
809
835
|
subtitle: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, lineHeight: 6, children: [
|
|
810
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", variant: "epsilon", children: numberOfEntriesText + (
|
|
836
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", variant: "epsilon", children: numberOfEntriesText + (isScheduled ? ` - ${scheduledText}` : "") }),
|
|
811
837
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { ...getBadgeProps(release.status), children: release.status })
|
|
812
838
|
] }),
|
|
813
|
-
navigationAction: /* @__PURE__ */ jsxRuntime.jsx(
|
|
814
|
-
id: "global.back",
|
|
815
|
-
defaultMessage: "Back"
|
|
816
|
-
}) }),
|
|
839
|
+
navigationAction: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.BackButton, {}),
|
|
817
840
|
primaryAction: !release.releasedAt && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
818
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
841
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Root, { children: [
|
|
819
842
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
820
|
-
|
|
843
|
+
designSystem.Menu.Trigger,
|
|
821
844
|
{
|
|
822
|
-
as: designSystem.IconButton,
|
|
823
845
|
paddingLeft: 2,
|
|
824
846
|
paddingRight: 2,
|
|
825
847
|
"aria-label": formatMessage({
|
|
826
848
|
id: "content-releases.header.actions.open-release-actions",
|
|
827
849
|
defaultMessage: "Release edit and delete menu"
|
|
828
850
|
}),
|
|
829
|
-
|
|
830
|
-
|
|
851
|
+
variant: "tertiary",
|
|
852
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(icons.More, {})
|
|
831
853
|
}
|
|
832
854
|
),
|
|
833
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
855
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Content, { top: 1, popoverPlacement: "bottom-end", maxHeight: void 0, children: [
|
|
834
856
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
835
857
|
designSystem.Flex,
|
|
836
858
|
{
|
|
@@ -852,7 +874,7 @@ const ReleaseDetailsLayout = ({
|
|
|
852
874
|
{
|
|
853
875
|
disabled: !canDelete,
|
|
854
876
|
onSelect: toggleWarningSubmit,
|
|
855
|
-
variant: "danger",
|
|
877
|
+
$variant: "danger",
|
|
856
878
|
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 2, hasRadius: true, width: "100%", children: [
|
|
857
879
|
/* @__PURE__ */ jsxRuntime.jsx(TrashIcon, {}),
|
|
858
880
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { ellipsis: true, textColor: "danger600", children: formatMessage({
|
|
@@ -879,7 +901,7 @@ const ReleaseDetailsLayout = ({
|
|
|
879
901
|
defaultMessage: "Created"
|
|
880
902
|
}) }),
|
|
881
903
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", color: "neutral300", children: [
|
|
882
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
904
|
+
/* @__PURE__ */ jsxRuntime.jsx(RelativeTime$1, { timestamp: new Date(release.createdAt) }),
|
|
883
905
|
formatMessage(
|
|
884
906
|
{
|
|
885
907
|
id: "content-releases.header.actions.created.description",
|
|
@@ -897,12 +919,12 @@ const ReleaseDetailsLayout = ({
|
|
|
897
919
|
id: "content-releases.header.actions.refresh",
|
|
898
920
|
defaultMessage: "Refresh"
|
|
899
921
|
}) }),
|
|
900
|
-
|
|
922
|
+
canPublish ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
901
923
|
designSystem.Button,
|
|
902
924
|
{
|
|
903
925
|
size: "S",
|
|
904
926
|
variant: "default",
|
|
905
|
-
onClick: handlePublishRelease,
|
|
927
|
+
onClick: handlePublishRelease(release.id.toString()),
|
|
906
928
|
loading: isPublishing,
|
|
907
929
|
disabled: release.actions.meta.count === 0,
|
|
908
930
|
children: formatMessage({
|
|
@@ -910,7 +932,7 @@ const ReleaseDetailsLayout = ({
|
|
|
910
932
|
defaultMessage: "Publish"
|
|
911
933
|
})
|
|
912
934
|
}
|
|
913
|
-
)
|
|
935
|
+
) : null
|
|
914
936
|
] })
|
|
915
937
|
}
|
|
916
938
|
),
|
|
@@ -918,6 +940,7 @@ const ReleaseDetailsLayout = ({
|
|
|
918
940
|
] });
|
|
919
941
|
};
|
|
920
942
|
const GROUP_BY_OPTIONS = ["contentType", "locale", "action"];
|
|
943
|
+
const GROUP_BY_OPTIONS_NO_LOCALE = ["contentType", "action"];
|
|
921
944
|
const getGroupByOptionLabel = (value) => {
|
|
922
945
|
if (value === "locale") {
|
|
923
946
|
return {
|
|
@@ -936,21 +959,33 @@ const getGroupByOptionLabel = (value) => {
|
|
|
936
959
|
defaultMessage: "Content-Types"
|
|
937
960
|
};
|
|
938
961
|
};
|
|
939
|
-
const ReleaseDetailsBody = () => {
|
|
962
|
+
const ReleaseDetailsBody = ({ releaseId }) => {
|
|
940
963
|
const { formatMessage } = reactIntl.useIntl();
|
|
941
|
-
const {
|
|
942
|
-
const
|
|
943
|
-
const
|
|
944
|
-
const { formatAPIError } = helperPlugin.useAPIErrorHandler();
|
|
964
|
+
const [{ query }, setQuery] = strapiAdmin.useQueryParams();
|
|
965
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
966
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
945
967
|
const {
|
|
946
968
|
data: releaseData,
|
|
947
969
|
isLoading: isReleaseLoading,
|
|
948
|
-
isError: isReleaseError,
|
|
949
970
|
error: releaseError
|
|
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 {
|
|
@@ -979,65 +1014,59 @@ const ReleaseDetailsBody = () => {
|
|
|
979
1014
|
// We are passing the action path to found the position in the cache of the action for optimistic updates
|
|
980
1015
|
});
|
|
981
1016
|
if ("error" in response) {
|
|
982
|
-
if (
|
|
1017
|
+
if (strapiAdmin.isFetchError(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;
|
|
1000
1035
|
const contentTypes = releaseMeta?.contentTypes || {};
|
|
1001
1036
|
const components = releaseMeta?.components || {};
|
|
1002
|
-
if (
|
|
1037
|
+
if (isBaseQueryError(releaseError) || !release) {
|
|
1003
1038
|
const errorsArray = [];
|
|
1004
|
-
if (releaseError) {
|
|
1039
|
+
if (releaseError && "code" in releaseError) {
|
|
1005
1040
|
errorsArray.push({
|
|
1006
1041
|
code: releaseError.code
|
|
1007
1042
|
});
|
|
1008
1043
|
}
|
|
1009
|
-
if (releaseActionsError) {
|
|
1044
|
+
if (releaseActionsError && "code" in releaseActionsError) {
|
|
1010
1045
|
errorsArray.push({
|
|
1011
1046
|
code: releaseActionsError.code
|
|
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
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1031
|
-
|
|
1063
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
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
|
+
tag: reactRouterDom.Link,
|
|
1041
1070
|
to: {
|
|
1042
1071
|
pathname: "/content-manager"
|
|
1043
1072
|
},
|
|
@@ -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
|
}
|
|
1055
|
-
|
|
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;
|
|
1127
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Layouts.Content, { 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") : void 0;
|
|
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
|
});
|
|
1268
|
-
|
|
1289
|
+
toggleEditReleaseModal();
|
|
1290
|
+
} else if (strapiAdmin.isFetchError(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
|
-
|
|
1287
|
-
} else if (
|
|
1307
|
+
navigate("..");
|
|
1308
|
+
} else if (strapiAdmin.isFetchError(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-DUmziQ17.js.map
|