@strapi/content-releases 0.0.0-experimental.defd8568ae03ef8d52f86e1f3541979f953c3941 → 0.0.0-experimental.e14656d3b8681880212c13260b9a2b340c182f2d
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-O0ZO-S35.mjs → App-DMILern_.mjs} +409 -396
- package/dist/_chunks/App-DMILern_.mjs.map +1 -0
- package/dist/_chunks/{App-C0DlH0im.js → App-fAgiijnc.js} +412 -401
- package/dist/_chunks/App-fAgiijnc.js.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-DAHdUpAA.js → PurchaseContentReleases-Be3acS2L.js} +4 -3
- package/dist/_chunks/PurchaseContentReleases-Be3acS2L.js.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-Ex09YpKR.mjs → PurchaseContentReleases-_MxP6-Dt.mjs} +5 -4
- package/dist/_chunks/PurchaseContentReleases-_MxP6-Dt.mjs.map +1 -0
- package/dist/_chunks/ReleasesSettingsPage-YVZJH-oN.js +178 -0
- package/dist/_chunks/ReleasesSettingsPage-YVZJH-oN.js.map +1 -0
- package/dist/_chunks/ReleasesSettingsPage-dwoRuXB-.mjs +178 -0
- package/dist/_chunks/ReleasesSettingsPage-dwoRuXB-.mjs.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-DoZNNtsb.js → index--_NWfuDG.js} +681 -585
- package/dist/_chunks/index--_NWfuDG.js.map +1 -0
- package/dist/_chunks/{index-DjDPK8kb.mjs → index-CYsQToWs.mjs} +690 -592
- package/dist/_chunks/index-CYsQToWs.mjs.map +1 -0
- package/dist/_chunks/schemas-63pFihNF.mjs +44 -0
- package/dist/_chunks/schemas-63pFihNF.mjs.map +1 -0
- package/dist/_chunks/schemas-z5zp-_Gd.js +62 -0
- package/dist/_chunks/schemas-z5zp-_Gd.js.map +1 -0
- package/dist/admin/index.js +1 -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 +796 -623
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +797 -624
- 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 +66 -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 +38 -38
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/server/src/services/release-action.d.ts +36 -0
- package/dist/server/src/services/release-action.d.ts.map +1 -0
- package/dist/server/src/services/release.d.ts +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 +17 -18
- package/dist/_chunks/App-C0DlH0im.js.map +0 -1
- package/dist/_chunks/App-O0ZO-S35.mjs.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-DAHdUpAA.js.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-Ex09YpKR.mjs.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-DjDPK8kb.mjs.map +0 -1
- package/dist/_chunks/index-DoZNNtsb.js.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
|
@@ -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--_NWfuDG.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
10
|
const icons = require("@strapi/icons");
|
|
10
11
|
const symbols = require("@strapi/icons/symbols");
|
|
11
|
-
const strapiAdmin$1 = require("@strapi/plugin-content-manager/strapi-admin");
|
|
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-z5zp-_Gd.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;
|
|
@@ -365,7 +365,7 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
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,7 +516,7 @@ 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
|
{
|
|
@@ -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,61 +628,92 @@ const StyledMenuItem = styled__default.default(designSystem.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 =
|
|
634
|
+
const PencilIcon = styledComponents.styled(icons.Pencil)`
|
|
643
635
|
width: ${({ theme }) => theme.spaces[3]};
|
|
644
636
|
height: ${({ theme }) => theme.spaces[3]};
|
|
645
637
|
path {
|
|
646
638
|
fill: ${({ theme }) => theme.colors.neutral600};
|
|
647
639
|
}
|
|
648
640
|
`;
|
|
649
|
-
const TrashIcon =
|
|
641
|
+
const TrashIcon = styledComponents.styled(icons.Trash)`
|
|
650
642
|
width: ${({ theme }) => theme.spaces[3]};
|
|
651
643
|
height: ${({ theme }) => theme.spaces[3]};
|
|
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
|
-
|
|
671
|
-
|
|
672
|
-
const validationErrorsMessages = Object.entries(errors).map(
|
|
673
|
-
([key, value]) => formatMessage(
|
|
674
|
-
{ id: `${value.id}.withField`, defaultMessage: value.defaultMessage },
|
|
675
|
-
{ field: key }
|
|
676
|
-
)
|
|
677
|
-
).join(" ");
|
|
678
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
679
|
-
/* @__PURE__ */ jsxRuntime.jsx(icons.CrossCircle, { fill: "danger600" }),
|
|
680
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tooltip, { description: validationErrorsMessages, children: /* @__PURE__ */ jsxRuntime.jsx(TypographyMaxWidth, { textColor: "danger600", variant: "omega", fontWeight: "semiBold", ellipsis: true, children: validationErrorsMessages }) })
|
|
681
|
-
] });
|
|
663
|
+
if (isLoading) {
|
|
664
|
+
return null;
|
|
682
665
|
}
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
666
|
+
const errors = validate(entry) ?? {};
|
|
667
|
+
if (action === "publish") {
|
|
668
|
+
if (Object.keys(errors).length > 0) {
|
|
669
|
+
const validationErrorsMessages = Object.entries(errors).map(
|
|
670
|
+
([key, value]) => formatMessage(
|
|
671
|
+
// @ts-expect-error – TODO: fix this will better checks
|
|
672
|
+
{ id: `${value.id}.withField`, defaultMessage: value.defaultMessage },
|
|
673
|
+
{ field: key }
|
|
674
|
+
)
|
|
675
|
+
).join(" ");
|
|
676
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
677
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.CrossCircle, { fill: "danger600" }),
|
|
678
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tooltip, { description: validationErrorsMessages, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
679
|
+
TypographyMaxWidth,
|
|
680
|
+
{
|
|
681
|
+
textColor: "danger600",
|
|
682
|
+
variant: "omega",
|
|
683
|
+
fontWeight: "semiBold",
|
|
684
|
+
ellipsis: true,
|
|
685
|
+
children: validationErrorsMessages
|
|
686
|
+
}
|
|
687
|
+
) })
|
|
688
|
+
] });
|
|
689
|
+
}
|
|
690
|
+
if (status === "draft") {
|
|
691
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
692
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
|
693
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
|
|
694
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.ready-to-publish",
|
|
695
|
+
defaultMessage: "Ready to publish"
|
|
696
|
+
}) })
|
|
697
|
+
] });
|
|
698
|
+
}
|
|
699
|
+
if (status === "modified") {
|
|
700
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
701
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.ArrowsCounterClockwise, { fill: "alternative600" }),
|
|
702
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
|
|
703
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.modified",
|
|
704
|
+
defaultMessage: "Ready to publish changes"
|
|
705
|
+
}) })
|
|
706
|
+
] });
|
|
707
|
+
}
|
|
708
|
+
if (status === "published") {
|
|
709
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
710
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
|
711
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
|
|
712
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.already-published",
|
|
713
|
+
defaultMessage: "Already published"
|
|
714
|
+
}) })
|
|
715
|
+
] });
|
|
716
|
+
}
|
|
694
717
|
}
|
|
695
718
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
696
719
|
/* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
|
@@ -713,7 +736,6 @@ const ReleaseDetailsLayout = ({
|
|
|
713
736
|
const {
|
|
714
737
|
data,
|
|
715
738
|
isLoading: isLoadingDetails,
|
|
716
|
-
isError,
|
|
717
739
|
error
|
|
718
740
|
} = index.useGetReleaseQuery(
|
|
719
741
|
{ id: releaseId },
|
|
@@ -745,7 +767,7 @@ const ReleaseDetailsLayout = ({
|
|
|
745
767
|
totalPublishedEntries,
|
|
746
768
|
totalUnpublishedEntries
|
|
747
769
|
});
|
|
748
|
-
} else if (
|
|
770
|
+
} else if (strapiAdmin.isFetchError(response.error)) {
|
|
749
771
|
toggleNotification({
|
|
750
772
|
type: "danger",
|
|
751
773
|
message: formatAPIError(response.error)
|
|
@@ -780,7 +802,7 @@ const ReleaseDetailsLayout = ({
|
|
|
780
802
|
if (isLoadingDetails) {
|
|
781
803
|
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
|
|
782
804
|
}
|
|
783
|
-
if (
|
|
805
|
+
if (isBaseQueryError(error) && "code" in error || !release) {
|
|
784
806
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
785
807
|
reactRouterDom.Navigate,
|
|
786
808
|
{
|
|
@@ -788,6 +810,7 @@ const ReleaseDetailsLayout = ({
|
|
|
788
810
|
state: {
|
|
789
811
|
errors: [
|
|
790
812
|
{
|
|
813
|
+
// @ts-expect-error – TODO: fix this weird error flow
|
|
791
814
|
code: error?.code
|
|
792
815
|
}
|
|
793
816
|
]
|
|
@@ -827,7 +850,7 @@ const ReleaseDetailsLayout = ({
|
|
|
827
850
|
) : "";
|
|
828
851
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { "aria-busy": isLoadingDetails, children: [
|
|
829
852
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
830
|
-
|
|
853
|
+
strapiAdmin.Layouts.Header,
|
|
831
854
|
{
|
|
832
855
|
title: release.name,
|
|
833
856
|
subtitle: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, lineHeight: 6, children: [
|
|
@@ -836,84 +859,71 @@ const ReleaseDetailsLayout = ({
|
|
|
836
859
|
] }),
|
|
837
860
|
navigationAction: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.BackButton, {}),
|
|
838
861
|
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
|
-
|
|
862
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
863
|
+
SimpleMenuButton,
|
|
864
|
+
{
|
|
865
|
+
label: /* @__PURE__ */ jsxRuntime.jsx(icons.More, {}),
|
|
866
|
+
variant: "tertiary",
|
|
867
|
+
endIcon: null,
|
|
868
|
+
paddingLeft: "7px",
|
|
869
|
+
paddingRight: "7px",
|
|
870
|
+
"aria-label": formatMessage({
|
|
871
|
+
id: "content-releases.header.actions.open-release-actions",
|
|
872
|
+
defaultMessage: "Release edit and delete menu"
|
|
873
|
+
}),
|
|
874
|
+
popoverPlacement: "bottom-end",
|
|
875
|
+
children: [
|
|
876
|
+
/* @__PURE__ */ jsxRuntime.jsx(StyledMenuItem, { disabled: !canUpdate, onSelect: toggleEditReleaseModal, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 2, hasRadius: true, width: "100%", children: [
|
|
877
|
+
/* @__PURE__ */ jsxRuntime.jsx(PencilIcon, {}),
|
|
878
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { ellipsis: true, children: formatMessage({
|
|
879
|
+
id: "content-releases.header.actions.edit",
|
|
880
|
+
defaultMessage: "Edit"
|
|
881
|
+
}) })
|
|
882
|
+
] }) }),
|
|
883
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
884
|
+
StyledMenuItem,
|
|
885
|
+
{
|
|
886
|
+
disabled: !canDelete,
|
|
887
|
+
onSelect: toggleWarningSubmit,
|
|
888
|
+
$variant: "danger",
|
|
889
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 2, hasRadius: true, width: "100%", children: [
|
|
890
|
+
/* @__PURE__ */ jsxRuntime.jsx(TrashIcon, {}),
|
|
891
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { ellipsis: true, textColor: "danger600", children: formatMessage({
|
|
892
|
+
id: "content-releases.header.actions.delete",
|
|
893
|
+
defaultMessage: "Delete"
|
|
869
894
|
}) })
|
|
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
895
|
] })
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
896
|
+
}
|
|
897
|
+
),
|
|
898
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
899
|
+
ReleaseInfoWrapper,
|
|
900
|
+
{
|
|
901
|
+
direction: "column",
|
|
902
|
+
justifyContent: "center",
|
|
903
|
+
alignItems: "flex-start",
|
|
904
|
+
gap: 1,
|
|
905
|
+
padding: 5,
|
|
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
|
+
),
|
|
917
927
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { size: "S", variant: "tertiary", onClick: handleRefresh, children: formatMessage({
|
|
918
928
|
id: "content-releases.header.actions.refresh",
|
|
919
929
|
defaultMessage: "Refresh"
|
|
@@ -938,6 +948,11 @@ const ReleaseDetailsLayout = ({
|
|
|
938
948
|
children
|
|
939
949
|
] });
|
|
940
950
|
};
|
|
951
|
+
const SimpleMenuButton = styledComponents.styled(designSystem.SimpleMenu)`
|
|
952
|
+
& > span {
|
|
953
|
+
display: flex;
|
|
954
|
+
}
|
|
955
|
+
`;
|
|
941
956
|
const GROUP_BY_OPTIONS = ["contentType", "locale", "action"];
|
|
942
957
|
const GROUP_BY_OPTIONS_NO_LOCALE = ["contentType", "action"];
|
|
943
958
|
const getGroupByOptionLabel = (value) => {
|
|
@@ -966,26 +981,24 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
966
981
|
const {
|
|
967
982
|
data: releaseData,
|
|
968
983
|
isLoading: isReleaseLoading,
|
|
969
|
-
isError: isReleaseError,
|
|
970
984
|
error: releaseError
|
|
971
985
|
} = index.useGetReleaseQuery({ id: releaseId });
|
|
972
986
|
const {
|
|
973
987
|
allowedActions: { canUpdate }
|
|
974
988
|
} = strapiAdmin.useRBAC(index.PERMISSIONS);
|
|
975
989
|
const runHookWaterfall = strapiAdmin.useStrapiApp("ReleaseDetailsPage", (state) => state.runHookWaterfall);
|
|
976
|
-
const { hasI18nEnabled } = runHookWaterfall(
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
);
|
|
990
|
+
const { displayedHeaders, hasI18nEnabled } = runHookWaterfall("ContentReleases/pages/ReleaseDetails/add-locale-in-releases", {
|
|
991
|
+
displayedHeaders: [
|
|
992
|
+
{
|
|
993
|
+
label: {
|
|
994
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.name",
|
|
995
|
+
defaultMessage: "name"
|
|
996
|
+
},
|
|
997
|
+
name: "name"
|
|
998
|
+
}
|
|
999
|
+
],
|
|
1000
|
+
hasI18nEnabled: false
|
|
1001
|
+
});
|
|
989
1002
|
const release = releaseData?.data;
|
|
990
1003
|
const selectedGroupBy = query?.groupBy || "contentType";
|
|
991
1004
|
const {
|
|
@@ -1014,7 +1027,7 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1014
1027
|
// We are passing the action path to found the position in the cache of the action for optimistic updates
|
|
1015
1028
|
});
|
|
1016
1029
|
if ("error" in response) {
|
|
1017
|
-
if (
|
|
1030
|
+
if (strapiAdmin.isFetchError(response.error)) {
|
|
1018
1031
|
toggleNotification({
|
|
1019
1032
|
type: "danger",
|
|
1020
1033
|
message: formatAPIError(response.error)
|
|
@@ -1034,14 +1047,14 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1034
1047
|
const releaseMeta = data?.meta;
|
|
1035
1048
|
const contentTypes = releaseMeta?.contentTypes || {};
|
|
1036
1049
|
const components = releaseMeta?.components || {};
|
|
1037
|
-
if (
|
|
1050
|
+
if (isBaseQueryError(releaseError) || !release) {
|
|
1038
1051
|
const errorsArray = [];
|
|
1039
|
-
if (releaseError) {
|
|
1052
|
+
if (releaseError && "code" in releaseError) {
|
|
1040
1053
|
errorsArray.push({
|
|
1041
1054
|
code: releaseError.code
|
|
1042
1055
|
});
|
|
1043
1056
|
}
|
|
1044
|
-
if (releaseActionsError) {
|
|
1057
|
+
if (releaseActionsError && "code" in releaseActionsError) {
|
|
1045
1058
|
errorsArray.push({
|
|
1046
1059
|
code: releaseActionsError.code
|
|
1047
1060
|
});
|
|
@@ -1060,13 +1073,13 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1060
1073
|
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Error, {});
|
|
1061
1074
|
}
|
|
1062
1075
|
if (Object.keys(releaseActions).length === 0) {
|
|
1063
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1076
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1064
1077
|
designSystem.EmptyStateLayout,
|
|
1065
1078
|
{
|
|
1066
1079
|
action: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1067
1080
|
designSystem.LinkButton,
|
|
1068
1081
|
{
|
|
1069
|
-
|
|
1082
|
+
tag: reactRouterDom.Link,
|
|
1070
1083
|
to: {
|
|
1071
1084
|
pathname: "/content-manager"
|
|
1072
1085
|
},
|
|
@@ -1091,40 +1104,33 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1091
1104
|
defaultMessage: "Group by"
|
|
1092
1105
|
});
|
|
1093
1106
|
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
|
-
},
|
|
1107
|
+
...displayedHeaders,
|
|
1102
1108
|
{
|
|
1103
|
-
label:
|
|
1109
|
+
label: {
|
|
1104
1110
|
id: "content-releases.page.ReleaseDetails.table.header.label.content-type",
|
|
1105
1111
|
defaultMessage: "content-type"
|
|
1106
|
-
}
|
|
1112
|
+
},
|
|
1107
1113
|
name: "content-type"
|
|
1108
1114
|
},
|
|
1109
1115
|
{
|
|
1110
|
-
label:
|
|
1116
|
+
label: {
|
|
1111
1117
|
id: "content-releases.page.ReleaseDetails.table.header.label.action",
|
|
1112
1118
|
defaultMessage: "action"
|
|
1113
|
-
}
|
|
1119
|
+
},
|
|
1114
1120
|
name: "action"
|
|
1115
1121
|
},
|
|
1116
1122
|
...!release.releasedAt ? [
|
|
1117
1123
|
{
|
|
1118
|
-
label:
|
|
1124
|
+
label: {
|
|
1119
1125
|
id: "content-releases.page.ReleaseDetails.table.header.label.status",
|
|
1120
1126
|
defaultMessage: "status"
|
|
1121
|
-
}
|
|
1127
|
+
},
|
|
1122
1128
|
name: "status"
|
|
1123
1129
|
}
|
|
1124
1130
|
] : []
|
|
1125
1131
|
];
|
|
1126
1132
|
const options = hasI18nEnabled ? GROUP_BY_OPTIONS : GROUP_BY_OPTIONS_NO_LOCALE;
|
|
1127
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1133
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 8, direction: "column", alignItems: "stretch", children: [
|
|
1128
1134
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1129
1135
|
designSystem.SingleSelect,
|
|
1130
1136
|
{
|
|
@@ -1156,10 +1162,10 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1156
1162
|
headers,
|
|
1157
1163
|
isLoading: isLoading || isFetching,
|
|
1158
1164
|
children: /* @__PURE__ */ jsxRuntime.jsxs(strapiAdmin.Table.Content, { children: [
|
|
1159
|
-
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Head, { children: headers.map((
|
|
1165
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Head, { children: headers.map(({ label, name }) => /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.HeaderCell, { label: formatMessage(label), name }, name)) }),
|
|
1160
1166
|
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Loading, {}),
|
|
1161
1167
|
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Body, { children: releaseActions[key].map(
|
|
1162
|
-
({ id, contentType, locale, type, entry }, actionIndex) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
1168
|
+
({ id, contentType, locale, type, entry, status }, actionIndex) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
1163
1169
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "25%", maxWidth: "200px", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { ellipsis: true, children: `${contentType.mainFieldValue || entry.id}` }) }),
|
|
1164
1170
|
hasI18nEnabled && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "10%", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: `${locale?.name ? locale.name : "-"}` }) }),
|
|
1165
1171
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "10%", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: contentType.displayName || "" }) }),
|
|
@@ -1188,7 +1194,8 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1188
1194
|
action: type,
|
|
1189
1195
|
schema: contentTypes?.[contentType.uid],
|
|
1190
1196
|
components,
|
|
1191
|
-
entry
|
|
1197
|
+
entry,
|
|
1198
|
+
status
|
|
1192
1199
|
}
|
|
1193
1200
|
) }),
|
|
1194
1201
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsxs(index.ReleaseActionMenu.Root, { children: [
|
|
@@ -1196,7 +1203,7 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1196
1203
|
index.ReleaseActionMenu.ReleaseActionEntryLinkItem,
|
|
1197
1204
|
{
|
|
1198
1205
|
contentTypeUid: contentType.uid,
|
|
1199
|
-
|
|
1206
|
+
documentId: entry.documentId,
|
|
1200
1207
|
locale: locale?.code
|
|
1201
1208
|
}
|
|
1202
1209
|
),
|
|
@@ -1246,13 +1253,24 @@ const ReleaseDetailsPage = () => {
|
|
|
1246
1253
|
skip: !releaseId
|
|
1247
1254
|
}
|
|
1248
1255
|
);
|
|
1256
|
+
const { data: dataTimezone, isLoading: isLoadingTimezone } = index.useGetReleaseSettingsQuery();
|
|
1249
1257
|
const [updateRelease, { isLoading: isSubmittingForm }] = index.useUpdateReleaseMutation();
|
|
1250
1258
|
const [deleteRelease] = index.useDeleteReleaseMutation();
|
|
1251
1259
|
const toggleEditReleaseModal = () => {
|
|
1252
1260
|
setReleaseModalShown((prev) => !prev);
|
|
1253
1261
|
};
|
|
1262
|
+
const getTimezoneValue = () => {
|
|
1263
|
+
if (releaseData?.timezone) {
|
|
1264
|
+
return releaseData.timezone;
|
|
1265
|
+
} else {
|
|
1266
|
+
if (dataTimezone?.data.defaultTimezone) {
|
|
1267
|
+
return dataTimezone.data.defaultTimezone;
|
|
1268
|
+
}
|
|
1269
|
+
return null;
|
|
1270
|
+
}
|
|
1271
|
+
};
|
|
1254
1272
|
const toggleWarningSubmit = () => setWarningSubmit((prevState) => !prevState);
|
|
1255
|
-
if (isLoadingDetails) {
|
|
1273
|
+
if (isLoadingDetails || isLoadingTimezone) {
|
|
1256
1274
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1257
1275
|
ReleaseDetailsLayout,
|
|
1258
1276
|
{
|
|
@@ -1267,9 +1285,9 @@ const ReleaseDetailsPage = () => {
|
|
|
1267
1285
|
}
|
|
1268
1286
|
const releaseData = isSuccessDetails && data?.data || null;
|
|
1269
1287
|
const title = releaseData?.name || "";
|
|
1270
|
-
const timezone =
|
|
1288
|
+
const timezone = getTimezoneValue();
|
|
1271
1289
|
const scheduledAt = releaseData?.scheduledAt && timezone ? dateFnsTz.utcToZonedTime(releaseData.scheduledAt, timezone) : null;
|
|
1272
|
-
const date = scheduledAt ? format__default.default(scheduledAt, "yyyy-MM-dd") :
|
|
1290
|
+
const date = scheduledAt ? format__default.default(scheduledAt, "yyyy-MM-dd") : void 0;
|
|
1273
1291
|
const time = scheduledAt ? format__default.default(scheduledAt, "HH:mm") : "";
|
|
1274
1292
|
const handleEditRelease = async (values) => {
|
|
1275
1293
|
const response = await updateRelease({
|
|
@@ -1287,7 +1305,7 @@ const ReleaseDetailsPage = () => {
|
|
|
1287
1305
|
})
|
|
1288
1306
|
});
|
|
1289
1307
|
toggleEditReleaseModal();
|
|
1290
|
-
} else if (
|
|
1308
|
+
} else if (strapiAdmin.isFetchError(response.error)) {
|
|
1291
1309
|
toggleNotification({
|
|
1292
1310
|
type: "danger",
|
|
1293
1311
|
message: formatAPIError(response.error)
|
|
@@ -1305,7 +1323,7 @@ const ReleaseDetailsPage = () => {
|
|
|
1305
1323
|
});
|
|
1306
1324
|
if ("data" in response) {
|
|
1307
1325
|
navigate("..");
|
|
1308
|
-
} else if (
|
|
1326
|
+
} else if (strapiAdmin.isFetchError(response.error)) {
|
|
1309
1327
|
toggleNotification({
|
|
1310
1328
|
type: "danger",
|
|
1311
1329
|
message: formatAPIError(response.error)
|
|
@@ -1324,9 +1342,10 @@ const ReleaseDetailsPage = () => {
|
|
|
1324
1342
|
toggleWarningSubmit,
|
|
1325
1343
|
children: [
|
|
1326
1344
|
/* @__PURE__ */ jsxRuntime.jsx(ReleaseDetailsBody, { releaseId }),
|
|
1327
|
-
|
|
1345
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1328
1346
|
ReleaseModal,
|
|
1329
1347
|
{
|
|
1348
|
+
open: releaseModalShown,
|
|
1330
1349
|
handleClose: toggleEditReleaseModal,
|
|
1331
1350
|
handleSubmit: handleEditRelease,
|
|
1332
1351
|
isLoading: isLoadingDetails || isSubmittingForm,
|
|
@@ -1340,18 +1359,10 @@ const ReleaseDetailsPage = () => {
|
|
|
1340
1359
|
}
|
|
1341
1360
|
}
|
|
1342
1361
|
),
|
|
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
|
-
)
|
|
1362
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Root, { open: showWarningSubmit, onOpenChange: toggleWarningSubmit, children: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.ConfirmDialog, { onConfirm: handleDeleteRelease, children: formatMessage({
|
|
1363
|
+
id: "content-releases.dialog.confirmation-message",
|
|
1364
|
+
defaultMessage: "Are you sure you want to delete this release?"
|
|
1365
|
+
}) }) })
|
|
1355
1366
|
]
|
|
1356
1367
|
}
|
|
1357
1368
|
);
|
|
@@ -1363,4 +1374,4 @@ const App = () => {
|
|
|
1363
1374
|
] }) });
|
|
1364
1375
|
};
|
|
1365
1376
|
exports.App = App;
|
|
1366
|
-
//# sourceMappingURL=App-
|
|
1377
|
+
//# sourceMappingURL=App-fAgiijnc.js.map
|