@strapi/content-releases 0.0.0-experimental.ec089c69ff953942fb39de032c12daafaf7176e6 → 0.0.0-experimental.f75e3c6d67cc47c64ab37479efdbb7b43be50b78
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-HjWtUYmc.js → App-DUmziQ17.js} +401 -388
- package/dist/_chunks/App-DUmziQ17.js.map +1 -0
- package/dist/_chunks/{App-gu1aiP6i.mjs → App-D_6Y9N2F.mjs} +378 -364
- 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-ltT1TlKQ.mjs → en-B9Ur3VsE.mjs} +1 -1
- package/dist/_chunks/en-B9Ur3VsE.mjs.map +1 -0
- package/dist/_chunks/{en-HrREghh3.js → en-DtFJ5ViE.js} +1 -1
- package/dist/_chunks/en-DtFJ5ViE.js.map +1 -0
- package/dist/_chunks/{index-mvj9PSKd.mjs → index-BomF0-yY.mjs} +180 -476
- package/dist/_chunks/index-BomF0-yY.mjs.map +1 -0
- package/dist/_chunks/{index-ZNwxYN8H.js → index-C5Hc767q.js} +177 -475
- 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 +83 -86
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +84 -86
- 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-HjWtUYmc.js.map +0 -1
- package/dist/_chunks/App-gu1aiP6i.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-HrREghh3.js.map +0 -1
- package/dist/_chunks/en-ltT1TlKQ.mjs.map +0 -1
- package/dist/_chunks/index-ZNwxYN8H.js.map +0 -1
- package/dist/_chunks/index-mvj9PSKd.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,36 +280,40 @@ 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
|
+
] });
|
|
282
308
|
};
|
|
283
|
-
const
|
|
309
|
+
const useTypedDispatch = reactRedux.useDispatch;
|
|
310
|
+
const isBaseQueryError = (error) => {
|
|
311
|
+
return typeof error !== "undefined" && error.name !== void 0;
|
|
312
|
+
};
|
|
313
|
+
const LinkCard = styledComponents.styled(designSystem.Link)`
|
|
284
314
|
display: block;
|
|
285
315
|
`;
|
|
286
|
-
const RelativeTime =
|
|
316
|
+
const RelativeTime = styledComponents.styled(RelativeTime$1)`
|
|
287
317
|
display: inline-block;
|
|
288
318
|
&::first-letter {
|
|
289
319
|
text-transform: uppercase;
|
|
@@ -317,7 +347,7 @@ const getBadgeProps = (status) => {
|
|
|
317
347
|
const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
318
348
|
const { formatMessage } = reactIntl.useIntl();
|
|
319
349
|
if (isError) {
|
|
320
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
350
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Error, {});
|
|
321
351
|
}
|
|
322
352
|
if (releases?.length === 0) {
|
|
323
353
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -332,11 +362,11 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
332
362
|
target: sectionTitle
|
|
333
363
|
}
|
|
334
364
|
),
|
|
335
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
365
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(symbols.EmptyDocuments, { width: "16rem" })
|
|
336
366
|
}
|
|
337
367
|
);
|
|
338
368
|
}
|
|
339
|
-
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(
|
|
340
370
|
designSystem.Flex,
|
|
341
371
|
{
|
|
342
372
|
direction: "column",
|
|
@@ -351,7 +381,7 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
351
381
|
gap: 4,
|
|
352
382
|
children: [
|
|
353
383
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "start", gap: 1, children: [
|
|
354
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, {
|
|
384
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "h3", variant: "delta", fontWeight: "bold", children: name }),
|
|
355
385
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: scheduledAt ? /* @__PURE__ */ jsxRuntime.jsx(RelativeTime, { timestamp: new Date(scheduledAt) }) : formatMessage({
|
|
356
386
|
id: "content-releases.pages.Releases.not-scheduled",
|
|
357
387
|
defaultMessage: "Not scheduled"
|
|
@@ -362,7 +392,7 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
362
392
|
}
|
|
363
393
|
) }) }, id)) });
|
|
364
394
|
};
|
|
365
|
-
const StyledAlert =
|
|
395
|
+
const StyledAlert = styledComponents.styled(designSystem.Alert)`
|
|
366
396
|
button {
|
|
367
397
|
display: none;
|
|
368
398
|
}
|
|
@@ -372,7 +402,7 @@ const StyledAlert = styled__default.default(designSystem.Alert)`
|
|
|
372
402
|
`;
|
|
373
403
|
const INITIAL_FORM_VALUES = {
|
|
374
404
|
name: "",
|
|
375
|
-
date:
|
|
405
|
+
date: void 0,
|
|
376
406
|
time: "",
|
|
377
407
|
isScheduled: true,
|
|
378
408
|
scheduledAt: null,
|
|
@@ -382,23 +412,26 @@ const ReleasesPage = () => {
|
|
|
382
412
|
const tabRef = React__namespace.useRef(null);
|
|
383
413
|
const location = reactRouterDom.useLocation();
|
|
384
414
|
const [releaseModalShown, setReleaseModalShown] = React__namespace.useState(false);
|
|
385
|
-
const toggleNotification =
|
|
415
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
386
416
|
const { formatMessage } = reactIntl.useIntl();
|
|
387
|
-
const
|
|
388
|
-
const { formatAPIError } =
|
|
389
|
-
const [{ query }, setQuery] =
|
|
417
|
+
const navigate = reactRouterDom.useNavigate();
|
|
418
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
419
|
+
const [{ query }, setQuery] = strapiAdmin.useQueryParams();
|
|
390
420
|
const response = index.useGetReleasesQuery(query);
|
|
391
421
|
const [createRelease, { isLoading: isSubmittingForm }] = index.useCreateReleaseMutation();
|
|
392
|
-
const { getFeature } =
|
|
422
|
+
const { getFeature } = ee.useLicenseLimits();
|
|
393
423
|
const { maximumReleases = 3 } = getFeature("cms-content-releases");
|
|
394
|
-
const { trackUsage } =
|
|
424
|
+
const { trackUsage } = strapiAdmin.useTracking();
|
|
425
|
+
const {
|
|
426
|
+
allowedActions: { canCreate }
|
|
427
|
+
} = strapiAdmin.useRBAC(index.PERMISSIONS);
|
|
395
428
|
const { isLoading, isSuccess, isError } = response;
|
|
396
429
|
const activeTab = response?.currentData?.meta?.activeTab || "pending";
|
|
397
430
|
const activeTabIndex = ["pending", "done"].indexOf(activeTab);
|
|
398
431
|
React__namespace.useEffect(() => {
|
|
399
432
|
if (location?.state?.errors) {
|
|
400
433
|
toggleNotification({
|
|
401
|
-
type: "
|
|
434
|
+
type: "danger",
|
|
402
435
|
title: formatMessage({
|
|
403
436
|
id: "content-releases.pages.Releases.notification.error.title",
|
|
404
437
|
defaultMessage: "Your request could not be processed."
|
|
@@ -408,9 +441,9 @@ const ReleasesPage = () => {
|
|
|
408
441
|
defaultMessage: "Please try again or open another release."
|
|
409
442
|
})
|
|
410
443
|
});
|
|
411
|
-
|
|
444
|
+
navigate("", { replace: true, state: null });
|
|
412
445
|
}
|
|
413
|
-
}, [formatMessage, location?.state?.errors,
|
|
446
|
+
}, [formatMessage, location?.state?.errors, navigate, toggleNotification]);
|
|
414
447
|
React__namespace.useEffect(() => {
|
|
415
448
|
if (tabRef.current) {
|
|
416
449
|
tabRef.current._handlers.setSelectedTabIndex(activeTabIndex);
|
|
@@ -420,7 +453,7 @@ const ReleasesPage = () => {
|
|
|
420
453
|
setReleaseModalShown((prev) => !prev);
|
|
421
454
|
};
|
|
422
455
|
if (isLoading) {
|
|
423
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
456
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
|
|
424
457
|
}
|
|
425
458
|
const totalPendingReleases = isSuccess && response.currentData?.meta?.pendingReleasesCount || 0;
|
|
426
459
|
const hasReachedMaximumPendingReleases = totalPendingReleases >= maximumReleases;
|
|
@@ -451,22 +484,22 @@ const ReleasesPage = () => {
|
|
|
451
484
|
})
|
|
452
485
|
});
|
|
453
486
|
trackUsage("didCreateRelease");
|
|
454
|
-
|
|
455
|
-
} else if (
|
|
487
|
+
navigate(response2.data.data.id.toString());
|
|
488
|
+
} else if (strapiAdmin.isFetchError(response2.error)) {
|
|
456
489
|
toggleNotification({
|
|
457
|
-
type: "
|
|
490
|
+
type: "danger",
|
|
458
491
|
message: formatAPIError(response2.error)
|
|
459
492
|
});
|
|
460
493
|
} else {
|
|
461
494
|
toggleNotification({
|
|
462
|
-
type: "
|
|
495
|
+
type: "danger",
|
|
463
496
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
464
497
|
});
|
|
465
498
|
}
|
|
466
499
|
};
|
|
467
500
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { "aria-busy": isLoading, children: [
|
|
468
501
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
469
|
-
|
|
502
|
+
strapiAdmin.Layouts.Header,
|
|
470
503
|
{
|
|
471
504
|
title: formatMessage({
|
|
472
505
|
id: "content-releases.pages.Releases.title",
|
|
@@ -476,7 +509,7 @@ const ReleasesPage = () => {
|
|
|
476
509
|
id: "content-releases.pages.Releases.header-subtitle",
|
|
477
510
|
defaultMessage: "Create and manage content updates"
|
|
478
511
|
}),
|
|
479
|
-
primaryAction:
|
|
512
|
+
primaryAction: canCreate ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
480
513
|
designSystem.Button,
|
|
481
514
|
{
|
|
482
515
|
startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Plus, {}),
|
|
@@ -487,15 +520,15 @@ const ReleasesPage = () => {
|
|
|
487
520
|
defaultMessage: "New release"
|
|
488
521
|
})
|
|
489
522
|
}
|
|
490
|
-
)
|
|
523
|
+
) : null
|
|
491
524
|
}
|
|
492
525
|
),
|
|
493
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
526
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
494
527
|
hasReachedMaximumPendingReleases && /* @__PURE__ */ jsxRuntime.jsx(
|
|
495
528
|
StyledAlert,
|
|
496
529
|
{
|
|
497
530
|
marginBottom: 6,
|
|
498
|
-
action: /* @__PURE__ */ jsxRuntime.jsx(
|
|
531
|
+
action: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Link, { href: "https://strapi.io/pricing-cloud", isExternal: true, children: formatMessage({
|
|
499
532
|
id: "content-releases.pages.Releases.max-limit-reached.action",
|
|
500
533
|
defaultMessage: "Explore plans"
|
|
501
534
|
}) }),
|
|
@@ -566,23 +599,17 @@ const ReleasesPage = () => {
|
|
|
566
599
|
]
|
|
567
600
|
}
|
|
568
601
|
),
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
pagination: {
|
|
581
|
-
pageCount: response?.currentData?.meta?.pagination?.pageCount || 0
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
)
|
|
585
|
-
] }) : 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
|
+
)
|
|
586
613
|
] }) }),
|
|
587
614
|
releaseModalShown && /* @__PURE__ */ jsxRuntime.jsx(
|
|
588
615
|
ReleaseModal,
|
|
@@ -595,13 +622,13 @@ const ReleasesPage = () => {
|
|
|
595
622
|
)
|
|
596
623
|
] });
|
|
597
624
|
};
|
|
598
|
-
const ReleaseInfoWrapper =
|
|
625
|
+
const ReleaseInfoWrapper = styledComponents.styled(designSystem.Flex)`
|
|
599
626
|
align-self: stretch;
|
|
600
627
|
border-bottom-right-radius: ${({ theme }) => theme.borderRadius};
|
|
601
628
|
border-bottom-left-radius: ${({ theme }) => theme.borderRadius};
|
|
602
629
|
border-top: 1px solid ${({ theme }) => theme.colors.neutral150};
|
|
603
630
|
`;
|
|
604
|
-
const StyledMenuItem =
|
|
631
|
+
const StyledMenuItem = styledComponents.styled(designSystem.Menu.Item)`
|
|
605
632
|
svg path {
|
|
606
633
|
fill: ${({ theme, disabled }) => disabled && theme.colors.neutral500};
|
|
607
634
|
}
|
|
@@ -610,49 +637,54 @@ const StyledMenuItem = styled__default.default(v2.Menu.Item)`
|
|
|
610
637
|
}
|
|
611
638
|
|
|
612
639
|
&:hover {
|
|
613
|
-
background: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}100`]};
|
|
640
|
+
background: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}100`]};
|
|
614
641
|
}
|
|
615
642
|
`;
|
|
616
|
-
const PencilIcon =
|
|
643
|
+
const PencilIcon = styledComponents.styled(icons.Pencil)`
|
|
617
644
|
width: ${({ theme }) => theme.spaces[3]};
|
|
618
645
|
height: ${({ theme }) => theme.spaces[3]};
|
|
619
646
|
path {
|
|
620
647
|
fill: ${({ theme }) => theme.colors.neutral600};
|
|
621
648
|
}
|
|
622
649
|
`;
|
|
623
|
-
const TrashIcon =
|
|
650
|
+
const TrashIcon = styledComponents.styled(icons.Trash)`
|
|
624
651
|
width: ${({ theme }) => theme.spaces[3]};
|
|
625
652
|
height: ${({ theme }) => theme.spaces[3]};
|
|
626
653
|
path {
|
|
627
654
|
fill: ${({ theme }) => theme.colors.danger600};
|
|
628
655
|
}
|
|
629
656
|
`;
|
|
630
|
-
const TypographyMaxWidth =
|
|
657
|
+
const TypographyMaxWidth = styledComponents.styled(designSystem.Typography)`
|
|
631
658
|
max-width: 300px;
|
|
632
659
|
`;
|
|
633
|
-
const EntryValidationText = ({ action, schema,
|
|
660
|
+
const EntryValidationText = ({ action, schema, entry }) => {
|
|
634
661
|
const { formatMessage } = reactIntl.useIntl();
|
|
635
|
-
const { validate } = strapiAdmin.unstable_useDocument(
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
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) ?? {};
|
|
641
672
|
if (Object.keys(errors).length > 0) {
|
|
642
673
|
const validationErrorsMessages = Object.entries(errors).map(
|
|
643
674
|
([key, value]) => formatMessage(
|
|
675
|
+
// @ts-expect-error – TODO: fix this will better checks
|
|
644
676
|
{ id: `${value.id}.withField`, defaultMessage: value.defaultMessage },
|
|
645
677
|
{ field: key }
|
|
646
678
|
)
|
|
647
679
|
).join(" ");
|
|
648
680
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
649
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
681
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.CrossCircle, { fill: "danger600" }),
|
|
650
682
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tooltip, { description: validationErrorsMessages, children: /* @__PURE__ */ jsxRuntime.jsx(TypographyMaxWidth, { textColor: "danger600", variant: "omega", fontWeight: "semiBold", ellipsis: true, children: validationErrorsMessages }) })
|
|
651
683
|
] });
|
|
652
684
|
}
|
|
653
685
|
if (action == "publish") {
|
|
654
686
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
655
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
687
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
|
656
688
|
entry.publishedAt ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "success600", fontWeight: "bold", children: formatMessage({
|
|
657
689
|
id: "content-releases.pages.ReleaseDetails.entry-validation.already-published",
|
|
658
690
|
defaultMessage: "Already published"
|
|
@@ -663,7 +695,7 @@ const EntryValidationText = ({ action, schema, components, entry }) => {
|
|
|
663
695
|
] });
|
|
664
696
|
}
|
|
665
697
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
666
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
698
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
|
667
699
|
!entry.publishedAt ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "success600", fontWeight: "bold", children: formatMessage({
|
|
668
700
|
id: "content-releases.pages.ReleaseDetails.entry-validation.already-unpublished",
|
|
669
701
|
defaultMessage: "Already unpublished"
|
|
@@ -683,20 +715,23 @@ const ReleaseDetailsLayout = ({
|
|
|
683
715
|
const {
|
|
684
716
|
data,
|
|
685
717
|
isLoading: isLoadingDetails,
|
|
686
|
-
isError,
|
|
687
718
|
error
|
|
688
|
-
} = index.useGetReleaseQuery(
|
|
719
|
+
} = index.useGetReleaseQuery(
|
|
720
|
+
{ id: releaseId },
|
|
721
|
+
{
|
|
722
|
+
skip: !releaseId
|
|
723
|
+
}
|
|
724
|
+
);
|
|
689
725
|
const [publishRelease, { isLoading: isPublishing }] = index.usePublishReleaseMutation();
|
|
690
|
-
const toggleNotification =
|
|
691
|
-
const { formatAPIError } =
|
|
692
|
-
const {
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
const
|
|
696
|
-
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();
|
|
697
732
|
const release = data?.data;
|
|
698
|
-
const handlePublishRelease = async () => {
|
|
699
|
-
const response = await publishRelease({ id
|
|
733
|
+
const handlePublishRelease = (id) => async () => {
|
|
734
|
+
const response = await publishRelease({ id });
|
|
700
735
|
if ("data" in response) {
|
|
701
736
|
toggleNotification({
|
|
702
737
|
type: "success",
|
|
@@ -711,14 +746,14 @@ const ReleaseDetailsLayout = ({
|
|
|
711
746
|
totalPublishedEntries,
|
|
712
747
|
totalUnpublishedEntries
|
|
713
748
|
});
|
|
714
|
-
} else if (
|
|
749
|
+
} else if (strapiAdmin.isFetchError(response.error)) {
|
|
715
750
|
toggleNotification({
|
|
716
|
-
type: "
|
|
751
|
+
type: "danger",
|
|
717
752
|
message: formatAPIError(response.error)
|
|
718
753
|
});
|
|
719
754
|
} else {
|
|
720
755
|
toggleNotification({
|
|
721
|
-
type: "
|
|
756
|
+
type: "danger",
|
|
722
757
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
723
758
|
});
|
|
724
759
|
}
|
|
@@ -744,21 +779,20 @@ const ReleaseDetailsLayout = ({
|
|
|
744
779
|
return release.createdBy.email;
|
|
745
780
|
};
|
|
746
781
|
if (isLoadingDetails) {
|
|
747
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
782
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
|
|
748
783
|
}
|
|
749
|
-
if (
|
|
784
|
+
if (isBaseQueryError(error) && "code" in error || !release) {
|
|
750
785
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
751
|
-
reactRouterDom.
|
|
786
|
+
reactRouterDom.Navigate,
|
|
752
787
|
{
|
|
753
|
-
to:
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
}
|
|
788
|
+
to: "..",
|
|
789
|
+
state: {
|
|
790
|
+
errors: [
|
|
791
|
+
{
|
|
792
|
+
// @ts-expect-error – TODO: fix this weird error flow
|
|
793
|
+
code: error?.code
|
|
794
|
+
}
|
|
795
|
+
]
|
|
762
796
|
}
|
|
763
797
|
}
|
|
764
798
|
);
|
|
@@ -795,34 +829,30 @@ const ReleaseDetailsLayout = ({
|
|
|
795
829
|
) : "";
|
|
796
830
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { "aria-busy": isLoadingDetails, children: [
|
|
797
831
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
798
|
-
|
|
832
|
+
strapiAdmin.Layouts.Header,
|
|
799
833
|
{
|
|
800
834
|
title: release.name,
|
|
801
835
|
subtitle: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, lineHeight: 6, children: [
|
|
802
836
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", variant: "epsilon", children: numberOfEntriesText + (isScheduled ? ` - ${scheduledText}` : "") }),
|
|
803
837
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { ...getBadgeProps(release.status), children: release.status })
|
|
804
838
|
] }),
|
|
805
|
-
navigationAction: /* @__PURE__ */ jsxRuntime.jsx(
|
|
806
|
-
id: "global.back",
|
|
807
|
-
defaultMessage: "Back"
|
|
808
|
-
}) }),
|
|
839
|
+
navigationAction: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.BackButton, {}),
|
|
809
840
|
primaryAction: !release.releasedAt && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
810
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
841
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Root, { children: [
|
|
811
842
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
812
|
-
|
|
843
|
+
designSystem.Menu.Trigger,
|
|
813
844
|
{
|
|
814
|
-
as: designSystem.IconButton,
|
|
815
845
|
paddingLeft: 2,
|
|
816
846
|
paddingRight: 2,
|
|
817
847
|
"aria-label": formatMessage({
|
|
818
848
|
id: "content-releases.header.actions.open-release-actions",
|
|
819
849
|
defaultMessage: "Release edit and delete menu"
|
|
820
850
|
}),
|
|
821
|
-
|
|
822
|
-
|
|
851
|
+
variant: "tertiary",
|
|
852
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(icons.More, {})
|
|
823
853
|
}
|
|
824
854
|
),
|
|
825
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
855
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Content, { top: 1, popoverPlacement: "bottom-end", maxHeight: void 0, children: [
|
|
826
856
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
827
857
|
designSystem.Flex,
|
|
828
858
|
{
|
|
@@ -844,7 +874,7 @@ const ReleaseDetailsLayout = ({
|
|
|
844
874
|
{
|
|
845
875
|
disabled: !canDelete,
|
|
846
876
|
onSelect: toggleWarningSubmit,
|
|
847
|
-
variant: "danger",
|
|
877
|
+
$variant: "danger",
|
|
848
878
|
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 2, hasRadius: true, width: "100%", children: [
|
|
849
879
|
/* @__PURE__ */ jsxRuntime.jsx(TrashIcon, {}),
|
|
850
880
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { ellipsis: true, textColor: "danger600", children: formatMessage({
|
|
@@ -871,7 +901,7 @@ const ReleaseDetailsLayout = ({
|
|
|
871
901
|
defaultMessage: "Created"
|
|
872
902
|
}) }),
|
|
873
903
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", color: "neutral300", children: [
|
|
874
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
904
|
+
/* @__PURE__ */ jsxRuntime.jsx(RelativeTime$1, { timestamp: new Date(release.createdAt) }),
|
|
875
905
|
formatMessage(
|
|
876
906
|
{
|
|
877
907
|
id: "content-releases.header.actions.created.description",
|
|
@@ -889,12 +919,12 @@ const ReleaseDetailsLayout = ({
|
|
|
889
919
|
id: "content-releases.header.actions.refresh",
|
|
890
920
|
defaultMessage: "Refresh"
|
|
891
921
|
}) }),
|
|
892
|
-
|
|
922
|
+
canPublish ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
893
923
|
designSystem.Button,
|
|
894
924
|
{
|
|
895
925
|
size: "S",
|
|
896
926
|
variant: "default",
|
|
897
|
-
onClick: handlePublishRelease,
|
|
927
|
+
onClick: handlePublishRelease(release.id.toString()),
|
|
898
928
|
loading: isPublishing,
|
|
899
929
|
disabled: release.actions.meta.count === 0,
|
|
900
930
|
children: formatMessage({
|
|
@@ -902,7 +932,7 @@ const ReleaseDetailsLayout = ({
|
|
|
902
932
|
defaultMessage: "Publish"
|
|
903
933
|
})
|
|
904
934
|
}
|
|
905
|
-
)
|
|
935
|
+
) : null
|
|
906
936
|
] })
|
|
907
937
|
}
|
|
908
938
|
),
|
|
@@ -929,44 +959,30 @@ const getGroupByOptionLabel = (value) => {
|
|
|
929
959
|
defaultMessage: "Content-Types"
|
|
930
960
|
};
|
|
931
961
|
};
|
|
932
|
-
const
|
|
933
|
-
{
|
|
934
|
-
key: "__name__",
|
|
935
|
-
fieldSchema: { type: "string" },
|
|
936
|
-
metadatas: {
|
|
937
|
-
label: {
|
|
938
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.name",
|
|
939
|
-
defaultMessage: "name"
|
|
940
|
-
},
|
|
941
|
-
searchable: false,
|
|
942
|
-
sortable: false
|
|
943
|
-
},
|
|
944
|
-
name: "name"
|
|
945
|
-
}
|
|
946
|
-
];
|
|
947
|
-
const ReleaseDetailsBody = () => {
|
|
962
|
+
const ReleaseDetailsBody = ({ releaseId }) => {
|
|
948
963
|
const { formatMessage } = reactIntl.useIntl();
|
|
949
|
-
const {
|
|
950
|
-
const
|
|
951
|
-
const
|
|
952
|
-
const { formatAPIError } = helperPlugin.useAPIErrorHandler();
|
|
964
|
+
const [{ query }, setQuery] = strapiAdmin.useQueryParams();
|
|
965
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
966
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
953
967
|
const {
|
|
954
968
|
data: releaseData,
|
|
955
969
|
isLoading: isReleaseLoading,
|
|
956
|
-
isError: isReleaseError,
|
|
957
970
|
error: releaseError
|
|
958
971
|
} = index.useGetReleaseQuery({ id: releaseId });
|
|
959
972
|
const {
|
|
960
973
|
allowedActions: { canUpdate }
|
|
961
|
-
} =
|
|
962
|
-
const
|
|
963
|
-
const {
|
|
964
|
-
displayedHeaders,
|
|
965
|
-
hasI18nEnabled
|
|
966
|
-
} = runHookWaterfall(
|
|
974
|
+
} = strapiAdmin.useRBAC(index.PERMISSIONS);
|
|
975
|
+
const runHookWaterfall = strapiAdmin.useStrapiApp("ReleaseDetailsPage", (state) => state.runHookWaterfall);
|
|
976
|
+
const { hasI18nEnabled } = runHookWaterfall(
|
|
967
977
|
"ContentReleases/pages/ReleaseDetails/add-locale-in-releases",
|
|
968
978
|
{
|
|
969
|
-
displayedHeaders:
|
|
979
|
+
displayedHeaders: {
|
|
980
|
+
label: formatMessage({
|
|
981
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.locale",
|
|
982
|
+
defaultMessage: "locale"
|
|
983
|
+
}),
|
|
984
|
+
name: "locale"
|
|
985
|
+
},
|
|
970
986
|
hasI18nEnabled: false
|
|
971
987
|
}
|
|
972
988
|
);
|
|
@@ -998,65 +1014,59 @@ const ReleaseDetailsBody = () => {
|
|
|
998
1014
|
// We are passing the action path to found the position in the cache of the action for optimistic updates
|
|
999
1015
|
});
|
|
1000
1016
|
if ("error" in response) {
|
|
1001
|
-
if (
|
|
1017
|
+
if (strapiAdmin.isFetchError(response.error)) {
|
|
1002
1018
|
toggleNotification({
|
|
1003
|
-
type: "
|
|
1019
|
+
type: "danger",
|
|
1004
1020
|
message: formatAPIError(response.error)
|
|
1005
1021
|
});
|
|
1006
1022
|
} else {
|
|
1007
1023
|
toggleNotification({
|
|
1008
|
-
type: "
|
|
1024
|
+
type: "danger",
|
|
1009
1025
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
1010
1026
|
});
|
|
1011
1027
|
}
|
|
1012
1028
|
}
|
|
1013
1029
|
};
|
|
1014
1030
|
if (isLoading || isReleaseLoading) {
|
|
1015
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1031
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
|
|
1016
1032
|
}
|
|
1017
1033
|
const releaseActions = data?.data;
|
|
1018
1034
|
const releaseMeta = data?.meta;
|
|
1019
1035
|
const contentTypes = releaseMeta?.contentTypes || {};
|
|
1020
1036
|
const components = releaseMeta?.components || {};
|
|
1021
|
-
if (
|
|
1037
|
+
if (isBaseQueryError(releaseError) || !release) {
|
|
1022
1038
|
const errorsArray = [];
|
|
1023
|
-
if (releaseError) {
|
|
1039
|
+
if (releaseError && "code" in releaseError) {
|
|
1024
1040
|
errorsArray.push({
|
|
1025
1041
|
code: releaseError.code
|
|
1026
1042
|
});
|
|
1027
1043
|
}
|
|
1028
|
-
if (releaseActionsError) {
|
|
1044
|
+
if (releaseActionsError && "code" in releaseActionsError) {
|
|
1029
1045
|
errorsArray.push({
|
|
1030
1046
|
code: releaseActionsError.code
|
|
1031
1047
|
});
|
|
1032
1048
|
}
|
|
1033
1049
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1034
|
-
reactRouterDom.
|
|
1050
|
+
reactRouterDom.Navigate,
|
|
1035
1051
|
{
|
|
1036
|
-
to:
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
errors: errorsArray
|
|
1040
|
-
}
|
|
1052
|
+
to: "..",
|
|
1053
|
+
state: {
|
|
1054
|
+
errors: errorsArray
|
|
1041
1055
|
}
|
|
1042
1056
|
}
|
|
1043
1057
|
);
|
|
1044
1058
|
}
|
|
1045
1059
|
if (isError || !releaseActions) {
|
|
1046
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1060
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Error, {});
|
|
1047
1061
|
}
|
|
1048
1062
|
if (Object.keys(releaseActions).length === 0) {
|
|
1049
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1050
|
-
|
|
1063
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1064
|
+
designSystem.EmptyStateLayout,
|
|
1051
1065
|
{
|
|
1052
|
-
content: {
|
|
1053
|
-
id: "content-releases.pages.Details.tab.emptyEntries",
|
|
1054
|
-
defaultMessage: "This release is empty. Open the Content Manager, select an entry and add it to the release."
|
|
1055
|
-
},
|
|
1056
1066
|
action: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1057
|
-
|
|
1067
|
+
designSystem.LinkButton,
|
|
1058
1068
|
{
|
|
1059
|
-
|
|
1069
|
+
tag: reactRouterDom.Link,
|
|
1060
1070
|
to: {
|
|
1061
1071
|
pathname: "/content-manager"
|
|
1062
1072
|
},
|
|
@@ -1067,19 +1077,59 @@ const ReleaseDetailsBody = () => {
|
|
|
1067
1077
|
defaultMessage: "Open the Content Manager"
|
|
1068
1078
|
})
|
|
1069
1079
|
}
|
|
1070
|
-
)
|
|
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
|
+
})
|
|
1071
1086
|
}
|
|
1072
1087
|
) });
|
|
1073
1088
|
}
|
|
1089
|
+
const groupByLabel = formatMessage({
|
|
1090
|
+
id: "content-releases.pages.ReleaseDetails.groupBy.aria-label",
|
|
1091
|
+
defaultMessage: "Group by"
|
|
1092
|
+
});
|
|
1093
|
+
const headers = [
|
|
1094
|
+
// ...displayedHeaders,
|
|
1095
|
+
{
|
|
1096
|
+
label: formatMessage({
|
|
1097
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.name",
|
|
1098
|
+
defaultMessage: "name"
|
|
1099
|
+
}),
|
|
1100
|
+
name: "name"
|
|
1101
|
+
},
|
|
1102
|
+
{
|
|
1103
|
+
label: formatMessage({
|
|
1104
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.content-type",
|
|
1105
|
+
defaultMessage: "content-type"
|
|
1106
|
+
}),
|
|
1107
|
+
name: "content-type"
|
|
1108
|
+
},
|
|
1109
|
+
{
|
|
1110
|
+
label: formatMessage({
|
|
1111
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.action",
|
|
1112
|
+
defaultMessage: "action"
|
|
1113
|
+
}),
|
|
1114
|
+
name: "action"
|
|
1115
|
+
},
|
|
1116
|
+
...!release.releasedAt ? [
|
|
1117
|
+
{
|
|
1118
|
+
label: formatMessage({
|
|
1119
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.status",
|
|
1120
|
+
defaultMessage: "status"
|
|
1121
|
+
}),
|
|
1122
|
+
name: "status"
|
|
1123
|
+
}
|
|
1124
|
+
] : []
|
|
1125
|
+
];
|
|
1074
1126
|
const options = hasI18nEnabled ? GROUP_BY_OPTIONS : GROUP_BY_OPTIONS_NO_LOCALE;
|
|
1075
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1127
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 8, direction: "column", alignItems: "stretch", children: [
|
|
1076
1128
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1077
1129
|
designSystem.SingleSelect,
|
|
1078
1130
|
{
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
defaultMessage: "Group by"
|
|
1082
|
-
}),
|
|
1131
|
+
placeholder: groupByLabel,
|
|
1132
|
+
"aria-label": groupByLabel,
|
|
1083
1133
|
customizeContent: (value) => formatMessage(
|
|
1084
1134
|
{
|
|
1085
1135
|
id: `content-releases.pages.ReleaseDetails.groupBy.label`,
|
|
@@ -1097,62 +1147,18 @@ const ReleaseDetailsBody = () => {
|
|
|
1097
1147
|
Object.keys(releaseActions).map((key) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, direction: "column", alignItems: "stretch", children: [
|
|
1098
1148
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { role: "separator", "aria-label": key, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { children: key }) }),
|
|
1099
1149
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1100
|
-
|
|
1150
|
+
strapiAdmin.Table.Root,
|
|
1101
1151
|
{
|
|
1102
1152
|
rows: releaseActions[key].map((item) => ({
|
|
1103
1153
|
...item,
|
|
1104
1154
|
id: Number(item.entry.id)
|
|
1105
1155
|
})),
|
|
1106
|
-
|
|
1107
|
-
isLoading,
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1111
|
-
|
|
1112
|
-
helperPlugin.Table.HeaderCell,
|
|
1113
|
-
{
|
|
1114
|
-
fieldSchemaType: fieldSchema.type,
|
|
1115
|
-
label: formatMessage(metadatas.label),
|
|
1116
|
-
name
|
|
1117
|
-
},
|
|
1118
|
-
key2
|
|
1119
|
-
)),
|
|
1120
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1121
|
-
helperPlugin.Table.HeaderCell,
|
|
1122
|
-
{
|
|
1123
|
-
fieldSchemaType: "string",
|
|
1124
|
-
label: formatMessage({
|
|
1125
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.content-type",
|
|
1126
|
-
defaultMessage: "content-type"
|
|
1127
|
-
}),
|
|
1128
|
-
name: "content-type"
|
|
1129
|
-
}
|
|
1130
|
-
),
|
|
1131
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1132
|
-
helperPlugin.Table.HeaderCell,
|
|
1133
|
-
{
|
|
1134
|
-
fieldSchemaType: "string",
|
|
1135
|
-
label: formatMessage({
|
|
1136
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.action",
|
|
1137
|
-
defaultMessage: "action"
|
|
1138
|
-
}),
|
|
1139
|
-
name: "action"
|
|
1140
|
-
}
|
|
1141
|
-
),
|
|
1142
|
-
!release.releasedAt && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1143
|
-
helperPlugin.Table.HeaderCell,
|
|
1144
|
-
{
|
|
1145
|
-
fieldSchemaType: "string",
|
|
1146
|
-
label: formatMessage({
|
|
1147
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.status",
|
|
1148
|
-
defaultMessage: "status"
|
|
1149
|
-
}),
|
|
1150
|
-
name: "status"
|
|
1151
|
-
}
|
|
1152
|
-
)
|
|
1153
|
-
] }),
|
|
1154
|
-
/* @__PURE__ */ jsxRuntime.jsx(helperPlugin.Table.LoadingBody, {}),
|
|
1155
|
-
/* @__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(
|
|
1156
1162
|
({ id, contentType, locale, type, entry }, actionIndex) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
1157
1163
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "25%", maxWidth: "200px", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { ellipsis: true, children: `${contentType.mainFieldValue || entry.id}` }) }),
|
|
1158
1164
|
hasI18nEnabled && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "10%", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: `${locale?.name ? locale.name : "-"}` }) }),
|
|
@@ -1209,34 +1215,39 @@ const ReleaseDetailsBody = () => {
|
|
|
1209
1215
|
}
|
|
1210
1216
|
)
|
|
1211
1217
|
] }, `releases-group-${key}`)),
|
|
1212
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
}
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
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
|
+
)
|
|
1223
1229
|
] }) });
|
|
1224
1230
|
};
|
|
1225
1231
|
const ReleaseDetailsPage = () => {
|
|
1226
1232
|
const { formatMessage } = reactIntl.useIntl();
|
|
1227
1233
|
const { releaseId } = reactRouterDom.useParams();
|
|
1228
|
-
const toggleNotification =
|
|
1229
|
-
const { formatAPIError } =
|
|
1230
|
-
const
|
|
1234
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
1235
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
1236
|
+
const navigate = reactRouterDom.useNavigate();
|
|
1231
1237
|
const [releaseModalShown, setReleaseModalShown] = React__namespace.useState(false);
|
|
1232
1238
|
const [showWarningSubmit, setWarningSubmit] = React__namespace.useState(false);
|
|
1233
1239
|
const {
|
|
1234
1240
|
isLoading: isLoadingDetails,
|
|
1235
1241
|
data,
|
|
1236
1242
|
isSuccess: isSuccessDetails
|
|
1237
|
-
} = index.useGetReleaseQuery(
|
|
1243
|
+
} = index.useGetReleaseQuery(
|
|
1244
|
+
{ id: releaseId },
|
|
1245
|
+
{
|
|
1246
|
+
skip: !releaseId
|
|
1247
|
+
}
|
|
1248
|
+
);
|
|
1238
1249
|
const [updateRelease, { isLoading: isSubmittingForm }] = index.useUpdateReleaseMutation();
|
|
1239
|
-
const [deleteRelease
|
|
1250
|
+
const [deleteRelease] = index.useDeleteReleaseMutation();
|
|
1240
1251
|
const toggleEditReleaseModal = () => {
|
|
1241
1252
|
setReleaseModalShown((prev) => !prev);
|
|
1242
1253
|
};
|
|
@@ -1247,15 +1258,18 @@ const ReleaseDetailsPage = () => {
|
|
|
1247
1258
|
{
|
|
1248
1259
|
toggleEditReleaseModal,
|
|
1249
1260
|
toggleWarningSubmit,
|
|
1250
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1261
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {})
|
|
1251
1262
|
}
|
|
1252
1263
|
);
|
|
1253
1264
|
}
|
|
1265
|
+
if (!releaseId) {
|
|
1266
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: ".." });
|
|
1267
|
+
}
|
|
1254
1268
|
const releaseData = isSuccessDetails && data?.data || null;
|
|
1255
1269
|
const title = releaseData?.name || "";
|
|
1256
1270
|
const timezone = releaseData?.timezone ?? null;
|
|
1257
1271
|
const scheduledAt = releaseData?.scheduledAt && timezone ? dateFnsTz.utcToZonedTime(releaseData.scheduledAt, timezone) : null;
|
|
1258
|
-
const date = scheduledAt ? format__default.default(scheduledAt, "yyyy-MM-dd") :
|
|
1272
|
+
const date = scheduledAt ? format__default.default(scheduledAt, "yyyy-MM-dd") : void 0;
|
|
1259
1273
|
const time = scheduledAt ? format__default.default(scheduledAt, "HH:mm") : "";
|
|
1260
1274
|
const handleEditRelease = async (values) => {
|
|
1261
1275
|
const response = await updateRelease({
|
|
@@ -1273,14 +1287,14 @@ const ReleaseDetailsPage = () => {
|
|
|
1273
1287
|
})
|
|
1274
1288
|
});
|
|
1275
1289
|
toggleEditReleaseModal();
|
|
1276
|
-
} else if (
|
|
1290
|
+
} else if (strapiAdmin.isFetchError(response.error)) {
|
|
1277
1291
|
toggleNotification({
|
|
1278
|
-
type: "
|
|
1292
|
+
type: "danger",
|
|
1279
1293
|
message: formatAPIError(response.error)
|
|
1280
1294
|
});
|
|
1281
1295
|
} else {
|
|
1282
1296
|
toggleNotification({
|
|
1283
|
-
type: "
|
|
1297
|
+
type: "danger",
|
|
1284
1298
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
1285
1299
|
});
|
|
1286
1300
|
}
|
|
@@ -1290,15 +1304,15 @@ const ReleaseDetailsPage = () => {
|
|
|
1290
1304
|
id: releaseId
|
|
1291
1305
|
});
|
|
1292
1306
|
if ("data" in response) {
|
|
1293
|
-
|
|
1294
|
-
} else if (
|
|
1307
|
+
navigate("..");
|
|
1308
|
+
} else if (strapiAdmin.isFetchError(response.error)) {
|
|
1295
1309
|
toggleNotification({
|
|
1296
|
-
type: "
|
|
1310
|
+
type: "danger",
|
|
1297
1311
|
message: formatAPIError(response.error)
|
|
1298
1312
|
});
|
|
1299
1313
|
} else {
|
|
1300
1314
|
toggleNotification({
|
|
1301
|
-
type: "
|
|
1315
|
+
type: "danger",
|
|
1302
1316
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
1303
1317
|
});
|
|
1304
1318
|
}
|
|
@@ -1309,7 +1323,7 @@ const ReleaseDetailsPage = () => {
|
|
|
1309
1323
|
toggleEditReleaseModal,
|
|
1310
1324
|
toggleWarningSubmit,
|
|
1311
1325
|
children: [
|
|
1312
|
-
/* @__PURE__ */ jsxRuntime.jsx(ReleaseDetailsBody, {}),
|
|
1326
|
+
/* @__PURE__ */ jsxRuntime.jsx(ReleaseDetailsBody, { releaseId }),
|
|
1313
1327
|
releaseModalShown && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1314
1328
|
ReleaseModal,
|
|
1315
1329
|
{
|
|
@@ -1327,16 +1341,15 @@ const ReleaseDetailsPage = () => {
|
|
|
1327
1341
|
}
|
|
1328
1342
|
),
|
|
1329
1343
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1330
|
-
|
|
1344
|
+
strapiAdmin.ConfirmDialog,
|
|
1331
1345
|
{
|
|
1332
|
-
|
|
1346
|
+
isOpen: showWarningSubmit,
|
|
1347
|
+
onClose: toggleWarningSubmit,
|
|
1348
|
+
onConfirm: handleDeleteRelease,
|
|
1349
|
+
children: formatMessage({
|
|
1333
1350
|
id: "content-releases.dialog.confirmation-message",
|
|
1334
1351
|
defaultMessage: "Are you sure you want to delete this release?"
|
|
1335
|
-
}
|
|
1336
|
-
isOpen: showWarningSubmit,
|
|
1337
|
-
isConfirmButtonLoading: isDeletingRelease,
|
|
1338
|
-
onToggleDialog: toggleWarningSubmit,
|
|
1339
|
-
onConfirm: handleDeleteRelease
|
|
1352
|
+
})
|
|
1340
1353
|
}
|
|
1341
1354
|
)
|
|
1342
1355
|
]
|
|
@@ -1344,10 +1357,10 @@ const ReleaseDetailsPage = () => {
|
|
|
1344
1357
|
);
|
|
1345
1358
|
};
|
|
1346
1359
|
const App = () => {
|
|
1347
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1348
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, {
|
|
1349
|
-
/* @__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, {}) })
|
|
1350
1363
|
] }) });
|
|
1351
1364
|
};
|
|
1352
1365
|
exports.App = App;
|
|
1353
|
-
//# sourceMappingURL=App-
|
|
1366
|
+
//# sourceMappingURL=App-DUmziQ17.js.map
|