@strapi/content-releases 0.0.0-experimental.bb0b6c425a787a0a8268bb133787d71713c56944 → 0.0.0-experimental.c3e9d4b26f9fd3d9eb530b5c11f9baa1d09b13ad
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-c5uGEz9O.js → App-DUmziQ17.js} +416 -385
- package/dist/_chunks/App-DUmziQ17.js.map +1 -0
- package/dist/_chunks/{App-xQ5ljY7-.mjs → App-D_6Y9N2F.mjs} +395 -363
- package/dist/_chunks/App-D_6Y9N2F.mjs.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-bpIYXOfu.js → PurchaseContentReleases-Be3acS2L.js} +7 -6
- package/dist/_chunks/PurchaseContentReleases-Be3acS2L.js.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-3tRbmbY3.mjs → PurchaseContentReleases-_MxP6-Dt.mjs} +8 -7
- package/dist/_chunks/PurchaseContentReleases-_MxP6-Dt.mjs.map +1 -0
- package/dist/_chunks/{en-bpHsnU0n.mjs → en-B9Ur3VsE.mjs} +2 -1
- package/dist/_chunks/en-B9Ur3VsE.mjs.map +1 -0
- package/dist/_chunks/{en-3SGjiVyR.js → en-DtFJ5ViE.js} +2 -1
- package/dist/_chunks/en-DtFJ5ViE.js.map +1 -0
- package/dist/_chunks/{index-ifoPtgmH.mjs → index-BomF0-yY.mjs} +207 -392
- package/dist/_chunks/index-BomF0-yY.mjs.map +1 -0
- package/dist/_chunks/{index-4U0Q_Fgd.js → index-C5Hc767q.js} +207 -394
- package/dist/_chunks/index-C5Hc767q.js.map +1 -0
- package/dist/admin/index.js +1 -15
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +2 -16
- package/dist/admin/index.mjs.map +1 -1
- package/dist/admin/src/components/CMReleasesContainer.d.ts +22 -0
- package/dist/admin/src/components/RelativeTime.d.ts +28 -0
- package/dist/admin/src/components/ReleaseAction.d.ts +3 -0
- package/dist/admin/src/components/ReleaseActionMenu.d.ts +26 -0
- package/dist/admin/src/components/ReleaseActionOptions.d.ts +9 -0
- package/dist/admin/src/components/ReleaseListCell.d.ts +0 -0
- package/dist/admin/src/components/ReleaseModal.d.ts +16 -0
- package/dist/admin/src/constants.d.ts +58 -0
- package/dist/admin/src/index.d.ts +3 -0
- package/dist/admin/src/pages/App.d.ts +1 -0
- package/dist/admin/src/pages/PurchaseContentReleases.d.ts +2 -0
- package/dist/admin/src/pages/ReleaseDetailsPage.d.ts +2 -0
- package/dist/admin/src/pages/ReleasesPage.d.ts +8 -0
- package/dist/admin/src/pages/tests/mockReleaseDetailsPageData.d.ts +181 -0
- package/dist/admin/src/pages/tests/mockReleasesPageData.d.ts +39 -0
- package/dist/admin/src/pluginId.d.ts +1 -0
- package/dist/admin/src/services/release.d.ts +105 -0
- package/dist/admin/src/store/hooks.d.ts +7 -0
- package/dist/admin/src/utils/api.d.ts +6 -0
- package/dist/admin/src/utils/prefixPluginTranslations.d.ts +3 -0
- package/dist/admin/src/utils/time.d.ts +1 -0
- package/dist/server/index.js +152 -93
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +153 -93
- 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-c5uGEz9O.js.map +0 -1
- package/dist/_chunks/App-xQ5ljY7-.mjs.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-3tRbmbY3.mjs.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-bpIYXOfu.js.map +0 -1
- package/dist/_chunks/en-3SGjiVyR.js.map +0 -1
- package/dist/_chunks/en-bpHsnU0n.mjs.map +0 -1
- package/dist/_chunks/index-4U0Q_Fgd.js.map +0 -1
- package/dist/_chunks/index-ifoPtgmH.mjs.map +0 -1
|
@@ -1,25 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
-
const
|
|
4
|
+
const strapiAdmin = require("@strapi/admin/strapi-admin");
|
|
5
5
|
const reactRouterDom = require("react-router-dom");
|
|
6
|
-
const index = require("./index-
|
|
6
|
+
const index = require("./index-C5Hc767q.js");
|
|
7
7
|
const React = require("react");
|
|
8
|
-
const strapiAdmin = require("@strapi/
|
|
8
|
+
const strapiAdmin$1 = require("@strapi/content-manager/strapi-admin");
|
|
9
9
|
const designSystem = require("@strapi/design-system");
|
|
10
|
-
const v2 = require("@strapi/design-system/v2");
|
|
11
10
|
const icons = require("@strapi/icons");
|
|
11
|
+
const symbols = require("@strapi/icons/symbols");
|
|
12
12
|
const format = require("date-fns/format");
|
|
13
13
|
const dateFnsTz = require("date-fns-tz");
|
|
14
14
|
const reactIntl = require("react-intl");
|
|
15
|
-
const
|
|
15
|
+
const styledComponents = require("styled-components");
|
|
16
16
|
const dateFns = require("date-fns");
|
|
17
17
|
const formik = require("formik");
|
|
18
18
|
const yup = require("yup");
|
|
19
|
-
require("
|
|
20
|
-
require("
|
|
21
|
-
require("@reduxjs/toolkit/query/react");
|
|
22
|
-
require("react-redux");
|
|
19
|
+
const reactRedux = require("react-redux");
|
|
20
|
+
const ee = require("@strapi/admin/strapi-admin/ee");
|
|
23
21
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
24
22
|
function _interopNamespace(e) {
|
|
25
23
|
if (e && e.__esModule)
|
|
@@ -41,8 +39,37 @@ function _interopNamespace(e) {
|
|
|
41
39
|
}
|
|
42
40
|
const React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
|
43
41
|
const format__default = /* @__PURE__ */ _interopDefault(format);
|
|
44
|
-
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
45
42
|
const yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
|
|
43
|
+
const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
|
|
44
|
+
const RelativeTime$1 = React__namespace.forwardRef(
|
|
45
|
+
({ timestamp, customIntervals = [], ...restProps }, forwardedRef) => {
|
|
46
|
+
const { formatRelativeTime, formatDate, formatTime } = reactIntl.useIntl();
|
|
47
|
+
const interval = dateFns.intervalToDuration({
|
|
48
|
+
start: timestamp,
|
|
49
|
+
end: Date.now()
|
|
50
|
+
// see https://github.com/date-fns/date-fns/issues/2891 – No idea why it's all partial it returns it every time.
|
|
51
|
+
});
|
|
52
|
+
const unit = intervals.find((intervalUnit) => {
|
|
53
|
+
return interval[intervalUnit] > 0 && Object.keys(interval).includes(intervalUnit);
|
|
54
|
+
});
|
|
55
|
+
const relativeTime = dateFns.isPast(timestamp) ? -interval[unit] : interval[unit];
|
|
56
|
+
const customInterval = customIntervals.find(
|
|
57
|
+
(custom) => interval[custom.unit] < custom.threshold
|
|
58
|
+
);
|
|
59
|
+
const displayText = customInterval ? customInterval.text : formatRelativeTime(relativeTime, unit, { numeric: "auto" });
|
|
60
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
61
|
+
"time",
|
|
62
|
+
{
|
|
63
|
+
ref: forwardedRef,
|
|
64
|
+
dateTime: timestamp.toISOString(),
|
|
65
|
+
role: "time",
|
|
66
|
+
title: `${formatDate(timestamp)} ${formatTime(timestamp)}`,
|
|
67
|
+
...restProps,
|
|
68
|
+
children: displayText
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
);
|
|
46
73
|
const RELEASE_SCHEMA = yup__namespace.object().shape({
|
|
47
74
|
name: yup__namespace.string().trim().required(),
|
|
48
75
|
scheduledAt: yup__namespace.string().nullable(),
|
|
@@ -112,120 +139,119 @@ const ReleaseModal = ({
|
|
|
112
139
|
},
|
|
113
140
|
validationSchema: RELEASE_SCHEMA,
|
|
114
141
|
validateOnChange: false,
|
|
115
|
-
children: ({ values, errors, handleChange, setFieldValue }) =>
|
|
116
|
-
|
|
117
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
118
|
-
designSystem.
|
|
119
|
-
|
|
120
|
-
label: formatMessage({
|
|
142
|
+
children: ({ values, errors, handleChange, setFieldValue }) => {
|
|
143
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(formik.Form, { children: [
|
|
144
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.ModalBody, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
|
|
145
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { name: "name", error: errors.name, required: true, children: [
|
|
146
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
121
147
|
id: "content-releases.modal.form.input.label.release-name",
|
|
122
148
|
defaultMessage: "Name"
|
|
123
|
-
}),
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
designSystem.DatePicker,
|
|
165
|
-
{
|
|
166
|
-
label: formatMessage({
|
|
149
|
+
}) }),
|
|
150
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.TextInput, { value: values.name, onChange: handleChange }),
|
|
151
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
152
|
+
] }),
|
|
153
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "max-content", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
154
|
+
designSystem.Checkbox,
|
|
155
|
+
{
|
|
156
|
+
name: "isScheduled",
|
|
157
|
+
value: values.isScheduled,
|
|
158
|
+
onChange: (event) => {
|
|
159
|
+
setFieldValue("isScheduled", event.target.checked);
|
|
160
|
+
if (!event.target.checked) {
|
|
161
|
+
setFieldValue("date", null);
|
|
162
|
+
setFieldValue("time", "");
|
|
163
|
+
setFieldValue("timezone", null);
|
|
164
|
+
} else {
|
|
165
|
+
setFieldValue("date", initialValues.date);
|
|
166
|
+
setFieldValue("time", initialValues.time);
|
|
167
|
+
setFieldValue(
|
|
168
|
+
"timezone",
|
|
169
|
+
initialValues.timezone ?? systemTimezone?.value
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
174
|
+
designSystem.Typography,
|
|
175
|
+
{
|
|
176
|
+
textColor: values.isScheduled ? "primary600" : "neutral800",
|
|
177
|
+
fontWeight: values.isScheduled ? "semiBold" : "regular",
|
|
178
|
+
children: formatMessage({
|
|
179
|
+
id: "modal.form.input.label.schedule-release",
|
|
180
|
+
defaultMessage: "Schedule release"
|
|
181
|
+
})
|
|
182
|
+
}
|
|
183
|
+
)
|
|
184
|
+
}
|
|
185
|
+
) }),
|
|
186
|
+
values.isScheduled && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
187
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, alignItems: "start", children: [
|
|
188
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { name: "date", error: errors.date, required: true, children: [
|
|
189
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
167
190
|
id: "content-releases.modal.form.input.label.date",
|
|
168
191
|
defaultMessage: "Date"
|
|
169
|
-
}),
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
{
|
|
191
|
-
|
|
192
|
+
}) }),
|
|
193
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
194
|
+
designSystem.DatePicker,
|
|
195
|
+
{
|
|
196
|
+
onChange: (date) => {
|
|
197
|
+
const isoFormatDate = date ? dateFns.formatISO(date, { representation: "date" }) : null;
|
|
198
|
+
setFieldValue("date", isoFormatDate);
|
|
199
|
+
},
|
|
200
|
+
clearLabel: formatMessage({
|
|
201
|
+
id: "content-releases.modal.form.input.clearLabel",
|
|
202
|
+
defaultMessage: "Clear"
|
|
203
|
+
}),
|
|
204
|
+
onClear: () => {
|
|
205
|
+
setFieldValue("date", null);
|
|
206
|
+
},
|
|
207
|
+
value: values.date ? new Date(values.date) : /* @__PURE__ */ new Date(),
|
|
208
|
+
minDate: dateFnsTz.utcToZonedTime(/* @__PURE__ */ new Date(), values.timezone.split("&")[1])
|
|
209
|
+
}
|
|
210
|
+
),
|
|
211
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
212
|
+
] }) }),
|
|
213
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { name: "time", error: errors.time, required: true, children: [
|
|
214
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
192
215
|
id: "content-releases.modal.form.input.label.time",
|
|
193
216
|
defaultMessage: "Time"
|
|
194
|
-
}),
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
217
|
+
}) }),
|
|
218
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
219
|
+
designSystem.TimePicker,
|
|
220
|
+
{
|
|
221
|
+
onChange: (time) => {
|
|
222
|
+
setFieldValue("time", time);
|
|
223
|
+
},
|
|
224
|
+
clearLabel: formatMessage({
|
|
225
|
+
id: "content-releases.modal.form.input.clearLabel",
|
|
226
|
+
defaultMessage: "Clear"
|
|
227
|
+
}),
|
|
228
|
+
onClear: () => {
|
|
229
|
+
setFieldValue("time", "");
|
|
230
|
+
},
|
|
231
|
+
value: values.time || void 0
|
|
232
|
+
}
|
|
233
|
+
),
|
|
234
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
235
|
+
] }) })
|
|
236
|
+
] }),
|
|
237
|
+
/* @__PURE__ */ jsxRuntime.jsx(TimezoneComponent, { timezoneOptions: timezoneList })
|
|
238
|
+
] })
|
|
239
|
+
] }) }),
|
|
240
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
241
|
+
designSystem.ModalFooter,
|
|
242
|
+
{
|
|
243
|
+
startActions: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: handleClose, variant: "tertiary", name: "cancel", children: formatMessage({ id: "cancel", defaultMessage: "Cancel" }) }),
|
|
244
|
+
endActions: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { name: "submit", loading: isLoading, type: "submit", children: formatMessage(
|
|
245
|
+
{
|
|
246
|
+
id: "content-releases.modal.form.button.submit",
|
|
247
|
+
defaultMessage: "{isCreatingRelease, select, true {Continue} other {Save}}"
|
|
248
|
+
},
|
|
249
|
+
{ isCreatingRelease }
|
|
210
250
|
) })
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
216
|
-
designSystem.ModalFooter,
|
|
217
|
-
{
|
|
218
|
-
startActions: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: handleClose, variant: "tertiary", name: "cancel", children: formatMessage({ id: "cancel", defaultMessage: "Cancel" }) }),
|
|
219
|
-
endActions: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { name: "submit", loading: isLoading, type: "submit", children: formatMessage(
|
|
220
|
-
{
|
|
221
|
-
id: "content-releases.modal.form.button.submit",
|
|
222
|
-
defaultMessage: "{isCreatingRelease, select, true {Continue} other {Save}}"
|
|
223
|
-
},
|
|
224
|
-
{ isCreatingRelease }
|
|
225
|
-
) })
|
|
226
|
-
}
|
|
227
|
-
)
|
|
228
|
-
] })
|
|
251
|
+
}
|
|
252
|
+
)
|
|
253
|
+
] });
|
|
254
|
+
}
|
|
229
255
|
}
|
|
230
256
|
)
|
|
231
257
|
] });
|
|
@@ -254,37 +280,44 @@ const TimezoneComponent = ({ timezoneOptions }) => {
|
|
|
254
280
|
}
|
|
255
281
|
}
|
|
256
282
|
}, [setFieldValue, values.date, values.timezone]);
|
|
257
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
258
|
-
designSystem.
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
}
|
|
281
|
-
);
|
|
283
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { name: "timezone", error: errors.timezone, required: true, children: [
|
|
284
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
285
|
+
id: "content-releases.modal.form.input.label.timezone",
|
|
286
|
+
defaultMessage: "Timezone"
|
|
287
|
+
}) }),
|
|
288
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
289
|
+
designSystem.Combobox,
|
|
290
|
+
{
|
|
291
|
+
autocomplete: { type: "list", filter: "contains" },
|
|
292
|
+
value: values.timezone || void 0,
|
|
293
|
+
textValue: values.timezone ? values.timezone.replace(/&/, " ") : void 0,
|
|
294
|
+
onChange: (timezone) => {
|
|
295
|
+
setFieldValue("timezone", timezone);
|
|
296
|
+
},
|
|
297
|
+
onTextValueChange: (timezone) => {
|
|
298
|
+
setFieldValue("timezone", timezone);
|
|
299
|
+
},
|
|
300
|
+
onClear: () => {
|
|
301
|
+
setFieldValue("timezone", "");
|
|
302
|
+
},
|
|
303
|
+
children: timezoneList.map((timezone) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.ComboboxOption, { value: timezone.value, children: timezone.value.replace(/&/, " ") }, timezone.value))
|
|
304
|
+
}
|
|
305
|
+
),
|
|
306
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
307
|
+
] });
|
|
308
|
+
};
|
|
309
|
+
const useTypedDispatch = reactRedux.useDispatch;
|
|
310
|
+
const isBaseQueryError = (error) => {
|
|
311
|
+
return typeof error !== "undefined" && error.name !== void 0;
|
|
282
312
|
};
|
|
283
|
-
const LinkCard =
|
|
313
|
+
const LinkCard = styledComponents.styled(designSystem.Link)`
|
|
284
314
|
display: block;
|
|
285
315
|
`;
|
|
286
|
-
const
|
|
287
|
-
|
|
316
|
+
const RelativeTime = styledComponents.styled(RelativeTime$1)`
|
|
317
|
+
display: inline-block;
|
|
318
|
+
&::first-letter {
|
|
319
|
+
text-transform: uppercase;
|
|
320
|
+
}
|
|
288
321
|
`;
|
|
289
322
|
const getBadgeProps = (status) => {
|
|
290
323
|
let color;
|
|
@@ -314,7 +347,7 @@ const getBadgeProps = (status) => {
|
|
|
314
347
|
const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
315
348
|
const { formatMessage } = reactIntl.useIntl();
|
|
316
349
|
if (isError) {
|
|
317
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
350
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Error, {});
|
|
318
351
|
}
|
|
319
352
|
if (releases?.length === 0) {
|
|
320
353
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -329,11 +362,11 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
329
362
|
target: sectionTitle
|
|
330
363
|
}
|
|
331
364
|
),
|
|
332
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
365
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(symbols.EmptyDocuments, { width: "16rem" })
|
|
333
366
|
}
|
|
334
367
|
);
|
|
335
368
|
}
|
|
336
|
-
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, {
|
|
369
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid, { gap: 4, children: releases.map(({ id, name, scheduledAt, status }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.GridItem, { col: 3, s: 6, xs: 12, children: /* @__PURE__ */ jsxRuntime.jsx(LinkCard, { tag: reactRouterDom.NavLink, to: `${id}`, isExternal: false, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
337
370
|
designSystem.Flex,
|
|
338
371
|
{
|
|
339
372
|
direction: "column",
|
|
@@ -348,8 +381,8 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
348
381
|
gap: 4,
|
|
349
382
|
children: [
|
|
350
383
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "start", gap: 1, children: [
|
|
351
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, {
|
|
352
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: scheduledAt ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
384
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "h3", variant: "delta", fontWeight: "bold", children: name }),
|
|
385
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: scheduledAt ? /* @__PURE__ */ jsxRuntime.jsx(RelativeTime, { timestamp: new Date(scheduledAt) }) : formatMessage({
|
|
353
386
|
id: "content-releases.pages.Releases.not-scheduled",
|
|
354
387
|
defaultMessage: "Not scheduled"
|
|
355
388
|
}) })
|
|
@@ -359,7 +392,7 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
359
392
|
}
|
|
360
393
|
) }) }, id)) });
|
|
361
394
|
};
|
|
362
|
-
const StyledAlert =
|
|
395
|
+
const StyledAlert = styledComponents.styled(designSystem.Alert)`
|
|
363
396
|
button {
|
|
364
397
|
display: none;
|
|
365
398
|
}
|
|
@@ -369,7 +402,7 @@ const StyledAlert = styled__default.default(designSystem.Alert)`
|
|
|
369
402
|
`;
|
|
370
403
|
const INITIAL_FORM_VALUES = {
|
|
371
404
|
name: "",
|
|
372
|
-
date:
|
|
405
|
+
date: void 0,
|
|
373
406
|
time: "",
|
|
374
407
|
isScheduled: true,
|
|
375
408
|
scheduledAt: null,
|
|
@@ -379,23 +412,26 @@ const ReleasesPage = () => {
|
|
|
379
412
|
const tabRef = React__namespace.useRef(null);
|
|
380
413
|
const location = reactRouterDom.useLocation();
|
|
381
414
|
const [releaseModalShown, setReleaseModalShown] = React__namespace.useState(false);
|
|
382
|
-
const toggleNotification =
|
|
415
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
383
416
|
const { formatMessage } = reactIntl.useIntl();
|
|
384
|
-
const
|
|
385
|
-
const { formatAPIError } =
|
|
386
|
-
const [{ query }, setQuery] =
|
|
417
|
+
const navigate = reactRouterDom.useNavigate();
|
|
418
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
419
|
+
const [{ query }, setQuery] = strapiAdmin.useQueryParams();
|
|
387
420
|
const response = index.useGetReleasesQuery(query);
|
|
388
421
|
const [createRelease, { isLoading: isSubmittingForm }] = index.useCreateReleaseMutation();
|
|
389
|
-
const { getFeature } =
|
|
422
|
+
const { getFeature } = ee.useLicenseLimits();
|
|
390
423
|
const { maximumReleases = 3 } = getFeature("cms-content-releases");
|
|
391
|
-
const { trackUsage } =
|
|
424
|
+
const { trackUsage } = strapiAdmin.useTracking();
|
|
425
|
+
const {
|
|
426
|
+
allowedActions: { canCreate }
|
|
427
|
+
} = strapiAdmin.useRBAC(index.PERMISSIONS);
|
|
392
428
|
const { isLoading, isSuccess, isError } = response;
|
|
393
429
|
const activeTab = response?.currentData?.meta?.activeTab || "pending";
|
|
394
430
|
const activeTabIndex = ["pending", "done"].indexOf(activeTab);
|
|
395
431
|
React__namespace.useEffect(() => {
|
|
396
432
|
if (location?.state?.errors) {
|
|
397
433
|
toggleNotification({
|
|
398
|
-
type: "
|
|
434
|
+
type: "danger",
|
|
399
435
|
title: formatMessage({
|
|
400
436
|
id: "content-releases.pages.Releases.notification.error.title",
|
|
401
437
|
defaultMessage: "Your request could not be processed."
|
|
@@ -405,9 +441,9 @@ const ReleasesPage = () => {
|
|
|
405
441
|
defaultMessage: "Please try again or open another release."
|
|
406
442
|
})
|
|
407
443
|
});
|
|
408
|
-
|
|
444
|
+
navigate("", { replace: true, state: null });
|
|
409
445
|
}
|
|
410
|
-
}, [formatMessage, location?.state?.errors,
|
|
446
|
+
}, [formatMessage, location?.state?.errors, navigate, toggleNotification]);
|
|
411
447
|
React__namespace.useEffect(() => {
|
|
412
448
|
if (tabRef.current) {
|
|
413
449
|
tabRef.current._handlers.setSelectedTabIndex(activeTabIndex);
|
|
@@ -417,7 +453,7 @@ const ReleasesPage = () => {
|
|
|
417
453
|
setReleaseModalShown((prev) => !prev);
|
|
418
454
|
};
|
|
419
455
|
if (isLoading) {
|
|
420
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
456
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
|
|
421
457
|
}
|
|
422
458
|
const totalPendingReleases = isSuccess && response.currentData?.meta?.pendingReleasesCount || 0;
|
|
423
459
|
const hasReachedMaximumPendingReleases = totalPendingReleases >= maximumReleases;
|
|
@@ -448,22 +484,22 @@ const ReleasesPage = () => {
|
|
|
448
484
|
})
|
|
449
485
|
});
|
|
450
486
|
trackUsage("didCreateRelease");
|
|
451
|
-
|
|
452
|
-
} else if (
|
|
487
|
+
navigate(response2.data.data.id.toString());
|
|
488
|
+
} else if (strapiAdmin.isFetchError(response2.error)) {
|
|
453
489
|
toggleNotification({
|
|
454
|
-
type: "
|
|
490
|
+
type: "danger",
|
|
455
491
|
message: formatAPIError(response2.error)
|
|
456
492
|
});
|
|
457
493
|
} else {
|
|
458
494
|
toggleNotification({
|
|
459
|
-
type: "
|
|
495
|
+
type: "danger",
|
|
460
496
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
461
497
|
});
|
|
462
498
|
}
|
|
463
499
|
};
|
|
464
500
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { "aria-busy": isLoading, children: [
|
|
465
501
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
466
|
-
|
|
502
|
+
strapiAdmin.Layouts.Header,
|
|
467
503
|
{
|
|
468
504
|
title: formatMessage({
|
|
469
505
|
id: "content-releases.pages.Releases.title",
|
|
@@ -473,7 +509,7 @@ const ReleasesPage = () => {
|
|
|
473
509
|
id: "content-releases.pages.Releases.header-subtitle",
|
|
474
510
|
defaultMessage: "Create and manage content updates"
|
|
475
511
|
}),
|
|
476
|
-
primaryAction:
|
|
512
|
+
primaryAction: canCreate ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
477
513
|
designSystem.Button,
|
|
478
514
|
{
|
|
479
515
|
startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Plus, {}),
|
|
@@ -484,15 +520,15 @@ const ReleasesPage = () => {
|
|
|
484
520
|
defaultMessage: "New release"
|
|
485
521
|
})
|
|
486
522
|
}
|
|
487
|
-
)
|
|
523
|
+
) : null
|
|
488
524
|
}
|
|
489
525
|
),
|
|
490
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
526
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
491
527
|
hasReachedMaximumPendingReleases && /* @__PURE__ */ jsxRuntime.jsx(
|
|
492
528
|
StyledAlert,
|
|
493
529
|
{
|
|
494
530
|
marginBottom: 6,
|
|
495
|
-
action: /* @__PURE__ */ jsxRuntime.jsx(
|
|
531
|
+
action: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Link, { href: "https://strapi.io/pricing-cloud", isExternal: true, children: formatMessage({
|
|
496
532
|
id: "content-releases.pages.Releases.max-limit-reached.action",
|
|
497
533
|
defaultMessage: "Explore plans"
|
|
498
534
|
}) }),
|
|
@@ -563,23 +599,17 @@ const ReleasesPage = () => {
|
|
|
563
599
|
]
|
|
564
600
|
}
|
|
565
601
|
),
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
pagination: {
|
|
578
|
-
pageCount: response?.currentData?.meta?.pagination?.pageCount || 0
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
)
|
|
582
|
-
] }) : null
|
|
602
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
603
|
+
strapiAdmin.Pagination.Root,
|
|
604
|
+
{
|
|
605
|
+
...response?.currentData?.meta?.pagination,
|
|
606
|
+
defaultPageSize: response?.currentData?.meta?.pagination?.pageSize,
|
|
607
|
+
children: [
|
|
608
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.PageSize, { options: ["8", "16", "32", "64"] }),
|
|
609
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.Links, {})
|
|
610
|
+
]
|
|
611
|
+
}
|
|
612
|
+
)
|
|
583
613
|
] }) }),
|
|
584
614
|
releaseModalShown && /* @__PURE__ */ jsxRuntime.jsx(
|
|
585
615
|
ReleaseModal,
|
|
@@ -592,13 +622,13 @@ const ReleasesPage = () => {
|
|
|
592
622
|
)
|
|
593
623
|
] });
|
|
594
624
|
};
|
|
595
|
-
const ReleaseInfoWrapper =
|
|
625
|
+
const ReleaseInfoWrapper = styledComponents.styled(designSystem.Flex)`
|
|
596
626
|
align-self: stretch;
|
|
597
627
|
border-bottom-right-radius: ${({ theme }) => theme.borderRadius};
|
|
598
628
|
border-bottom-left-radius: ${({ theme }) => theme.borderRadius};
|
|
599
629
|
border-top: 1px solid ${({ theme }) => theme.colors.neutral150};
|
|
600
630
|
`;
|
|
601
|
-
const StyledMenuItem =
|
|
631
|
+
const StyledMenuItem = styledComponents.styled(designSystem.Menu.Item)`
|
|
602
632
|
svg path {
|
|
603
633
|
fill: ${({ theme, disabled }) => disabled && theme.colors.neutral500};
|
|
604
634
|
}
|
|
@@ -607,49 +637,54 @@ const StyledMenuItem = styled__default.default(v2.Menu.Item)`
|
|
|
607
637
|
}
|
|
608
638
|
|
|
609
639
|
&:hover {
|
|
610
|
-
background: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}100`]};
|
|
640
|
+
background: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}100`]};
|
|
611
641
|
}
|
|
612
642
|
`;
|
|
613
|
-
const PencilIcon =
|
|
643
|
+
const PencilIcon = styledComponents.styled(icons.Pencil)`
|
|
614
644
|
width: ${({ theme }) => theme.spaces[3]};
|
|
615
645
|
height: ${({ theme }) => theme.spaces[3]};
|
|
616
646
|
path {
|
|
617
647
|
fill: ${({ theme }) => theme.colors.neutral600};
|
|
618
648
|
}
|
|
619
649
|
`;
|
|
620
|
-
const TrashIcon =
|
|
650
|
+
const TrashIcon = styledComponents.styled(icons.Trash)`
|
|
621
651
|
width: ${({ theme }) => theme.spaces[3]};
|
|
622
652
|
height: ${({ theme }) => theme.spaces[3]};
|
|
623
653
|
path {
|
|
624
654
|
fill: ${({ theme }) => theme.colors.danger600};
|
|
625
655
|
}
|
|
626
656
|
`;
|
|
627
|
-
const TypographyMaxWidth =
|
|
657
|
+
const TypographyMaxWidth = styledComponents.styled(designSystem.Typography)`
|
|
628
658
|
max-width: 300px;
|
|
629
659
|
`;
|
|
630
|
-
const EntryValidationText = ({ action, schema,
|
|
660
|
+
const EntryValidationText = ({ action, schema, entry }) => {
|
|
631
661
|
const { formatMessage } = reactIntl.useIntl();
|
|
632
|
-
const { validate } = strapiAdmin.unstable_useDocument(
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
662
|
+
const { validate } = strapiAdmin$1.unstable_useDocument(
|
|
663
|
+
{
|
|
664
|
+
collectionType: schema?.kind ?? "",
|
|
665
|
+
model: schema?.uid ?? ""
|
|
666
|
+
},
|
|
667
|
+
{
|
|
668
|
+
skip: !schema
|
|
669
|
+
}
|
|
670
|
+
);
|
|
671
|
+
const errors = validate(entry) ?? {};
|
|
638
672
|
if (Object.keys(errors).length > 0) {
|
|
639
673
|
const validationErrorsMessages = Object.entries(errors).map(
|
|
640
674
|
([key, value]) => formatMessage(
|
|
675
|
+
// @ts-expect-error – TODO: fix this will better checks
|
|
641
676
|
{ id: `${value.id}.withField`, defaultMessage: value.defaultMessage },
|
|
642
677
|
{ field: key }
|
|
643
678
|
)
|
|
644
679
|
).join(" ");
|
|
645
680
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
646
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
681
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.CrossCircle, { fill: "danger600" }),
|
|
647
682
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tooltip, { description: validationErrorsMessages, children: /* @__PURE__ */ jsxRuntime.jsx(TypographyMaxWidth, { textColor: "danger600", variant: "omega", fontWeight: "semiBold", ellipsis: true, children: validationErrorsMessages }) })
|
|
648
683
|
] });
|
|
649
684
|
}
|
|
650
685
|
if (action == "publish") {
|
|
651
686
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
652
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
687
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
|
653
688
|
entry.publishedAt ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "success600", fontWeight: "bold", children: formatMessage({
|
|
654
689
|
id: "content-releases.pages.ReleaseDetails.entry-validation.already-published",
|
|
655
690
|
defaultMessage: "Already published"
|
|
@@ -660,7 +695,7 @@ const EntryValidationText = ({ action, schema, components, entry }) => {
|
|
|
660
695
|
] });
|
|
661
696
|
}
|
|
662
697
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
663
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
698
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
|
664
699
|
!entry.publishedAt ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "success600", fontWeight: "bold", children: formatMessage({
|
|
665
700
|
id: "content-releases.pages.ReleaseDetails.entry-validation.already-unpublished",
|
|
666
701
|
defaultMessage: "Already unpublished"
|
|
@@ -680,20 +715,23 @@ const ReleaseDetailsLayout = ({
|
|
|
680
715
|
const {
|
|
681
716
|
data,
|
|
682
717
|
isLoading: isLoadingDetails,
|
|
683
|
-
isError,
|
|
684
718
|
error
|
|
685
|
-
} = index.useGetReleaseQuery(
|
|
719
|
+
} = index.useGetReleaseQuery(
|
|
720
|
+
{ id: releaseId },
|
|
721
|
+
{
|
|
722
|
+
skip: !releaseId
|
|
723
|
+
}
|
|
724
|
+
);
|
|
686
725
|
const [publishRelease, { isLoading: isPublishing }] = index.usePublishReleaseMutation();
|
|
687
|
-
const toggleNotification =
|
|
688
|
-
const { formatAPIError } =
|
|
689
|
-
const {
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
const
|
|
693
|
-
const { trackUsage } = helperPlugin.useTracking();
|
|
726
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
727
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
728
|
+
const { allowedActions } = strapiAdmin.useRBAC(index.PERMISSIONS);
|
|
729
|
+
const { canUpdate, canDelete, canPublish } = allowedActions;
|
|
730
|
+
const dispatch = useTypedDispatch();
|
|
731
|
+
const { trackUsage } = strapiAdmin.useTracking();
|
|
694
732
|
const release = data?.data;
|
|
695
|
-
const handlePublishRelease = async () => {
|
|
696
|
-
const response = await publishRelease({ id
|
|
733
|
+
const handlePublishRelease = (id) => async () => {
|
|
734
|
+
const response = await publishRelease({ id });
|
|
697
735
|
if ("data" in response) {
|
|
698
736
|
toggleNotification({
|
|
699
737
|
type: "success",
|
|
@@ -708,14 +746,14 @@ const ReleaseDetailsLayout = ({
|
|
|
708
746
|
totalPublishedEntries,
|
|
709
747
|
totalUnpublishedEntries
|
|
710
748
|
});
|
|
711
|
-
} else if (
|
|
749
|
+
} else if (strapiAdmin.isFetchError(response.error)) {
|
|
712
750
|
toggleNotification({
|
|
713
|
-
type: "
|
|
751
|
+
type: "danger",
|
|
714
752
|
message: formatAPIError(response.error)
|
|
715
753
|
});
|
|
716
754
|
} else {
|
|
717
755
|
toggleNotification({
|
|
718
|
-
type: "
|
|
756
|
+
type: "danger",
|
|
719
757
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
720
758
|
});
|
|
721
759
|
}
|
|
@@ -741,21 +779,20 @@ const ReleaseDetailsLayout = ({
|
|
|
741
779
|
return release.createdBy.email;
|
|
742
780
|
};
|
|
743
781
|
if (isLoadingDetails) {
|
|
744
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
782
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
|
|
745
783
|
}
|
|
746
|
-
if (
|
|
784
|
+
if (isBaseQueryError(error) && "code" in error || !release) {
|
|
747
785
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
748
|
-
reactRouterDom.
|
|
786
|
+
reactRouterDom.Navigate,
|
|
749
787
|
{
|
|
750
|
-
to:
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
}
|
|
788
|
+
to: "..",
|
|
789
|
+
state: {
|
|
790
|
+
errors: [
|
|
791
|
+
{
|
|
792
|
+
// @ts-expect-error – TODO: fix this weird error flow
|
|
793
|
+
code: error?.code
|
|
794
|
+
}
|
|
795
|
+
]
|
|
759
796
|
}
|
|
760
797
|
}
|
|
761
798
|
);
|
|
@@ -792,34 +829,30 @@ const ReleaseDetailsLayout = ({
|
|
|
792
829
|
) : "";
|
|
793
830
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { "aria-busy": isLoadingDetails, children: [
|
|
794
831
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
795
|
-
|
|
832
|
+
strapiAdmin.Layouts.Header,
|
|
796
833
|
{
|
|
797
834
|
title: release.name,
|
|
798
835
|
subtitle: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, lineHeight: 6, children: [
|
|
799
836
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", variant: "epsilon", children: numberOfEntriesText + (isScheduled ? ` - ${scheduledText}` : "") }),
|
|
800
837
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { ...getBadgeProps(release.status), children: release.status })
|
|
801
838
|
] }),
|
|
802
|
-
navigationAction: /* @__PURE__ */ jsxRuntime.jsx(
|
|
803
|
-
id: "global.back",
|
|
804
|
-
defaultMessage: "Back"
|
|
805
|
-
}) }),
|
|
839
|
+
navigationAction: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.BackButton, {}),
|
|
806
840
|
primaryAction: !release.releasedAt && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
807
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
841
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Root, { children: [
|
|
808
842
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
809
|
-
|
|
843
|
+
designSystem.Menu.Trigger,
|
|
810
844
|
{
|
|
811
|
-
as: designSystem.IconButton,
|
|
812
845
|
paddingLeft: 2,
|
|
813
846
|
paddingRight: 2,
|
|
814
847
|
"aria-label": formatMessage({
|
|
815
848
|
id: "content-releases.header.actions.open-release-actions",
|
|
816
849
|
defaultMessage: "Release edit and delete menu"
|
|
817
850
|
}),
|
|
818
|
-
|
|
819
|
-
|
|
851
|
+
variant: "tertiary",
|
|
852
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(icons.More, {})
|
|
820
853
|
}
|
|
821
854
|
),
|
|
822
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
855
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Content, { top: 1, popoverPlacement: "bottom-end", maxHeight: void 0, children: [
|
|
823
856
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
824
857
|
designSystem.Flex,
|
|
825
858
|
{
|
|
@@ -841,7 +874,7 @@ const ReleaseDetailsLayout = ({
|
|
|
841
874
|
{
|
|
842
875
|
disabled: !canDelete,
|
|
843
876
|
onSelect: toggleWarningSubmit,
|
|
844
|
-
variant: "danger",
|
|
877
|
+
$variant: "danger",
|
|
845
878
|
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 2, hasRadius: true, width: "100%", children: [
|
|
846
879
|
/* @__PURE__ */ jsxRuntime.jsx(TrashIcon, {}),
|
|
847
880
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { ellipsis: true, textColor: "danger600", children: formatMessage({
|
|
@@ -868,7 +901,7 @@ const ReleaseDetailsLayout = ({
|
|
|
868
901
|
defaultMessage: "Created"
|
|
869
902
|
}) }),
|
|
870
903
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", color: "neutral300", children: [
|
|
871
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
904
|
+
/* @__PURE__ */ jsxRuntime.jsx(RelativeTime$1, { timestamp: new Date(release.createdAt) }),
|
|
872
905
|
formatMessage(
|
|
873
906
|
{
|
|
874
907
|
id: "content-releases.header.actions.created.description",
|
|
@@ -886,12 +919,12 @@ const ReleaseDetailsLayout = ({
|
|
|
886
919
|
id: "content-releases.header.actions.refresh",
|
|
887
920
|
defaultMessage: "Refresh"
|
|
888
921
|
}) }),
|
|
889
|
-
|
|
922
|
+
canPublish ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
890
923
|
designSystem.Button,
|
|
891
924
|
{
|
|
892
925
|
size: "S",
|
|
893
926
|
variant: "default",
|
|
894
|
-
onClick: handlePublishRelease,
|
|
927
|
+
onClick: handlePublishRelease(release.id.toString()),
|
|
895
928
|
loading: isPublishing,
|
|
896
929
|
disabled: release.actions.meta.count === 0,
|
|
897
930
|
children: formatMessage({
|
|
@@ -899,7 +932,7 @@ const ReleaseDetailsLayout = ({
|
|
|
899
932
|
defaultMessage: "Publish"
|
|
900
933
|
})
|
|
901
934
|
}
|
|
902
|
-
)
|
|
935
|
+
) : null
|
|
903
936
|
] })
|
|
904
937
|
}
|
|
905
938
|
),
|
|
@@ -907,6 +940,7 @@ const ReleaseDetailsLayout = ({
|
|
|
907
940
|
] });
|
|
908
941
|
};
|
|
909
942
|
const GROUP_BY_OPTIONS = ["contentType", "locale", "action"];
|
|
943
|
+
const GROUP_BY_OPTIONS_NO_LOCALE = ["contentType", "action"];
|
|
910
944
|
const getGroupByOptionLabel = (value) => {
|
|
911
945
|
if (value === "locale") {
|
|
912
946
|
return {
|
|
@@ -925,21 +959,33 @@ const getGroupByOptionLabel = (value) => {
|
|
|
925
959
|
defaultMessage: "Content-Types"
|
|
926
960
|
};
|
|
927
961
|
};
|
|
928
|
-
const ReleaseDetailsBody = () => {
|
|
962
|
+
const ReleaseDetailsBody = ({ releaseId }) => {
|
|
929
963
|
const { formatMessage } = reactIntl.useIntl();
|
|
930
|
-
const {
|
|
931
|
-
const
|
|
932
|
-
const
|
|
933
|
-
const { formatAPIError } = helperPlugin.useAPIErrorHandler();
|
|
964
|
+
const [{ query }, setQuery] = strapiAdmin.useQueryParams();
|
|
965
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
966
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
934
967
|
const {
|
|
935
968
|
data: releaseData,
|
|
936
969
|
isLoading: isReleaseLoading,
|
|
937
|
-
isError: isReleaseError,
|
|
938
970
|
error: releaseError
|
|
939
971
|
} = index.useGetReleaseQuery({ id: releaseId });
|
|
940
972
|
const {
|
|
941
973
|
allowedActions: { canUpdate }
|
|
942
|
-
} =
|
|
974
|
+
} = strapiAdmin.useRBAC(index.PERMISSIONS);
|
|
975
|
+
const runHookWaterfall = strapiAdmin.useStrapiApp("ReleaseDetailsPage", (state) => state.runHookWaterfall);
|
|
976
|
+
const { hasI18nEnabled } = runHookWaterfall(
|
|
977
|
+
"ContentReleases/pages/ReleaseDetails/add-locale-in-releases",
|
|
978
|
+
{
|
|
979
|
+
displayedHeaders: {
|
|
980
|
+
label: formatMessage({
|
|
981
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.locale",
|
|
982
|
+
defaultMessage: "locale"
|
|
983
|
+
}),
|
|
984
|
+
name: "locale"
|
|
985
|
+
},
|
|
986
|
+
hasI18nEnabled: false
|
|
987
|
+
}
|
|
988
|
+
);
|
|
943
989
|
const release = releaseData?.data;
|
|
944
990
|
const selectedGroupBy = query?.groupBy || "contentType";
|
|
945
991
|
const {
|
|
@@ -968,65 +1014,59 @@ const ReleaseDetailsBody = () => {
|
|
|
968
1014
|
// We are passing the action path to found the position in the cache of the action for optimistic updates
|
|
969
1015
|
});
|
|
970
1016
|
if ("error" in response) {
|
|
971
|
-
if (
|
|
1017
|
+
if (strapiAdmin.isFetchError(response.error)) {
|
|
972
1018
|
toggleNotification({
|
|
973
|
-
type: "
|
|
1019
|
+
type: "danger",
|
|
974
1020
|
message: formatAPIError(response.error)
|
|
975
1021
|
});
|
|
976
1022
|
} else {
|
|
977
1023
|
toggleNotification({
|
|
978
|
-
type: "
|
|
1024
|
+
type: "danger",
|
|
979
1025
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
980
1026
|
});
|
|
981
1027
|
}
|
|
982
1028
|
}
|
|
983
1029
|
};
|
|
984
1030
|
if (isLoading || isReleaseLoading) {
|
|
985
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1031
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
|
|
986
1032
|
}
|
|
987
1033
|
const releaseActions = data?.data;
|
|
988
1034
|
const releaseMeta = data?.meta;
|
|
989
1035
|
const contentTypes = releaseMeta?.contentTypes || {};
|
|
990
1036
|
const components = releaseMeta?.components || {};
|
|
991
|
-
if (
|
|
1037
|
+
if (isBaseQueryError(releaseError) || !release) {
|
|
992
1038
|
const errorsArray = [];
|
|
993
|
-
if (releaseError) {
|
|
1039
|
+
if (releaseError && "code" in releaseError) {
|
|
994
1040
|
errorsArray.push({
|
|
995
1041
|
code: releaseError.code
|
|
996
1042
|
});
|
|
997
1043
|
}
|
|
998
|
-
if (releaseActionsError) {
|
|
1044
|
+
if (releaseActionsError && "code" in releaseActionsError) {
|
|
999
1045
|
errorsArray.push({
|
|
1000
1046
|
code: releaseActionsError.code
|
|
1001
1047
|
});
|
|
1002
1048
|
}
|
|
1003
1049
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1004
|
-
reactRouterDom.
|
|
1050
|
+
reactRouterDom.Navigate,
|
|
1005
1051
|
{
|
|
1006
|
-
to:
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
errors: errorsArray
|
|
1010
|
-
}
|
|
1052
|
+
to: "..",
|
|
1053
|
+
state: {
|
|
1054
|
+
errors: errorsArray
|
|
1011
1055
|
}
|
|
1012
1056
|
}
|
|
1013
1057
|
);
|
|
1014
1058
|
}
|
|
1015
1059
|
if (isError || !releaseActions) {
|
|
1016
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1060
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Error, {});
|
|
1017
1061
|
}
|
|
1018
1062
|
if (Object.keys(releaseActions).length === 0) {
|
|
1019
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1020
|
-
|
|
1063
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1064
|
+
designSystem.EmptyStateLayout,
|
|
1021
1065
|
{
|
|
1022
|
-
content: {
|
|
1023
|
-
id: "content-releases.pages.Details.tab.emptyEntries",
|
|
1024
|
-
defaultMessage: "This release is empty. Open the Content Manager, select an entry and add it to the release."
|
|
1025
|
-
},
|
|
1026
1066
|
action: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1027
|
-
|
|
1067
|
+
designSystem.LinkButton,
|
|
1028
1068
|
{
|
|
1029
|
-
|
|
1069
|
+
tag: reactRouterDom.Link,
|
|
1030
1070
|
to: {
|
|
1031
1071
|
pathname: "/content-manager"
|
|
1032
1072
|
},
|
|
@@ -1037,18 +1077,59 @@ const ReleaseDetailsBody = () => {
|
|
|
1037
1077
|
defaultMessage: "Open the Content Manager"
|
|
1038
1078
|
})
|
|
1039
1079
|
}
|
|
1040
|
-
)
|
|
1080
|
+
),
|
|
1081
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(symbols.EmptyDocuments, { width: "16rem" }),
|
|
1082
|
+
content: formatMessage({
|
|
1083
|
+
id: "content-releases.pages.Details.tab.emptyEntries",
|
|
1084
|
+
defaultMessage: "This release is empty. Open the Content Manager, select an entry and add it to the release."
|
|
1085
|
+
})
|
|
1041
1086
|
}
|
|
1042
1087
|
) });
|
|
1043
1088
|
}
|
|
1044
|
-
|
|
1089
|
+
const groupByLabel = formatMessage({
|
|
1090
|
+
id: "content-releases.pages.ReleaseDetails.groupBy.aria-label",
|
|
1091
|
+
defaultMessage: "Group by"
|
|
1092
|
+
});
|
|
1093
|
+
const headers = [
|
|
1094
|
+
// ...displayedHeaders,
|
|
1095
|
+
{
|
|
1096
|
+
label: formatMessage({
|
|
1097
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.name",
|
|
1098
|
+
defaultMessage: "name"
|
|
1099
|
+
}),
|
|
1100
|
+
name: "name"
|
|
1101
|
+
},
|
|
1102
|
+
{
|
|
1103
|
+
label: formatMessage({
|
|
1104
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.content-type",
|
|
1105
|
+
defaultMessage: "content-type"
|
|
1106
|
+
}),
|
|
1107
|
+
name: "content-type"
|
|
1108
|
+
},
|
|
1109
|
+
{
|
|
1110
|
+
label: formatMessage({
|
|
1111
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.action",
|
|
1112
|
+
defaultMessage: "action"
|
|
1113
|
+
}),
|
|
1114
|
+
name: "action"
|
|
1115
|
+
},
|
|
1116
|
+
...!release.releasedAt ? [
|
|
1117
|
+
{
|
|
1118
|
+
label: formatMessage({
|
|
1119
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.status",
|
|
1120
|
+
defaultMessage: "status"
|
|
1121
|
+
}),
|
|
1122
|
+
name: "status"
|
|
1123
|
+
}
|
|
1124
|
+
] : []
|
|
1125
|
+
];
|
|
1126
|
+
const options = hasI18nEnabled ? GROUP_BY_OPTIONS : GROUP_BY_OPTIONS_NO_LOCALE;
|
|
1127
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 8, direction: "column", alignItems: "stretch", children: [
|
|
1045
1128
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1046
1129
|
designSystem.SingleSelect,
|
|
1047
1130
|
{
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
defaultMessage: "Group by"
|
|
1051
|
-
}),
|
|
1131
|
+
placeholder: groupByLabel,
|
|
1132
|
+
"aria-label": groupByLabel,
|
|
1052
1133
|
customizeContent: (value) => formatMessage(
|
|
1053
1134
|
{
|
|
1054
1135
|
id: `content-releases.pages.ReleaseDetails.groupBy.label`,
|
|
@@ -1060,84 +1141,27 @@ const ReleaseDetailsBody = () => {
|
|
|
1060
1141
|
),
|
|
1061
1142
|
value: formatMessage(getGroupByOptionLabel(selectedGroupBy)),
|
|
1062
1143
|
onChange: (value) => setQuery({ groupBy: value }),
|
|
1063
|
-
children:
|
|
1144
|
+
children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: option, children: formatMessage(getGroupByOptionLabel(option)) }, option))
|
|
1064
1145
|
}
|
|
1065
1146
|
) }),
|
|
1066
1147
|
Object.keys(releaseActions).map((key) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, direction: "column", alignItems: "stretch", children: [
|
|
1067
1148
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { role: "separator", "aria-label": key, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { children: key }) }),
|
|
1068
1149
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1069
|
-
|
|
1150
|
+
strapiAdmin.Table.Root,
|
|
1070
1151
|
{
|
|
1071
1152
|
rows: releaseActions[key].map((item) => ({
|
|
1072
1153
|
...item,
|
|
1073
1154
|
id: Number(item.entry.id)
|
|
1074
1155
|
})),
|
|
1075
|
-
|
|
1076
|
-
isLoading,
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1080
|
-
|
|
1081
|
-
helperPlugin.Table.HeaderCell,
|
|
1082
|
-
{
|
|
1083
|
-
fieldSchemaType: "string",
|
|
1084
|
-
label: formatMessage({
|
|
1085
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.name",
|
|
1086
|
-
defaultMessage: "name"
|
|
1087
|
-
}),
|
|
1088
|
-
name: "name"
|
|
1089
|
-
}
|
|
1090
|
-
),
|
|
1091
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1092
|
-
helperPlugin.Table.HeaderCell,
|
|
1093
|
-
{
|
|
1094
|
-
fieldSchemaType: "string",
|
|
1095
|
-
label: formatMessage({
|
|
1096
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.locale",
|
|
1097
|
-
defaultMessage: "locale"
|
|
1098
|
-
}),
|
|
1099
|
-
name: "locale"
|
|
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.content-type",
|
|
1108
|
-
defaultMessage: "content-type"
|
|
1109
|
-
}),
|
|
1110
|
-
name: "content-type"
|
|
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.action",
|
|
1119
|
-
defaultMessage: "action"
|
|
1120
|
-
}),
|
|
1121
|
-
name: "action"
|
|
1122
|
-
}
|
|
1123
|
-
),
|
|
1124
|
-
!release.releasedAt && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1125
|
-
helperPlugin.Table.HeaderCell,
|
|
1126
|
-
{
|
|
1127
|
-
fieldSchemaType: "string",
|
|
1128
|
-
label: formatMessage({
|
|
1129
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.status",
|
|
1130
|
-
defaultMessage: "status"
|
|
1131
|
-
}),
|
|
1132
|
-
name: "status"
|
|
1133
|
-
}
|
|
1134
|
-
)
|
|
1135
|
-
] }),
|
|
1136
|
-
/* @__PURE__ */ jsxRuntime.jsx(helperPlugin.Table.LoadingBody, {}),
|
|
1137
|
-
/* @__PURE__ */ jsxRuntime.jsx(helperPlugin.Table.Body, { children: releaseActions[key].map(
|
|
1156
|
+
headers,
|
|
1157
|
+
isLoading: isLoading || isFetching,
|
|
1158
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(strapiAdmin.Table.Content, { children: [
|
|
1159
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Head, { children: headers.map((header) => /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.HeaderCell, { ...header }, header.name)) }),
|
|
1160
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Loading, {}),
|
|
1161
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Body, { children: releaseActions[key].map(
|
|
1138
1162
|
({ id, contentType, locale, type, entry }, actionIndex) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
1139
1163
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "25%", maxWidth: "200px", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { ellipsis: true, children: `${contentType.mainFieldValue || entry.id}` }) }),
|
|
1140
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "10%", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: `${locale?.name ? locale.name : "-"}` }) }),
|
|
1164
|
+
hasI18nEnabled && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "10%", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: `${locale?.name ? locale.name : "-"}` }) }),
|
|
1141
1165
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "10%", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: contentType.displayName || "" }) }),
|
|
1142
1166
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "20%", children: release.releasedAt ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage(
|
|
1143
1167
|
{
|
|
@@ -1191,34 +1215,39 @@ const ReleaseDetailsBody = () => {
|
|
|
1191
1215
|
}
|
|
1192
1216
|
)
|
|
1193
1217
|
] }, `releases-group-${key}`)),
|
|
1194
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
}
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1218
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1219
|
+
strapiAdmin.Pagination.Root,
|
|
1220
|
+
{
|
|
1221
|
+
...releaseMeta?.pagination,
|
|
1222
|
+
defaultPageSize: releaseMeta?.pagination?.pageSize,
|
|
1223
|
+
children: [
|
|
1224
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.PageSize, {}),
|
|
1225
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.Links, {})
|
|
1226
|
+
]
|
|
1227
|
+
}
|
|
1228
|
+
)
|
|
1205
1229
|
] }) });
|
|
1206
1230
|
};
|
|
1207
1231
|
const ReleaseDetailsPage = () => {
|
|
1208
1232
|
const { formatMessage } = reactIntl.useIntl();
|
|
1209
1233
|
const { releaseId } = reactRouterDom.useParams();
|
|
1210
|
-
const toggleNotification =
|
|
1211
|
-
const { formatAPIError } =
|
|
1212
|
-
const
|
|
1234
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
1235
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
1236
|
+
const navigate = reactRouterDom.useNavigate();
|
|
1213
1237
|
const [releaseModalShown, setReleaseModalShown] = React__namespace.useState(false);
|
|
1214
1238
|
const [showWarningSubmit, setWarningSubmit] = React__namespace.useState(false);
|
|
1215
1239
|
const {
|
|
1216
1240
|
isLoading: isLoadingDetails,
|
|
1217
1241
|
data,
|
|
1218
1242
|
isSuccess: isSuccessDetails
|
|
1219
|
-
} = index.useGetReleaseQuery(
|
|
1243
|
+
} = index.useGetReleaseQuery(
|
|
1244
|
+
{ id: releaseId },
|
|
1245
|
+
{
|
|
1246
|
+
skip: !releaseId
|
|
1247
|
+
}
|
|
1248
|
+
);
|
|
1220
1249
|
const [updateRelease, { isLoading: isSubmittingForm }] = index.useUpdateReleaseMutation();
|
|
1221
|
-
const [deleteRelease
|
|
1250
|
+
const [deleteRelease] = index.useDeleteReleaseMutation();
|
|
1222
1251
|
const toggleEditReleaseModal = () => {
|
|
1223
1252
|
setReleaseModalShown((prev) => !prev);
|
|
1224
1253
|
};
|
|
@@ -1229,15 +1258,18 @@ const ReleaseDetailsPage = () => {
|
|
|
1229
1258
|
{
|
|
1230
1259
|
toggleEditReleaseModal,
|
|
1231
1260
|
toggleWarningSubmit,
|
|
1232
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1261
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {})
|
|
1233
1262
|
}
|
|
1234
1263
|
);
|
|
1235
1264
|
}
|
|
1265
|
+
if (!releaseId) {
|
|
1266
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: ".." });
|
|
1267
|
+
}
|
|
1236
1268
|
const releaseData = isSuccessDetails && data?.data || null;
|
|
1237
1269
|
const title = releaseData?.name || "";
|
|
1238
1270
|
const timezone = releaseData?.timezone ?? null;
|
|
1239
1271
|
const scheduledAt = releaseData?.scheduledAt && timezone ? dateFnsTz.utcToZonedTime(releaseData.scheduledAt, timezone) : null;
|
|
1240
|
-
const date = scheduledAt ? format__default.default(scheduledAt, "yyyy-MM-dd") :
|
|
1272
|
+
const date = scheduledAt ? format__default.default(scheduledAt, "yyyy-MM-dd") : void 0;
|
|
1241
1273
|
const time = scheduledAt ? format__default.default(scheduledAt, "HH:mm") : "";
|
|
1242
1274
|
const handleEditRelease = async (values) => {
|
|
1243
1275
|
const response = await updateRelease({
|
|
@@ -1254,33 +1286,33 @@ const ReleaseDetailsPage = () => {
|
|
|
1254
1286
|
defaultMessage: "Release updated."
|
|
1255
1287
|
})
|
|
1256
1288
|
});
|
|
1257
|
-
|
|
1289
|
+
toggleEditReleaseModal();
|
|
1290
|
+
} else if (strapiAdmin.isFetchError(response.error)) {
|
|
1258
1291
|
toggleNotification({
|
|
1259
|
-
type: "
|
|
1292
|
+
type: "danger",
|
|
1260
1293
|
message: formatAPIError(response.error)
|
|
1261
1294
|
});
|
|
1262
1295
|
} else {
|
|
1263
1296
|
toggleNotification({
|
|
1264
|
-
type: "
|
|
1297
|
+
type: "danger",
|
|
1265
1298
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
1266
1299
|
});
|
|
1267
1300
|
}
|
|
1268
|
-
toggleEditReleaseModal();
|
|
1269
1301
|
};
|
|
1270
1302
|
const handleDeleteRelease = async () => {
|
|
1271
1303
|
const response = await deleteRelease({
|
|
1272
1304
|
id: releaseId
|
|
1273
1305
|
});
|
|
1274
1306
|
if ("data" in response) {
|
|
1275
|
-
|
|
1276
|
-
} else if (
|
|
1307
|
+
navigate("..");
|
|
1308
|
+
} else if (strapiAdmin.isFetchError(response.error)) {
|
|
1277
1309
|
toggleNotification({
|
|
1278
|
-
type: "
|
|
1310
|
+
type: "danger",
|
|
1279
1311
|
message: formatAPIError(response.error)
|
|
1280
1312
|
});
|
|
1281
1313
|
} else {
|
|
1282
1314
|
toggleNotification({
|
|
1283
|
-
type: "
|
|
1315
|
+
type: "danger",
|
|
1284
1316
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
1285
1317
|
});
|
|
1286
1318
|
}
|
|
@@ -1291,7 +1323,7 @@ const ReleaseDetailsPage = () => {
|
|
|
1291
1323
|
toggleEditReleaseModal,
|
|
1292
1324
|
toggleWarningSubmit,
|
|
1293
1325
|
children: [
|
|
1294
|
-
/* @__PURE__ */ jsxRuntime.jsx(ReleaseDetailsBody, {}),
|
|
1326
|
+
/* @__PURE__ */ jsxRuntime.jsx(ReleaseDetailsBody, { releaseId }),
|
|
1295
1327
|
releaseModalShown && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1296
1328
|
ReleaseModal,
|
|
1297
1329
|
{
|
|
@@ -1309,16 +1341,15 @@ const ReleaseDetailsPage = () => {
|
|
|
1309
1341
|
}
|
|
1310
1342
|
),
|
|
1311
1343
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1312
|
-
|
|
1344
|
+
strapiAdmin.ConfirmDialog,
|
|
1313
1345
|
{
|
|
1314
|
-
|
|
1346
|
+
isOpen: showWarningSubmit,
|
|
1347
|
+
onClose: toggleWarningSubmit,
|
|
1348
|
+
onConfirm: handleDeleteRelease,
|
|
1349
|
+
children: formatMessage({
|
|
1315
1350
|
id: "content-releases.dialog.confirmation-message",
|
|
1316
1351
|
defaultMessage: "Are you sure you want to delete this release?"
|
|
1317
|
-
}
|
|
1318
|
-
isOpen: showWarningSubmit,
|
|
1319
|
-
isConfirmButtonLoading: isDeletingRelease,
|
|
1320
|
-
onToggleDialog: toggleWarningSubmit,
|
|
1321
|
-
onConfirm: handleDeleteRelease
|
|
1352
|
+
})
|
|
1322
1353
|
}
|
|
1323
1354
|
)
|
|
1324
1355
|
]
|
|
@@ -1326,10 +1357,10 @@ const ReleaseDetailsPage = () => {
|
|
|
1326
1357
|
);
|
|
1327
1358
|
};
|
|
1328
1359
|
const App = () => {
|
|
1329
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1330
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, {
|
|
1331
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, {
|
|
1360
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Protect, { permissions: index.PERMISSIONS.main, children: /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.Routes, { children: [
|
|
1361
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { index: true, element: /* @__PURE__ */ jsxRuntime.jsx(ReleasesPage, {}) }),
|
|
1362
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: ":releaseId", element: /* @__PURE__ */ jsxRuntime.jsx(ReleaseDetailsPage, {}) })
|
|
1332
1363
|
] }) });
|
|
1333
1364
|
};
|
|
1334
1365
|
exports.App = App;
|
|
1335
|
-
//# sourceMappingURL=App-
|
|
1366
|
+
//# sourceMappingURL=App-DUmziQ17.js.map
|