@strapi/content-releases 0.0.0-experimental.d9f9f725e07a329ca272ecedef7bd85fa74dd661 → 0.0.0-experimental.da85533897155e719d784f0271223c866d2f69ab
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{App-jrh58sXY.mjs → App-B4mkcLmw.mjs} +580 -554
- package/dist/_chunks/App-B4mkcLmw.mjs.map +1 -0
- package/dist/_chunks/{App-dLXY5ei3.js → App-DpoC8s97.js} +599 -575
- package/dist/_chunks/App-DpoC8s97.js.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-bpIYXOfu.js → PurchaseContentReleases-Be3acS2L.js} +7 -6
- package/dist/_chunks/PurchaseContentReleases-Be3acS2L.js.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-3tRbmbY3.mjs → PurchaseContentReleases-_MxP6-Dt.mjs} +8 -7
- package/dist/_chunks/PurchaseContentReleases-_MxP6-Dt.mjs.map +1 -0
- package/dist/_chunks/ReleasesSettingsPage-B89WWWJf.js +178 -0
- package/dist/_chunks/ReleasesSettingsPage-B89WWWJf.js.map +1 -0
- package/dist/_chunks/ReleasesSettingsPage-DfL6yxLG.mjs +178 -0
- package/dist/_chunks/ReleasesSettingsPage-DfL6yxLG.mjs.map +1 -0
- package/dist/_chunks/{en-HrREghh3.js → en-CmYoEnA7.js} +9 -2
- package/dist/_chunks/en-CmYoEnA7.js.map +1 -0
- package/dist/_chunks/{en-ltT1TlKQ.mjs → en-D0yVZFqf.mjs} +9 -2
- package/dist/_chunks/en-D0yVZFqf.mjs.map +1 -0
- package/dist/_chunks/index-B3cqcIza.mjs +1342 -0
- package/dist/_chunks/index-B3cqcIza.mjs.map +1 -0
- package/dist/_chunks/index-sGcuP2hw.js +1361 -0
- package/dist/_chunks/index-sGcuP2hw.js.map +1 -0
- package/dist/_chunks/schemas-63pFihNF.mjs +44 -0
- package/dist/_chunks/schemas-63pFihNF.mjs.map +1 -0
- package/dist/_chunks/schemas-z5zp-_Gd.js +62 -0
- package/dist/_chunks/schemas-z5zp-_Gd.js.map +1 -0
- package/dist/admin/index.js +1 -15
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +2 -16
- package/dist/admin/index.mjs.map +1 -1
- package/dist/admin/src/components/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 +807 -637
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +808 -637
- 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 +2113 -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 +1826 -0
- package/dist/server/src/services/index.d.ts.map +1 -0
- package/dist/server/src/services/release-action.d.ts +36 -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 +30 -36
- package/dist/_chunks/App-dLXY5ei3.js.map +0 -1
- package/dist/_chunks/App-jrh58sXY.mjs.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-3tRbmbY3.mjs.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-bpIYXOfu.js.map +0 -1
- package/dist/_chunks/en-HrREghh3.js.map +0 -1
- package/dist/_chunks/en-ltT1TlKQ.mjs.map +0 -1
- package/dist/_chunks/index-CVO0Rqdm.js +0 -1336
- package/dist/_chunks/index-CVO0Rqdm.js.map +0 -1
- package/dist/_chunks/index-PiOGBETy.mjs +0 -1315
- package/dist/_chunks/index-PiOGBETy.mjs.map +0 -1
|
@@ -1,25 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
-
const
|
|
4
|
+
const strapiAdmin = require("@strapi/admin/strapi-admin");
|
|
5
5
|
const reactRouterDom = require("react-router-dom");
|
|
6
|
-
const index = require("./index-
|
|
6
|
+
const index = require("./index-sGcuP2hw.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-z5zp-_Gd.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,7 +79,7 @@ const ReleaseModal = ({
|
|
|
72
79
|
const { formatMessage } = reactIntl.useIntl();
|
|
73
80
|
const { pathname } = reactRouterDom.useLocation();
|
|
74
81
|
const isCreatingRelease = pathname === `/plugins/${index.pluginId}`;
|
|
75
|
-
const { timezoneList, systemTimezone = { value: "UTC+00:00-Africa/Abidjan " } } = getTimezones(
|
|
82
|
+
const { timezoneList, systemTimezone = { value: "UTC+00:00-Africa/Abidjan " } } = index.getTimezones(
|
|
76
83
|
initialValues.scheduledAt ? new Date(initialValues.scheduledAt) : /* @__PURE__ */ new Date()
|
|
77
84
|
);
|
|
78
85
|
const getScheduledTimestamp = (values) => {
|
|
@@ -88,8 +95,8 @@ const ReleaseModal = ({
|
|
|
88
95
|
);
|
|
89
96
|
return currentTimezone?.value || systemTimezone.value;
|
|
90
97
|
};
|
|
91
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
92
|
-
/* @__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(
|
|
93
100
|
{
|
|
94
101
|
id: "content-releases.modal.title",
|
|
95
102
|
defaultMessage: "{isCreatingRelease, select, true {New release} other {Edit release}}"
|
|
@@ -110,135 +117,145 @@ const ReleaseModal = ({
|
|
|
110
117
|
...initialValues,
|
|
111
118
|
timezone: initialValues.timezone ? getTimezoneWithOffset() : systemTimezone.value
|
|
112
119
|
},
|
|
113
|
-
validationSchema: RELEASE_SCHEMA,
|
|
120
|
+
validationSchema: schemas.RELEASE_SCHEMA,
|
|
114
121
|
validateOnChange: false,
|
|
115
|
-
children: ({ values, errors, handleChange, setFieldValue }) =>
|
|
116
|
-
|
|
117
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
defaultMessage:
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
setFieldValue("
|
|
141
|
-
|
|
142
|
-
} else {
|
|
143
|
-
setFieldValue("date", initialValues.date);
|
|
144
|
-
setFieldValue("time", initialValues.time);
|
|
145
|
-
setFieldValue("timezone", initialValues.timezone ?? systemTimezone?.value);
|
|
146
|
-
}
|
|
147
|
-
},
|
|
148
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
149
|
-
designSystem.Typography,
|
|
150
|
-
{
|
|
151
|
-
textColor: values.isScheduled ? "primary600" : "neutral800",
|
|
152
|
-
fontWeight: values.isScheduled ? "semiBold" : "regular",
|
|
153
|
-
children: formatMessage({
|
|
154
|
-
id: "modal.form.input.label.schedule-release",
|
|
155
|
-
defaultMessage: "Schedule release"
|
|
156
|
-
})
|
|
157
|
-
}
|
|
158
|
-
)
|
|
159
|
-
}
|
|
160
|
-
) }),
|
|
161
|
-
values.isScheduled && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
162
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, alignItems: "start", children: [
|
|
163
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
164
|
-
designSystem.DatePicker,
|
|
165
|
-
{
|
|
166
|
-
label: formatMessage({
|
|
167
|
-
id: "content-releases.modal.form.input.label.date",
|
|
168
|
-
defaultMessage: "Date"
|
|
169
|
-
}),
|
|
170
|
-
name: "date",
|
|
171
|
-
error: errors.date,
|
|
172
|
-
onChange: (date) => {
|
|
173
|
-
const isoFormatDate = date ? dateFns.formatISO(date, { representation: "date" }) : null;
|
|
174
|
-
setFieldValue("date", isoFormatDate);
|
|
175
|
-
},
|
|
176
|
-
clearLabel: formatMessage({
|
|
177
|
-
id: "content-releases.modal.form.input.clearLabel",
|
|
178
|
-
defaultMessage: "Clear"
|
|
179
|
-
}),
|
|
180
|
-
onClear: () => {
|
|
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
|
+
),
|
|
141
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "max-content", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
142
|
+
designSystem.Checkbox,
|
|
143
|
+
{
|
|
144
|
+
name: "isScheduled",
|
|
145
|
+
checked: values.isScheduled,
|
|
146
|
+
onCheckedChange: (checked) => {
|
|
147
|
+
setFieldValue("isScheduled", checked);
|
|
148
|
+
if (!checked) {
|
|
181
149
|
setFieldValue("date", null);
|
|
182
|
-
},
|
|
183
|
-
selectedDate: values.date || void 0,
|
|
184
|
-
required: true,
|
|
185
|
-
minDate: dateFnsTz.utcToZonedTime(/* @__PURE__ */ new Date(), values.timezone.split("&")[1])
|
|
186
|
-
}
|
|
187
|
-
) }),
|
|
188
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
189
|
-
designSystem.TimePicker,
|
|
190
|
-
{
|
|
191
|
-
label: formatMessage({
|
|
192
|
-
id: "content-releases.modal.form.input.label.time",
|
|
193
|
-
defaultMessage: "Time"
|
|
194
|
-
}),
|
|
195
|
-
name: "time",
|
|
196
|
-
error: errors.time,
|
|
197
|
-
onChange: (time) => {
|
|
198
|
-
setFieldValue("time", time);
|
|
199
|
-
},
|
|
200
|
-
clearLabel: formatMessage({
|
|
201
|
-
id: "content-releases.modal.form.input.clearLabel",
|
|
202
|
-
defaultMessage: "Clear"
|
|
203
|
-
}),
|
|
204
|
-
onClear: () => {
|
|
205
150
|
setFieldValue("time", "");
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
151
|
+
setFieldValue("timezone", null);
|
|
152
|
+
} else {
|
|
153
|
+
setFieldValue("date", initialValues.date);
|
|
154
|
+
setFieldValue("time", initialValues.time);
|
|
155
|
+
setFieldValue(
|
|
156
|
+
"timezone",
|
|
157
|
+
initialValues.timezone ?? systemTimezone?.value
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
162
|
+
designSystem.Typography,
|
|
163
|
+
{
|
|
164
|
+
textColor: values.isScheduled ? "primary600" : "neutral800",
|
|
165
|
+
fontWeight: values.isScheduled ? "semiBold" : "regular",
|
|
166
|
+
children: formatMessage({
|
|
167
|
+
id: "modal.form.input.label.schedule-release",
|
|
168
|
+
defaultMessage: "Schedule release"
|
|
169
|
+
})
|
|
170
|
+
}
|
|
171
|
+
)
|
|
172
|
+
}
|
|
173
|
+
) }),
|
|
174
|
+
values.isScheduled && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
175
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, alignItems: "start", children: [
|
|
176
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
177
|
+
designSystem.Field.Root,
|
|
178
|
+
{
|
|
179
|
+
name: "date",
|
|
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
|
+
]
|
|
207
|
+
}
|
|
208
|
+
) }),
|
|
209
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
210
|
+
designSystem.Field.Root,
|
|
211
|
+
{
|
|
212
|
+
name: "time",
|
|
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
|
+
]
|
|
238
|
+
}
|
|
239
|
+
) })
|
|
240
|
+
] }),
|
|
241
|
+
/* @__PURE__ */ jsxRuntime.jsx(TimezoneComponent, { timezoneOptions: timezoneList })
|
|
242
|
+
] })
|
|
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(
|
|
220
247
|
{
|
|
221
248
|
id: "content-releases.modal.form.button.submit",
|
|
222
249
|
defaultMessage: "{isCreatingRelease, select, true {Continue} other {Save}}"
|
|
223
250
|
},
|
|
224
251
|
{ isCreatingRelease }
|
|
225
252
|
) })
|
|
226
|
-
}
|
|
227
|
-
)
|
|
228
|
-
|
|
253
|
+
] })
|
|
254
|
+
] });
|
|
255
|
+
}
|
|
229
256
|
}
|
|
230
257
|
)
|
|
231
|
-
] });
|
|
232
|
-
};
|
|
233
|
-
const getTimezones = (selectedDate) => {
|
|
234
|
-
const timezoneList = Intl.supportedValuesOf("timeZone").map((timezone) => {
|
|
235
|
-
const utcOffset = index.getTimezoneOffset(timezone, selectedDate);
|
|
236
|
-
return { offset: utcOffset, value: `${utcOffset}&${timezone}` };
|
|
237
|
-
});
|
|
238
|
-
const systemTimezone = timezoneList.find(
|
|
239
|
-
(timezone) => timezone.value.split("&")[1] === Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
240
|
-
);
|
|
241
|
-
return { timezoneList, systemTimezone };
|
|
258
|
+
] }) });
|
|
242
259
|
};
|
|
243
260
|
const TimezoneComponent = ({ timezoneOptions }) => {
|
|
244
261
|
const { values, errors, setFieldValue } = formik.useFormikContext();
|
|
@@ -246,7 +263,7 @@ const TimezoneComponent = ({ timezoneOptions }) => {
|
|
|
246
263
|
const [timezoneList, setTimezoneList] = React__namespace.useState(timezoneOptions);
|
|
247
264
|
React__namespace.useEffect(() => {
|
|
248
265
|
if (values.date) {
|
|
249
|
-
const { timezoneList: timezoneList2 } = getTimezones(new Date(values.date));
|
|
266
|
+
const { timezoneList: timezoneList2 } = index.getTimezones(new Date(values.date));
|
|
250
267
|
setTimezoneList(timezoneList2);
|
|
251
268
|
const updatedTimezone = values.timezone && timezoneList2.find((tz) => tz.value.split("&")[1] === values.timezone.split("&")[1]);
|
|
252
269
|
if (updatedTimezone) {
|
|
@@ -254,36 +271,48 @@ const TimezoneComponent = ({ timezoneOptions }) => {
|
|
|
254
271
|
}
|
|
255
272
|
}
|
|
256
273
|
}, [setFieldValue, values.date, values.timezone]);
|
|
257
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
258
|
-
designSystem.
|
|
274
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
275
|
+
designSystem.Field.Root,
|
|
259
276
|
{
|
|
260
|
-
label: formatMessage({
|
|
261
|
-
id: "content-releases.modal.form.input.label.timezone",
|
|
262
|
-
defaultMessage: "Timezone"
|
|
263
|
-
}),
|
|
264
|
-
autocomplete: { type: "list", filter: "contains" },
|
|
265
277
|
name: "timezone",
|
|
266
|
-
|
|
267
|
-
textValue: values.timezone ? values.timezone.replace(/&/, " ") : void 0,
|
|
268
|
-
onChange: (timezone) => {
|
|
269
|
-
setFieldValue("timezone", timezone);
|
|
270
|
-
},
|
|
271
|
-
onTextValueChange: (timezone) => {
|
|
272
|
-
setFieldValue("timezone", timezone);
|
|
273
|
-
},
|
|
274
|
-
onClear: () => {
|
|
275
|
-
setFieldValue("timezone", "");
|
|
276
|
-
},
|
|
277
|
-
error: errors.timezone,
|
|
278
|
+
error: errors.timezone && formatMessage({ id: errors.timezone, defaultMessage: errors.timezone }),
|
|
278
279
|
required: true,
|
|
279
|
-
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
|
+
]
|
|
280
305
|
}
|
|
281
306
|
);
|
|
282
307
|
};
|
|
283
|
-
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)`
|
|
284
313
|
display: block;
|
|
285
314
|
`;
|
|
286
|
-
const RelativeTime =
|
|
315
|
+
const RelativeTime = styledComponents.styled(RelativeTime$1)`
|
|
287
316
|
display: inline-block;
|
|
288
317
|
&::first-letter {
|
|
289
318
|
text-transform: uppercase;
|
|
@@ -317,7 +346,7 @@ const getBadgeProps = (status) => {
|
|
|
317
346
|
const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
318
347
|
const { formatMessage } = reactIntl.useIntl();
|
|
319
348
|
if (isError) {
|
|
320
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
349
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Error, {});
|
|
321
350
|
}
|
|
322
351
|
if (releases?.length === 0) {
|
|
323
352
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -332,11 +361,11 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
332
361
|
target: sectionTitle
|
|
333
362
|
}
|
|
334
363
|
),
|
|
335
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
364
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(symbols.EmptyDocuments, { width: "16rem" })
|
|
336
365
|
}
|
|
337
366
|
);
|
|
338
367
|
}
|
|
339
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid, { gap: 4, children: releases.map(({ id, name, scheduledAt, status }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
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(
|
|
340
369
|
designSystem.Flex,
|
|
341
370
|
{
|
|
342
371
|
direction: "column",
|
|
@@ -351,7 +380,7 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
351
380
|
gap: 4,
|
|
352
381
|
children: [
|
|
353
382
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "start", gap: 1, children: [
|
|
354
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, {
|
|
383
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", tag: "h3", variant: "delta", fontWeight: "bold", children: name }),
|
|
355
384
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: scheduledAt ? /* @__PURE__ */ jsxRuntime.jsx(RelativeTime, { timestamp: new Date(scheduledAt) }) : formatMessage({
|
|
356
385
|
id: "content-releases.pages.Releases.not-scheduled",
|
|
357
386
|
defaultMessage: "Not scheduled"
|
|
@@ -362,7 +391,7 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
362
391
|
}
|
|
363
392
|
) }) }, id)) });
|
|
364
393
|
};
|
|
365
|
-
const StyledAlert =
|
|
394
|
+
const StyledAlert = styledComponents.styled(designSystem.Alert)`
|
|
366
395
|
button {
|
|
367
396
|
display: none;
|
|
368
397
|
}
|
|
@@ -372,33 +401,35 @@ const StyledAlert = styled__default.default(designSystem.Alert)`
|
|
|
372
401
|
`;
|
|
373
402
|
const INITIAL_FORM_VALUES = {
|
|
374
403
|
name: "",
|
|
375
|
-
date:
|
|
404
|
+
date: dateFns.format(/* @__PURE__ */ new Date(), "yyyy-MM-dd"),
|
|
376
405
|
time: "",
|
|
377
406
|
isScheduled: true,
|
|
378
407
|
scheduledAt: null,
|
|
379
408
|
timezone: null
|
|
380
409
|
};
|
|
381
410
|
const ReleasesPage = () => {
|
|
382
|
-
const tabRef = React__namespace.useRef(null);
|
|
383
411
|
const location = reactRouterDom.useLocation();
|
|
384
412
|
const [releaseModalShown, setReleaseModalShown] = React__namespace.useState(false);
|
|
385
|
-
const toggleNotification =
|
|
413
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
386
414
|
const { formatMessage } = reactIntl.useIntl();
|
|
387
|
-
const
|
|
388
|
-
const { formatAPIError } =
|
|
389
|
-
const [{ query }, setQuery] =
|
|
415
|
+
const navigate = reactRouterDom.useNavigate();
|
|
416
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
417
|
+
const [{ query }, setQuery] = strapiAdmin.useQueryParams();
|
|
390
418
|
const response = index.useGetReleasesQuery(query);
|
|
419
|
+
const { data, isLoading: isLoadingSettings } = index.useGetReleaseSettingsQuery();
|
|
391
420
|
const [createRelease, { isLoading: isSubmittingForm }] = index.useCreateReleaseMutation();
|
|
392
|
-
const { getFeature } =
|
|
421
|
+
const { getFeature } = ee.useLicenseLimits();
|
|
393
422
|
const { maximumReleases = 3 } = getFeature("cms-content-releases");
|
|
394
|
-
const { trackUsage } =
|
|
395
|
-
const {
|
|
423
|
+
const { trackUsage } = strapiAdmin.useTracking();
|
|
424
|
+
const {
|
|
425
|
+
allowedActions: { canCreate }
|
|
426
|
+
} = strapiAdmin.useRBAC(index.PERMISSIONS);
|
|
427
|
+
const { isLoading: isLoadingReleases, isSuccess, isError } = response;
|
|
396
428
|
const activeTab = response?.currentData?.meta?.activeTab || "pending";
|
|
397
|
-
const activeTabIndex = ["pending", "done"].indexOf(activeTab);
|
|
398
429
|
React__namespace.useEffect(() => {
|
|
399
430
|
if (location?.state?.errors) {
|
|
400
431
|
toggleNotification({
|
|
401
|
-
type: "
|
|
432
|
+
type: "danger",
|
|
402
433
|
title: formatMessage({
|
|
403
434
|
id: "content-releases.pages.Releases.notification.error.title",
|
|
404
435
|
defaultMessage: "Your request could not be processed."
|
|
@@ -408,30 +439,25 @@ const ReleasesPage = () => {
|
|
|
408
439
|
defaultMessage: "Please try again or open another release."
|
|
409
440
|
})
|
|
410
441
|
});
|
|
411
|
-
|
|
412
|
-
}
|
|
413
|
-
}, [formatMessage, location?.state?.errors, replace, toggleNotification]);
|
|
414
|
-
React__namespace.useEffect(() => {
|
|
415
|
-
if (tabRef.current) {
|
|
416
|
-
tabRef.current._handlers.setSelectedTabIndex(activeTabIndex);
|
|
442
|
+
navigate("", { replace: true, state: null });
|
|
417
443
|
}
|
|
418
|
-
}, [
|
|
444
|
+
}, [formatMessage, location?.state?.errors, navigate, toggleNotification]);
|
|
419
445
|
const toggleAddReleaseModal = () => {
|
|
420
446
|
setReleaseModalShown((prev) => !prev);
|
|
421
447
|
};
|
|
422
|
-
if (
|
|
423
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
448
|
+
if (isLoadingReleases || isLoadingSettings) {
|
|
449
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
|
|
424
450
|
}
|
|
425
451
|
const totalPendingReleases = isSuccess && response.currentData?.meta?.pendingReleasesCount || 0;
|
|
426
452
|
const hasReachedMaximumPendingReleases = totalPendingReleases >= maximumReleases;
|
|
427
|
-
const handleTabChange = (
|
|
453
|
+
const handleTabChange = (tabValue) => {
|
|
428
454
|
setQuery({
|
|
429
455
|
...query,
|
|
430
456
|
page: 1,
|
|
431
457
|
pageSize: response?.currentData?.meta?.pagination?.pageSize || 16,
|
|
432
458
|
filters: {
|
|
433
459
|
releasedAt: {
|
|
434
|
-
$notNull:
|
|
460
|
+
$notNull: tabValue !== "pending"
|
|
435
461
|
}
|
|
436
462
|
}
|
|
437
463
|
});
|
|
@@ -451,22 +477,22 @@ const ReleasesPage = () => {
|
|
|
451
477
|
})
|
|
452
478
|
});
|
|
453
479
|
trackUsage("didCreateRelease");
|
|
454
|
-
|
|
455
|
-
} else if (
|
|
480
|
+
navigate(response2.data.data.id.toString());
|
|
481
|
+
} else if (strapiAdmin.isFetchError(response2.error)) {
|
|
456
482
|
toggleNotification({
|
|
457
|
-
type: "
|
|
483
|
+
type: "danger",
|
|
458
484
|
message: formatAPIError(response2.error)
|
|
459
485
|
});
|
|
460
486
|
} else {
|
|
461
487
|
toggleNotification({
|
|
462
|
-
type: "
|
|
488
|
+
type: "danger",
|
|
463
489
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
464
490
|
});
|
|
465
491
|
}
|
|
466
492
|
};
|
|
467
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { "aria-busy":
|
|
493
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { "aria-busy": isLoadingReleases || isLoadingSettings, children: [
|
|
468
494
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
469
|
-
|
|
495
|
+
strapiAdmin.Layouts.Header,
|
|
470
496
|
{
|
|
471
497
|
title: formatMessage({
|
|
472
498
|
id: "content-releases.pages.Releases.title",
|
|
@@ -476,7 +502,7 @@ const ReleasesPage = () => {
|
|
|
476
502
|
id: "content-releases.pages.Releases.header-subtitle",
|
|
477
503
|
defaultMessage: "Create and manage content updates"
|
|
478
504
|
}),
|
|
479
|
-
primaryAction:
|
|
505
|
+
primaryAction: canCreate ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
480
506
|
designSystem.Button,
|
|
481
507
|
{
|
|
482
508
|
startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Plus, {}),
|
|
@@ -487,15 +513,15 @@ const ReleasesPage = () => {
|
|
|
487
513
|
defaultMessage: "New release"
|
|
488
514
|
})
|
|
489
515
|
}
|
|
490
|
-
)
|
|
516
|
+
) : null
|
|
491
517
|
}
|
|
492
518
|
),
|
|
493
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
519
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
494
520
|
hasReachedMaximumPendingReleases && /* @__PURE__ */ jsxRuntime.jsx(
|
|
495
521
|
StyledAlert,
|
|
496
522
|
{
|
|
497
523
|
marginBottom: 6,
|
|
498
|
-
action: /* @__PURE__ */ jsxRuntime.jsx(
|
|
524
|
+
action: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Link, { href: "https://strapi.io/pricing-cloud", isExternal: true, children: formatMessage({
|
|
499
525
|
id: "content-releases.pages.Releases.max-limit-reached.action",
|
|
500
526
|
defaultMessage: "Explore plans"
|
|
501
527
|
}) }),
|
|
@@ -515,21 +541,17 @@ const ReleasesPage = () => {
|
|
|
515
541
|
})
|
|
516
542
|
}
|
|
517
543
|
),
|
|
518
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
519
|
-
designSystem.
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
children: [
|
|
530
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { paddingBottom: 8, children: [
|
|
531
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tabs, { children: [
|
|
532
|
-
/* @__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(
|
|
533
555
|
{
|
|
534
556
|
id: "content-releases.pages.Releases.tab.pending",
|
|
535
557
|
defaultMessage: "Pending ({count})"
|
|
@@ -538,70 +560,66 @@ const ReleasesPage = () => {
|
|
|
538
560
|
count: totalPendingReleases
|
|
539
561
|
}
|
|
540
562
|
) }),
|
|
541
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
563
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Trigger, { value: "done", children: formatMessage({
|
|
542
564
|
id: "content-releases.pages.Releases.tab.done",
|
|
543
565
|
defaultMessage: "Done"
|
|
544
566
|
}) })
|
|
545
|
-
]
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
sectionTitle: "pending",
|
|
553
|
-
releases: response?.currentData?.data,
|
|
554
|
-
isError
|
|
555
|
-
}
|
|
556
|
-
) }),
|
|
557
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.TabPanel, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
558
|
-
ReleasesGrid,
|
|
559
|
-
{
|
|
560
|
-
sectionTitle: "done",
|
|
561
|
-
releases: response?.currentData?.data,
|
|
562
|
-
isError
|
|
563
|
-
}
|
|
564
|
-
) })
|
|
565
|
-
] })
|
|
566
|
-
]
|
|
567
|
-
}
|
|
568
|
-
),
|
|
569
|
-
response.currentData?.meta?.pagination?.total ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { paddingTop: 4, alignItems: "flex-end", justifyContent: "space-between", children: [
|
|
570
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
571
|
-
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,
|
|
572
574
|
{
|
|
573
|
-
|
|
574
|
-
|
|
575
|
+
sectionTitle: "pending",
|
|
576
|
+
releases: response?.currentData?.data,
|
|
577
|
+
isError
|
|
575
578
|
}
|
|
576
|
-
),
|
|
577
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
578
|
-
|
|
579
|
+
) }),
|
|
580
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Content, { value: "done", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
581
|
+
ReleasesGrid,
|
|
579
582
|
{
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
+
sectionTitle: "done",
|
|
584
|
+
releases: response?.currentData?.data,
|
|
585
|
+
isError
|
|
583
586
|
}
|
|
584
|
-
)
|
|
585
|
-
] })
|
|
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
|
+
)
|
|
586
600
|
] }) }),
|
|
587
|
-
|
|
601
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
588
602
|
ReleaseModal,
|
|
589
603
|
{
|
|
604
|
+
open: releaseModalShown,
|
|
590
605
|
handleClose: toggleAddReleaseModal,
|
|
591
606
|
handleSubmit: handleAddRelease,
|
|
592
607
|
isLoading: isSubmittingForm,
|
|
593
|
-
initialValues:
|
|
608
|
+
initialValues: {
|
|
609
|
+
...INITIAL_FORM_VALUES,
|
|
610
|
+
timezone: data?.data.defaultTimezone ? data.data.defaultTimezone.split("&")[1] : null
|
|
611
|
+
}
|
|
594
612
|
}
|
|
595
613
|
)
|
|
596
614
|
] });
|
|
597
615
|
};
|
|
598
|
-
const ReleaseInfoWrapper =
|
|
616
|
+
const ReleaseInfoWrapper = styledComponents.styled(designSystem.Flex)`
|
|
599
617
|
align-self: stretch;
|
|
600
618
|
border-bottom-right-radius: ${({ theme }) => theme.borderRadius};
|
|
601
619
|
border-bottom-left-radius: ${({ theme }) => theme.borderRadius};
|
|
602
620
|
border-top: 1px solid ${({ theme }) => theme.colors.neutral150};
|
|
603
621
|
`;
|
|
604
|
-
const StyledMenuItem =
|
|
622
|
+
const StyledMenuItem = styledComponents.styled(designSystem.MenuItem)`
|
|
605
623
|
svg path {
|
|
606
624
|
fill: ${({ theme, disabled }) => disabled && theme.colors.neutral500};
|
|
607
625
|
}
|
|
@@ -610,60 +628,95 @@ const StyledMenuItem = styled__default.default(v2.Menu.Item)`
|
|
|
610
628
|
}
|
|
611
629
|
|
|
612
630
|
&:hover {
|
|
613
|
-
background: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}100`]};
|
|
631
|
+
background: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}100`]};
|
|
614
632
|
}
|
|
615
633
|
`;
|
|
616
|
-
const PencilIcon =
|
|
634
|
+
const PencilIcon = styledComponents.styled(icons.Pencil)`
|
|
617
635
|
width: ${({ theme }) => theme.spaces[3]};
|
|
618
636
|
height: ${({ theme }) => theme.spaces[3]};
|
|
619
637
|
path {
|
|
620
638
|
fill: ${({ theme }) => theme.colors.neutral600};
|
|
621
639
|
}
|
|
622
640
|
`;
|
|
623
|
-
const TrashIcon =
|
|
641
|
+
const TrashIcon = styledComponents.styled(icons.Trash)`
|
|
624
642
|
width: ${({ theme }) => theme.spaces[3]};
|
|
625
643
|
height: ${({ theme }) => theme.spaces[3]};
|
|
626
644
|
path {
|
|
627
645
|
fill: ${({ theme }) => theme.colors.danger600};
|
|
628
646
|
}
|
|
629
647
|
`;
|
|
630
|
-
const TypographyMaxWidth =
|
|
648
|
+
const TypographyMaxWidth = styledComponents.styled(designSystem.Typography)`
|
|
631
649
|
max-width: 300px;
|
|
632
650
|
`;
|
|
633
|
-
const EntryValidationText = ({ action, schema,
|
|
651
|
+
const EntryValidationText = ({ action, schema, entry, status }) => {
|
|
634
652
|
const { formatMessage } = reactIntl.useIntl();
|
|
635
|
-
const { validate } = strapiAdmin.unstable_useDocument(
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
).join(" ");
|
|
648
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
649
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Icon, { color: "danger600", as: icons.CrossCircle }),
|
|
650
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tooltip, { description: validationErrorsMessages, children: /* @__PURE__ */ jsxRuntime.jsx(TypographyMaxWidth, { textColor: "danger600", variant: "omega", fontWeight: "semiBold", ellipsis: true, children: validationErrorsMessages }) })
|
|
651
|
-
] });
|
|
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
|
+
if (isLoading) {
|
|
664
|
+
return null;
|
|
652
665
|
}
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
666
|
+
const errors = validate(entry) ?? {};
|
|
667
|
+
if (action === "publish") {
|
|
668
|
+
if (Object.keys(errors).length > 0) {
|
|
669
|
+
const validationErrorsMessages = Object.entries(errors).map(
|
|
670
|
+
([key, value]) => formatMessage(
|
|
671
|
+
// @ts-expect-error – TODO: fix this will better checks
|
|
672
|
+
{ id: `${value.id}.withField`, defaultMessage: value.defaultMessage },
|
|
673
|
+
{ field: key }
|
|
674
|
+
)
|
|
675
|
+
).join(" ");
|
|
676
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
677
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.CrossCircle, { fill: "danger600" }),
|
|
678
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tooltip, { description: validationErrorsMessages, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
679
|
+
TypographyMaxWidth,
|
|
680
|
+
{
|
|
681
|
+
textColor: "danger600",
|
|
682
|
+
variant: "omega",
|
|
683
|
+
fontWeight: "semiBold",
|
|
684
|
+
ellipsis: true,
|
|
685
|
+
children: validationErrorsMessages
|
|
686
|
+
}
|
|
687
|
+
) })
|
|
688
|
+
] });
|
|
689
|
+
}
|
|
690
|
+
if (status === "draft") {
|
|
691
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
692
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
|
693
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
|
|
694
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.ready-to-publish",
|
|
695
|
+
defaultMessage: "Ready to publish"
|
|
696
|
+
}) })
|
|
697
|
+
] });
|
|
698
|
+
}
|
|
699
|
+
if (status === "modified") {
|
|
700
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
701
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.ArrowsCounterClockwise, { fill: "alternative600" }),
|
|
702
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
|
|
703
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.modified",
|
|
704
|
+
defaultMessage: "Ready to publish changes"
|
|
705
|
+
}) })
|
|
706
|
+
] });
|
|
707
|
+
}
|
|
708
|
+
if (status === "published") {
|
|
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.already-published",
|
|
713
|
+
defaultMessage: "Already published"
|
|
714
|
+
}) })
|
|
715
|
+
] });
|
|
716
|
+
}
|
|
664
717
|
}
|
|
665
718
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
666
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
719
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
|
667
720
|
!entry.publishedAt ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "success600", fontWeight: "bold", children: formatMessage({
|
|
668
721
|
id: "content-releases.pages.ReleaseDetails.entry-validation.already-unpublished",
|
|
669
722
|
defaultMessage: "Already unpublished"
|
|
@@ -683,20 +736,23 @@ const ReleaseDetailsLayout = ({
|
|
|
683
736
|
const {
|
|
684
737
|
data,
|
|
685
738
|
isLoading: isLoadingDetails,
|
|
686
|
-
isError,
|
|
687
739
|
error
|
|
688
|
-
} = index.useGetReleaseQuery(
|
|
740
|
+
} = index.useGetReleaseQuery(
|
|
741
|
+
{ id: releaseId },
|
|
742
|
+
{
|
|
743
|
+
skip: !releaseId
|
|
744
|
+
}
|
|
745
|
+
);
|
|
689
746
|
const [publishRelease, { isLoading: isPublishing }] = index.usePublishReleaseMutation();
|
|
690
|
-
const toggleNotification =
|
|
691
|
-
const { formatAPIError } =
|
|
692
|
-
const {
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
const
|
|
696
|
-
const { trackUsage } = helperPlugin.useTracking();
|
|
747
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
748
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
749
|
+
const { allowedActions } = strapiAdmin.useRBAC(index.PERMISSIONS);
|
|
750
|
+
const { canUpdate, canDelete, canPublish } = allowedActions;
|
|
751
|
+
const dispatch = useTypedDispatch();
|
|
752
|
+
const { trackUsage } = strapiAdmin.useTracking();
|
|
697
753
|
const release = data?.data;
|
|
698
|
-
const handlePublishRelease = async () => {
|
|
699
|
-
const response = await publishRelease({ id
|
|
754
|
+
const handlePublishRelease = (id) => async () => {
|
|
755
|
+
const response = await publishRelease({ id });
|
|
700
756
|
if ("data" in response) {
|
|
701
757
|
toggleNotification({
|
|
702
758
|
type: "success",
|
|
@@ -711,14 +767,14 @@ const ReleaseDetailsLayout = ({
|
|
|
711
767
|
totalPublishedEntries,
|
|
712
768
|
totalUnpublishedEntries
|
|
713
769
|
});
|
|
714
|
-
} else if (
|
|
770
|
+
} else if (strapiAdmin.isFetchError(response.error)) {
|
|
715
771
|
toggleNotification({
|
|
716
|
-
type: "
|
|
772
|
+
type: "danger",
|
|
717
773
|
message: formatAPIError(response.error)
|
|
718
774
|
});
|
|
719
775
|
} else {
|
|
720
776
|
toggleNotification({
|
|
721
|
-
type: "
|
|
777
|
+
type: "danger",
|
|
722
778
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
723
779
|
});
|
|
724
780
|
}
|
|
@@ -744,21 +800,20 @@ const ReleaseDetailsLayout = ({
|
|
|
744
800
|
return release.createdBy.email;
|
|
745
801
|
};
|
|
746
802
|
if (isLoadingDetails) {
|
|
747
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
803
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
|
|
748
804
|
}
|
|
749
|
-
if (
|
|
805
|
+
if (isBaseQueryError(error) && "code" in error || !release) {
|
|
750
806
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
751
|
-
reactRouterDom.
|
|
807
|
+
reactRouterDom.Navigate,
|
|
752
808
|
{
|
|
753
|
-
to:
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
}
|
|
809
|
+
to: "..",
|
|
810
|
+
state: {
|
|
811
|
+
errors: [
|
|
812
|
+
{
|
|
813
|
+
// @ts-expect-error – TODO: fix this weird error flow
|
|
814
|
+
code: error?.code
|
|
815
|
+
}
|
|
816
|
+
]
|
|
762
817
|
}
|
|
763
818
|
}
|
|
764
819
|
);
|
|
@@ -795,106 +850,90 @@ const ReleaseDetailsLayout = ({
|
|
|
795
850
|
) : "";
|
|
796
851
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { "aria-busy": isLoadingDetails, children: [
|
|
797
852
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
798
|
-
|
|
853
|
+
strapiAdmin.Layouts.Header,
|
|
799
854
|
{
|
|
800
855
|
title: release.name,
|
|
801
856
|
subtitle: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, lineHeight: 6, children: [
|
|
802
857
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", variant: "epsilon", children: numberOfEntriesText + (isScheduled ? ` - ${scheduledText}` : "") }),
|
|
803
858
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { ...getBadgeProps(release.status), children: release.status })
|
|
804
859
|
] }),
|
|
805
|
-
navigationAction: /* @__PURE__ */ jsxRuntime.jsx(
|
|
806
|
-
id: "global.back",
|
|
807
|
-
defaultMessage: "Back"
|
|
808
|
-
}) }),
|
|
860
|
+
navigationAction: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.BackButton, {}),
|
|
809
861
|
primaryAction: !release.releasedAt && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
810
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
{
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
862
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
863
|
+
SimpleMenuButton,
|
|
864
|
+
{
|
|
865
|
+
label: /* @__PURE__ */ jsxRuntime.jsx(icons.More, {}),
|
|
866
|
+
variant: "tertiary",
|
|
867
|
+
endIcon: null,
|
|
868
|
+
paddingLeft: "7px",
|
|
869
|
+
paddingRight: "7px",
|
|
870
|
+
"aria-label": formatMessage({
|
|
871
|
+
id: "content-releases.header.actions.open-release-actions",
|
|
872
|
+
defaultMessage: "Release edit and delete menu"
|
|
873
|
+
}),
|
|
874
|
+
popoverPlacement: "bottom-end",
|
|
875
|
+
children: [
|
|
876
|
+
/* @__PURE__ */ jsxRuntime.jsx(StyledMenuItem, { disabled: !canUpdate, onSelect: toggleEditReleaseModal, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 2, hasRadius: true, width: "100%", children: [
|
|
877
|
+
/* @__PURE__ */ jsxRuntime.jsx(PencilIcon, {}),
|
|
878
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { ellipsis: true, children: formatMessage({
|
|
879
|
+
id: "content-releases.header.actions.edit",
|
|
880
|
+
defaultMessage: "Edit"
|
|
881
|
+
}) })
|
|
882
|
+
] }) }),
|
|
883
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
884
|
+
StyledMenuItem,
|
|
885
|
+
{
|
|
886
|
+
disabled: !canDelete,
|
|
887
|
+
onSelect: toggleWarningSubmit,
|
|
888
|
+
$variant: "danger",
|
|
889
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 2, hasRadius: true, width: "100%", children: [
|
|
890
|
+
/* @__PURE__ */ jsxRuntime.jsx(TrashIcon, {}),
|
|
891
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { ellipsis: true, textColor: "danger600", children: formatMessage({
|
|
892
|
+
id: "content-releases.header.actions.delete",
|
|
893
|
+
defaultMessage: "Delete"
|
|
840
894
|
}) })
|
|
841
|
-
] }) }),
|
|
842
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
843
|
-
StyledMenuItem,
|
|
844
|
-
{
|
|
845
|
-
disabled: !canDelete,
|
|
846
|
-
onSelect: toggleWarningSubmit,
|
|
847
|
-
variant: "danger",
|
|
848
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 2, hasRadius: true, width: "100%", children: [
|
|
849
|
-
/* @__PURE__ */ jsxRuntime.jsx(TrashIcon, {}),
|
|
850
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { ellipsis: true, textColor: "danger600", children: formatMessage({
|
|
851
|
-
id: "content-releases.header.actions.delete",
|
|
852
|
-
defaultMessage: "Delete"
|
|
853
|
-
}) })
|
|
854
|
-
] })
|
|
855
|
-
}
|
|
856
|
-
)
|
|
857
|
-
]
|
|
858
|
-
}
|
|
859
|
-
),
|
|
860
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
861
|
-
ReleaseInfoWrapper,
|
|
862
|
-
{
|
|
863
|
-
direction: "column",
|
|
864
|
-
justifyContent: "center",
|
|
865
|
-
alignItems: "flex-start",
|
|
866
|
-
gap: 1,
|
|
867
|
-
padding: 5,
|
|
868
|
-
children: [
|
|
869
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", children: formatMessage({
|
|
870
|
-
id: "content-releases.header.actions.created",
|
|
871
|
-
defaultMessage: "Created"
|
|
872
|
-
}) }),
|
|
873
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", color: "neutral300", children: [
|
|
874
|
-
/* @__PURE__ */ jsxRuntime.jsx(helperPlugin.RelativeTime, { timestamp: new Date(release.createdAt) }),
|
|
875
|
-
formatMessage(
|
|
876
|
-
{
|
|
877
|
-
id: "content-releases.header.actions.created.description",
|
|
878
|
-
defaultMessage: "{hasCreatedByUser, select, true { by {createdBy}} other { by deleted user}}"
|
|
879
|
-
},
|
|
880
|
-
{ createdBy: getCreatedByUser(), hasCreatedByUser }
|
|
881
|
-
)
|
|
882
895
|
] })
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
896
|
+
}
|
|
897
|
+
),
|
|
898
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
899
|
+
ReleaseInfoWrapper,
|
|
900
|
+
{
|
|
901
|
+
direction: "column",
|
|
902
|
+
justifyContent: "center",
|
|
903
|
+
alignItems: "flex-start",
|
|
904
|
+
gap: 1,
|
|
905
|
+
padding: 4,
|
|
906
|
+
children: [
|
|
907
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", children: formatMessage({
|
|
908
|
+
id: "content-releases.header.actions.created",
|
|
909
|
+
defaultMessage: "Created"
|
|
910
|
+
}) }),
|
|
911
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", color: "neutral300", children: [
|
|
912
|
+
/* @__PURE__ */ jsxRuntime.jsx(RelativeTime$1, { timestamp: new Date(release.createdAt) }),
|
|
913
|
+
formatMessage(
|
|
914
|
+
{
|
|
915
|
+
id: "content-releases.header.actions.created.description",
|
|
916
|
+
defaultMessage: "{hasCreatedByUser, select, true { by {createdBy}} other { by deleted user}}"
|
|
917
|
+
},
|
|
918
|
+
{ createdBy: getCreatedByUser(), hasCreatedByUser }
|
|
919
|
+
)
|
|
920
|
+
] })
|
|
921
|
+
]
|
|
922
|
+
}
|
|
923
|
+
)
|
|
924
|
+
]
|
|
925
|
+
}
|
|
926
|
+
),
|
|
888
927
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { size: "S", variant: "tertiary", onClick: handleRefresh, children: formatMessage({
|
|
889
928
|
id: "content-releases.header.actions.refresh",
|
|
890
929
|
defaultMessage: "Refresh"
|
|
891
930
|
}) }),
|
|
892
|
-
|
|
931
|
+
canPublish ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
893
932
|
designSystem.Button,
|
|
894
933
|
{
|
|
895
934
|
size: "S",
|
|
896
935
|
variant: "default",
|
|
897
|
-
onClick: handlePublishRelease,
|
|
936
|
+
onClick: handlePublishRelease(release.id.toString()),
|
|
898
937
|
loading: isPublishing,
|
|
899
938
|
disabled: release.actions.meta.count === 0,
|
|
900
939
|
children: formatMessage({
|
|
@@ -902,13 +941,18 @@ const ReleaseDetailsLayout = ({
|
|
|
902
941
|
defaultMessage: "Publish"
|
|
903
942
|
})
|
|
904
943
|
}
|
|
905
|
-
)
|
|
944
|
+
) : null
|
|
906
945
|
] })
|
|
907
946
|
}
|
|
908
947
|
),
|
|
909
948
|
children
|
|
910
949
|
] });
|
|
911
950
|
};
|
|
951
|
+
const SimpleMenuButton = styledComponents.styled(designSystem.SimpleMenu)`
|
|
952
|
+
& > span {
|
|
953
|
+
display: flex;
|
|
954
|
+
}
|
|
955
|
+
`;
|
|
912
956
|
const GROUP_BY_OPTIONS = ["contentType", "locale", "action"];
|
|
913
957
|
const GROUP_BY_OPTIONS_NO_LOCALE = ["contentType", "action"];
|
|
914
958
|
const getGroupByOptionLabel = (value) => {
|
|
@@ -929,47 +973,32 @@ const getGroupByOptionLabel = (value) => {
|
|
|
929
973
|
defaultMessage: "Content-Types"
|
|
930
974
|
};
|
|
931
975
|
};
|
|
932
|
-
const
|
|
933
|
-
{
|
|
934
|
-
key: "__name__",
|
|
935
|
-
fieldSchema: { type: "string" },
|
|
936
|
-
metadatas: {
|
|
937
|
-
label: {
|
|
938
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.name",
|
|
939
|
-
defaultMessage: "name"
|
|
940
|
-
},
|
|
941
|
-
searchable: false,
|
|
942
|
-
sortable: false
|
|
943
|
-
},
|
|
944
|
-
name: "name"
|
|
945
|
-
}
|
|
946
|
-
];
|
|
947
|
-
const ReleaseDetailsBody = () => {
|
|
976
|
+
const ReleaseDetailsBody = ({ releaseId }) => {
|
|
948
977
|
const { formatMessage } = reactIntl.useIntl();
|
|
949
|
-
const {
|
|
950
|
-
const
|
|
951
|
-
const
|
|
952
|
-
const { formatAPIError } = helperPlugin.useAPIErrorHandler();
|
|
978
|
+
const [{ query }, setQuery] = strapiAdmin.useQueryParams();
|
|
979
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
980
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
953
981
|
const {
|
|
954
982
|
data: releaseData,
|
|
955
983
|
isLoading: isReleaseLoading,
|
|
956
|
-
isError: isReleaseError,
|
|
957
984
|
error: releaseError
|
|
958
985
|
} = index.useGetReleaseQuery({ id: releaseId });
|
|
959
986
|
const {
|
|
960
987
|
allowedActions: { canUpdate }
|
|
961
|
-
} =
|
|
962
|
-
const
|
|
963
|
-
const {
|
|
964
|
-
displayedHeaders
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
988
|
+
} = strapiAdmin.useRBAC(index.PERMISSIONS);
|
|
989
|
+
const runHookWaterfall = strapiAdmin.useStrapiApp("ReleaseDetailsPage", (state) => state.runHookWaterfall);
|
|
990
|
+
const { displayedHeaders, hasI18nEnabled } = runHookWaterfall("ContentReleases/pages/ReleaseDetails/add-locale-in-releases", {
|
|
991
|
+
displayedHeaders: [
|
|
992
|
+
{
|
|
993
|
+
label: {
|
|
994
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.name",
|
|
995
|
+
defaultMessage: "name"
|
|
996
|
+
},
|
|
997
|
+
name: "name"
|
|
998
|
+
}
|
|
999
|
+
],
|
|
1000
|
+
hasI18nEnabled: false
|
|
1001
|
+
});
|
|
973
1002
|
const release = releaseData?.data;
|
|
974
1003
|
const selectedGroupBy = query?.groupBy || "contentType";
|
|
975
1004
|
const {
|
|
@@ -998,65 +1027,59 @@ const ReleaseDetailsBody = () => {
|
|
|
998
1027
|
// We are passing the action path to found the position in the cache of the action for optimistic updates
|
|
999
1028
|
});
|
|
1000
1029
|
if ("error" in response) {
|
|
1001
|
-
if (
|
|
1030
|
+
if (strapiAdmin.isFetchError(response.error)) {
|
|
1002
1031
|
toggleNotification({
|
|
1003
|
-
type: "
|
|
1032
|
+
type: "danger",
|
|
1004
1033
|
message: formatAPIError(response.error)
|
|
1005
1034
|
});
|
|
1006
1035
|
} else {
|
|
1007
1036
|
toggleNotification({
|
|
1008
|
-
type: "
|
|
1037
|
+
type: "danger",
|
|
1009
1038
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
1010
1039
|
});
|
|
1011
1040
|
}
|
|
1012
1041
|
}
|
|
1013
1042
|
};
|
|
1014
1043
|
if (isLoading || isReleaseLoading) {
|
|
1015
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1044
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
|
|
1016
1045
|
}
|
|
1017
1046
|
const releaseActions = data?.data;
|
|
1018
1047
|
const releaseMeta = data?.meta;
|
|
1019
1048
|
const contentTypes = releaseMeta?.contentTypes || {};
|
|
1020
1049
|
const components = releaseMeta?.components || {};
|
|
1021
|
-
if (
|
|
1050
|
+
if (isBaseQueryError(releaseError) || !release) {
|
|
1022
1051
|
const errorsArray = [];
|
|
1023
|
-
if (releaseError) {
|
|
1052
|
+
if (releaseError && "code" in releaseError) {
|
|
1024
1053
|
errorsArray.push({
|
|
1025
1054
|
code: releaseError.code
|
|
1026
1055
|
});
|
|
1027
1056
|
}
|
|
1028
|
-
if (releaseActionsError) {
|
|
1057
|
+
if (releaseActionsError && "code" in releaseActionsError) {
|
|
1029
1058
|
errorsArray.push({
|
|
1030
1059
|
code: releaseActionsError.code
|
|
1031
1060
|
});
|
|
1032
1061
|
}
|
|
1033
1062
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1034
|
-
reactRouterDom.
|
|
1063
|
+
reactRouterDom.Navigate,
|
|
1035
1064
|
{
|
|
1036
|
-
to:
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
errors: errorsArray
|
|
1040
|
-
}
|
|
1065
|
+
to: "..",
|
|
1066
|
+
state: {
|
|
1067
|
+
errors: errorsArray
|
|
1041
1068
|
}
|
|
1042
1069
|
}
|
|
1043
1070
|
);
|
|
1044
1071
|
}
|
|
1045
1072
|
if (isError || !releaseActions) {
|
|
1046
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1073
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Error, {});
|
|
1047
1074
|
}
|
|
1048
1075
|
if (Object.keys(releaseActions).length === 0) {
|
|
1049
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1050
|
-
|
|
1076
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1077
|
+
designSystem.EmptyStateLayout,
|
|
1051
1078
|
{
|
|
1052
|
-
content: {
|
|
1053
|
-
id: "content-releases.pages.Details.tab.emptyEntries",
|
|
1054
|
-
defaultMessage: "This release is empty. Open the Content Manager, select an entry and add it to the release."
|
|
1055
|
-
},
|
|
1056
1079
|
action: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1057
|
-
|
|
1080
|
+
designSystem.LinkButton,
|
|
1058
1081
|
{
|
|
1059
|
-
|
|
1082
|
+
tag: reactRouterDom.Link,
|
|
1060
1083
|
to: {
|
|
1061
1084
|
pathname: "/content-manager"
|
|
1062
1085
|
},
|
|
@@ -1067,19 +1090,52 @@ const ReleaseDetailsBody = () => {
|
|
|
1067
1090
|
defaultMessage: "Open the Content Manager"
|
|
1068
1091
|
})
|
|
1069
1092
|
}
|
|
1070
|
-
)
|
|
1093
|
+
),
|
|
1094
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(symbols.EmptyDocuments, { width: "16rem" }),
|
|
1095
|
+
content: formatMessage({
|
|
1096
|
+
id: "content-releases.pages.Details.tab.emptyEntries",
|
|
1097
|
+
defaultMessage: "This release is empty. Open the Content Manager, select an entry and add it to the release."
|
|
1098
|
+
})
|
|
1071
1099
|
}
|
|
1072
1100
|
) });
|
|
1073
1101
|
}
|
|
1102
|
+
const groupByLabel = formatMessage({
|
|
1103
|
+
id: "content-releases.pages.ReleaseDetails.groupBy.aria-label",
|
|
1104
|
+
defaultMessage: "Group by"
|
|
1105
|
+
});
|
|
1106
|
+
const headers = [
|
|
1107
|
+
...displayedHeaders,
|
|
1108
|
+
{
|
|
1109
|
+
label: {
|
|
1110
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.content-type",
|
|
1111
|
+
defaultMessage: "content-type"
|
|
1112
|
+
},
|
|
1113
|
+
name: "content-type"
|
|
1114
|
+
},
|
|
1115
|
+
{
|
|
1116
|
+
label: {
|
|
1117
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.action",
|
|
1118
|
+
defaultMessage: "action"
|
|
1119
|
+
},
|
|
1120
|
+
name: "action"
|
|
1121
|
+
},
|
|
1122
|
+
...!release.releasedAt ? [
|
|
1123
|
+
{
|
|
1124
|
+
label: {
|
|
1125
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.status",
|
|
1126
|
+
defaultMessage: "status"
|
|
1127
|
+
},
|
|
1128
|
+
name: "status"
|
|
1129
|
+
}
|
|
1130
|
+
] : []
|
|
1131
|
+
];
|
|
1074
1132
|
const options = hasI18nEnabled ? GROUP_BY_OPTIONS : GROUP_BY_OPTIONS_NO_LOCALE;
|
|
1075
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1133
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 8, direction: "column", alignItems: "stretch", children: [
|
|
1076
1134
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1077
1135
|
designSystem.SingleSelect,
|
|
1078
1136
|
{
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
defaultMessage: "Group by"
|
|
1082
|
-
}),
|
|
1137
|
+
placeholder: groupByLabel,
|
|
1138
|
+
"aria-label": groupByLabel,
|
|
1083
1139
|
customizeContent: (value) => formatMessage(
|
|
1084
1140
|
{
|
|
1085
1141
|
id: `content-releases.pages.ReleaseDetails.groupBy.label`,
|
|
@@ -1097,63 +1153,19 @@ const ReleaseDetailsBody = () => {
|
|
|
1097
1153
|
Object.keys(releaseActions).map((key) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, direction: "column", alignItems: "stretch", children: [
|
|
1098
1154
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { role: "separator", "aria-label": key, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { children: key }) }),
|
|
1099
1155
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1100
|
-
|
|
1156
|
+
strapiAdmin.Table.Root,
|
|
1101
1157
|
{
|
|
1102
1158
|
rows: releaseActions[key].map((item) => ({
|
|
1103
1159
|
...item,
|
|
1104
1160
|
id: Number(item.entry.id)
|
|
1105
1161
|
})),
|
|
1106
|
-
|
|
1107
|
-
isLoading,
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
{
|
|
1114
|
-
fieldSchemaType: fieldSchema.type,
|
|
1115
|
-
label: formatMessage(metadatas.label),
|
|
1116
|
-
name
|
|
1117
|
-
},
|
|
1118
|
-
key2
|
|
1119
|
-
)),
|
|
1120
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1121
|
-
helperPlugin.Table.HeaderCell,
|
|
1122
|
-
{
|
|
1123
|
-
fieldSchemaType: "string",
|
|
1124
|
-
label: formatMessage({
|
|
1125
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.content-type",
|
|
1126
|
-
defaultMessage: "content-type"
|
|
1127
|
-
}),
|
|
1128
|
-
name: "content-type"
|
|
1129
|
-
}
|
|
1130
|
-
),
|
|
1131
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1132
|
-
helperPlugin.Table.HeaderCell,
|
|
1133
|
-
{
|
|
1134
|
-
fieldSchemaType: "string",
|
|
1135
|
-
label: formatMessage({
|
|
1136
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.action",
|
|
1137
|
-
defaultMessage: "action"
|
|
1138
|
-
}),
|
|
1139
|
-
name: "action"
|
|
1140
|
-
}
|
|
1141
|
-
),
|
|
1142
|
-
!release.releasedAt && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1143
|
-
helperPlugin.Table.HeaderCell,
|
|
1144
|
-
{
|
|
1145
|
-
fieldSchemaType: "string",
|
|
1146
|
-
label: formatMessage({
|
|
1147
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.status",
|
|
1148
|
-
defaultMessage: "status"
|
|
1149
|
-
}),
|
|
1150
|
-
name: "status"
|
|
1151
|
-
}
|
|
1152
|
-
)
|
|
1153
|
-
] }),
|
|
1154
|
-
/* @__PURE__ */ jsxRuntime.jsx(helperPlugin.Table.LoadingBody, {}),
|
|
1155
|
-
/* @__PURE__ */ jsxRuntime.jsx(helperPlugin.Table.Body, { children: releaseActions[key].map(
|
|
1156
|
-
({ id, contentType, locale, type, entry }, actionIndex) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
1162
|
+
headers,
|
|
1163
|
+
isLoading: isLoading || isFetching,
|
|
1164
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(strapiAdmin.Table.Content, { children: [
|
|
1165
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Head, { children: headers.map(({ label, name }) => /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.HeaderCell, { label: formatMessage(label), name }, name)) }),
|
|
1166
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Loading, {}),
|
|
1167
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Body, { children: releaseActions[key].map(
|
|
1168
|
+
({ id, contentType, locale, type, entry, status }, actionIndex) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
1157
1169
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "25%", maxWidth: "200px", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { ellipsis: true, children: `${contentType.mainFieldValue || entry.id}` }) }),
|
|
1158
1170
|
hasI18nEnabled && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "10%", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: `${locale?.name ? locale.name : "-"}` }) }),
|
|
1159
1171
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "10%", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: contentType.displayName || "" }) }),
|
|
@@ -1182,7 +1194,8 @@ const ReleaseDetailsBody = () => {
|
|
|
1182
1194
|
action: type,
|
|
1183
1195
|
schema: contentTypes?.[contentType.uid],
|
|
1184
1196
|
components,
|
|
1185
|
-
entry
|
|
1197
|
+
entry,
|
|
1198
|
+
status
|
|
1186
1199
|
}
|
|
1187
1200
|
) }),
|
|
1188
1201
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsxs(index.ReleaseActionMenu.Root, { children: [
|
|
@@ -1190,7 +1203,7 @@ const ReleaseDetailsBody = () => {
|
|
|
1190
1203
|
index.ReleaseActionMenu.ReleaseActionEntryLinkItem,
|
|
1191
1204
|
{
|
|
1192
1205
|
contentTypeUid: contentType.uid,
|
|
1193
|
-
|
|
1206
|
+
documentId: entry.documentId,
|
|
1194
1207
|
locale: locale?.code
|
|
1195
1208
|
}
|
|
1196
1209
|
),
|
|
@@ -1209,53 +1222,72 @@ const ReleaseDetailsBody = () => {
|
|
|
1209
1222
|
}
|
|
1210
1223
|
)
|
|
1211
1224
|
] }, `releases-group-${key}`)),
|
|
1212
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
}
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1225
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1226
|
+
strapiAdmin.Pagination.Root,
|
|
1227
|
+
{
|
|
1228
|
+
...releaseMeta?.pagination,
|
|
1229
|
+
defaultPageSize: releaseMeta?.pagination?.pageSize,
|
|
1230
|
+
children: [
|
|
1231
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.PageSize, {}),
|
|
1232
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.Links, {})
|
|
1233
|
+
]
|
|
1234
|
+
}
|
|
1235
|
+
)
|
|
1223
1236
|
] }) });
|
|
1224
1237
|
};
|
|
1225
1238
|
const ReleaseDetailsPage = () => {
|
|
1226
1239
|
const { formatMessage } = reactIntl.useIntl();
|
|
1227
1240
|
const { releaseId } = reactRouterDom.useParams();
|
|
1228
|
-
const toggleNotification =
|
|
1229
|
-
const { formatAPIError } =
|
|
1230
|
-
const
|
|
1241
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
1242
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
1243
|
+
const navigate = reactRouterDom.useNavigate();
|
|
1231
1244
|
const [releaseModalShown, setReleaseModalShown] = React__namespace.useState(false);
|
|
1232
1245
|
const [showWarningSubmit, setWarningSubmit] = React__namespace.useState(false);
|
|
1233
1246
|
const {
|
|
1234
1247
|
isLoading: isLoadingDetails,
|
|
1235
1248
|
data,
|
|
1236
1249
|
isSuccess: isSuccessDetails
|
|
1237
|
-
} = index.useGetReleaseQuery(
|
|
1250
|
+
} = index.useGetReleaseQuery(
|
|
1251
|
+
{ id: releaseId },
|
|
1252
|
+
{
|
|
1253
|
+
skip: !releaseId
|
|
1254
|
+
}
|
|
1255
|
+
);
|
|
1256
|
+
const { data: dataTimezone, isLoading: isLoadingTimezone } = index.useGetReleaseSettingsQuery();
|
|
1238
1257
|
const [updateRelease, { isLoading: isSubmittingForm }] = index.useUpdateReleaseMutation();
|
|
1239
|
-
const [deleteRelease
|
|
1258
|
+
const [deleteRelease] = index.useDeleteReleaseMutation();
|
|
1240
1259
|
const toggleEditReleaseModal = () => {
|
|
1241
1260
|
setReleaseModalShown((prev) => !prev);
|
|
1242
1261
|
};
|
|
1262
|
+
const getTimezoneValue = () => {
|
|
1263
|
+
if (releaseData?.timezone) {
|
|
1264
|
+
return releaseData.timezone;
|
|
1265
|
+
} else {
|
|
1266
|
+
if (dataTimezone?.data.defaultTimezone) {
|
|
1267
|
+
return dataTimezone.data.defaultTimezone;
|
|
1268
|
+
}
|
|
1269
|
+
return null;
|
|
1270
|
+
}
|
|
1271
|
+
};
|
|
1243
1272
|
const toggleWarningSubmit = () => setWarningSubmit((prevState) => !prevState);
|
|
1244
|
-
if (isLoadingDetails) {
|
|
1273
|
+
if (isLoadingDetails || isLoadingTimezone) {
|
|
1245
1274
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1246
1275
|
ReleaseDetailsLayout,
|
|
1247
1276
|
{
|
|
1248
1277
|
toggleEditReleaseModal,
|
|
1249
1278
|
toggleWarningSubmit,
|
|
1250
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1279
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {})
|
|
1251
1280
|
}
|
|
1252
1281
|
);
|
|
1253
1282
|
}
|
|
1283
|
+
if (!releaseId) {
|
|
1284
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: ".." });
|
|
1285
|
+
}
|
|
1254
1286
|
const releaseData = isSuccessDetails && data?.data || null;
|
|
1255
1287
|
const title = releaseData?.name || "";
|
|
1256
|
-
const timezone =
|
|
1288
|
+
const timezone = getTimezoneValue();
|
|
1257
1289
|
const scheduledAt = releaseData?.scheduledAt && timezone ? dateFnsTz.utcToZonedTime(releaseData.scheduledAt, timezone) : null;
|
|
1258
|
-
const date = scheduledAt ? format__default.default(scheduledAt, "yyyy-MM-dd") :
|
|
1290
|
+
const date = scheduledAt ? format__default.default(scheduledAt, "yyyy-MM-dd") : void 0;
|
|
1259
1291
|
const time = scheduledAt ? format__default.default(scheduledAt, "HH:mm") : "";
|
|
1260
1292
|
const handleEditRelease = async (values) => {
|
|
1261
1293
|
const response = await updateRelease({
|
|
@@ -1273,14 +1305,14 @@ const ReleaseDetailsPage = () => {
|
|
|
1273
1305
|
})
|
|
1274
1306
|
});
|
|
1275
1307
|
toggleEditReleaseModal();
|
|
1276
|
-
} else if (
|
|
1308
|
+
} else if (strapiAdmin.isFetchError(response.error)) {
|
|
1277
1309
|
toggleNotification({
|
|
1278
|
-
type: "
|
|
1310
|
+
type: "danger",
|
|
1279
1311
|
message: formatAPIError(response.error)
|
|
1280
1312
|
});
|
|
1281
1313
|
} else {
|
|
1282
1314
|
toggleNotification({
|
|
1283
|
-
type: "
|
|
1315
|
+
type: "danger",
|
|
1284
1316
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
1285
1317
|
});
|
|
1286
1318
|
}
|
|
@@ -1290,15 +1322,15 @@ const ReleaseDetailsPage = () => {
|
|
|
1290
1322
|
id: releaseId
|
|
1291
1323
|
});
|
|
1292
1324
|
if ("data" in response) {
|
|
1293
|
-
|
|
1294
|
-
} else if (
|
|
1325
|
+
navigate("..");
|
|
1326
|
+
} else if (strapiAdmin.isFetchError(response.error)) {
|
|
1295
1327
|
toggleNotification({
|
|
1296
|
-
type: "
|
|
1328
|
+
type: "danger",
|
|
1297
1329
|
message: formatAPIError(response.error)
|
|
1298
1330
|
});
|
|
1299
1331
|
} else {
|
|
1300
1332
|
toggleNotification({
|
|
1301
|
-
type: "
|
|
1333
|
+
type: "danger",
|
|
1302
1334
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
1303
1335
|
});
|
|
1304
1336
|
}
|
|
@@ -1309,10 +1341,11 @@ const ReleaseDetailsPage = () => {
|
|
|
1309
1341
|
toggleEditReleaseModal,
|
|
1310
1342
|
toggleWarningSubmit,
|
|
1311
1343
|
children: [
|
|
1312
|
-
/* @__PURE__ */ jsxRuntime.jsx(ReleaseDetailsBody, {}),
|
|
1313
|
-
|
|
1344
|
+
/* @__PURE__ */ jsxRuntime.jsx(ReleaseDetailsBody, { releaseId }),
|
|
1345
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1314
1346
|
ReleaseModal,
|
|
1315
1347
|
{
|
|
1348
|
+
open: releaseModalShown,
|
|
1316
1349
|
handleClose: toggleEditReleaseModal,
|
|
1317
1350
|
handleSubmit: handleEditRelease,
|
|
1318
1351
|
isLoading: isLoadingDetails || isSubmittingForm,
|
|
@@ -1326,28 +1359,19 @@ const ReleaseDetailsPage = () => {
|
|
|
1326
1359
|
}
|
|
1327
1360
|
}
|
|
1328
1361
|
),
|
|
1329
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
id: "content-releases.dialog.confirmation-message",
|
|
1334
|
-
defaultMessage: "Are you sure you want to delete this release?"
|
|
1335
|
-
},
|
|
1336
|
-
isOpen: showWarningSubmit,
|
|
1337
|
-
isConfirmButtonLoading: isDeletingRelease,
|
|
1338
|
-
onToggleDialog: toggleWarningSubmit,
|
|
1339
|
-
onConfirm: handleDeleteRelease
|
|
1340
|
-
}
|
|
1341
|
-
)
|
|
1362
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Root, { open: showWarningSubmit, onOpenChange: toggleWarningSubmit, children: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.ConfirmDialog, { onConfirm: handleDeleteRelease, children: formatMessage({
|
|
1363
|
+
id: "content-releases.dialog.confirmation-message",
|
|
1364
|
+
defaultMessage: "Are you sure you want to delete this release?"
|
|
1365
|
+
}) }) })
|
|
1342
1366
|
]
|
|
1343
1367
|
}
|
|
1344
1368
|
);
|
|
1345
1369
|
};
|
|
1346
1370
|
const App = () => {
|
|
1347
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1348
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, {
|
|
1349
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, {
|
|
1371
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Protect, { permissions: index.PERMISSIONS.main, children: /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.Routes, { children: [
|
|
1372
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { index: true, element: /* @__PURE__ */ jsxRuntime.jsx(ReleasesPage, {}) }),
|
|
1373
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: ":releaseId", element: /* @__PURE__ */ jsxRuntime.jsx(ReleaseDetailsPage, {}) })
|
|
1350
1374
|
] }) });
|
|
1351
1375
|
};
|
|
1352
1376
|
exports.App = App;
|
|
1353
|
-
//# sourceMappingURL=App-
|
|
1377
|
+
//# sourceMappingURL=App-DpoC8s97.js.map
|