@strapi/content-releases 0.0.0-experimental.fc1ac2acd58c8a5a858679956b6d102ac5ee4011 → 0.0.0-experimental.fd379e4937e431407d784eaa5fe7f93cf2a53386
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/LICENSE +17 -1
- package/dist/_chunks/{App-C768ulk4.js → App-BKB1esYS.js} +497 -483
- package/dist/_chunks/App-BKB1esYS.js.map +1 -0
- package/dist/_chunks/{App-0Er6xxcq.mjs → App-Cne--1Z8.mjs} +480 -464
- package/dist/_chunks/App-Cne--1Z8.mjs.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-YhAPgpG9.js → PurchaseContentReleases-Be3acS2L.js} +8 -7
- package/dist/_chunks/PurchaseContentReleases-Be3acS2L.js.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-Clm0iACO.mjs → PurchaseContentReleases-_MxP6-Dt.mjs} +9 -8
- package/dist/_chunks/PurchaseContentReleases-_MxP6-Dt.mjs.map +1 -0
- package/dist/_chunks/ReleasesSettingsPage-C1WwGWIH.mjs +178 -0
- package/dist/_chunks/ReleasesSettingsPage-C1WwGWIH.mjs.map +1 -0
- package/dist/_chunks/ReleasesSettingsPage-kuXIwpWp.js +178 -0
- package/dist/_chunks/ReleasesSettingsPage-kuXIwpWp.js.map +1 -0
- package/dist/_chunks/{en-gcJJ5htG.js → en-CmYoEnA7.js} +19 -4
- package/dist/_chunks/en-CmYoEnA7.js.map +1 -0
- package/dist/_chunks/{en-WuuhP6Bn.mjs → en-D0yVZFqf.mjs} +19 -4
- package/dist/_chunks/en-D0yVZFqf.mjs.map +1 -0
- package/dist/_chunks/index-5Odi61vw.js +1381 -0
- package/dist/_chunks/index-5Odi61vw.js.map +1 -0
- package/dist/_chunks/index-Cy7qwpaU.mjs +1362 -0
- package/dist/_chunks/index-Cy7qwpaU.mjs.map +1 -0
- package/dist/_chunks/schemas-BE1LxE9J.js +62 -0
- package/dist/_chunks/schemas-BE1LxE9J.js.map +1 -0
- package/dist/_chunks/schemas-DdA2ic2U.mjs +44 -0
- package/dist/_chunks/schemas-DdA2ic2U.mjs.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/ReleaseAction.d.ts +3 -0
- package/dist/admin/src/components/ReleaseActionMenu.d.ts +4 -4
- package/dist/admin/src/components/ReleaseActionModal.d.ts +24 -0
- package/dist/admin/src/components/ReleaseListCell.d.ts +28 -0
- package/dist/admin/src/components/ReleaseModal.d.ts +3 -2
- package/dist/admin/src/components/ReleasesPanel.d.ts +3 -0
- package/dist/admin/src/constants.d.ts +18 -0
- package/dist/admin/src/modules/hooks.d.ts +7 -0
- package/dist/admin/src/pages/ReleasesSettingsPage.d.ts +1 -0
- package/dist/admin/src/services/release.d.ts +66 -323
- 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 +9 -0
- package/dist/admin/src/validation/schemas.d.ts +6 -0
- package/dist/server/index.js +1057 -646
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +1058 -647
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/bootstrap.d.ts +2 -2
- package/dist/server/src/bootstrap.d.ts.map +1 -1
- package/dist/server/src/constants.d.ts +11 -2
- package/dist/server/src/constants.d.ts.map +1 -1
- package/dist/server/src/content-types/index.d.ts +3 -5
- package/dist/server/src/content-types/index.d.ts.map +1 -1
- package/dist/server/src/content-types/release-action/index.d.ts +3 -5
- package/dist/server/src/content-types/release-action/index.d.ts.map +1 -1
- package/dist/server/src/content-types/release-action/schema.d.ts +3 -5
- package/dist/server/src/content-types/release-action/schema.d.ts.map +1 -1
- package/dist/server/src/controllers/index.d.ts +8 -1
- package/dist/server/src/controllers/index.d.ts.map +1 -1
- package/dist/server/src/controllers/release-action.d.ts +1 -0
- package/dist/server/src/controllers/release-action.d.ts.map +1 -1
- package/dist/server/src/controllers/release.d.ts +8 -1
- package/dist/server/src/controllers/release.d.ts.map +1 -1
- package/dist/server/src/controllers/settings.d.ts +11 -0
- package/dist/server/src/controllers/settings.d.ts.map +1 -0
- package/dist/server/src/controllers/validation/release-action.d.ts +13 -2
- package/dist/server/src/controllers/validation/release-action.d.ts.map +1 -1
- package/dist/server/src/controllers/validation/release.d.ts +2 -0
- package/dist/server/src/controllers/validation/release.d.ts.map +1 -1
- package/dist/server/src/controllers/validation/settings.d.ts +3 -0
- package/dist/server/src/controllers/validation/settings.d.ts.map +1 -0
- package/dist/server/src/destroy.d.ts +2 -2
- package/dist/server/src/destroy.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +1518 -3241
- package/dist/server/src/index.d.ts.map +1 -1
- package/dist/server/src/middlewares/documents.d.ts +6 -0
- package/dist/server/src/middlewares/documents.d.ts.map +1 -0
- package/dist/server/src/migrations/database/5.0.0-document-id-in-actions.d.ts +9 -0
- package/dist/server/src/migrations/database/5.0.0-document-id-in-actions.d.ts.map +1 -0
- package/dist/server/src/migrations/index.d.ts +3 -0
- package/dist/server/src/migrations/index.d.ts.map +1 -1
- package/dist/server/src/register.d.ts +2 -2
- package/dist/server/src/register.d.ts.map +1 -1
- package/dist/server/src/routes/index.d.ts +16 -0
- package/dist/server/src/routes/index.d.ts.map +1 -1
- package/dist/server/src/routes/release-action.d.ts.map +1 -1
- package/dist/server/src/routes/release.d.ts.map +1 -1
- package/dist/server/src/routes/settings.d.ts +18 -0
- package/dist/server/src/routes/settings.d.ts.map +1 -0
- package/dist/server/src/services/index.d.ts +1482 -3226
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/server/src/services/release-action.d.ts +38 -0
- package/dist/server/src/services/release-action.d.ts.map +1 -0
- package/dist/server/src/services/release.d.ts +19 -1800
- package/dist/server/src/services/release.d.ts.map +1 -1
- package/dist/server/src/services/scheduling.d.ts +6 -6
- package/dist/server/src/services/scheduling.d.ts.map +1 -1
- package/dist/server/src/services/settings.d.ts +13 -0
- package/dist/server/src/services/settings.d.ts.map +1 -0
- package/dist/server/src/services/validation.d.ts +7 -3
- package/dist/server/src/services/validation.d.ts.map +1 -1
- package/dist/server/src/utils/index.d.ts +33 -16
- package/dist/server/src/utils/index.d.ts.map +1 -1
- package/dist/shared/contracts/release-actions.d.ts +37 -12
- package/dist/shared/contracts/release-actions.d.ts.map +1 -1
- package/dist/shared/contracts/releases.d.ts +24 -6
- package/dist/shared/contracts/releases.d.ts.map +1 -1
- package/dist/shared/contracts/settings.d.ts +39 -0
- package/dist/shared/contracts/settings.d.ts.map +1 -0
- package/dist/shared/types.d.ts +2 -2
- package/dist/shared/types.d.ts.map +1 -1
- package/package.json +29 -27
- package/dist/_chunks/App-0Er6xxcq.mjs.map +0 -1
- package/dist/_chunks/App-C768ulk4.js.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-Clm0iACO.mjs.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-YhAPgpG9.js.map +0 -1
- package/dist/_chunks/en-WuuhP6Bn.mjs.map +0 -1
- package/dist/_chunks/en-gcJJ5htG.js.map +0 -1
- package/dist/_chunks/index-BLSMpbpZ.js +0 -1028
- package/dist/_chunks/index-BLSMpbpZ.js.map +0 -1
- package/dist/_chunks/index-fJx1up7m.mjs +0 -1007
- package/dist/_chunks/index-fJx1up7m.mjs.map +0 -1
- package/dist/admin/src/components/CMReleasesContainer.d.ts +0 -1
- package/dist/admin/src/services/axios.d.ts +0 -29
- package/dist/shared/validation-schemas.d.ts +0 -2
- package/dist/shared/validation-schemas.d.ts.map +0 -1
- package/strapi-server.js +0 -3
|
@@ -3,23 +3,21 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
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-5Odi61vw.js");
|
|
7
7
|
const React = require("react");
|
|
8
|
+
const strapiAdmin$1 = require("@strapi/content-manager/strapi-admin");
|
|
8
9
|
const designSystem = require("@strapi/design-system");
|
|
9
|
-
const v2 = require("@strapi/design-system/v2");
|
|
10
|
-
const helperPlugin = require("@strapi/helper-plugin");
|
|
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
|
-
const
|
|
19
|
-
require("
|
|
20
|
-
require("
|
|
21
|
-
require("@reduxjs/toolkit/query/react");
|
|
22
|
-
require("react-redux");
|
|
18
|
+
const schemas = require("./schemas-BE1LxE9J.js");
|
|
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,10 +39,8 @@ 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
|
-
const yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
|
|
46
42
|
const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
|
|
47
|
-
const RelativeTime = React__namespace.forwardRef(
|
|
43
|
+
const RelativeTime$1 = React__namespace.forwardRef(
|
|
48
44
|
({ timestamp, customIntervals = [], ...restProps }, forwardedRef) => {
|
|
49
45
|
const { formatRelativeTime, formatDate, formatTime } = reactIntl.useIntl();
|
|
50
46
|
const interval = dateFns.intervalToDuration({
|
|
@@ -73,28 +69,9 @@ const RelativeTime = React__namespace.forwardRef(
|
|
|
73
69
|
);
|
|
74
70
|
}
|
|
75
71
|
);
|
|
76
|
-
const RELEASE_SCHEMA = yup__namespace.object().shape({
|
|
77
|
-
name: yup__namespace.string().trim().required(),
|
|
78
|
-
scheduledAt: yup__namespace.string().nullable(),
|
|
79
|
-
isScheduled: yup__namespace.boolean().optional(),
|
|
80
|
-
time: yup__namespace.string().when("isScheduled", {
|
|
81
|
-
is: true,
|
|
82
|
-
then: yup__namespace.string().trim().required(),
|
|
83
|
-
otherwise: yup__namespace.string().nullable()
|
|
84
|
-
}),
|
|
85
|
-
timezone: yup__namespace.string().when("isScheduled", {
|
|
86
|
-
is: true,
|
|
87
|
-
then: yup__namespace.string().required().nullable(),
|
|
88
|
-
otherwise: yup__namespace.string().nullable()
|
|
89
|
-
}),
|
|
90
|
-
date: yup__namespace.string().when("isScheduled", {
|
|
91
|
-
is: true,
|
|
92
|
-
then: yup__namespace.string().required().nullable(),
|
|
93
|
-
otherwise: yup__namespace.string().nullable()
|
|
94
|
-
})
|
|
95
|
-
}).required().noUnknown();
|
|
96
72
|
const ReleaseModal = ({
|
|
97
73
|
handleClose,
|
|
74
|
+
open,
|
|
98
75
|
handleSubmit,
|
|
99
76
|
initialValues,
|
|
100
77
|
isLoading = false
|
|
@@ -102,26 +79,24 @@ const ReleaseModal = ({
|
|
|
102
79
|
const { formatMessage } = reactIntl.useIntl();
|
|
103
80
|
const { pathname } = reactRouterDom.useLocation();
|
|
104
81
|
const isCreatingRelease = pathname === `/plugins/${index.pluginId}`;
|
|
105
|
-
const
|
|
106
|
-
const { timezoneList, systemTimezone = { value: "UTC+00:00-Africa/Abidjan " } } = getTimezones(
|
|
82
|
+
const { timezoneList, systemTimezone = { value: "UTC+00:00-Africa/Abidjan " } } = index.getTimezones(
|
|
107
83
|
initialValues.scheduledAt ? new Date(initialValues.scheduledAt) : /* @__PURE__ */ new Date()
|
|
108
84
|
);
|
|
109
85
|
const getScheduledTimestamp = (values) => {
|
|
110
86
|
const { date, time, timezone } = values;
|
|
111
87
|
if (!date || !time || !timezone)
|
|
112
88
|
return null;
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
return dateFnsTz.zonedTimeToUtc(formattedDate, timezoneWithoutOffset);
|
|
89
|
+
const timezoneWithoutOffset = timezone.split("&")[1];
|
|
90
|
+
return dateFnsTz.zonedTimeToUtc(`${date} ${time}`, timezoneWithoutOffset);
|
|
116
91
|
};
|
|
117
92
|
const getTimezoneWithOffset = () => {
|
|
118
93
|
const currentTimezone = timezoneList.find(
|
|
119
|
-
(timezone) => timezone.value.split("
|
|
94
|
+
(timezone) => timezone.value.split("&")[1] === initialValues.timezone
|
|
120
95
|
);
|
|
121
96
|
return currentTimezone?.value || systemTimezone.value;
|
|
122
97
|
};
|
|
123
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
124
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
98
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Root, { open, onOpenChange: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Content, { children: [
|
|
99
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Title, { children: formatMessage(
|
|
125
100
|
{
|
|
126
101
|
id: "content-releases.modal.title",
|
|
127
102
|
defaultMessage: "{isCreatingRelease, select, true {New release} other {Edit release}}"
|
|
@@ -134,7 +109,7 @@ const ReleaseModal = ({
|
|
|
134
109
|
onSubmit: (values) => {
|
|
135
110
|
handleSubmit({
|
|
136
111
|
...values,
|
|
137
|
-
timezone: values.timezone ? values.timezone.split("
|
|
112
|
+
timezone: values.timezone ? values.timezone.split("&")[1] : null,
|
|
138
113
|
scheduledAt: values.isScheduled ? getScheduledTimestamp(values) : null
|
|
139
114
|
});
|
|
140
115
|
},
|
|
@@ -142,33 +117,35 @@ const ReleaseModal = ({
|
|
|
142
117
|
...initialValues,
|
|
143
118
|
timezone: initialValues.timezone ? getTimezoneWithOffset() : systemTimezone.value
|
|
144
119
|
},
|
|
145
|
-
validationSchema: RELEASE_SCHEMA,
|
|
120
|
+
validationSchema: schemas.RELEASE_SCHEMA,
|
|
146
121
|
validateOnChange: false,
|
|
147
|
-
children: ({ values, errors, handleChange, setFieldValue }) =>
|
|
148
|
-
|
|
149
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
defaultMessage:
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
122
|
+
children: ({ values, errors, handleChange, setFieldValue }) => {
|
|
123
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(formik.Form, { children: [
|
|
124
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Body, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
|
|
125
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
126
|
+
designSystem.Field.Root,
|
|
127
|
+
{
|
|
128
|
+
name: "name",
|
|
129
|
+
error: errors.name && formatMessage({ id: errors.name, defaultMessage: errors.name }),
|
|
130
|
+
required: true,
|
|
131
|
+
children: [
|
|
132
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
133
|
+
id: "content-releases.modal.form.input.label.release-name",
|
|
134
|
+
defaultMessage: "Name"
|
|
135
|
+
}) }),
|
|
136
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.TextInput, { value: values.name, onChange: handleChange }),
|
|
137
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
138
|
+
]
|
|
139
|
+
}
|
|
140
|
+
),
|
|
164
141
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "max-content", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
165
142
|
designSystem.Checkbox,
|
|
166
143
|
{
|
|
167
144
|
name: "isScheduled",
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
setFieldValue("isScheduled",
|
|
171
|
-
if (!
|
|
145
|
+
checked: values.isScheduled,
|
|
146
|
+
onCheckedChange: (checked) => {
|
|
147
|
+
setFieldValue("isScheduled", checked);
|
|
148
|
+
if (!checked) {
|
|
172
149
|
setFieldValue("date", null);
|
|
173
150
|
setFieldValue("time", "");
|
|
174
151
|
setFieldValue("timezone", null);
|
|
@@ -196,85 +173,89 @@ const ReleaseModal = ({
|
|
|
196
173
|
) }),
|
|
197
174
|
values.isScheduled && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
198
175
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, alignItems: "start", children: [
|
|
199
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.
|
|
200
|
-
designSystem.
|
|
176
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
177
|
+
designSystem.Field.Root,
|
|
201
178
|
{
|
|
202
|
-
label: formatMessage({
|
|
203
|
-
id: "content-releases.modal.form.input.label.date",
|
|
204
|
-
defaultMessage: "Date"
|
|
205
|
-
}),
|
|
206
179
|
name: "date",
|
|
207
|
-
error: errors.date,
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
180
|
+
error: errors.date && formatMessage({ id: errors.date, defaultMessage: errors.date }),
|
|
181
|
+
required: true,
|
|
182
|
+
children: [
|
|
183
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
184
|
+
id: "content-releases.modal.form.input.label.date",
|
|
185
|
+
defaultMessage: "Date"
|
|
186
|
+
}) }),
|
|
187
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
188
|
+
designSystem.DatePicker,
|
|
189
|
+
{
|
|
190
|
+
onChange: (date) => {
|
|
191
|
+
const isoFormatDate = date ? dateFns.formatISO(date, { representation: "date" }) : null;
|
|
192
|
+
setFieldValue("date", isoFormatDate);
|
|
193
|
+
},
|
|
194
|
+
clearLabel: formatMessage({
|
|
195
|
+
id: "content-releases.modal.form.input.clearLabel",
|
|
196
|
+
defaultMessage: "Clear"
|
|
197
|
+
}),
|
|
198
|
+
onClear: () => {
|
|
199
|
+
setFieldValue("date", null);
|
|
200
|
+
},
|
|
201
|
+
value: values.date ? new Date(values.date) : /* @__PURE__ */ new Date(),
|
|
202
|
+
minDate: dateFnsTz.utcToZonedTime(/* @__PURE__ */ new Date(), values.timezone.split("&")[1])
|
|
203
|
+
}
|
|
204
|
+
),
|
|
205
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
206
|
+
]
|
|
221
207
|
}
|
|
222
208
|
) }),
|
|
223
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.
|
|
224
|
-
designSystem.
|
|
209
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
210
|
+
designSystem.Field.Root,
|
|
225
211
|
{
|
|
226
|
-
label: formatMessage({
|
|
227
|
-
id: "content-releases.modal.form.input.label.time",
|
|
228
|
-
defaultMessage: "Time"
|
|
229
|
-
}),
|
|
230
212
|
name: "time",
|
|
231
|
-
error: errors.time,
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
213
|
+
error: errors.time && formatMessage({ id: errors.time, defaultMessage: errors.time }),
|
|
214
|
+
required: true,
|
|
215
|
+
children: [
|
|
216
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
217
|
+
id: "content-releases.modal.form.input.label.time",
|
|
218
|
+
defaultMessage: "Time"
|
|
219
|
+
}) }),
|
|
220
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
221
|
+
designSystem.TimePicker,
|
|
222
|
+
{
|
|
223
|
+
onChange: (time) => {
|
|
224
|
+
setFieldValue("time", time);
|
|
225
|
+
},
|
|
226
|
+
clearLabel: formatMessage({
|
|
227
|
+
id: "content-releases.modal.form.input.clearLabel",
|
|
228
|
+
defaultMessage: "Clear"
|
|
229
|
+
}),
|
|
230
|
+
onClear: () => {
|
|
231
|
+
setFieldValue("time", "");
|
|
232
|
+
},
|
|
233
|
+
value: values.time || void 0
|
|
234
|
+
}
|
|
235
|
+
),
|
|
236
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
237
|
+
]
|
|
244
238
|
}
|
|
245
239
|
) })
|
|
246
240
|
] }),
|
|
247
241
|
/* @__PURE__ */ jsxRuntime.jsx(TimezoneComponent, { timezoneOptions: timezoneList })
|
|
248
242
|
] })
|
|
249
|
-
] })
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
{
|
|
254
|
-
startActions: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: handleClose, variant: "tertiary", name: "cancel", children: formatMessage({ id: "cancel", defaultMessage: "Cancel" }) }),
|
|
255
|
-
endActions: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { name: "submit", loading: isLoading, type: "submit", children: formatMessage(
|
|
243
|
+
] }) }),
|
|
244
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Footer, { children: [
|
|
245
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Close, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", name: "cancel", children: formatMessage({ id: "cancel", defaultMessage: "Cancel" }) }) }),
|
|
246
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { name: "submit", loading: isLoading, type: "submit", children: formatMessage(
|
|
256
247
|
{
|
|
257
248
|
id: "content-releases.modal.form.button.submit",
|
|
258
249
|
defaultMessage: "{isCreatingRelease, select, true {Continue} other {Save}}"
|
|
259
250
|
},
|
|
260
251
|
{ isCreatingRelease }
|
|
261
252
|
) })
|
|
262
|
-
}
|
|
263
|
-
)
|
|
264
|
-
|
|
253
|
+
] })
|
|
254
|
+
] });
|
|
255
|
+
}
|
|
265
256
|
}
|
|
266
257
|
)
|
|
267
|
-
] });
|
|
268
|
-
};
|
|
269
|
-
const getTimezones = (selectedDate) => {
|
|
270
|
-
const timezoneList = Intl.supportedValuesOf("timeZone").map((timezone) => {
|
|
271
|
-
const utcOffset = index.getTimezoneOffset(timezone, selectedDate);
|
|
272
|
-
return { offset: utcOffset, value: `${utcOffset}_${timezone}` };
|
|
273
|
-
});
|
|
274
|
-
const systemTimezone = timezoneList.find(
|
|
275
|
-
(timezone) => timezone.value.split("_")[1] === Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
276
|
-
);
|
|
277
|
-
return { timezoneList, systemTimezone };
|
|
258
|
+
] }) });
|
|
278
259
|
};
|
|
279
260
|
const TimezoneComponent = ({ timezoneOptions }) => {
|
|
280
261
|
const { values, errors, setFieldValue } = formik.useFormikContext();
|
|
@@ -282,44 +263,60 @@ const TimezoneComponent = ({ timezoneOptions }) => {
|
|
|
282
263
|
const [timezoneList, setTimezoneList] = React__namespace.useState(timezoneOptions);
|
|
283
264
|
React__namespace.useEffect(() => {
|
|
284
265
|
if (values.date) {
|
|
285
|
-
const { timezoneList: timezoneList2 } = getTimezones(new Date(values.date));
|
|
266
|
+
const { timezoneList: timezoneList2 } = index.getTimezones(new Date(values.date));
|
|
286
267
|
setTimezoneList(timezoneList2);
|
|
287
|
-
const updatedTimezone = values.timezone && timezoneList2.find((tz) => tz.value.split("
|
|
268
|
+
const updatedTimezone = values.timezone && timezoneList2.find((tz) => tz.value.split("&")[1] === values.timezone.split("&")[1]);
|
|
288
269
|
if (updatedTimezone) {
|
|
289
270
|
setFieldValue("timezone", updatedTimezone.value);
|
|
290
271
|
}
|
|
291
272
|
}
|
|
292
273
|
}, [setFieldValue, values.date, values.timezone]);
|
|
293
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
294
|
-
designSystem.
|
|
274
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
275
|
+
designSystem.Field.Root,
|
|
295
276
|
{
|
|
296
|
-
label: formatMessage({
|
|
297
|
-
id: "content-releases.modal.form.input.label.timezone",
|
|
298
|
-
defaultMessage: "Timezone"
|
|
299
|
-
}),
|
|
300
277
|
name: "timezone",
|
|
301
|
-
|
|
302
|
-
textValue: values.timezone ? values.timezone.replace("_", " ") : void 0,
|
|
303
|
-
onChange: (timezone) => {
|
|
304
|
-
setFieldValue("timezone", timezone);
|
|
305
|
-
},
|
|
306
|
-
onTextValueChange: (timezone) => {
|
|
307
|
-
setFieldValue("timezone", timezone);
|
|
308
|
-
},
|
|
309
|
-
onClear: () => {
|
|
310
|
-
setFieldValue("timezone", "");
|
|
311
|
-
},
|
|
312
|
-
error: errors.timezone,
|
|
278
|
+
error: errors.timezone && formatMessage({ id: errors.timezone, defaultMessage: errors.timezone }),
|
|
313
279
|
required: true,
|
|
314
|
-
children:
|
|
280
|
+
children: [
|
|
281
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
282
|
+
id: "content-releases.modal.form.input.label.timezone",
|
|
283
|
+
defaultMessage: "Timezone"
|
|
284
|
+
}) }),
|
|
285
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
286
|
+
designSystem.Combobox,
|
|
287
|
+
{
|
|
288
|
+
autocomplete: { type: "list", filter: "contains" },
|
|
289
|
+
value: values.timezone || void 0,
|
|
290
|
+
textValue: values.timezone ? values.timezone.replace(/&/, " ") : void 0,
|
|
291
|
+
onChange: (timezone) => {
|
|
292
|
+
setFieldValue("timezone", timezone);
|
|
293
|
+
},
|
|
294
|
+
onTextValueChange: (timezone) => {
|
|
295
|
+
setFieldValue("timezone", timezone);
|
|
296
|
+
},
|
|
297
|
+
onClear: () => {
|
|
298
|
+
setFieldValue("timezone", "");
|
|
299
|
+
},
|
|
300
|
+
children: timezoneList.map((timezone) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.ComboboxOption, { value: timezone.value, children: timezone.value.replace(/&/, " ") }, timezone.value))
|
|
301
|
+
}
|
|
302
|
+
),
|
|
303
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
304
|
+
]
|
|
315
305
|
}
|
|
316
306
|
);
|
|
317
307
|
};
|
|
318
|
-
const
|
|
308
|
+
const useTypedDispatch = reactRedux.useDispatch;
|
|
309
|
+
const isBaseQueryError = (error) => {
|
|
310
|
+
return typeof error !== "undefined" && error.name !== void 0;
|
|
311
|
+
};
|
|
312
|
+
const LinkCard = styledComponents.styled(designSystem.Link)`
|
|
319
313
|
display: block;
|
|
320
314
|
`;
|
|
321
|
-
const
|
|
322
|
-
|
|
315
|
+
const RelativeTime = styledComponents.styled(RelativeTime$1)`
|
|
316
|
+
display: inline-block;
|
|
317
|
+
&::first-letter {
|
|
318
|
+
text-transform: uppercase;
|
|
319
|
+
}
|
|
323
320
|
`;
|
|
324
321
|
const getBadgeProps = (status) => {
|
|
325
322
|
let color;
|
|
@@ -348,7 +345,6 @@ const getBadgeProps = (status) => {
|
|
|
348
345
|
};
|
|
349
346
|
const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
350
347
|
const { formatMessage } = reactIntl.useIntl();
|
|
351
|
-
const IsSchedulingEnabled = window.strapi.future.isEnabled("contentReleasesScheduling");
|
|
352
348
|
if (isError) {
|
|
353
349
|
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Error, {});
|
|
354
350
|
}
|
|
@@ -365,11 +361,11 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
365
361
|
target: sectionTitle
|
|
366
362
|
}
|
|
367
363
|
),
|
|
368
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
364
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(symbols.EmptyDocuments, { width: "16rem" })
|
|
369
365
|
}
|
|
370
366
|
);
|
|
371
367
|
}
|
|
372
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid, { gap: 4, children: releases.map(({ id, name,
|
|
368
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Root, { gap: 4, children: releases.map(({ id, name, scheduledAt, status }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 3, s: 6, xs: 12, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsxRuntime.jsx(LinkCard, { tag: reactRouterDom.NavLink, to: `${id}`, isExternal: false, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
373
369
|
designSystem.Flex,
|
|
374
370
|
{
|
|
375
371
|
direction: "column",
|
|
@@ -384,24 +380,18 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
384
380
|
gap: 4,
|
|
385
381
|
children: [
|
|
386
382
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "start", gap: 1, children: [
|
|
387
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, {
|
|
388
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children:
|
|
383
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", tag: "h3", variant: "delta", fontWeight: "bold", children: name }),
|
|
384
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: scheduledAt ? /* @__PURE__ */ jsxRuntime.jsx(RelativeTime, { timestamp: new Date(scheduledAt) }) : formatMessage({
|
|
389
385
|
id: "content-releases.pages.Releases.not-scheduled",
|
|
390
386
|
defaultMessage: "Not scheduled"
|
|
391
|
-
})
|
|
392
|
-
{
|
|
393
|
-
id: "content-releases.page.Releases.release-item.entries",
|
|
394
|
-
defaultMessage: "{number, plural, =0 {No entries} one {# entry} other {# entries}}"
|
|
395
|
-
},
|
|
396
|
-
{ number: actions.meta.count }
|
|
397
|
-
) })
|
|
387
|
+
}) })
|
|
398
388
|
] }),
|
|
399
389
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { ...getBadgeProps(status), children: status })
|
|
400
390
|
]
|
|
401
391
|
}
|
|
402
392
|
) }) }, id)) });
|
|
403
393
|
};
|
|
404
|
-
const StyledAlert =
|
|
394
|
+
const StyledAlert = styledComponents.styled(designSystem.Alert)`
|
|
405
395
|
button {
|
|
406
396
|
display: none;
|
|
407
397
|
}
|
|
@@ -411,34 +401,35 @@ const StyledAlert = styled__default.default(designSystem.Alert)`
|
|
|
411
401
|
`;
|
|
412
402
|
const INITIAL_FORM_VALUES = {
|
|
413
403
|
name: "",
|
|
414
|
-
date:
|
|
404
|
+
date: dateFns.format(/* @__PURE__ */ new Date(), "yyyy-MM-dd"),
|
|
415
405
|
time: "",
|
|
416
|
-
|
|
417
|
-
isScheduled: window.strapi.future.isEnabled("contentReleasesScheduling"),
|
|
406
|
+
isScheduled: true,
|
|
418
407
|
scheduledAt: null,
|
|
419
408
|
timezone: null
|
|
420
409
|
};
|
|
421
410
|
const ReleasesPage = () => {
|
|
422
|
-
const tabRef = React__namespace.useRef(null);
|
|
423
411
|
const location = reactRouterDom.useLocation();
|
|
424
412
|
const [releaseModalShown, setReleaseModalShown] = React__namespace.useState(false);
|
|
425
|
-
const toggleNotification =
|
|
413
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
426
414
|
const { formatMessage } = reactIntl.useIntl();
|
|
427
415
|
const navigate = reactRouterDom.useNavigate();
|
|
428
|
-
const { formatAPIError } =
|
|
429
|
-
const [{ query }, setQuery] =
|
|
416
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
417
|
+
const [{ query }, setQuery] = strapiAdmin.useQueryParams();
|
|
430
418
|
const response = index.useGetReleasesQuery(query);
|
|
419
|
+
const { data, isLoading: isLoadingSettings } = index.useGetReleaseSettingsQuery();
|
|
431
420
|
const [createRelease, { isLoading: isSubmittingForm }] = index.useCreateReleaseMutation();
|
|
432
|
-
const { getFeature } =
|
|
421
|
+
const { getFeature } = ee.useLicenseLimits();
|
|
433
422
|
const { maximumReleases = 3 } = getFeature("cms-content-releases");
|
|
434
|
-
const { trackUsage } =
|
|
435
|
-
const {
|
|
423
|
+
const { trackUsage } = strapiAdmin.useTracking();
|
|
424
|
+
const {
|
|
425
|
+
allowedActions: { canCreate }
|
|
426
|
+
} = strapiAdmin.useRBAC(index.PERMISSIONS);
|
|
427
|
+
const { isLoading: isLoadingReleases, isSuccess, isError } = response;
|
|
436
428
|
const activeTab = response?.currentData?.meta?.activeTab || "pending";
|
|
437
|
-
const activeTabIndex = ["pending", "done"].indexOf(activeTab);
|
|
438
429
|
React__namespace.useEffect(() => {
|
|
439
430
|
if (location?.state?.errors) {
|
|
440
431
|
toggleNotification({
|
|
441
|
-
type: "
|
|
432
|
+
type: "danger",
|
|
442
433
|
title: formatMessage({
|
|
443
434
|
id: "content-releases.pages.Releases.notification.error.title",
|
|
444
435
|
defaultMessage: "Your request could not be processed."
|
|
@@ -451,27 +442,22 @@ const ReleasesPage = () => {
|
|
|
451
442
|
navigate("", { replace: true, state: null });
|
|
452
443
|
}
|
|
453
444
|
}, [formatMessage, location?.state?.errors, navigate, toggleNotification]);
|
|
454
|
-
React__namespace.useEffect(() => {
|
|
455
|
-
if (tabRef.current) {
|
|
456
|
-
tabRef.current._handlers.setSelectedTabIndex(activeTabIndex);
|
|
457
|
-
}
|
|
458
|
-
}, [activeTabIndex]);
|
|
459
445
|
const toggleAddReleaseModal = () => {
|
|
460
446
|
setReleaseModalShown((prev) => !prev);
|
|
461
447
|
};
|
|
462
|
-
if (
|
|
448
|
+
if (isLoadingReleases || isLoadingSettings) {
|
|
463
449
|
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
|
|
464
450
|
}
|
|
465
451
|
const totalPendingReleases = isSuccess && response.currentData?.meta?.pendingReleasesCount || 0;
|
|
466
452
|
const hasReachedMaximumPendingReleases = totalPendingReleases >= maximumReleases;
|
|
467
|
-
const handleTabChange = (
|
|
453
|
+
const handleTabChange = (tabValue) => {
|
|
468
454
|
setQuery({
|
|
469
455
|
...query,
|
|
470
456
|
page: 1,
|
|
471
457
|
pageSize: response?.currentData?.meta?.pagination?.pageSize || 16,
|
|
472
458
|
filters: {
|
|
473
459
|
releasedAt: {
|
|
474
|
-
$notNull:
|
|
460
|
+
$notNull: tabValue !== "pending"
|
|
475
461
|
}
|
|
476
462
|
}
|
|
477
463
|
});
|
|
@@ -492,21 +478,21 @@ const ReleasesPage = () => {
|
|
|
492
478
|
});
|
|
493
479
|
trackUsage("didCreateRelease");
|
|
494
480
|
navigate(response2.data.data.id.toString());
|
|
495
|
-
} else if (
|
|
481
|
+
} else if (strapiAdmin.isFetchError(response2.error)) {
|
|
496
482
|
toggleNotification({
|
|
497
|
-
type: "
|
|
483
|
+
type: "danger",
|
|
498
484
|
message: formatAPIError(response2.error)
|
|
499
485
|
});
|
|
500
486
|
} else {
|
|
501
487
|
toggleNotification({
|
|
502
|
-
type: "
|
|
488
|
+
type: "danger",
|
|
503
489
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
504
490
|
});
|
|
505
491
|
}
|
|
506
492
|
};
|
|
507
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { "aria-busy":
|
|
493
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { "aria-busy": isLoadingReleases || isLoadingSettings, children: [
|
|
508
494
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
509
|
-
|
|
495
|
+
strapiAdmin.Layouts.Header,
|
|
510
496
|
{
|
|
511
497
|
title: formatMessage({
|
|
512
498
|
id: "content-releases.pages.Releases.title",
|
|
@@ -516,7 +502,7 @@ const ReleasesPage = () => {
|
|
|
516
502
|
id: "content-releases.pages.Releases.header-subtitle",
|
|
517
503
|
defaultMessage: "Create and manage content updates"
|
|
518
504
|
}),
|
|
519
|
-
primaryAction:
|
|
505
|
+
primaryAction: canCreate ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
520
506
|
designSystem.Button,
|
|
521
507
|
{
|
|
522
508
|
startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Plus, {}),
|
|
@@ -527,15 +513,15 @@ const ReleasesPage = () => {
|
|
|
527
513
|
defaultMessage: "New release"
|
|
528
514
|
})
|
|
529
515
|
}
|
|
530
|
-
)
|
|
516
|
+
) : null
|
|
531
517
|
}
|
|
532
518
|
),
|
|
533
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
519
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
534
520
|
hasReachedMaximumPendingReleases && /* @__PURE__ */ jsxRuntime.jsx(
|
|
535
521
|
StyledAlert,
|
|
536
522
|
{
|
|
537
523
|
marginBottom: 6,
|
|
538
|
-
action: /* @__PURE__ */ jsxRuntime.jsx(
|
|
524
|
+
action: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Link, { href: "https://strapi.io/pricing-cloud", isExternal: true, children: formatMessage({
|
|
539
525
|
id: "content-releases.pages.Releases.max-limit-reached.action",
|
|
540
526
|
defaultMessage: "Explore plans"
|
|
541
527
|
}) }),
|
|
@@ -555,21 +541,17 @@ const ReleasesPage = () => {
|
|
|
555
541
|
})
|
|
556
542
|
}
|
|
557
543
|
),
|
|
558
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
559
|
-
designSystem.
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
children: [
|
|
570
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { paddingBottom: 8, children: [
|
|
571
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tabs, { children: [
|
|
572
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tab, { children: formatMessage(
|
|
544
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tabs.Root, { variant: "simple", onValueChange: handleTabChange, value: activeTab, children: [
|
|
545
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { paddingBottom: 8, children: [
|
|
546
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
547
|
+
designSystem.Tabs.List,
|
|
548
|
+
{
|
|
549
|
+
"aria-label": formatMessage({
|
|
550
|
+
id: "content-releases.pages.Releases.tab-group.label",
|
|
551
|
+
defaultMessage: "Releases list"
|
|
552
|
+
}),
|
|
553
|
+
children: [
|
|
554
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Trigger, { value: "pending", children: formatMessage(
|
|
573
555
|
{
|
|
574
556
|
id: "content-releases.pages.Releases.tab.pending",
|
|
575
557
|
defaultMessage: "Pending ({count})"
|
|
@@ -578,34 +560,32 @@ const ReleasesPage = () => {
|
|
|
578
560
|
count: totalPendingReleases
|
|
579
561
|
}
|
|
580
562
|
) }),
|
|
581
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
563
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Trigger, { value: "done", children: formatMessage({
|
|
582
564
|
id: "content-releases.pages.Releases.tab.done",
|
|
583
565
|
defaultMessage: "Done"
|
|
584
566
|
}) })
|
|
585
|
-
]
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
}
|
|
608
|
-
),
|
|
567
|
+
]
|
|
568
|
+
}
|
|
569
|
+
),
|
|
570
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Divider, {})
|
|
571
|
+
] }),
|
|
572
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Content, { value: "pending", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
573
|
+
ReleasesGrid,
|
|
574
|
+
{
|
|
575
|
+
sectionTitle: "pending",
|
|
576
|
+
releases: response?.currentData?.data,
|
|
577
|
+
isError
|
|
578
|
+
}
|
|
579
|
+
) }),
|
|
580
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Content, { value: "done", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
581
|
+
ReleasesGrid,
|
|
582
|
+
{
|
|
583
|
+
sectionTitle: "done",
|
|
584
|
+
releases: response?.currentData?.data,
|
|
585
|
+
isError
|
|
586
|
+
}
|
|
587
|
+
) })
|
|
588
|
+
] }),
|
|
609
589
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
610
590
|
strapiAdmin.Pagination.Root,
|
|
611
591
|
{
|
|
@@ -618,24 +598,28 @@ const ReleasesPage = () => {
|
|
|
618
598
|
}
|
|
619
599
|
)
|
|
620
600
|
] }) }),
|
|
621
|
-
|
|
601
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
622
602
|
ReleaseModal,
|
|
623
603
|
{
|
|
604
|
+
open: releaseModalShown,
|
|
624
605
|
handleClose: toggleAddReleaseModal,
|
|
625
606
|
handleSubmit: handleAddRelease,
|
|
626
607
|
isLoading: isSubmittingForm,
|
|
627
|
-
initialValues:
|
|
608
|
+
initialValues: {
|
|
609
|
+
...INITIAL_FORM_VALUES,
|
|
610
|
+
timezone: data?.data.defaultTimezone ? data.data.defaultTimezone.split("&")[1] : null
|
|
611
|
+
}
|
|
628
612
|
}
|
|
629
613
|
)
|
|
630
614
|
] });
|
|
631
615
|
};
|
|
632
|
-
const ReleaseInfoWrapper =
|
|
616
|
+
const ReleaseInfoWrapper = styledComponents.styled(designSystem.Flex)`
|
|
633
617
|
align-self: stretch;
|
|
634
618
|
border-bottom-right-radius: ${({ theme }) => theme.borderRadius};
|
|
635
619
|
border-bottom-left-radius: ${({ theme }) => theme.borderRadius};
|
|
636
620
|
border-top: 1px solid ${({ theme }) => theme.colors.neutral150};
|
|
637
621
|
`;
|
|
638
|
-
const StyledMenuItem =
|
|
622
|
+
const StyledMenuItem = styledComponents.styled(designSystem.MenuItem)`
|
|
639
623
|
svg path {
|
|
640
624
|
fill: ${({ theme, disabled }) => disabled && theme.colors.neutral500};
|
|
641
625
|
}
|
|
@@ -644,64 +628,113 @@ const StyledMenuItem = styled__default.default(v2.Menu.Item)`
|
|
|
644
628
|
}
|
|
645
629
|
|
|
646
630
|
&:hover {
|
|
647
|
-
background: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}100`]};
|
|
631
|
+
background: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}100`]};
|
|
648
632
|
}
|
|
649
633
|
`;
|
|
650
|
-
const PencilIcon =
|
|
651
|
-
width: ${({ theme }) => theme.spaces[
|
|
652
|
-
height: ${({ theme }) => theme.spaces[
|
|
634
|
+
const PencilIcon = styledComponents.styled(icons.Pencil)`
|
|
635
|
+
width: ${({ theme }) => theme.spaces[4]};
|
|
636
|
+
height: ${({ theme }) => theme.spaces[4]};
|
|
653
637
|
path {
|
|
654
638
|
fill: ${({ theme }) => theme.colors.neutral600};
|
|
655
639
|
}
|
|
656
640
|
`;
|
|
657
|
-
const TrashIcon =
|
|
658
|
-
width: ${({ theme }) => theme.spaces[
|
|
659
|
-
height: ${({ theme }) => theme.spaces[
|
|
641
|
+
const TrashIcon = styledComponents.styled(icons.Trash)`
|
|
642
|
+
width: ${({ theme }) => theme.spaces[4]};
|
|
643
|
+
height: ${({ theme }) => theme.spaces[4]};
|
|
660
644
|
path {
|
|
661
645
|
fill: ${({ theme }) => theme.colors.danger600};
|
|
662
646
|
}
|
|
663
647
|
`;
|
|
664
|
-
const TypographyMaxWidth =
|
|
648
|
+
const TypographyMaxWidth = styledComponents.styled(designSystem.Typography)`
|
|
665
649
|
max-width: 300px;
|
|
666
650
|
`;
|
|
667
|
-
const EntryValidationText = ({ action, schema, entry }) => {
|
|
651
|
+
const EntryValidationText = ({ action, schema, entry, status }) => {
|
|
668
652
|
const { formatMessage } = reactIntl.useIntl();
|
|
669
|
-
const { validate } = strapiAdmin.unstable_useDocument(
|
|
653
|
+
const { validate, isLoading } = strapiAdmin$1.unstable_useDocument(
|
|
670
654
|
{
|
|
671
655
|
collectionType: schema?.kind ?? "",
|
|
672
656
|
model: schema?.uid ?? ""
|
|
673
657
|
},
|
|
674
658
|
{
|
|
675
|
-
skip
|
|
659
|
+
// useDocument makes a request to get more data about the entry, but we only want to have the validation function so we skip the request
|
|
660
|
+
skip: true
|
|
676
661
|
}
|
|
677
662
|
);
|
|
678
|
-
const
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
663
|
+
const errorsToString = (errors2, prefix = "") => {
|
|
664
|
+
if (Object.keys(errors2).length === 0) {
|
|
665
|
+
return "";
|
|
666
|
+
}
|
|
667
|
+
return Object.entries(errors2).map(([key, value]) => {
|
|
668
|
+
if (value === void 0 || value === null) {
|
|
669
|
+
return "";
|
|
670
|
+
}
|
|
671
|
+
if (typeof value === "string") {
|
|
672
|
+
return formatMessage(
|
|
673
|
+
{ id: value, defaultMessage: value },
|
|
674
|
+
{ field: prefix ? `${prefix}.${key}` : key }
|
|
675
|
+
);
|
|
676
|
+
}
|
|
677
|
+
if (typeof value === "object" && value !== null && "id" in value && "defaultMessage" in value) {
|
|
678
|
+
return formatMessage(
|
|
679
|
+
// @ts-expect-error – TODO: default message will be a string
|
|
680
|
+
{ id: `${value.id}.withField`, defaultMessage: value.defaultMessage },
|
|
681
|
+
{ field: prefix ? `${prefix}.${key}` : key }
|
|
682
|
+
);
|
|
683
|
+
}
|
|
684
|
+
return errorsToString(value, key);
|
|
685
|
+
}).join(" ");
|
|
686
|
+
};
|
|
687
|
+
if (isLoading) {
|
|
688
|
+
return null;
|
|
690
689
|
}
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
690
|
+
const errors = validate(entry) ?? {};
|
|
691
|
+
if (action === "publish") {
|
|
692
|
+
if (Object.keys(errors).length > 0) {
|
|
693
|
+
const validationErrorsMessages = errorsToString(errors);
|
|
694
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
695
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.CrossCircle, { fill: "danger600" }),
|
|
696
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tooltip, { description: validationErrorsMessages, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
697
|
+
TypographyMaxWidth,
|
|
698
|
+
{
|
|
699
|
+
textColor: "danger600",
|
|
700
|
+
variant: "omega",
|
|
701
|
+
fontWeight: "semiBold",
|
|
702
|
+
ellipsis: true,
|
|
703
|
+
children: validationErrorsMessages
|
|
704
|
+
}
|
|
705
|
+
) })
|
|
706
|
+
] });
|
|
707
|
+
}
|
|
708
|
+
if (status === "draft") {
|
|
709
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
710
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
|
711
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
|
|
712
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.ready-to-publish",
|
|
713
|
+
defaultMessage: "Ready to publish"
|
|
714
|
+
}) })
|
|
715
|
+
] });
|
|
716
|
+
}
|
|
717
|
+
if (status === "modified") {
|
|
718
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
719
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.ArrowsCounterClockwise, { fill: "alternative600" }),
|
|
720
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
|
|
721
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.modified",
|
|
722
|
+
defaultMessage: "Ready to publish changes"
|
|
723
|
+
}) })
|
|
724
|
+
] });
|
|
725
|
+
}
|
|
726
|
+
if (status === "published") {
|
|
727
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
728
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
|
729
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
|
|
730
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.already-published",
|
|
731
|
+
defaultMessage: "Already published"
|
|
732
|
+
}) })
|
|
733
|
+
] });
|
|
734
|
+
}
|
|
702
735
|
}
|
|
703
736
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
704
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
737
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
|
705
738
|
!entry.publishedAt ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "success600", fontWeight: "bold", children: formatMessage({
|
|
706
739
|
id: "content-releases.pages.ReleaseDetails.entry-validation.already-unpublished",
|
|
707
740
|
defaultMessage: "Already unpublished"
|
|
@@ -721,7 +754,6 @@ const ReleaseDetailsLayout = ({
|
|
|
721
754
|
const {
|
|
722
755
|
data,
|
|
723
756
|
isLoading: isLoadingDetails,
|
|
724
|
-
isError,
|
|
725
757
|
error
|
|
726
758
|
} = index.useGetReleaseQuery(
|
|
727
759
|
{ id: releaseId },
|
|
@@ -730,13 +762,12 @@ const ReleaseDetailsLayout = ({
|
|
|
730
762
|
}
|
|
731
763
|
);
|
|
732
764
|
const [publishRelease, { isLoading: isPublishing }] = index.usePublishReleaseMutation();
|
|
733
|
-
const toggleNotification =
|
|
734
|
-
const { formatAPIError } =
|
|
735
|
-
const {
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
const
|
|
739
|
-
const { trackUsage } = helperPlugin.useTracking();
|
|
765
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
766
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
767
|
+
const { allowedActions } = strapiAdmin.useRBAC(index.PERMISSIONS);
|
|
768
|
+
const { canUpdate, canDelete, canPublish } = allowedActions;
|
|
769
|
+
const dispatch = useTypedDispatch();
|
|
770
|
+
const { trackUsage } = strapiAdmin.useTracking();
|
|
740
771
|
const release = data?.data;
|
|
741
772
|
const handlePublishRelease = (id) => async () => {
|
|
742
773
|
const response = await publishRelease({ id });
|
|
@@ -754,20 +785,25 @@ const ReleaseDetailsLayout = ({
|
|
|
754
785
|
totalPublishedEntries,
|
|
755
786
|
totalUnpublishedEntries
|
|
756
787
|
});
|
|
757
|
-
} else if (
|
|
788
|
+
} else if (strapiAdmin.isFetchError(response.error)) {
|
|
758
789
|
toggleNotification({
|
|
759
|
-
type: "
|
|
790
|
+
type: "danger",
|
|
760
791
|
message: formatAPIError(response.error)
|
|
761
792
|
});
|
|
762
793
|
} else {
|
|
763
794
|
toggleNotification({
|
|
764
|
-
type: "
|
|
795
|
+
type: "danger",
|
|
765
796
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
766
797
|
});
|
|
767
798
|
}
|
|
768
799
|
};
|
|
769
800
|
const handleRefresh = () => {
|
|
770
|
-
dispatch(
|
|
801
|
+
dispatch(
|
|
802
|
+
index.releaseApi.util.invalidateTags([
|
|
803
|
+
{ type: "ReleaseAction", id: "LIST" },
|
|
804
|
+
{ type: "Release", id: releaseId }
|
|
805
|
+
])
|
|
806
|
+
);
|
|
771
807
|
};
|
|
772
808
|
const getCreatedByUser = () => {
|
|
773
809
|
if (!release?.createdBy) {
|
|
@@ -784,7 +820,7 @@ const ReleaseDetailsLayout = ({
|
|
|
784
820
|
if (isLoadingDetails) {
|
|
785
821
|
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
|
|
786
822
|
}
|
|
787
|
-
if (
|
|
823
|
+
if (isBaseQueryError(error) && "code" in error || !release) {
|
|
788
824
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
789
825
|
reactRouterDom.Navigate,
|
|
790
826
|
{
|
|
@@ -792,6 +828,7 @@ const ReleaseDetailsLayout = ({
|
|
|
792
828
|
state: {
|
|
793
829
|
errors: [
|
|
794
830
|
{
|
|
831
|
+
// @ts-expect-error – TODO: fix this weird error flow
|
|
795
832
|
code: error?.code
|
|
796
833
|
}
|
|
797
834
|
]
|
|
@@ -801,7 +838,6 @@ const ReleaseDetailsLayout = ({
|
|
|
801
838
|
}
|
|
802
839
|
const totalEntries = release.actions.meta.count || 0;
|
|
803
840
|
const hasCreatedByUser = Boolean(getCreatedByUser());
|
|
804
|
-
const IsSchedulingEnabled = window.strapi.future.isEnabled("contentReleasesScheduling");
|
|
805
841
|
const isScheduled = release.scheduledAt && release.timezone;
|
|
806
842
|
const numberOfEntriesText = formatMessage(
|
|
807
843
|
{
|
|
@@ -832,101 +868,85 @@ const ReleaseDetailsLayout = ({
|
|
|
832
868
|
) : "";
|
|
833
869
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { "aria-busy": isLoadingDetails, children: [
|
|
834
870
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
835
|
-
|
|
871
|
+
strapiAdmin.Layouts.Header,
|
|
836
872
|
{
|
|
837
873
|
title: release.name,
|
|
838
874
|
subtitle: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, lineHeight: 6, children: [
|
|
839
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", variant: "epsilon", children: numberOfEntriesText + (
|
|
875
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", variant: "epsilon", children: numberOfEntriesText + (isScheduled ? ` - ${scheduledText}` : "") }),
|
|
840
876
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { ...getBadgeProps(release.status), children: release.status })
|
|
841
877
|
] }),
|
|
842
|
-
navigationAction: /* @__PURE__ */ jsxRuntime.jsx(
|
|
843
|
-
id: "global.back",
|
|
844
|
-
defaultMessage: "Back"
|
|
845
|
-
}) }),
|
|
878
|
+
navigationAction: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.BackButton, {}),
|
|
846
879
|
primaryAction: !release.releasedAt && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
847
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
{
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
880
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
881
|
+
SimpleMenuButton,
|
|
882
|
+
{
|
|
883
|
+
label: /* @__PURE__ */ jsxRuntime.jsx(icons.More, {}),
|
|
884
|
+
variant: "tertiary",
|
|
885
|
+
endIcon: null,
|
|
886
|
+
paddingLeft: "7px",
|
|
887
|
+
paddingRight: "7px",
|
|
888
|
+
"aria-label": formatMessage({
|
|
889
|
+
id: "content-releases.header.actions.open-release-actions",
|
|
890
|
+
defaultMessage: "Release edit and delete menu"
|
|
891
|
+
}),
|
|
892
|
+
popoverPlacement: "bottom-end",
|
|
893
|
+
children: [
|
|
894
|
+
/* @__PURE__ */ jsxRuntime.jsx(StyledMenuItem, { disabled: !canUpdate, onSelect: toggleEditReleaseModal, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 2, hasRadius: true, width: "100%", children: [
|
|
895
|
+
/* @__PURE__ */ jsxRuntime.jsx(PencilIcon, {}),
|
|
896
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { ellipsis: true, children: formatMessage({
|
|
897
|
+
id: "content-releases.header.actions.edit",
|
|
898
|
+
defaultMessage: "Edit"
|
|
899
|
+
}) })
|
|
900
|
+
] }) }),
|
|
901
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
902
|
+
StyledMenuItem,
|
|
903
|
+
{
|
|
904
|
+
disabled: !canDelete,
|
|
905
|
+
onSelect: toggleWarningSubmit,
|
|
906
|
+
$variant: "danger",
|
|
907
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 2, hasRadius: true, width: "100%", children: [
|
|
908
|
+
/* @__PURE__ */ jsxRuntime.jsx(TrashIcon, {}),
|
|
909
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { ellipsis: true, textColor: "danger600", children: formatMessage({
|
|
910
|
+
id: "content-releases.header.actions.delete",
|
|
911
|
+
defaultMessage: "Delete"
|
|
877
912
|
}) })
|
|
878
|
-
] }) }),
|
|
879
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
880
|
-
StyledMenuItem,
|
|
881
|
-
{
|
|
882
|
-
disabled: !canDelete,
|
|
883
|
-
onSelect: toggleWarningSubmit,
|
|
884
|
-
variant: "danger",
|
|
885
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 2, hasRadius: true, width: "100%", children: [
|
|
886
|
-
/* @__PURE__ */ jsxRuntime.jsx(TrashIcon, {}),
|
|
887
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { ellipsis: true, textColor: "danger600", children: formatMessage({
|
|
888
|
-
id: "content-releases.header.actions.delete",
|
|
889
|
-
defaultMessage: "Delete"
|
|
890
|
-
}) })
|
|
891
|
-
] })
|
|
892
|
-
}
|
|
893
|
-
)
|
|
894
|
-
]
|
|
895
|
-
}
|
|
896
|
-
),
|
|
897
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
898
|
-
ReleaseInfoWrapper,
|
|
899
|
-
{
|
|
900
|
-
direction: "column",
|
|
901
|
-
justifyContent: "center",
|
|
902
|
-
alignItems: "flex-start",
|
|
903
|
-
gap: 1,
|
|
904
|
-
padding: 5,
|
|
905
|
-
children: [
|
|
906
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", children: formatMessage({
|
|
907
|
-
id: "content-releases.header.actions.created",
|
|
908
|
-
defaultMessage: "Created"
|
|
909
|
-
}) }),
|
|
910
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", color: "neutral300", children: [
|
|
911
|
-
/* @__PURE__ */ jsxRuntime.jsx(RelativeTime, { timestamp: new Date(release.createdAt) }),
|
|
912
|
-
formatMessage(
|
|
913
|
-
{
|
|
914
|
-
id: "content-releases.header.actions.created.description",
|
|
915
|
-
defaultMessage: "{hasCreatedByUser, select, true { by {createdBy}} other { by deleted user}}"
|
|
916
|
-
},
|
|
917
|
-
{ createdBy: getCreatedByUser(), hasCreatedByUser }
|
|
918
|
-
)
|
|
919
913
|
] })
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
914
|
+
}
|
|
915
|
+
),
|
|
916
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
917
|
+
ReleaseInfoWrapper,
|
|
918
|
+
{
|
|
919
|
+
direction: "column",
|
|
920
|
+
justifyContent: "center",
|
|
921
|
+
alignItems: "flex-start",
|
|
922
|
+
gap: 1,
|
|
923
|
+
padding: 4,
|
|
924
|
+
children: [
|
|
925
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", children: formatMessage({
|
|
926
|
+
id: "content-releases.header.actions.created",
|
|
927
|
+
defaultMessage: "Created"
|
|
928
|
+
}) }),
|
|
929
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", color: "neutral300", children: [
|
|
930
|
+
/* @__PURE__ */ jsxRuntime.jsx(RelativeTime$1, { timestamp: new Date(release.createdAt) }),
|
|
931
|
+
formatMessage(
|
|
932
|
+
{
|
|
933
|
+
id: "content-releases.header.actions.created.description",
|
|
934
|
+
defaultMessage: "{hasCreatedByUser, select, true { by {createdBy}} other { by deleted user}}"
|
|
935
|
+
},
|
|
936
|
+
{ createdBy: getCreatedByUser(), hasCreatedByUser }
|
|
937
|
+
)
|
|
938
|
+
] })
|
|
939
|
+
]
|
|
940
|
+
}
|
|
941
|
+
)
|
|
942
|
+
]
|
|
943
|
+
}
|
|
944
|
+
),
|
|
925
945
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { size: "S", variant: "tertiary", onClick: handleRefresh, children: formatMessage({
|
|
926
946
|
id: "content-releases.header.actions.refresh",
|
|
927
947
|
defaultMessage: "Refresh"
|
|
928
948
|
}) }),
|
|
929
|
-
|
|
949
|
+
canPublish ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
930
950
|
designSystem.Button,
|
|
931
951
|
{
|
|
932
952
|
size: "S",
|
|
@@ -939,14 +959,20 @@ const ReleaseDetailsLayout = ({
|
|
|
939
959
|
defaultMessage: "Publish"
|
|
940
960
|
})
|
|
941
961
|
}
|
|
942
|
-
)
|
|
962
|
+
) : null
|
|
943
963
|
] })
|
|
944
964
|
}
|
|
945
965
|
),
|
|
946
966
|
children
|
|
947
967
|
] });
|
|
948
968
|
};
|
|
969
|
+
const SimpleMenuButton = styledComponents.styled(designSystem.SimpleMenu)`
|
|
970
|
+
& > span {
|
|
971
|
+
display: flex;
|
|
972
|
+
}
|
|
973
|
+
`;
|
|
949
974
|
const GROUP_BY_OPTIONS = ["contentType", "locale", "action"];
|
|
975
|
+
const GROUP_BY_OPTIONS_NO_LOCALE = ["contentType", "action"];
|
|
950
976
|
const getGroupByOptionLabel = (value) => {
|
|
951
977
|
if (value === "locale") {
|
|
952
978
|
return {
|
|
@@ -967,18 +993,30 @@ const getGroupByOptionLabel = (value) => {
|
|
|
967
993
|
};
|
|
968
994
|
const ReleaseDetailsBody = ({ releaseId }) => {
|
|
969
995
|
const { formatMessage } = reactIntl.useIntl();
|
|
970
|
-
const [{ query }, setQuery] =
|
|
971
|
-
const toggleNotification =
|
|
972
|
-
const { formatAPIError } =
|
|
996
|
+
const [{ query }, setQuery] = strapiAdmin.useQueryParams();
|
|
997
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
998
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
973
999
|
const {
|
|
974
1000
|
data: releaseData,
|
|
975
1001
|
isLoading: isReleaseLoading,
|
|
976
|
-
isError: isReleaseError,
|
|
977
1002
|
error: releaseError
|
|
978
1003
|
} = index.useGetReleaseQuery({ id: releaseId });
|
|
979
1004
|
const {
|
|
980
1005
|
allowedActions: { canUpdate }
|
|
981
|
-
} =
|
|
1006
|
+
} = strapiAdmin.useRBAC(index.PERMISSIONS);
|
|
1007
|
+
const runHookWaterfall = strapiAdmin.useStrapiApp("ReleaseDetailsPage", (state) => state.runHookWaterfall);
|
|
1008
|
+
const { displayedHeaders, hasI18nEnabled } = runHookWaterfall("ContentReleases/pages/ReleaseDetails/add-locale-in-releases", {
|
|
1009
|
+
displayedHeaders: [
|
|
1010
|
+
{
|
|
1011
|
+
label: {
|
|
1012
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.name",
|
|
1013
|
+
defaultMessage: "name"
|
|
1014
|
+
},
|
|
1015
|
+
name: "name"
|
|
1016
|
+
}
|
|
1017
|
+
],
|
|
1018
|
+
hasI18nEnabled: false
|
|
1019
|
+
});
|
|
982
1020
|
const release = releaseData?.data;
|
|
983
1021
|
const selectedGroupBy = query?.groupBy || "contentType";
|
|
984
1022
|
const {
|
|
@@ -1007,14 +1045,14 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1007
1045
|
// We are passing the action path to found the position in the cache of the action for optimistic updates
|
|
1008
1046
|
});
|
|
1009
1047
|
if ("error" in response) {
|
|
1010
|
-
if (
|
|
1048
|
+
if (strapiAdmin.isFetchError(response.error)) {
|
|
1011
1049
|
toggleNotification({
|
|
1012
|
-
type: "
|
|
1050
|
+
type: "danger",
|
|
1013
1051
|
message: formatAPIError(response.error)
|
|
1014
1052
|
});
|
|
1015
1053
|
} else {
|
|
1016
1054
|
toggleNotification({
|
|
1017
|
-
type: "
|
|
1055
|
+
type: "danger",
|
|
1018
1056
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
1019
1057
|
});
|
|
1020
1058
|
}
|
|
@@ -1027,14 +1065,14 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1027
1065
|
const releaseMeta = data?.meta;
|
|
1028
1066
|
const contentTypes = releaseMeta?.contentTypes || {};
|
|
1029
1067
|
const components = releaseMeta?.components || {};
|
|
1030
|
-
if (
|
|
1068
|
+
if (isBaseQueryError(releaseError) || !release) {
|
|
1031
1069
|
const errorsArray = [];
|
|
1032
|
-
if (releaseError) {
|
|
1070
|
+
if (releaseError && "code" in releaseError) {
|
|
1033
1071
|
errorsArray.push({
|
|
1034
1072
|
code: releaseError.code
|
|
1035
1073
|
});
|
|
1036
1074
|
}
|
|
1037
|
-
if (releaseActionsError) {
|
|
1075
|
+
if (releaseActionsError && "code" in releaseActionsError) {
|
|
1038
1076
|
errorsArray.push({
|
|
1039
1077
|
code: releaseActionsError.code
|
|
1040
1078
|
});
|
|
@@ -1053,13 +1091,13 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1053
1091
|
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Error, {});
|
|
1054
1092
|
}
|
|
1055
1093
|
if (Object.keys(releaseActions).length === 0) {
|
|
1056
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1094
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1057
1095
|
designSystem.EmptyStateLayout,
|
|
1058
1096
|
{
|
|
1059
1097
|
action: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1060
|
-
|
|
1098
|
+
designSystem.LinkButton,
|
|
1061
1099
|
{
|
|
1062
|
-
|
|
1100
|
+
tag: reactRouterDom.Link,
|
|
1063
1101
|
to: {
|
|
1064
1102
|
pathname: "/content-manager"
|
|
1065
1103
|
},
|
|
@@ -1071,7 +1109,7 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1071
1109
|
})
|
|
1072
1110
|
}
|
|
1073
1111
|
),
|
|
1074
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1112
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(symbols.EmptyDocuments, { width: "16rem" }),
|
|
1075
1113
|
content: formatMessage({
|
|
1076
1114
|
id: "content-releases.pages.Details.tab.emptyEntries",
|
|
1077
1115
|
defaultMessage: "This release is empty. Open the Content Manager, select an entry and add it to the release."
|
|
@@ -1079,14 +1117,43 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1079
1117
|
}
|
|
1080
1118
|
) });
|
|
1081
1119
|
}
|
|
1082
|
-
|
|
1120
|
+
const groupByLabel = formatMessage({
|
|
1121
|
+
id: "content-releases.pages.ReleaseDetails.groupBy.aria-label",
|
|
1122
|
+
defaultMessage: "Group by"
|
|
1123
|
+
});
|
|
1124
|
+
const headers = [
|
|
1125
|
+
...displayedHeaders,
|
|
1126
|
+
{
|
|
1127
|
+
label: {
|
|
1128
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.content-type",
|
|
1129
|
+
defaultMessage: "content-type"
|
|
1130
|
+
},
|
|
1131
|
+
name: "content-type"
|
|
1132
|
+
},
|
|
1133
|
+
{
|
|
1134
|
+
label: {
|
|
1135
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.action",
|
|
1136
|
+
defaultMessage: "action"
|
|
1137
|
+
},
|
|
1138
|
+
name: "action"
|
|
1139
|
+
},
|
|
1140
|
+
...!release.releasedAt ? [
|
|
1141
|
+
{
|
|
1142
|
+
label: {
|
|
1143
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.status",
|
|
1144
|
+
defaultMessage: "status"
|
|
1145
|
+
},
|
|
1146
|
+
name: "status"
|
|
1147
|
+
}
|
|
1148
|
+
] : []
|
|
1149
|
+
];
|
|
1150
|
+
const options = hasI18nEnabled ? GROUP_BY_OPTIONS : GROUP_BY_OPTIONS_NO_LOCALE;
|
|
1151
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 8, direction: "column", alignItems: "stretch", children: [
|
|
1083
1152
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1084
1153
|
designSystem.SingleSelect,
|
|
1085
1154
|
{
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
defaultMessage: "Group by"
|
|
1089
|
-
}),
|
|
1155
|
+
placeholder: groupByLabel,
|
|
1156
|
+
"aria-label": groupByLabel,
|
|
1090
1157
|
customizeContent: (value) => formatMessage(
|
|
1091
1158
|
{
|
|
1092
1159
|
id: `content-releases.pages.ReleaseDetails.groupBy.label`,
|
|
@@ -1098,84 +1165,27 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1098
1165
|
),
|
|
1099
1166
|
value: formatMessage(getGroupByOptionLabel(selectedGroupBy)),
|
|
1100
1167
|
onChange: (value) => setQuery({ groupBy: value }),
|
|
1101
|
-
children:
|
|
1168
|
+
children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: option, children: formatMessage(getGroupByOptionLabel(option)) }, option))
|
|
1102
1169
|
}
|
|
1103
1170
|
) }),
|
|
1104
1171
|
Object.keys(releaseActions).map((key) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, direction: "column", alignItems: "stretch", children: [
|
|
1105
1172
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { role: "separator", "aria-label": key, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { children: key }) }),
|
|
1106
1173
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1107
|
-
|
|
1174
|
+
strapiAdmin.Table.Root,
|
|
1108
1175
|
{
|
|
1109
1176
|
rows: releaseActions[key].map((item) => ({
|
|
1110
1177
|
...item,
|
|
1111
1178
|
id: Number(item.entry.id)
|
|
1112
1179
|
})),
|
|
1113
|
-
|
|
1114
|
-
isLoading,
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
{
|
|
1121
|
-
attribute: { type: "string" },
|
|
1122
|
-
label: formatMessage({
|
|
1123
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.name",
|
|
1124
|
-
defaultMessage: "name"
|
|
1125
|
-
}),
|
|
1126
|
-
name: "name"
|
|
1127
|
-
}
|
|
1128
|
-
),
|
|
1129
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1130
|
-
helperPlugin.Table.HeaderCell,
|
|
1131
|
-
{
|
|
1132
|
-
attribute: { type: "string" },
|
|
1133
|
-
label: formatMessage({
|
|
1134
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.locale",
|
|
1135
|
-
defaultMessage: "locale"
|
|
1136
|
-
}),
|
|
1137
|
-
name: "locale"
|
|
1138
|
-
}
|
|
1139
|
-
),
|
|
1140
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1141
|
-
helperPlugin.Table.HeaderCell,
|
|
1142
|
-
{
|
|
1143
|
-
attribute: { type: "string" },
|
|
1144
|
-
label: formatMessage({
|
|
1145
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.content-type",
|
|
1146
|
-
defaultMessage: "content-type"
|
|
1147
|
-
}),
|
|
1148
|
-
name: "content-type"
|
|
1149
|
-
}
|
|
1150
|
-
),
|
|
1151
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1152
|
-
helperPlugin.Table.HeaderCell,
|
|
1153
|
-
{
|
|
1154
|
-
attribute: { type: "string" },
|
|
1155
|
-
label: formatMessage({
|
|
1156
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.action",
|
|
1157
|
-
defaultMessage: "action"
|
|
1158
|
-
}),
|
|
1159
|
-
name: "action"
|
|
1160
|
-
}
|
|
1161
|
-
),
|
|
1162
|
-
!release.releasedAt && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1163
|
-
helperPlugin.Table.HeaderCell,
|
|
1164
|
-
{
|
|
1165
|
-
attribute: { type: "string" },
|
|
1166
|
-
label: formatMessage({
|
|
1167
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.status",
|
|
1168
|
-
defaultMessage: "status"
|
|
1169
|
-
}),
|
|
1170
|
-
name: "status"
|
|
1171
|
-
}
|
|
1172
|
-
)
|
|
1173
|
-
] }),
|
|
1174
|
-
/* @__PURE__ */ jsxRuntime.jsx(helperPlugin.Table.LoadingBody, {}),
|
|
1175
|
-
/* @__PURE__ */ jsxRuntime.jsx(helperPlugin.Table.Body, { children: releaseActions[key].map(
|
|
1176
|
-
({ id, contentType, locale, type, entry }, actionIndex) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
1180
|
+
headers,
|
|
1181
|
+
isLoading: isLoading || isFetching,
|
|
1182
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(strapiAdmin.Table.Content, { children: [
|
|
1183
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Head, { children: headers.map(({ label, name }) => /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.HeaderCell, { label: formatMessage(label), name }, name)) }),
|
|
1184
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Loading, {}),
|
|
1185
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Body, { children: releaseActions[key].map(
|
|
1186
|
+
({ id, contentType, locale, type, entry, status }, actionIndex) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
1177
1187
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "25%", maxWidth: "200px", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { ellipsis: true, children: `${contentType.mainFieldValue || entry.id}` }) }),
|
|
1178
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "10%", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: `${locale?.name ? locale.name : "-"}` }) }),
|
|
1188
|
+
hasI18nEnabled && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "10%", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: `${locale?.name ? locale.name : "-"}` }) }),
|
|
1179
1189
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "10%", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: contentType.displayName || "" }) }),
|
|
1180
1190
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "20%", children: release.releasedAt ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage(
|
|
1181
1191
|
{
|
|
@@ -1202,7 +1212,8 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1202
1212
|
action: type,
|
|
1203
1213
|
schema: contentTypes?.[contentType.uid],
|
|
1204
1214
|
components,
|
|
1205
|
-
entry
|
|
1215
|
+
entry,
|
|
1216
|
+
status
|
|
1206
1217
|
}
|
|
1207
1218
|
) }),
|
|
1208
1219
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsxs(index.ReleaseActionMenu.Root, { children: [
|
|
@@ -1210,7 +1221,7 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1210
1221
|
index.ReleaseActionMenu.ReleaseActionEntryLinkItem,
|
|
1211
1222
|
{
|
|
1212
1223
|
contentTypeUid: contentType.uid,
|
|
1213
|
-
|
|
1224
|
+
documentId: entry.documentId,
|
|
1214
1225
|
locale: locale?.code
|
|
1215
1226
|
}
|
|
1216
1227
|
),
|
|
@@ -1245,8 +1256,8 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1245
1256
|
const ReleaseDetailsPage = () => {
|
|
1246
1257
|
const { formatMessage } = reactIntl.useIntl();
|
|
1247
1258
|
const { releaseId } = reactRouterDom.useParams();
|
|
1248
|
-
const toggleNotification =
|
|
1249
|
-
const { formatAPIError } =
|
|
1259
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
1260
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
1250
1261
|
const navigate = reactRouterDom.useNavigate();
|
|
1251
1262
|
const [releaseModalShown, setReleaseModalShown] = React__namespace.useState(false);
|
|
1252
1263
|
const [showWarningSubmit, setWarningSubmit] = React__namespace.useState(false);
|
|
@@ -1260,13 +1271,24 @@ const ReleaseDetailsPage = () => {
|
|
|
1260
1271
|
skip: !releaseId
|
|
1261
1272
|
}
|
|
1262
1273
|
);
|
|
1274
|
+
const { data: dataTimezone, isLoading: isLoadingTimezone } = index.useGetReleaseSettingsQuery();
|
|
1263
1275
|
const [updateRelease, { isLoading: isSubmittingForm }] = index.useUpdateReleaseMutation();
|
|
1264
|
-
const [deleteRelease
|
|
1276
|
+
const [deleteRelease] = index.useDeleteReleaseMutation();
|
|
1265
1277
|
const toggleEditReleaseModal = () => {
|
|
1266
1278
|
setReleaseModalShown((prev) => !prev);
|
|
1267
1279
|
};
|
|
1280
|
+
const getTimezoneValue = () => {
|
|
1281
|
+
if (releaseData?.timezone) {
|
|
1282
|
+
return releaseData.timezone;
|
|
1283
|
+
} else {
|
|
1284
|
+
if (dataTimezone?.data.defaultTimezone) {
|
|
1285
|
+
return dataTimezone.data.defaultTimezone;
|
|
1286
|
+
}
|
|
1287
|
+
return null;
|
|
1288
|
+
}
|
|
1289
|
+
};
|
|
1268
1290
|
const toggleWarningSubmit = () => setWarningSubmit((prevState) => !prevState);
|
|
1269
|
-
if (isLoadingDetails) {
|
|
1291
|
+
if (isLoadingDetails || isLoadingTimezone) {
|
|
1270
1292
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1271
1293
|
ReleaseDetailsLayout,
|
|
1272
1294
|
{
|
|
@@ -1281,9 +1303,9 @@ const ReleaseDetailsPage = () => {
|
|
|
1281
1303
|
}
|
|
1282
1304
|
const releaseData = isSuccessDetails && data?.data || null;
|
|
1283
1305
|
const title = releaseData?.name || "";
|
|
1284
|
-
const timezone =
|
|
1306
|
+
const timezone = getTimezoneValue();
|
|
1285
1307
|
const scheduledAt = releaseData?.scheduledAt && timezone ? dateFnsTz.utcToZonedTime(releaseData.scheduledAt, timezone) : null;
|
|
1286
|
-
const date = scheduledAt ?
|
|
1308
|
+
const date = scheduledAt ? format__default.default(scheduledAt, "yyyy-MM-dd") : void 0;
|
|
1287
1309
|
const time = scheduledAt ? format__default.default(scheduledAt, "HH:mm") : "";
|
|
1288
1310
|
const handleEditRelease = async (values) => {
|
|
1289
1311
|
const response = await updateRelease({
|
|
@@ -1300,18 +1322,18 @@ const ReleaseDetailsPage = () => {
|
|
|
1300
1322
|
defaultMessage: "Release updated."
|
|
1301
1323
|
})
|
|
1302
1324
|
});
|
|
1303
|
-
|
|
1325
|
+
toggleEditReleaseModal();
|
|
1326
|
+
} else if (strapiAdmin.isFetchError(response.error)) {
|
|
1304
1327
|
toggleNotification({
|
|
1305
|
-
type: "
|
|
1328
|
+
type: "danger",
|
|
1306
1329
|
message: formatAPIError(response.error)
|
|
1307
1330
|
});
|
|
1308
1331
|
} else {
|
|
1309
1332
|
toggleNotification({
|
|
1310
|
-
type: "
|
|
1333
|
+
type: "danger",
|
|
1311
1334
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
1312
1335
|
});
|
|
1313
1336
|
}
|
|
1314
|
-
toggleEditReleaseModal();
|
|
1315
1337
|
};
|
|
1316
1338
|
const handleDeleteRelease = async () => {
|
|
1317
1339
|
const response = await deleteRelease({
|
|
@@ -1319,14 +1341,14 @@ const ReleaseDetailsPage = () => {
|
|
|
1319
1341
|
});
|
|
1320
1342
|
if ("data" in response) {
|
|
1321
1343
|
navigate("..");
|
|
1322
|
-
} else if (
|
|
1344
|
+
} else if (strapiAdmin.isFetchError(response.error)) {
|
|
1323
1345
|
toggleNotification({
|
|
1324
|
-
type: "
|
|
1346
|
+
type: "danger",
|
|
1325
1347
|
message: formatAPIError(response.error)
|
|
1326
1348
|
});
|
|
1327
1349
|
} else {
|
|
1328
1350
|
toggleNotification({
|
|
1329
|
-
type: "
|
|
1351
|
+
type: "danger",
|
|
1330
1352
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
1331
1353
|
});
|
|
1332
1354
|
}
|
|
@@ -1338,9 +1360,10 @@ const ReleaseDetailsPage = () => {
|
|
|
1338
1360
|
toggleWarningSubmit,
|
|
1339
1361
|
children: [
|
|
1340
1362
|
/* @__PURE__ */ jsxRuntime.jsx(ReleaseDetailsBody, { releaseId }),
|
|
1341
|
-
|
|
1363
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1342
1364
|
ReleaseModal,
|
|
1343
1365
|
{
|
|
1366
|
+
open: releaseModalShown,
|
|
1344
1367
|
handleClose: toggleEditReleaseModal,
|
|
1345
1368
|
handleSubmit: handleEditRelease,
|
|
1346
1369
|
isLoading: isLoadingDetails || isSubmittingForm,
|
|
@@ -1354,19 +1377,10 @@ const ReleaseDetailsPage = () => {
|
|
|
1354
1377
|
}
|
|
1355
1378
|
}
|
|
1356
1379
|
),
|
|
1357
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
id: "content-releases.dialog.confirmation-message",
|
|
1362
|
-
defaultMessage: "Are you sure you want to delete this release?"
|
|
1363
|
-
},
|
|
1364
|
-
isOpen: showWarningSubmit,
|
|
1365
|
-
isConfirmButtonLoading: isDeletingRelease,
|
|
1366
|
-
onToggleDialog: toggleWarningSubmit,
|
|
1367
|
-
onConfirm: handleDeleteRelease
|
|
1368
|
-
}
|
|
1369
|
-
)
|
|
1380
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Root, { open: showWarningSubmit, onOpenChange: toggleWarningSubmit, children: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.ConfirmDialog, { onConfirm: handleDeleteRelease, children: formatMessage({
|
|
1381
|
+
id: "content-releases.dialog.confirmation-message",
|
|
1382
|
+
defaultMessage: "Are you sure you want to delete this release?"
|
|
1383
|
+
}) }) })
|
|
1370
1384
|
]
|
|
1371
1385
|
}
|
|
1372
1386
|
);
|
|
@@ -1378,4 +1392,4 @@ const App = () => {
|
|
|
1378
1392
|
] }) });
|
|
1379
1393
|
};
|
|
1380
1394
|
exports.App = App;
|
|
1381
|
-
//# sourceMappingURL=App-
|
|
1395
|
+
//# sourceMappingURL=App-BKB1esYS.js.map
|