@strapi/content-releases 4.20.4 → 5.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{App-6ugQxqYE.mjs → App-dbdAcsz_.mjs} +296 -296
- package/dist/_chunks/App-dbdAcsz_.mjs.map +1 -0
- package/dist/_chunks/{App-P1kyM3gT.js → App-zwe_jKPv.js} +301 -301
- package/dist/_chunks/App-zwe_jKPv.js.map +1 -0
- package/dist/_chunks/{en-WuuhP6Bn.mjs → en-RdapH-9X.mjs} +1 -2
- package/dist/_chunks/en-RdapH-9X.mjs.map +1 -0
- package/dist/_chunks/{en-gcJJ5htG.js → en-faJDuv3q.js} +1 -2
- package/dist/_chunks/en-faJDuv3q.js.map +1 -0
- package/dist/_chunks/{index-_eBuegHN.mjs → index-RBaVMtyr.mjs} +79 -70
- package/dist/_chunks/index-RBaVMtyr.mjs.map +1 -0
- package/dist/_chunks/{index-2xzbhaQP.js → index-TBrVNrv9.js} +77 -68
- package/dist/_chunks/index-TBrVNrv9.js.map +1 -0
- package/dist/admin/index.js +1 -14
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +1 -14
- package/dist/admin/index.mjs.map +1 -1
- package/dist/admin/src/components/CMReleasesContainer.d.ts +1 -0
- package/dist/admin/src/components/RelativeTime.d.ts +28 -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/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 +369 -0
- package/dist/admin/src/store/hooks.d.ts +7 -0
- package/dist/admin/src/utils/time.d.ts +1 -0
- package/dist/server/index.js +327 -234
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +328 -234
- 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 +19 -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 +11 -0
- package/dist/server/src/controllers/release.d.ts.map +1 -0
- package/dist/server/src/controllers/validation/release-action.d.ts +3 -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 +2095 -0
- package/dist/server/src/index.d.ts.map +1 -0
- package/dist/server/src/migrations/index.d.ts +12 -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 +166 -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 +24 -30
- package/dist/_chunks/App-6ugQxqYE.mjs.map +0 -1
- package/dist/_chunks/App-P1kyM3gT.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-2xzbhaQP.js.map +0 -1
- package/dist/_chunks/index-_eBuegHN.mjs.map +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
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-TBrVNrv9.js");
|
|
7
7
|
const React = require("react");
|
|
8
|
-
const strapiAdmin = require("@strapi/admin/strapi-admin");
|
|
9
8
|
const designSystem = require("@strapi/design-system");
|
|
10
9
|
const v2 = require("@strapi/design-system/v2");
|
|
10
|
+
const helperPlugin = require("@strapi/helper-plugin");
|
|
11
11
|
const icons = require("@strapi/icons");
|
|
12
12
|
const format = require("date-fns/format");
|
|
13
13
|
const dateFnsTz = require("date-fns-tz");
|
|
@@ -16,10 +16,6 @@ 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("@reduxjs/toolkit/query");
|
|
20
|
-
require("axios");
|
|
21
|
-
require("@reduxjs/toolkit/query/react");
|
|
22
|
-
require("react-redux");
|
|
23
19
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
24
20
|
function _interopNamespace(e) {
|
|
25
21
|
if (e && e.__esModule)
|
|
@@ -43,6 +39,36 @@ const React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
|
|
43
39
|
const format__default = /* @__PURE__ */ _interopDefault(format);
|
|
44
40
|
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
45
41
|
const yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
|
|
42
|
+
const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
|
|
43
|
+
const RelativeTime = React__namespace.forwardRef(
|
|
44
|
+
({ timestamp, customIntervals = [], ...restProps }, forwardedRef) => {
|
|
45
|
+
const { formatRelativeTime, formatDate, formatTime } = reactIntl.useIntl();
|
|
46
|
+
const interval = dateFns.intervalToDuration({
|
|
47
|
+
start: timestamp,
|
|
48
|
+
end: Date.now()
|
|
49
|
+
// see https://github.com/date-fns/date-fns/issues/2891 – No idea why it's all partial it returns it every time.
|
|
50
|
+
});
|
|
51
|
+
const unit = intervals.find((intervalUnit) => {
|
|
52
|
+
return interval[intervalUnit] > 0 && Object.keys(interval).includes(intervalUnit);
|
|
53
|
+
});
|
|
54
|
+
const relativeTime = dateFns.isPast(timestamp) ? -interval[unit] : interval[unit];
|
|
55
|
+
const customInterval = customIntervals.find(
|
|
56
|
+
(custom) => interval[custom.unit] < custom.threshold
|
|
57
|
+
);
|
|
58
|
+
const displayText = customInterval ? customInterval.text : formatRelativeTime(relativeTime, unit, { numeric: "auto" });
|
|
59
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
60
|
+
"time",
|
|
61
|
+
{
|
|
62
|
+
ref: forwardedRef,
|
|
63
|
+
dateTime: timestamp.toISOString(),
|
|
64
|
+
role: "time",
|
|
65
|
+
title: `${formatDate(timestamp)} ${formatTime(timestamp)}`,
|
|
66
|
+
...restProps,
|
|
67
|
+
children: displayText
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
);
|
|
46
72
|
const RELEASE_SCHEMA = yup__namespace.object().shape({
|
|
47
73
|
name: yup__namespace.string().trim().required(),
|
|
48
74
|
scheduledAt: yup__namespace.string().nullable(),
|
|
@@ -72,7 +98,6 @@ const ReleaseModal = ({
|
|
|
72
98
|
const { formatMessage } = reactIntl.useIntl();
|
|
73
99
|
const { pathname } = reactRouterDom.useLocation();
|
|
74
100
|
const isCreatingRelease = pathname === `/plugins/${index.pluginId}`;
|
|
75
|
-
const IsSchedulingEnabled = window.strapi.future.isEnabled("contentReleasesScheduling");
|
|
76
101
|
const { timezoneList, systemTimezone = { value: "UTC+00:00-Africa/Abidjan " } } = getTimezones(
|
|
77
102
|
initialValues.scheduledAt ? new Date(initialValues.scheduledAt) : /* @__PURE__ */ new Date()
|
|
78
103
|
);
|
|
@@ -81,12 +106,12 @@ const ReleaseModal = ({
|
|
|
81
106
|
if (!date || !time || !timezone)
|
|
82
107
|
return null;
|
|
83
108
|
const formattedDate = dateFns.parse(time, "HH:mm", new Date(date));
|
|
84
|
-
const timezoneWithoutOffset = timezone.split("
|
|
109
|
+
const timezoneWithoutOffset = timezone.split("&")[1];
|
|
85
110
|
return dateFnsTz.zonedTimeToUtc(formattedDate, timezoneWithoutOffset);
|
|
86
111
|
};
|
|
87
112
|
const getTimezoneWithOffset = () => {
|
|
88
113
|
const currentTimezone = timezoneList.find(
|
|
89
|
-
(timezone) => timezone.value.split("
|
|
114
|
+
(timezone) => timezone.value.split("&")[1] === initialValues.timezone
|
|
90
115
|
);
|
|
91
116
|
return currentTimezone?.value || systemTimezone.value;
|
|
92
117
|
};
|
|
@@ -104,7 +129,7 @@ const ReleaseModal = ({
|
|
|
104
129
|
onSubmit: (values) => {
|
|
105
130
|
handleSubmit({
|
|
106
131
|
...values,
|
|
107
|
-
timezone: values.timezone ? values.timezone.split("
|
|
132
|
+
timezone: values.timezone ? values.timezone.split("&")[1] : null,
|
|
108
133
|
scheduledAt: values.isScheduled ? getScheduledTimestamp(values) : null
|
|
109
134
|
});
|
|
110
135
|
},
|
|
@@ -130,92 +155,88 @@ const ReleaseModal = ({
|
|
|
130
155
|
required: true
|
|
131
156
|
}
|
|
132
157
|
),
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
158
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "max-content", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
159
|
+
designSystem.Checkbox,
|
|
160
|
+
{
|
|
161
|
+
name: "isScheduled",
|
|
162
|
+
value: values.isScheduled,
|
|
163
|
+
onChange: (event) => {
|
|
164
|
+
setFieldValue("isScheduled", event.target.checked);
|
|
165
|
+
if (!event.target.checked) {
|
|
166
|
+
setFieldValue("date", null);
|
|
167
|
+
setFieldValue("time", "");
|
|
168
|
+
setFieldValue("timezone", null);
|
|
169
|
+
} else {
|
|
170
|
+
setFieldValue("date", initialValues.date);
|
|
171
|
+
setFieldValue("time", initialValues.time);
|
|
172
|
+
setFieldValue("timezone", initialValues.timezone ?? systemTimezone?.value);
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
176
|
+
designSystem.Typography,
|
|
177
|
+
{
|
|
178
|
+
textColor: values.isScheduled ? "primary600" : "neutral800",
|
|
179
|
+
fontWeight: values.isScheduled ? "semiBold" : "regular",
|
|
180
|
+
children: formatMessage({
|
|
181
|
+
id: "modal.form.input.label.schedule-release",
|
|
182
|
+
defaultMessage: "Schedule release"
|
|
183
|
+
})
|
|
184
|
+
}
|
|
185
|
+
)
|
|
186
|
+
}
|
|
187
|
+
) }),
|
|
188
|
+
values.isScheduled && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
189
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, alignItems: "start", children: [
|
|
190
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
191
|
+
designSystem.DatePicker,
|
|
192
|
+
{
|
|
193
|
+
label: formatMessage({
|
|
194
|
+
id: "content-releases.modal.form.input.label.date",
|
|
195
|
+
defaultMessage: "Date"
|
|
196
|
+
}),
|
|
197
|
+
name: "date",
|
|
198
|
+
error: errors.date,
|
|
199
|
+
onChange: (date) => {
|
|
200
|
+
const isoFormatDate = date ? dateFns.formatISO(date, { representation: "date" }) : null;
|
|
201
|
+
setFieldValue("date", isoFormatDate);
|
|
202
|
+
},
|
|
203
|
+
clearLabel: formatMessage({
|
|
204
|
+
id: "content-releases.modal.form.input.clearLabel",
|
|
205
|
+
defaultMessage: "Clear"
|
|
206
|
+
}),
|
|
207
|
+
onClear: () => {
|
|
142
208
|
setFieldValue("date", null);
|
|
209
|
+
},
|
|
210
|
+
selectedDate: values.date || void 0,
|
|
211
|
+
required: true,
|
|
212
|
+
minDate: dateFnsTz.utcToZonedTime(/* @__PURE__ */ new Date(), values.timezone.split("&")[1])
|
|
213
|
+
}
|
|
214
|
+
) }),
|
|
215
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
216
|
+
designSystem.TimePicker,
|
|
217
|
+
{
|
|
218
|
+
label: formatMessage({
|
|
219
|
+
id: "content-releases.modal.form.input.label.time",
|
|
220
|
+
defaultMessage: "Time"
|
|
221
|
+
}),
|
|
222
|
+
name: "time",
|
|
223
|
+
error: errors.time,
|
|
224
|
+
onChange: (time) => {
|
|
225
|
+
setFieldValue("time", time);
|
|
226
|
+
},
|
|
227
|
+
clearLabel: formatMessage({
|
|
228
|
+
id: "content-releases.modal.form.input.clearLabel",
|
|
229
|
+
defaultMessage: "Clear"
|
|
230
|
+
}),
|
|
231
|
+
onClear: () => {
|
|
143
232
|
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
|
-
}
|
|
192
|
-
) }),
|
|
193
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
194
|
-
designSystem.TimePicker,
|
|
195
|
-
{
|
|
196
|
-
label: formatMessage({
|
|
197
|
-
id: "content-releases.modal.form.input.label.time",
|
|
198
|
-
defaultMessage: "Time"
|
|
199
|
-
}),
|
|
200
|
-
name: "time",
|
|
201
|
-
error: errors.time,
|
|
202
|
-
onChange: (time) => {
|
|
203
|
-
setFieldValue("time", time);
|
|
204
|
-
},
|
|
205
|
-
clearLabel: formatMessage({
|
|
206
|
-
id: "content-releases.modal.form.input.clearLabel",
|
|
207
|
-
defaultMessage: "Clear"
|
|
208
|
-
}),
|
|
209
|
-
onClear: () => {
|
|
210
|
-
setFieldValue("time", "");
|
|
211
|
-
},
|
|
212
|
-
value: values.time || void 0,
|
|
213
|
-
required: true
|
|
214
|
-
}
|
|
215
|
-
) })
|
|
216
|
-
] }),
|
|
217
|
-
/* @__PURE__ */ jsxRuntime.jsx(TimezoneComponent, { timezoneOptions: timezoneList })
|
|
218
|
-
] })
|
|
233
|
+
},
|
|
234
|
+
value: values.time || void 0,
|
|
235
|
+
required: true
|
|
236
|
+
}
|
|
237
|
+
) })
|
|
238
|
+
] }),
|
|
239
|
+
/* @__PURE__ */ jsxRuntime.jsx(TimezoneComponent, { timezoneOptions: timezoneList })
|
|
219
240
|
] })
|
|
220
241
|
] }) }),
|
|
221
242
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -239,10 +260,10 @@ const ReleaseModal = ({
|
|
|
239
260
|
const getTimezones = (selectedDate) => {
|
|
240
261
|
const timezoneList = Intl.supportedValuesOf("timeZone").map((timezone) => {
|
|
241
262
|
const utcOffset = index.getTimezoneOffset(timezone, selectedDate);
|
|
242
|
-
return { offset: utcOffset, value: `${utcOffset}
|
|
263
|
+
return { offset: utcOffset, value: `${utcOffset}&${timezone}` };
|
|
243
264
|
});
|
|
244
265
|
const systemTimezone = timezoneList.find(
|
|
245
|
-
(timezone) => timezone.value.split("
|
|
266
|
+
(timezone) => timezone.value.split("&")[1] === Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
246
267
|
);
|
|
247
268
|
return { timezoneList, systemTimezone };
|
|
248
269
|
};
|
|
@@ -254,7 +275,7 @@ const TimezoneComponent = ({ timezoneOptions }) => {
|
|
|
254
275
|
if (values.date) {
|
|
255
276
|
const { timezoneList: timezoneList2 } = getTimezones(new Date(values.date));
|
|
256
277
|
setTimezoneList(timezoneList2);
|
|
257
|
-
const updatedTimezone = values.timezone && timezoneList2.find((tz) => tz.value.split("
|
|
278
|
+
const updatedTimezone = values.timezone && timezoneList2.find((tz) => tz.value.split("&")[1] === values.timezone.split("&")[1]);
|
|
258
279
|
if (updatedTimezone) {
|
|
259
280
|
setFieldValue("timezone", updatedTimezone.value);
|
|
260
281
|
}
|
|
@@ -267,9 +288,10 @@ const TimezoneComponent = ({ timezoneOptions }) => {
|
|
|
267
288
|
id: "content-releases.modal.form.input.label.timezone",
|
|
268
289
|
defaultMessage: "Timezone"
|
|
269
290
|
}),
|
|
291
|
+
autocomplete: { type: "list", filter: "contains" },
|
|
270
292
|
name: "timezone",
|
|
271
293
|
value: values.timezone || void 0,
|
|
272
|
-
textValue: values.timezone ? values.timezone.replace(
|
|
294
|
+
textValue: values.timezone ? values.timezone.replace(/&/, " ") : void 0,
|
|
273
295
|
onChange: (timezone) => {
|
|
274
296
|
setFieldValue("timezone", timezone);
|
|
275
297
|
},
|
|
@@ -281,14 +303,14 @@ const TimezoneComponent = ({ timezoneOptions }) => {
|
|
|
281
303
|
},
|
|
282
304
|
error: errors.timezone,
|
|
283
305
|
required: true,
|
|
284
|
-
children: timezoneList.map((timezone) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.ComboboxOption, { value: timezone.value, children: timezone.value.replace(
|
|
306
|
+
children: timezoneList.map((timezone) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.ComboboxOption, { value: timezone.value, children: timezone.value.replace(/&/, " ") }, timezone.value))
|
|
285
307
|
}
|
|
286
308
|
);
|
|
287
309
|
};
|
|
288
310
|
const LinkCard = styled__default.default(v2.Link)`
|
|
289
311
|
display: block;
|
|
290
312
|
`;
|
|
291
|
-
const CapitalizeRelativeTime = styled__default.default(
|
|
313
|
+
const CapitalizeRelativeTime = styled__default.default(RelativeTime)`
|
|
292
314
|
text-transform: capitalize;
|
|
293
315
|
`;
|
|
294
316
|
const getBadgeProps = (status) => {
|
|
@@ -318,9 +340,8 @@ const getBadgeProps = (status) => {
|
|
|
318
340
|
};
|
|
319
341
|
const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
320
342
|
const { formatMessage } = reactIntl.useIntl();
|
|
321
|
-
const IsSchedulingEnabled = window.strapi.future.isEnabled("contentReleasesScheduling");
|
|
322
343
|
if (isError) {
|
|
323
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
344
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Error, {});
|
|
324
345
|
}
|
|
325
346
|
if (releases?.length === 0) {
|
|
326
347
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -339,7 +360,7 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
339
360
|
}
|
|
340
361
|
);
|
|
341
362
|
}
|
|
342
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid, { gap: 4, children: releases.map(({ id, name,
|
|
363
|
+
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(
|
|
343
364
|
designSystem.Flex,
|
|
344
365
|
{
|
|
345
366
|
direction: "column",
|
|
@@ -355,16 +376,10 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
355
376
|
children: [
|
|
356
377
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "start", gap: 1, children: [
|
|
357
378
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { as: "h3", variant: "delta", fontWeight: "bold", children: name }),
|
|
358
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children:
|
|
379
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: scheduledAt ? /* @__PURE__ */ jsxRuntime.jsx(CapitalizeRelativeTime, { timestamp: new Date(scheduledAt) }) : formatMessage({
|
|
359
380
|
id: "content-releases.pages.Releases.not-scheduled",
|
|
360
381
|
defaultMessage: "Not scheduled"
|
|
361
|
-
})
|
|
362
|
-
{
|
|
363
|
-
id: "content-releases.page.Releases.release-item.entries",
|
|
364
|
-
defaultMessage: "{number, plural, =0 {No entries} one {# entry} other {# entries}}"
|
|
365
|
-
},
|
|
366
|
-
{ number: actions.meta.count }
|
|
367
|
-
) })
|
|
382
|
+
}) })
|
|
368
383
|
] }),
|
|
369
384
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { ...getBadgeProps(status), children: status })
|
|
370
385
|
]
|
|
@@ -383,8 +398,7 @@ const INITIAL_FORM_VALUES = {
|
|
|
383
398
|
name: "",
|
|
384
399
|
date: null,
|
|
385
400
|
time: "",
|
|
386
|
-
|
|
387
|
-
isScheduled: window.strapi.future.isEnabled("contentReleasesScheduling"),
|
|
401
|
+
isScheduled: true,
|
|
388
402
|
scheduledAt: null,
|
|
389
403
|
timezone: null
|
|
390
404
|
};
|
|
@@ -392,23 +406,26 @@ const ReleasesPage = () => {
|
|
|
392
406
|
const tabRef = React__namespace.useRef(null);
|
|
393
407
|
const location = reactRouterDom.useLocation();
|
|
394
408
|
const [releaseModalShown, setReleaseModalShown] = React__namespace.useState(false);
|
|
395
|
-
const toggleNotification =
|
|
409
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
396
410
|
const { formatMessage } = reactIntl.useIntl();
|
|
397
|
-
const
|
|
398
|
-
const { formatAPIError } =
|
|
411
|
+
const navigate = reactRouterDom.useNavigate();
|
|
412
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
399
413
|
const [{ query }, setQuery] = helperPlugin.useQueryParams();
|
|
400
414
|
const response = index.useGetReleasesQuery(query);
|
|
401
415
|
const [createRelease, { isLoading: isSubmittingForm }] = index.useCreateReleaseMutation();
|
|
402
416
|
const { getFeature } = strapiAdmin.useLicenseLimits();
|
|
403
417
|
const { maximumReleases = 3 } = getFeature("cms-content-releases");
|
|
404
|
-
const { trackUsage } =
|
|
418
|
+
const { trackUsage } = strapiAdmin.useTracking();
|
|
419
|
+
const {
|
|
420
|
+
allowedActions: { canCreate }
|
|
421
|
+
} = helperPlugin.useRBAC(index.PERMISSIONS);
|
|
405
422
|
const { isLoading, isSuccess, isError } = response;
|
|
406
423
|
const activeTab = response?.currentData?.meta?.activeTab || "pending";
|
|
407
424
|
const activeTabIndex = ["pending", "done"].indexOf(activeTab);
|
|
408
425
|
React__namespace.useEffect(() => {
|
|
409
426
|
if (location?.state?.errors) {
|
|
410
427
|
toggleNotification({
|
|
411
|
-
type: "
|
|
428
|
+
type: "danger",
|
|
412
429
|
title: formatMessage({
|
|
413
430
|
id: "content-releases.pages.Releases.notification.error.title",
|
|
414
431
|
defaultMessage: "Your request could not be processed."
|
|
@@ -418,9 +435,9 @@ const ReleasesPage = () => {
|
|
|
418
435
|
defaultMessage: "Please try again or open another release."
|
|
419
436
|
})
|
|
420
437
|
});
|
|
421
|
-
|
|
438
|
+
navigate("", { replace: true, state: null });
|
|
422
439
|
}
|
|
423
|
-
}, [formatMessage, location?.state?.errors,
|
|
440
|
+
}, [formatMessage, location?.state?.errors, navigate, toggleNotification]);
|
|
424
441
|
React__namespace.useEffect(() => {
|
|
425
442
|
if (tabRef.current) {
|
|
426
443
|
tabRef.current._handlers.setSelectedTabIndex(activeTabIndex);
|
|
@@ -430,7 +447,7 @@ const ReleasesPage = () => {
|
|
|
430
447
|
setReleaseModalShown((prev) => !prev);
|
|
431
448
|
};
|
|
432
449
|
if (isLoading) {
|
|
433
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
450
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
|
|
434
451
|
}
|
|
435
452
|
const totalPendingReleases = isSuccess && response.currentData?.meta?.pendingReleasesCount || 0;
|
|
436
453
|
const hasReachedMaximumPendingReleases = totalPendingReleases >= maximumReleases;
|
|
@@ -461,15 +478,15 @@ const ReleasesPage = () => {
|
|
|
461
478
|
})
|
|
462
479
|
});
|
|
463
480
|
trackUsage("didCreateRelease");
|
|
464
|
-
|
|
481
|
+
navigate(response2.data.data.id.toString());
|
|
465
482
|
} else if (index.isAxiosError(response2.error)) {
|
|
466
483
|
toggleNotification({
|
|
467
|
-
type: "
|
|
484
|
+
type: "danger",
|
|
468
485
|
message: formatAPIError(response2.error)
|
|
469
486
|
});
|
|
470
487
|
} else {
|
|
471
488
|
toggleNotification({
|
|
472
|
-
type: "
|
|
489
|
+
type: "danger",
|
|
473
490
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
474
491
|
});
|
|
475
492
|
}
|
|
@@ -486,7 +503,7 @@ const ReleasesPage = () => {
|
|
|
486
503
|
id: "content-releases.pages.Releases.header-subtitle",
|
|
487
504
|
defaultMessage: "Create and manage content updates"
|
|
488
505
|
}),
|
|
489
|
-
primaryAction:
|
|
506
|
+
primaryAction: canCreate ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
490
507
|
designSystem.Button,
|
|
491
508
|
{
|
|
492
509
|
startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Plus, {}),
|
|
@@ -497,7 +514,7 @@ const ReleasesPage = () => {
|
|
|
497
514
|
defaultMessage: "New release"
|
|
498
515
|
})
|
|
499
516
|
}
|
|
500
|
-
)
|
|
517
|
+
) : null
|
|
501
518
|
}
|
|
502
519
|
),
|
|
503
520
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.ContentLayout, { children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -576,23 +593,17 @@ const ReleasesPage = () => {
|
|
|
576
593
|
]
|
|
577
594
|
}
|
|
578
595
|
),
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
pagination: {
|
|
591
|
-
pageCount: response?.currentData?.meta?.pagination?.pageCount || 0
|
|
592
|
-
}
|
|
593
|
-
}
|
|
594
|
-
)
|
|
595
|
-
] }) : null
|
|
596
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
597
|
+
strapiAdmin.Pagination.Root,
|
|
598
|
+
{
|
|
599
|
+
...response?.currentData?.meta?.pagination,
|
|
600
|
+
defaultPageSize: response?.currentData?.meta?.pagination?.pageSize,
|
|
601
|
+
children: [
|
|
602
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.PageSize, { options: ["8", "16", "32", "64"] }),
|
|
603
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.Links, {})
|
|
604
|
+
]
|
|
605
|
+
}
|
|
606
|
+
)
|
|
596
607
|
] }) }),
|
|
597
608
|
releaseModalShown && /* @__PURE__ */ jsxRuntime.jsx(
|
|
598
609
|
ReleaseModal,
|
|
@@ -640,14 +651,18 @@ const TrashIcon = styled__default.default(icons.Trash)`
|
|
|
640
651
|
const TypographyMaxWidth = styled__default.default(designSystem.Typography)`
|
|
641
652
|
max-width: 300px;
|
|
642
653
|
`;
|
|
643
|
-
const EntryValidationText = ({ action, schema,
|
|
654
|
+
const EntryValidationText = ({ action, schema, entry }) => {
|
|
644
655
|
const { formatMessage } = reactIntl.useIntl();
|
|
645
|
-
const { validate } = strapiAdmin.unstable_useDocument(
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
656
|
+
const { validate } = strapiAdmin.unstable_useDocument(
|
|
657
|
+
{
|
|
658
|
+
collectionType: schema?.kind ?? "",
|
|
659
|
+
model: schema?.uid ?? ""
|
|
660
|
+
},
|
|
661
|
+
{
|
|
662
|
+
skip: !schema
|
|
663
|
+
}
|
|
664
|
+
);
|
|
665
|
+
const errors = validate(entry) ?? {};
|
|
651
666
|
if (Object.keys(errors).length > 0) {
|
|
652
667
|
const validationErrorsMessages = Object.entries(errors).map(
|
|
653
668
|
([key, value]) => formatMessage(
|
|
@@ -695,18 +710,22 @@ const ReleaseDetailsLayout = ({
|
|
|
695
710
|
isLoading: isLoadingDetails,
|
|
696
711
|
isError,
|
|
697
712
|
error
|
|
698
|
-
} = index.useGetReleaseQuery(
|
|
713
|
+
} = index.useGetReleaseQuery(
|
|
714
|
+
{ id: releaseId },
|
|
715
|
+
{
|
|
716
|
+
skip: !releaseId
|
|
717
|
+
}
|
|
718
|
+
);
|
|
699
719
|
const [publishRelease, { isLoading: isPublishing }] = index.usePublishReleaseMutation();
|
|
700
|
-
const toggleNotification =
|
|
701
|
-
const { formatAPIError } =
|
|
702
|
-
const {
|
|
703
|
-
|
|
704
|
-
} = helperPlugin.useRBAC(index.PERMISSIONS);
|
|
720
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
721
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
722
|
+
const { allowedActions } = helperPlugin.useRBAC(index.PERMISSIONS);
|
|
723
|
+
const { canUpdate, canDelete, canPublish } = allowedActions;
|
|
705
724
|
const dispatch = index.useTypedDispatch();
|
|
706
|
-
const { trackUsage } =
|
|
725
|
+
const { trackUsage } = strapiAdmin.useTracking();
|
|
707
726
|
const release = data?.data;
|
|
708
|
-
const handlePublishRelease = async () => {
|
|
709
|
-
const response = await publishRelease({ id
|
|
727
|
+
const handlePublishRelease = (id) => async () => {
|
|
728
|
+
const response = await publishRelease({ id });
|
|
710
729
|
if ("data" in response) {
|
|
711
730
|
toggleNotification({
|
|
712
731
|
type: "success",
|
|
@@ -723,12 +742,12 @@ const ReleaseDetailsLayout = ({
|
|
|
723
742
|
});
|
|
724
743
|
} else if (index.isAxiosError(response.error)) {
|
|
725
744
|
toggleNotification({
|
|
726
|
-
type: "
|
|
745
|
+
type: "danger",
|
|
727
746
|
message: formatAPIError(response.error)
|
|
728
747
|
});
|
|
729
748
|
} else {
|
|
730
749
|
toggleNotification({
|
|
731
|
-
type: "
|
|
750
|
+
type: "danger",
|
|
732
751
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
733
752
|
});
|
|
734
753
|
}
|
|
@@ -749,28 +768,25 @@ const ReleaseDetailsLayout = ({
|
|
|
749
768
|
return release.createdBy.email;
|
|
750
769
|
};
|
|
751
770
|
if (isLoadingDetails) {
|
|
752
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
771
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
|
|
753
772
|
}
|
|
754
773
|
if (isError || !release) {
|
|
755
774
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
756
|
-
reactRouterDom.
|
|
775
|
+
reactRouterDom.Navigate,
|
|
757
776
|
{
|
|
758
|
-
to:
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
]
|
|
766
|
-
}
|
|
777
|
+
to: "..",
|
|
778
|
+
state: {
|
|
779
|
+
errors: [
|
|
780
|
+
{
|
|
781
|
+
code: error?.code
|
|
782
|
+
}
|
|
783
|
+
]
|
|
767
784
|
}
|
|
768
785
|
}
|
|
769
786
|
);
|
|
770
787
|
}
|
|
771
788
|
const totalEntries = release.actions.meta.count || 0;
|
|
772
789
|
const hasCreatedByUser = Boolean(getCreatedByUser());
|
|
773
|
-
const IsSchedulingEnabled = window.strapi.future.isEnabled("contentReleasesScheduling");
|
|
774
790
|
const isScheduled = release.scheduledAt && release.timezone;
|
|
775
791
|
const numberOfEntriesText = formatMessage(
|
|
776
792
|
{
|
|
@@ -805,13 +821,10 @@ const ReleaseDetailsLayout = ({
|
|
|
805
821
|
{
|
|
806
822
|
title: release.name,
|
|
807
823
|
subtitle: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, lineHeight: 6, children: [
|
|
808
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", variant: "epsilon", children: numberOfEntriesText + (
|
|
824
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", variant: "epsilon", children: numberOfEntriesText + (isScheduled ? ` - ${scheduledText}` : "") }),
|
|
809
825
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { ...getBadgeProps(release.status), children: release.status })
|
|
810
826
|
] }),
|
|
811
|
-
navigationAction: /* @__PURE__ */ jsxRuntime.jsx(
|
|
812
|
-
id: "global.back",
|
|
813
|
-
defaultMessage: "Back"
|
|
814
|
-
}) }),
|
|
827
|
+
navigationAction: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.BackButton, {}),
|
|
815
828
|
primaryAction: !release.releasedAt && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
816
829
|
/* @__PURE__ */ jsxRuntime.jsxs(v2.Menu.Root, { children: [
|
|
817
830
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -877,7 +890,7 @@ const ReleaseDetailsLayout = ({
|
|
|
877
890
|
defaultMessage: "Created"
|
|
878
891
|
}) }),
|
|
879
892
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", color: "neutral300", children: [
|
|
880
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
893
|
+
/* @__PURE__ */ jsxRuntime.jsx(RelativeTime, { timestamp: new Date(release.createdAt) }),
|
|
881
894
|
formatMessage(
|
|
882
895
|
{
|
|
883
896
|
id: "content-releases.header.actions.created.description",
|
|
@@ -895,12 +908,12 @@ const ReleaseDetailsLayout = ({
|
|
|
895
908
|
id: "content-releases.header.actions.refresh",
|
|
896
909
|
defaultMessage: "Refresh"
|
|
897
910
|
}) }),
|
|
898
|
-
|
|
911
|
+
canPublish ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
899
912
|
designSystem.Button,
|
|
900
913
|
{
|
|
901
914
|
size: "S",
|
|
902
915
|
variant: "default",
|
|
903
|
-
onClick: handlePublishRelease,
|
|
916
|
+
onClick: handlePublishRelease(release.id.toString()),
|
|
904
917
|
loading: isPublishing,
|
|
905
918
|
disabled: release.actions.meta.count === 0,
|
|
906
919
|
children: formatMessage({
|
|
@@ -908,7 +921,7 @@ const ReleaseDetailsLayout = ({
|
|
|
908
921
|
defaultMessage: "Publish"
|
|
909
922
|
})
|
|
910
923
|
}
|
|
911
|
-
)
|
|
924
|
+
) : null
|
|
912
925
|
] })
|
|
913
926
|
}
|
|
914
927
|
),
|
|
@@ -934,12 +947,11 @@ const getGroupByOptionLabel = (value) => {
|
|
|
934
947
|
defaultMessage: "Content-Types"
|
|
935
948
|
};
|
|
936
949
|
};
|
|
937
|
-
const ReleaseDetailsBody = () => {
|
|
950
|
+
const ReleaseDetailsBody = ({ releaseId }) => {
|
|
938
951
|
const { formatMessage } = reactIntl.useIntl();
|
|
939
|
-
const { releaseId } = reactRouterDom.useParams();
|
|
940
952
|
const [{ query }, setQuery] = helperPlugin.useQueryParams();
|
|
941
|
-
const toggleNotification =
|
|
942
|
-
const { formatAPIError } =
|
|
953
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
954
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
943
955
|
const {
|
|
944
956
|
data: releaseData,
|
|
945
957
|
isLoading: isReleaseLoading,
|
|
@@ -979,19 +991,19 @@ const ReleaseDetailsBody = () => {
|
|
|
979
991
|
if ("error" in response) {
|
|
980
992
|
if (index.isAxiosError(response.error)) {
|
|
981
993
|
toggleNotification({
|
|
982
|
-
type: "
|
|
994
|
+
type: "danger",
|
|
983
995
|
message: formatAPIError(response.error)
|
|
984
996
|
});
|
|
985
997
|
} else {
|
|
986
998
|
toggleNotification({
|
|
987
|
-
type: "
|
|
999
|
+
type: "danger",
|
|
988
1000
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
989
1001
|
});
|
|
990
1002
|
}
|
|
991
1003
|
}
|
|
992
1004
|
};
|
|
993
1005
|
if (isLoading || isReleaseLoading) {
|
|
994
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1006
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
|
|
995
1007
|
}
|
|
996
1008
|
const releaseActions = data?.data;
|
|
997
1009
|
const releaseMeta = data?.meta;
|
|
@@ -1010,28 +1022,22 @@ const ReleaseDetailsBody = () => {
|
|
|
1010
1022
|
});
|
|
1011
1023
|
}
|
|
1012
1024
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1013
|
-
reactRouterDom.
|
|
1025
|
+
reactRouterDom.Navigate,
|
|
1014
1026
|
{
|
|
1015
|
-
to:
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
errors: errorsArray
|
|
1019
|
-
}
|
|
1027
|
+
to: "..",
|
|
1028
|
+
state: {
|
|
1029
|
+
errors: errorsArray
|
|
1020
1030
|
}
|
|
1021
1031
|
}
|
|
1022
1032
|
);
|
|
1023
1033
|
}
|
|
1024
1034
|
if (isError || !releaseActions) {
|
|
1025
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1035
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Error, {});
|
|
1026
1036
|
}
|
|
1027
1037
|
if (Object.keys(releaseActions).length === 0) {
|
|
1028
1038
|
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.ContentLayout, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1029
|
-
|
|
1039
|
+
designSystem.EmptyStateLayout,
|
|
1030
1040
|
{
|
|
1031
|
-
content: {
|
|
1032
|
-
id: "content-releases.pages.Details.tab.emptyEntries",
|
|
1033
|
-
defaultMessage: "This release is empty. Open the Content Manager, select an entry and add it to the release."
|
|
1034
|
-
},
|
|
1035
1041
|
action: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1036
1042
|
v2.LinkButton,
|
|
1037
1043
|
{
|
|
@@ -1046,10 +1052,54 @@ const ReleaseDetailsBody = () => {
|
|
|
1046
1052
|
defaultMessage: "Open the Content Manager"
|
|
1047
1053
|
})
|
|
1048
1054
|
}
|
|
1049
|
-
)
|
|
1055
|
+
),
|
|
1056
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.EmptyDocuments, { width: "10rem" }),
|
|
1057
|
+
content: formatMessage({
|
|
1058
|
+
id: "content-releases.pages.Details.tab.emptyEntries",
|
|
1059
|
+
defaultMessage: "This release is empty. Open the Content Manager, select an entry and add it to the release."
|
|
1060
|
+
})
|
|
1050
1061
|
}
|
|
1051
1062
|
) });
|
|
1052
1063
|
}
|
|
1064
|
+
const headers = [
|
|
1065
|
+
{
|
|
1066
|
+
label: formatMessage({
|
|
1067
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.name",
|
|
1068
|
+
defaultMessage: "name"
|
|
1069
|
+
}),
|
|
1070
|
+
name: "name"
|
|
1071
|
+
},
|
|
1072
|
+
{
|
|
1073
|
+
label: formatMessage({
|
|
1074
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.locale",
|
|
1075
|
+
defaultMessage: "locale"
|
|
1076
|
+
}),
|
|
1077
|
+
name: "locale"
|
|
1078
|
+
},
|
|
1079
|
+
{
|
|
1080
|
+
label: formatMessage({
|
|
1081
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.content-type",
|
|
1082
|
+
defaultMessage: "content-type"
|
|
1083
|
+
}),
|
|
1084
|
+
name: "content-type"
|
|
1085
|
+
},
|
|
1086
|
+
{
|
|
1087
|
+
label: formatMessage({
|
|
1088
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.action",
|
|
1089
|
+
defaultMessage: "action"
|
|
1090
|
+
}),
|
|
1091
|
+
name: "action"
|
|
1092
|
+
},
|
|
1093
|
+
...!release.releasedAt ? [
|
|
1094
|
+
{
|
|
1095
|
+
label: formatMessage({
|
|
1096
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.status",
|
|
1097
|
+
defaultMessage: "status"
|
|
1098
|
+
}),
|
|
1099
|
+
name: "status"
|
|
1100
|
+
}
|
|
1101
|
+
] : []
|
|
1102
|
+
];
|
|
1053
1103
|
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.ContentLayout, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 8, direction: "column", alignItems: "stretch", children: [
|
|
1054
1104
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1055
1105
|
designSystem.SingleSelect,
|
|
@@ -1075,75 +1125,18 @@ const ReleaseDetailsBody = () => {
|
|
|
1075
1125
|
Object.keys(releaseActions).map((key) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, direction: "column", alignItems: "stretch", children: [
|
|
1076
1126
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { role: "separator", "aria-label": key, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { children: key }) }),
|
|
1077
1127
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1078
|
-
|
|
1128
|
+
strapiAdmin.Table.Root,
|
|
1079
1129
|
{
|
|
1080
1130
|
rows: releaseActions[key].map((item) => ({
|
|
1081
1131
|
...item,
|
|
1082
1132
|
id: Number(item.entry.id)
|
|
1083
1133
|
})),
|
|
1084
|
-
|
|
1085
|
-
isLoading,
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1089
|
-
|
|
1090
|
-
helperPlugin.Table.HeaderCell,
|
|
1091
|
-
{
|
|
1092
|
-
fieldSchemaType: "string",
|
|
1093
|
-
label: formatMessage({
|
|
1094
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.name",
|
|
1095
|
-
defaultMessage: "name"
|
|
1096
|
-
}),
|
|
1097
|
-
name: "name"
|
|
1098
|
-
}
|
|
1099
|
-
),
|
|
1100
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1101
|
-
helperPlugin.Table.HeaderCell,
|
|
1102
|
-
{
|
|
1103
|
-
fieldSchemaType: "string",
|
|
1104
|
-
label: formatMessage({
|
|
1105
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.locale",
|
|
1106
|
-
defaultMessage: "locale"
|
|
1107
|
-
}),
|
|
1108
|
-
name: "locale"
|
|
1109
|
-
}
|
|
1110
|
-
),
|
|
1111
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1112
|
-
helperPlugin.Table.HeaderCell,
|
|
1113
|
-
{
|
|
1114
|
-
fieldSchemaType: "string",
|
|
1115
|
-
label: formatMessage({
|
|
1116
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.content-type",
|
|
1117
|
-
defaultMessage: "content-type"
|
|
1118
|
-
}),
|
|
1119
|
-
name: "content-type"
|
|
1120
|
-
}
|
|
1121
|
-
),
|
|
1122
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1123
|
-
helperPlugin.Table.HeaderCell,
|
|
1124
|
-
{
|
|
1125
|
-
fieldSchemaType: "string",
|
|
1126
|
-
label: formatMessage({
|
|
1127
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.action",
|
|
1128
|
-
defaultMessage: "action"
|
|
1129
|
-
}),
|
|
1130
|
-
name: "action"
|
|
1131
|
-
}
|
|
1132
|
-
),
|
|
1133
|
-
!release.releasedAt && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1134
|
-
helperPlugin.Table.HeaderCell,
|
|
1135
|
-
{
|
|
1136
|
-
fieldSchemaType: "string",
|
|
1137
|
-
label: formatMessage({
|
|
1138
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.status",
|
|
1139
|
-
defaultMessage: "status"
|
|
1140
|
-
}),
|
|
1141
|
-
name: "status"
|
|
1142
|
-
}
|
|
1143
|
-
)
|
|
1144
|
-
] }),
|
|
1145
|
-
/* @__PURE__ */ jsxRuntime.jsx(helperPlugin.Table.LoadingBody, {}),
|
|
1146
|
-
/* @__PURE__ */ jsxRuntime.jsx(helperPlugin.Table.Body, { children: releaseActions[key].map(
|
|
1134
|
+
headers,
|
|
1135
|
+
isLoading: isLoading || isFetching,
|
|
1136
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(strapiAdmin.Table.Content, { children: [
|
|
1137
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Head, { children: headers.map((header) => /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.HeaderCell, { ...header }, header.name)) }),
|
|
1138
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Loading, {}),
|
|
1139
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Body, { children: releaseActions[key].map(
|
|
1147
1140
|
({ id, contentType, locale, type, entry }, actionIndex) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
1148
1141
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "25%", maxWidth: "200px", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { ellipsis: true, children: `${contentType.mainFieldValue || entry.id}` }) }),
|
|
1149
1142
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "10%", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: `${locale?.name ? locale.name : "-"}` }) }),
|
|
@@ -1200,34 +1193,39 @@ const ReleaseDetailsBody = () => {
|
|
|
1200
1193
|
}
|
|
1201
1194
|
)
|
|
1202
1195
|
] }, `releases-group-${key}`)),
|
|
1203
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
}
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1196
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1197
|
+
strapiAdmin.Pagination.Root,
|
|
1198
|
+
{
|
|
1199
|
+
...releaseMeta?.pagination,
|
|
1200
|
+
defaultPageSize: releaseMeta?.pagination?.pageSize,
|
|
1201
|
+
children: [
|
|
1202
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.PageSize, {}),
|
|
1203
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.Links, {})
|
|
1204
|
+
]
|
|
1205
|
+
}
|
|
1206
|
+
)
|
|
1214
1207
|
] }) });
|
|
1215
1208
|
};
|
|
1216
1209
|
const ReleaseDetailsPage = () => {
|
|
1217
1210
|
const { formatMessage } = reactIntl.useIntl();
|
|
1218
1211
|
const { releaseId } = reactRouterDom.useParams();
|
|
1219
|
-
const toggleNotification =
|
|
1220
|
-
const { formatAPIError } =
|
|
1221
|
-
const
|
|
1212
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
1213
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
1214
|
+
const navigate = reactRouterDom.useNavigate();
|
|
1222
1215
|
const [releaseModalShown, setReleaseModalShown] = React__namespace.useState(false);
|
|
1223
1216
|
const [showWarningSubmit, setWarningSubmit] = React__namespace.useState(false);
|
|
1224
1217
|
const {
|
|
1225
1218
|
isLoading: isLoadingDetails,
|
|
1226
1219
|
data,
|
|
1227
1220
|
isSuccess: isSuccessDetails
|
|
1228
|
-
} = index.useGetReleaseQuery(
|
|
1221
|
+
} = index.useGetReleaseQuery(
|
|
1222
|
+
{ id: releaseId },
|
|
1223
|
+
{
|
|
1224
|
+
skip: !releaseId
|
|
1225
|
+
}
|
|
1226
|
+
);
|
|
1229
1227
|
const [updateRelease, { isLoading: isSubmittingForm }] = index.useUpdateReleaseMutation();
|
|
1230
|
-
const [deleteRelease
|
|
1228
|
+
const [deleteRelease] = index.useDeleteReleaseMutation();
|
|
1231
1229
|
const toggleEditReleaseModal = () => {
|
|
1232
1230
|
setReleaseModalShown((prev) => !prev);
|
|
1233
1231
|
};
|
|
@@ -1238,10 +1236,13 @@ const ReleaseDetailsPage = () => {
|
|
|
1238
1236
|
{
|
|
1239
1237
|
toggleEditReleaseModal,
|
|
1240
1238
|
toggleWarningSubmit,
|
|
1241
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1239
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {})
|
|
1242
1240
|
}
|
|
1243
1241
|
);
|
|
1244
1242
|
}
|
|
1243
|
+
if (!releaseId) {
|
|
1244
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: ".." });
|
|
1245
|
+
}
|
|
1245
1246
|
const releaseData = isSuccessDetails && data?.data || null;
|
|
1246
1247
|
const title = releaseData?.name || "";
|
|
1247
1248
|
const timezone = releaseData?.timezone ?? null;
|
|
@@ -1265,12 +1266,12 @@ const ReleaseDetailsPage = () => {
|
|
|
1265
1266
|
});
|
|
1266
1267
|
} else if (index.isAxiosError(response.error)) {
|
|
1267
1268
|
toggleNotification({
|
|
1268
|
-
type: "
|
|
1269
|
+
type: "danger",
|
|
1269
1270
|
message: formatAPIError(response.error)
|
|
1270
1271
|
});
|
|
1271
1272
|
} else {
|
|
1272
1273
|
toggleNotification({
|
|
1273
|
-
type: "
|
|
1274
|
+
type: "danger",
|
|
1274
1275
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
1275
1276
|
});
|
|
1276
1277
|
}
|
|
@@ -1281,15 +1282,15 @@ const ReleaseDetailsPage = () => {
|
|
|
1281
1282
|
id: releaseId
|
|
1282
1283
|
});
|
|
1283
1284
|
if ("data" in response) {
|
|
1284
|
-
|
|
1285
|
+
navigate("..");
|
|
1285
1286
|
} else if (index.isAxiosError(response.error)) {
|
|
1286
1287
|
toggleNotification({
|
|
1287
|
-
type: "
|
|
1288
|
+
type: "danger",
|
|
1288
1289
|
message: formatAPIError(response.error)
|
|
1289
1290
|
});
|
|
1290
1291
|
} else {
|
|
1291
1292
|
toggleNotification({
|
|
1292
|
-
type: "
|
|
1293
|
+
type: "danger",
|
|
1293
1294
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
1294
1295
|
});
|
|
1295
1296
|
}
|
|
@@ -1300,7 +1301,7 @@ const ReleaseDetailsPage = () => {
|
|
|
1300
1301
|
toggleEditReleaseModal,
|
|
1301
1302
|
toggleWarningSubmit,
|
|
1302
1303
|
children: [
|
|
1303
|
-
/* @__PURE__ */ jsxRuntime.jsx(ReleaseDetailsBody, {}),
|
|
1304
|
+
/* @__PURE__ */ jsxRuntime.jsx(ReleaseDetailsBody, { releaseId }),
|
|
1304
1305
|
releaseModalShown && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1305
1306
|
ReleaseModal,
|
|
1306
1307
|
{
|
|
@@ -1318,16 +1319,15 @@ const ReleaseDetailsPage = () => {
|
|
|
1318
1319
|
}
|
|
1319
1320
|
),
|
|
1320
1321
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1321
|
-
|
|
1322
|
+
strapiAdmin.ConfirmDialog,
|
|
1322
1323
|
{
|
|
1323
|
-
|
|
1324
|
+
isOpen: showWarningSubmit,
|
|
1325
|
+
onClose: toggleWarningSubmit,
|
|
1326
|
+
onConfirm: handleDeleteRelease,
|
|
1327
|
+
children: formatMessage({
|
|
1324
1328
|
id: "content-releases.dialog.confirmation-message",
|
|
1325
1329
|
defaultMessage: "Are you sure you want to delete this release?"
|
|
1326
|
-
}
|
|
1327
|
-
isOpen: showWarningSubmit,
|
|
1328
|
-
isConfirmButtonLoading: isDeletingRelease,
|
|
1329
|
-
onToggleDialog: toggleWarningSubmit,
|
|
1330
|
-
onConfirm: handleDeleteRelease
|
|
1330
|
+
})
|
|
1331
1331
|
}
|
|
1332
1332
|
)
|
|
1333
1333
|
]
|
|
@@ -1335,10 +1335,10 @@ const ReleaseDetailsPage = () => {
|
|
|
1335
1335
|
);
|
|
1336
1336
|
};
|
|
1337
1337
|
const App = () => {
|
|
1338
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1339
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, {
|
|
1340
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, {
|
|
1338
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Protect, { permissions: index.PERMISSIONS.main, children: /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.Routes, { children: [
|
|
1339
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { index: true, element: /* @__PURE__ */ jsxRuntime.jsx(ReleasesPage, {}) }),
|
|
1340
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: ":releaseId", element: /* @__PURE__ */ jsxRuntime.jsx(ReleaseDetailsPage, {}) })
|
|
1341
1341
|
] }) });
|
|
1342
1342
|
};
|
|
1343
1343
|
exports.App = App;
|
|
1344
|
-
//# sourceMappingURL=App-
|
|
1344
|
+
//# sourceMappingURL=App-zwe_jKPv.js.map
|