@strapi/content-releases 0.0.0-experimental.dd3311938ac827f1fa8560c8840a9a394f5896c0 → 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-D_6Y9N2F.mjs → App-DMILern_.mjs} +359 -347
- package/dist/_chunks/App-DMILern_.mjs.map +1 -0
- package/dist/_chunks/{App-DUmziQ17.js → App-fAgiijnc.js} +356 -345
- package/dist/_chunks/App-fAgiijnc.js.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-C5Hc767q.js → index--_NWfuDG.js} +759 -438
- package/dist/_chunks/index--_NWfuDG.js.map +1 -0
- package/dist/_chunks/{index-BomF0-yY.mjs → index-CYsQToWs.mjs} +772 -451
- 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/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 +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 +10 -9
- 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.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
|
@@ -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--_NWfuDG.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-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,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
|
}
|
|
@@ -657,42 +648,72 @@ 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
|
-
|
|
672
|
-
|
|
673
|
-
const validationErrorsMessages = Object.entries(errors).map(
|
|
674
|
-
([key, value]) => formatMessage(
|
|
675
|
-
// @ts-expect-error – TODO: fix this will better checks
|
|
676
|
-
{ id: `${value.id}.withField`, defaultMessage: value.defaultMessage },
|
|
677
|
-
{ field: key }
|
|
678
|
-
)
|
|
679
|
-
).join(" ");
|
|
680
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
681
|
-
/* @__PURE__ */ jsxRuntime.jsx(icons.CrossCircle, { fill: "danger600" }),
|
|
682
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tooltip, { description: validationErrorsMessages, children: /* @__PURE__ */ jsxRuntime.jsx(TypographyMaxWidth, { textColor: "danger600", variant: "omega", fontWeight: "semiBold", ellipsis: true, children: validationErrorsMessages }) })
|
|
683
|
-
] });
|
|
663
|
+
if (isLoading) {
|
|
664
|
+
return null;
|
|
684
665
|
}
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
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
|
+
}
|
|
696
717
|
}
|
|
697
718
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
698
719
|
/* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
|
@@ -838,83 +859,71 @@ const ReleaseDetailsLayout = ({
|
|
|
838
859
|
] }),
|
|
839
860
|
navigationAction: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.BackButton, {}),
|
|
840
861
|
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
|
-
|
|
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"
|
|
870
894
|
}) })
|
|
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
895
|
] })
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
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
|
+
),
|
|
918
927
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { size: "S", variant: "tertiary", onClick: handleRefresh, children: formatMessage({
|
|
919
928
|
id: "content-releases.header.actions.refresh",
|
|
920
929
|
defaultMessage: "Refresh"
|
|
@@ -939,6 +948,11 @@ const ReleaseDetailsLayout = ({
|
|
|
939
948
|
children
|
|
940
949
|
] });
|
|
941
950
|
};
|
|
951
|
+
const SimpleMenuButton = styledComponents.styled(designSystem.SimpleMenu)`
|
|
952
|
+
& > span {
|
|
953
|
+
display: flex;
|
|
954
|
+
}
|
|
955
|
+
`;
|
|
942
956
|
const GROUP_BY_OPTIONS = ["contentType", "locale", "action"];
|
|
943
957
|
const GROUP_BY_OPTIONS_NO_LOCALE = ["contentType", "action"];
|
|
944
958
|
const getGroupByOptionLabel = (value) => {
|
|
@@ -973,19 +987,18 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
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 {
|
|
@@ -1091,34 +1104,27 @@ 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
|
] : []
|
|
@@ -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,7 +1285,7 @@ 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
1290
|
const date = scheduledAt ? format__default.default(scheduledAt, "yyyy-MM-dd") : void 0;
|
|
1273
1291
|
const time = scheduledAt ? format__default.default(scheduledAt, "HH:mm") : "";
|
|
@@ -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
|