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