@strapi/content-releases 0.0.0-experimental.dd3311938ac827f1fa8560c8840a9a394f5896c0 → 0.0.0-experimental.e02b4637b3906c6d31048d00600d09a23a0edc3d
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-D_6Y9N2F.mjs → App-BA2xDdy0.mjs} +381 -351
- package/dist/_chunks/App-BA2xDdy0.mjs.map +1 -0
- package/dist/_chunks/{App-DUmziQ17.js → App-D4Wira1X.js} +378 -349
- package/dist/_chunks/App-D4Wira1X.js.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-CCFFG3Zs.mjs +1365 -0
- package/dist/_chunks/index-CCFFG3Zs.mjs.map +1 -0
- package/dist/_chunks/{index-C5Hc767q.js → index-DxkQGp4N.js} +790 -443
- 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/ReleaseActionMenu.d.ts +2 -2
- 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 +2 -1
- 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 +43 -36
- 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 +12 -10
- package/dist/_chunks/App-DUmziQ17.js.map +0 -1
- package/dist/_chunks/App-D_6Y9N2F.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-BomF0-yY.mjs +0 -1018
- package/dist/_chunks/index-BomF0-yY.mjs.map +0 -1
- package/dist/_chunks/index-C5Hc767q.js.map +0 -1
- 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,7 +3,7 @@ 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
8
|
const strapiAdmin$1 = require("@strapi/content-manager/strapi-admin");
|
|
9
9
|
const designSystem = require("@strapi/design-system");
|
|
@@ -15,7 +15,7 @@ const reactIntl = require("react-intl");
|
|
|
15
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,7 +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 yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
|
|
43
42
|
const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
|
|
44
43
|
const RelativeTime$1 = React__namespace.forwardRef(
|
|
45
44
|
({ timestamp, customIntervals = [], ...restProps }, forwardedRef) => {
|
|
@@ -70,28 +69,9 @@ const RelativeTime$1 = React__namespace.forwardRef(
|
|
|
70
69
|
);
|
|
71
70
|
}
|
|
72
71
|
);
|
|
73
|
-
const RELEASE_SCHEMA = yup__namespace.object().shape({
|
|
74
|
-
name: yup__namespace.string().trim().required(),
|
|
75
|
-
scheduledAt: yup__namespace.string().nullable(),
|
|
76
|
-
isScheduled: yup__namespace.boolean().optional(),
|
|
77
|
-
time: yup__namespace.string().when("isScheduled", {
|
|
78
|
-
is: true,
|
|
79
|
-
then: yup__namespace.string().trim().required(),
|
|
80
|
-
otherwise: yup__namespace.string().nullable()
|
|
81
|
-
}),
|
|
82
|
-
timezone: yup__namespace.string().when("isScheduled", {
|
|
83
|
-
is: true,
|
|
84
|
-
then: yup__namespace.string().required().nullable(),
|
|
85
|
-
otherwise: yup__namespace.string().nullable()
|
|
86
|
-
}),
|
|
87
|
-
date: yup__namespace.string().when("isScheduled", {
|
|
88
|
-
is: true,
|
|
89
|
-
then: yup__namespace.string().required().nullable(),
|
|
90
|
-
otherwise: yup__namespace.string().nullable()
|
|
91
|
-
})
|
|
92
|
-
}).required().noUnknown();
|
|
93
72
|
const ReleaseModal = ({
|
|
94
73
|
handleClose,
|
|
74
|
+
open,
|
|
95
75
|
handleSubmit,
|
|
96
76
|
initialValues,
|
|
97
77
|
isLoading = false
|
|
@@ -99,7 +79,7 @@ const ReleaseModal = ({
|
|
|
99
79
|
const { formatMessage } = reactIntl.useIntl();
|
|
100
80
|
const { pathname } = reactRouterDom.useLocation();
|
|
101
81
|
const isCreatingRelease = pathname === `/plugins/${index.pluginId}`;
|
|
102
|
-
const { timezoneList, systemTimezone = { value: "UTC+00:00-Africa/Abidjan " } } = getTimezones(
|
|
82
|
+
const { timezoneList, systemTimezone = { value: "UTC+00:00-Africa/Abidjan " } } = index.getTimezones(
|
|
103
83
|
initialValues.scheduledAt ? new Date(initialValues.scheduledAt) : /* @__PURE__ */ new Date()
|
|
104
84
|
);
|
|
105
85
|
const getScheduledTimestamp = (values) => {
|
|
@@ -115,8 +95,8 @@ const ReleaseModal = ({
|
|
|
115
95
|
);
|
|
116
96
|
return currentTimezone?.value || systemTimezone.value;
|
|
117
97
|
};
|
|
118
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
119
|
-
/* @__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(
|
|
120
100
|
{
|
|
121
101
|
id: "content-releases.modal.title",
|
|
122
102
|
defaultMessage: "{isCreatingRelease, select, true {New release} other {Edit release}}"
|
|
@@ -137,27 +117,35 @@ const ReleaseModal = ({
|
|
|
137
117
|
...initialValues,
|
|
138
118
|
timezone: initialValues.timezone ? getTimezoneWithOffset() : systemTimezone.value
|
|
139
119
|
},
|
|
140
|
-
validationSchema: RELEASE_SCHEMA,
|
|
120
|
+
validationSchema: schemas.RELEASE_SCHEMA,
|
|
141
121
|
validateOnChange: false,
|
|
142
122
|
children: ({ values, errors, handleChange, setFieldValue }) => {
|
|
143
123
|
return /* @__PURE__ */ jsxRuntime.jsxs(formik.Form, { children: [
|
|
144
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
145
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
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
|
+
),
|
|
153
141
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "max-content", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
154
142
|
designSystem.Checkbox,
|
|
155
143
|
{
|
|
156
144
|
name: "isScheduled",
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
setFieldValue("isScheduled",
|
|
160
|
-
if (!
|
|
145
|
+
checked: values.isScheduled,
|
|
146
|
+
onCheckedChange: (checked) => {
|
|
147
|
+
setFieldValue("isScheduled", checked);
|
|
148
|
+
if (!checked) {
|
|
161
149
|
setFieldValue("date", null);
|
|
162
150
|
setFieldValue("time", "");
|
|
163
151
|
setFieldValue("timezone", null);
|
|
@@ -185,86 +173,89 @@ const ReleaseModal = ({
|
|
|
185
173
|
) }),
|
|
186
174
|
values.isScheduled && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
187
175
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, alignItems: "start", children: [
|
|
188
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
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
|
+
) })
|
|
236
240
|
] }),
|
|
237
241
|
/* @__PURE__ */ jsxRuntime.jsx(TimezoneComponent, { timezoneOptions: timezoneList })
|
|
238
242
|
] })
|
|
239
243
|
] }) }),
|
|
240
|
-
/* @__PURE__ */ jsxRuntime.
|
|
241
|
-
designSystem.
|
|
242
|
-
{
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
{
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
) })
|
|
251
|
-
}
|
|
252
|
-
)
|
|
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(
|
|
247
|
+
{
|
|
248
|
+
id: "content-releases.modal.form.button.submit",
|
|
249
|
+
defaultMessage: "{isCreatingRelease, select, true {Continue} other {Save}}"
|
|
250
|
+
},
|
|
251
|
+
{ isCreatingRelease }
|
|
252
|
+
) })
|
|
253
|
+
] })
|
|
253
254
|
] });
|
|
254
255
|
}
|
|
255
256
|
}
|
|
256
257
|
)
|
|
257
|
-
] });
|
|
258
|
-
};
|
|
259
|
-
const getTimezones = (selectedDate) => {
|
|
260
|
-
const timezoneList = Intl.supportedValuesOf("timeZone").map((timezone) => {
|
|
261
|
-
const utcOffset = index.getTimezoneOffset(timezone, selectedDate);
|
|
262
|
-
return { offset: utcOffset, value: `${utcOffset}&${timezone}` };
|
|
263
|
-
});
|
|
264
|
-
const systemTimezone = timezoneList.find(
|
|
265
|
-
(timezone) => timezone.value.split("&")[1] === Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
266
|
-
);
|
|
267
|
-
return { timezoneList, systemTimezone };
|
|
258
|
+
] }) });
|
|
268
259
|
};
|
|
269
260
|
const TimezoneComponent = ({ timezoneOptions }) => {
|
|
270
261
|
const { values, errors, setFieldValue } = formik.useFormikContext();
|
|
@@ -272,7 +263,7 @@ const TimezoneComponent = ({ timezoneOptions }) => {
|
|
|
272
263
|
const [timezoneList, setTimezoneList] = React__namespace.useState(timezoneOptions);
|
|
273
264
|
React__namespace.useEffect(() => {
|
|
274
265
|
if (values.date) {
|
|
275
|
-
const { timezoneList: timezoneList2 } = getTimezones(new Date(values.date));
|
|
266
|
+
const { timezoneList: timezoneList2 } = index.getTimezones(new Date(values.date));
|
|
276
267
|
setTimezoneList(timezoneList2);
|
|
277
268
|
const updatedTimezone = values.timezone && timezoneList2.find((tz) => tz.value.split("&")[1] === values.timezone.split("&")[1]);
|
|
278
269
|
if (updatedTimezone) {
|
|
@@ -280,31 +271,39 @@ const TimezoneComponent = ({ timezoneOptions }) => {
|
|
|
280
271
|
}
|
|
281
272
|
}
|
|
282
273
|
}, [setFieldValue, values.date, values.timezone]);
|
|
283
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
274
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
275
|
+
designSystem.Field.Root,
|
|
276
|
+
{
|
|
277
|
+
name: "timezone",
|
|
278
|
+
error: errors.timezone && formatMessage({ id: errors.timezone, defaultMessage: errors.timezone }),
|
|
279
|
+
required: true,
|
|
280
|
+
children: [
|
|
281
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
282
|
+
id: "content-releases.modal.form.input.label.timezone",
|
|
283
|
+
defaultMessage: "Timezone"
|
|
284
|
+
}) }),
|
|
285
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
286
|
+
designSystem.Combobox,
|
|
287
|
+
{
|
|
288
|
+
autocomplete: { type: "list", filter: "contains" },
|
|
289
|
+
value: values.timezone || void 0,
|
|
290
|
+
textValue: values.timezone ? values.timezone.replace(/&/, " ") : void 0,
|
|
291
|
+
onChange: (timezone) => {
|
|
292
|
+
setFieldValue("timezone", timezone);
|
|
293
|
+
},
|
|
294
|
+
onTextValueChange: (timezone) => {
|
|
295
|
+
setFieldValue("timezone", timezone);
|
|
296
|
+
},
|
|
297
|
+
onClear: () => {
|
|
298
|
+
setFieldValue("timezone", "");
|
|
299
|
+
},
|
|
300
|
+
children: timezoneList.map((timezone) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.ComboboxOption, { value: timezone.value, children: timezone.value.replace(/&/, " ") }, timezone.value))
|
|
301
|
+
}
|
|
302
|
+
),
|
|
303
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
304
|
+
]
|
|
305
|
+
}
|
|
306
|
+
);
|
|
308
307
|
};
|
|
309
308
|
const useTypedDispatch = reactRedux.useDispatch;
|
|
310
309
|
const isBaseQueryError = (error) => {
|
|
@@ -366,7 +365,7 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
366
365
|
}
|
|
367
366
|
);
|
|
368
367
|
}
|
|
369
|
-
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(
|
|
370
369
|
designSystem.Flex,
|
|
371
370
|
{
|
|
372
371
|
direction: "column",
|
|
@@ -381,7 +380,7 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
381
380
|
gap: 4,
|
|
382
381
|
children: [
|
|
383
382
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "start", gap: 1, children: [
|
|
384
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "h3", variant: "delta", fontWeight: "bold", children: name }),
|
|
383
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", tag: "h3", variant: "delta", fontWeight: "bold", children: name }),
|
|
385
384
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: scheduledAt ? /* @__PURE__ */ jsxRuntime.jsx(RelativeTime, { timestamp: new Date(scheduledAt) }) : formatMessage({
|
|
386
385
|
id: "content-releases.pages.Releases.not-scheduled",
|
|
387
386
|
defaultMessage: "Not scheduled"
|
|
@@ -402,14 +401,13 @@ const StyledAlert = styledComponents.styled(designSystem.Alert)`
|
|
|
402
401
|
`;
|
|
403
402
|
const INITIAL_FORM_VALUES = {
|
|
404
403
|
name: "",
|
|
405
|
-
date:
|
|
404
|
+
date: dateFns.format(/* @__PURE__ */ new Date(), "yyyy-MM-dd"),
|
|
406
405
|
time: "",
|
|
407
406
|
isScheduled: true,
|
|
408
407
|
scheduledAt: null,
|
|
409
408
|
timezone: null
|
|
410
409
|
};
|
|
411
410
|
const ReleasesPage = () => {
|
|
412
|
-
const tabRef = React__namespace.useRef(null);
|
|
413
411
|
const location = reactRouterDom.useLocation();
|
|
414
412
|
const [releaseModalShown, setReleaseModalShown] = React__namespace.useState(false);
|
|
415
413
|
const { toggleNotification } = strapiAdmin.useNotification();
|
|
@@ -418,6 +416,7 @@ const ReleasesPage = () => {
|
|
|
418
416
|
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
419
417
|
const [{ query }, setQuery] = strapiAdmin.useQueryParams();
|
|
420
418
|
const response = index.useGetReleasesQuery(query);
|
|
419
|
+
const { data, isLoading: isLoadingSettings } = index.useGetReleaseSettingsQuery();
|
|
421
420
|
const [createRelease, { isLoading: isSubmittingForm }] = index.useCreateReleaseMutation();
|
|
422
421
|
const { getFeature } = ee.useLicenseLimits();
|
|
423
422
|
const { maximumReleases = 3 } = getFeature("cms-content-releases");
|
|
@@ -425,9 +424,8 @@ const ReleasesPage = () => {
|
|
|
425
424
|
const {
|
|
426
425
|
allowedActions: { canCreate }
|
|
427
426
|
} = strapiAdmin.useRBAC(index.PERMISSIONS);
|
|
428
|
-
const { isLoading, isSuccess, isError } = response;
|
|
427
|
+
const { isLoading: isLoadingReleases, isSuccess, isError } = response;
|
|
429
428
|
const activeTab = response?.currentData?.meta?.activeTab || "pending";
|
|
430
|
-
const activeTabIndex = ["pending", "done"].indexOf(activeTab);
|
|
431
429
|
React__namespace.useEffect(() => {
|
|
432
430
|
if (location?.state?.errors) {
|
|
433
431
|
toggleNotification({
|
|
@@ -444,27 +442,22 @@ const ReleasesPage = () => {
|
|
|
444
442
|
navigate("", { replace: true, state: null });
|
|
445
443
|
}
|
|
446
444
|
}, [formatMessage, location?.state?.errors, navigate, toggleNotification]);
|
|
447
|
-
React__namespace.useEffect(() => {
|
|
448
|
-
if (tabRef.current) {
|
|
449
|
-
tabRef.current._handlers.setSelectedTabIndex(activeTabIndex);
|
|
450
|
-
}
|
|
451
|
-
}, [activeTabIndex]);
|
|
452
445
|
const toggleAddReleaseModal = () => {
|
|
453
446
|
setReleaseModalShown((prev) => !prev);
|
|
454
447
|
};
|
|
455
|
-
if (
|
|
448
|
+
if (isLoadingReleases || isLoadingSettings) {
|
|
456
449
|
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
|
|
457
450
|
}
|
|
458
451
|
const totalPendingReleases = isSuccess && response.currentData?.meta?.pendingReleasesCount || 0;
|
|
459
452
|
const hasReachedMaximumPendingReleases = totalPendingReleases >= maximumReleases;
|
|
460
|
-
const handleTabChange = (
|
|
453
|
+
const handleTabChange = (tabValue) => {
|
|
461
454
|
setQuery({
|
|
462
455
|
...query,
|
|
463
456
|
page: 1,
|
|
464
457
|
pageSize: response?.currentData?.meta?.pagination?.pageSize || 16,
|
|
465
458
|
filters: {
|
|
466
459
|
releasedAt: {
|
|
467
|
-
$notNull:
|
|
460
|
+
$notNull: tabValue !== "pending"
|
|
468
461
|
}
|
|
469
462
|
}
|
|
470
463
|
});
|
|
@@ -497,7 +490,7 @@ const ReleasesPage = () => {
|
|
|
497
490
|
});
|
|
498
491
|
}
|
|
499
492
|
};
|
|
500
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { "aria-busy":
|
|
493
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { "aria-busy": isLoadingReleases || isLoadingSettings, children: [
|
|
501
494
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
502
495
|
strapiAdmin.Layouts.Header,
|
|
503
496
|
{
|
|
@@ -548,21 +541,17 @@ const ReleasesPage = () => {
|
|
|
548
541
|
})
|
|
549
542
|
}
|
|
550
543
|
),
|
|
551
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
552
|
-
designSystem.
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
children: [
|
|
563
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { paddingBottom: 8, children: [
|
|
564
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tabs, { children: [
|
|
565
|
-
/* @__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(
|
|
566
555
|
{
|
|
567
556
|
id: "content-releases.pages.Releases.tab.pending",
|
|
568
557
|
defaultMessage: "Pending ({count})"
|
|
@@ -571,34 +560,32 @@ const ReleasesPage = () => {
|
|
|
571
560
|
count: totalPendingReleases
|
|
572
561
|
}
|
|
573
562
|
) }),
|
|
574
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
563
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Trigger, { value: "done", children: formatMessage({
|
|
575
564
|
id: "content-releases.pages.Releases.tab.done",
|
|
576
565
|
defaultMessage: "Done"
|
|
577
566
|
}) })
|
|
578
|
-
]
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
}
|
|
601
|
-
),
|
|
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
|
+
] }),
|
|
602
589
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
603
590
|
strapiAdmin.Pagination.Root,
|
|
604
591
|
{
|
|
@@ -611,13 +598,17 @@ const ReleasesPage = () => {
|
|
|
611
598
|
}
|
|
612
599
|
)
|
|
613
600
|
] }) }),
|
|
614
|
-
|
|
601
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
615
602
|
ReleaseModal,
|
|
616
603
|
{
|
|
604
|
+
open: releaseModalShown,
|
|
617
605
|
handleClose: toggleAddReleaseModal,
|
|
618
606
|
handleSubmit: handleAddRelease,
|
|
619
607
|
isLoading: isSubmittingForm,
|
|
620
|
-
initialValues:
|
|
608
|
+
initialValues: {
|
|
609
|
+
...INITIAL_FORM_VALUES,
|
|
610
|
+
timezone: data?.data.defaultTimezone ? data.data.defaultTimezone.split("&")[1] : null
|
|
611
|
+
}
|
|
621
612
|
}
|
|
622
613
|
)
|
|
623
614
|
] });
|
|
@@ -628,7 +619,7 @@ const ReleaseInfoWrapper = styledComponents.styled(designSystem.Flex)`
|
|
|
628
619
|
border-bottom-left-radius: ${({ theme }) => theme.borderRadius};
|
|
629
620
|
border-top: 1px solid ${({ theme }) => theme.colors.neutral150};
|
|
630
621
|
`;
|
|
631
|
-
const StyledMenuItem = styledComponents.styled(designSystem.
|
|
622
|
+
const StyledMenuItem = styledComponents.styled(designSystem.MenuItem)`
|
|
632
623
|
svg path {
|
|
633
624
|
fill: ${({ theme, disabled }) => disabled && theme.colors.neutral500};
|
|
634
625
|
}
|
|
@@ -641,15 +632,15 @@ const StyledMenuItem = styledComponents.styled(designSystem.Menu.Item)`
|
|
|
641
632
|
}
|
|
642
633
|
`;
|
|
643
634
|
const PencilIcon = styledComponents.styled(icons.Pencil)`
|
|
644
|
-
width: ${({ theme }) => theme.spaces[
|
|
645
|
-
height: ${({ theme }) => theme.spaces[
|
|
635
|
+
width: ${({ theme }) => theme.spaces[4]};
|
|
636
|
+
height: ${({ theme }) => theme.spaces[4]};
|
|
646
637
|
path {
|
|
647
638
|
fill: ${({ theme }) => theme.colors.neutral600};
|
|
648
639
|
}
|
|
649
640
|
`;
|
|
650
641
|
const TrashIcon = styledComponents.styled(icons.Trash)`
|
|
651
|
-
width: ${({ theme }) => theme.spaces[
|
|
652
|
-
height: ${({ theme }) => theme.spaces[
|
|
642
|
+
width: ${({ theme }) => theme.spaces[4]};
|
|
643
|
+
height: ${({ theme }) => theme.spaces[4]};
|
|
653
644
|
path {
|
|
654
645
|
fill: ${({ theme }) => theme.colors.danger600};
|
|
655
646
|
}
|
|
@@ -657,42 +648,90 @@ const TrashIcon = styledComponents.styled(icons.Trash)`
|
|
|
657
648
|
const TypographyMaxWidth = styledComponents.styled(designSystem.Typography)`
|
|
658
649
|
max-width: 300px;
|
|
659
650
|
`;
|
|
660
|
-
const EntryValidationText = ({ action, schema, entry }) => {
|
|
651
|
+
const EntryValidationText = ({ action, schema, entry, status }) => {
|
|
661
652
|
const { formatMessage } = reactIntl.useIntl();
|
|
662
|
-
const { validate } = strapiAdmin$1.unstable_useDocument(
|
|
653
|
+
const { validate, isLoading } = strapiAdmin$1.unstable_useDocument(
|
|
663
654
|
{
|
|
664
655
|
collectionType: schema?.kind ?? "",
|
|
665
656
|
model: schema?.uid ?? ""
|
|
666
657
|
},
|
|
667
658
|
{
|
|
668
|
-
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
|
|
669
661
|
}
|
|
670
662
|
);
|
|
671
|
-
const
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
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;
|
|
684
689
|
}
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
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
|
+
}
|
|
696
735
|
}
|
|
697
736
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
698
737
|
/* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
|
@@ -838,83 +877,71 @@ const ReleaseDetailsLayout = ({
|
|
|
838
877
|
] }),
|
|
839
878
|
navigationAction: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.BackButton, {}),
|
|
840
879
|
primaryAction: !release.releasedAt && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
841
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
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
|
-
|
|
869
|
-
|
|
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"
|
|
870
912
|
}) })
|
|
871
|
-
] }) }),
|
|
872
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
873
|
-
StyledMenuItem,
|
|
874
|
-
{
|
|
875
|
-
disabled: !canDelete,
|
|
876
|
-
onSelect: toggleWarningSubmit,
|
|
877
|
-
$variant: "danger",
|
|
878
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 2, hasRadius: true, width: "100%", children: [
|
|
879
|
-
/* @__PURE__ */ jsxRuntime.jsx(TrashIcon, {}),
|
|
880
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { ellipsis: true, textColor: "danger600", children: formatMessage({
|
|
881
|
-
id: "content-releases.header.actions.delete",
|
|
882
|
-
defaultMessage: "Delete"
|
|
883
|
-
}) })
|
|
884
|
-
] })
|
|
885
|
-
}
|
|
886
|
-
)
|
|
887
|
-
]
|
|
888
|
-
}
|
|
889
|
-
),
|
|
890
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
891
|
-
ReleaseInfoWrapper,
|
|
892
|
-
{
|
|
893
|
-
direction: "column",
|
|
894
|
-
justifyContent: "center",
|
|
895
|
-
alignItems: "flex-start",
|
|
896
|
-
gap: 1,
|
|
897
|
-
padding: 5,
|
|
898
|
-
children: [
|
|
899
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", children: formatMessage({
|
|
900
|
-
id: "content-releases.header.actions.created",
|
|
901
|
-
defaultMessage: "Created"
|
|
902
|
-
}) }),
|
|
903
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", color: "neutral300", children: [
|
|
904
|
-
/* @__PURE__ */ jsxRuntime.jsx(RelativeTime$1, { timestamp: new Date(release.createdAt) }),
|
|
905
|
-
formatMessage(
|
|
906
|
-
{
|
|
907
|
-
id: "content-releases.header.actions.created.description",
|
|
908
|
-
defaultMessage: "{hasCreatedByUser, select, true { by {createdBy}} other { by deleted user}}"
|
|
909
|
-
},
|
|
910
|
-
{ createdBy: getCreatedByUser(), hasCreatedByUser }
|
|
911
|
-
)
|
|
912
913
|
] })
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
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
|
+
),
|
|
918
945
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { size: "S", variant: "tertiary", onClick: handleRefresh, children: formatMessage({
|
|
919
946
|
id: "content-releases.header.actions.refresh",
|
|
920
947
|
defaultMessage: "Refresh"
|
|
@@ -939,6 +966,11 @@ const ReleaseDetailsLayout = ({
|
|
|
939
966
|
children
|
|
940
967
|
] });
|
|
941
968
|
};
|
|
969
|
+
const SimpleMenuButton = styledComponents.styled(designSystem.SimpleMenu)`
|
|
970
|
+
& > span {
|
|
971
|
+
display: flex;
|
|
972
|
+
}
|
|
973
|
+
`;
|
|
942
974
|
const GROUP_BY_OPTIONS = ["contentType", "locale", "action"];
|
|
943
975
|
const GROUP_BY_OPTIONS_NO_LOCALE = ["contentType", "action"];
|
|
944
976
|
const getGroupByOptionLabel = (value) => {
|
|
@@ -973,19 +1005,18 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
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 {
|
|
@@ -1091,34 +1122,27 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1091
1122
|
defaultMessage: "Group by"
|
|
1092
1123
|
});
|
|
1093
1124
|
const headers = [
|
|
1094
|
-
|
|
1125
|
+
...displayedHeaders,
|
|
1095
1126
|
{
|
|
1096
|
-
label:
|
|
1097
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.name",
|
|
1098
|
-
defaultMessage: "name"
|
|
1099
|
-
}),
|
|
1100
|
-
name: "name"
|
|
1101
|
-
},
|
|
1102
|
-
{
|
|
1103
|
-
label: formatMessage({
|
|
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
|
] : []
|
|
@@ -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,7 +1303,7 @@ 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
1308
|
const date = scheduledAt ? format__default.default(scheduledAt, "yyyy-MM-dd") : void 0;
|
|
1273
1309
|
const time = scheduledAt ? format__default.default(scheduledAt, "HH:mm") : "";
|
|
@@ -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
|