@strapi/content-releases 0.0.0-experimental.d8a676a242377cee820b59b21a05d47290d9ac73 → 0.0.0-experimental.d954d57341a6623992a0d211daaec8e245c3517d
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-CqbuK4M6.js} +426 -427
- package/dist/_chunks/App-CqbuK4M6.js.map +1 -0
- package/dist/_chunks/{App-bpzO2Ljh.mjs → App-Do-Rnv0A.mjs} +406 -406
- package/dist/_chunks/App-Do-Rnv0A.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-D_pgdqQL.mjs} +244 -247
- package/dist/_chunks/index-D_pgdqQL.mjs.map +1 -0
- package/dist/_chunks/{index-fP3qoWZ4.js → index-Tedsw4GC.js} +244 -249
- package/dist/_chunks/index-Tedsw4GC.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 +17 -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-Tedsw4GC.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(),
|
|
@@ -65,6 +92,7 @@ const RELEASE_SCHEMA = yup__namespace.object().shape({
|
|
|
65
92
|
}).required().noUnknown();
|
|
66
93
|
const ReleaseModal = ({
|
|
67
94
|
handleClose,
|
|
95
|
+
open,
|
|
68
96
|
handleSubmit,
|
|
69
97
|
initialValues,
|
|
70
98
|
isLoading = false
|
|
@@ -72,7 +100,6 @@ const ReleaseModal = ({
|
|
|
72
100
|
const { formatMessage } = reactIntl.useIntl();
|
|
73
101
|
const { pathname } = reactRouterDom.useLocation();
|
|
74
102
|
const isCreatingRelease = pathname === `/plugins/${index.pluginId}`;
|
|
75
|
-
const IsSchedulingEnabled = window.strapi.future.isEnabled("contentReleasesScheduling");
|
|
76
103
|
const { timezoneList, systemTimezone = { value: "UTC+00:00-Africa/Abidjan " } } = getTimezones(
|
|
77
104
|
initialValues.scheduledAt ? new Date(initialValues.scheduledAt) : /* @__PURE__ */ new Date()
|
|
78
105
|
);
|
|
@@ -80,9 +107,8 @@ const ReleaseModal = ({
|
|
|
80
107
|
const { date, time, timezone } = values;
|
|
81
108
|
if (!date || !time || !timezone)
|
|
82
109
|
return null;
|
|
83
|
-
const formattedDate = dateFns.parse(time, "HH:mm", new Date(date));
|
|
84
110
|
const timezoneWithoutOffset = timezone.split("&")[1];
|
|
85
|
-
return dateFnsTz.zonedTimeToUtc(
|
|
111
|
+
return dateFnsTz.zonedTimeToUtc(`${date} ${time}`, timezoneWithoutOffset);
|
|
86
112
|
};
|
|
87
113
|
const getTimezoneWithOffset = () => {
|
|
88
114
|
const currentTimezone = timezoneList.find(
|
|
@@ -90,8 +116,8 @@ const ReleaseModal = ({
|
|
|
90
116
|
);
|
|
91
117
|
return currentTimezone?.value || systemTimezone.value;
|
|
92
118
|
};
|
|
93
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
94
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
119
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Root, { open, onOpenChange: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Content, { children: [
|
|
120
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Title, { children: formatMessage(
|
|
95
121
|
{
|
|
96
122
|
id: "content-releases.modal.title",
|
|
97
123
|
defaultMessage: "{isCreatingRelease, select, true {New release} other {Edit release}}"
|
|
@@ -114,31 +140,25 @@ const ReleaseModal = ({
|
|
|
114
140
|
},
|
|
115
141
|
validationSchema: RELEASE_SCHEMA,
|
|
116
142
|
validateOnChange: false,
|
|
117
|
-
children: ({ values, errors, handleChange, setFieldValue }) =>
|
|
118
|
-
|
|
119
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
120
|
-
designSystem.
|
|
121
|
-
|
|
122
|
-
label: formatMessage({
|
|
143
|
+
children: ({ values, errors, handleChange, setFieldValue }) => {
|
|
144
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(formik.Form, { children: [
|
|
145
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Body, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
|
|
146
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { name: "name", error: errors.name, required: true, children: [
|
|
147
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
123
148
|
id: "content-releases.modal.form.input.label.release-name",
|
|
124
149
|
defaultMessage: "Name"
|
|
125
|
-
}),
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
onChange: handleChange,
|
|
130
|
-
required: true
|
|
131
|
-
}
|
|
132
|
-
),
|
|
133
|
-
IsSchedulingEnabled && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
150
|
+
}) }),
|
|
151
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.TextInput, { value: values.name, onChange: handleChange }),
|
|
152
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
153
|
+
] }),
|
|
134
154
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "max-content", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
135
155
|
designSystem.Checkbox,
|
|
136
156
|
{
|
|
137
157
|
name: "isScheduled",
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
setFieldValue("isScheduled",
|
|
141
|
-
if (!
|
|
158
|
+
checked: values.isScheduled,
|
|
159
|
+
onCheckedChange: (checked) => {
|
|
160
|
+
setFieldValue("isScheduled", checked);
|
|
161
|
+
if (!checked) {
|
|
142
162
|
setFieldValue("date", null);
|
|
143
163
|
setFieldValue("time", "");
|
|
144
164
|
setFieldValue("timezone", null);
|
|
@@ -166,76 +186,73 @@ const ReleaseModal = ({
|
|
|
166
186
|
) }),
|
|
167
187
|
values.isScheduled && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
168
188
|
/* @__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
|
-
) })
|
|
189
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { name: "date", error: errors.date, required: true, children: [
|
|
190
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
191
|
+
id: "content-releases.modal.form.input.label.date",
|
|
192
|
+
defaultMessage: "Date"
|
|
193
|
+
}) }),
|
|
194
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
195
|
+
designSystem.DatePicker,
|
|
196
|
+
{
|
|
197
|
+
onChange: (date) => {
|
|
198
|
+
const isoFormatDate = date ? dateFns.formatISO(date, { representation: "date" }) : null;
|
|
199
|
+
setFieldValue("date", isoFormatDate);
|
|
200
|
+
},
|
|
201
|
+
clearLabel: formatMessage({
|
|
202
|
+
id: "content-releases.modal.form.input.clearLabel",
|
|
203
|
+
defaultMessage: "Clear"
|
|
204
|
+
}),
|
|
205
|
+
onClear: () => {
|
|
206
|
+
setFieldValue("date", null);
|
|
207
|
+
},
|
|
208
|
+
value: values.date ? new Date(values.date) : /* @__PURE__ */ new Date(),
|
|
209
|
+
minDate: dateFnsTz.utcToZonedTime(/* @__PURE__ */ new Date(), values.timezone.split("&")[1])
|
|
210
|
+
}
|
|
211
|
+
),
|
|
212
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
213
|
+
] }) }),
|
|
214
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { name: "time", error: errors.time, required: true, children: [
|
|
215
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
216
|
+
id: "content-releases.modal.form.input.label.time",
|
|
217
|
+
defaultMessage: "Time"
|
|
218
|
+
}) }),
|
|
219
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
220
|
+
designSystem.TimePicker,
|
|
221
|
+
{
|
|
222
|
+
onChange: (time) => {
|
|
223
|
+
setFieldValue("time", time);
|
|
224
|
+
},
|
|
225
|
+
clearLabel: formatMessage({
|
|
226
|
+
id: "content-releases.modal.form.input.clearLabel",
|
|
227
|
+
defaultMessage: "Clear"
|
|
228
|
+
}),
|
|
229
|
+
onClear: () => {
|
|
230
|
+
setFieldValue("time", "");
|
|
231
|
+
},
|
|
232
|
+
value: values.time || void 0
|
|
233
|
+
}
|
|
234
|
+
),
|
|
235
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
236
|
+
] }) })
|
|
217
237
|
] }),
|
|
218
238
|
/* @__PURE__ */ jsxRuntime.jsx(TimezoneComponent, { timezoneOptions: timezoneList })
|
|
219
239
|
] })
|
|
220
|
-
] })
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
{
|
|
225
|
-
startActions: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: handleClose, variant: "tertiary", name: "cancel", children: formatMessage({ id: "cancel", defaultMessage: "Cancel" }) }),
|
|
226
|
-
endActions: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { name: "submit", loading: isLoading, type: "submit", children: formatMessage(
|
|
240
|
+
] }) }),
|
|
241
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Footer, { children: [
|
|
242
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Close, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", name: "cancel", children: formatMessage({ id: "cancel", defaultMessage: "Cancel" }) }) }),
|
|
243
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { name: "submit", loading: isLoading, type: "submit", children: formatMessage(
|
|
227
244
|
{
|
|
228
245
|
id: "content-releases.modal.form.button.submit",
|
|
229
246
|
defaultMessage: "{isCreatingRelease, select, true {Continue} other {Save}}"
|
|
230
247
|
},
|
|
231
248
|
{ isCreatingRelease }
|
|
232
249
|
) })
|
|
233
|
-
}
|
|
234
|
-
)
|
|
235
|
-
|
|
250
|
+
] })
|
|
251
|
+
] });
|
|
252
|
+
}
|
|
236
253
|
}
|
|
237
254
|
)
|
|
238
|
-
] });
|
|
255
|
+
] }) });
|
|
239
256
|
};
|
|
240
257
|
const getTimezones = (selectedDate) => {
|
|
241
258
|
const timezoneList = Intl.supportedValuesOf("timeZone").map((timezone) => {
|
|
@@ -261,37 +278,44 @@ const TimezoneComponent = ({ timezoneOptions }) => {
|
|
|
261
278
|
}
|
|
262
279
|
}
|
|
263
280
|
}, [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
|
-
);
|
|
281
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { name: "timezone", error: errors.timezone, required: true, children: [
|
|
282
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
283
|
+
id: "content-releases.modal.form.input.label.timezone",
|
|
284
|
+
defaultMessage: "Timezone"
|
|
285
|
+
}) }),
|
|
286
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
287
|
+
designSystem.Combobox,
|
|
288
|
+
{
|
|
289
|
+
autocomplete: { type: "list", filter: "contains" },
|
|
290
|
+
value: values.timezone || void 0,
|
|
291
|
+
textValue: values.timezone ? values.timezone.replace(/&/, " ") : void 0,
|
|
292
|
+
onChange: (timezone) => {
|
|
293
|
+
setFieldValue("timezone", timezone);
|
|
294
|
+
},
|
|
295
|
+
onTextValueChange: (timezone) => {
|
|
296
|
+
setFieldValue("timezone", timezone);
|
|
297
|
+
},
|
|
298
|
+
onClear: () => {
|
|
299
|
+
setFieldValue("timezone", "");
|
|
300
|
+
},
|
|
301
|
+
children: timezoneList.map((timezone) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.ComboboxOption, { value: timezone.value, children: timezone.value.replace(/&/, " ") }, timezone.value))
|
|
302
|
+
}
|
|
303
|
+
),
|
|
304
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
305
|
+
] });
|
|
306
|
+
};
|
|
307
|
+
const useTypedDispatch = reactRedux.useDispatch;
|
|
308
|
+
const isBaseQueryError = (error) => {
|
|
309
|
+
return typeof error !== "undefined" && error.name !== void 0;
|
|
289
310
|
};
|
|
290
|
-
const LinkCard =
|
|
311
|
+
const LinkCard = styledComponents.styled(designSystem.Link)`
|
|
291
312
|
display: block;
|
|
292
313
|
`;
|
|
293
|
-
const
|
|
294
|
-
|
|
314
|
+
const RelativeTime = styledComponents.styled(RelativeTime$1)`
|
|
315
|
+
display: inline-block;
|
|
316
|
+
&::first-letter {
|
|
317
|
+
text-transform: uppercase;
|
|
318
|
+
}
|
|
295
319
|
`;
|
|
296
320
|
const getBadgeProps = (status) => {
|
|
297
321
|
let color;
|
|
@@ -320,9 +344,8 @@ const getBadgeProps = (status) => {
|
|
|
320
344
|
};
|
|
321
345
|
const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
322
346
|
const { formatMessage } = reactIntl.useIntl();
|
|
323
|
-
const IsSchedulingEnabled = window.strapi.future.isEnabled("contentReleasesScheduling");
|
|
324
347
|
if (isError) {
|
|
325
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
348
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Error, {});
|
|
326
349
|
}
|
|
327
350
|
if (releases?.length === 0) {
|
|
328
351
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -337,11 +360,11 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
337
360
|
target: sectionTitle
|
|
338
361
|
}
|
|
339
362
|
),
|
|
340
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
363
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(symbols.EmptyDocuments, { width: "16rem" })
|
|
341
364
|
}
|
|
342
365
|
);
|
|
343
366
|
}
|
|
344
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid, { gap: 4, children: releases.map(({ id, name,
|
|
367
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Root, { gap: 4, children: releases.map(({ id, name, scheduledAt, status }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 3, s: 6, xs: 12, children: /* @__PURE__ */ jsxRuntime.jsx(LinkCard, { tag: reactRouterDom.NavLink, to: `${id}`, isExternal: false, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
345
368
|
designSystem.Flex,
|
|
346
369
|
{
|
|
347
370
|
direction: "column",
|
|
@@ -356,24 +379,18 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
356
379
|
gap: 4,
|
|
357
380
|
children: [
|
|
358
381
|
/* @__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:
|
|
382
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", tag: "h3", variant: "delta", fontWeight: "bold", children: name }),
|
|
383
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: scheduledAt ? /* @__PURE__ */ jsxRuntime.jsx(RelativeTime, { timestamp: new Date(scheduledAt) }) : formatMessage({
|
|
361
384
|
id: "content-releases.pages.Releases.not-scheduled",
|
|
362
385
|
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
|
-
) })
|
|
386
|
+
}) })
|
|
370
387
|
] }),
|
|
371
388
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { ...getBadgeProps(status), children: status })
|
|
372
389
|
]
|
|
373
390
|
}
|
|
374
391
|
) }) }, id)) });
|
|
375
392
|
};
|
|
376
|
-
const StyledAlert =
|
|
393
|
+
const StyledAlert = styledComponents.styled(designSystem.Alert)`
|
|
377
394
|
button {
|
|
378
395
|
display: none;
|
|
379
396
|
}
|
|
@@ -383,34 +400,34 @@ const StyledAlert = styled__default.default(designSystem.Alert)`
|
|
|
383
400
|
`;
|
|
384
401
|
const INITIAL_FORM_VALUES = {
|
|
385
402
|
name: "",
|
|
386
|
-
date:
|
|
403
|
+
date: void 0,
|
|
387
404
|
time: "",
|
|
388
|
-
|
|
389
|
-
isScheduled: window.strapi.future.isEnabled("contentReleasesScheduling"),
|
|
405
|
+
isScheduled: true,
|
|
390
406
|
scheduledAt: null,
|
|
391
407
|
timezone: null
|
|
392
408
|
};
|
|
393
409
|
const ReleasesPage = () => {
|
|
394
|
-
const tabRef = React__namespace.useRef(null);
|
|
395
410
|
const location = reactRouterDom.useLocation();
|
|
396
411
|
const [releaseModalShown, setReleaseModalShown] = React__namespace.useState(false);
|
|
397
|
-
const toggleNotification =
|
|
412
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
398
413
|
const { formatMessage } = reactIntl.useIntl();
|
|
399
|
-
const
|
|
400
|
-
const { formatAPIError } =
|
|
401
|
-
const [{ query }, setQuery] =
|
|
414
|
+
const navigate = reactRouterDom.useNavigate();
|
|
415
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
416
|
+
const [{ query }, setQuery] = strapiAdmin.useQueryParams();
|
|
402
417
|
const response = index.useGetReleasesQuery(query);
|
|
403
418
|
const [createRelease, { isLoading: isSubmittingForm }] = index.useCreateReleaseMutation();
|
|
404
|
-
const { getFeature } =
|
|
419
|
+
const { getFeature } = ee.useLicenseLimits();
|
|
405
420
|
const { maximumReleases = 3 } = getFeature("cms-content-releases");
|
|
406
|
-
const { trackUsage } =
|
|
421
|
+
const { trackUsage } = strapiAdmin.useTracking();
|
|
422
|
+
const {
|
|
423
|
+
allowedActions: { canCreate }
|
|
424
|
+
} = strapiAdmin.useRBAC(index.PERMISSIONS);
|
|
407
425
|
const { isLoading, isSuccess, isError } = response;
|
|
408
426
|
const activeTab = response?.currentData?.meta?.activeTab || "pending";
|
|
409
|
-
const activeTabIndex = ["pending", "done"].indexOf(activeTab);
|
|
410
427
|
React__namespace.useEffect(() => {
|
|
411
428
|
if (location?.state?.errors) {
|
|
412
429
|
toggleNotification({
|
|
413
|
-
type: "
|
|
430
|
+
type: "danger",
|
|
414
431
|
title: formatMessage({
|
|
415
432
|
id: "content-releases.pages.Releases.notification.error.title",
|
|
416
433
|
defaultMessage: "Your request could not be processed."
|
|
@@ -420,30 +437,25 @@ const ReleasesPage = () => {
|
|
|
420
437
|
defaultMessage: "Please try again or open another release."
|
|
421
438
|
})
|
|
422
439
|
});
|
|
423
|
-
|
|
440
|
+
navigate("", { replace: true, state: null });
|
|
424
441
|
}
|
|
425
|
-
}, [formatMessage, location?.state?.errors,
|
|
426
|
-
React__namespace.useEffect(() => {
|
|
427
|
-
if (tabRef.current) {
|
|
428
|
-
tabRef.current._handlers.setSelectedTabIndex(activeTabIndex);
|
|
429
|
-
}
|
|
430
|
-
}, [activeTabIndex]);
|
|
442
|
+
}, [formatMessage, location?.state?.errors, navigate, toggleNotification]);
|
|
431
443
|
const toggleAddReleaseModal = () => {
|
|
432
444
|
setReleaseModalShown((prev) => !prev);
|
|
433
445
|
};
|
|
434
446
|
if (isLoading) {
|
|
435
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
447
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
|
|
436
448
|
}
|
|
437
449
|
const totalPendingReleases = isSuccess && response.currentData?.meta?.pendingReleasesCount || 0;
|
|
438
450
|
const hasReachedMaximumPendingReleases = totalPendingReleases >= maximumReleases;
|
|
439
|
-
const handleTabChange = (
|
|
451
|
+
const handleTabChange = (tabValue) => {
|
|
440
452
|
setQuery({
|
|
441
453
|
...query,
|
|
442
454
|
page: 1,
|
|
443
455
|
pageSize: response?.currentData?.meta?.pagination?.pageSize || 16,
|
|
444
456
|
filters: {
|
|
445
457
|
releasedAt: {
|
|
446
|
-
$notNull:
|
|
458
|
+
$notNull: tabValue === "pending"
|
|
447
459
|
}
|
|
448
460
|
}
|
|
449
461
|
});
|
|
@@ -463,22 +475,22 @@ const ReleasesPage = () => {
|
|
|
463
475
|
})
|
|
464
476
|
});
|
|
465
477
|
trackUsage("didCreateRelease");
|
|
466
|
-
|
|
467
|
-
} else if (
|
|
478
|
+
navigate(response2.data.data.id.toString());
|
|
479
|
+
} else if (strapiAdmin.isFetchError(response2.error)) {
|
|
468
480
|
toggleNotification({
|
|
469
|
-
type: "
|
|
481
|
+
type: "danger",
|
|
470
482
|
message: formatAPIError(response2.error)
|
|
471
483
|
});
|
|
472
484
|
} else {
|
|
473
485
|
toggleNotification({
|
|
474
|
-
type: "
|
|
486
|
+
type: "danger",
|
|
475
487
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
476
488
|
});
|
|
477
489
|
}
|
|
478
490
|
};
|
|
479
491
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { "aria-busy": isLoading, children: [
|
|
480
492
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
481
|
-
|
|
493
|
+
strapiAdmin.Layouts.Header,
|
|
482
494
|
{
|
|
483
495
|
title: formatMessage({
|
|
484
496
|
id: "content-releases.pages.Releases.title",
|
|
@@ -488,7 +500,7 @@ const ReleasesPage = () => {
|
|
|
488
500
|
id: "content-releases.pages.Releases.header-subtitle",
|
|
489
501
|
defaultMessage: "Create and manage content updates"
|
|
490
502
|
}),
|
|
491
|
-
primaryAction:
|
|
503
|
+
primaryAction: canCreate ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
492
504
|
designSystem.Button,
|
|
493
505
|
{
|
|
494
506
|
startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Plus, {}),
|
|
@@ -499,15 +511,15 @@ const ReleasesPage = () => {
|
|
|
499
511
|
defaultMessage: "New release"
|
|
500
512
|
})
|
|
501
513
|
}
|
|
502
|
-
)
|
|
514
|
+
) : null
|
|
503
515
|
}
|
|
504
516
|
),
|
|
505
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
517
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
506
518
|
hasReachedMaximumPendingReleases && /* @__PURE__ */ jsxRuntime.jsx(
|
|
507
519
|
StyledAlert,
|
|
508
520
|
{
|
|
509
521
|
marginBottom: 6,
|
|
510
|
-
action: /* @__PURE__ */ jsxRuntime.jsx(
|
|
522
|
+
action: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Link, { href: "https://strapi.io/pricing-cloud", isExternal: true, children: formatMessage({
|
|
511
523
|
id: "content-releases.pages.Releases.max-limit-reached.action",
|
|
512
524
|
defaultMessage: "Explore plans"
|
|
513
525
|
}) }),
|
|
@@ -527,21 +539,17 @@ const ReleasesPage = () => {
|
|
|
527
539
|
})
|
|
528
540
|
}
|
|
529
541
|
),
|
|
530
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
531
|
-
designSystem.
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
children: [
|
|
542
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { paddingBottom: 8, children: [
|
|
543
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tabs, { children: [
|
|
544
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tab, { children: formatMessage(
|
|
542
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tabs.Root, { variant: "simple", onValueChange: handleTabChange, value: activeTab, children: [
|
|
543
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { paddingBottom: 8, children: [
|
|
544
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
545
|
+
designSystem.Tabs.List,
|
|
546
|
+
{
|
|
547
|
+
"aria-label": formatMessage({
|
|
548
|
+
id: "content-releases.pages.Releases.tab-group.label",
|
|
549
|
+
defaultMessage: "Releases list"
|
|
550
|
+
}),
|
|
551
|
+
children: [
|
|
552
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Trigger, { value: "pending", children: formatMessage(
|
|
545
553
|
{
|
|
546
554
|
id: "content-releases.pages.Releases.tab.pending",
|
|
547
555
|
defaultMessage: "Pending ({count})"
|
|
@@ -550,55 +558,48 @@ const ReleasesPage = () => {
|
|
|
550
558
|
count: totalPendingReleases
|
|
551
559
|
}
|
|
552
560
|
) }),
|
|
553
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
561
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Trigger, { value: "done", children: formatMessage({
|
|
554
562
|
id: "content-releases.pages.Releases.tab.done",
|
|
555
563
|
defaultMessage: "Done"
|
|
556
564
|
}) })
|
|
557
|
-
]
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
sectionTitle: "pending",
|
|
565
|
-
releases: response?.currentData?.data,
|
|
566
|
-
isError
|
|
567
|
-
}
|
|
568
|
-
) }),
|
|
569
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.TabPanel, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
570
|
-
ReleasesGrid,
|
|
571
|
-
{
|
|
572
|
-
sectionTitle: "done",
|
|
573
|
-
releases: response?.currentData?.data,
|
|
574
|
-
isError
|
|
575
|
-
}
|
|
576
|
-
) })
|
|
577
|
-
] })
|
|
578
|
-
]
|
|
579
|
-
}
|
|
580
|
-
),
|
|
581
|
-
response.currentData?.meta?.pagination?.total ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { paddingTop: 4, alignItems: "flex-end", justifyContent: "space-between", children: [
|
|
582
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
583
|
-
helperPlugin.PageSizeURLQuery,
|
|
565
|
+
]
|
|
566
|
+
}
|
|
567
|
+
),
|
|
568
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Divider, {})
|
|
569
|
+
] }),
|
|
570
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Content, { value: "pending", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
571
|
+
ReleasesGrid,
|
|
584
572
|
{
|
|
585
|
-
|
|
586
|
-
|
|
573
|
+
sectionTitle: "pending",
|
|
574
|
+
releases: response?.currentData?.data,
|
|
575
|
+
isError
|
|
587
576
|
}
|
|
588
|
-
),
|
|
589
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
590
|
-
|
|
577
|
+
) }),
|
|
578
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Content, { value: "done", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
579
|
+
ReleasesGrid,
|
|
591
580
|
{
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
581
|
+
sectionTitle: "done",
|
|
582
|
+
releases: response?.currentData?.data,
|
|
583
|
+
isError
|
|
595
584
|
}
|
|
596
|
-
)
|
|
597
|
-
] })
|
|
585
|
+
) })
|
|
586
|
+
] }),
|
|
587
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
588
|
+
strapiAdmin.Pagination.Root,
|
|
589
|
+
{
|
|
590
|
+
...response?.currentData?.meta?.pagination,
|
|
591
|
+
defaultPageSize: response?.currentData?.meta?.pagination?.pageSize,
|
|
592
|
+
children: [
|
|
593
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.PageSize, { options: ["8", "16", "32", "64"] }),
|
|
594
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.Links, {})
|
|
595
|
+
]
|
|
596
|
+
}
|
|
597
|
+
)
|
|
598
598
|
] }) }),
|
|
599
|
-
|
|
599
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
600
600
|
ReleaseModal,
|
|
601
601
|
{
|
|
602
|
+
open: releaseModalShown,
|
|
602
603
|
handleClose: toggleAddReleaseModal,
|
|
603
604
|
handleSubmit: handleAddRelease,
|
|
604
605
|
isLoading: isSubmittingForm,
|
|
@@ -607,13 +608,13 @@ const ReleasesPage = () => {
|
|
|
607
608
|
)
|
|
608
609
|
] });
|
|
609
610
|
};
|
|
610
|
-
const ReleaseInfoWrapper =
|
|
611
|
+
const ReleaseInfoWrapper = styledComponents.styled(designSystem.Flex)`
|
|
611
612
|
align-self: stretch;
|
|
612
613
|
border-bottom-right-radius: ${({ theme }) => theme.borderRadius};
|
|
613
614
|
border-bottom-left-radius: ${({ theme }) => theme.borderRadius};
|
|
614
615
|
border-top: 1px solid ${({ theme }) => theme.colors.neutral150};
|
|
615
616
|
`;
|
|
616
|
-
const StyledMenuItem =
|
|
617
|
+
const StyledMenuItem = styledComponents.styled(designSystem.Menu.Item)`
|
|
617
618
|
svg path {
|
|
618
619
|
fill: ${({ theme, disabled }) => disabled && theme.colors.neutral500};
|
|
619
620
|
}
|
|
@@ -622,49 +623,54 @@ const StyledMenuItem = styled__default.default(v2.Menu.Item)`
|
|
|
622
623
|
}
|
|
623
624
|
|
|
624
625
|
&:hover {
|
|
625
|
-
background: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}100`]};
|
|
626
|
+
background: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}100`]};
|
|
626
627
|
}
|
|
627
628
|
`;
|
|
628
|
-
const PencilIcon =
|
|
629
|
+
const PencilIcon = styledComponents.styled(icons.Pencil)`
|
|
629
630
|
width: ${({ theme }) => theme.spaces[3]};
|
|
630
631
|
height: ${({ theme }) => theme.spaces[3]};
|
|
631
632
|
path {
|
|
632
633
|
fill: ${({ theme }) => theme.colors.neutral600};
|
|
633
634
|
}
|
|
634
635
|
`;
|
|
635
|
-
const TrashIcon =
|
|
636
|
+
const TrashIcon = styledComponents.styled(icons.Trash)`
|
|
636
637
|
width: ${({ theme }) => theme.spaces[3]};
|
|
637
638
|
height: ${({ theme }) => theme.spaces[3]};
|
|
638
639
|
path {
|
|
639
640
|
fill: ${({ theme }) => theme.colors.danger600};
|
|
640
641
|
}
|
|
641
642
|
`;
|
|
642
|
-
const TypographyMaxWidth =
|
|
643
|
+
const TypographyMaxWidth = styledComponents.styled(designSystem.Typography)`
|
|
643
644
|
max-width: 300px;
|
|
644
645
|
`;
|
|
645
|
-
const EntryValidationText = ({ action, schema,
|
|
646
|
+
const EntryValidationText = ({ action, schema, entry }) => {
|
|
646
647
|
const { formatMessage } = reactIntl.useIntl();
|
|
647
|
-
const { validate } = strapiAdmin.unstable_useDocument(
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
648
|
+
const { validate } = strapiAdmin$1.unstable_useDocument(
|
|
649
|
+
{
|
|
650
|
+
collectionType: schema?.kind ?? "",
|
|
651
|
+
model: schema?.uid ?? ""
|
|
652
|
+
},
|
|
653
|
+
{
|
|
654
|
+
skip: !schema
|
|
655
|
+
}
|
|
656
|
+
);
|
|
657
|
+
const errors = validate(entry) ?? {};
|
|
653
658
|
if (Object.keys(errors).length > 0) {
|
|
654
659
|
const validationErrorsMessages = Object.entries(errors).map(
|
|
655
660
|
([key, value]) => formatMessage(
|
|
661
|
+
// @ts-expect-error – TODO: fix this will better checks
|
|
656
662
|
{ id: `${value.id}.withField`, defaultMessage: value.defaultMessage },
|
|
657
663
|
{ field: key }
|
|
658
664
|
)
|
|
659
665
|
).join(" ");
|
|
660
666
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
661
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
667
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.CrossCircle, { fill: "danger600" }),
|
|
662
668
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tooltip, { description: validationErrorsMessages, children: /* @__PURE__ */ jsxRuntime.jsx(TypographyMaxWidth, { textColor: "danger600", variant: "omega", fontWeight: "semiBold", ellipsis: true, children: validationErrorsMessages }) })
|
|
663
669
|
] });
|
|
664
670
|
}
|
|
665
671
|
if (action == "publish") {
|
|
666
672
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
667
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
673
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
|
668
674
|
entry.publishedAt ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "success600", fontWeight: "bold", children: formatMessage({
|
|
669
675
|
id: "content-releases.pages.ReleaseDetails.entry-validation.already-published",
|
|
670
676
|
defaultMessage: "Already published"
|
|
@@ -675,7 +681,7 @@ const EntryValidationText = ({ action, schema, components, entry }) => {
|
|
|
675
681
|
] });
|
|
676
682
|
}
|
|
677
683
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
678
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
684
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
|
679
685
|
!entry.publishedAt ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "success600", fontWeight: "bold", children: formatMessage({
|
|
680
686
|
id: "content-releases.pages.ReleaseDetails.entry-validation.already-unpublished",
|
|
681
687
|
defaultMessage: "Already unpublished"
|
|
@@ -695,20 +701,23 @@ const ReleaseDetailsLayout = ({
|
|
|
695
701
|
const {
|
|
696
702
|
data,
|
|
697
703
|
isLoading: isLoadingDetails,
|
|
698
|
-
isError,
|
|
699
704
|
error
|
|
700
|
-
} = index.useGetReleaseQuery(
|
|
705
|
+
} = index.useGetReleaseQuery(
|
|
706
|
+
{ id: releaseId },
|
|
707
|
+
{
|
|
708
|
+
skip: !releaseId
|
|
709
|
+
}
|
|
710
|
+
);
|
|
701
711
|
const [publishRelease, { isLoading: isPublishing }] = index.usePublishReleaseMutation();
|
|
702
|
-
const toggleNotification =
|
|
703
|
-
const { formatAPIError } =
|
|
704
|
-
const {
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
const
|
|
708
|
-
const { trackUsage } = helperPlugin.useTracking();
|
|
712
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
713
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
714
|
+
const { allowedActions } = strapiAdmin.useRBAC(index.PERMISSIONS);
|
|
715
|
+
const { canUpdate, canDelete, canPublish } = allowedActions;
|
|
716
|
+
const dispatch = useTypedDispatch();
|
|
717
|
+
const { trackUsage } = strapiAdmin.useTracking();
|
|
709
718
|
const release = data?.data;
|
|
710
|
-
const handlePublishRelease = async () => {
|
|
711
|
-
const response = await publishRelease({ id
|
|
719
|
+
const handlePublishRelease = (id) => async () => {
|
|
720
|
+
const response = await publishRelease({ id });
|
|
712
721
|
if ("data" in response) {
|
|
713
722
|
toggleNotification({
|
|
714
723
|
type: "success",
|
|
@@ -723,20 +732,25 @@ const ReleaseDetailsLayout = ({
|
|
|
723
732
|
totalPublishedEntries,
|
|
724
733
|
totalUnpublishedEntries
|
|
725
734
|
});
|
|
726
|
-
} else if (
|
|
735
|
+
} else if (strapiAdmin.isFetchError(response.error)) {
|
|
727
736
|
toggleNotification({
|
|
728
|
-
type: "
|
|
737
|
+
type: "danger",
|
|
729
738
|
message: formatAPIError(response.error)
|
|
730
739
|
});
|
|
731
740
|
} else {
|
|
732
741
|
toggleNotification({
|
|
733
|
-
type: "
|
|
742
|
+
type: "danger",
|
|
734
743
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
735
744
|
});
|
|
736
745
|
}
|
|
737
746
|
};
|
|
738
747
|
const handleRefresh = () => {
|
|
739
|
-
dispatch(
|
|
748
|
+
dispatch(
|
|
749
|
+
index.releaseApi.util.invalidateTags([
|
|
750
|
+
{ type: "ReleaseAction", id: "LIST" },
|
|
751
|
+
{ type: "Release", id: releaseId }
|
|
752
|
+
])
|
|
753
|
+
);
|
|
740
754
|
};
|
|
741
755
|
const getCreatedByUser = () => {
|
|
742
756
|
if (!release?.createdBy) {
|
|
@@ -751,28 +765,26 @@ const ReleaseDetailsLayout = ({
|
|
|
751
765
|
return release.createdBy.email;
|
|
752
766
|
};
|
|
753
767
|
if (isLoadingDetails) {
|
|
754
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
768
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
|
|
755
769
|
}
|
|
756
|
-
if (
|
|
770
|
+
if (isBaseQueryError(error) && "code" in error || !release) {
|
|
757
771
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
758
|
-
reactRouterDom.
|
|
772
|
+
reactRouterDom.Navigate,
|
|
759
773
|
{
|
|
760
|
-
to:
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
}
|
|
774
|
+
to: "..",
|
|
775
|
+
state: {
|
|
776
|
+
errors: [
|
|
777
|
+
{
|
|
778
|
+
// @ts-expect-error – TODO: fix this weird error flow
|
|
779
|
+
code: error?.code
|
|
780
|
+
}
|
|
781
|
+
]
|
|
769
782
|
}
|
|
770
783
|
}
|
|
771
784
|
);
|
|
772
785
|
}
|
|
773
786
|
const totalEntries = release.actions.meta.count || 0;
|
|
774
787
|
const hasCreatedByUser = Boolean(getCreatedByUser());
|
|
775
|
-
const IsSchedulingEnabled = window.strapi.future.isEnabled("contentReleasesScheduling");
|
|
776
788
|
const isScheduled = release.scheduledAt && release.timezone;
|
|
777
789
|
const numberOfEntriesText = formatMessage(
|
|
778
790
|
{
|
|
@@ -803,34 +815,30 @@ const ReleaseDetailsLayout = ({
|
|
|
803
815
|
) : "";
|
|
804
816
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { "aria-busy": isLoadingDetails, children: [
|
|
805
817
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
806
|
-
|
|
818
|
+
strapiAdmin.Layouts.Header,
|
|
807
819
|
{
|
|
808
820
|
title: release.name,
|
|
809
821
|
subtitle: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, lineHeight: 6, children: [
|
|
810
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", variant: "epsilon", children: numberOfEntriesText + (
|
|
822
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", variant: "epsilon", children: numberOfEntriesText + (isScheduled ? ` - ${scheduledText}` : "") }),
|
|
811
823
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { ...getBadgeProps(release.status), children: release.status })
|
|
812
824
|
] }),
|
|
813
|
-
navigationAction: /* @__PURE__ */ jsxRuntime.jsx(
|
|
814
|
-
id: "global.back",
|
|
815
|
-
defaultMessage: "Back"
|
|
816
|
-
}) }),
|
|
825
|
+
navigationAction: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.BackButton, {}),
|
|
817
826
|
primaryAction: !release.releasedAt && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
818
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
827
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Root, { children: [
|
|
819
828
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
820
|
-
|
|
829
|
+
designSystem.Menu.Trigger,
|
|
821
830
|
{
|
|
822
|
-
as: designSystem.IconButton,
|
|
823
831
|
paddingLeft: 2,
|
|
824
832
|
paddingRight: 2,
|
|
825
833
|
"aria-label": formatMessage({
|
|
826
834
|
id: "content-releases.header.actions.open-release-actions",
|
|
827
835
|
defaultMessage: "Release edit and delete menu"
|
|
828
836
|
}),
|
|
829
|
-
|
|
830
|
-
|
|
837
|
+
variant: "tertiary",
|
|
838
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(icons.More, {})
|
|
831
839
|
}
|
|
832
840
|
),
|
|
833
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
841
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Content, { top: 1, popoverPlacement: "bottom-end", maxHeight: void 0, children: [
|
|
834
842
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
835
843
|
designSystem.Flex,
|
|
836
844
|
{
|
|
@@ -852,7 +860,7 @@ const ReleaseDetailsLayout = ({
|
|
|
852
860
|
{
|
|
853
861
|
disabled: !canDelete,
|
|
854
862
|
onSelect: toggleWarningSubmit,
|
|
855
|
-
variant: "danger",
|
|
863
|
+
$variant: "danger",
|
|
856
864
|
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 2, hasRadius: true, width: "100%", children: [
|
|
857
865
|
/* @__PURE__ */ jsxRuntime.jsx(TrashIcon, {}),
|
|
858
866
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { ellipsis: true, textColor: "danger600", children: formatMessage({
|
|
@@ -879,7 +887,7 @@ const ReleaseDetailsLayout = ({
|
|
|
879
887
|
defaultMessage: "Created"
|
|
880
888
|
}) }),
|
|
881
889
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", color: "neutral300", children: [
|
|
882
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
890
|
+
/* @__PURE__ */ jsxRuntime.jsx(RelativeTime$1, { timestamp: new Date(release.createdAt) }),
|
|
883
891
|
formatMessage(
|
|
884
892
|
{
|
|
885
893
|
id: "content-releases.header.actions.created.description",
|
|
@@ -897,12 +905,12 @@ const ReleaseDetailsLayout = ({
|
|
|
897
905
|
id: "content-releases.header.actions.refresh",
|
|
898
906
|
defaultMessage: "Refresh"
|
|
899
907
|
}) }),
|
|
900
|
-
|
|
908
|
+
canPublish ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
901
909
|
designSystem.Button,
|
|
902
910
|
{
|
|
903
911
|
size: "S",
|
|
904
912
|
variant: "default",
|
|
905
|
-
onClick: handlePublishRelease,
|
|
913
|
+
onClick: handlePublishRelease(release.id.toString()),
|
|
906
914
|
loading: isPublishing,
|
|
907
915
|
disabled: release.actions.meta.count === 0,
|
|
908
916
|
children: formatMessage({
|
|
@@ -910,7 +918,7 @@ const ReleaseDetailsLayout = ({
|
|
|
910
918
|
defaultMessage: "Publish"
|
|
911
919
|
})
|
|
912
920
|
}
|
|
913
|
-
)
|
|
921
|
+
) : null
|
|
914
922
|
] })
|
|
915
923
|
}
|
|
916
924
|
),
|
|
@@ -918,6 +926,7 @@ const ReleaseDetailsLayout = ({
|
|
|
918
926
|
] });
|
|
919
927
|
};
|
|
920
928
|
const GROUP_BY_OPTIONS = ["contentType", "locale", "action"];
|
|
929
|
+
const GROUP_BY_OPTIONS_NO_LOCALE = ["contentType", "action"];
|
|
921
930
|
const getGroupByOptionLabel = (value) => {
|
|
922
931
|
if (value === "locale") {
|
|
923
932
|
return {
|
|
@@ -936,21 +945,33 @@ const getGroupByOptionLabel = (value) => {
|
|
|
936
945
|
defaultMessage: "Content-Types"
|
|
937
946
|
};
|
|
938
947
|
};
|
|
939
|
-
const ReleaseDetailsBody = () => {
|
|
948
|
+
const ReleaseDetailsBody = ({ releaseId }) => {
|
|
940
949
|
const { formatMessage } = reactIntl.useIntl();
|
|
941
|
-
const {
|
|
942
|
-
const
|
|
943
|
-
const
|
|
944
|
-
const { formatAPIError } = helperPlugin.useAPIErrorHandler();
|
|
950
|
+
const [{ query }, setQuery] = strapiAdmin.useQueryParams();
|
|
951
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
952
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
945
953
|
const {
|
|
946
954
|
data: releaseData,
|
|
947
955
|
isLoading: isReleaseLoading,
|
|
948
|
-
isError: isReleaseError,
|
|
949
956
|
error: releaseError
|
|
950
957
|
} = index.useGetReleaseQuery({ id: releaseId });
|
|
951
958
|
const {
|
|
952
959
|
allowedActions: { canUpdate }
|
|
953
|
-
} =
|
|
960
|
+
} = strapiAdmin.useRBAC(index.PERMISSIONS);
|
|
961
|
+
const runHookWaterfall = strapiAdmin.useStrapiApp("ReleaseDetailsPage", (state) => state.runHookWaterfall);
|
|
962
|
+
const { hasI18nEnabled } = runHookWaterfall(
|
|
963
|
+
"ContentReleases/pages/ReleaseDetails/add-locale-in-releases",
|
|
964
|
+
{
|
|
965
|
+
displayedHeaders: {
|
|
966
|
+
label: formatMessage({
|
|
967
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.locale",
|
|
968
|
+
defaultMessage: "locale"
|
|
969
|
+
}),
|
|
970
|
+
name: "locale"
|
|
971
|
+
},
|
|
972
|
+
hasI18nEnabled: false
|
|
973
|
+
}
|
|
974
|
+
);
|
|
954
975
|
const release = releaseData?.data;
|
|
955
976
|
const selectedGroupBy = query?.groupBy || "contentType";
|
|
956
977
|
const {
|
|
@@ -979,65 +1000,59 @@ const ReleaseDetailsBody = () => {
|
|
|
979
1000
|
// We are passing the action path to found the position in the cache of the action for optimistic updates
|
|
980
1001
|
});
|
|
981
1002
|
if ("error" in response) {
|
|
982
|
-
if (
|
|
1003
|
+
if (strapiAdmin.isFetchError(response.error)) {
|
|
983
1004
|
toggleNotification({
|
|
984
|
-
type: "
|
|
1005
|
+
type: "danger",
|
|
985
1006
|
message: formatAPIError(response.error)
|
|
986
1007
|
});
|
|
987
1008
|
} else {
|
|
988
1009
|
toggleNotification({
|
|
989
|
-
type: "
|
|
1010
|
+
type: "danger",
|
|
990
1011
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
991
1012
|
});
|
|
992
1013
|
}
|
|
993
1014
|
}
|
|
994
1015
|
};
|
|
995
1016
|
if (isLoading || isReleaseLoading) {
|
|
996
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1017
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
|
|
997
1018
|
}
|
|
998
1019
|
const releaseActions = data?.data;
|
|
999
1020
|
const releaseMeta = data?.meta;
|
|
1000
1021
|
const contentTypes = releaseMeta?.contentTypes || {};
|
|
1001
1022
|
const components = releaseMeta?.components || {};
|
|
1002
|
-
if (
|
|
1023
|
+
if (isBaseQueryError(releaseError) || !release) {
|
|
1003
1024
|
const errorsArray = [];
|
|
1004
|
-
if (releaseError) {
|
|
1025
|
+
if (releaseError && "code" in releaseError) {
|
|
1005
1026
|
errorsArray.push({
|
|
1006
1027
|
code: releaseError.code
|
|
1007
1028
|
});
|
|
1008
1029
|
}
|
|
1009
|
-
if (releaseActionsError) {
|
|
1030
|
+
if (releaseActionsError && "code" in releaseActionsError) {
|
|
1010
1031
|
errorsArray.push({
|
|
1011
1032
|
code: releaseActionsError.code
|
|
1012
1033
|
});
|
|
1013
1034
|
}
|
|
1014
1035
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1015
|
-
reactRouterDom.
|
|
1036
|
+
reactRouterDom.Navigate,
|
|
1016
1037
|
{
|
|
1017
|
-
to:
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
errors: errorsArray
|
|
1021
|
-
}
|
|
1038
|
+
to: "..",
|
|
1039
|
+
state: {
|
|
1040
|
+
errors: errorsArray
|
|
1022
1041
|
}
|
|
1023
1042
|
}
|
|
1024
1043
|
);
|
|
1025
1044
|
}
|
|
1026
1045
|
if (isError || !releaseActions) {
|
|
1027
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1046
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Error, {});
|
|
1028
1047
|
}
|
|
1029
1048
|
if (Object.keys(releaseActions).length === 0) {
|
|
1030
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1031
|
-
|
|
1049
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1050
|
+
designSystem.EmptyStateLayout,
|
|
1032
1051
|
{
|
|
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
1052
|
action: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1038
|
-
|
|
1053
|
+
designSystem.LinkButton,
|
|
1039
1054
|
{
|
|
1040
|
-
|
|
1055
|
+
tag: reactRouterDom.Link,
|
|
1041
1056
|
to: {
|
|
1042
1057
|
pathname: "/content-manager"
|
|
1043
1058
|
},
|
|
@@ -1048,18 +1063,59 @@ const ReleaseDetailsBody = () => {
|
|
|
1048
1063
|
defaultMessage: "Open the Content Manager"
|
|
1049
1064
|
})
|
|
1050
1065
|
}
|
|
1051
|
-
)
|
|
1066
|
+
),
|
|
1067
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(symbols.EmptyDocuments, { width: "16rem" }),
|
|
1068
|
+
content: formatMessage({
|
|
1069
|
+
id: "content-releases.pages.Details.tab.emptyEntries",
|
|
1070
|
+
defaultMessage: "This release is empty. Open the Content Manager, select an entry and add it to the release."
|
|
1071
|
+
})
|
|
1052
1072
|
}
|
|
1053
1073
|
) });
|
|
1054
1074
|
}
|
|
1055
|
-
|
|
1075
|
+
const groupByLabel = formatMessage({
|
|
1076
|
+
id: "content-releases.pages.ReleaseDetails.groupBy.aria-label",
|
|
1077
|
+
defaultMessage: "Group by"
|
|
1078
|
+
});
|
|
1079
|
+
const headers = [
|
|
1080
|
+
// ...displayedHeaders,
|
|
1081
|
+
{
|
|
1082
|
+
label: formatMessage({
|
|
1083
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.name",
|
|
1084
|
+
defaultMessage: "name"
|
|
1085
|
+
}),
|
|
1086
|
+
name: "name"
|
|
1087
|
+
},
|
|
1088
|
+
{
|
|
1089
|
+
label: formatMessage({
|
|
1090
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.content-type",
|
|
1091
|
+
defaultMessage: "content-type"
|
|
1092
|
+
}),
|
|
1093
|
+
name: "content-type"
|
|
1094
|
+
},
|
|
1095
|
+
{
|
|
1096
|
+
label: formatMessage({
|
|
1097
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.action",
|
|
1098
|
+
defaultMessage: "action"
|
|
1099
|
+
}),
|
|
1100
|
+
name: "action"
|
|
1101
|
+
},
|
|
1102
|
+
...!release.releasedAt ? [
|
|
1103
|
+
{
|
|
1104
|
+
label: formatMessage({
|
|
1105
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.status",
|
|
1106
|
+
defaultMessage: "status"
|
|
1107
|
+
}),
|
|
1108
|
+
name: "status"
|
|
1109
|
+
}
|
|
1110
|
+
] : []
|
|
1111
|
+
];
|
|
1112
|
+
const options = hasI18nEnabled ? GROUP_BY_OPTIONS : GROUP_BY_OPTIONS_NO_LOCALE;
|
|
1113
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 8, direction: "column", alignItems: "stretch", children: [
|
|
1056
1114
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1057
1115
|
designSystem.SingleSelect,
|
|
1058
1116
|
{
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
defaultMessage: "Group by"
|
|
1062
|
-
}),
|
|
1117
|
+
placeholder: groupByLabel,
|
|
1118
|
+
"aria-label": groupByLabel,
|
|
1063
1119
|
customizeContent: (value) => formatMessage(
|
|
1064
1120
|
{
|
|
1065
1121
|
id: `content-releases.pages.ReleaseDetails.groupBy.label`,
|
|
@@ -1071,84 +1127,27 @@ const ReleaseDetailsBody = () => {
|
|
|
1071
1127
|
),
|
|
1072
1128
|
value: formatMessage(getGroupByOptionLabel(selectedGroupBy)),
|
|
1073
1129
|
onChange: (value) => setQuery({ groupBy: value }),
|
|
1074
|
-
children:
|
|
1130
|
+
children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: option, children: formatMessage(getGroupByOptionLabel(option)) }, option))
|
|
1075
1131
|
}
|
|
1076
1132
|
) }),
|
|
1077
1133
|
Object.keys(releaseActions).map((key) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, direction: "column", alignItems: "stretch", children: [
|
|
1078
1134
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { role: "separator", "aria-label": key, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { children: key }) }),
|
|
1079
1135
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1080
|
-
|
|
1136
|
+
strapiAdmin.Table.Root,
|
|
1081
1137
|
{
|
|
1082
1138
|
rows: releaseActions[key].map((item) => ({
|
|
1083
1139
|
...item,
|
|
1084
1140
|
id: Number(item.entry.id)
|
|
1085
1141
|
})),
|
|
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(
|
|
1142
|
+
headers,
|
|
1143
|
+
isLoading: isLoading || isFetching,
|
|
1144
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(strapiAdmin.Table.Content, { children: [
|
|
1145
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Head, { children: headers.map((header) => /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.HeaderCell, { ...header }, header.name)) }),
|
|
1146
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Loading, {}),
|
|
1147
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Body, { children: releaseActions[key].map(
|
|
1149
1148
|
({ id, contentType, locale, type, entry }, actionIndex) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
1150
1149
|
/* @__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 : "-"}` }) }),
|
|
1150
|
+
hasI18nEnabled && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "10%", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: `${locale?.name ? locale.name : "-"}` }) }),
|
|
1152
1151
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "10%", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: contentType.displayName || "" }) }),
|
|
1153
1152
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "20%", children: release.releasedAt ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage(
|
|
1154
1153
|
{
|
|
@@ -1202,34 +1201,39 @@ const ReleaseDetailsBody = () => {
|
|
|
1202
1201
|
}
|
|
1203
1202
|
)
|
|
1204
1203
|
] }, `releases-group-${key}`)),
|
|
1205
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
}
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1204
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1205
|
+
strapiAdmin.Pagination.Root,
|
|
1206
|
+
{
|
|
1207
|
+
...releaseMeta?.pagination,
|
|
1208
|
+
defaultPageSize: releaseMeta?.pagination?.pageSize,
|
|
1209
|
+
children: [
|
|
1210
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.PageSize, {}),
|
|
1211
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.Links, {})
|
|
1212
|
+
]
|
|
1213
|
+
}
|
|
1214
|
+
)
|
|
1216
1215
|
] }) });
|
|
1217
1216
|
};
|
|
1218
1217
|
const ReleaseDetailsPage = () => {
|
|
1219
1218
|
const { formatMessage } = reactIntl.useIntl();
|
|
1220
1219
|
const { releaseId } = reactRouterDom.useParams();
|
|
1221
|
-
const toggleNotification =
|
|
1222
|
-
const { formatAPIError } =
|
|
1223
|
-
const
|
|
1220
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
1221
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
1222
|
+
const navigate = reactRouterDom.useNavigate();
|
|
1224
1223
|
const [releaseModalShown, setReleaseModalShown] = React__namespace.useState(false);
|
|
1225
1224
|
const [showWarningSubmit, setWarningSubmit] = React__namespace.useState(false);
|
|
1226
1225
|
const {
|
|
1227
1226
|
isLoading: isLoadingDetails,
|
|
1228
1227
|
data,
|
|
1229
1228
|
isSuccess: isSuccessDetails
|
|
1230
|
-
} = index.useGetReleaseQuery(
|
|
1229
|
+
} = index.useGetReleaseQuery(
|
|
1230
|
+
{ id: releaseId },
|
|
1231
|
+
{
|
|
1232
|
+
skip: !releaseId
|
|
1233
|
+
}
|
|
1234
|
+
);
|
|
1231
1235
|
const [updateRelease, { isLoading: isSubmittingForm }] = index.useUpdateReleaseMutation();
|
|
1232
|
-
const [deleteRelease
|
|
1236
|
+
const [deleteRelease] = index.useDeleteReleaseMutation();
|
|
1233
1237
|
const toggleEditReleaseModal = () => {
|
|
1234
1238
|
setReleaseModalShown((prev) => !prev);
|
|
1235
1239
|
};
|
|
@@ -1240,15 +1244,18 @@ const ReleaseDetailsPage = () => {
|
|
|
1240
1244
|
{
|
|
1241
1245
|
toggleEditReleaseModal,
|
|
1242
1246
|
toggleWarningSubmit,
|
|
1243
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1247
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {})
|
|
1244
1248
|
}
|
|
1245
1249
|
);
|
|
1246
1250
|
}
|
|
1251
|
+
if (!releaseId) {
|
|
1252
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: ".." });
|
|
1253
|
+
}
|
|
1247
1254
|
const releaseData = isSuccessDetails && data?.data || null;
|
|
1248
1255
|
const title = releaseData?.name || "";
|
|
1249
1256
|
const timezone = releaseData?.timezone ?? null;
|
|
1250
1257
|
const scheduledAt = releaseData?.scheduledAt && timezone ? dateFnsTz.utcToZonedTime(releaseData.scheduledAt, timezone) : null;
|
|
1251
|
-
const date = scheduledAt ?
|
|
1258
|
+
const date = scheduledAt ? format__default.default(scheduledAt, "yyyy-MM-dd") : void 0;
|
|
1252
1259
|
const time = scheduledAt ? format__default.default(scheduledAt, "HH:mm") : "";
|
|
1253
1260
|
const handleEditRelease = async (values) => {
|
|
1254
1261
|
const response = await updateRelease({
|
|
@@ -1265,33 +1272,33 @@ const ReleaseDetailsPage = () => {
|
|
|
1265
1272
|
defaultMessage: "Release updated."
|
|
1266
1273
|
})
|
|
1267
1274
|
});
|
|
1268
|
-
|
|
1275
|
+
toggleEditReleaseModal();
|
|
1276
|
+
} else if (strapiAdmin.isFetchError(response.error)) {
|
|
1269
1277
|
toggleNotification({
|
|
1270
|
-
type: "
|
|
1278
|
+
type: "danger",
|
|
1271
1279
|
message: formatAPIError(response.error)
|
|
1272
1280
|
});
|
|
1273
1281
|
} else {
|
|
1274
1282
|
toggleNotification({
|
|
1275
|
-
type: "
|
|
1283
|
+
type: "danger",
|
|
1276
1284
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
1277
1285
|
});
|
|
1278
1286
|
}
|
|
1279
|
-
toggleEditReleaseModal();
|
|
1280
1287
|
};
|
|
1281
1288
|
const handleDeleteRelease = async () => {
|
|
1282
1289
|
const response = await deleteRelease({
|
|
1283
1290
|
id: releaseId
|
|
1284
1291
|
});
|
|
1285
1292
|
if ("data" in response) {
|
|
1286
|
-
|
|
1287
|
-
} else if (
|
|
1293
|
+
navigate("..");
|
|
1294
|
+
} else if (strapiAdmin.isFetchError(response.error)) {
|
|
1288
1295
|
toggleNotification({
|
|
1289
|
-
type: "
|
|
1296
|
+
type: "danger",
|
|
1290
1297
|
message: formatAPIError(response.error)
|
|
1291
1298
|
});
|
|
1292
1299
|
} else {
|
|
1293
1300
|
toggleNotification({
|
|
1294
|
-
type: "
|
|
1301
|
+
type: "danger",
|
|
1295
1302
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
1296
1303
|
});
|
|
1297
1304
|
}
|
|
@@ -1302,10 +1309,11 @@ const ReleaseDetailsPage = () => {
|
|
|
1302
1309
|
toggleEditReleaseModal,
|
|
1303
1310
|
toggleWarningSubmit,
|
|
1304
1311
|
children: [
|
|
1305
|
-
/* @__PURE__ */ jsxRuntime.jsx(ReleaseDetailsBody, {}),
|
|
1306
|
-
|
|
1312
|
+
/* @__PURE__ */ jsxRuntime.jsx(ReleaseDetailsBody, { releaseId }),
|
|
1313
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1307
1314
|
ReleaseModal,
|
|
1308
1315
|
{
|
|
1316
|
+
open: releaseModalShown,
|
|
1309
1317
|
handleClose: toggleEditReleaseModal,
|
|
1310
1318
|
handleSubmit: handleEditRelease,
|
|
1311
1319
|
isLoading: isLoadingDetails || isSubmittingForm,
|
|
@@ -1319,28 +1327,19 @@ const ReleaseDetailsPage = () => {
|
|
|
1319
1327
|
}
|
|
1320
1328
|
}
|
|
1321
1329
|
),
|
|
1322
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
id: "content-releases.dialog.confirmation-message",
|
|
1327
|
-
defaultMessage: "Are you sure you want to delete this release?"
|
|
1328
|
-
},
|
|
1329
|
-
isOpen: showWarningSubmit,
|
|
1330
|
-
isConfirmButtonLoading: isDeletingRelease,
|
|
1331
|
-
onToggleDialog: toggleWarningSubmit,
|
|
1332
|
-
onConfirm: handleDeleteRelease
|
|
1333
|
-
}
|
|
1334
|
-
)
|
|
1330
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Root, { open: showWarningSubmit, onOpenChange: toggleWarningSubmit, children: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.ConfirmDialog, { onConfirm: handleDeleteRelease, children: formatMessage({
|
|
1331
|
+
id: "content-releases.dialog.confirmation-message",
|
|
1332
|
+
defaultMessage: "Are you sure you want to delete this release?"
|
|
1333
|
+
}) }) })
|
|
1335
1334
|
]
|
|
1336
1335
|
}
|
|
1337
1336
|
);
|
|
1338
1337
|
};
|
|
1339
1338
|
const App = () => {
|
|
1340
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1341
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, {
|
|
1342
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, {
|
|
1339
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Protect, { permissions: index.PERMISSIONS.main, children: /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.Routes, { children: [
|
|
1340
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { index: true, element: /* @__PURE__ */ jsxRuntime.jsx(ReleasesPage, {}) }),
|
|
1341
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: ":releaseId", element: /* @__PURE__ */ jsxRuntime.jsx(ReleaseDetailsPage, {}) })
|
|
1343
1342
|
] }) });
|
|
1344
1343
|
};
|
|
1345
1344
|
exports.App = App;
|
|
1346
|
-
//# sourceMappingURL=App-
|
|
1345
|
+
//# sourceMappingURL=App-CqbuK4M6.js.map
|