@strapi/content-releases 0.0.0-experimental.d5b46d578a5c055b8dcc66939e1b5d540976fafb → 0.0.0-experimental.d954d57341a6623992a0d211daaec8e245c3517d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{App-OP70yd5M.js → App-CqbuK4M6.js} +440 -433
- package/dist/_chunks/App-CqbuK4M6.js.map +1 -0
- package/dist/_chunks/{App-x6Tjj3HN.mjs → App-Do-Rnv0A.mjs} +418 -410
- package/dist/_chunks/App-Do-Rnv0A.mjs.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-bpIYXOfu.js → PurchaseContentReleases-Be3acS2L.js} +7 -6
- package/dist/_chunks/PurchaseContentReleases-Be3acS2L.js.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-3tRbmbY3.mjs → PurchaseContentReleases-_MxP6-Dt.mjs} +8 -7
- package/dist/_chunks/PurchaseContentReleases-_MxP6-Dt.mjs.map +1 -0
- package/dist/_chunks/{en-bpHsnU0n.mjs → en-B9Ur3VsE.mjs} +2 -1
- package/dist/_chunks/en-B9Ur3VsE.mjs.map +1 -0
- package/dist/_chunks/{en-3SGjiVyR.js → en-DtFJ5ViE.js} +2 -1
- package/dist/_chunks/en-DtFJ5ViE.js.map +1 -0
- package/dist/_chunks/{index-1ejXLtzt.mjs → index-D_pgdqQL.mjs} +227 -420
- package/dist/_chunks/index-D_pgdqQL.mjs.map +1 -0
- package/dist/_chunks/{index-ydocdaZ0.js → index-Tedsw4GC.js} +227 -422
- package/dist/_chunks/index-Tedsw4GC.js.map +1 -0
- package/dist/admin/index.js +1 -15
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +2 -16
- package/dist/admin/index.mjs.map +1 -1
- package/dist/admin/src/components/CMReleasesContainer.d.ts +22 -0
- package/dist/admin/src/components/RelativeTime.d.ts +28 -0
- package/dist/admin/src/components/ReleaseAction.d.ts +3 -0
- package/dist/admin/src/components/ReleaseActionMenu.d.ts +26 -0
- package/dist/admin/src/components/ReleaseActionOptions.d.ts +9 -0
- package/dist/admin/src/components/ReleaseListCell.d.ts +0 -0
- package/dist/admin/src/components/ReleaseModal.d.ts +17 -0
- package/dist/admin/src/constants.d.ts +58 -0
- package/dist/admin/src/index.d.ts +3 -0
- package/dist/admin/src/pages/App.d.ts +1 -0
- package/dist/admin/src/pages/PurchaseContentReleases.d.ts +2 -0
- package/dist/admin/src/pages/ReleaseDetailsPage.d.ts +2 -0
- package/dist/admin/src/pages/ReleasesPage.d.ts +8 -0
- package/dist/admin/src/pages/tests/mockReleaseDetailsPageData.d.ts +181 -0
- package/dist/admin/src/pages/tests/mockReleasesPageData.d.ts +39 -0
- package/dist/admin/src/pluginId.d.ts +1 -0
- package/dist/admin/src/services/release.d.ts +105 -0
- package/dist/admin/src/store/hooks.d.ts +7 -0
- package/dist/admin/src/utils/api.d.ts +6 -0
- package/dist/admin/src/utils/prefixPluginTranslations.d.ts +3 -0
- package/dist/admin/src/utils/time.d.ts +1 -0
- package/dist/server/index.js +152 -93
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +153 -93
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/bootstrap.d.ts +5 -0
- package/dist/server/src/bootstrap.d.ts.map +1 -0
- package/dist/server/src/constants.d.ts +12 -0
- package/dist/server/src/constants.d.ts.map +1 -0
- package/dist/server/src/content-types/index.d.ts +99 -0
- package/dist/server/src/content-types/index.d.ts.map +1 -0
- package/dist/server/src/content-types/release/index.d.ts +48 -0
- package/dist/server/src/content-types/release/index.d.ts.map +1 -0
- package/dist/server/src/content-types/release/schema.d.ts +47 -0
- package/dist/server/src/content-types/release/schema.d.ts.map +1 -0
- package/dist/server/src/content-types/release-action/index.d.ts +50 -0
- package/dist/server/src/content-types/release-action/index.d.ts.map +1 -0
- package/dist/server/src/content-types/release-action/schema.d.ts +49 -0
- package/dist/server/src/content-types/release-action/schema.d.ts.map +1 -0
- package/dist/server/src/controllers/index.d.ts +20 -0
- package/dist/server/src/controllers/index.d.ts.map +1 -0
- package/dist/server/src/controllers/release-action.d.ts +10 -0
- package/dist/server/src/controllers/release-action.d.ts.map +1 -0
- package/dist/server/src/controllers/release.d.ts +12 -0
- package/dist/server/src/controllers/release.d.ts.map +1 -0
- package/dist/server/src/controllers/validation/release-action.d.ts +8 -0
- package/dist/server/src/controllers/validation/release-action.d.ts.map +1 -0
- package/dist/server/src/controllers/validation/release.d.ts +2 -0
- package/dist/server/src/controllers/validation/release.d.ts.map +1 -0
- package/dist/server/src/destroy.d.ts +5 -0
- package/dist/server/src/destroy.d.ts.map +1 -0
- package/dist/server/src/index.d.ts +2096 -0
- package/dist/server/src/index.d.ts.map +1 -0
- package/dist/server/src/migrations/index.d.ts +13 -0
- package/dist/server/src/migrations/index.d.ts.map +1 -0
- package/dist/server/src/register.d.ts +5 -0
- package/dist/server/src/register.d.ts.map +1 -0
- package/dist/server/src/routes/index.d.ts +35 -0
- package/dist/server/src/routes/index.d.ts.map +1 -0
- package/dist/server/src/routes/release-action.d.ts +18 -0
- package/dist/server/src/routes/release-action.d.ts.map +1 -0
- package/dist/server/src/routes/release.d.ts +18 -0
- package/dist/server/src/routes/release.d.ts.map +1 -0
- package/dist/server/src/services/index.d.ts +1826 -0
- package/dist/server/src/services/index.d.ts.map +1 -0
- package/dist/server/src/services/release.d.ts +66 -0
- package/dist/server/src/services/release.d.ts.map +1 -0
- package/dist/server/src/services/scheduling.d.ts +18 -0
- package/dist/server/src/services/scheduling.d.ts.map +1 -0
- package/dist/server/src/services/validation.d.ts +18 -0
- package/dist/server/src/services/validation.d.ts.map +1 -0
- package/dist/server/src/utils/index.d.ts +14 -0
- package/dist/server/src/utils/index.d.ts.map +1 -0
- package/dist/shared/contracts/release-actions.d.ts +131 -0
- package/dist/shared/contracts/release-actions.d.ts.map +1 -0
- package/dist/shared/contracts/releases.d.ts +182 -0
- package/dist/shared/contracts/releases.d.ts.map +1 -0
- package/dist/shared/types.d.ts +24 -0
- package/dist/shared/types.d.ts.map +1 -0
- package/dist/shared/validation-schemas.d.ts +2 -0
- package/dist/shared/validation-schemas.d.ts.map +1 -0
- package/package.json +29 -36
- package/dist/_chunks/App-OP70yd5M.js.map +0 -1
- package/dist/_chunks/App-x6Tjj3HN.mjs.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-3tRbmbY3.mjs.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-bpIYXOfu.js.map +0 -1
- package/dist/_chunks/en-3SGjiVyR.js.map +0 -1
- package/dist/_chunks/en-bpHsnU0n.mjs.map +0 -1
- package/dist/_chunks/index-1ejXLtzt.mjs.map +0 -1
- package/dist/_chunks/index-ydocdaZ0.js.map +0 -1
|
@@ -1,25 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
-
const
|
|
4
|
+
const strapiAdmin = require("@strapi/admin/strapi-admin");
|
|
5
5
|
const reactRouterDom = require("react-router-dom");
|
|
6
|
-
const index = require("./index-
|
|
6
|
+
const index = require("./index-Tedsw4GC.js");
|
|
7
7
|
const React = require("react");
|
|
8
|
-
const strapiAdmin = require("@strapi/
|
|
8
|
+
const strapiAdmin$1 = require("@strapi/content-manager/strapi-admin");
|
|
9
9
|
const designSystem = require("@strapi/design-system");
|
|
10
|
-
const v2 = require("@strapi/design-system/v2");
|
|
11
10
|
const icons = require("@strapi/icons");
|
|
11
|
+
const symbols = require("@strapi/icons/symbols");
|
|
12
12
|
const format = require("date-fns/format");
|
|
13
13
|
const dateFnsTz = require("date-fns-tz");
|
|
14
14
|
const reactIntl = require("react-intl");
|
|
15
|
-
const
|
|
15
|
+
const styledComponents = require("styled-components");
|
|
16
16
|
const dateFns = require("date-fns");
|
|
17
17
|
const formik = require("formik");
|
|
18
18
|
const yup = require("yup");
|
|
19
|
-
require("
|
|
20
|
-
require("
|
|
21
|
-
require("@reduxjs/toolkit/query/react");
|
|
22
|
-
require("react-redux");
|
|
19
|
+
const reactRedux = require("react-redux");
|
|
20
|
+
const ee = require("@strapi/admin/strapi-admin/ee");
|
|
23
21
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
24
22
|
function _interopNamespace(e) {
|
|
25
23
|
if (e && e.__esModule)
|
|
@@ -41,8 +39,37 @@ function _interopNamespace(e) {
|
|
|
41
39
|
}
|
|
42
40
|
const React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
|
43
41
|
const format__default = /* @__PURE__ */ _interopDefault(format);
|
|
44
|
-
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
45
42
|
const yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
|
|
43
|
+
const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
|
|
44
|
+
const RelativeTime$1 = React__namespace.forwardRef(
|
|
45
|
+
({ timestamp, customIntervals = [], ...restProps }, forwardedRef) => {
|
|
46
|
+
const { formatRelativeTime, formatDate, formatTime } = reactIntl.useIntl();
|
|
47
|
+
const interval = dateFns.intervalToDuration({
|
|
48
|
+
start: timestamp,
|
|
49
|
+
end: Date.now()
|
|
50
|
+
// see https://github.com/date-fns/date-fns/issues/2891 – No idea why it's all partial it returns it every time.
|
|
51
|
+
});
|
|
52
|
+
const unit = intervals.find((intervalUnit) => {
|
|
53
|
+
return interval[intervalUnit] > 0 && Object.keys(interval).includes(intervalUnit);
|
|
54
|
+
});
|
|
55
|
+
const relativeTime = dateFns.isPast(timestamp) ? -interval[unit] : interval[unit];
|
|
56
|
+
const customInterval = customIntervals.find(
|
|
57
|
+
(custom) => interval[custom.unit] < custom.threshold
|
|
58
|
+
);
|
|
59
|
+
const displayText = customInterval ? customInterval.text : formatRelativeTime(relativeTime, unit, { numeric: "auto" });
|
|
60
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
61
|
+
"time",
|
|
62
|
+
{
|
|
63
|
+
ref: forwardedRef,
|
|
64
|
+
dateTime: timestamp.toISOString(),
|
|
65
|
+
role: "time",
|
|
66
|
+
title: `${formatDate(timestamp)} ${formatTime(timestamp)}`,
|
|
67
|
+
...restProps,
|
|
68
|
+
children: displayText
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
);
|
|
46
73
|
const RELEASE_SCHEMA = yup__namespace.object().shape({
|
|
47
74
|
name: yup__namespace.string().trim().required(),
|
|
48
75
|
scheduledAt: yup__namespace.string().nullable(),
|
|
@@ -65,6 +92,7 @@ const RELEASE_SCHEMA = yup__namespace.object().shape({
|
|
|
65
92
|
}).required().noUnknown();
|
|
66
93
|
const ReleaseModal = ({
|
|
67
94
|
handleClose,
|
|
95
|
+
open,
|
|
68
96
|
handleSubmit,
|
|
69
97
|
initialValues,
|
|
70
98
|
isLoading = false
|
|
@@ -88,8 +116,8 @@ const ReleaseModal = ({
|
|
|
88
116
|
);
|
|
89
117
|
return currentTimezone?.value || systemTimezone.value;
|
|
90
118
|
};
|
|
91
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
92
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
119
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Root, { open, onOpenChange: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Content, { children: [
|
|
120
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Title, { children: formatMessage(
|
|
93
121
|
{
|
|
94
122
|
id: "content-releases.modal.title",
|
|
95
123
|
defaultMessage: "{isCreatingRelease, select, true {New release} other {Edit release}}"
|
|
@@ -112,123 +140,119 @@ const ReleaseModal = ({
|
|
|
112
140
|
},
|
|
113
141
|
validationSchema: RELEASE_SCHEMA,
|
|
114
142
|
validateOnChange: false,
|
|
115
|
-
children: ({ values, errors, handleChange, setFieldValue }) =>
|
|
116
|
-
|
|
117
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
118
|
-
designSystem.
|
|
119
|
-
|
|
120
|
-
label: formatMessage({
|
|
143
|
+
children: ({ values, errors, handleChange, setFieldValue }) => {
|
|
144
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(formik.Form, { children: [
|
|
145
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Body, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
|
|
146
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { name: "name", error: errors.name, required: true, children: [
|
|
147
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
121
148
|
id: "content-releases.modal.form.input.label.release-name",
|
|
122
149
|
defaultMessage: "Name"
|
|
123
|
-
}),
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
designSystem.DatePicker,
|
|
165
|
-
{
|
|
166
|
-
label: formatMessage({
|
|
150
|
+
}) }),
|
|
151
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.TextInput, { value: values.name, onChange: handleChange }),
|
|
152
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
153
|
+
] }),
|
|
154
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "max-content", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
155
|
+
designSystem.Checkbox,
|
|
156
|
+
{
|
|
157
|
+
name: "isScheduled",
|
|
158
|
+
checked: values.isScheduled,
|
|
159
|
+
onCheckedChange: (checked) => {
|
|
160
|
+
setFieldValue("isScheduled", checked);
|
|
161
|
+
if (!checked) {
|
|
162
|
+
setFieldValue("date", null);
|
|
163
|
+
setFieldValue("time", "");
|
|
164
|
+
setFieldValue("timezone", null);
|
|
165
|
+
} else {
|
|
166
|
+
setFieldValue("date", initialValues.date);
|
|
167
|
+
setFieldValue("time", initialValues.time);
|
|
168
|
+
setFieldValue(
|
|
169
|
+
"timezone",
|
|
170
|
+
initialValues.timezone ?? systemTimezone?.value
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
175
|
+
designSystem.Typography,
|
|
176
|
+
{
|
|
177
|
+
textColor: values.isScheduled ? "primary600" : "neutral800",
|
|
178
|
+
fontWeight: values.isScheduled ? "semiBold" : "regular",
|
|
179
|
+
children: formatMessage({
|
|
180
|
+
id: "modal.form.input.label.schedule-release",
|
|
181
|
+
defaultMessage: "Schedule release"
|
|
182
|
+
})
|
|
183
|
+
}
|
|
184
|
+
)
|
|
185
|
+
}
|
|
186
|
+
) }),
|
|
187
|
+
values.isScheduled && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
188
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, alignItems: "start", children: [
|
|
189
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { name: "date", error: errors.date, required: true, children: [
|
|
190
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
167
191
|
id: "content-releases.modal.form.input.label.date",
|
|
168
192
|
defaultMessage: "Date"
|
|
169
|
-
}),
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
{
|
|
191
|
-
|
|
193
|
+
}) }),
|
|
194
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
195
|
+
designSystem.DatePicker,
|
|
196
|
+
{
|
|
197
|
+
onChange: (date) => {
|
|
198
|
+
const isoFormatDate = date ? dateFns.formatISO(date, { representation: "date" }) : null;
|
|
199
|
+
setFieldValue("date", isoFormatDate);
|
|
200
|
+
},
|
|
201
|
+
clearLabel: formatMessage({
|
|
202
|
+
id: "content-releases.modal.form.input.clearLabel",
|
|
203
|
+
defaultMessage: "Clear"
|
|
204
|
+
}),
|
|
205
|
+
onClear: () => {
|
|
206
|
+
setFieldValue("date", null);
|
|
207
|
+
},
|
|
208
|
+
value: values.date ? new Date(values.date) : /* @__PURE__ */ new Date(),
|
|
209
|
+
minDate: dateFnsTz.utcToZonedTime(/* @__PURE__ */ new Date(), values.timezone.split("&")[1])
|
|
210
|
+
}
|
|
211
|
+
),
|
|
212
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
213
|
+
] }) }),
|
|
214
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { name: "time", error: errors.time, required: true, children: [
|
|
215
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
192
216
|
id: "content-releases.modal.form.input.label.time",
|
|
193
217
|
defaultMessage: "Time"
|
|
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
|
-
|
|
218
|
+
}) }),
|
|
219
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
220
|
+
designSystem.TimePicker,
|
|
221
|
+
{
|
|
222
|
+
onChange: (time) => {
|
|
223
|
+
setFieldValue("time", time);
|
|
224
|
+
},
|
|
225
|
+
clearLabel: formatMessage({
|
|
226
|
+
id: "content-releases.modal.form.input.clearLabel",
|
|
227
|
+
defaultMessage: "Clear"
|
|
228
|
+
}),
|
|
229
|
+
onClear: () => {
|
|
230
|
+
setFieldValue("time", "");
|
|
231
|
+
},
|
|
232
|
+
value: values.time || void 0
|
|
233
|
+
}
|
|
234
|
+
),
|
|
235
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
236
|
+
] }) })
|
|
237
|
+
] }),
|
|
238
|
+
/* @__PURE__ */ jsxRuntime.jsx(TimezoneComponent, { timezoneOptions: timezoneList })
|
|
239
|
+
] })
|
|
240
|
+
] }) }),
|
|
241
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Footer, { children: [
|
|
242
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Close, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", name: "cancel", children: formatMessage({ id: "cancel", defaultMessage: "Cancel" }) }) }),
|
|
243
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { name: "submit", loading: isLoading, type: "submit", children: formatMessage(
|
|
220
244
|
{
|
|
221
245
|
id: "content-releases.modal.form.button.submit",
|
|
222
246
|
defaultMessage: "{isCreatingRelease, select, true {Continue} other {Save}}"
|
|
223
247
|
},
|
|
224
248
|
{ isCreatingRelease }
|
|
225
249
|
) })
|
|
226
|
-
}
|
|
227
|
-
)
|
|
228
|
-
|
|
250
|
+
] })
|
|
251
|
+
] });
|
|
252
|
+
}
|
|
229
253
|
}
|
|
230
254
|
)
|
|
231
|
-
] });
|
|
255
|
+
] }) });
|
|
232
256
|
};
|
|
233
257
|
const getTimezones = (selectedDate) => {
|
|
234
258
|
const timezoneList = Intl.supportedValuesOf("timeZone").map((timezone) => {
|
|
@@ -254,36 +278,40 @@ const TimezoneComponent = ({ timezoneOptions }) => {
|
|
|
254
278
|
}
|
|
255
279
|
}
|
|
256
280
|
}, [setFieldValue, values.date, values.timezone]);
|
|
257
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
258
|
-
designSystem.
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
}
|
|
281
|
-
);
|
|
281
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { name: "timezone", error: errors.timezone, required: true, children: [
|
|
282
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
283
|
+
id: "content-releases.modal.form.input.label.timezone",
|
|
284
|
+
defaultMessage: "Timezone"
|
|
285
|
+
}) }),
|
|
286
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
287
|
+
designSystem.Combobox,
|
|
288
|
+
{
|
|
289
|
+
autocomplete: { type: "list", filter: "contains" },
|
|
290
|
+
value: values.timezone || void 0,
|
|
291
|
+
textValue: values.timezone ? values.timezone.replace(/&/, " ") : void 0,
|
|
292
|
+
onChange: (timezone) => {
|
|
293
|
+
setFieldValue("timezone", timezone);
|
|
294
|
+
},
|
|
295
|
+
onTextValueChange: (timezone) => {
|
|
296
|
+
setFieldValue("timezone", timezone);
|
|
297
|
+
},
|
|
298
|
+
onClear: () => {
|
|
299
|
+
setFieldValue("timezone", "");
|
|
300
|
+
},
|
|
301
|
+
children: timezoneList.map((timezone) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.ComboboxOption, { value: timezone.value, children: timezone.value.replace(/&/, " ") }, timezone.value))
|
|
302
|
+
}
|
|
303
|
+
),
|
|
304
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
305
|
+
] });
|
|
282
306
|
};
|
|
283
|
-
const
|
|
307
|
+
const useTypedDispatch = reactRedux.useDispatch;
|
|
308
|
+
const isBaseQueryError = (error) => {
|
|
309
|
+
return typeof error !== "undefined" && error.name !== void 0;
|
|
310
|
+
};
|
|
311
|
+
const LinkCard = styledComponents.styled(designSystem.Link)`
|
|
284
312
|
display: block;
|
|
285
313
|
`;
|
|
286
|
-
const RelativeTime =
|
|
314
|
+
const RelativeTime = styledComponents.styled(RelativeTime$1)`
|
|
287
315
|
display: inline-block;
|
|
288
316
|
&::first-letter {
|
|
289
317
|
text-transform: uppercase;
|
|
@@ -317,7 +345,7 @@ const getBadgeProps = (status) => {
|
|
|
317
345
|
const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
318
346
|
const { formatMessage } = reactIntl.useIntl();
|
|
319
347
|
if (isError) {
|
|
320
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
348
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Error, {});
|
|
321
349
|
}
|
|
322
350
|
if (releases?.length === 0) {
|
|
323
351
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -332,11 +360,11 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
332
360
|
target: sectionTitle
|
|
333
361
|
}
|
|
334
362
|
),
|
|
335
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
363
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(symbols.EmptyDocuments, { width: "16rem" })
|
|
336
364
|
}
|
|
337
365
|
);
|
|
338
366
|
}
|
|
339
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid, { gap: 4, children: releases.map(({ id, name, scheduledAt, status }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
367
|
+
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, children: /* @__PURE__ */ jsxRuntime.jsx(LinkCard, { tag: reactRouterDom.NavLink, to: `${id}`, isExternal: false, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
340
368
|
designSystem.Flex,
|
|
341
369
|
{
|
|
342
370
|
direction: "column",
|
|
@@ -351,7 +379,7 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
351
379
|
gap: 4,
|
|
352
380
|
children: [
|
|
353
381
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "start", gap: 1, children: [
|
|
354
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, {
|
|
382
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", tag: "h3", variant: "delta", fontWeight: "bold", children: name }),
|
|
355
383
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: scheduledAt ? /* @__PURE__ */ jsxRuntime.jsx(RelativeTime, { timestamp: new Date(scheduledAt) }) : formatMessage({
|
|
356
384
|
id: "content-releases.pages.Releases.not-scheduled",
|
|
357
385
|
defaultMessage: "Not scheduled"
|
|
@@ -362,7 +390,7 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
362
390
|
}
|
|
363
391
|
) }) }, id)) });
|
|
364
392
|
};
|
|
365
|
-
const StyledAlert =
|
|
393
|
+
const StyledAlert = styledComponents.styled(designSystem.Alert)`
|
|
366
394
|
button {
|
|
367
395
|
display: none;
|
|
368
396
|
}
|
|
@@ -372,33 +400,34 @@ const StyledAlert = styled__default.default(designSystem.Alert)`
|
|
|
372
400
|
`;
|
|
373
401
|
const INITIAL_FORM_VALUES = {
|
|
374
402
|
name: "",
|
|
375
|
-
date:
|
|
403
|
+
date: void 0,
|
|
376
404
|
time: "",
|
|
377
405
|
isScheduled: true,
|
|
378
406
|
scheduledAt: null,
|
|
379
407
|
timezone: null
|
|
380
408
|
};
|
|
381
409
|
const ReleasesPage = () => {
|
|
382
|
-
const tabRef = React__namespace.useRef(null);
|
|
383
410
|
const location = reactRouterDom.useLocation();
|
|
384
411
|
const [releaseModalShown, setReleaseModalShown] = React__namespace.useState(false);
|
|
385
|
-
const toggleNotification =
|
|
412
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
386
413
|
const { formatMessage } = reactIntl.useIntl();
|
|
387
|
-
const
|
|
388
|
-
const { formatAPIError } =
|
|
389
|
-
const [{ query }, setQuery] =
|
|
414
|
+
const navigate = reactRouterDom.useNavigate();
|
|
415
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
416
|
+
const [{ query }, setQuery] = strapiAdmin.useQueryParams();
|
|
390
417
|
const response = index.useGetReleasesQuery(query);
|
|
391
418
|
const [createRelease, { isLoading: isSubmittingForm }] = index.useCreateReleaseMutation();
|
|
392
|
-
const { getFeature } =
|
|
419
|
+
const { getFeature } = ee.useLicenseLimits();
|
|
393
420
|
const { maximumReleases = 3 } = getFeature("cms-content-releases");
|
|
394
|
-
const { trackUsage } =
|
|
421
|
+
const { trackUsage } = strapiAdmin.useTracking();
|
|
422
|
+
const {
|
|
423
|
+
allowedActions: { canCreate }
|
|
424
|
+
} = strapiAdmin.useRBAC(index.PERMISSIONS);
|
|
395
425
|
const { isLoading, isSuccess, isError } = response;
|
|
396
426
|
const activeTab = response?.currentData?.meta?.activeTab || "pending";
|
|
397
|
-
const activeTabIndex = ["pending", "done"].indexOf(activeTab);
|
|
398
427
|
React__namespace.useEffect(() => {
|
|
399
428
|
if (location?.state?.errors) {
|
|
400
429
|
toggleNotification({
|
|
401
|
-
type: "
|
|
430
|
+
type: "danger",
|
|
402
431
|
title: formatMessage({
|
|
403
432
|
id: "content-releases.pages.Releases.notification.error.title",
|
|
404
433
|
defaultMessage: "Your request could not be processed."
|
|
@@ -408,30 +437,25 @@ const ReleasesPage = () => {
|
|
|
408
437
|
defaultMessage: "Please try again or open another release."
|
|
409
438
|
})
|
|
410
439
|
});
|
|
411
|
-
|
|
412
|
-
}
|
|
413
|
-
}, [formatMessage, location?.state?.errors, replace, toggleNotification]);
|
|
414
|
-
React__namespace.useEffect(() => {
|
|
415
|
-
if (tabRef.current) {
|
|
416
|
-
tabRef.current._handlers.setSelectedTabIndex(activeTabIndex);
|
|
440
|
+
navigate("", { replace: true, state: null });
|
|
417
441
|
}
|
|
418
|
-
}, [
|
|
442
|
+
}, [formatMessage, location?.state?.errors, navigate, toggleNotification]);
|
|
419
443
|
const toggleAddReleaseModal = () => {
|
|
420
444
|
setReleaseModalShown((prev) => !prev);
|
|
421
445
|
};
|
|
422
446
|
if (isLoading) {
|
|
423
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
447
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
|
|
424
448
|
}
|
|
425
449
|
const totalPendingReleases = isSuccess && response.currentData?.meta?.pendingReleasesCount || 0;
|
|
426
450
|
const hasReachedMaximumPendingReleases = totalPendingReleases >= maximumReleases;
|
|
427
|
-
const handleTabChange = (
|
|
451
|
+
const handleTabChange = (tabValue) => {
|
|
428
452
|
setQuery({
|
|
429
453
|
...query,
|
|
430
454
|
page: 1,
|
|
431
455
|
pageSize: response?.currentData?.meta?.pagination?.pageSize || 16,
|
|
432
456
|
filters: {
|
|
433
457
|
releasedAt: {
|
|
434
|
-
$notNull:
|
|
458
|
+
$notNull: tabValue === "pending"
|
|
435
459
|
}
|
|
436
460
|
}
|
|
437
461
|
});
|
|
@@ -451,22 +475,22 @@ const ReleasesPage = () => {
|
|
|
451
475
|
})
|
|
452
476
|
});
|
|
453
477
|
trackUsage("didCreateRelease");
|
|
454
|
-
|
|
455
|
-
} else if (
|
|
478
|
+
navigate(response2.data.data.id.toString());
|
|
479
|
+
} else if (strapiAdmin.isFetchError(response2.error)) {
|
|
456
480
|
toggleNotification({
|
|
457
|
-
type: "
|
|
481
|
+
type: "danger",
|
|
458
482
|
message: formatAPIError(response2.error)
|
|
459
483
|
});
|
|
460
484
|
} else {
|
|
461
485
|
toggleNotification({
|
|
462
|
-
type: "
|
|
486
|
+
type: "danger",
|
|
463
487
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
464
488
|
});
|
|
465
489
|
}
|
|
466
490
|
};
|
|
467
491
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { "aria-busy": isLoading, children: [
|
|
468
492
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
469
|
-
|
|
493
|
+
strapiAdmin.Layouts.Header,
|
|
470
494
|
{
|
|
471
495
|
title: formatMessage({
|
|
472
496
|
id: "content-releases.pages.Releases.title",
|
|
@@ -476,7 +500,7 @@ const ReleasesPage = () => {
|
|
|
476
500
|
id: "content-releases.pages.Releases.header-subtitle",
|
|
477
501
|
defaultMessage: "Create and manage content updates"
|
|
478
502
|
}),
|
|
479
|
-
primaryAction:
|
|
503
|
+
primaryAction: canCreate ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
480
504
|
designSystem.Button,
|
|
481
505
|
{
|
|
482
506
|
startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Plus, {}),
|
|
@@ -487,15 +511,15 @@ const ReleasesPage = () => {
|
|
|
487
511
|
defaultMessage: "New release"
|
|
488
512
|
})
|
|
489
513
|
}
|
|
490
|
-
)
|
|
514
|
+
) : null
|
|
491
515
|
}
|
|
492
516
|
),
|
|
493
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
517
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
494
518
|
hasReachedMaximumPendingReleases && /* @__PURE__ */ jsxRuntime.jsx(
|
|
495
519
|
StyledAlert,
|
|
496
520
|
{
|
|
497
521
|
marginBottom: 6,
|
|
498
|
-
action: /* @__PURE__ */ jsxRuntime.jsx(
|
|
522
|
+
action: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Link, { href: "https://strapi.io/pricing-cloud", isExternal: true, children: formatMessage({
|
|
499
523
|
id: "content-releases.pages.Releases.max-limit-reached.action",
|
|
500
524
|
defaultMessage: "Explore plans"
|
|
501
525
|
}) }),
|
|
@@ -515,21 +539,17 @@ const ReleasesPage = () => {
|
|
|
515
539
|
})
|
|
516
540
|
}
|
|
517
541
|
),
|
|
518
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
519
|
-
designSystem.
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
children: [
|
|
530
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { paddingBottom: 8, children: [
|
|
531
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tabs, { children: [
|
|
532
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tab, { children: formatMessage(
|
|
542
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tabs.Root, { variant: "simple", onValueChange: handleTabChange, value: activeTab, children: [
|
|
543
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { paddingBottom: 8, children: [
|
|
544
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
545
|
+
designSystem.Tabs.List,
|
|
546
|
+
{
|
|
547
|
+
"aria-label": formatMessage({
|
|
548
|
+
id: "content-releases.pages.Releases.tab-group.label",
|
|
549
|
+
defaultMessage: "Releases list"
|
|
550
|
+
}),
|
|
551
|
+
children: [
|
|
552
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Trigger, { value: "pending", children: formatMessage(
|
|
533
553
|
{
|
|
534
554
|
id: "content-releases.pages.Releases.tab.pending",
|
|
535
555
|
defaultMessage: "Pending ({count})"
|
|
@@ -538,55 +558,48 @@ const ReleasesPage = () => {
|
|
|
538
558
|
count: totalPendingReleases
|
|
539
559
|
}
|
|
540
560
|
) }),
|
|
541
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
561
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Trigger, { value: "done", children: formatMessage({
|
|
542
562
|
id: "content-releases.pages.Releases.tab.done",
|
|
543
563
|
defaultMessage: "Done"
|
|
544
564
|
}) })
|
|
545
|
-
]
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
sectionTitle: "pending",
|
|
553
|
-
releases: response?.currentData?.data,
|
|
554
|
-
isError
|
|
555
|
-
}
|
|
556
|
-
) }),
|
|
557
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.TabPanel, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
558
|
-
ReleasesGrid,
|
|
559
|
-
{
|
|
560
|
-
sectionTitle: "done",
|
|
561
|
-
releases: response?.currentData?.data,
|
|
562
|
-
isError
|
|
563
|
-
}
|
|
564
|
-
) })
|
|
565
|
-
] })
|
|
566
|
-
]
|
|
567
|
-
}
|
|
568
|
-
),
|
|
569
|
-
response.currentData?.meta?.pagination?.total ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { paddingTop: 4, alignItems: "flex-end", justifyContent: "space-between", children: [
|
|
570
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
571
|
-
helperPlugin.PageSizeURLQuery,
|
|
565
|
+
]
|
|
566
|
+
}
|
|
567
|
+
),
|
|
568
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Divider, {})
|
|
569
|
+
] }),
|
|
570
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Content, { value: "pending", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
571
|
+
ReleasesGrid,
|
|
572
572
|
{
|
|
573
|
-
|
|
574
|
-
|
|
573
|
+
sectionTitle: "pending",
|
|
574
|
+
releases: response?.currentData?.data,
|
|
575
|
+
isError
|
|
575
576
|
}
|
|
576
|
-
),
|
|
577
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
578
|
-
|
|
577
|
+
) }),
|
|
578
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Content, { value: "done", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
579
|
+
ReleasesGrid,
|
|
579
580
|
{
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
581
|
+
sectionTitle: "done",
|
|
582
|
+
releases: response?.currentData?.data,
|
|
583
|
+
isError
|
|
583
584
|
}
|
|
584
|
-
)
|
|
585
|
-
] })
|
|
585
|
+
) })
|
|
586
|
+
] }),
|
|
587
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
588
|
+
strapiAdmin.Pagination.Root,
|
|
589
|
+
{
|
|
590
|
+
...response?.currentData?.meta?.pagination,
|
|
591
|
+
defaultPageSize: response?.currentData?.meta?.pagination?.pageSize,
|
|
592
|
+
children: [
|
|
593
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.PageSize, { options: ["8", "16", "32", "64"] }),
|
|
594
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.Links, {})
|
|
595
|
+
]
|
|
596
|
+
}
|
|
597
|
+
)
|
|
586
598
|
] }) }),
|
|
587
|
-
|
|
599
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
588
600
|
ReleaseModal,
|
|
589
601
|
{
|
|
602
|
+
open: releaseModalShown,
|
|
590
603
|
handleClose: toggleAddReleaseModal,
|
|
591
604
|
handleSubmit: handleAddRelease,
|
|
592
605
|
isLoading: isSubmittingForm,
|
|
@@ -595,13 +608,13 @@ const ReleasesPage = () => {
|
|
|
595
608
|
)
|
|
596
609
|
] });
|
|
597
610
|
};
|
|
598
|
-
const ReleaseInfoWrapper =
|
|
611
|
+
const ReleaseInfoWrapper = styledComponents.styled(designSystem.Flex)`
|
|
599
612
|
align-self: stretch;
|
|
600
613
|
border-bottom-right-radius: ${({ theme }) => theme.borderRadius};
|
|
601
614
|
border-bottom-left-radius: ${({ theme }) => theme.borderRadius};
|
|
602
615
|
border-top: 1px solid ${({ theme }) => theme.colors.neutral150};
|
|
603
616
|
`;
|
|
604
|
-
const StyledMenuItem =
|
|
617
|
+
const StyledMenuItem = styledComponents.styled(designSystem.Menu.Item)`
|
|
605
618
|
svg path {
|
|
606
619
|
fill: ${({ theme, disabled }) => disabled && theme.colors.neutral500};
|
|
607
620
|
}
|
|
@@ -610,49 +623,54 @@ const StyledMenuItem = styled__default.default(v2.Menu.Item)`
|
|
|
610
623
|
}
|
|
611
624
|
|
|
612
625
|
&:hover {
|
|
613
|
-
background: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}100`]};
|
|
626
|
+
background: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}100`]};
|
|
614
627
|
}
|
|
615
628
|
`;
|
|
616
|
-
const PencilIcon =
|
|
629
|
+
const PencilIcon = styledComponents.styled(icons.Pencil)`
|
|
617
630
|
width: ${({ theme }) => theme.spaces[3]};
|
|
618
631
|
height: ${({ theme }) => theme.spaces[3]};
|
|
619
632
|
path {
|
|
620
633
|
fill: ${({ theme }) => theme.colors.neutral600};
|
|
621
634
|
}
|
|
622
635
|
`;
|
|
623
|
-
const TrashIcon =
|
|
636
|
+
const TrashIcon = styledComponents.styled(icons.Trash)`
|
|
624
637
|
width: ${({ theme }) => theme.spaces[3]};
|
|
625
638
|
height: ${({ theme }) => theme.spaces[3]};
|
|
626
639
|
path {
|
|
627
640
|
fill: ${({ theme }) => theme.colors.danger600};
|
|
628
641
|
}
|
|
629
642
|
`;
|
|
630
|
-
const TypographyMaxWidth =
|
|
643
|
+
const TypographyMaxWidth = styledComponents.styled(designSystem.Typography)`
|
|
631
644
|
max-width: 300px;
|
|
632
645
|
`;
|
|
633
|
-
const EntryValidationText = ({ action, schema,
|
|
646
|
+
const EntryValidationText = ({ action, schema, entry }) => {
|
|
634
647
|
const { formatMessage } = reactIntl.useIntl();
|
|
635
|
-
const { validate } = strapiAdmin.unstable_useDocument(
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
648
|
+
const { validate } = strapiAdmin$1.unstable_useDocument(
|
|
649
|
+
{
|
|
650
|
+
collectionType: schema?.kind ?? "",
|
|
651
|
+
model: schema?.uid ?? ""
|
|
652
|
+
},
|
|
653
|
+
{
|
|
654
|
+
skip: !schema
|
|
655
|
+
}
|
|
656
|
+
);
|
|
657
|
+
const errors = validate(entry) ?? {};
|
|
641
658
|
if (Object.keys(errors).length > 0) {
|
|
642
659
|
const validationErrorsMessages = Object.entries(errors).map(
|
|
643
660
|
([key, value]) => formatMessage(
|
|
661
|
+
// @ts-expect-error – TODO: fix this will better checks
|
|
644
662
|
{ id: `${value.id}.withField`, defaultMessage: value.defaultMessage },
|
|
645
663
|
{ field: key }
|
|
646
664
|
)
|
|
647
665
|
).join(" ");
|
|
648
666
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
649
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
667
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.CrossCircle, { fill: "danger600" }),
|
|
650
668
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tooltip, { description: validationErrorsMessages, children: /* @__PURE__ */ jsxRuntime.jsx(TypographyMaxWidth, { textColor: "danger600", variant: "omega", fontWeight: "semiBold", ellipsis: true, children: validationErrorsMessages }) })
|
|
651
669
|
] });
|
|
652
670
|
}
|
|
653
671
|
if (action == "publish") {
|
|
654
672
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
655
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
673
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
|
656
674
|
entry.publishedAt ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "success600", fontWeight: "bold", children: formatMessage({
|
|
657
675
|
id: "content-releases.pages.ReleaseDetails.entry-validation.already-published",
|
|
658
676
|
defaultMessage: "Already published"
|
|
@@ -663,7 +681,7 @@ const EntryValidationText = ({ action, schema, components, entry }) => {
|
|
|
663
681
|
] });
|
|
664
682
|
}
|
|
665
683
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
666
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
684
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
|
667
685
|
!entry.publishedAt ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "success600", fontWeight: "bold", children: formatMessage({
|
|
668
686
|
id: "content-releases.pages.ReleaseDetails.entry-validation.already-unpublished",
|
|
669
687
|
defaultMessage: "Already unpublished"
|
|
@@ -683,20 +701,23 @@ const ReleaseDetailsLayout = ({
|
|
|
683
701
|
const {
|
|
684
702
|
data,
|
|
685
703
|
isLoading: isLoadingDetails,
|
|
686
|
-
isError,
|
|
687
704
|
error
|
|
688
|
-
} = index.useGetReleaseQuery(
|
|
705
|
+
} = index.useGetReleaseQuery(
|
|
706
|
+
{ id: releaseId },
|
|
707
|
+
{
|
|
708
|
+
skip: !releaseId
|
|
709
|
+
}
|
|
710
|
+
);
|
|
689
711
|
const [publishRelease, { isLoading: isPublishing }] = index.usePublishReleaseMutation();
|
|
690
|
-
const toggleNotification =
|
|
691
|
-
const { formatAPIError } =
|
|
692
|
-
const {
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
const
|
|
696
|
-
const { trackUsage } = helperPlugin.useTracking();
|
|
712
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
713
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
714
|
+
const { allowedActions } = strapiAdmin.useRBAC(index.PERMISSIONS);
|
|
715
|
+
const { canUpdate, canDelete, canPublish } = allowedActions;
|
|
716
|
+
const dispatch = useTypedDispatch();
|
|
717
|
+
const { trackUsage } = strapiAdmin.useTracking();
|
|
697
718
|
const release = data?.data;
|
|
698
|
-
const handlePublishRelease = async () => {
|
|
699
|
-
const response = await publishRelease({ id
|
|
719
|
+
const handlePublishRelease = (id) => async () => {
|
|
720
|
+
const response = await publishRelease({ id });
|
|
700
721
|
if ("data" in response) {
|
|
701
722
|
toggleNotification({
|
|
702
723
|
type: "success",
|
|
@@ -711,14 +732,14 @@ const ReleaseDetailsLayout = ({
|
|
|
711
732
|
totalPublishedEntries,
|
|
712
733
|
totalUnpublishedEntries
|
|
713
734
|
});
|
|
714
|
-
} else if (
|
|
735
|
+
} else if (strapiAdmin.isFetchError(response.error)) {
|
|
715
736
|
toggleNotification({
|
|
716
|
-
type: "
|
|
737
|
+
type: "danger",
|
|
717
738
|
message: formatAPIError(response.error)
|
|
718
739
|
});
|
|
719
740
|
} else {
|
|
720
741
|
toggleNotification({
|
|
721
|
-
type: "
|
|
742
|
+
type: "danger",
|
|
722
743
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
723
744
|
});
|
|
724
745
|
}
|
|
@@ -744,21 +765,20 @@ const ReleaseDetailsLayout = ({
|
|
|
744
765
|
return release.createdBy.email;
|
|
745
766
|
};
|
|
746
767
|
if (isLoadingDetails) {
|
|
747
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
768
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
|
|
748
769
|
}
|
|
749
|
-
if (
|
|
770
|
+
if (isBaseQueryError(error) && "code" in error || !release) {
|
|
750
771
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
751
|
-
reactRouterDom.
|
|
772
|
+
reactRouterDom.Navigate,
|
|
752
773
|
{
|
|
753
|
-
to:
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
}
|
|
774
|
+
to: "..",
|
|
775
|
+
state: {
|
|
776
|
+
errors: [
|
|
777
|
+
{
|
|
778
|
+
// @ts-expect-error – TODO: fix this weird error flow
|
|
779
|
+
code: error?.code
|
|
780
|
+
}
|
|
781
|
+
]
|
|
762
782
|
}
|
|
763
783
|
}
|
|
764
784
|
);
|
|
@@ -795,34 +815,30 @@ const ReleaseDetailsLayout = ({
|
|
|
795
815
|
) : "";
|
|
796
816
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { "aria-busy": isLoadingDetails, children: [
|
|
797
817
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
798
|
-
|
|
818
|
+
strapiAdmin.Layouts.Header,
|
|
799
819
|
{
|
|
800
820
|
title: release.name,
|
|
801
821
|
subtitle: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, lineHeight: 6, children: [
|
|
802
822
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", variant: "epsilon", children: numberOfEntriesText + (isScheduled ? ` - ${scheduledText}` : "") }),
|
|
803
823
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { ...getBadgeProps(release.status), children: release.status })
|
|
804
824
|
] }),
|
|
805
|
-
navigationAction: /* @__PURE__ */ jsxRuntime.jsx(
|
|
806
|
-
id: "global.back",
|
|
807
|
-
defaultMessage: "Back"
|
|
808
|
-
}) }),
|
|
825
|
+
navigationAction: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.BackButton, {}),
|
|
809
826
|
primaryAction: !release.releasedAt && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
810
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
827
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Root, { children: [
|
|
811
828
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
812
|
-
|
|
829
|
+
designSystem.Menu.Trigger,
|
|
813
830
|
{
|
|
814
|
-
as: designSystem.IconButton,
|
|
815
831
|
paddingLeft: 2,
|
|
816
832
|
paddingRight: 2,
|
|
817
833
|
"aria-label": formatMessage({
|
|
818
834
|
id: "content-releases.header.actions.open-release-actions",
|
|
819
835
|
defaultMessage: "Release edit and delete menu"
|
|
820
836
|
}),
|
|
821
|
-
|
|
822
|
-
|
|
837
|
+
variant: "tertiary",
|
|
838
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(icons.More, {})
|
|
823
839
|
}
|
|
824
840
|
),
|
|
825
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
841
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Content, { top: 1, popoverPlacement: "bottom-end", maxHeight: void 0, children: [
|
|
826
842
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
827
843
|
designSystem.Flex,
|
|
828
844
|
{
|
|
@@ -844,7 +860,7 @@ const ReleaseDetailsLayout = ({
|
|
|
844
860
|
{
|
|
845
861
|
disabled: !canDelete,
|
|
846
862
|
onSelect: toggleWarningSubmit,
|
|
847
|
-
variant: "danger",
|
|
863
|
+
$variant: "danger",
|
|
848
864
|
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 2, hasRadius: true, width: "100%", children: [
|
|
849
865
|
/* @__PURE__ */ jsxRuntime.jsx(TrashIcon, {}),
|
|
850
866
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { ellipsis: true, textColor: "danger600", children: formatMessage({
|
|
@@ -871,7 +887,7 @@ const ReleaseDetailsLayout = ({
|
|
|
871
887
|
defaultMessage: "Created"
|
|
872
888
|
}) }),
|
|
873
889
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", color: "neutral300", children: [
|
|
874
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
890
|
+
/* @__PURE__ */ jsxRuntime.jsx(RelativeTime$1, { timestamp: new Date(release.createdAt) }),
|
|
875
891
|
formatMessage(
|
|
876
892
|
{
|
|
877
893
|
id: "content-releases.header.actions.created.description",
|
|
@@ -889,12 +905,12 @@ const ReleaseDetailsLayout = ({
|
|
|
889
905
|
id: "content-releases.header.actions.refresh",
|
|
890
906
|
defaultMessage: "Refresh"
|
|
891
907
|
}) }),
|
|
892
|
-
|
|
908
|
+
canPublish ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
893
909
|
designSystem.Button,
|
|
894
910
|
{
|
|
895
911
|
size: "S",
|
|
896
912
|
variant: "default",
|
|
897
|
-
onClick: handlePublishRelease,
|
|
913
|
+
onClick: handlePublishRelease(release.id.toString()),
|
|
898
914
|
loading: isPublishing,
|
|
899
915
|
disabled: release.actions.meta.count === 0,
|
|
900
916
|
children: formatMessage({
|
|
@@ -902,7 +918,7 @@ const ReleaseDetailsLayout = ({
|
|
|
902
918
|
defaultMessage: "Publish"
|
|
903
919
|
})
|
|
904
920
|
}
|
|
905
|
-
)
|
|
921
|
+
) : null
|
|
906
922
|
] })
|
|
907
923
|
}
|
|
908
924
|
),
|
|
@@ -910,6 +926,7 @@ const ReleaseDetailsLayout = ({
|
|
|
910
926
|
] });
|
|
911
927
|
};
|
|
912
928
|
const GROUP_BY_OPTIONS = ["contentType", "locale", "action"];
|
|
929
|
+
const GROUP_BY_OPTIONS_NO_LOCALE = ["contentType", "action"];
|
|
913
930
|
const getGroupByOptionLabel = (value) => {
|
|
914
931
|
if (value === "locale") {
|
|
915
932
|
return {
|
|
@@ -928,21 +945,33 @@ const getGroupByOptionLabel = (value) => {
|
|
|
928
945
|
defaultMessage: "Content-Types"
|
|
929
946
|
};
|
|
930
947
|
};
|
|
931
|
-
const ReleaseDetailsBody = () => {
|
|
948
|
+
const ReleaseDetailsBody = ({ releaseId }) => {
|
|
932
949
|
const { formatMessage } = reactIntl.useIntl();
|
|
933
|
-
const {
|
|
934
|
-
const
|
|
935
|
-
const
|
|
936
|
-
const { formatAPIError } = helperPlugin.useAPIErrorHandler();
|
|
950
|
+
const [{ query }, setQuery] = strapiAdmin.useQueryParams();
|
|
951
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
952
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
937
953
|
const {
|
|
938
954
|
data: releaseData,
|
|
939
955
|
isLoading: isReleaseLoading,
|
|
940
|
-
isError: isReleaseError,
|
|
941
956
|
error: releaseError
|
|
942
957
|
} = index.useGetReleaseQuery({ id: releaseId });
|
|
943
958
|
const {
|
|
944
959
|
allowedActions: { canUpdate }
|
|
945
|
-
} =
|
|
960
|
+
} = strapiAdmin.useRBAC(index.PERMISSIONS);
|
|
961
|
+
const runHookWaterfall = strapiAdmin.useStrapiApp("ReleaseDetailsPage", (state) => state.runHookWaterfall);
|
|
962
|
+
const { hasI18nEnabled } = runHookWaterfall(
|
|
963
|
+
"ContentReleases/pages/ReleaseDetails/add-locale-in-releases",
|
|
964
|
+
{
|
|
965
|
+
displayedHeaders: {
|
|
966
|
+
label: formatMessage({
|
|
967
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.locale",
|
|
968
|
+
defaultMessage: "locale"
|
|
969
|
+
}),
|
|
970
|
+
name: "locale"
|
|
971
|
+
},
|
|
972
|
+
hasI18nEnabled: false
|
|
973
|
+
}
|
|
974
|
+
);
|
|
946
975
|
const release = releaseData?.data;
|
|
947
976
|
const selectedGroupBy = query?.groupBy || "contentType";
|
|
948
977
|
const {
|
|
@@ -971,65 +1000,59 @@ const ReleaseDetailsBody = () => {
|
|
|
971
1000
|
// We are passing the action path to found the position in the cache of the action for optimistic updates
|
|
972
1001
|
});
|
|
973
1002
|
if ("error" in response) {
|
|
974
|
-
if (
|
|
1003
|
+
if (strapiAdmin.isFetchError(response.error)) {
|
|
975
1004
|
toggleNotification({
|
|
976
|
-
type: "
|
|
1005
|
+
type: "danger",
|
|
977
1006
|
message: formatAPIError(response.error)
|
|
978
1007
|
});
|
|
979
1008
|
} else {
|
|
980
1009
|
toggleNotification({
|
|
981
|
-
type: "
|
|
1010
|
+
type: "danger",
|
|
982
1011
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
983
1012
|
});
|
|
984
1013
|
}
|
|
985
1014
|
}
|
|
986
1015
|
};
|
|
987
1016
|
if (isLoading || isReleaseLoading) {
|
|
988
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1017
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
|
|
989
1018
|
}
|
|
990
1019
|
const releaseActions = data?.data;
|
|
991
1020
|
const releaseMeta = data?.meta;
|
|
992
1021
|
const contentTypes = releaseMeta?.contentTypes || {};
|
|
993
1022
|
const components = releaseMeta?.components || {};
|
|
994
|
-
if (
|
|
1023
|
+
if (isBaseQueryError(releaseError) || !release) {
|
|
995
1024
|
const errorsArray = [];
|
|
996
|
-
if (releaseError) {
|
|
1025
|
+
if (releaseError && "code" in releaseError) {
|
|
997
1026
|
errorsArray.push({
|
|
998
1027
|
code: releaseError.code
|
|
999
1028
|
});
|
|
1000
1029
|
}
|
|
1001
|
-
if (releaseActionsError) {
|
|
1030
|
+
if (releaseActionsError && "code" in releaseActionsError) {
|
|
1002
1031
|
errorsArray.push({
|
|
1003
1032
|
code: releaseActionsError.code
|
|
1004
1033
|
});
|
|
1005
1034
|
}
|
|
1006
1035
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1007
|
-
reactRouterDom.
|
|
1036
|
+
reactRouterDom.Navigate,
|
|
1008
1037
|
{
|
|
1009
|
-
to:
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
errors: errorsArray
|
|
1013
|
-
}
|
|
1038
|
+
to: "..",
|
|
1039
|
+
state: {
|
|
1040
|
+
errors: errorsArray
|
|
1014
1041
|
}
|
|
1015
1042
|
}
|
|
1016
1043
|
);
|
|
1017
1044
|
}
|
|
1018
1045
|
if (isError || !releaseActions) {
|
|
1019
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1046
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Error, {});
|
|
1020
1047
|
}
|
|
1021
1048
|
if (Object.keys(releaseActions).length === 0) {
|
|
1022
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1023
|
-
|
|
1049
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1050
|
+
designSystem.EmptyStateLayout,
|
|
1024
1051
|
{
|
|
1025
|
-
content: {
|
|
1026
|
-
id: "content-releases.pages.Details.tab.emptyEntries",
|
|
1027
|
-
defaultMessage: "This release is empty. Open the Content Manager, select an entry and add it to the release."
|
|
1028
|
-
},
|
|
1029
1052
|
action: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1030
|
-
|
|
1053
|
+
designSystem.LinkButton,
|
|
1031
1054
|
{
|
|
1032
|
-
|
|
1055
|
+
tag: reactRouterDom.Link,
|
|
1033
1056
|
to: {
|
|
1034
1057
|
pathname: "/content-manager"
|
|
1035
1058
|
},
|
|
@@ -1040,18 +1063,59 @@ const ReleaseDetailsBody = () => {
|
|
|
1040
1063
|
defaultMessage: "Open the Content Manager"
|
|
1041
1064
|
})
|
|
1042
1065
|
}
|
|
1043
|
-
)
|
|
1066
|
+
),
|
|
1067
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(symbols.EmptyDocuments, { width: "16rem" }),
|
|
1068
|
+
content: formatMessage({
|
|
1069
|
+
id: "content-releases.pages.Details.tab.emptyEntries",
|
|
1070
|
+
defaultMessage: "This release is empty. Open the Content Manager, select an entry and add it to the release."
|
|
1071
|
+
})
|
|
1044
1072
|
}
|
|
1045
1073
|
) });
|
|
1046
1074
|
}
|
|
1047
|
-
|
|
1075
|
+
const groupByLabel = formatMessage({
|
|
1076
|
+
id: "content-releases.pages.ReleaseDetails.groupBy.aria-label",
|
|
1077
|
+
defaultMessage: "Group by"
|
|
1078
|
+
});
|
|
1079
|
+
const headers = [
|
|
1080
|
+
// ...displayedHeaders,
|
|
1081
|
+
{
|
|
1082
|
+
label: formatMessage({
|
|
1083
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.name",
|
|
1084
|
+
defaultMessage: "name"
|
|
1085
|
+
}),
|
|
1086
|
+
name: "name"
|
|
1087
|
+
},
|
|
1088
|
+
{
|
|
1089
|
+
label: formatMessage({
|
|
1090
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.content-type",
|
|
1091
|
+
defaultMessage: "content-type"
|
|
1092
|
+
}),
|
|
1093
|
+
name: "content-type"
|
|
1094
|
+
},
|
|
1095
|
+
{
|
|
1096
|
+
label: formatMessage({
|
|
1097
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.action",
|
|
1098
|
+
defaultMessage: "action"
|
|
1099
|
+
}),
|
|
1100
|
+
name: "action"
|
|
1101
|
+
},
|
|
1102
|
+
...!release.releasedAt ? [
|
|
1103
|
+
{
|
|
1104
|
+
label: formatMessage({
|
|
1105
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.status",
|
|
1106
|
+
defaultMessage: "status"
|
|
1107
|
+
}),
|
|
1108
|
+
name: "status"
|
|
1109
|
+
}
|
|
1110
|
+
] : []
|
|
1111
|
+
];
|
|
1112
|
+
const options = hasI18nEnabled ? GROUP_BY_OPTIONS : GROUP_BY_OPTIONS_NO_LOCALE;
|
|
1113
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 8, direction: "column", alignItems: "stretch", children: [
|
|
1048
1114
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1049
1115
|
designSystem.SingleSelect,
|
|
1050
1116
|
{
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
defaultMessage: "Group by"
|
|
1054
|
-
}),
|
|
1117
|
+
placeholder: groupByLabel,
|
|
1118
|
+
"aria-label": groupByLabel,
|
|
1055
1119
|
customizeContent: (value) => formatMessage(
|
|
1056
1120
|
{
|
|
1057
1121
|
id: `content-releases.pages.ReleaseDetails.groupBy.label`,
|
|
@@ -1063,84 +1127,27 @@ const ReleaseDetailsBody = () => {
|
|
|
1063
1127
|
),
|
|
1064
1128
|
value: formatMessage(getGroupByOptionLabel(selectedGroupBy)),
|
|
1065
1129
|
onChange: (value) => setQuery({ groupBy: value }),
|
|
1066
|
-
children:
|
|
1130
|
+
children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: option, children: formatMessage(getGroupByOptionLabel(option)) }, option))
|
|
1067
1131
|
}
|
|
1068
1132
|
) }),
|
|
1069
1133
|
Object.keys(releaseActions).map((key) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, direction: "column", alignItems: "stretch", children: [
|
|
1070
1134
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { role: "separator", "aria-label": key, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { children: key }) }),
|
|
1071
1135
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1072
|
-
|
|
1136
|
+
strapiAdmin.Table.Root,
|
|
1073
1137
|
{
|
|
1074
1138
|
rows: releaseActions[key].map((item) => ({
|
|
1075
1139
|
...item,
|
|
1076
1140
|
id: Number(item.entry.id)
|
|
1077
1141
|
})),
|
|
1078
|
-
|
|
1079
|
-
isLoading,
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1083
|
-
|
|
1084
|
-
helperPlugin.Table.HeaderCell,
|
|
1085
|
-
{
|
|
1086
|
-
fieldSchemaType: "string",
|
|
1087
|
-
label: formatMessage({
|
|
1088
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.name",
|
|
1089
|
-
defaultMessage: "name"
|
|
1090
|
-
}),
|
|
1091
|
-
name: "name"
|
|
1092
|
-
}
|
|
1093
|
-
),
|
|
1094
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1095
|
-
helperPlugin.Table.HeaderCell,
|
|
1096
|
-
{
|
|
1097
|
-
fieldSchemaType: "string",
|
|
1098
|
-
label: formatMessage({
|
|
1099
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.locale",
|
|
1100
|
-
defaultMessage: "locale"
|
|
1101
|
-
}),
|
|
1102
|
-
name: "locale"
|
|
1103
|
-
}
|
|
1104
|
-
),
|
|
1105
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1106
|
-
helperPlugin.Table.HeaderCell,
|
|
1107
|
-
{
|
|
1108
|
-
fieldSchemaType: "string",
|
|
1109
|
-
label: formatMessage({
|
|
1110
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.content-type",
|
|
1111
|
-
defaultMessage: "content-type"
|
|
1112
|
-
}),
|
|
1113
|
-
name: "content-type"
|
|
1114
|
-
}
|
|
1115
|
-
),
|
|
1116
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1117
|
-
helperPlugin.Table.HeaderCell,
|
|
1118
|
-
{
|
|
1119
|
-
fieldSchemaType: "string",
|
|
1120
|
-
label: formatMessage({
|
|
1121
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.action",
|
|
1122
|
-
defaultMessage: "action"
|
|
1123
|
-
}),
|
|
1124
|
-
name: "action"
|
|
1125
|
-
}
|
|
1126
|
-
),
|
|
1127
|
-
!release.releasedAt && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1128
|
-
helperPlugin.Table.HeaderCell,
|
|
1129
|
-
{
|
|
1130
|
-
fieldSchemaType: "string",
|
|
1131
|
-
label: formatMessage({
|
|
1132
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.status",
|
|
1133
|
-
defaultMessage: "status"
|
|
1134
|
-
}),
|
|
1135
|
-
name: "status"
|
|
1136
|
-
}
|
|
1137
|
-
)
|
|
1138
|
-
] }),
|
|
1139
|
-
/* @__PURE__ */ jsxRuntime.jsx(helperPlugin.Table.LoadingBody, {}),
|
|
1140
|
-
/* @__PURE__ */ jsxRuntime.jsx(helperPlugin.Table.Body, { children: releaseActions[key].map(
|
|
1142
|
+
headers,
|
|
1143
|
+
isLoading: isLoading || isFetching,
|
|
1144
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(strapiAdmin.Table.Content, { children: [
|
|
1145
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Head, { children: headers.map((header) => /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.HeaderCell, { ...header }, header.name)) }),
|
|
1146
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Loading, {}),
|
|
1147
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Body, { children: releaseActions[key].map(
|
|
1141
1148
|
({ id, contentType, locale, type, entry }, actionIndex) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
1142
1149
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "25%", maxWidth: "200px", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { ellipsis: true, children: `${contentType.mainFieldValue || entry.id}` }) }),
|
|
1143
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "10%", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: `${locale?.name ? locale.name : "-"}` }) }),
|
|
1150
|
+
hasI18nEnabled && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "10%", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: `${locale?.name ? locale.name : "-"}` }) }),
|
|
1144
1151
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "10%", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: contentType.displayName || "" }) }),
|
|
1145
1152
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "20%", children: release.releasedAt ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage(
|
|
1146
1153
|
{
|
|
@@ -1194,34 +1201,39 @@ const ReleaseDetailsBody = () => {
|
|
|
1194
1201
|
}
|
|
1195
1202
|
)
|
|
1196
1203
|
] }, `releases-group-${key}`)),
|
|
1197
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
}
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1204
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1205
|
+
strapiAdmin.Pagination.Root,
|
|
1206
|
+
{
|
|
1207
|
+
...releaseMeta?.pagination,
|
|
1208
|
+
defaultPageSize: releaseMeta?.pagination?.pageSize,
|
|
1209
|
+
children: [
|
|
1210
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.PageSize, {}),
|
|
1211
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.Links, {})
|
|
1212
|
+
]
|
|
1213
|
+
}
|
|
1214
|
+
)
|
|
1208
1215
|
] }) });
|
|
1209
1216
|
};
|
|
1210
1217
|
const ReleaseDetailsPage = () => {
|
|
1211
1218
|
const { formatMessage } = reactIntl.useIntl();
|
|
1212
1219
|
const { releaseId } = reactRouterDom.useParams();
|
|
1213
|
-
const toggleNotification =
|
|
1214
|
-
const { formatAPIError } =
|
|
1215
|
-
const
|
|
1220
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
1221
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
1222
|
+
const navigate = reactRouterDom.useNavigate();
|
|
1216
1223
|
const [releaseModalShown, setReleaseModalShown] = React__namespace.useState(false);
|
|
1217
1224
|
const [showWarningSubmit, setWarningSubmit] = React__namespace.useState(false);
|
|
1218
1225
|
const {
|
|
1219
1226
|
isLoading: isLoadingDetails,
|
|
1220
1227
|
data,
|
|
1221
1228
|
isSuccess: isSuccessDetails
|
|
1222
|
-
} = index.useGetReleaseQuery(
|
|
1229
|
+
} = index.useGetReleaseQuery(
|
|
1230
|
+
{ id: releaseId },
|
|
1231
|
+
{
|
|
1232
|
+
skip: !releaseId
|
|
1233
|
+
}
|
|
1234
|
+
);
|
|
1223
1235
|
const [updateRelease, { isLoading: isSubmittingForm }] = index.useUpdateReleaseMutation();
|
|
1224
|
-
const [deleteRelease
|
|
1236
|
+
const [deleteRelease] = index.useDeleteReleaseMutation();
|
|
1225
1237
|
const toggleEditReleaseModal = () => {
|
|
1226
1238
|
setReleaseModalShown((prev) => !prev);
|
|
1227
1239
|
};
|
|
@@ -1232,15 +1244,18 @@ const ReleaseDetailsPage = () => {
|
|
|
1232
1244
|
{
|
|
1233
1245
|
toggleEditReleaseModal,
|
|
1234
1246
|
toggleWarningSubmit,
|
|
1235
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1247
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {})
|
|
1236
1248
|
}
|
|
1237
1249
|
);
|
|
1238
1250
|
}
|
|
1251
|
+
if (!releaseId) {
|
|
1252
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: ".." });
|
|
1253
|
+
}
|
|
1239
1254
|
const releaseData = isSuccessDetails && data?.data || null;
|
|
1240
1255
|
const title = releaseData?.name || "";
|
|
1241
1256
|
const timezone = releaseData?.timezone ?? null;
|
|
1242
1257
|
const scheduledAt = releaseData?.scheduledAt && timezone ? dateFnsTz.utcToZonedTime(releaseData.scheduledAt, timezone) : null;
|
|
1243
|
-
const date = scheduledAt ? format__default.default(scheduledAt, "yyyy-MM-dd") :
|
|
1258
|
+
const date = scheduledAt ? format__default.default(scheduledAt, "yyyy-MM-dd") : void 0;
|
|
1244
1259
|
const time = scheduledAt ? format__default.default(scheduledAt, "HH:mm") : "";
|
|
1245
1260
|
const handleEditRelease = async (values) => {
|
|
1246
1261
|
const response = await updateRelease({
|
|
@@ -1258,14 +1273,14 @@ const ReleaseDetailsPage = () => {
|
|
|
1258
1273
|
})
|
|
1259
1274
|
});
|
|
1260
1275
|
toggleEditReleaseModal();
|
|
1261
|
-
} else if (
|
|
1276
|
+
} else if (strapiAdmin.isFetchError(response.error)) {
|
|
1262
1277
|
toggleNotification({
|
|
1263
|
-
type: "
|
|
1278
|
+
type: "danger",
|
|
1264
1279
|
message: formatAPIError(response.error)
|
|
1265
1280
|
});
|
|
1266
1281
|
} else {
|
|
1267
1282
|
toggleNotification({
|
|
1268
|
-
type: "
|
|
1283
|
+
type: "danger",
|
|
1269
1284
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
1270
1285
|
});
|
|
1271
1286
|
}
|
|
@@ -1275,15 +1290,15 @@ const ReleaseDetailsPage = () => {
|
|
|
1275
1290
|
id: releaseId
|
|
1276
1291
|
});
|
|
1277
1292
|
if ("data" in response) {
|
|
1278
|
-
|
|
1279
|
-
} else if (
|
|
1293
|
+
navigate("..");
|
|
1294
|
+
} else if (strapiAdmin.isFetchError(response.error)) {
|
|
1280
1295
|
toggleNotification({
|
|
1281
|
-
type: "
|
|
1296
|
+
type: "danger",
|
|
1282
1297
|
message: formatAPIError(response.error)
|
|
1283
1298
|
});
|
|
1284
1299
|
} else {
|
|
1285
1300
|
toggleNotification({
|
|
1286
|
-
type: "
|
|
1301
|
+
type: "danger",
|
|
1287
1302
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
1288
1303
|
});
|
|
1289
1304
|
}
|
|
@@ -1294,10 +1309,11 @@ const ReleaseDetailsPage = () => {
|
|
|
1294
1309
|
toggleEditReleaseModal,
|
|
1295
1310
|
toggleWarningSubmit,
|
|
1296
1311
|
children: [
|
|
1297
|
-
/* @__PURE__ */ jsxRuntime.jsx(ReleaseDetailsBody, {}),
|
|
1298
|
-
|
|
1312
|
+
/* @__PURE__ */ jsxRuntime.jsx(ReleaseDetailsBody, { releaseId }),
|
|
1313
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1299
1314
|
ReleaseModal,
|
|
1300
1315
|
{
|
|
1316
|
+
open: releaseModalShown,
|
|
1301
1317
|
handleClose: toggleEditReleaseModal,
|
|
1302
1318
|
handleSubmit: handleEditRelease,
|
|
1303
1319
|
isLoading: isLoadingDetails || isSubmittingForm,
|
|
@@ -1311,28 +1327,19 @@ const ReleaseDetailsPage = () => {
|
|
|
1311
1327
|
}
|
|
1312
1328
|
}
|
|
1313
1329
|
),
|
|
1314
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
id: "content-releases.dialog.confirmation-message",
|
|
1319
|
-
defaultMessage: "Are you sure you want to delete this release?"
|
|
1320
|
-
},
|
|
1321
|
-
isOpen: showWarningSubmit,
|
|
1322
|
-
isConfirmButtonLoading: isDeletingRelease,
|
|
1323
|
-
onToggleDialog: toggleWarningSubmit,
|
|
1324
|
-
onConfirm: handleDeleteRelease
|
|
1325
|
-
}
|
|
1326
|
-
)
|
|
1330
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Root, { open: showWarningSubmit, onOpenChange: toggleWarningSubmit, children: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.ConfirmDialog, { onConfirm: handleDeleteRelease, children: formatMessage({
|
|
1331
|
+
id: "content-releases.dialog.confirmation-message",
|
|
1332
|
+
defaultMessage: "Are you sure you want to delete this release?"
|
|
1333
|
+
}) }) })
|
|
1327
1334
|
]
|
|
1328
1335
|
}
|
|
1329
1336
|
);
|
|
1330
1337
|
};
|
|
1331
1338
|
const App = () => {
|
|
1332
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1333
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, {
|
|
1334
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, {
|
|
1339
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Protect, { permissions: index.PERMISSIONS.main, children: /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.Routes, { children: [
|
|
1340
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { index: true, element: /* @__PURE__ */ jsxRuntime.jsx(ReleasesPage, {}) }),
|
|
1341
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: ":releaseId", element: /* @__PURE__ */ jsxRuntime.jsx(ReleaseDetailsPage, {}) })
|
|
1335
1342
|
] }) });
|
|
1336
1343
|
};
|
|
1337
1344
|
exports.App = App;
|
|
1338
|
-
//# sourceMappingURL=App-
|
|
1345
|
+
//# sourceMappingURL=App-CqbuK4M6.js.map
|