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