@strapi/content-releases 0.0.0-experimental.d23c1d5b0e45dd06ef09977f526c85468be05403 → 0.0.0-experimental.d3243594aea3e6fa0ef08580192bb0df29c9162d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +17 -1
- package/dist/_chunks/{App-Cmn2Mkn7.mjs → App-BA2xDdy0.mjs} +435 -404
- package/dist/_chunks/App-BA2xDdy0.mjs.map +1 -0
- package/dist/_chunks/{App-FVorrIzF.js → App-D4Wira1X.js} +440 -411
- package/dist/_chunks/App-D4Wira1X.js.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-sD6ADHk2.js → PurchaseContentReleases-Be3acS2L.js} +7 -6
- package/dist/_chunks/PurchaseContentReleases-Be3acS2L.js.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-C8djn9fP.mjs → PurchaseContentReleases-_MxP6-Dt.mjs} +8 -7
- package/dist/_chunks/PurchaseContentReleases-_MxP6-Dt.mjs.map +1 -0
- package/dist/_chunks/ReleasesSettingsPage-BAlbMWpw.mjs +178 -0
- package/dist/_chunks/ReleasesSettingsPage-BAlbMWpw.mjs.map +1 -0
- package/dist/_chunks/ReleasesSettingsPage-xhFyRXCM.js +178 -0
- package/dist/_chunks/ReleasesSettingsPage-xhFyRXCM.js.map +1 -0
- package/dist/_chunks/{en-DtFJ5ViE.js → en-CmYoEnA7.js} +9 -2
- package/dist/_chunks/en-CmYoEnA7.js.map +1 -0
- package/dist/_chunks/{en-B9Ur3VsE.mjs → en-D0yVZFqf.mjs} +9 -2
- package/dist/_chunks/en-D0yVZFqf.mjs.map +1 -0
- package/dist/_chunks/{index-DDohgTaQ.mjs → index-CCFFG3Zs.mjs} +724 -604
- package/dist/_chunks/index-CCFFG3Zs.mjs.map +1 -0
- package/dist/_chunks/{index-BfJLth9Z.js → index-DxkQGp4N.js} +712 -594
- package/dist/_chunks/index-DxkQGp4N.js.map +1 -0
- package/dist/_chunks/schemas-BE1LxE9J.js +62 -0
- package/dist/_chunks/schemas-BE1LxE9J.js.map +1 -0
- package/dist/_chunks/schemas-DdA2ic2U.mjs +44 -0
- package/dist/_chunks/schemas-DdA2ic2U.mjs.map +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +2 -2
- package/dist/admin/src/components/ReleaseAction.d.ts +1 -1
- package/dist/admin/src/components/ReleaseActionMenu.d.ts +3 -3
- package/dist/admin/src/components/{CMReleasesContainer.d.ts → ReleaseActionModal.d.ts} +3 -1
- package/dist/admin/src/components/ReleaseListCell.d.ts +28 -0
- package/dist/admin/src/components/ReleaseModal.d.ts +3 -2
- package/dist/admin/src/components/ReleasesPanel.d.ts +3 -0
- package/dist/admin/src/constants.d.ts +18 -0
- package/dist/admin/src/modules/hooks.d.ts +7 -0
- package/dist/admin/src/pages/ReleasesSettingsPage.d.ts +1 -0
- package/dist/admin/src/services/release.d.ts +53 -370
- package/dist/admin/src/utils/api.d.ts +6 -0
- package/dist/admin/src/utils/time.d.ts +9 -0
- package/dist/admin/src/validation/schemas.d.ts +6 -0
- package/dist/server/index.js +782 -580
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +783 -581
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/bootstrap.d.ts.map +1 -1
- package/dist/server/src/constants.d.ts +11 -2
- package/dist/server/src/constants.d.ts.map +1 -1
- package/dist/server/src/content-types/index.d.ts +3 -5
- package/dist/server/src/content-types/index.d.ts.map +1 -1
- package/dist/server/src/content-types/release-action/index.d.ts +3 -5
- package/dist/server/src/content-types/release-action/index.d.ts.map +1 -1
- package/dist/server/src/content-types/release-action/schema.d.ts +3 -5
- package/dist/server/src/content-types/release-action/schema.d.ts.map +1 -1
- package/dist/server/src/controllers/index.d.ts +6 -1
- package/dist/server/src/controllers/index.d.ts.map +1 -1
- package/dist/server/src/controllers/release-action.d.ts.map +1 -1
- package/dist/server/src/controllers/release.d.ts +7 -1
- package/dist/server/src/controllers/release.d.ts.map +1 -1
- package/dist/server/src/controllers/settings.d.ts +11 -0
- package/dist/server/src/controllers/settings.d.ts.map +1 -0
- package/dist/server/src/controllers/validation/release-action.d.ts +7 -1
- package/dist/server/src/controllers/validation/release-action.d.ts.map +1 -1
- package/dist/server/src/controllers/validation/release.d.ts +2 -0
- package/dist/server/src/controllers/validation/release.d.ts.map +1 -1
- package/dist/server/src/controllers/validation/settings.d.ts +3 -0
- package/dist/server/src/controllers/validation/settings.d.ts.map +1 -0
- package/dist/server/src/index.d.ts +68 -49
- package/dist/server/src/index.d.ts.map +1 -1
- package/dist/server/src/middlewares/documents.d.ts +6 -0
- package/dist/server/src/middlewares/documents.d.ts.map +1 -0
- package/dist/server/src/migrations/database/5.0.0-document-id-in-actions.d.ts +9 -0
- package/dist/server/src/migrations/database/5.0.0-document-id-in-actions.d.ts.map +1 -0
- package/dist/server/src/migrations/index.d.ts.map +1 -1
- package/dist/server/src/register.d.ts.map +1 -1
- package/dist/server/src/routes/index.d.ts +16 -0
- package/dist/server/src/routes/index.d.ts.map +1 -1
- package/dist/server/src/routes/release.d.ts.map +1 -1
- package/dist/server/src/routes/settings.d.ts +18 -0
- package/dist/server/src/routes/settings.d.ts.map +1 -0
- package/dist/server/src/services/index.d.ts +40 -38
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/server/src/services/release-action.d.ts +38 -0
- package/dist/server/src/services/release-action.d.ts.map +1 -0
- package/dist/server/src/services/release.d.ts +6 -41
- package/dist/server/src/services/release.d.ts.map +1 -1
- package/dist/server/src/services/settings.d.ts +13 -0
- package/dist/server/src/services/settings.d.ts.map +1 -0
- package/dist/server/src/services/validation.d.ts +1 -1
- package/dist/server/src/services/validation.d.ts.map +1 -1
- package/dist/server/src/utils/index.d.ts +29 -8
- package/dist/server/src/utils/index.d.ts.map +1 -1
- package/dist/shared/contracts/release-actions.d.ts +9 -10
- package/dist/shared/contracts/release-actions.d.ts.map +1 -1
- package/dist/shared/contracts/releases.d.ts +9 -7
- package/dist/shared/contracts/releases.d.ts.map +1 -1
- package/dist/shared/contracts/settings.d.ts +39 -0
- package/dist/shared/contracts/settings.d.ts.map +1 -0
- package/package.json +19 -19
- package/dist/_chunks/App-Cmn2Mkn7.mjs.map +0 -1
- package/dist/_chunks/App-FVorrIzF.js.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-C8djn9fP.mjs.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-sD6ADHk2.js.map +0 -1
- package/dist/_chunks/en-B9Ur3VsE.mjs.map +0 -1
- package/dist/_chunks/en-DtFJ5ViE.js.map +0 -1
- package/dist/_chunks/index-BfJLth9Z.js.map +0 -1
- package/dist/_chunks/index-DDohgTaQ.mjs.map +0 -1
- package/dist/admin/src/services/axios.d.ts +0 -29
- package/dist/shared/validation-schemas.d.ts +0 -2
- package/dist/shared/validation-schemas.d.ts.map +0 -1
- package/strapi-server.js +0 -3
|
@@ -3,19 +3,19 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const strapiAdmin = require("@strapi/admin/strapi-admin");
|
|
5
5
|
const reactRouterDom = require("react-router-dom");
|
|
6
|
-
const index = require("./index-
|
|
6
|
+
const index = require("./index-DxkQGp4N.js");
|
|
7
7
|
const React = require("react");
|
|
8
|
+
const strapiAdmin$1 = require("@strapi/content-manager/strapi-admin");
|
|
8
9
|
const designSystem = require("@strapi/design-system");
|
|
9
|
-
const v2 = require("@strapi/design-system/v2");
|
|
10
10
|
const icons = require("@strapi/icons");
|
|
11
|
-
const
|
|
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
|
|
18
|
+
const schemas = require("./schemas-BE1LxE9J.js");
|
|
19
19
|
const reactRedux = require("react-redux");
|
|
20
20
|
const ee = require("@strapi/admin/strapi-admin/ee");
|
|
21
21
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
@@ -39,8 +39,6 @@ function _interopNamespace(e) {
|
|
|
39
39
|
}
|
|
40
40
|
const React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
|
41
41
|
const format__default = /* @__PURE__ */ _interopDefault(format);
|
|
42
|
-
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
43
|
-
const yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
|
|
44
42
|
const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
|
|
45
43
|
const RelativeTime$1 = React__namespace.forwardRef(
|
|
46
44
|
({ timestamp, customIntervals = [], ...restProps }, forwardedRef) => {
|
|
@@ -71,28 +69,9 @@ const RelativeTime$1 = React__namespace.forwardRef(
|
|
|
71
69
|
);
|
|
72
70
|
}
|
|
73
71
|
);
|
|
74
|
-
const RELEASE_SCHEMA = yup__namespace.object().shape({
|
|
75
|
-
name: yup__namespace.string().trim().required(),
|
|
76
|
-
scheduledAt: yup__namespace.string().nullable(),
|
|
77
|
-
isScheduled: yup__namespace.boolean().optional(),
|
|
78
|
-
time: yup__namespace.string().when("isScheduled", {
|
|
79
|
-
is: true,
|
|
80
|
-
then: yup__namespace.string().trim().required(),
|
|
81
|
-
otherwise: yup__namespace.string().nullable()
|
|
82
|
-
}),
|
|
83
|
-
timezone: yup__namespace.string().when("isScheduled", {
|
|
84
|
-
is: true,
|
|
85
|
-
then: yup__namespace.string().required().nullable(),
|
|
86
|
-
otherwise: yup__namespace.string().nullable()
|
|
87
|
-
}),
|
|
88
|
-
date: yup__namespace.string().when("isScheduled", {
|
|
89
|
-
is: true,
|
|
90
|
-
then: yup__namespace.string().required().nullable(),
|
|
91
|
-
otherwise: yup__namespace.string().nullable()
|
|
92
|
-
})
|
|
93
|
-
}).required().noUnknown();
|
|
94
72
|
const ReleaseModal = ({
|
|
95
73
|
handleClose,
|
|
74
|
+
open,
|
|
96
75
|
handleSubmit,
|
|
97
76
|
initialValues,
|
|
98
77
|
isLoading = false
|
|
@@ -100,7 +79,7 @@ const ReleaseModal = ({
|
|
|
100
79
|
const { formatMessage } = reactIntl.useIntl();
|
|
101
80
|
const { pathname } = reactRouterDom.useLocation();
|
|
102
81
|
const isCreatingRelease = pathname === `/plugins/${index.pluginId}`;
|
|
103
|
-
const { timezoneList, systemTimezone = { value: "UTC+00:00-Africa/Abidjan " } } = getTimezones(
|
|
82
|
+
const { timezoneList, systemTimezone = { value: "UTC+00:00-Africa/Abidjan " } } = index.getTimezones(
|
|
104
83
|
initialValues.scheduledAt ? new Date(initialValues.scheduledAt) : /* @__PURE__ */ new Date()
|
|
105
84
|
);
|
|
106
85
|
const getScheduledTimestamp = (values) => {
|
|
@@ -116,8 +95,8 @@ const ReleaseModal = ({
|
|
|
116
95
|
);
|
|
117
96
|
return currentTimezone?.value || systemTimezone.value;
|
|
118
97
|
};
|
|
119
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
120
|
-
/* @__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(
|
|
121
100
|
{
|
|
122
101
|
id: "content-releases.modal.title",
|
|
123
102
|
defaultMessage: "{isCreatingRelease, select, true {New release} other {Edit release}}"
|
|
@@ -138,135 +117,145 @@ const ReleaseModal = ({
|
|
|
138
117
|
...initialValues,
|
|
139
118
|
timezone: initialValues.timezone ? getTimezoneWithOffset() : systemTimezone.value
|
|
140
119
|
},
|
|
141
|
-
validationSchema: RELEASE_SCHEMA,
|
|
120
|
+
validationSchema: schemas.RELEASE_SCHEMA,
|
|
142
121
|
validateOnChange: false,
|
|
143
|
-
children: ({ values, errors, handleChange, setFieldValue }) =>
|
|
144
|
-
|
|
145
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
defaultMessage:
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
setFieldValue("
|
|
169
|
-
|
|
170
|
-
} else {
|
|
171
|
-
setFieldValue("date", initialValues.date);
|
|
172
|
-
setFieldValue("time", initialValues.time);
|
|
173
|
-
setFieldValue("timezone", initialValues.timezone ?? systemTimezone?.value);
|
|
174
|
-
}
|
|
175
|
-
},
|
|
176
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
177
|
-
designSystem.Typography,
|
|
178
|
-
{
|
|
179
|
-
textColor: values.isScheduled ? "primary600" : "neutral800",
|
|
180
|
-
fontWeight: values.isScheduled ? "semiBold" : "regular",
|
|
181
|
-
children: formatMessage({
|
|
182
|
-
id: "modal.form.input.label.schedule-release",
|
|
183
|
-
defaultMessage: "Schedule release"
|
|
184
|
-
})
|
|
185
|
-
}
|
|
186
|
-
)
|
|
187
|
-
}
|
|
188
|
-
) }),
|
|
189
|
-
values.isScheduled && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
190
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, alignItems: "start", children: [
|
|
191
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
192
|
-
designSystem.DatePicker,
|
|
193
|
-
{
|
|
194
|
-
label: formatMessage({
|
|
195
|
-
id: "content-releases.modal.form.input.label.date",
|
|
196
|
-
defaultMessage: "Date"
|
|
197
|
-
}),
|
|
198
|
-
name: "date",
|
|
199
|
-
error: errors.date,
|
|
200
|
-
onChange: (date) => {
|
|
201
|
-
const isoFormatDate = date ? dateFns.formatISO(date, { representation: "date" }) : null;
|
|
202
|
-
setFieldValue("date", isoFormatDate);
|
|
203
|
-
},
|
|
204
|
-
clearLabel: formatMessage({
|
|
205
|
-
id: "content-releases.modal.form.input.clearLabel",
|
|
206
|
-
defaultMessage: "Clear"
|
|
207
|
-
}),
|
|
208
|
-
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) {
|
|
209
149
|
setFieldValue("date", null);
|
|
210
|
-
},
|
|
211
|
-
selectedDate: values.date || void 0,
|
|
212
|
-
required: true,
|
|
213
|
-
minDate: dateFnsTz.utcToZonedTime(/* @__PURE__ */ new Date(), values.timezone.split("&")[1])
|
|
214
|
-
}
|
|
215
|
-
) }),
|
|
216
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
217
|
-
designSystem.TimePicker,
|
|
218
|
-
{
|
|
219
|
-
label: formatMessage({
|
|
220
|
-
id: "content-releases.modal.form.input.label.time",
|
|
221
|
-
defaultMessage: "Time"
|
|
222
|
-
}),
|
|
223
|
-
name: "time",
|
|
224
|
-
error: errors.time,
|
|
225
|
-
onChange: (time) => {
|
|
226
|
-
setFieldValue("time", time);
|
|
227
|
-
},
|
|
228
|
-
clearLabel: formatMessage({
|
|
229
|
-
id: "content-releases.modal.form.input.clearLabel",
|
|
230
|
-
defaultMessage: "Clear"
|
|
231
|
-
}),
|
|
232
|
-
onClear: () => {
|
|
233
150
|
setFieldValue("time", "");
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
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(
|
|
248
247
|
{
|
|
249
248
|
id: "content-releases.modal.form.button.submit",
|
|
250
249
|
defaultMessage: "{isCreatingRelease, select, true {Continue} other {Save}}"
|
|
251
250
|
},
|
|
252
251
|
{ isCreatingRelease }
|
|
253
252
|
) })
|
|
254
|
-
}
|
|
255
|
-
)
|
|
256
|
-
|
|
253
|
+
] })
|
|
254
|
+
] });
|
|
255
|
+
}
|
|
257
256
|
}
|
|
258
257
|
)
|
|
259
|
-
] });
|
|
260
|
-
};
|
|
261
|
-
const getTimezones = (selectedDate) => {
|
|
262
|
-
const timezoneList = Intl.supportedValuesOf("timeZone").map((timezone) => {
|
|
263
|
-
const utcOffset = index.getTimezoneOffset(timezone, selectedDate);
|
|
264
|
-
return { offset: utcOffset, value: `${utcOffset}&${timezone}` };
|
|
265
|
-
});
|
|
266
|
-
const systemTimezone = timezoneList.find(
|
|
267
|
-
(timezone) => timezone.value.split("&")[1] === Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
268
|
-
);
|
|
269
|
-
return { timezoneList, systemTimezone };
|
|
258
|
+
] }) });
|
|
270
259
|
};
|
|
271
260
|
const TimezoneComponent = ({ timezoneOptions }) => {
|
|
272
261
|
const { values, errors, setFieldValue } = formik.useFormikContext();
|
|
@@ -274,7 +263,7 @@ const TimezoneComponent = ({ timezoneOptions }) => {
|
|
|
274
263
|
const [timezoneList, setTimezoneList] = React__namespace.useState(timezoneOptions);
|
|
275
264
|
React__namespace.useEffect(() => {
|
|
276
265
|
if (values.date) {
|
|
277
|
-
const { timezoneList: timezoneList2 } = getTimezones(new Date(values.date));
|
|
266
|
+
const { timezoneList: timezoneList2 } = index.getTimezones(new Date(values.date));
|
|
278
267
|
setTimezoneList(timezoneList2);
|
|
279
268
|
const updatedTimezone = values.timezone && timezoneList2.find((tz) => tz.value.split("&")[1] === values.timezone.split("&")[1]);
|
|
280
269
|
if (updatedTimezone) {
|
|
@@ -282,37 +271,48 @@ const TimezoneComponent = ({ timezoneOptions }) => {
|
|
|
282
271
|
}
|
|
283
272
|
}
|
|
284
273
|
}, [setFieldValue, values.date, values.timezone]);
|
|
285
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
286
|
-
designSystem.
|
|
274
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
275
|
+
designSystem.Field.Root,
|
|
287
276
|
{
|
|
288
|
-
label: formatMessage({
|
|
289
|
-
id: "content-releases.modal.form.input.label.timezone",
|
|
290
|
-
defaultMessage: "Timezone"
|
|
291
|
-
}),
|
|
292
|
-
autocomplete: { type: "list", filter: "contains" },
|
|
293
277
|
name: "timezone",
|
|
294
|
-
|
|
295
|
-
textValue: values.timezone ? values.timezone.replace(/&/, " ") : void 0,
|
|
296
|
-
onChange: (timezone) => {
|
|
297
|
-
setFieldValue("timezone", timezone);
|
|
298
|
-
},
|
|
299
|
-
onTextValueChange: (timezone) => {
|
|
300
|
-
setFieldValue("timezone", timezone);
|
|
301
|
-
},
|
|
302
|
-
onClear: () => {
|
|
303
|
-
setFieldValue("timezone", "");
|
|
304
|
-
},
|
|
305
|
-
error: errors.timezone,
|
|
278
|
+
error: errors.timezone && formatMessage({ id: errors.timezone, defaultMessage: errors.timezone }),
|
|
306
279
|
required: true,
|
|
307
|
-
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
|
+
]
|
|
308
305
|
}
|
|
309
306
|
);
|
|
310
307
|
};
|
|
311
308
|
const useTypedDispatch = reactRedux.useDispatch;
|
|
312
|
-
const
|
|
309
|
+
const isBaseQueryError = (error) => {
|
|
310
|
+
return typeof error !== "undefined" && error.name !== void 0;
|
|
311
|
+
};
|
|
312
|
+
const LinkCard = styledComponents.styled(designSystem.Link)`
|
|
313
313
|
display: block;
|
|
314
314
|
`;
|
|
315
|
-
const RelativeTime =
|
|
315
|
+
const RelativeTime = styledComponents.styled(RelativeTime$1)`
|
|
316
316
|
display: inline-block;
|
|
317
317
|
&::first-letter {
|
|
318
318
|
text-transform: uppercase;
|
|
@@ -361,11 +361,11 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
361
361
|
target: sectionTitle
|
|
362
362
|
}
|
|
363
363
|
),
|
|
364
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
364
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(symbols.EmptyDocuments, { width: "16rem" })
|
|
365
365
|
}
|
|
366
366
|
);
|
|
367
367
|
}
|
|
368
|
-
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(
|
|
369
369
|
designSystem.Flex,
|
|
370
370
|
{
|
|
371
371
|
direction: "column",
|
|
@@ -380,7 +380,7 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
380
380
|
gap: 4,
|
|
381
381
|
children: [
|
|
382
382
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "start", gap: 1, children: [
|
|
383
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, {
|
|
383
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", tag: "h3", variant: "delta", fontWeight: "bold", children: name }),
|
|
384
384
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: scheduledAt ? /* @__PURE__ */ jsxRuntime.jsx(RelativeTime, { timestamp: new Date(scheduledAt) }) : formatMessage({
|
|
385
385
|
id: "content-releases.pages.Releases.not-scheduled",
|
|
386
386
|
defaultMessage: "Not scheduled"
|
|
@@ -391,7 +391,7 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
391
391
|
}
|
|
392
392
|
) }) }, id)) });
|
|
393
393
|
};
|
|
394
|
-
const StyledAlert =
|
|
394
|
+
const StyledAlert = styledComponents.styled(designSystem.Alert)`
|
|
395
395
|
button {
|
|
396
396
|
display: none;
|
|
397
397
|
}
|
|
@@ -401,14 +401,13 @@ const StyledAlert = styled__default.default(designSystem.Alert)`
|
|
|
401
401
|
`;
|
|
402
402
|
const INITIAL_FORM_VALUES = {
|
|
403
403
|
name: "",
|
|
404
|
-
date:
|
|
404
|
+
date: dateFns.format(/* @__PURE__ */ new Date(), "yyyy-MM-dd"),
|
|
405
405
|
time: "",
|
|
406
406
|
isScheduled: true,
|
|
407
407
|
scheduledAt: null,
|
|
408
408
|
timezone: null
|
|
409
409
|
};
|
|
410
410
|
const ReleasesPage = () => {
|
|
411
|
-
const tabRef = React__namespace.useRef(null);
|
|
412
411
|
const location = reactRouterDom.useLocation();
|
|
413
412
|
const [releaseModalShown, setReleaseModalShown] = React__namespace.useState(false);
|
|
414
413
|
const { toggleNotification } = strapiAdmin.useNotification();
|
|
@@ -417,6 +416,7 @@ const ReleasesPage = () => {
|
|
|
417
416
|
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
418
417
|
const [{ query }, setQuery] = strapiAdmin.useQueryParams();
|
|
419
418
|
const response = index.useGetReleasesQuery(query);
|
|
419
|
+
const { data, isLoading: isLoadingSettings } = index.useGetReleaseSettingsQuery();
|
|
420
420
|
const [createRelease, { isLoading: isSubmittingForm }] = index.useCreateReleaseMutation();
|
|
421
421
|
const { getFeature } = ee.useLicenseLimits();
|
|
422
422
|
const { maximumReleases = 3 } = getFeature("cms-content-releases");
|
|
@@ -424,9 +424,8 @@ const ReleasesPage = () => {
|
|
|
424
424
|
const {
|
|
425
425
|
allowedActions: { canCreate }
|
|
426
426
|
} = strapiAdmin.useRBAC(index.PERMISSIONS);
|
|
427
|
-
const { isLoading, isSuccess, isError } = response;
|
|
427
|
+
const { isLoading: isLoadingReleases, isSuccess, isError } = response;
|
|
428
428
|
const activeTab = response?.currentData?.meta?.activeTab || "pending";
|
|
429
|
-
const activeTabIndex = ["pending", "done"].indexOf(activeTab);
|
|
430
429
|
React__namespace.useEffect(() => {
|
|
431
430
|
if (location?.state?.errors) {
|
|
432
431
|
toggleNotification({
|
|
@@ -443,27 +442,22 @@ const ReleasesPage = () => {
|
|
|
443
442
|
navigate("", { replace: true, state: null });
|
|
444
443
|
}
|
|
445
444
|
}, [formatMessage, location?.state?.errors, navigate, toggleNotification]);
|
|
446
|
-
React__namespace.useEffect(() => {
|
|
447
|
-
if (tabRef.current) {
|
|
448
|
-
tabRef.current._handlers.setSelectedTabIndex(activeTabIndex);
|
|
449
|
-
}
|
|
450
|
-
}, [activeTabIndex]);
|
|
451
445
|
const toggleAddReleaseModal = () => {
|
|
452
446
|
setReleaseModalShown((prev) => !prev);
|
|
453
447
|
};
|
|
454
|
-
if (
|
|
448
|
+
if (isLoadingReleases || isLoadingSettings) {
|
|
455
449
|
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
|
|
456
450
|
}
|
|
457
451
|
const totalPendingReleases = isSuccess && response.currentData?.meta?.pendingReleasesCount || 0;
|
|
458
452
|
const hasReachedMaximumPendingReleases = totalPendingReleases >= maximumReleases;
|
|
459
|
-
const handleTabChange = (
|
|
453
|
+
const handleTabChange = (tabValue) => {
|
|
460
454
|
setQuery({
|
|
461
455
|
...query,
|
|
462
456
|
page: 1,
|
|
463
457
|
pageSize: response?.currentData?.meta?.pagination?.pageSize || 16,
|
|
464
458
|
filters: {
|
|
465
459
|
releasedAt: {
|
|
466
|
-
$notNull:
|
|
460
|
+
$notNull: tabValue !== "pending"
|
|
467
461
|
}
|
|
468
462
|
}
|
|
469
463
|
});
|
|
@@ -484,7 +478,7 @@ const ReleasesPage = () => {
|
|
|
484
478
|
});
|
|
485
479
|
trackUsage("didCreateRelease");
|
|
486
480
|
navigate(response2.data.data.id.toString());
|
|
487
|
-
} else if (
|
|
481
|
+
} else if (strapiAdmin.isFetchError(response2.error)) {
|
|
488
482
|
toggleNotification({
|
|
489
483
|
type: "danger",
|
|
490
484
|
message: formatAPIError(response2.error)
|
|
@@ -496,9 +490,9 @@ const ReleasesPage = () => {
|
|
|
496
490
|
});
|
|
497
491
|
}
|
|
498
492
|
};
|
|
499
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { "aria-busy":
|
|
493
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { "aria-busy": isLoadingReleases || isLoadingSettings, children: [
|
|
500
494
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
501
|
-
|
|
495
|
+
strapiAdmin.Layouts.Header,
|
|
502
496
|
{
|
|
503
497
|
title: formatMessage({
|
|
504
498
|
id: "content-releases.pages.Releases.title",
|
|
@@ -522,12 +516,12 @@ const ReleasesPage = () => {
|
|
|
522
516
|
) : null
|
|
523
517
|
}
|
|
524
518
|
),
|
|
525
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
519
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
526
520
|
hasReachedMaximumPendingReleases && /* @__PURE__ */ jsxRuntime.jsx(
|
|
527
521
|
StyledAlert,
|
|
528
522
|
{
|
|
529
523
|
marginBottom: 6,
|
|
530
|
-
action: /* @__PURE__ */ jsxRuntime.jsx(
|
|
524
|
+
action: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Link, { href: "https://strapi.io/pricing-cloud", isExternal: true, children: formatMessage({
|
|
531
525
|
id: "content-releases.pages.Releases.max-limit-reached.action",
|
|
532
526
|
defaultMessage: "Explore plans"
|
|
533
527
|
}) }),
|
|
@@ -547,21 +541,17 @@ const ReleasesPage = () => {
|
|
|
547
541
|
})
|
|
548
542
|
}
|
|
549
543
|
),
|
|
550
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
551
|
-
designSystem.
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
children: [
|
|
562
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { paddingBottom: 8, children: [
|
|
563
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tabs, { children: [
|
|
564
|
-
/* @__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(
|
|
565
555
|
{
|
|
566
556
|
id: "content-releases.pages.Releases.tab.pending",
|
|
567
557
|
defaultMessage: "Pending ({count})"
|
|
@@ -570,34 +560,32 @@ const ReleasesPage = () => {
|
|
|
570
560
|
count: totalPendingReleases
|
|
571
561
|
}
|
|
572
562
|
) }),
|
|
573
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
563
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Trigger, { value: "done", children: formatMessage({
|
|
574
564
|
id: "content-releases.pages.Releases.tab.done",
|
|
575
565
|
defaultMessage: "Done"
|
|
576
566
|
}) })
|
|
577
|
-
]
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
}
|
|
600
|
-
),
|
|
567
|
+
]
|
|
568
|
+
}
|
|
569
|
+
),
|
|
570
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Divider, {})
|
|
571
|
+
] }),
|
|
572
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Content, { value: "pending", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
573
|
+
ReleasesGrid,
|
|
574
|
+
{
|
|
575
|
+
sectionTitle: "pending",
|
|
576
|
+
releases: response?.currentData?.data,
|
|
577
|
+
isError
|
|
578
|
+
}
|
|
579
|
+
) }),
|
|
580
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Content, { value: "done", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
581
|
+
ReleasesGrid,
|
|
582
|
+
{
|
|
583
|
+
sectionTitle: "done",
|
|
584
|
+
releases: response?.currentData?.data,
|
|
585
|
+
isError
|
|
586
|
+
}
|
|
587
|
+
) })
|
|
588
|
+
] }),
|
|
601
589
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
602
590
|
strapiAdmin.Pagination.Root,
|
|
603
591
|
{
|
|
@@ -610,24 +598,28 @@ const ReleasesPage = () => {
|
|
|
610
598
|
}
|
|
611
599
|
)
|
|
612
600
|
] }) }),
|
|
613
|
-
|
|
601
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
614
602
|
ReleaseModal,
|
|
615
603
|
{
|
|
604
|
+
open: releaseModalShown,
|
|
616
605
|
handleClose: toggleAddReleaseModal,
|
|
617
606
|
handleSubmit: handleAddRelease,
|
|
618
607
|
isLoading: isSubmittingForm,
|
|
619
|
-
initialValues:
|
|
608
|
+
initialValues: {
|
|
609
|
+
...INITIAL_FORM_VALUES,
|
|
610
|
+
timezone: data?.data.defaultTimezone ? data.data.defaultTimezone.split("&")[1] : null
|
|
611
|
+
}
|
|
620
612
|
}
|
|
621
613
|
)
|
|
622
614
|
] });
|
|
623
615
|
};
|
|
624
|
-
const ReleaseInfoWrapper =
|
|
616
|
+
const ReleaseInfoWrapper = styledComponents.styled(designSystem.Flex)`
|
|
625
617
|
align-self: stretch;
|
|
626
618
|
border-bottom-right-radius: ${({ theme }) => theme.borderRadius};
|
|
627
619
|
border-bottom-left-radius: ${({ theme }) => theme.borderRadius};
|
|
628
620
|
border-top: 1px solid ${({ theme }) => theme.colors.neutral150};
|
|
629
621
|
`;
|
|
630
|
-
const StyledMenuItem =
|
|
622
|
+
const StyledMenuItem = styledComponents.styled(designSystem.MenuItem)`
|
|
631
623
|
svg path {
|
|
632
624
|
fill: ${({ theme, disabled }) => disabled && theme.colors.neutral500};
|
|
633
625
|
}
|
|
@@ -636,64 +628,113 @@ const StyledMenuItem = styled__default.default(v2.Menu.Item)`
|
|
|
636
628
|
}
|
|
637
629
|
|
|
638
630
|
&:hover {
|
|
639
|
-
background: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}100`]};
|
|
631
|
+
background: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}100`]};
|
|
640
632
|
}
|
|
641
633
|
`;
|
|
642
|
-
const PencilIcon =
|
|
643
|
-
width: ${({ theme }) => theme.spaces[
|
|
644
|
-
height: ${({ theme }) => theme.spaces[
|
|
634
|
+
const PencilIcon = styledComponents.styled(icons.Pencil)`
|
|
635
|
+
width: ${({ theme }) => theme.spaces[4]};
|
|
636
|
+
height: ${({ theme }) => theme.spaces[4]};
|
|
645
637
|
path {
|
|
646
638
|
fill: ${({ theme }) => theme.colors.neutral600};
|
|
647
639
|
}
|
|
648
640
|
`;
|
|
649
|
-
const TrashIcon =
|
|
650
|
-
width: ${({ theme }) => theme.spaces[
|
|
651
|
-
height: ${({ theme }) => theme.spaces[
|
|
641
|
+
const TrashIcon = styledComponents.styled(icons.Trash)`
|
|
642
|
+
width: ${({ theme }) => theme.spaces[4]};
|
|
643
|
+
height: ${({ theme }) => theme.spaces[4]};
|
|
652
644
|
path {
|
|
653
645
|
fill: ${({ theme }) => theme.colors.danger600};
|
|
654
646
|
}
|
|
655
647
|
`;
|
|
656
|
-
const TypographyMaxWidth =
|
|
648
|
+
const TypographyMaxWidth = styledComponents.styled(designSystem.Typography)`
|
|
657
649
|
max-width: 300px;
|
|
658
650
|
`;
|
|
659
|
-
const EntryValidationText = ({ action, schema, entry }) => {
|
|
651
|
+
const EntryValidationText = ({ action, schema, entry, status }) => {
|
|
660
652
|
const { formatMessage } = reactIntl.useIntl();
|
|
661
|
-
const { validate } = strapiAdmin$1.unstable_useDocument(
|
|
653
|
+
const { validate, isLoading } = strapiAdmin$1.unstable_useDocument(
|
|
662
654
|
{
|
|
663
655
|
collectionType: schema?.kind ?? "",
|
|
664
656
|
model: schema?.uid ?? ""
|
|
665
657
|
},
|
|
666
658
|
{
|
|
667
|
-
skip
|
|
659
|
+
// useDocument makes a request to get more data about the entry, but we only want to have the validation function so we skip the request
|
|
660
|
+
skip: true
|
|
668
661
|
}
|
|
669
662
|
);
|
|
670
|
-
const
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
663
|
+
const errorsToString = (errors2, prefix = "") => {
|
|
664
|
+
if (Object.keys(errors2).length === 0) {
|
|
665
|
+
return "";
|
|
666
|
+
}
|
|
667
|
+
return Object.entries(errors2).map(([key, value]) => {
|
|
668
|
+
if (value === void 0 || value === null) {
|
|
669
|
+
return "";
|
|
670
|
+
}
|
|
671
|
+
if (typeof value === "string") {
|
|
672
|
+
return formatMessage(
|
|
673
|
+
{ id: value, defaultMessage: value },
|
|
674
|
+
{ field: prefix ? `${prefix}.${key}` : key }
|
|
675
|
+
);
|
|
676
|
+
}
|
|
677
|
+
if (typeof value === "object" && value !== null && "id" in value && "defaultMessage" in value) {
|
|
678
|
+
return formatMessage(
|
|
679
|
+
// @ts-expect-error – TODO: default message will be a string
|
|
680
|
+
{ id: `${value.id}.withField`, defaultMessage: value.defaultMessage },
|
|
681
|
+
{ field: prefix ? `${prefix}.${key}` : key }
|
|
682
|
+
);
|
|
683
|
+
}
|
|
684
|
+
return errorsToString(value, key);
|
|
685
|
+
}).join(" ");
|
|
686
|
+
};
|
|
687
|
+
if (isLoading) {
|
|
688
|
+
return null;
|
|
682
689
|
}
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
690
|
+
const errors = validate(entry) ?? {};
|
|
691
|
+
if (action === "publish") {
|
|
692
|
+
if (Object.keys(errors).length > 0) {
|
|
693
|
+
const validationErrorsMessages = errorsToString(errors);
|
|
694
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
695
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.CrossCircle, { fill: "danger600" }),
|
|
696
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tooltip, { description: validationErrorsMessages, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
697
|
+
TypographyMaxWidth,
|
|
698
|
+
{
|
|
699
|
+
textColor: "danger600",
|
|
700
|
+
variant: "omega",
|
|
701
|
+
fontWeight: "semiBold",
|
|
702
|
+
ellipsis: true,
|
|
703
|
+
children: validationErrorsMessages
|
|
704
|
+
}
|
|
705
|
+
) })
|
|
706
|
+
] });
|
|
707
|
+
}
|
|
708
|
+
if (status === "draft") {
|
|
709
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
710
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
|
711
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
|
|
712
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.ready-to-publish",
|
|
713
|
+
defaultMessage: "Ready to publish"
|
|
714
|
+
}) })
|
|
715
|
+
] });
|
|
716
|
+
}
|
|
717
|
+
if (status === "modified") {
|
|
718
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
719
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.ArrowsCounterClockwise, { fill: "alternative600" }),
|
|
720
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
|
|
721
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.modified",
|
|
722
|
+
defaultMessage: "Ready to publish changes"
|
|
723
|
+
}) })
|
|
724
|
+
] });
|
|
725
|
+
}
|
|
726
|
+
if (status === "published") {
|
|
727
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
728
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
|
729
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
|
|
730
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.already-published",
|
|
731
|
+
defaultMessage: "Already published"
|
|
732
|
+
}) })
|
|
733
|
+
] });
|
|
734
|
+
}
|
|
694
735
|
}
|
|
695
736
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
696
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
737
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
|
697
738
|
!entry.publishedAt ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "success600", fontWeight: "bold", children: formatMessage({
|
|
698
739
|
id: "content-releases.pages.ReleaseDetails.entry-validation.already-unpublished",
|
|
699
740
|
defaultMessage: "Already unpublished"
|
|
@@ -713,7 +754,6 @@ const ReleaseDetailsLayout = ({
|
|
|
713
754
|
const {
|
|
714
755
|
data,
|
|
715
756
|
isLoading: isLoadingDetails,
|
|
716
|
-
isError,
|
|
717
757
|
error
|
|
718
758
|
} = index.useGetReleaseQuery(
|
|
719
759
|
{ id: releaseId },
|
|
@@ -745,7 +785,7 @@ const ReleaseDetailsLayout = ({
|
|
|
745
785
|
totalPublishedEntries,
|
|
746
786
|
totalUnpublishedEntries
|
|
747
787
|
});
|
|
748
|
-
} else if (
|
|
788
|
+
} else if (strapiAdmin.isFetchError(response.error)) {
|
|
749
789
|
toggleNotification({
|
|
750
790
|
type: "danger",
|
|
751
791
|
message: formatAPIError(response.error)
|
|
@@ -780,7 +820,7 @@ const ReleaseDetailsLayout = ({
|
|
|
780
820
|
if (isLoadingDetails) {
|
|
781
821
|
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
|
|
782
822
|
}
|
|
783
|
-
if (
|
|
823
|
+
if (isBaseQueryError(error) && "code" in error || !release) {
|
|
784
824
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
785
825
|
reactRouterDom.Navigate,
|
|
786
826
|
{
|
|
@@ -788,6 +828,7 @@ const ReleaseDetailsLayout = ({
|
|
|
788
828
|
state: {
|
|
789
829
|
errors: [
|
|
790
830
|
{
|
|
831
|
+
// @ts-expect-error – TODO: fix this weird error flow
|
|
791
832
|
code: error?.code
|
|
792
833
|
}
|
|
793
834
|
]
|
|
@@ -827,7 +868,7 @@ const ReleaseDetailsLayout = ({
|
|
|
827
868
|
) : "";
|
|
828
869
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { "aria-busy": isLoadingDetails, children: [
|
|
829
870
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
830
|
-
|
|
871
|
+
strapiAdmin.Layouts.Header,
|
|
831
872
|
{
|
|
832
873
|
title: release.name,
|
|
833
874
|
subtitle: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, lineHeight: 6, children: [
|
|
@@ -836,84 +877,71 @@ const ReleaseDetailsLayout = ({
|
|
|
836
877
|
] }),
|
|
837
878
|
navigationAction: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.BackButton, {}),
|
|
838
879
|
primaryAction: !release.releasedAt && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
839
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
{
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
880
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
881
|
+
SimpleMenuButton,
|
|
882
|
+
{
|
|
883
|
+
label: /* @__PURE__ */ jsxRuntime.jsx(icons.More, {}),
|
|
884
|
+
variant: "tertiary",
|
|
885
|
+
endIcon: null,
|
|
886
|
+
paddingLeft: "7px",
|
|
887
|
+
paddingRight: "7px",
|
|
888
|
+
"aria-label": formatMessage({
|
|
889
|
+
id: "content-releases.header.actions.open-release-actions",
|
|
890
|
+
defaultMessage: "Release edit and delete menu"
|
|
891
|
+
}),
|
|
892
|
+
popoverPlacement: "bottom-end",
|
|
893
|
+
children: [
|
|
894
|
+
/* @__PURE__ */ jsxRuntime.jsx(StyledMenuItem, { disabled: !canUpdate, onSelect: toggleEditReleaseModal, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 2, hasRadius: true, width: "100%", children: [
|
|
895
|
+
/* @__PURE__ */ jsxRuntime.jsx(PencilIcon, {}),
|
|
896
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { ellipsis: true, children: formatMessage({
|
|
897
|
+
id: "content-releases.header.actions.edit",
|
|
898
|
+
defaultMessage: "Edit"
|
|
899
|
+
}) })
|
|
900
|
+
] }) }),
|
|
901
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
902
|
+
StyledMenuItem,
|
|
903
|
+
{
|
|
904
|
+
disabled: !canDelete,
|
|
905
|
+
onSelect: toggleWarningSubmit,
|
|
906
|
+
$variant: "danger",
|
|
907
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 2, hasRadius: true, width: "100%", children: [
|
|
908
|
+
/* @__PURE__ */ jsxRuntime.jsx(TrashIcon, {}),
|
|
909
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { ellipsis: true, textColor: "danger600", children: formatMessage({
|
|
910
|
+
id: "content-releases.header.actions.delete",
|
|
911
|
+
defaultMessage: "Delete"
|
|
869
912
|
}) })
|
|
870
|
-
] }) }),
|
|
871
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
872
|
-
StyledMenuItem,
|
|
873
|
-
{
|
|
874
|
-
disabled: !canDelete,
|
|
875
|
-
onSelect: toggleWarningSubmit,
|
|
876
|
-
variant: "danger",
|
|
877
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 2, hasRadius: true, width: "100%", children: [
|
|
878
|
-
/* @__PURE__ */ jsxRuntime.jsx(TrashIcon, {}),
|
|
879
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { ellipsis: true, textColor: "danger600", children: formatMessage({
|
|
880
|
-
id: "content-releases.header.actions.delete",
|
|
881
|
-
defaultMessage: "Delete"
|
|
882
|
-
}) })
|
|
883
|
-
] })
|
|
884
|
-
}
|
|
885
|
-
)
|
|
886
|
-
]
|
|
887
|
-
}
|
|
888
|
-
),
|
|
889
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
890
|
-
ReleaseInfoWrapper,
|
|
891
|
-
{
|
|
892
|
-
direction: "column",
|
|
893
|
-
justifyContent: "center",
|
|
894
|
-
alignItems: "flex-start",
|
|
895
|
-
gap: 1,
|
|
896
|
-
padding: 5,
|
|
897
|
-
children: [
|
|
898
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", children: formatMessage({
|
|
899
|
-
id: "content-releases.header.actions.created",
|
|
900
|
-
defaultMessage: "Created"
|
|
901
|
-
}) }),
|
|
902
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", color: "neutral300", children: [
|
|
903
|
-
/* @__PURE__ */ jsxRuntime.jsx(RelativeTime$1, { timestamp: new Date(release.createdAt) }),
|
|
904
|
-
formatMessage(
|
|
905
|
-
{
|
|
906
|
-
id: "content-releases.header.actions.created.description",
|
|
907
|
-
defaultMessage: "{hasCreatedByUser, select, true { by {createdBy}} other { by deleted user}}"
|
|
908
|
-
},
|
|
909
|
-
{ createdBy: getCreatedByUser(), hasCreatedByUser }
|
|
910
|
-
)
|
|
911
913
|
] })
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
914
|
+
}
|
|
915
|
+
),
|
|
916
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
917
|
+
ReleaseInfoWrapper,
|
|
918
|
+
{
|
|
919
|
+
direction: "column",
|
|
920
|
+
justifyContent: "center",
|
|
921
|
+
alignItems: "flex-start",
|
|
922
|
+
gap: 1,
|
|
923
|
+
padding: 4,
|
|
924
|
+
children: [
|
|
925
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", children: formatMessage({
|
|
926
|
+
id: "content-releases.header.actions.created",
|
|
927
|
+
defaultMessage: "Created"
|
|
928
|
+
}) }),
|
|
929
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", color: "neutral300", children: [
|
|
930
|
+
/* @__PURE__ */ jsxRuntime.jsx(RelativeTime$1, { timestamp: new Date(release.createdAt) }),
|
|
931
|
+
formatMessage(
|
|
932
|
+
{
|
|
933
|
+
id: "content-releases.header.actions.created.description",
|
|
934
|
+
defaultMessage: "{hasCreatedByUser, select, true { by {createdBy}} other { by deleted user}}"
|
|
935
|
+
},
|
|
936
|
+
{ createdBy: getCreatedByUser(), hasCreatedByUser }
|
|
937
|
+
)
|
|
938
|
+
] })
|
|
939
|
+
]
|
|
940
|
+
}
|
|
941
|
+
)
|
|
942
|
+
]
|
|
943
|
+
}
|
|
944
|
+
),
|
|
917
945
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { size: "S", variant: "tertiary", onClick: handleRefresh, children: formatMessage({
|
|
918
946
|
id: "content-releases.header.actions.refresh",
|
|
919
947
|
defaultMessage: "Refresh"
|
|
@@ -938,6 +966,11 @@ const ReleaseDetailsLayout = ({
|
|
|
938
966
|
children
|
|
939
967
|
] });
|
|
940
968
|
};
|
|
969
|
+
const SimpleMenuButton = styledComponents.styled(designSystem.SimpleMenu)`
|
|
970
|
+
& > span {
|
|
971
|
+
display: flex;
|
|
972
|
+
}
|
|
973
|
+
`;
|
|
941
974
|
const GROUP_BY_OPTIONS = ["contentType", "locale", "action"];
|
|
942
975
|
const GROUP_BY_OPTIONS_NO_LOCALE = ["contentType", "action"];
|
|
943
976
|
const getGroupByOptionLabel = (value) => {
|
|
@@ -966,26 +999,24 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
966
999
|
const {
|
|
967
1000
|
data: releaseData,
|
|
968
1001
|
isLoading: isReleaseLoading,
|
|
969
|
-
isError: isReleaseError,
|
|
970
1002
|
error: releaseError
|
|
971
1003
|
} = index.useGetReleaseQuery({ id: releaseId });
|
|
972
1004
|
const {
|
|
973
1005
|
allowedActions: { canUpdate }
|
|
974
1006
|
} = strapiAdmin.useRBAC(index.PERMISSIONS);
|
|
975
1007
|
const runHookWaterfall = strapiAdmin.useStrapiApp("ReleaseDetailsPage", (state) => state.runHookWaterfall);
|
|
976
|
-
const { hasI18nEnabled } = runHookWaterfall(
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
);
|
|
1008
|
+
const { displayedHeaders, hasI18nEnabled } = runHookWaterfall("ContentReleases/pages/ReleaseDetails/add-locale-in-releases", {
|
|
1009
|
+
displayedHeaders: [
|
|
1010
|
+
{
|
|
1011
|
+
label: {
|
|
1012
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.name",
|
|
1013
|
+
defaultMessage: "name"
|
|
1014
|
+
},
|
|
1015
|
+
name: "name"
|
|
1016
|
+
}
|
|
1017
|
+
],
|
|
1018
|
+
hasI18nEnabled: false
|
|
1019
|
+
});
|
|
989
1020
|
const release = releaseData?.data;
|
|
990
1021
|
const selectedGroupBy = query?.groupBy || "contentType";
|
|
991
1022
|
const {
|
|
@@ -1014,7 +1045,7 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1014
1045
|
// We are passing the action path to found the position in the cache of the action for optimistic updates
|
|
1015
1046
|
});
|
|
1016
1047
|
if ("error" in response) {
|
|
1017
|
-
if (
|
|
1048
|
+
if (strapiAdmin.isFetchError(response.error)) {
|
|
1018
1049
|
toggleNotification({
|
|
1019
1050
|
type: "danger",
|
|
1020
1051
|
message: formatAPIError(response.error)
|
|
@@ -1034,14 +1065,14 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1034
1065
|
const releaseMeta = data?.meta;
|
|
1035
1066
|
const contentTypes = releaseMeta?.contentTypes || {};
|
|
1036
1067
|
const components = releaseMeta?.components || {};
|
|
1037
|
-
if (
|
|
1068
|
+
if (isBaseQueryError(releaseError) || !release) {
|
|
1038
1069
|
const errorsArray = [];
|
|
1039
|
-
if (releaseError) {
|
|
1070
|
+
if (releaseError && "code" in releaseError) {
|
|
1040
1071
|
errorsArray.push({
|
|
1041
1072
|
code: releaseError.code
|
|
1042
1073
|
});
|
|
1043
1074
|
}
|
|
1044
|
-
if (releaseActionsError) {
|
|
1075
|
+
if (releaseActionsError && "code" in releaseActionsError) {
|
|
1045
1076
|
errorsArray.push({
|
|
1046
1077
|
code: releaseActionsError.code
|
|
1047
1078
|
});
|
|
@@ -1060,13 +1091,13 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1060
1091
|
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Error, {});
|
|
1061
1092
|
}
|
|
1062
1093
|
if (Object.keys(releaseActions).length === 0) {
|
|
1063
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1094
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1064
1095
|
designSystem.EmptyStateLayout,
|
|
1065
1096
|
{
|
|
1066
1097
|
action: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1067
|
-
|
|
1098
|
+
designSystem.LinkButton,
|
|
1068
1099
|
{
|
|
1069
|
-
|
|
1100
|
+
tag: reactRouterDom.Link,
|
|
1070
1101
|
to: {
|
|
1071
1102
|
pathname: "/content-manager"
|
|
1072
1103
|
},
|
|
@@ -1078,7 +1109,7 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1078
1109
|
})
|
|
1079
1110
|
}
|
|
1080
1111
|
),
|
|
1081
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1112
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(symbols.EmptyDocuments, { width: "16rem" }),
|
|
1082
1113
|
content: formatMessage({
|
|
1083
1114
|
id: "content-releases.pages.Details.tab.emptyEntries",
|
|
1084
1115
|
defaultMessage: "This release is empty. Open the Content Manager, select an entry and add it to the release."
|
|
@@ -1091,40 +1122,33 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1091
1122
|
defaultMessage: "Group by"
|
|
1092
1123
|
});
|
|
1093
1124
|
const headers = [
|
|
1094
|
-
|
|
1095
|
-
{
|
|
1096
|
-
label: formatMessage({
|
|
1097
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.name",
|
|
1098
|
-
defaultMessage: "name"
|
|
1099
|
-
}),
|
|
1100
|
-
name: "name"
|
|
1101
|
-
},
|
|
1125
|
+
...displayedHeaders,
|
|
1102
1126
|
{
|
|
1103
|
-
label:
|
|
1127
|
+
label: {
|
|
1104
1128
|
id: "content-releases.page.ReleaseDetails.table.header.label.content-type",
|
|
1105
1129
|
defaultMessage: "content-type"
|
|
1106
|
-
}
|
|
1130
|
+
},
|
|
1107
1131
|
name: "content-type"
|
|
1108
1132
|
},
|
|
1109
1133
|
{
|
|
1110
|
-
label:
|
|
1134
|
+
label: {
|
|
1111
1135
|
id: "content-releases.page.ReleaseDetails.table.header.label.action",
|
|
1112
1136
|
defaultMessage: "action"
|
|
1113
|
-
}
|
|
1137
|
+
},
|
|
1114
1138
|
name: "action"
|
|
1115
1139
|
},
|
|
1116
1140
|
...!release.releasedAt ? [
|
|
1117
1141
|
{
|
|
1118
|
-
label:
|
|
1142
|
+
label: {
|
|
1119
1143
|
id: "content-releases.page.ReleaseDetails.table.header.label.status",
|
|
1120
1144
|
defaultMessage: "status"
|
|
1121
|
-
}
|
|
1145
|
+
},
|
|
1122
1146
|
name: "status"
|
|
1123
1147
|
}
|
|
1124
1148
|
] : []
|
|
1125
1149
|
];
|
|
1126
1150
|
const options = hasI18nEnabled ? GROUP_BY_OPTIONS : GROUP_BY_OPTIONS_NO_LOCALE;
|
|
1127
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1151
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 8, direction: "column", alignItems: "stretch", children: [
|
|
1128
1152
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1129
1153
|
designSystem.SingleSelect,
|
|
1130
1154
|
{
|
|
@@ -1156,10 +1180,10 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1156
1180
|
headers,
|
|
1157
1181
|
isLoading: isLoading || isFetching,
|
|
1158
1182
|
children: /* @__PURE__ */ jsxRuntime.jsxs(strapiAdmin.Table.Content, { children: [
|
|
1159
|
-
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Head, { children: headers.map((
|
|
1183
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Head, { children: headers.map(({ label, name }) => /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.HeaderCell, { label: formatMessage(label), name }, name)) }),
|
|
1160
1184
|
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Loading, {}),
|
|
1161
1185
|
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Body, { children: releaseActions[key].map(
|
|
1162
|
-
({ id, contentType, locale, type, entry }, actionIndex) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
1186
|
+
({ id, contentType, locale, type, entry, status }, actionIndex) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
1163
1187
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "25%", maxWidth: "200px", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { ellipsis: true, children: `${contentType.mainFieldValue || entry.id}` }) }),
|
|
1164
1188
|
hasI18nEnabled && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "10%", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: `${locale?.name ? locale.name : "-"}` }) }),
|
|
1165
1189
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "10%", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: contentType.displayName || "" }) }),
|
|
@@ -1188,7 +1212,8 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1188
1212
|
action: type,
|
|
1189
1213
|
schema: contentTypes?.[contentType.uid],
|
|
1190
1214
|
components,
|
|
1191
|
-
entry
|
|
1215
|
+
entry,
|
|
1216
|
+
status
|
|
1192
1217
|
}
|
|
1193
1218
|
) }),
|
|
1194
1219
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsxs(index.ReleaseActionMenu.Root, { children: [
|
|
@@ -1196,7 +1221,7 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1196
1221
|
index.ReleaseActionMenu.ReleaseActionEntryLinkItem,
|
|
1197
1222
|
{
|
|
1198
1223
|
contentTypeUid: contentType.uid,
|
|
1199
|
-
|
|
1224
|
+
documentId: entry.documentId,
|
|
1200
1225
|
locale: locale?.code
|
|
1201
1226
|
}
|
|
1202
1227
|
),
|
|
@@ -1246,13 +1271,24 @@ const ReleaseDetailsPage = () => {
|
|
|
1246
1271
|
skip: !releaseId
|
|
1247
1272
|
}
|
|
1248
1273
|
);
|
|
1274
|
+
const { data: dataTimezone, isLoading: isLoadingTimezone } = index.useGetReleaseSettingsQuery();
|
|
1249
1275
|
const [updateRelease, { isLoading: isSubmittingForm }] = index.useUpdateReleaseMutation();
|
|
1250
1276
|
const [deleteRelease] = index.useDeleteReleaseMutation();
|
|
1251
1277
|
const toggleEditReleaseModal = () => {
|
|
1252
1278
|
setReleaseModalShown((prev) => !prev);
|
|
1253
1279
|
};
|
|
1280
|
+
const getTimezoneValue = () => {
|
|
1281
|
+
if (releaseData?.timezone) {
|
|
1282
|
+
return releaseData.timezone;
|
|
1283
|
+
} else {
|
|
1284
|
+
if (dataTimezone?.data.defaultTimezone) {
|
|
1285
|
+
return dataTimezone.data.defaultTimezone;
|
|
1286
|
+
}
|
|
1287
|
+
return null;
|
|
1288
|
+
}
|
|
1289
|
+
};
|
|
1254
1290
|
const toggleWarningSubmit = () => setWarningSubmit((prevState) => !prevState);
|
|
1255
|
-
if (isLoadingDetails) {
|
|
1291
|
+
if (isLoadingDetails || isLoadingTimezone) {
|
|
1256
1292
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1257
1293
|
ReleaseDetailsLayout,
|
|
1258
1294
|
{
|
|
@@ -1267,9 +1303,9 @@ const ReleaseDetailsPage = () => {
|
|
|
1267
1303
|
}
|
|
1268
1304
|
const releaseData = isSuccessDetails && data?.data || null;
|
|
1269
1305
|
const title = releaseData?.name || "";
|
|
1270
|
-
const timezone =
|
|
1306
|
+
const timezone = getTimezoneValue();
|
|
1271
1307
|
const scheduledAt = releaseData?.scheduledAt && timezone ? dateFnsTz.utcToZonedTime(releaseData.scheduledAt, timezone) : null;
|
|
1272
|
-
const date = scheduledAt ? format__default.default(scheduledAt, "yyyy-MM-dd") :
|
|
1308
|
+
const date = scheduledAt ? format__default.default(scheduledAt, "yyyy-MM-dd") : void 0;
|
|
1273
1309
|
const time = scheduledAt ? format__default.default(scheduledAt, "HH:mm") : "";
|
|
1274
1310
|
const handleEditRelease = async (values) => {
|
|
1275
1311
|
const response = await updateRelease({
|
|
@@ -1287,7 +1323,7 @@ const ReleaseDetailsPage = () => {
|
|
|
1287
1323
|
})
|
|
1288
1324
|
});
|
|
1289
1325
|
toggleEditReleaseModal();
|
|
1290
|
-
} else if (
|
|
1326
|
+
} else if (strapiAdmin.isFetchError(response.error)) {
|
|
1291
1327
|
toggleNotification({
|
|
1292
1328
|
type: "danger",
|
|
1293
1329
|
message: formatAPIError(response.error)
|
|
@@ -1305,7 +1341,7 @@ const ReleaseDetailsPage = () => {
|
|
|
1305
1341
|
});
|
|
1306
1342
|
if ("data" in response) {
|
|
1307
1343
|
navigate("..");
|
|
1308
|
-
} else if (
|
|
1344
|
+
} else if (strapiAdmin.isFetchError(response.error)) {
|
|
1309
1345
|
toggleNotification({
|
|
1310
1346
|
type: "danger",
|
|
1311
1347
|
message: formatAPIError(response.error)
|
|
@@ -1324,9 +1360,10 @@ const ReleaseDetailsPage = () => {
|
|
|
1324
1360
|
toggleWarningSubmit,
|
|
1325
1361
|
children: [
|
|
1326
1362
|
/* @__PURE__ */ jsxRuntime.jsx(ReleaseDetailsBody, { releaseId }),
|
|
1327
|
-
|
|
1363
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1328
1364
|
ReleaseModal,
|
|
1329
1365
|
{
|
|
1366
|
+
open: releaseModalShown,
|
|
1330
1367
|
handleClose: toggleEditReleaseModal,
|
|
1331
1368
|
handleSubmit: handleEditRelease,
|
|
1332
1369
|
isLoading: isLoadingDetails || isSubmittingForm,
|
|
@@ -1340,18 +1377,10 @@ const ReleaseDetailsPage = () => {
|
|
|
1340
1377
|
}
|
|
1341
1378
|
}
|
|
1342
1379
|
),
|
|
1343
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
onClose: toggleWarningSubmit,
|
|
1348
|
-
onConfirm: handleDeleteRelease,
|
|
1349
|
-
children: formatMessage({
|
|
1350
|
-
id: "content-releases.dialog.confirmation-message",
|
|
1351
|
-
defaultMessage: "Are you sure you want to delete this release?"
|
|
1352
|
-
})
|
|
1353
|
-
}
|
|
1354
|
-
)
|
|
1380
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Root, { open: showWarningSubmit, onOpenChange: toggleWarningSubmit, children: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.ConfirmDialog, { onConfirm: handleDeleteRelease, children: formatMessage({
|
|
1381
|
+
id: "content-releases.dialog.confirmation-message",
|
|
1382
|
+
defaultMessage: "Are you sure you want to delete this release?"
|
|
1383
|
+
}) }) })
|
|
1355
1384
|
]
|
|
1356
1385
|
}
|
|
1357
1386
|
);
|
|
@@ -1363,4 +1392,4 @@ const App = () => {
|
|
|
1363
1392
|
] }) });
|
|
1364
1393
|
};
|
|
1365
1394
|
exports.App = App;
|
|
1366
|
-
//# sourceMappingURL=App-
|
|
1395
|
+
//# sourceMappingURL=App-D4Wira1X.js.map
|