@strapi/content-releases 0.0.0-experimental.fc1ac2acd58c8a5a858679956b6d102ac5ee4011 → 0.0.0-experimental.fea7af0bd6b406e4648e4c6669829249f73eb60f
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-C768ulk4.js → App-HjWtUYmc.js} +233 -261
- package/dist/_chunks/App-HjWtUYmc.js.map +1 -0
- package/dist/_chunks/{App-0Er6xxcq.mjs → App-gu1aiP6i.mjs} +237 -265
- package/dist/_chunks/App-gu1aiP6i.mjs.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-Clm0iACO.mjs → PurchaseContentReleases-3tRbmbY3.mjs} +2 -2
- package/dist/_chunks/PurchaseContentReleases-3tRbmbY3.mjs.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-YhAPgpG9.js → PurchaseContentReleases-bpIYXOfu.js} +2 -2
- package/dist/_chunks/PurchaseContentReleases-bpIYXOfu.js.map +1 -0
- package/dist/_chunks/{en-gcJJ5htG.js → en-HrREghh3.js} +11 -3
- package/dist/_chunks/en-HrREghh3.js.map +1 -0
- package/dist/_chunks/{en-WuuhP6Bn.mjs → en-ltT1TlKQ.mjs} +11 -3
- package/dist/_chunks/en-ltT1TlKQ.mjs.map +1 -0
- package/dist/_chunks/{index-BLSMpbpZ.js → index-ZNwxYN8H.js} +338 -31
- package/dist/_chunks/index-ZNwxYN8H.js.map +1 -0
- package/dist/_chunks/{index-fJx1up7m.mjs → index-mvj9PSKd.mjs} +345 -38
- package/dist/_chunks/index-mvj9PSKd.mjs.map +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/server/index.js +380 -172
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +380 -173
- package/dist/server/index.mjs.map +1 -1
- package/package.json +22 -15
- package/dist/_chunks/App-0Er6xxcq.mjs.map +0 -1
- package/dist/_chunks/App-C768ulk4.js.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-Clm0iACO.mjs.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-YhAPgpG9.js.map +0 -1
- package/dist/_chunks/en-WuuhP6Bn.mjs.map +0 -1
- package/dist/_chunks/en-gcJJ5htG.js.map +0 -1
- package/dist/_chunks/index-BLSMpbpZ.js.map +0 -1
- package/dist/_chunks/index-fJx1up7m.mjs.map +0 -1
- package/dist/admin/src/components/CMReleasesContainer.d.ts +0 -1
- package/dist/admin/src/components/RelativeTime.d.ts +0 -28
- package/dist/admin/src/components/ReleaseActionMenu.d.ts +0 -26
- package/dist/admin/src/components/ReleaseActionOptions.d.ts +0 -9
- package/dist/admin/src/components/ReleaseModal.d.ts +0 -16
- package/dist/admin/src/constants.d.ts +0 -58
- package/dist/admin/src/index.d.ts +0 -3
- package/dist/admin/src/pages/App.d.ts +0 -1
- package/dist/admin/src/pages/PurchaseContentReleases.d.ts +0 -2
- package/dist/admin/src/pages/ReleaseDetailsPage.d.ts +0 -2
- package/dist/admin/src/pages/ReleasesPage.d.ts +0 -8
- package/dist/admin/src/pages/tests/mockReleaseDetailsPageData.d.ts +0 -181
- package/dist/admin/src/pages/tests/mockReleasesPageData.d.ts +0 -39
- package/dist/admin/src/pluginId.d.ts +0 -1
- package/dist/admin/src/services/axios.d.ts +0 -29
- package/dist/admin/src/services/release.d.ts +0 -369
- package/dist/admin/src/store/hooks.d.ts +0 -7
- package/dist/admin/src/utils/time.d.ts +0 -1
- package/dist/server/src/bootstrap.d.ts +0 -5
- package/dist/server/src/bootstrap.d.ts.map +0 -1
- package/dist/server/src/constants.d.ts +0 -12
- package/dist/server/src/constants.d.ts.map +0 -1
- package/dist/server/src/content-types/index.d.ts +0 -99
- package/dist/server/src/content-types/index.d.ts.map +0 -1
- package/dist/server/src/content-types/release/index.d.ts +0 -48
- package/dist/server/src/content-types/release/index.d.ts.map +0 -1
- package/dist/server/src/content-types/release/schema.d.ts +0 -47
- package/dist/server/src/content-types/release/schema.d.ts.map +0 -1
- package/dist/server/src/content-types/release-action/index.d.ts +0 -50
- package/dist/server/src/content-types/release-action/index.d.ts.map +0 -1
- package/dist/server/src/content-types/release-action/schema.d.ts +0 -49
- package/dist/server/src/content-types/release-action/schema.d.ts.map +0 -1
- package/dist/server/src/controllers/index.d.ts +0 -18
- package/dist/server/src/controllers/index.d.ts.map +0 -1
- package/dist/server/src/controllers/release-action.d.ts +0 -9
- package/dist/server/src/controllers/release-action.d.ts.map +0 -1
- package/dist/server/src/controllers/release.d.ts +0 -11
- package/dist/server/src/controllers/release.d.ts.map +0 -1
- package/dist/server/src/controllers/validation/release-action.d.ts +0 -3
- package/dist/server/src/controllers/validation/release-action.d.ts.map +0 -1
- package/dist/server/src/controllers/validation/release.d.ts +0 -2
- package/dist/server/src/controllers/validation/release.d.ts.map +0 -1
- package/dist/server/src/destroy.d.ts +0 -5
- package/dist/server/src/destroy.d.ts.map +0 -1
- package/dist/server/src/index.d.ts +0 -3838
- package/dist/server/src/index.d.ts.map +0 -1
- package/dist/server/src/migrations/index.d.ts +0 -10
- package/dist/server/src/migrations/index.d.ts.map +0 -1
- package/dist/server/src/register.d.ts +0 -5
- package/dist/server/src/register.d.ts.map +0 -1
- package/dist/server/src/routes/index.d.ts +0 -35
- package/dist/server/src/routes/index.d.ts.map +0 -1
- package/dist/server/src/routes/release-action.d.ts +0 -18
- package/dist/server/src/routes/release-action.d.ts.map +0 -1
- package/dist/server/src/routes/release.d.ts +0 -18
- package/dist/server/src/routes/release.d.ts.map +0 -1
- package/dist/server/src/services/index.d.ts +0 -3572
- package/dist/server/src/services/index.d.ts.map +0 -1
- package/dist/server/src/services/release.d.ts +0 -1812
- package/dist/server/src/services/release.d.ts.map +0 -1
- package/dist/server/src/services/scheduling.d.ts +0 -18
- package/dist/server/src/services/scheduling.d.ts.map +0 -1
- package/dist/server/src/services/validation.d.ts +0 -14
- package/dist/server/src/services/validation.d.ts.map +0 -1
- package/dist/server/src/utils/index.d.ts +0 -18
- package/dist/server/src/utils/index.d.ts.map +0 -1
- package/dist/shared/contracts/release-actions.d.ts +0 -105
- package/dist/shared/contracts/release-actions.d.ts.map +0 -1
- package/dist/shared/contracts/releases.d.ts +0 -166
- package/dist/shared/contracts/releases.d.ts.map +0 -1
- package/dist/shared/types.d.ts +0 -24
- package/dist/shared/types.d.ts.map +0 -1
- package/dist/shared/validation-schemas.d.ts +0 -2
- package/dist/shared/validation-schemas.d.ts.map +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
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 helperPlugin = require("@strapi/helper-plugin");
|
|
5
5
|
const reactRouterDom = require("react-router-dom");
|
|
6
|
-
const index = require("./index-
|
|
6
|
+
const index = require("./index-ZNwxYN8H.js");
|
|
7
7
|
const React = require("react");
|
|
8
|
+
const strapiAdmin = require("@strapi/admin/strapi-admin");
|
|
8
9
|
const designSystem = require("@strapi/design-system");
|
|
9
10
|
const v2 = require("@strapi/design-system/v2");
|
|
10
|
-
const helperPlugin = require("@strapi/helper-plugin");
|
|
11
11
|
const icons = require("@strapi/icons");
|
|
12
12
|
const format = require("date-fns/format");
|
|
13
13
|
const dateFnsTz = require("date-fns-tz");
|
|
@@ -43,36 +43,6 @@ const React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
|
|
43
43
|
const format__default = /* @__PURE__ */ _interopDefault(format);
|
|
44
44
|
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
45
45
|
const yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
|
|
46
|
-
const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
|
|
47
|
-
const RelativeTime = React__namespace.forwardRef(
|
|
48
|
-
({ timestamp, customIntervals = [], ...restProps }, forwardedRef) => {
|
|
49
|
-
const { formatRelativeTime, formatDate, formatTime } = reactIntl.useIntl();
|
|
50
|
-
const interval = dateFns.intervalToDuration({
|
|
51
|
-
start: timestamp,
|
|
52
|
-
end: Date.now()
|
|
53
|
-
// see https://github.com/date-fns/date-fns/issues/2891 – No idea why it's all partial it returns it every time.
|
|
54
|
-
});
|
|
55
|
-
const unit = intervals.find((intervalUnit) => {
|
|
56
|
-
return interval[intervalUnit] > 0 && Object.keys(interval).includes(intervalUnit);
|
|
57
|
-
});
|
|
58
|
-
const relativeTime = dateFns.isPast(timestamp) ? -interval[unit] : interval[unit];
|
|
59
|
-
const customInterval = customIntervals.find(
|
|
60
|
-
(custom) => interval[custom.unit] < custom.threshold
|
|
61
|
-
);
|
|
62
|
-
const displayText = customInterval ? customInterval.text : formatRelativeTime(relativeTime, unit, { numeric: "auto" });
|
|
63
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
64
|
-
"time",
|
|
65
|
-
{
|
|
66
|
-
ref: forwardedRef,
|
|
67
|
-
dateTime: timestamp.toISOString(),
|
|
68
|
-
role: "time",
|
|
69
|
-
title: `${formatDate(timestamp)} ${formatTime(timestamp)}`,
|
|
70
|
-
...restProps,
|
|
71
|
-
children: displayText
|
|
72
|
-
}
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
);
|
|
76
46
|
const RELEASE_SCHEMA = yup__namespace.object().shape({
|
|
77
47
|
name: yup__namespace.string().trim().required(),
|
|
78
48
|
scheduledAt: yup__namespace.string().nullable(),
|
|
@@ -102,7 +72,6 @@ const ReleaseModal = ({
|
|
|
102
72
|
const { formatMessage } = reactIntl.useIntl();
|
|
103
73
|
const { pathname } = reactRouterDom.useLocation();
|
|
104
74
|
const isCreatingRelease = pathname === `/plugins/${index.pluginId}`;
|
|
105
|
-
const IsSchedulingEnabled = window.strapi.future.isEnabled("contentReleasesScheduling");
|
|
106
75
|
const { timezoneList, systemTimezone = { value: "UTC+00:00-Africa/Abidjan " } } = getTimezones(
|
|
107
76
|
initialValues.scheduledAt ? new Date(initialValues.scheduledAt) : /* @__PURE__ */ new Date()
|
|
108
77
|
);
|
|
@@ -110,13 +79,12 @@ const ReleaseModal = ({
|
|
|
110
79
|
const { date, time, timezone } = values;
|
|
111
80
|
if (!date || !time || !timezone)
|
|
112
81
|
return null;
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
return dateFnsTz.zonedTimeToUtc(formattedDate, timezoneWithoutOffset);
|
|
82
|
+
const timezoneWithoutOffset = timezone.split("&")[1];
|
|
83
|
+
return dateFnsTz.zonedTimeToUtc(`${date} ${time}`, timezoneWithoutOffset);
|
|
116
84
|
};
|
|
117
85
|
const getTimezoneWithOffset = () => {
|
|
118
86
|
const currentTimezone = timezoneList.find(
|
|
119
|
-
(timezone) => timezone.value.split("
|
|
87
|
+
(timezone) => timezone.value.split("&")[1] === initialValues.timezone
|
|
120
88
|
);
|
|
121
89
|
return currentTimezone?.value || systemTimezone.value;
|
|
122
90
|
};
|
|
@@ -134,7 +102,7 @@ const ReleaseModal = ({
|
|
|
134
102
|
onSubmit: (values) => {
|
|
135
103
|
handleSubmit({
|
|
136
104
|
...values,
|
|
137
|
-
timezone: values.timezone ? values.timezone.split("
|
|
105
|
+
timezone: values.timezone ? values.timezone.split("&")[1] : null,
|
|
138
106
|
scheduledAt: values.isScheduled ? getScheduledTimestamp(values) : null
|
|
139
107
|
});
|
|
140
108
|
},
|
|
@@ -160,92 +128,88 @@ const ReleaseModal = ({
|
|
|
160
128
|
required: true
|
|
161
129
|
}
|
|
162
130
|
),
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
131
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "max-content", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
132
|
+
designSystem.Checkbox,
|
|
133
|
+
{
|
|
134
|
+
name: "isScheduled",
|
|
135
|
+
value: values.isScheduled,
|
|
136
|
+
onChange: (event) => {
|
|
137
|
+
setFieldValue("isScheduled", event.target.checked);
|
|
138
|
+
if (!event.target.checked) {
|
|
139
|
+
setFieldValue("date", null);
|
|
140
|
+
setFieldValue("time", "");
|
|
141
|
+
setFieldValue("timezone", null);
|
|
142
|
+
} else {
|
|
143
|
+
setFieldValue("date", initialValues.date);
|
|
144
|
+
setFieldValue("time", initialValues.time);
|
|
145
|
+
setFieldValue("timezone", initialValues.timezone ?? systemTimezone?.value);
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
149
|
+
designSystem.Typography,
|
|
150
|
+
{
|
|
151
|
+
textColor: values.isScheduled ? "primary600" : "neutral800",
|
|
152
|
+
fontWeight: values.isScheduled ? "semiBold" : "regular",
|
|
153
|
+
children: formatMessage({
|
|
154
|
+
id: "modal.form.input.label.schedule-release",
|
|
155
|
+
defaultMessage: "Schedule release"
|
|
156
|
+
})
|
|
157
|
+
}
|
|
158
|
+
)
|
|
159
|
+
}
|
|
160
|
+
) }),
|
|
161
|
+
values.isScheduled && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
162
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, alignItems: "start", children: [
|
|
163
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
164
|
+
designSystem.DatePicker,
|
|
165
|
+
{
|
|
166
|
+
label: formatMessage({
|
|
167
|
+
id: "content-releases.modal.form.input.label.date",
|
|
168
|
+
defaultMessage: "Date"
|
|
169
|
+
}),
|
|
170
|
+
name: "date",
|
|
171
|
+
error: errors.date,
|
|
172
|
+
onChange: (date) => {
|
|
173
|
+
const isoFormatDate = date ? dateFns.formatISO(date, { representation: "date" }) : null;
|
|
174
|
+
setFieldValue("date", isoFormatDate);
|
|
175
|
+
},
|
|
176
|
+
clearLabel: formatMessage({
|
|
177
|
+
id: "content-releases.modal.form.input.clearLabel",
|
|
178
|
+
defaultMessage: "Clear"
|
|
179
|
+
}),
|
|
180
|
+
onClear: () => {
|
|
172
181
|
setFieldValue("date", null);
|
|
182
|
+
},
|
|
183
|
+
selectedDate: values.date || void 0,
|
|
184
|
+
required: true,
|
|
185
|
+
minDate: dateFnsTz.utcToZonedTime(/* @__PURE__ */ new Date(), values.timezone.split("&")[1])
|
|
186
|
+
}
|
|
187
|
+
) }),
|
|
188
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
189
|
+
designSystem.TimePicker,
|
|
190
|
+
{
|
|
191
|
+
label: formatMessage({
|
|
192
|
+
id: "content-releases.modal.form.input.label.time",
|
|
193
|
+
defaultMessage: "Time"
|
|
194
|
+
}),
|
|
195
|
+
name: "time",
|
|
196
|
+
error: errors.time,
|
|
197
|
+
onChange: (time) => {
|
|
198
|
+
setFieldValue("time", time);
|
|
199
|
+
},
|
|
200
|
+
clearLabel: formatMessage({
|
|
201
|
+
id: "content-releases.modal.form.input.clearLabel",
|
|
202
|
+
defaultMessage: "Clear"
|
|
203
|
+
}),
|
|
204
|
+
onClear: () => {
|
|
173
205
|
setFieldValue("time", "");
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
);
|
|
182
|
-
}
|
|
183
|
-
},
|
|
184
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
185
|
-
designSystem.Typography,
|
|
186
|
-
{
|
|
187
|
-
textColor: values.isScheduled ? "primary600" : "neutral800",
|
|
188
|
-
fontWeight: values.isScheduled ? "semiBold" : "regular",
|
|
189
|
-
children: formatMessage({
|
|
190
|
-
id: "modal.form.input.label.schedule-release",
|
|
191
|
-
defaultMessage: "Schedule release"
|
|
192
|
-
})
|
|
193
|
-
}
|
|
194
|
-
)
|
|
195
|
-
}
|
|
196
|
-
) }),
|
|
197
|
-
values.isScheduled && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
198
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, alignItems: "start", children: [
|
|
199
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
200
|
-
designSystem.DatePicker,
|
|
201
|
-
{
|
|
202
|
-
label: formatMessage({
|
|
203
|
-
id: "content-releases.modal.form.input.label.date",
|
|
204
|
-
defaultMessage: "Date"
|
|
205
|
-
}),
|
|
206
|
-
name: "date",
|
|
207
|
-
error: errors.date,
|
|
208
|
-
onChange: (date) => {
|
|
209
|
-
const isoFormatDate = date ? dateFns.formatISO(date, { representation: "date" }) : null;
|
|
210
|
-
setFieldValue("date", isoFormatDate);
|
|
211
|
-
},
|
|
212
|
-
clearLabel: formatMessage({
|
|
213
|
-
id: "content-releases.modal.form.input.clearLabel",
|
|
214
|
-
defaultMessage: "Clear"
|
|
215
|
-
}),
|
|
216
|
-
onClear: () => {
|
|
217
|
-
setFieldValue("date", null);
|
|
218
|
-
},
|
|
219
|
-
selectedDate: values.date || void 0,
|
|
220
|
-
required: true
|
|
221
|
-
}
|
|
222
|
-
) }),
|
|
223
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
224
|
-
designSystem.TimePicker,
|
|
225
|
-
{
|
|
226
|
-
label: formatMessage({
|
|
227
|
-
id: "content-releases.modal.form.input.label.time",
|
|
228
|
-
defaultMessage: "Time"
|
|
229
|
-
}),
|
|
230
|
-
name: "time",
|
|
231
|
-
error: errors.time,
|
|
232
|
-
onChange: (time) => {
|
|
233
|
-
setFieldValue("time", time);
|
|
234
|
-
},
|
|
235
|
-
clearLabel: formatMessage({
|
|
236
|
-
id: "content-releases.modal.form.input.clearLabel",
|
|
237
|
-
defaultMessage: "Clear"
|
|
238
|
-
}),
|
|
239
|
-
onClear: () => {
|
|
240
|
-
setFieldValue("time", "");
|
|
241
|
-
},
|
|
242
|
-
value: values.time || void 0,
|
|
243
|
-
required: true
|
|
244
|
-
}
|
|
245
|
-
) })
|
|
246
|
-
] }),
|
|
247
|
-
/* @__PURE__ */ jsxRuntime.jsx(TimezoneComponent, { timezoneOptions: timezoneList })
|
|
248
|
-
] })
|
|
206
|
+
},
|
|
207
|
+
value: values.time || void 0,
|
|
208
|
+
required: true
|
|
209
|
+
}
|
|
210
|
+
) })
|
|
211
|
+
] }),
|
|
212
|
+
/* @__PURE__ */ jsxRuntime.jsx(TimezoneComponent, { timezoneOptions: timezoneList })
|
|
249
213
|
] })
|
|
250
214
|
] }) }),
|
|
251
215
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -269,10 +233,10 @@ const ReleaseModal = ({
|
|
|
269
233
|
const getTimezones = (selectedDate) => {
|
|
270
234
|
const timezoneList = Intl.supportedValuesOf("timeZone").map((timezone) => {
|
|
271
235
|
const utcOffset = index.getTimezoneOffset(timezone, selectedDate);
|
|
272
|
-
return { offset: utcOffset, value: `${utcOffset}
|
|
236
|
+
return { offset: utcOffset, value: `${utcOffset}&${timezone}` };
|
|
273
237
|
});
|
|
274
238
|
const systemTimezone = timezoneList.find(
|
|
275
|
-
(timezone) => timezone.value.split("
|
|
239
|
+
(timezone) => timezone.value.split("&")[1] === Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
276
240
|
);
|
|
277
241
|
return { timezoneList, systemTimezone };
|
|
278
242
|
};
|
|
@@ -284,7 +248,7 @@ const TimezoneComponent = ({ timezoneOptions }) => {
|
|
|
284
248
|
if (values.date) {
|
|
285
249
|
const { timezoneList: timezoneList2 } = getTimezones(new Date(values.date));
|
|
286
250
|
setTimezoneList(timezoneList2);
|
|
287
|
-
const updatedTimezone = values.timezone && timezoneList2.find((tz) => tz.value.split("
|
|
251
|
+
const updatedTimezone = values.timezone && timezoneList2.find((tz) => tz.value.split("&")[1] === values.timezone.split("&")[1]);
|
|
288
252
|
if (updatedTimezone) {
|
|
289
253
|
setFieldValue("timezone", updatedTimezone.value);
|
|
290
254
|
}
|
|
@@ -297,9 +261,10 @@ const TimezoneComponent = ({ timezoneOptions }) => {
|
|
|
297
261
|
id: "content-releases.modal.form.input.label.timezone",
|
|
298
262
|
defaultMessage: "Timezone"
|
|
299
263
|
}),
|
|
264
|
+
autocomplete: { type: "list", filter: "contains" },
|
|
300
265
|
name: "timezone",
|
|
301
266
|
value: values.timezone || void 0,
|
|
302
|
-
textValue: values.timezone ? values.timezone.replace(
|
|
267
|
+
textValue: values.timezone ? values.timezone.replace(/&/, " ") : void 0,
|
|
303
268
|
onChange: (timezone) => {
|
|
304
269
|
setFieldValue("timezone", timezone);
|
|
305
270
|
},
|
|
@@ -311,15 +276,18 @@ const TimezoneComponent = ({ timezoneOptions }) => {
|
|
|
311
276
|
},
|
|
312
277
|
error: errors.timezone,
|
|
313
278
|
required: true,
|
|
314
|
-
children: timezoneList.map((timezone) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.ComboboxOption, { value: timezone.value, children: timezone.value.replace(
|
|
279
|
+
children: timezoneList.map((timezone) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.ComboboxOption, { value: timezone.value, children: timezone.value.replace(/&/, " ") }, timezone.value))
|
|
315
280
|
}
|
|
316
281
|
);
|
|
317
282
|
};
|
|
318
283
|
const LinkCard = styled__default.default(v2.Link)`
|
|
319
284
|
display: block;
|
|
320
285
|
`;
|
|
321
|
-
const
|
|
322
|
-
|
|
286
|
+
const RelativeTime = styled__default.default(helperPlugin.RelativeTime)`
|
|
287
|
+
display: inline-block;
|
|
288
|
+
&::first-letter {
|
|
289
|
+
text-transform: uppercase;
|
|
290
|
+
}
|
|
323
291
|
`;
|
|
324
292
|
const getBadgeProps = (status) => {
|
|
325
293
|
let color;
|
|
@@ -348,9 +316,8 @@ const getBadgeProps = (status) => {
|
|
|
348
316
|
};
|
|
349
317
|
const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
350
318
|
const { formatMessage } = reactIntl.useIntl();
|
|
351
|
-
const IsSchedulingEnabled = window.strapi.future.isEnabled("contentReleasesScheduling");
|
|
352
319
|
if (isError) {
|
|
353
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
320
|
+
return /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.AnErrorOccurred, {});
|
|
354
321
|
}
|
|
355
322
|
if (releases?.length === 0) {
|
|
356
323
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -369,7 +336,7 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
369
336
|
}
|
|
370
337
|
);
|
|
371
338
|
}
|
|
372
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid, { gap: 4, children: releases.map(({ id, name,
|
|
339
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid, { gap: 4, children: releases.map(({ id, name, scheduledAt, status }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.GridItem, { col: 3, s: 6, xs: 12, children: /* @__PURE__ */ jsxRuntime.jsx(LinkCard, { href: `content-releases/${id}`, isExternal: false, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
373
340
|
designSystem.Flex,
|
|
374
341
|
{
|
|
375
342
|
direction: "column",
|
|
@@ -385,16 +352,10 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
385
352
|
children: [
|
|
386
353
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "start", gap: 1, children: [
|
|
387
354
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { as: "h3", variant: "delta", fontWeight: "bold", children: name }),
|
|
388
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children:
|
|
355
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: scheduledAt ? /* @__PURE__ */ jsxRuntime.jsx(RelativeTime, { timestamp: new Date(scheduledAt) }) : formatMessage({
|
|
389
356
|
id: "content-releases.pages.Releases.not-scheduled",
|
|
390
357
|
defaultMessage: "Not scheduled"
|
|
391
|
-
})
|
|
392
|
-
{
|
|
393
|
-
id: "content-releases.page.Releases.release-item.entries",
|
|
394
|
-
defaultMessage: "{number, plural, =0 {No entries} one {# entry} other {# entries}}"
|
|
395
|
-
},
|
|
396
|
-
{ number: actions.meta.count }
|
|
397
|
-
) })
|
|
358
|
+
}) })
|
|
398
359
|
] }),
|
|
399
360
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { ...getBadgeProps(status), children: status })
|
|
400
361
|
]
|
|
@@ -413,8 +374,7 @@ const INITIAL_FORM_VALUES = {
|
|
|
413
374
|
name: "",
|
|
414
375
|
date: null,
|
|
415
376
|
time: "",
|
|
416
|
-
|
|
417
|
-
isScheduled: window.strapi.future.isEnabled("contentReleasesScheduling"),
|
|
377
|
+
isScheduled: true,
|
|
418
378
|
scheduledAt: null,
|
|
419
379
|
timezone: null
|
|
420
380
|
};
|
|
@@ -424,7 +384,7 @@ const ReleasesPage = () => {
|
|
|
424
384
|
const [releaseModalShown, setReleaseModalShown] = React__namespace.useState(false);
|
|
425
385
|
const toggleNotification = helperPlugin.useNotification();
|
|
426
386
|
const { formatMessage } = reactIntl.useIntl();
|
|
427
|
-
const
|
|
387
|
+
const { push, replace } = reactRouterDom.useHistory();
|
|
428
388
|
const { formatAPIError } = helperPlugin.useAPIErrorHandler();
|
|
429
389
|
const [{ query }, setQuery] = helperPlugin.useQueryParams();
|
|
430
390
|
const response = index.useGetReleasesQuery(query);
|
|
@@ -448,9 +408,9 @@ const ReleasesPage = () => {
|
|
|
448
408
|
defaultMessage: "Please try again or open another release."
|
|
449
409
|
})
|
|
450
410
|
});
|
|
451
|
-
|
|
411
|
+
replace({ state: null });
|
|
452
412
|
}
|
|
453
|
-
}, [formatMessage, location?.state?.errors,
|
|
413
|
+
}, [formatMessage, location?.state?.errors, replace, toggleNotification]);
|
|
454
414
|
React__namespace.useEffect(() => {
|
|
455
415
|
if (tabRef.current) {
|
|
456
416
|
tabRef.current._handlers.setSelectedTabIndex(activeTabIndex);
|
|
@@ -460,7 +420,7 @@ const ReleasesPage = () => {
|
|
|
460
420
|
setReleaseModalShown((prev) => !prev);
|
|
461
421
|
};
|
|
462
422
|
if (isLoading) {
|
|
463
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
423
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Main, { "aria-busy": isLoading, children: /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.LoadingIndicatorPage, {}) });
|
|
464
424
|
}
|
|
465
425
|
const totalPendingReleases = isSuccess && response.currentData?.meta?.pendingReleasesCount || 0;
|
|
466
426
|
const hasReachedMaximumPendingReleases = totalPendingReleases >= maximumReleases;
|
|
@@ -491,7 +451,7 @@ const ReleasesPage = () => {
|
|
|
491
451
|
})
|
|
492
452
|
});
|
|
493
453
|
trackUsage("didCreateRelease");
|
|
494
|
-
|
|
454
|
+
push(`/plugins/content-releases/${response2.data.data.id}`);
|
|
495
455
|
} else if (index.isAxiosError(response2.error)) {
|
|
496
456
|
toggleNotification({
|
|
497
457
|
type: "warning",
|
|
@@ -606,17 +566,23 @@ const ReleasesPage = () => {
|
|
|
606
566
|
]
|
|
607
567
|
}
|
|
608
568
|
),
|
|
609
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
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,
|
|
572
|
+
{
|
|
573
|
+
options: ["8", "16", "32", "64"],
|
|
574
|
+
defaultValue: response?.currentData?.meta?.pagination?.pageSize.toString()
|
|
575
|
+
}
|
|
576
|
+
),
|
|
577
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
578
|
+
helperPlugin.PaginationURLQuery,
|
|
579
|
+
{
|
|
580
|
+
pagination: {
|
|
581
|
+
pageCount: response?.currentData?.meta?.pagination?.pageCount || 0
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
)
|
|
585
|
+
] }) : null
|
|
620
586
|
] }) }),
|
|
621
587
|
releaseModalShown && /* @__PURE__ */ jsxRuntime.jsx(
|
|
622
588
|
ReleaseModal,
|
|
@@ -664,18 +630,14 @@ const TrashIcon = styled__default.default(icons.Trash)`
|
|
|
664
630
|
const TypographyMaxWidth = styled__default.default(designSystem.Typography)`
|
|
665
631
|
max-width: 300px;
|
|
666
632
|
`;
|
|
667
|
-
const EntryValidationText = ({ action, schema, entry }) => {
|
|
633
|
+
const EntryValidationText = ({ action, schema, components, entry }) => {
|
|
668
634
|
const { formatMessage } = reactIntl.useIntl();
|
|
669
|
-
const { validate } = strapiAdmin.unstable_useDocument(
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
skip: !schema
|
|
676
|
-
}
|
|
677
|
-
);
|
|
678
|
-
const errors = validate(entry) ?? {};
|
|
635
|
+
const { validate } = strapiAdmin.unstable_useDocument();
|
|
636
|
+
const { errors } = validate(entry, {
|
|
637
|
+
contentType: schema,
|
|
638
|
+
components,
|
|
639
|
+
isCreatingEntry: false
|
|
640
|
+
});
|
|
679
641
|
if (Object.keys(errors).length > 0) {
|
|
680
642
|
const validationErrorsMessages = Object.entries(errors).map(
|
|
681
643
|
([key, value]) => formatMessage(
|
|
@@ -723,12 +685,7 @@ const ReleaseDetailsLayout = ({
|
|
|
723
685
|
isLoading: isLoadingDetails,
|
|
724
686
|
isError,
|
|
725
687
|
error
|
|
726
|
-
} = index.useGetReleaseQuery(
|
|
727
|
-
{ id: releaseId },
|
|
728
|
-
{
|
|
729
|
-
skip: !releaseId
|
|
730
|
-
}
|
|
731
|
-
);
|
|
688
|
+
} = index.useGetReleaseQuery({ id: releaseId });
|
|
732
689
|
const [publishRelease, { isLoading: isPublishing }] = index.usePublishReleaseMutation();
|
|
733
690
|
const toggleNotification = helperPlugin.useNotification();
|
|
734
691
|
const { formatAPIError } = helperPlugin.useAPIErrorHandler();
|
|
@@ -738,8 +695,8 @@ const ReleaseDetailsLayout = ({
|
|
|
738
695
|
const dispatch = index.useTypedDispatch();
|
|
739
696
|
const { trackUsage } = helperPlugin.useTracking();
|
|
740
697
|
const release = data?.data;
|
|
741
|
-
const handlePublishRelease =
|
|
742
|
-
const response = await publishRelease({ id });
|
|
698
|
+
const handlePublishRelease = async () => {
|
|
699
|
+
const response = await publishRelease({ id: releaseId });
|
|
743
700
|
if ("data" in response) {
|
|
744
701
|
toggleNotification({
|
|
745
702
|
type: "success",
|
|
@@ -767,7 +724,12 @@ const ReleaseDetailsLayout = ({
|
|
|
767
724
|
}
|
|
768
725
|
};
|
|
769
726
|
const handleRefresh = () => {
|
|
770
|
-
dispatch(
|
|
727
|
+
dispatch(
|
|
728
|
+
index.releaseApi.util.invalidateTags([
|
|
729
|
+
{ type: "ReleaseAction", id: "LIST" },
|
|
730
|
+
{ type: "Release", id: releaseId }
|
|
731
|
+
])
|
|
732
|
+
);
|
|
771
733
|
};
|
|
772
734
|
const getCreatedByUser = () => {
|
|
773
735
|
if (!release?.createdBy) {
|
|
@@ -782,26 +744,27 @@ const ReleaseDetailsLayout = ({
|
|
|
782
744
|
return release.createdBy.email;
|
|
783
745
|
};
|
|
784
746
|
if (isLoadingDetails) {
|
|
785
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
747
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Main, { "aria-busy": isLoadingDetails, children: /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.LoadingIndicatorPage, {}) });
|
|
786
748
|
}
|
|
787
749
|
if (isError || !release) {
|
|
788
750
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
789
|
-
reactRouterDom.
|
|
751
|
+
reactRouterDom.Redirect,
|
|
790
752
|
{
|
|
791
|
-
to:
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
753
|
+
to: {
|
|
754
|
+
pathname: "/plugins/content-releases",
|
|
755
|
+
state: {
|
|
756
|
+
errors: [
|
|
757
|
+
{
|
|
758
|
+
code: error?.code
|
|
759
|
+
}
|
|
760
|
+
]
|
|
761
|
+
}
|
|
798
762
|
}
|
|
799
763
|
}
|
|
800
764
|
);
|
|
801
765
|
}
|
|
802
766
|
const totalEntries = release.actions.meta.count || 0;
|
|
803
767
|
const hasCreatedByUser = Boolean(getCreatedByUser());
|
|
804
|
-
const IsSchedulingEnabled = window.strapi.future.isEnabled("contentReleasesScheduling");
|
|
805
768
|
const isScheduled = release.scheduledAt && release.timezone;
|
|
806
769
|
const numberOfEntriesText = formatMessage(
|
|
807
770
|
{
|
|
@@ -836,7 +799,7 @@ const ReleaseDetailsLayout = ({
|
|
|
836
799
|
{
|
|
837
800
|
title: release.name,
|
|
838
801
|
subtitle: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, lineHeight: 6, children: [
|
|
839
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", variant: "epsilon", children: numberOfEntriesText + (
|
|
802
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", variant: "epsilon", children: numberOfEntriesText + (isScheduled ? ` - ${scheduledText}` : "") }),
|
|
840
803
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { ...getBadgeProps(release.status), children: release.status })
|
|
841
804
|
] }),
|
|
842
805
|
navigationAction: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Link, { startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowLeft, {}), to: "/plugins/content-releases", children: formatMessage({
|
|
@@ -908,7 +871,7 @@ const ReleaseDetailsLayout = ({
|
|
|
908
871
|
defaultMessage: "Created"
|
|
909
872
|
}) }),
|
|
910
873
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", color: "neutral300", children: [
|
|
911
|
-
/* @__PURE__ */ jsxRuntime.jsx(RelativeTime, { timestamp: new Date(release.createdAt) }),
|
|
874
|
+
/* @__PURE__ */ jsxRuntime.jsx(helperPlugin.RelativeTime, { timestamp: new Date(release.createdAt) }),
|
|
912
875
|
formatMessage(
|
|
913
876
|
{
|
|
914
877
|
id: "content-releases.header.actions.created.description",
|
|
@@ -931,7 +894,7 @@ const ReleaseDetailsLayout = ({
|
|
|
931
894
|
{
|
|
932
895
|
size: "S",
|
|
933
896
|
variant: "default",
|
|
934
|
-
onClick: handlePublishRelease
|
|
897
|
+
onClick: handlePublishRelease,
|
|
935
898
|
loading: isPublishing,
|
|
936
899
|
disabled: release.actions.meta.count === 0,
|
|
937
900
|
children: formatMessage({
|
|
@@ -947,6 +910,7 @@ const ReleaseDetailsLayout = ({
|
|
|
947
910
|
] });
|
|
948
911
|
};
|
|
949
912
|
const GROUP_BY_OPTIONS = ["contentType", "locale", "action"];
|
|
913
|
+
const GROUP_BY_OPTIONS_NO_LOCALE = ["contentType", "action"];
|
|
950
914
|
const getGroupByOptionLabel = (value) => {
|
|
951
915
|
if (value === "locale") {
|
|
952
916
|
return {
|
|
@@ -965,8 +929,24 @@ const getGroupByOptionLabel = (value) => {
|
|
|
965
929
|
defaultMessage: "Content-Types"
|
|
966
930
|
};
|
|
967
931
|
};
|
|
968
|
-
const
|
|
932
|
+
const DEFAULT_RELEASE_DETAILS_HEADER = [
|
|
933
|
+
{
|
|
934
|
+
key: "__name__",
|
|
935
|
+
fieldSchema: { type: "string" },
|
|
936
|
+
metadatas: {
|
|
937
|
+
label: {
|
|
938
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.name",
|
|
939
|
+
defaultMessage: "name"
|
|
940
|
+
},
|
|
941
|
+
searchable: false,
|
|
942
|
+
sortable: false
|
|
943
|
+
},
|
|
944
|
+
name: "name"
|
|
945
|
+
}
|
|
946
|
+
];
|
|
947
|
+
const ReleaseDetailsBody = () => {
|
|
969
948
|
const { formatMessage } = reactIntl.useIntl();
|
|
949
|
+
const { releaseId } = reactRouterDom.useParams();
|
|
970
950
|
const [{ query }, setQuery] = helperPlugin.useQueryParams();
|
|
971
951
|
const toggleNotification = helperPlugin.useNotification();
|
|
972
952
|
const { formatAPIError } = helperPlugin.useAPIErrorHandler();
|
|
@@ -979,6 +959,17 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
979
959
|
const {
|
|
980
960
|
allowedActions: { canUpdate }
|
|
981
961
|
} = helperPlugin.useRBAC(index.PERMISSIONS);
|
|
962
|
+
const { runHookWaterfall } = helperPlugin.useStrapiApp();
|
|
963
|
+
const {
|
|
964
|
+
displayedHeaders,
|
|
965
|
+
hasI18nEnabled
|
|
966
|
+
} = runHookWaterfall(
|
|
967
|
+
"ContentReleases/pages/ReleaseDetails/add-locale-in-releases",
|
|
968
|
+
{
|
|
969
|
+
displayedHeaders: DEFAULT_RELEASE_DETAILS_HEADER,
|
|
970
|
+
hasI18nEnabled: false
|
|
971
|
+
}
|
|
972
|
+
);
|
|
982
973
|
const release = releaseData?.data;
|
|
983
974
|
const selectedGroupBy = query?.groupBy || "contentType";
|
|
984
975
|
const {
|
|
@@ -1021,7 +1012,7 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1021
1012
|
}
|
|
1022
1013
|
};
|
|
1023
1014
|
if (isLoading || isReleaseLoading) {
|
|
1024
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1015
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.ContentLayout, { children: /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.LoadingIndicatorPage, {}) });
|
|
1025
1016
|
}
|
|
1026
1017
|
const releaseActions = data?.data;
|
|
1027
1018
|
const releaseMeta = data?.meta;
|
|
@@ -1040,22 +1031,28 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1040
1031
|
});
|
|
1041
1032
|
}
|
|
1042
1033
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1043
|
-
reactRouterDom.
|
|
1034
|
+
reactRouterDom.Redirect,
|
|
1044
1035
|
{
|
|
1045
|
-
to:
|
|
1046
|
-
|
|
1047
|
-
|
|
1036
|
+
to: {
|
|
1037
|
+
pathname: "/plugins/content-releases",
|
|
1038
|
+
state: {
|
|
1039
|
+
errors: errorsArray
|
|
1040
|
+
}
|
|
1048
1041
|
}
|
|
1049
1042
|
}
|
|
1050
1043
|
);
|
|
1051
1044
|
}
|
|
1052
1045
|
if (isError || !releaseActions) {
|
|
1053
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1046
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.ContentLayout, { children: /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.AnErrorOccurred, {}) });
|
|
1054
1047
|
}
|
|
1055
1048
|
if (Object.keys(releaseActions).length === 0) {
|
|
1056
1049
|
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.ContentLayout, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1057
|
-
|
|
1050
|
+
helperPlugin.NoContent,
|
|
1058
1051
|
{
|
|
1052
|
+
content: {
|
|
1053
|
+
id: "content-releases.pages.Details.tab.emptyEntries",
|
|
1054
|
+
defaultMessage: "This release is empty. Open the Content Manager, select an entry and add it to the release."
|
|
1055
|
+
},
|
|
1059
1056
|
action: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1060
1057
|
v2.LinkButton,
|
|
1061
1058
|
{
|
|
@@ -1070,15 +1067,11 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1070
1067
|
defaultMessage: "Open the Content Manager"
|
|
1071
1068
|
})
|
|
1072
1069
|
}
|
|
1073
|
-
)
|
|
1074
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.EmptyDocuments, { width: "10rem" }),
|
|
1075
|
-
content: formatMessage({
|
|
1076
|
-
id: "content-releases.pages.Details.tab.emptyEntries",
|
|
1077
|
-
defaultMessage: "This release is empty. Open the Content Manager, select an entry and add it to the release."
|
|
1078
|
-
})
|
|
1070
|
+
)
|
|
1079
1071
|
}
|
|
1080
1072
|
) });
|
|
1081
1073
|
}
|
|
1074
|
+
const options = hasI18nEnabled ? GROUP_BY_OPTIONS : GROUP_BY_OPTIONS_NO_LOCALE;
|
|
1082
1075
|
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.ContentLayout, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 8, direction: "column", alignItems: "stretch", children: [
|
|
1083
1076
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1084
1077
|
designSystem.SingleSelect,
|
|
@@ -1098,7 +1091,7 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1098
1091
|
),
|
|
1099
1092
|
value: formatMessage(getGroupByOptionLabel(selectedGroupBy)),
|
|
1100
1093
|
onChange: (value) => setQuery({ groupBy: value }),
|
|
1101
|
-
children:
|
|
1094
|
+
children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: option, children: formatMessage(getGroupByOptionLabel(option)) }, option))
|
|
1102
1095
|
}
|
|
1103
1096
|
) }),
|
|
1104
1097
|
Object.keys(releaseActions).map((key) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, direction: "column", alignItems: "stretch", children: [
|
|
@@ -1115,32 +1108,19 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1115
1108
|
isFetching,
|
|
1116
1109
|
children: /* @__PURE__ */ jsxRuntime.jsxs(helperPlugin.Table.Content, { children: [
|
|
1117
1110
|
/* @__PURE__ */ jsxRuntime.jsxs(helperPlugin.Table.Head, { children: [
|
|
1118
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1111
|
+
displayedHeaders.map(({ key: key2, fieldSchema, metadatas, name }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1119
1112
|
helperPlugin.Table.HeaderCell,
|
|
1120
1113
|
{
|
|
1121
|
-
|
|
1122
|
-
label: formatMessage(
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
}
|
|
1128
|
-
),
|
|
1129
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1130
|
-
helperPlugin.Table.HeaderCell,
|
|
1131
|
-
{
|
|
1132
|
-
attribute: { type: "string" },
|
|
1133
|
-
label: formatMessage({
|
|
1134
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.locale",
|
|
1135
|
-
defaultMessage: "locale"
|
|
1136
|
-
}),
|
|
1137
|
-
name: "locale"
|
|
1138
|
-
}
|
|
1139
|
-
),
|
|
1114
|
+
fieldSchemaType: fieldSchema.type,
|
|
1115
|
+
label: formatMessage(metadatas.label),
|
|
1116
|
+
name
|
|
1117
|
+
},
|
|
1118
|
+
key2
|
|
1119
|
+
)),
|
|
1140
1120
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1141
1121
|
helperPlugin.Table.HeaderCell,
|
|
1142
1122
|
{
|
|
1143
|
-
|
|
1123
|
+
fieldSchemaType: "string",
|
|
1144
1124
|
label: formatMessage({
|
|
1145
1125
|
id: "content-releases.page.ReleaseDetails.table.header.label.content-type",
|
|
1146
1126
|
defaultMessage: "content-type"
|
|
@@ -1151,7 +1131,7 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1151
1131
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1152
1132
|
helperPlugin.Table.HeaderCell,
|
|
1153
1133
|
{
|
|
1154
|
-
|
|
1134
|
+
fieldSchemaType: "string",
|
|
1155
1135
|
label: formatMessage({
|
|
1156
1136
|
id: "content-releases.page.ReleaseDetails.table.header.label.action",
|
|
1157
1137
|
defaultMessage: "action"
|
|
@@ -1162,7 +1142,7 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1162
1142
|
!release.releasedAt && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1163
1143
|
helperPlugin.Table.HeaderCell,
|
|
1164
1144
|
{
|
|
1165
|
-
|
|
1145
|
+
fieldSchemaType: "string",
|
|
1166
1146
|
label: formatMessage({
|
|
1167
1147
|
id: "content-releases.page.ReleaseDetails.table.header.label.status",
|
|
1168
1148
|
defaultMessage: "status"
|
|
@@ -1175,7 +1155,7 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1175
1155
|
/* @__PURE__ */ jsxRuntime.jsx(helperPlugin.Table.Body, { children: releaseActions[key].map(
|
|
1176
1156
|
({ id, contentType, locale, type, entry }, actionIndex) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
1177
1157
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "25%", maxWidth: "200px", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { ellipsis: true, children: `${contentType.mainFieldValue || entry.id}` }) }),
|
|
1178
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "10%", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: `${locale?.name ? locale.name : "-"}` }) }),
|
|
1158
|
+
hasI18nEnabled && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "10%", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: `${locale?.name ? locale.name : "-"}` }) }),
|
|
1179
1159
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "10%", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: contentType.displayName || "" }) }),
|
|
1180
1160
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "20%", children: release.releasedAt ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage(
|
|
1181
1161
|
{
|
|
@@ -1229,17 +1209,17 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1229
1209
|
}
|
|
1230
1210
|
)
|
|
1231
1211
|
] }, `releases-group-${key}`)),
|
|
1232
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
)
|
|
1212
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { paddingTop: 4, alignItems: "flex-end", justifyContent: "space-between", children: [
|
|
1213
|
+
/* @__PURE__ */ jsxRuntime.jsx(helperPlugin.PageSizeURLQuery, { defaultValue: releaseMeta?.pagination?.pageSize.toString() }),
|
|
1214
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1215
|
+
helperPlugin.PaginationURLQuery,
|
|
1216
|
+
{
|
|
1217
|
+
pagination: {
|
|
1218
|
+
pageCount: releaseMeta?.pagination?.pageCount || 0
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
)
|
|
1222
|
+
] })
|
|
1243
1223
|
] }) });
|
|
1244
1224
|
};
|
|
1245
1225
|
const ReleaseDetailsPage = () => {
|
|
@@ -1247,19 +1227,14 @@ const ReleaseDetailsPage = () => {
|
|
|
1247
1227
|
const { releaseId } = reactRouterDom.useParams();
|
|
1248
1228
|
const toggleNotification = helperPlugin.useNotification();
|
|
1249
1229
|
const { formatAPIError } = helperPlugin.useAPIErrorHandler();
|
|
1250
|
-
const
|
|
1230
|
+
const { replace } = reactRouterDom.useHistory();
|
|
1251
1231
|
const [releaseModalShown, setReleaseModalShown] = React__namespace.useState(false);
|
|
1252
1232
|
const [showWarningSubmit, setWarningSubmit] = React__namespace.useState(false);
|
|
1253
1233
|
const {
|
|
1254
1234
|
isLoading: isLoadingDetails,
|
|
1255
1235
|
data,
|
|
1256
1236
|
isSuccess: isSuccessDetails
|
|
1257
|
-
} = index.useGetReleaseQuery(
|
|
1258
|
-
{ id: releaseId },
|
|
1259
|
-
{
|
|
1260
|
-
skip: !releaseId
|
|
1261
|
-
}
|
|
1262
|
-
);
|
|
1237
|
+
} = index.useGetReleaseQuery({ id: releaseId });
|
|
1263
1238
|
const [updateRelease, { isLoading: isSubmittingForm }] = index.useUpdateReleaseMutation();
|
|
1264
1239
|
const [deleteRelease, { isLoading: isDeletingRelease }] = index.useDeleteReleaseMutation();
|
|
1265
1240
|
const toggleEditReleaseModal = () => {
|
|
@@ -1272,18 +1247,15 @@ const ReleaseDetailsPage = () => {
|
|
|
1272
1247
|
{
|
|
1273
1248
|
toggleEditReleaseModal,
|
|
1274
1249
|
toggleWarningSubmit,
|
|
1275
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1250
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.ContentLayout, { children: /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.LoadingIndicatorPage, {}) })
|
|
1276
1251
|
}
|
|
1277
1252
|
);
|
|
1278
1253
|
}
|
|
1279
|
-
if (!releaseId) {
|
|
1280
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: ".." });
|
|
1281
|
-
}
|
|
1282
1254
|
const releaseData = isSuccessDetails && data?.data || null;
|
|
1283
1255
|
const title = releaseData?.name || "";
|
|
1284
1256
|
const timezone = releaseData?.timezone ?? null;
|
|
1285
1257
|
const scheduledAt = releaseData?.scheduledAt && timezone ? dateFnsTz.utcToZonedTime(releaseData.scheduledAt, timezone) : null;
|
|
1286
|
-
const date = scheduledAt ?
|
|
1258
|
+
const date = scheduledAt ? format__default.default(scheduledAt, "yyyy-MM-dd") : null;
|
|
1287
1259
|
const time = scheduledAt ? format__default.default(scheduledAt, "HH:mm") : "";
|
|
1288
1260
|
const handleEditRelease = async (values) => {
|
|
1289
1261
|
const response = await updateRelease({
|
|
@@ -1300,6 +1272,7 @@ const ReleaseDetailsPage = () => {
|
|
|
1300
1272
|
defaultMessage: "Release updated."
|
|
1301
1273
|
})
|
|
1302
1274
|
});
|
|
1275
|
+
toggleEditReleaseModal();
|
|
1303
1276
|
} else if (index.isAxiosError(response.error)) {
|
|
1304
1277
|
toggleNotification({
|
|
1305
1278
|
type: "warning",
|
|
@@ -1311,14 +1284,13 @@ const ReleaseDetailsPage = () => {
|
|
|
1311
1284
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
1312
1285
|
});
|
|
1313
1286
|
}
|
|
1314
|
-
toggleEditReleaseModal();
|
|
1315
1287
|
};
|
|
1316
1288
|
const handleDeleteRelease = async () => {
|
|
1317
1289
|
const response = await deleteRelease({
|
|
1318
1290
|
id: releaseId
|
|
1319
1291
|
});
|
|
1320
1292
|
if ("data" in response) {
|
|
1321
|
-
|
|
1293
|
+
replace("/plugins/content-releases");
|
|
1322
1294
|
} else if (index.isAxiosError(response.error)) {
|
|
1323
1295
|
toggleNotification({
|
|
1324
1296
|
type: "warning",
|
|
@@ -1337,7 +1309,7 @@ const ReleaseDetailsPage = () => {
|
|
|
1337
1309
|
toggleEditReleaseModal,
|
|
1338
1310
|
toggleWarningSubmit,
|
|
1339
1311
|
children: [
|
|
1340
|
-
/* @__PURE__ */ jsxRuntime.jsx(ReleaseDetailsBody, {
|
|
1312
|
+
/* @__PURE__ */ jsxRuntime.jsx(ReleaseDetailsBody, {}),
|
|
1341
1313
|
releaseModalShown && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1342
1314
|
ReleaseModal,
|
|
1343
1315
|
{
|
|
@@ -1372,10 +1344,10 @@ const ReleaseDetailsPage = () => {
|
|
|
1372
1344
|
);
|
|
1373
1345
|
};
|
|
1374
1346
|
const App = () => {
|
|
1375
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1376
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, {
|
|
1377
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, {
|
|
1347
|
+
return /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.CheckPagePermissions, { permissions: index.PERMISSIONS.main, children: /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.Switch, { children: [
|
|
1348
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { exact: true, path: `/plugins/${index.pluginId}`, component: ReleasesPage }),
|
|
1349
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { exact: true, path: `/plugins/${index.pluginId}/:releaseId`, component: ReleaseDetailsPage })
|
|
1378
1350
|
] }) });
|
|
1379
1351
|
};
|
|
1380
1352
|
exports.App = App;
|
|
1381
|
-
//# sourceMappingURL=App-
|
|
1353
|
+
//# sourceMappingURL=App-HjWtUYmc.js.map
|