@strapi/content-releases 0.0.0-experimental.f75e3c6d67cc47c64ab37479efdbb7b43be50b78 → 0.0.0-experimental.f77206734629a2b88793a7a8abca40388843c656
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-DUmziQ17.js → App-HjWtUYmc.js} +388 -401
- package/dist/_chunks/App-HjWtUYmc.js.map +1 -0
- package/dist/_chunks/{App-D_6Y9N2F.mjs → App-gu1aiP6i.mjs} +364 -378
- package/dist/_chunks/App-gu1aiP6i.mjs.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-_MxP6-Dt.mjs → PurchaseContentReleases-3tRbmbY3.mjs} +7 -8
- package/dist/_chunks/PurchaseContentReleases-3tRbmbY3.mjs.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-Be3acS2L.js → PurchaseContentReleases-bpIYXOfu.js} +6 -7
- package/dist/_chunks/PurchaseContentReleases-bpIYXOfu.js.map +1 -0
- package/dist/_chunks/{en-DtFJ5ViE.js → en-HrREghh3.js} +1 -1
- package/dist/_chunks/en-HrREghh3.js.map +1 -0
- package/dist/_chunks/{en-B9Ur3VsE.mjs → en-ltT1TlKQ.mjs} +1 -1
- package/dist/_chunks/en-ltT1TlKQ.mjs.map +1 -0
- package/dist/_chunks/{index-C5Hc767q.js → index-ZNwxYN8H.js} +475 -177
- package/dist/_chunks/index-ZNwxYN8H.js.map +1 -0
- package/dist/_chunks/{index-BomF0-yY.mjs → index-mvj9PSKd.mjs} +476 -180
- package/dist/_chunks/index-mvj9PSKd.mjs.map +1 -0
- package/dist/admin/index.js +15 -1
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +16 -2
- package/dist/admin/index.mjs.map +1 -1
- package/dist/server/index.js +86 -83
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +86 -84
- package/dist/server/index.mjs.map +1 -1
- package/package.json +36 -29
- package/dist/_chunks/App-DUmziQ17.js.map +0 -1
- package/dist/_chunks/App-D_6Y9N2F.mjs.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-Be3acS2L.js.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-_MxP6-Dt.mjs.map +0 -1
- package/dist/_chunks/en-B9Ur3VsE.mjs.map +0 -1
- package/dist/_chunks/en-DtFJ5ViE.js.map +0 -1
- package/dist/_chunks/index-BomF0-yY.mjs.map +0 -1
- package/dist/_chunks/index-C5Hc767q.js.map +0 -1
- package/dist/admin/src/components/CMReleasesContainer.d.ts +0 -22
- package/dist/admin/src/components/RelativeTime.d.ts +0 -28
- package/dist/admin/src/components/ReleaseAction.d.ts +0 -3
- 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/ReleaseListCell.d.ts +0 -0
- 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/release.d.ts +0 -105
- package/dist/admin/src/store/hooks.d.ts +0 -7
- package/dist/admin/src/utils/api.d.ts +0 -6
- package/dist/admin/src/utils/prefixPluginTranslations.d.ts +0 -3
- 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 -20
- package/dist/server/src/controllers/index.d.ts.map +0 -1
- package/dist/server/src/controllers/release-action.d.ts +0 -10
- package/dist/server/src/controllers/release-action.d.ts.map +0 -1
- package/dist/server/src/controllers/release.d.ts +0 -12
- package/dist/server/src/controllers/release.d.ts.map +0 -1
- package/dist/server/src/controllers/validation/release-action.d.ts +0 -8
- 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 -2096
- package/dist/server/src/index.d.ts.map +0 -1
- package/dist/server/src/migrations/index.d.ts +0 -13
- 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 -1826
- package/dist/server/src/services/index.d.ts.map +0 -1
- package/dist/server/src/services/release.d.ts +0 -66
- 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 -18
- package/dist/server/src/services/validation.d.ts.map +0 -1
- package/dist/server/src/utils/index.d.ts +0 -14
- package/dist/server/src/utils/index.d.ts.map +0 -1
- package/dist/shared/contracts/release-actions.d.ts +0 -131
- package/dist/shared/contracts/release-actions.d.ts.map +0 -1
- package/dist/shared/contracts/releases.d.ts +0 -182
- 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,23 +1,25 @@
|
|
|
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
|
|
8
|
+
const strapiAdmin = require("@strapi/admin/strapi-admin");
|
|
9
9
|
const designSystem = require("@strapi/design-system");
|
|
10
|
+
const v2 = require("@strapi/design-system/v2");
|
|
10
11
|
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 styled = require("styled-components");
|
|
16
16
|
const dateFns = require("date-fns");
|
|
17
17
|
const formik = require("formik");
|
|
18
18
|
const yup = require("yup");
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
require("@reduxjs/toolkit/query");
|
|
20
|
+
require("axios");
|
|
21
|
+
require("@reduxjs/toolkit/query/react");
|
|
22
|
+
require("react-redux");
|
|
21
23
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
22
24
|
function _interopNamespace(e) {
|
|
23
25
|
if (e && e.__esModule)
|
|
@@ -39,37 +41,8 @@ function _interopNamespace(e) {
|
|
|
39
41
|
}
|
|
40
42
|
const React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
|
41
43
|
const format__default = /* @__PURE__ */ _interopDefault(format);
|
|
44
|
+
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
42
45
|
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
|
-
);
|
|
73
46
|
const RELEASE_SCHEMA = yup__namespace.object().shape({
|
|
74
47
|
name: yup__namespace.string().trim().required(),
|
|
75
48
|
scheduledAt: yup__namespace.string().nullable(),
|
|
@@ -139,119 +112,120 @@ const ReleaseModal = ({
|
|
|
139
112
|
},
|
|
140
113
|
validationSchema: RELEASE_SCHEMA,
|
|
141
114
|
validateOnChange: false,
|
|
142
|
-
children: ({ values, errors, handleChange, setFieldValue }) => {
|
|
143
|
-
|
|
144
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
145
|
-
|
|
146
|
-
|
|
115
|
+
children: ({ values, errors, handleChange, setFieldValue }) => /* @__PURE__ */ jsxRuntime.jsxs(formik.Form, { children: [
|
|
116
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.ModalBody, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
|
|
117
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
118
|
+
designSystem.TextInput,
|
|
119
|
+
{
|
|
120
|
+
label: formatMessage({
|
|
147
121
|
id: "content-releases.modal.form.input.label.release-name",
|
|
148
122
|
defaultMessage: "Name"
|
|
149
|
-
})
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
123
|
+
}),
|
|
124
|
+
name: "name",
|
|
125
|
+
value: values.name,
|
|
126
|
+
error: errors.name,
|
|
127
|
+
onChange: handleChange,
|
|
128
|
+
required: true
|
|
129
|
+
}
|
|
130
|
+
),
|
|
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({
|
|
190
167
|
id: "content-releases.modal.form.input.label.date",
|
|
191
168
|
defaultMessage: "Date"
|
|
192
|
-
})
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
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: () => {
|
|
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({
|
|
215
192
|
id: "content-releases.modal.form.input.label.time",
|
|
216
193
|
defaultMessage: "Time"
|
|
217
|
-
})
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
),
|
|
234
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
235
|
-
] }) })
|
|
236
|
-
] }),
|
|
237
|
-
/* @__PURE__ */ jsxRuntime.jsx(TimezoneComponent, { timezoneOptions: timezoneList })
|
|
238
|
-
] })
|
|
239
|
-
] }) }),
|
|
240
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
241
|
-
designSystem.ModalFooter,
|
|
242
|
-
{
|
|
243
|
-
startActions: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: handleClose, variant: "tertiary", name: "cancel", children: formatMessage({ id: "cancel", defaultMessage: "Cancel" }) }),
|
|
244
|
-
endActions: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { name: "submit", loading: isLoading, type: "submit", children: formatMessage(
|
|
245
|
-
{
|
|
246
|
-
id: "content-releases.modal.form.button.submit",
|
|
247
|
-
defaultMessage: "{isCreatingRelease, select, true {Continue} other {Save}}"
|
|
248
|
-
},
|
|
249
|
-
{ isCreatingRelease }
|
|
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: () => {
|
|
205
|
+
setFieldValue("time", "");
|
|
206
|
+
},
|
|
207
|
+
value: values.time || void 0,
|
|
208
|
+
required: true
|
|
209
|
+
}
|
|
250
210
|
) })
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
211
|
+
] }),
|
|
212
|
+
/* @__PURE__ */ jsxRuntime.jsx(TimezoneComponent, { timezoneOptions: timezoneList })
|
|
213
|
+
] })
|
|
214
|
+
] }) }),
|
|
215
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
216
|
+
designSystem.ModalFooter,
|
|
217
|
+
{
|
|
218
|
+
startActions: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: handleClose, variant: "tertiary", name: "cancel", children: formatMessage({ id: "cancel", defaultMessage: "Cancel" }) }),
|
|
219
|
+
endActions: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { name: "submit", loading: isLoading, type: "submit", children: formatMessage(
|
|
220
|
+
{
|
|
221
|
+
id: "content-releases.modal.form.button.submit",
|
|
222
|
+
defaultMessage: "{isCreatingRelease, select, true {Continue} other {Save}}"
|
|
223
|
+
},
|
|
224
|
+
{ isCreatingRelease }
|
|
225
|
+
) })
|
|
226
|
+
}
|
|
227
|
+
)
|
|
228
|
+
] })
|
|
255
229
|
}
|
|
256
230
|
)
|
|
257
231
|
] });
|
|
@@ -280,40 +254,36 @@ const TimezoneComponent = ({ timezoneOptions }) => {
|
|
|
280
254
|
}
|
|
281
255
|
}
|
|
282
256
|
}, [setFieldValue, values.date, values.timezone]);
|
|
283
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
{
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
};
|
|
309
|
-
const useTypedDispatch = reactRedux.useDispatch;
|
|
310
|
-
const isBaseQueryError = (error) => {
|
|
311
|
-
return typeof error !== "undefined" && error.name !== void 0;
|
|
257
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
258
|
+
designSystem.Combobox,
|
|
259
|
+
{
|
|
260
|
+
label: formatMessage({
|
|
261
|
+
id: "content-releases.modal.form.input.label.timezone",
|
|
262
|
+
defaultMessage: "Timezone"
|
|
263
|
+
}),
|
|
264
|
+
autocomplete: { type: "list", filter: "contains" },
|
|
265
|
+
name: "timezone",
|
|
266
|
+
value: values.timezone || void 0,
|
|
267
|
+
textValue: values.timezone ? values.timezone.replace(/&/, " ") : void 0,
|
|
268
|
+
onChange: (timezone) => {
|
|
269
|
+
setFieldValue("timezone", timezone);
|
|
270
|
+
},
|
|
271
|
+
onTextValueChange: (timezone) => {
|
|
272
|
+
setFieldValue("timezone", timezone);
|
|
273
|
+
},
|
|
274
|
+
onClear: () => {
|
|
275
|
+
setFieldValue("timezone", "");
|
|
276
|
+
},
|
|
277
|
+
error: errors.timezone,
|
|
278
|
+
required: true,
|
|
279
|
+
children: timezoneList.map((timezone) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.ComboboxOption, { value: timezone.value, children: timezone.value.replace(/&/, " ") }, timezone.value))
|
|
280
|
+
}
|
|
281
|
+
);
|
|
312
282
|
};
|
|
313
|
-
const LinkCard =
|
|
283
|
+
const LinkCard = styled__default.default(v2.Link)`
|
|
314
284
|
display: block;
|
|
315
285
|
`;
|
|
316
|
-
const RelativeTime =
|
|
286
|
+
const RelativeTime = styled__default.default(helperPlugin.RelativeTime)`
|
|
317
287
|
display: inline-block;
|
|
318
288
|
&::first-letter {
|
|
319
289
|
text-transform: uppercase;
|
|
@@ -347,7 +317,7 @@ const getBadgeProps = (status) => {
|
|
|
347
317
|
const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
348
318
|
const { formatMessage } = reactIntl.useIntl();
|
|
349
319
|
if (isError) {
|
|
350
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
320
|
+
return /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.AnErrorOccurred, {});
|
|
351
321
|
}
|
|
352
322
|
if (releases?.length === 0) {
|
|
353
323
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -362,11 +332,11 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
362
332
|
target: sectionTitle
|
|
363
333
|
}
|
|
364
334
|
),
|
|
365
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
335
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.EmptyDocuments, { width: "10rem" })
|
|
366
336
|
}
|
|
367
337
|
);
|
|
368
338
|
}
|
|
369
|
-
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, {
|
|
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(
|
|
370
340
|
designSystem.Flex,
|
|
371
341
|
{
|
|
372
342
|
direction: "column",
|
|
@@ -381,7 +351,7 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
381
351
|
gap: 4,
|
|
382
352
|
children: [
|
|
383
353
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "start", gap: 1, children: [
|
|
384
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, {
|
|
354
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { as: "h3", variant: "delta", fontWeight: "bold", children: name }),
|
|
385
355
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: scheduledAt ? /* @__PURE__ */ jsxRuntime.jsx(RelativeTime, { timestamp: new Date(scheduledAt) }) : formatMessage({
|
|
386
356
|
id: "content-releases.pages.Releases.not-scheduled",
|
|
387
357
|
defaultMessage: "Not scheduled"
|
|
@@ -392,7 +362,7 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
392
362
|
}
|
|
393
363
|
) }) }, id)) });
|
|
394
364
|
};
|
|
395
|
-
const StyledAlert =
|
|
365
|
+
const StyledAlert = styled__default.default(designSystem.Alert)`
|
|
396
366
|
button {
|
|
397
367
|
display: none;
|
|
398
368
|
}
|
|
@@ -402,7 +372,7 @@ const StyledAlert = styledComponents.styled(designSystem.Alert)`
|
|
|
402
372
|
`;
|
|
403
373
|
const INITIAL_FORM_VALUES = {
|
|
404
374
|
name: "",
|
|
405
|
-
date:
|
|
375
|
+
date: null,
|
|
406
376
|
time: "",
|
|
407
377
|
isScheduled: true,
|
|
408
378
|
scheduledAt: null,
|
|
@@ -412,26 +382,23 @@ const ReleasesPage = () => {
|
|
|
412
382
|
const tabRef = React__namespace.useRef(null);
|
|
413
383
|
const location = reactRouterDom.useLocation();
|
|
414
384
|
const [releaseModalShown, setReleaseModalShown] = React__namespace.useState(false);
|
|
415
|
-
const
|
|
385
|
+
const toggleNotification = helperPlugin.useNotification();
|
|
416
386
|
const { formatMessage } = reactIntl.useIntl();
|
|
417
|
-
const
|
|
418
|
-
const { formatAPIError } =
|
|
419
|
-
const [{ query }, setQuery] =
|
|
387
|
+
const { push, replace } = reactRouterDom.useHistory();
|
|
388
|
+
const { formatAPIError } = helperPlugin.useAPIErrorHandler();
|
|
389
|
+
const [{ query }, setQuery] = helperPlugin.useQueryParams();
|
|
420
390
|
const response = index.useGetReleasesQuery(query);
|
|
421
391
|
const [createRelease, { isLoading: isSubmittingForm }] = index.useCreateReleaseMutation();
|
|
422
|
-
const { getFeature } =
|
|
392
|
+
const { getFeature } = strapiAdmin.useLicenseLimits();
|
|
423
393
|
const { maximumReleases = 3 } = getFeature("cms-content-releases");
|
|
424
|
-
const { trackUsage } =
|
|
425
|
-
const {
|
|
426
|
-
allowedActions: { canCreate }
|
|
427
|
-
} = strapiAdmin.useRBAC(index.PERMISSIONS);
|
|
394
|
+
const { trackUsage } = helperPlugin.useTracking();
|
|
428
395
|
const { isLoading, isSuccess, isError } = response;
|
|
429
396
|
const activeTab = response?.currentData?.meta?.activeTab || "pending";
|
|
430
397
|
const activeTabIndex = ["pending", "done"].indexOf(activeTab);
|
|
431
398
|
React__namespace.useEffect(() => {
|
|
432
399
|
if (location?.state?.errors) {
|
|
433
400
|
toggleNotification({
|
|
434
|
-
type: "
|
|
401
|
+
type: "warning",
|
|
435
402
|
title: formatMessage({
|
|
436
403
|
id: "content-releases.pages.Releases.notification.error.title",
|
|
437
404
|
defaultMessage: "Your request could not be processed."
|
|
@@ -441,9 +408,9 @@ const ReleasesPage = () => {
|
|
|
441
408
|
defaultMessage: "Please try again or open another release."
|
|
442
409
|
})
|
|
443
410
|
});
|
|
444
|
-
|
|
411
|
+
replace({ state: null });
|
|
445
412
|
}
|
|
446
|
-
}, [formatMessage, location?.state?.errors,
|
|
413
|
+
}, [formatMessage, location?.state?.errors, replace, toggleNotification]);
|
|
447
414
|
React__namespace.useEffect(() => {
|
|
448
415
|
if (tabRef.current) {
|
|
449
416
|
tabRef.current._handlers.setSelectedTabIndex(activeTabIndex);
|
|
@@ -453,7 +420,7 @@ const ReleasesPage = () => {
|
|
|
453
420
|
setReleaseModalShown((prev) => !prev);
|
|
454
421
|
};
|
|
455
422
|
if (isLoading) {
|
|
456
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
423
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Main, { "aria-busy": isLoading, children: /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.LoadingIndicatorPage, {}) });
|
|
457
424
|
}
|
|
458
425
|
const totalPendingReleases = isSuccess && response.currentData?.meta?.pendingReleasesCount || 0;
|
|
459
426
|
const hasReachedMaximumPendingReleases = totalPendingReleases >= maximumReleases;
|
|
@@ -484,22 +451,22 @@ const ReleasesPage = () => {
|
|
|
484
451
|
})
|
|
485
452
|
});
|
|
486
453
|
trackUsage("didCreateRelease");
|
|
487
|
-
|
|
488
|
-
} else if (
|
|
454
|
+
push(`/plugins/content-releases/${response2.data.data.id}`);
|
|
455
|
+
} else if (index.isAxiosError(response2.error)) {
|
|
489
456
|
toggleNotification({
|
|
490
|
-
type: "
|
|
457
|
+
type: "warning",
|
|
491
458
|
message: formatAPIError(response2.error)
|
|
492
459
|
});
|
|
493
460
|
} else {
|
|
494
461
|
toggleNotification({
|
|
495
|
-
type: "
|
|
462
|
+
type: "warning",
|
|
496
463
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
497
464
|
});
|
|
498
465
|
}
|
|
499
466
|
};
|
|
500
467
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { "aria-busy": isLoading, children: [
|
|
501
468
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
502
|
-
|
|
469
|
+
designSystem.HeaderLayout,
|
|
503
470
|
{
|
|
504
471
|
title: formatMessage({
|
|
505
472
|
id: "content-releases.pages.Releases.title",
|
|
@@ -509,7 +476,7 @@ const ReleasesPage = () => {
|
|
|
509
476
|
id: "content-releases.pages.Releases.header-subtitle",
|
|
510
477
|
defaultMessage: "Create and manage content updates"
|
|
511
478
|
}),
|
|
512
|
-
primaryAction:
|
|
479
|
+
primaryAction: /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.CheckPermissions, { permissions: index.PERMISSIONS.create, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
513
480
|
designSystem.Button,
|
|
514
481
|
{
|
|
515
482
|
startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Plus, {}),
|
|
@@ -520,15 +487,15 @@ const ReleasesPage = () => {
|
|
|
520
487
|
defaultMessage: "New release"
|
|
521
488
|
})
|
|
522
489
|
}
|
|
523
|
-
)
|
|
490
|
+
) })
|
|
524
491
|
}
|
|
525
492
|
),
|
|
526
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
493
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.ContentLayout, { children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
527
494
|
hasReachedMaximumPendingReleases && /* @__PURE__ */ jsxRuntime.jsx(
|
|
528
495
|
StyledAlert,
|
|
529
496
|
{
|
|
530
497
|
marginBottom: 6,
|
|
531
|
-
action: /* @__PURE__ */ jsxRuntime.jsx(
|
|
498
|
+
action: /* @__PURE__ */ jsxRuntime.jsx(v2.Link, { href: "https://strapi.io/pricing-cloud", isExternal: true, children: formatMessage({
|
|
532
499
|
id: "content-releases.pages.Releases.max-limit-reached.action",
|
|
533
500
|
defaultMessage: "Explore plans"
|
|
534
501
|
}) }),
|
|
@@ -599,17 +566,23 @@ const ReleasesPage = () => {
|
|
|
599
566
|
]
|
|
600
567
|
}
|
|
601
568
|
),
|
|
602
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
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
|
|
613
586
|
] }) }),
|
|
614
587
|
releaseModalShown && /* @__PURE__ */ jsxRuntime.jsx(
|
|
615
588
|
ReleaseModal,
|
|
@@ -622,13 +595,13 @@ const ReleasesPage = () => {
|
|
|
622
595
|
)
|
|
623
596
|
] });
|
|
624
597
|
};
|
|
625
|
-
const ReleaseInfoWrapper =
|
|
598
|
+
const ReleaseInfoWrapper = styled__default.default(designSystem.Flex)`
|
|
626
599
|
align-self: stretch;
|
|
627
600
|
border-bottom-right-radius: ${({ theme }) => theme.borderRadius};
|
|
628
601
|
border-bottom-left-radius: ${({ theme }) => theme.borderRadius};
|
|
629
602
|
border-top: 1px solid ${({ theme }) => theme.colors.neutral150};
|
|
630
603
|
`;
|
|
631
|
-
const StyledMenuItem =
|
|
604
|
+
const StyledMenuItem = styled__default.default(v2.Menu.Item)`
|
|
632
605
|
svg path {
|
|
633
606
|
fill: ${({ theme, disabled }) => disabled && theme.colors.neutral500};
|
|
634
607
|
}
|
|
@@ -637,54 +610,49 @@ const StyledMenuItem = styledComponents.styled(designSystem.Menu.Item)`
|
|
|
637
610
|
}
|
|
638
611
|
|
|
639
612
|
&:hover {
|
|
640
|
-
background: ${({ theme,
|
|
613
|
+
background: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}100`]};
|
|
641
614
|
}
|
|
642
615
|
`;
|
|
643
|
-
const PencilIcon =
|
|
616
|
+
const PencilIcon = styled__default.default(icons.Pencil)`
|
|
644
617
|
width: ${({ theme }) => theme.spaces[3]};
|
|
645
618
|
height: ${({ theme }) => theme.spaces[3]};
|
|
646
619
|
path {
|
|
647
620
|
fill: ${({ theme }) => theme.colors.neutral600};
|
|
648
621
|
}
|
|
649
622
|
`;
|
|
650
|
-
const TrashIcon =
|
|
623
|
+
const TrashIcon = styled__default.default(icons.Trash)`
|
|
651
624
|
width: ${({ theme }) => theme.spaces[3]};
|
|
652
625
|
height: ${({ theme }) => theme.spaces[3]};
|
|
653
626
|
path {
|
|
654
627
|
fill: ${({ theme }) => theme.colors.danger600};
|
|
655
628
|
}
|
|
656
629
|
`;
|
|
657
|
-
const TypographyMaxWidth =
|
|
630
|
+
const TypographyMaxWidth = styled__default.default(designSystem.Typography)`
|
|
658
631
|
max-width: 300px;
|
|
659
632
|
`;
|
|
660
|
-
const EntryValidationText = ({ action, schema, entry }) => {
|
|
633
|
+
const EntryValidationText = ({ action, schema, components, entry }) => {
|
|
661
634
|
const { formatMessage } = reactIntl.useIntl();
|
|
662
|
-
const { validate } = strapiAdmin
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
skip: !schema
|
|
669
|
-
}
|
|
670
|
-
);
|
|
671
|
-
const errors = validate(entry) ?? {};
|
|
635
|
+
const { validate } = strapiAdmin.unstable_useDocument();
|
|
636
|
+
const { errors } = validate(entry, {
|
|
637
|
+
contentType: schema,
|
|
638
|
+
components,
|
|
639
|
+
isCreatingEntry: false
|
|
640
|
+
});
|
|
672
641
|
if (Object.keys(errors).length > 0) {
|
|
673
642
|
const validationErrorsMessages = Object.entries(errors).map(
|
|
674
643
|
([key, value]) => formatMessage(
|
|
675
|
-
// @ts-expect-error – TODO: fix this will better checks
|
|
676
644
|
{ id: `${value.id}.withField`, defaultMessage: value.defaultMessage },
|
|
677
645
|
{ field: key }
|
|
678
646
|
)
|
|
679
647
|
).join(" ");
|
|
680
648
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
681
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
649
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Icon, { color: "danger600", as: icons.CrossCircle }),
|
|
682
650
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tooltip, { description: validationErrorsMessages, children: /* @__PURE__ */ jsxRuntime.jsx(TypographyMaxWidth, { textColor: "danger600", variant: "omega", fontWeight: "semiBold", ellipsis: true, children: validationErrorsMessages }) })
|
|
683
651
|
] });
|
|
684
652
|
}
|
|
685
653
|
if (action == "publish") {
|
|
686
654
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
687
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
655
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Icon, { color: "success600", as: icons.CheckCircle }),
|
|
688
656
|
entry.publishedAt ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "success600", fontWeight: "bold", children: formatMessage({
|
|
689
657
|
id: "content-releases.pages.ReleaseDetails.entry-validation.already-published",
|
|
690
658
|
defaultMessage: "Already published"
|
|
@@ -695,7 +663,7 @@ const EntryValidationText = ({ action, schema, entry }) => {
|
|
|
695
663
|
] });
|
|
696
664
|
}
|
|
697
665
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
698
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
666
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Icon, { color: "success600", as: icons.CheckCircle }),
|
|
699
667
|
!entry.publishedAt ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "success600", fontWeight: "bold", children: formatMessage({
|
|
700
668
|
id: "content-releases.pages.ReleaseDetails.entry-validation.already-unpublished",
|
|
701
669
|
defaultMessage: "Already unpublished"
|
|
@@ -715,23 +683,20 @@ const ReleaseDetailsLayout = ({
|
|
|
715
683
|
const {
|
|
716
684
|
data,
|
|
717
685
|
isLoading: isLoadingDetails,
|
|
686
|
+
isError,
|
|
718
687
|
error
|
|
719
|
-
} = index.useGetReleaseQuery(
|
|
720
|
-
{ id: releaseId },
|
|
721
|
-
{
|
|
722
|
-
skip: !releaseId
|
|
723
|
-
}
|
|
724
|
-
);
|
|
688
|
+
} = index.useGetReleaseQuery({ id: releaseId });
|
|
725
689
|
const [publishRelease, { isLoading: isPublishing }] = index.usePublishReleaseMutation();
|
|
726
|
-
const
|
|
727
|
-
const { formatAPIError } =
|
|
728
|
-
const {
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
const
|
|
690
|
+
const toggleNotification = helperPlugin.useNotification();
|
|
691
|
+
const { formatAPIError } = helperPlugin.useAPIErrorHandler();
|
|
692
|
+
const {
|
|
693
|
+
allowedActions: { canUpdate, canDelete }
|
|
694
|
+
} = helperPlugin.useRBAC(index.PERMISSIONS);
|
|
695
|
+
const dispatch = index.useTypedDispatch();
|
|
696
|
+
const { trackUsage } = helperPlugin.useTracking();
|
|
732
697
|
const release = data?.data;
|
|
733
|
-
const handlePublishRelease =
|
|
734
|
-
const response = await publishRelease({ id });
|
|
698
|
+
const handlePublishRelease = async () => {
|
|
699
|
+
const response = await publishRelease({ id: releaseId });
|
|
735
700
|
if ("data" in response) {
|
|
736
701
|
toggleNotification({
|
|
737
702
|
type: "success",
|
|
@@ -746,14 +711,14 @@ const ReleaseDetailsLayout = ({
|
|
|
746
711
|
totalPublishedEntries,
|
|
747
712
|
totalUnpublishedEntries
|
|
748
713
|
});
|
|
749
|
-
} else if (
|
|
714
|
+
} else if (index.isAxiosError(response.error)) {
|
|
750
715
|
toggleNotification({
|
|
751
|
-
type: "
|
|
716
|
+
type: "warning",
|
|
752
717
|
message: formatAPIError(response.error)
|
|
753
718
|
});
|
|
754
719
|
} else {
|
|
755
720
|
toggleNotification({
|
|
756
|
-
type: "
|
|
721
|
+
type: "warning",
|
|
757
722
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
758
723
|
});
|
|
759
724
|
}
|
|
@@ -779,20 +744,21 @@ const ReleaseDetailsLayout = ({
|
|
|
779
744
|
return release.createdBy.email;
|
|
780
745
|
};
|
|
781
746
|
if (isLoadingDetails) {
|
|
782
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
747
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Main, { "aria-busy": isLoadingDetails, children: /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.LoadingIndicatorPage, {}) });
|
|
783
748
|
}
|
|
784
|
-
if (
|
|
749
|
+
if (isError || !release) {
|
|
785
750
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
786
|
-
reactRouterDom.
|
|
751
|
+
reactRouterDom.Redirect,
|
|
787
752
|
{
|
|
788
|
-
to:
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
753
|
+
to: {
|
|
754
|
+
pathname: "/plugins/content-releases",
|
|
755
|
+
state: {
|
|
756
|
+
errors: [
|
|
757
|
+
{
|
|
758
|
+
code: error?.code
|
|
759
|
+
}
|
|
760
|
+
]
|
|
761
|
+
}
|
|
796
762
|
}
|
|
797
763
|
}
|
|
798
764
|
);
|
|
@@ -829,30 +795,34 @@ const ReleaseDetailsLayout = ({
|
|
|
829
795
|
) : "";
|
|
830
796
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { "aria-busy": isLoadingDetails, children: [
|
|
831
797
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
832
|
-
|
|
798
|
+
designSystem.HeaderLayout,
|
|
833
799
|
{
|
|
834
800
|
title: release.name,
|
|
835
801
|
subtitle: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, lineHeight: 6, children: [
|
|
836
802
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", variant: "epsilon", children: numberOfEntriesText + (isScheduled ? ` - ${scheduledText}` : "") }),
|
|
837
803
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { ...getBadgeProps(release.status), children: release.status })
|
|
838
804
|
] }),
|
|
839
|
-
navigationAction: /* @__PURE__ */ jsxRuntime.jsx(
|
|
805
|
+
navigationAction: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Link, { startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowLeft, {}), to: "/plugins/content-releases", children: formatMessage({
|
|
806
|
+
id: "global.back",
|
|
807
|
+
defaultMessage: "Back"
|
|
808
|
+
}) }),
|
|
840
809
|
primaryAction: !release.releasedAt && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
841
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
810
|
+
/* @__PURE__ */ jsxRuntime.jsxs(v2.Menu.Root, { children: [
|
|
842
811
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
843
|
-
|
|
812
|
+
v2.Menu.Trigger,
|
|
844
813
|
{
|
|
814
|
+
as: designSystem.IconButton,
|
|
845
815
|
paddingLeft: 2,
|
|
846
816
|
paddingRight: 2,
|
|
847
817
|
"aria-label": formatMessage({
|
|
848
818
|
id: "content-releases.header.actions.open-release-actions",
|
|
849
819
|
defaultMessage: "Release edit and delete menu"
|
|
850
820
|
}),
|
|
851
|
-
|
|
852
|
-
|
|
821
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.More, {}),
|
|
822
|
+
variant: "tertiary"
|
|
853
823
|
}
|
|
854
824
|
),
|
|
855
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
825
|
+
/* @__PURE__ */ jsxRuntime.jsxs(v2.Menu.Content, { top: 1, popoverPlacement: "bottom-end", children: [
|
|
856
826
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
857
827
|
designSystem.Flex,
|
|
858
828
|
{
|
|
@@ -874,7 +844,7 @@ const ReleaseDetailsLayout = ({
|
|
|
874
844
|
{
|
|
875
845
|
disabled: !canDelete,
|
|
876
846
|
onSelect: toggleWarningSubmit,
|
|
877
|
-
|
|
847
|
+
variant: "danger",
|
|
878
848
|
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 2, hasRadius: true, width: "100%", children: [
|
|
879
849
|
/* @__PURE__ */ jsxRuntime.jsx(TrashIcon, {}),
|
|
880
850
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { ellipsis: true, textColor: "danger600", children: formatMessage({
|
|
@@ -901,7 +871,7 @@ const ReleaseDetailsLayout = ({
|
|
|
901
871
|
defaultMessage: "Created"
|
|
902
872
|
}) }),
|
|
903
873
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", color: "neutral300", children: [
|
|
904
|
-
/* @__PURE__ */ jsxRuntime.jsx(RelativeTime
|
|
874
|
+
/* @__PURE__ */ jsxRuntime.jsx(helperPlugin.RelativeTime, { timestamp: new Date(release.createdAt) }),
|
|
905
875
|
formatMessage(
|
|
906
876
|
{
|
|
907
877
|
id: "content-releases.header.actions.created.description",
|
|
@@ -919,12 +889,12 @@ const ReleaseDetailsLayout = ({
|
|
|
919
889
|
id: "content-releases.header.actions.refresh",
|
|
920
890
|
defaultMessage: "Refresh"
|
|
921
891
|
}) }),
|
|
922
|
-
|
|
892
|
+
/* @__PURE__ */ jsxRuntime.jsx(helperPlugin.CheckPermissions, { permissions: index.PERMISSIONS.publish, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
923
893
|
designSystem.Button,
|
|
924
894
|
{
|
|
925
895
|
size: "S",
|
|
926
896
|
variant: "default",
|
|
927
|
-
onClick: handlePublishRelease
|
|
897
|
+
onClick: handlePublishRelease,
|
|
928
898
|
loading: isPublishing,
|
|
929
899
|
disabled: release.actions.meta.count === 0,
|
|
930
900
|
children: formatMessage({
|
|
@@ -932,7 +902,7 @@ const ReleaseDetailsLayout = ({
|
|
|
932
902
|
defaultMessage: "Publish"
|
|
933
903
|
})
|
|
934
904
|
}
|
|
935
|
-
)
|
|
905
|
+
) })
|
|
936
906
|
] })
|
|
937
907
|
}
|
|
938
908
|
),
|
|
@@ -959,30 +929,44 @@ const getGroupByOptionLabel = (value) => {
|
|
|
959
929
|
defaultMessage: "Content-Types"
|
|
960
930
|
};
|
|
961
931
|
};
|
|
962
|
-
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 = () => {
|
|
963
948
|
const { formatMessage } = reactIntl.useIntl();
|
|
964
|
-
const
|
|
965
|
-
const {
|
|
966
|
-
const
|
|
949
|
+
const { releaseId } = reactRouterDom.useParams();
|
|
950
|
+
const [{ query }, setQuery] = helperPlugin.useQueryParams();
|
|
951
|
+
const toggleNotification = helperPlugin.useNotification();
|
|
952
|
+
const { formatAPIError } = helperPlugin.useAPIErrorHandler();
|
|
967
953
|
const {
|
|
968
954
|
data: releaseData,
|
|
969
955
|
isLoading: isReleaseLoading,
|
|
956
|
+
isError: isReleaseError,
|
|
970
957
|
error: releaseError
|
|
971
958
|
} = index.useGetReleaseQuery({ id: releaseId });
|
|
972
959
|
const {
|
|
973
960
|
allowedActions: { canUpdate }
|
|
974
|
-
} =
|
|
975
|
-
const runHookWaterfall =
|
|
976
|
-
const {
|
|
961
|
+
} = helperPlugin.useRBAC(index.PERMISSIONS);
|
|
962
|
+
const { runHookWaterfall } = helperPlugin.useStrapiApp();
|
|
963
|
+
const {
|
|
964
|
+
displayedHeaders,
|
|
965
|
+
hasI18nEnabled
|
|
966
|
+
} = runHookWaterfall(
|
|
977
967
|
"ContentReleases/pages/ReleaseDetails/add-locale-in-releases",
|
|
978
968
|
{
|
|
979
|
-
displayedHeaders:
|
|
980
|
-
label: formatMessage({
|
|
981
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.locale",
|
|
982
|
-
defaultMessage: "locale"
|
|
983
|
-
}),
|
|
984
|
-
name: "locale"
|
|
985
|
-
},
|
|
969
|
+
displayedHeaders: DEFAULT_RELEASE_DETAILS_HEADER,
|
|
986
970
|
hasI18nEnabled: false
|
|
987
971
|
}
|
|
988
972
|
);
|
|
@@ -1014,59 +998,65 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1014
998
|
// We are passing the action path to found the position in the cache of the action for optimistic updates
|
|
1015
999
|
});
|
|
1016
1000
|
if ("error" in response) {
|
|
1017
|
-
if (
|
|
1001
|
+
if (index.isAxiosError(response.error)) {
|
|
1018
1002
|
toggleNotification({
|
|
1019
|
-
type: "
|
|
1003
|
+
type: "warning",
|
|
1020
1004
|
message: formatAPIError(response.error)
|
|
1021
1005
|
});
|
|
1022
1006
|
} else {
|
|
1023
1007
|
toggleNotification({
|
|
1024
|
-
type: "
|
|
1008
|
+
type: "warning",
|
|
1025
1009
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
1026
1010
|
});
|
|
1027
1011
|
}
|
|
1028
1012
|
}
|
|
1029
1013
|
};
|
|
1030
1014
|
if (isLoading || isReleaseLoading) {
|
|
1031
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1015
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.ContentLayout, { children: /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.LoadingIndicatorPage, {}) });
|
|
1032
1016
|
}
|
|
1033
1017
|
const releaseActions = data?.data;
|
|
1034
1018
|
const releaseMeta = data?.meta;
|
|
1035
1019
|
const contentTypes = releaseMeta?.contentTypes || {};
|
|
1036
1020
|
const components = releaseMeta?.components || {};
|
|
1037
|
-
if (
|
|
1021
|
+
if (isReleaseError || !release) {
|
|
1038
1022
|
const errorsArray = [];
|
|
1039
|
-
if (releaseError
|
|
1023
|
+
if (releaseError) {
|
|
1040
1024
|
errorsArray.push({
|
|
1041
1025
|
code: releaseError.code
|
|
1042
1026
|
});
|
|
1043
1027
|
}
|
|
1044
|
-
if (releaseActionsError
|
|
1028
|
+
if (releaseActionsError) {
|
|
1045
1029
|
errorsArray.push({
|
|
1046
1030
|
code: releaseActionsError.code
|
|
1047
1031
|
});
|
|
1048
1032
|
}
|
|
1049
1033
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1050
|
-
reactRouterDom.
|
|
1034
|
+
reactRouterDom.Redirect,
|
|
1051
1035
|
{
|
|
1052
|
-
to:
|
|
1053
|
-
|
|
1054
|
-
|
|
1036
|
+
to: {
|
|
1037
|
+
pathname: "/plugins/content-releases",
|
|
1038
|
+
state: {
|
|
1039
|
+
errors: errorsArray
|
|
1040
|
+
}
|
|
1055
1041
|
}
|
|
1056
1042
|
}
|
|
1057
1043
|
);
|
|
1058
1044
|
}
|
|
1059
1045
|
if (isError || !releaseActions) {
|
|
1060
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1046
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.ContentLayout, { children: /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.AnErrorOccurred, {}) });
|
|
1061
1047
|
}
|
|
1062
1048
|
if (Object.keys(releaseActions).length === 0) {
|
|
1063
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1064
|
-
|
|
1049
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.ContentLayout, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1050
|
+
helperPlugin.NoContent,
|
|
1065
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
|
+
},
|
|
1066
1056
|
action: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1067
|
-
|
|
1057
|
+
v2.LinkButton,
|
|
1068
1058
|
{
|
|
1069
|
-
|
|
1059
|
+
as: reactRouterDom.Link,
|
|
1070
1060
|
to: {
|
|
1071
1061
|
pathname: "/content-manager"
|
|
1072
1062
|
},
|
|
@@ -1077,59 +1067,19 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1077
1067
|
defaultMessage: "Open the Content Manager"
|
|
1078
1068
|
})
|
|
1079
1069
|
}
|
|
1080
|
-
)
|
|
1081
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(symbols.EmptyDocuments, { width: "16rem" }),
|
|
1082
|
-
content: formatMessage({
|
|
1083
|
-
id: "content-releases.pages.Details.tab.emptyEntries",
|
|
1084
|
-
defaultMessage: "This release is empty. Open the Content Manager, select an entry and add it to the release."
|
|
1085
|
-
})
|
|
1070
|
+
)
|
|
1086
1071
|
}
|
|
1087
1072
|
) });
|
|
1088
1073
|
}
|
|
1089
|
-
const groupByLabel = formatMessage({
|
|
1090
|
-
id: "content-releases.pages.ReleaseDetails.groupBy.aria-label",
|
|
1091
|
-
defaultMessage: "Group by"
|
|
1092
|
-
});
|
|
1093
|
-
const headers = [
|
|
1094
|
-
// ...displayedHeaders,
|
|
1095
|
-
{
|
|
1096
|
-
label: formatMessage({
|
|
1097
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.name",
|
|
1098
|
-
defaultMessage: "name"
|
|
1099
|
-
}),
|
|
1100
|
-
name: "name"
|
|
1101
|
-
},
|
|
1102
|
-
{
|
|
1103
|
-
label: formatMessage({
|
|
1104
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.content-type",
|
|
1105
|
-
defaultMessage: "content-type"
|
|
1106
|
-
}),
|
|
1107
|
-
name: "content-type"
|
|
1108
|
-
},
|
|
1109
|
-
{
|
|
1110
|
-
label: formatMessage({
|
|
1111
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.action",
|
|
1112
|
-
defaultMessage: "action"
|
|
1113
|
-
}),
|
|
1114
|
-
name: "action"
|
|
1115
|
-
},
|
|
1116
|
-
...!release.releasedAt ? [
|
|
1117
|
-
{
|
|
1118
|
-
label: formatMessage({
|
|
1119
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.status",
|
|
1120
|
-
defaultMessage: "status"
|
|
1121
|
-
}),
|
|
1122
|
-
name: "status"
|
|
1123
|
-
}
|
|
1124
|
-
] : []
|
|
1125
|
-
];
|
|
1126
1074
|
const options = hasI18nEnabled ? GROUP_BY_OPTIONS : GROUP_BY_OPTIONS_NO_LOCALE;
|
|
1127
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1075
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.ContentLayout, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 8, direction: "column", alignItems: "stretch", children: [
|
|
1128
1076
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1129
1077
|
designSystem.SingleSelect,
|
|
1130
1078
|
{
|
|
1131
|
-
|
|
1132
|
-
|
|
1079
|
+
"aria-label": formatMessage({
|
|
1080
|
+
id: "content-releases.pages.ReleaseDetails.groupBy.aria-label",
|
|
1081
|
+
defaultMessage: "Group by"
|
|
1082
|
+
}),
|
|
1133
1083
|
customizeContent: (value) => formatMessage(
|
|
1134
1084
|
{
|
|
1135
1085
|
id: `content-releases.pages.ReleaseDetails.groupBy.label`,
|
|
@@ -1147,18 +1097,62 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1147
1097
|
Object.keys(releaseActions).map((key) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, direction: "column", alignItems: "stretch", children: [
|
|
1148
1098
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { role: "separator", "aria-label": key, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { children: key }) }),
|
|
1149
1099
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1150
|
-
|
|
1100
|
+
helperPlugin.Table.Root,
|
|
1151
1101
|
{
|
|
1152
1102
|
rows: releaseActions[key].map((item) => ({
|
|
1153
1103
|
...item,
|
|
1154
1104
|
id: Number(item.entry.id)
|
|
1155
1105
|
})),
|
|
1156
|
-
|
|
1157
|
-
isLoading
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1161
|
-
|
|
1106
|
+
colCount: releaseActions[key].length,
|
|
1107
|
+
isLoading,
|
|
1108
|
+
isFetching,
|
|
1109
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(helperPlugin.Table.Content, { children: [
|
|
1110
|
+
/* @__PURE__ */ jsxRuntime.jsxs(helperPlugin.Table.Head, { children: [
|
|
1111
|
+
displayedHeaders.map(({ key: key2, fieldSchema, metadatas, name }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1112
|
+
helperPlugin.Table.HeaderCell,
|
|
1113
|
+
{
|
|
1114
|
+
fieldSchemaType: fieldSchema.type,
|
|
1115
|
+
label: formatMessage(metadatas.label),
|
|
1116
|
+
name
|
|
1117
|
+
},
|
|
1118
|
+
key2
|
|
1119
|
+
)),
|
|
1120
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1121
|
+
helperPlugin.Table.HeaderCell,
|
|
1122
|
+
{
|
|
1123
|
+
fieldSchemaType: "string",
|
|
1124
|
+
label: formatMessage({
|
|
1125
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.content-type",
|
|
1126
|
+
defaultMessage: "content-type"
|
|
1127
|
+
}),
|
|
1128
|
+
name: "content-type"
|
|
1129
|
+
}
|
|
1130
|
+
),
|
|
1131
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1132
|
+
helperPlugin.Table.HeaderCell,
|
|
1133
|
+
{
|
|
1134
|
+
fieldSchemaType: "string",
|
|
1135
|
+
label: formatMessage({
|
|
1136
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.action",
|
|
1137
|
+
defaultMessage: "action"
|
|
1138
|
+
}),
|
|
1139
|
+
name: "action"
|
|
1140
|
+
}
|
|
1141
|
+
),
|
|
1142
|
+
!release.releasedAt && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1143
|
+
helperPlugin.Table.HeaderCell,
|
|
1144
|
+
{
|
|
1145
|
+
fieldSchemaType: "string",
|
|
1146
|
+
label: formatMessage({
|
|
1147
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.status",
|
|
1148
|
+
defaultMessage: "status"
|
|
1149
|
+
}),
|
|
1150
|
+
name: "status"
|
|
1151
|
+
}
|
|
1152
|
+
)
|
|
1153
|
+
] }),
|
|
1154
|
+
/* @__PURE__ */ jsxRuntime.jsx(helperPlugin.Table.LoadingBody, {}),
|
|
1155
|
+
/* @__PURE__ */ jsxRuntime.jsx(helperPlugin.Table.Body, { children: releaseActions[key].map(
|
|
1162
1156
|
({ id, contentType, locale, type, entry }, actionIndex) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
1163
1157
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "25%", maxWidth: "200px", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { ellipsis: true, children: `${contentType.mainFieldValue || entry.id}` }) }),
|
|
1164
1158
|
hasI18nEnabled && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "10%", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: `${locale?.name ? locale.name : "-"}` }) }),
|
|
@@ -1215,39 +1209,34 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1215
1209
|
}
|
|
1216
1210
|
)
|
|
1217
1211
|
] }, `releases-group-${key}`)),
|
|
1218
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
)
|
|
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
|
+
] })
|
|
1229
1223
|
] }) });
|
|
1230
1224
|
};
|
|
1231
1225
|
const ReleaseDetailsPage = () => {
|
|
1232
1226
|
const { formatMessage } = reactIntl.useIntl();
|
|
1233
1227
|
const { releaseId } = reactRouterDom.useParams();
|
|
1234
|
-
const
|
|
1235
|
-
const { formatAPIError } =
|
|
1236
|
-
const
|
|
1228
|
+
const toggleNotification = helperPlugin.useNotification();
|
|
1229
|
+
const { formatAPIError } = helperPlugin.useAPIErrorHandler();
|
|
1230
|
+
const { replace } = reactRouterDom.useHistory();
|
|
1237
1231
|
const [releaseModalShown, setReleaseModalShown] = React__namespace.useState(false);
|
|
1238
1232
|
const [showWarningSubmit, setWarningSubmit] = React__namespace.useState(false);
|
|
1239
1233
|
const {
|
|
1240
1234
|
isLoading: isLoadingDetails,
|
|
1241
1235
|
data,
|
|
1242
1236
|
isSuccess: isSuccessDetails
|
|
1243
|
-
} = index.useGetReleaseQuery(
|
|
1244
|
-
{ id: releaseId },
|
|
1245
|
-
{
|
|
1246
|
-
skip: !releaseId
|
|
1247
|
-
}
|
|
1248
|
-
);
|
|
1237
|
+
} = index.useGetReleaseQuery({ id: releaseId });
|
|
1249
1238
|
const [updateRelease, { isLoading: isSubmittingForm }] = index.useUpdateReleaseMutation();
|
|
1250
|
-
const [deleteRelease] = index.useDeleteReleaseMutation();
|
|
1239
|
+
const [deleteRelease, { isLoading: isDeletingRelease }] = index.useDeleteReleaseMutation();
|
|
1251
1240
|
const toggleEditReleaseModal = () => {
|
|
1252
1241
|
setReleaseModalShown((prev) => !prev);
|
|
1253
1242
|
};
|
|
@@ -1258,18 +1247,15 @@ const ReleaseDetailsPage = () => {
|
|
|
1258
1247
|
{
|
|
1259
1248
|
toggleEditReleaseModal,
|
|
1260
1249
|
toggleWarningSubmit,
|
|
1261
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1250
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.ContentLayout, { children: /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.LoadingIndicatorPage, {}) })
|
|
1262
1251
|
}
|
|
1263
1252
|
);
|
|
1264
1253
|
}
|
|
1265
|
-
if (!releaseId) {
|
|
1266
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: ".." });
|
|
1267
|
-
}
|
|
1268
1254
|
const releaseData = isSuccessDetails && data?.data || null;
|
|
1269
1255
|
const title = releaseData?.name || "";
|
|
1270
1256
|
const timezone = releaseData?.timezone ?? null;
|
|
1271
1257
|
const scheduledAt = releaseData?.scheduledAt && timezone ? dateFnsTz.utcToZonedTime(releaseData.scheduledAt, timezone) : null;
|
|
1272
|
-
const date = scheduledAt ? format__default.default(scheduledAt, "yyyy-MM-dd") :
|
|
1258
|
+
const date = scheduledAt ? format__default.default(scheduledAt, "yyyy-MM-dd") : null;
|
|
1273
1259
|
const time = scheduledAt ? format__default.default(scheduledAt, "HH:mm") : "";
|
|
1274
1260
|
const handleEditRelease = async (values) => {
|
|
1275
1261
|
const response = await updateRelease({
|
|
@@ -1287,14 +1273,14 @@ const ReleaseDetailsPage = () => {
|
|
|
1287
1273
|
})
|
|
1288
1274
|
});
|
|
1289
1275
|
toggleEditReleaseModal();
|
|
1290
|
-
} else if (
|
|
1276
|
+
} else if (index.isAxiosError(response.error)) {
|
|
1291
1277
|
toggleNotification({
|
|
1292
|
-
type: "
|
|
1278
|
+
type: "warning",
|
|
1293
1279
|
message: formatAPIError(response.error)
|
|
1294
1280
|
});
|
|
1295
1281
|
} else {
|
|
1296
1282
|
toggleNotification({
|
|
1297
|
-
type: "
|
|
1283
|
+
type: "warning",
|
|
1298
1284
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
1299
1285
|
});
|
|
1300
1286
|
}
|
|
@@ -1304,15 +1290,15 @@ const ReleaseDetailsPage = () => {
|
|
|
1304
1290
|
id: releaseId
|
|
1305
1291
|
});
|
|
1306
1292
|
if ("data" in response) {
|
|
1307
|
-
|
|
1308
|
-
} else if (
|
|
1293
|
+
replace("/plugins/content-releases");
|
|
1294
|
+
} else if (index.isAxiosError(response.error)) {
|
|
1309
1295
|
toggleNotification({
|
|
1310
|
-
type: "
|
|
1296
|
+
type: "warning",
|
|
1311
1297
|
message: formatAPIError(response.error)
|
|
1312
1298
|
});
|
|
1313
1299
|
} else {
|
|
1314
1300
|
toggleNotification({
|
|
1315
|
-
type: "
|
|
1301
|
+
type: "warning",
|
|
1316
1302
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
1317
1303
|
});
|
|
1318
1304
|
}
|
|
@@ -1323,7 +1309,7 @@ const ReleaseDetailsPage = () => {
|
|
|
1323
1309
|
toggleEditReleaseModal,
|
|
1324
1310
|
toggleWarningSubmit,
|
|
1325
1311
|
children: [
|
|
1326
|
-
/* @__PURE__ */ jsxRuntime.jsx(ReleaseDetailsBody, {
|
|
1312
|
+
/* @__PURE__ */ jsxRuntime.jsx(ReleaseDetailsBody, {}),
|
|
1327
1313
|
releaseModalShown && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1328
1314
|
ReleaseModal,
|
|
1329
1315
|
{
|
|
@@ -1341,15 +1327,16 @@ const ReleaseDetailsPage = () => {
|
|
|
1341
1327
|
}
|
|
1342
1328
|
),
|
|
1343
1329
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1344
|
-
|
|
1330
|
+
helperPlugin.ConfirmDialog,
|
|
1345
1331
|
{
|
|
1346
|
-
|
|
1347
|
-
onClose: toggleWarningSubmit,
|
|
1348
|
-
onConfirm: handleDeleteRelease,
|
|
1349
|
-
children: formatMessage({
|
|
1332
|
+
bodyText: {
|
|
1350
1333
|
id: "content-releases.dialog.confirmation-message",
|
|
1351
1334
|
defaultMessage: "Are you sure you want to delete this release?"
|
|
1352
|
-
}
|
|
1335
|
+
},
|
|
1336
|
+
isOpen: showWarningSubmit,
|
|
1337
|
+
isConfirmButtonLoading: isDeletingRelease,
|
|
1338
|
+
onToggleDialog: toggleWarningSubmit,
|
|
1339
|
+
onConfirm: handleDeleteRelease
|
|
1353
1340
|
}
|
|
1354
1341
|
)
|
|
1355
1342
|
]
|
|
@@ -1357,10 +1344,10 @@ const ReleaseDetailsPage = () => {
|
|
|
1357
1344
|
);
|
|
1358
1345
|
};
|
|
1359
1346
|
const App = () => {
|
|
1360
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1361
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, {
|
|
1362
|
-
/* @__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 })
|
|
1363
1350
|
] }) });
|
|
1364
1351
|
};
|
|
1365
1352
|
exports.App = App;
|
|
1366
|
-
//# sourceMappingURL=App-
|
|
1353
|
+
//# sourceMappingURL=App-HjWtUYmc.js.map
|