@strapi/content-releases 0.0.0-experimental.d954d57341a6623992a0d211daaec8e245c3517d → 0.0.0-experimental.d9f9f725e07a329ca272ecedef7bd85fa74dd661
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +17 -1
- package/dist/_chunks/{App-CqbuK4M6.js → App-dLXY5ei3.js} +439 -431
- package/dist/_chunks/App-dLXY5ei3.js.map +1 -0
- package/dist/_chunks/{App-Do-Rnv0A.mjs → App-jrh58sXY.mjs} +416 -409
- package/dist/_chunks/App-jrh58sXY.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-Tedsw4GC.js → index-CVO0Rqdm.js} +504 -197
- package/dist/_chunks/index-CVO0Rqdm.js.map +1 -0
- package/dist/_chunks/{index-D_pgdqQL.mjs → index-PiOGBETy.mjs} +503 -198
- package/dist/_chunks/index-PiOGBETy.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-CqbuK4M6.js.map +0 -1
- package/dist/_chunks/App-Do-Rnv0A.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-D_pgdqQL.mjs.map +0 -1
- package/dist/_chunks/index-Tedsw4GC.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 -17
- 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-CVO0Rqdm.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(),
|
|
@@ -92,7 +65,6 @@ const RELEASE_SCHEMA = yup__namespace.object().shape({
|
|
|
92
65
|
}).required().noUnknown();
|
|
93
66
|
const ReleaseModal = ({
|
|
94
67
|
handleClose,
|
|
95
|
-
open,
|
|
96
68
|
handleSubmit,
|
|
97
69
|
initialValues,
|
|
98
70
|
isLoading = false
|
|
@@ -116,8 +88,8 @@ const ReleaseModal = ({
|
|
|
116
88
|
);
|
|
117
89
|
return currentTimezone?.value || systemTimezone.value;
|
|
118
90
|
};
|
|
119
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
120
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
91
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.ModalLayout, { onClose: handleClose, labelledBy: "title", children: [
|
|
92
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.ModalHeader, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { id: "title", fontWeight: "bold", textColor: "neutral800", children: formatMessage(
|
|
121
93
|
{
|
|
122
94
|
id: "content-releases.modal.title",
|
|
123
95
|
defaultMessage: "{isCreatingRelease, select, true {New release} other {Edit release}}"
|
|
@@ -140,119 +112,123 @@ const ReleaseModal = ({
|
|
|
140
112
|
},
|
|
141
113
|
validationSchema: RELEASE_SCHEMA,
|
|
142
114
|
validateOnChange: false,
|
|
143
|
-
children: ({ values, errors, handleChange, setFieldValue }) => {
|
|
144
|
-
|
|
145
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
146
|
-
|
|
147
|
-
|
|
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({
|
|
148
121
|
id: "content-releases.modal.form.input.label.release-name",
|
|
149
122
|
defaultMessage: "Name"
|
|
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
|
-
|
|
190
|
-
|
|
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({
|
|
191
167
|
id: "content-releases.modal.form.input.label.date",
|
|
192
168
|
defaultMessage: "Date"
|
|
193
|
-
})
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
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({
|
|
216
192
|
id: "content-releases.modal.form.input.label.time",
|
|
217
193
|
defaultMessage: "Time"
|
|
218
|
-
})
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
243
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { name: "submit", loading: isLoading, type: "submit", children: formatMessage(
|
|
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
|
+
}
|
|
210
|
+
) })
|
|
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(
|
|
244
220
|
{
|
|
245
221
|
id: "content-releases.modal.form.button.submit",
|
|
246
222
|
defaultMessage: "{isCreatingRelease, select, true {Continue} other {Save}}"
|
|
247
223
|
},
|
|
248
224
|
{ isCreatingRelease }
|
|
249
225
|
) })
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
}
|
|
226
|
+
}
|
|
227
|
+
)
|
|
228
|
+
] })
|
|
253
229
|
}
|
|
254
230
|
)
|
|
255
|
-
] })
|
|
231
|
+
] });
|
|
256
232
|
};
|
|
257
233
|
const getTimezones = (selectedDate) => {
|
|
258
234
|
const timezoneList = Intl.supportedValuesOf("timeZone").map((timezone) => {
|
|
@@ -278,40 +254,36 @@ const TimezoneComponent = ({ timezoneOptions }) => {
|
|
|
278
254
|
}
|
|
279
255
|
}
|
|
280
256
|
}, [setFieldValue, values.date, values.timezone]);
|
|
281
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
{
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
};
|
|
307
|
-
const useTypedDispatch = reactRedux.useDispatch;
|
|
308
|
-
const isBaseQueryError = (error) => {
|
|
309
|
-
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
|
+
);
|
|
310
282
|
};
|
|
311
|
-
const LinkCard =
|
|
283
|
+
const LinkCard = styled__default.default(v2.Link)`
|
|
312
284
|
display: block;
|
|
313
285
|
`;
|
|
314
|
-
const RelativeTime =
|
|
286
|
+
const RelativeTime = styled__default.default(helperPlugin.RelativeTime)`
|
|
315
287
|
display: inline-block;
|
|
316
288
|
&::first-letter {
|
|
317
289
|
text-transform: uppercase;
|
|
@@ -345,7 +317,7 @@ const getBadgeProps = (status) => {
|
|
|
345
317
|
const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
346
318
|
const { formatMessage } = reactIntl.useIntl();
|
|
347
319
|
if (isError) {
|
|
348
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
320
|
+
return /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.AnErrorOccurred, {});
|
|
349
321
|
}
|
|
350
322
|
if (releases?.length === 0) {
|
|
351
323
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -360,11 +332,11 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
360
332
|
target: sectionTitle
|
|
361
333
|
}
|
|
362
334
|
),
|
|
363
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
335
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.EmptyDocuments, { width: "10rem" })
|
|
364
336
|
}
|
|
365
337
|
);
|
|
366
338
|
}
|
|
367
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid
|
|
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(
|
|
368
340
|
designSystem.Flex,
|
|
369
341
|
{
|
|
370
342
|
direction: "column",
|
|
@@ -379,7 +351,7 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
379
351
|
gap: 4,
|
|
380
352
|
children: [
|
|
381
353
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "start", gap: 1, children: [
|
|
382
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, {
|
|
354
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { as: "h3", variant: "delta", fontWeight: "bold", children: name }),
|
|
383
355
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: scheduledAt ? /* @__PURE__ */ jsxRuntime.jsx(RelativeTime, { timestamp: new Date(scheduledAt) }) : formatMessage({
|
|
384
356
|
id: "content-releases.pages.Releases.not-scheduled",
|
|
385
357
|
defaultMessage: "Not scheduled"
|
|
@@ -390,7 +362,7 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
390
362
|
}
|
|
391
363
|
) }) }, id)) });
|
|
392
364
|
};
|
|
393
|
-
const StyledAlert =
|
|
365
|
+
const StyledAlert = styled__default.default(designSystem.Alert)`
|
|
394
366
|
button {
|
|
395
367
|
display: none;
|
|
396
368
|
}
|
|
@@ -400,34 +372,33 @@ const StyledAlert = styledComponents.styled(designSystem.Alert)`
|
|
|
400
372
|
`;
|
|
401
373
|
const INITIAL_FORM_VALUES = {
|
|
402
374
|
name: "",
|
|
403
|
-
date:
|
|
375
|
+
date: null,
|
|
404
376
|
time: "",
|
|
405
377
|
isScheduled: true,
|
|
406
378
|
scheduledAt: null,
|
|
407
379
|
timezone: null
|
|
408
380
|
};
|
|
409
381
|
const ReleasesPage = () => {
|
|
382
|
+
const tabRef = React__namespace.useRef(null);
|
|
410
383
|
const location = reactRouterDom.useLocation();
|
|
411
384
|
const [releaseModalShown, setReleaseModalShown] = React__namespace.useState(false);
|
|
412
|
-
const
|
|
385
|
+
const toggleNotification = helperPlugin.useNotification();
|
|
413
386
|
const { formatMessage } = reactIntl.useIntl();
|
|
414
|
-
const
|
|
415
|
-
const { formatAPIError } =
|
|
416
|
-
const [{ query }, setQuery] =
|
|
387
|
+
const { push, replace } = reactRouterDom.useHistory();
|
|
388
|
+
const { formatAPIError } = helperPlugin.useAPIErrorHandler();
|
|
389
|
+
const [{ query }, setQuery] = helperPlugin.useQueryParams();
|
|
417
390
|
const response = index.useGetReleasesQuery(query);
|
|
418
391
|
const [createRelease, { isLoading: isSubmittingForm }] = index.useCreateReleaseMutation();
|
|
419
|
-
const { getFeature } =
|
|
392
|
+
const { getFeature } = strapiAdmin.useLicenseLimits();
|
|
420
393
|
const { maximumReleases = 3 } = getFeature("cms-content-releases");
|
|
421
|
-
const { trackUsage } =
|
|
422
|
-
const {
|
|
423
|
-
allowedActions: { canCreate }
|
|
424
|
-
} = strapiAdmin.useRBAC(index.PERMISSIONS);
|
|
394
|
+
const { trackUsage } = helperPlugin.useTracking();
|
|
425
395
|
const { isLoading, isSuccess, isError } = response;
|
|
426
396
|
const activeTab = response?.currentData?.meta?.activeTab || "pending";
|
|
397
|
+
const activeTabIndex = ["pending", "done"].indexOf(activeTab);
|
|
427
398
|
React__namespace.useEffect(() => {
|
|
428
399
|
if (location?.state?.errors) {
|
|
429
400
|
toggleNotification({
|
|
430
|
-
type: "
|
|
401
|
+
type: "warning",
|
|
431
402
|
title: formatMessage({
|
|
432
403
|
id: "content-releases.pages.Releases.notification.error.title",
|
|
433
404
|
defaultMessage: "Your request could not be processed."
|
|
@@ -437,25 +408,30 @@ const ReleasesPage = () => {
|
|
|
437
408
|
defaultMessage: "Please try again or open another release."
|
|
438
409
|
})
|
|
439
410
|
});
|
|
440
|
-
|
|
411
|
+
replace({ state: null });
|
|
412
|
+
}
|
|
413
|
+
}, [formatMessage, location?.state?.errors, replace, toggleNotification]);
|
|
414
|
+
React__namespace.useEffect(() => {
|
|
415
|
+
if (tabRef.current) {
|
|
416
|
+
tabRef.current._handlers.setSelectedTabIndex(activeTabIndex);
|
|
441
417
|
}
|
|
442
|
-
}, [
|
|
418
|
+
}, [activeTabIndex]);
|
|
443
419
|
const toggleAddReleaseModal = () => {
|
|
444
420
|
setReleaseModalShown((prev) => !prev);
|
|
445
421
|
};
|
|
446
422
|
if (isLoading) {
|
|
447
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
423
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Main, { "aria-busy": isLoading, children: /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.LoadingIndicatorPage, {}) });
|
|
448
424
|
}
|
|
449
425
|
const totalPendingReleases = isSuccess && response.currentData?.meta?.pendingReleasesCount || 0;
|
|
450
426
|
const hasReachedMaximumPendingReleases = totalPendingReleases >= maximumReleases;
|
|
451
|
-
const handleTabChange = (
|
|
427
|
+
const handleTabChange = (index2) => {
|
|
452
428
|
setQuery({
|
|
453
429
|
...query,
|
|
454
430
|
page: 1,
|
|
455
431
|
pageSize: response?.currentData?.meta?.pagination?.pageSize || 16,
|
|
456
432
|
filters: {
|
|
457
433
|
releasedAt: {
|
|
458
|
-
$notNull:
|
|
434
|
+
$notNull: index2 === 0 ? false : true
|
|
459
435
|
}
|
|
460
436
|
}
|
|
461
437
|
});
|
|
@@ -475,22 +451,22 @@ const ReleasesPage = () => {
|
|
|
475
451
|
})
|
|
476
452
|
});
|
|
477
453
|
trackUsage("didCreateRelease");
|
|
478
|
-
|
|
479
|
-
} else if (
|
|
454
|
+
push(`/plugins/content-releases/${response2.data.data.id}`);
|
|
455
|
+
} else if (index.isAxiosError(response2.error)) {
|
|
480
456
|
toggleNotification({
|
|
481
|
-
type: "
|
|
457
|
+
type: "warning",
|
|
482
458
|
message: formatAPIError(response2.error)
|
|
483
459
|
});
|
|
484
460
|
} else {
|
|
485
461
|
toggleNotification({
|
|
486
|
-
type: "
|
|
462
|
+
type: "warning",
|
|
487
463
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
488
464
|
});
|
|
489
465
|
}
|
|
490
466
|
};
|
|
491
467
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { "aria-busy": isLoading, children: [
|
|
492
468
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
493
|
-
|
|
469
|
+
designSystem.HeaderLayout,
|
|
494
470
|
{
|
|
495
471
|
title: formatMessage({
|
|
496
472
|
id: "content-releases.pages.Releases.title",
|
|
@@ -500,7 +476,7 @@ const ReleasesPage = () => {
|
|
|
500
476
|
id: "content-releases.pages.Releases.header-subtitle",
|
|
501
477
|
defaultMessage: "Create and manage content updates"
|
|
502
478
|
}),
|
|
503
|
-
primaryAction:
|
|
479
|
+
primaryAction: /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.CheckPermissions, { permissions: index.PERMISSIONS.create, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
504
480
|
designSystem.Button,
|
|
505
481
|
{
|
|
506
482
|
startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Plus, {}),
|
|
@@ -511,15 +487,15 @@ const ReleasesPage = () => {
|
|
|
511
487
|
defaultMessage: "New release"
|
|
512
488
|
})
|
|
513
489
|
}
|
|
514
|
-
)
|
|
490
|
+
) })
|
|
515
491
|
}
|
|
516
492
|
),
|
|
517
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
493
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.ContentLayout, { children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
518
494
|
hasReachedMaximumPendingReleases && /* @__PURE__ */ jsxRuntime.jsx(
|
|
519
495
|
StyledAlert,
|
|
520
496
|
{
|
|
521
497
|
marginBottom: 6,
|
|
522
|
-
action: /* @__PURE__ */ jsxRuntime.jsx(
|
|
498
|
+
action: /* @__PURE__ */ jsxRuntime.jsx(v2.Link, { href: "https://strapi.io/pricing-cloud", isExternal: true, children: formatMessage({
|
|
523
499
|
id: "content-releases.pages.Releases.max-limit-reached.action",
|
|
524
500
|
defaultMessage: "Explore plans"
|
|
525
501
|
}) }),
|
|
@@ -539,17 +515,21 @@ const ReleasesPage = () => {
|
|
|
539
515
|
})
|
|
540
516
|
}
|
|
541
517
|
),
|
|
542
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
518
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
519
|
+
designSystem.TabGroup,
|
|
520
|
+
{
|
|
521
|
+
label: formatMessage({
|
|
522
|
+
id: "content-releases.pages.Releases.tab-group.label",
|
|
523
|
+
defaultMessage: "Releases list"
|
|
524
|
+
}),
|
|
525
|
+
variant: "simple",
|
|
526
|
+
initialSelectedTabIndex: activeTabIndex,
|
|
527
|
+
onTabChange: handleTabChange,
|
|
528
|
+
ref: tabRef,
|
|
529
|
+
children: [
|
|
530
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { paddingBottom: 8, children: [
|
|
531
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tabs, { children: [
|
|
532
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tab, { children: formatMessage(
|
|
553
533
|
{
|
|
554
534
|
id: "content-releases.pages.Releases.tab.pending",
|
|
555
535
|
defaultMessage: "Pending ({count})"
|
|
@@ -558,48 +538,55 @@ const ReleasesPage = () => {
|
|
|
558
538
|
count: totalPendingReleases
|
|
559
539
|
}
|
|
560
540
|
) }),
|
|
561
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
541
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tab, { children: formatMessage({
|
|
562
542
|
id: "content-releases.pages.Releases.tab.done",
|
|
563
543
|
defaultMessage: "Done"
|
|
564
544
|
}) })
|
|
565
|
-
]
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
545
|
+
] }),
|
|
546
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Divider, {})
|
|
547
|
+
] }),
|
|
548
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.TabPanels, { children: [
|
|
549
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.TabPanel, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
550
|
+
ReleasesGrid,
|
|
551
|
+
{
|
|
552
|
+
sectionTitle: "pending",
|
|
553
|
+
releases: response?.currentData?.data,
|
|
554
|
+
isError
|
|
555
|
+
}
|
|
556
|
+
) }),
|
|
557
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.TabPanel, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
558
|
+
ReleasesGrid,
|
|
559
|
+
{
|
|
560
|
+
sectionTitle: "done",
|
|
561
|
+
releases: response?.currentData?.data,
|
|
562
|
+
isError
|
|
563
|
+
}
|
|
564
|
+
) })
|
|
565
|
+
] })
|
|
566
|
+
]
|
|
567
|
+
}
|
|
568
|
+
),
|
|
569
|
+
response.currentData?.meta?.pagination?.total ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { paddingTop: 4, alignItems: "flex-end", justifyContent: "space-between", children: [
|
|
570
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
571
|
+
helperPlugin.PageSizeURLQuery,
|
|
572
572
|
{
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
isError
|
|
573
|
+
options: ["8", "16", "32", "64"],
|
|
574
|
+
defaultValue: response?.currentData?.meta?.pagination?.pageSize.toString()
|
|
576
575
|
}
|
|
577
|
-
)
|
|
578
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
579
|
-
|
|
576
|
+
),
|
|
577
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
578
|
+
helperPlugin.PaginationURLQuery,
|
|
580
579
|
{
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
580
|
+
pagination: {
|
|
581
|
+
pageCount: response?.currentData?.meta?.pagination?.pageCount || 0
|
|
582
|
+
}
|
|
584
583
|
}
|
|
585
|
-
)
|
|
586
|
-
] })
|
|
587
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
588
|
-
strapiAdmin.Pagination.Root,
|
|
589
|
-
{
|
|
590
|
-
...response?.currentData?.meta?.pagination,
|
|
591
|
-
defaultPageSize: response?.currentData?.meta?.pagination?.pageSize,
|
|
592
|
-
children: [
|
|
593
|
-
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.PageSize, { options: ["8", "16", "32", "64"] }),
|
|
594
|
-
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.Links, {})
|
|
595
|
-
]
|
|
596
|
-
}
|
|
597
|
-
)
|
|
584
|
+
)
|
|
585
|
+
] }) : null
|
|
598
586
|
] }) }),
|
|
599
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
587
|
+
releaseModalShown && /* @__PURE__ */ jsxRuntime.jsx(
|
|
600
588
|
ReleaseModal,
|
|
601
589
|
{
|
|
602
|
-
open: releaseModalShown,
|
|
603
590
|
handleClose: toggleAddReleaseModal,
|
|
604
591
|
handleSubmit: handleAddRelease,
|
|
605
592
|
isLoading: isSubmittingForm,
|
|
@@ -608,13 +595,13 @@ const ReleasesPage = () => {
|
|
|
608
595
|
)
|
|
609
596
|
] });
|
|
610
597
|
};
|
|
611
|
-
const ReleaseInfoWrapper =
|
|
598
|
+
const ReleaseInfoWrapper = styled__default.default(designSystem.Flex)`
|
|
612
599
|
align-self: stretch;
|
|
613
600
|
border-bottom-right-radius: ${({ theme }) => theme.borderRadius};
|
|
614
601
|
border-bottom-left-radius: ${({ theme }) => theme.borderRadius};
|
|
615
602
|
border-top: 1px solid ${({ theme }) => theme.colors.neutral150};
|
|
616
603
|
`;
|
|
617
|
-
const StyledMenuItem =
|
|
604
|
+
const StyledMenuItem = styled__default.default(v2.Menu.Item)`
|
|
618
605
|
svg path {
|
|
619
606
|
fill: ${({ theme, disabled }) => disabled && theme.colors.neutral500};
|
|
620
607
|
}
|
|
@@ -623,54 +610,49 @@ const StyledMenuItem = styledComponents.styled(designSystem.Menu.Item)`
|
|
|
623
610
|
}
|
|
624
611
|
|
|
625
612
|
&:hover {
|
|
626
|
-
background: ${({ theme,
|
|
613
|
+
background: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}100`]};
|
|
627
614
|
}
|
|
628
615
|
`;
|
|
629
|
-
const PencilIcon =
|
|
616
|
+
const PencilIcon = styled__default.default(icons.Pencil)`
|
|
630
617
|
width: ${({ theme }) => theme.spaces[3]};
|
|
631
618
|
height: ${({ theme }) => theme.spaces[3]};
|
|
632
619
|
path {
|
|
633
620
|
fill: ${({ theme }) => theme.colors.neutral600};
|
|
634
621
|
}
|
|
635
622
|
`;
|
|
636
|
-
const TrashIcon =
|
|
623
|
+
const TrashIcon = styled__default.default(icons.Trash)`
|
|
637
624
|
width: ${({ theme }) => theme.spaces[3]};
|
|
638
625
|
height: ${({ theme }) => theme.spaces[3]};
|
|
639
626
|
path {
|
|
640
627
|
fill: ${({ theme }) => theme.colors.danger600};
|
|
641
628
|
}
|
|
642
629
|
`;
|
|
643
|
-
const TypographyMaxWidth =
|
|
630
|
+
const TypographyMaxWidth = styled__default.default(designSystem.Typography)`
|
|
644
631
|
max-width: 300px;
|
|
645
632
|
`;
|
|
646
|
-
const EntryValidationText = ({ action, schema, entry }) => {
|
|
633
|
+
const EntryValidationText = ({ action, schema, components, entry }) => {
|
|
647
634
|
const { formatMessage } = reactIntl.useIntl();
|
|
648
|
-
const { validate } = strapiAdmin
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
skip: !schema
|
|
655
|
-
}
|
|
656
|
-
);
|
|
657
|
-
const errors = validate(entry) ?? {};
|
|
635
|
+
const { validate } = strapiAdmin.unstable_useDocument();
|
|
636
|
+
const { errors } = validate(entry, {
|
|
637
|
+
contentType: schema,
|
|
638
|
+
components,
|
|
639
|
+
isCreatingEntry: false
|
|
640
|
+
});
|
|
658
641
|
if (Object.keys(errors).length > 0) {
|
|
659
642
|
const validationErrorsMessages = Object.entries(errors).map(
|
|
660
643
|
([key, value]) => formatMessage(
|
|
661
|
-
// @ts-expect-error – TODO: fix this will better checks
|
|
662
644
|
{ id: `${value.id}.withField`, defaultMessage: value.defaultMessage },
|
|
663
645
|
{ field: key }
|
|
664
646
|
)
|
|
665
647
|
).join(" ");
|
|
666
648
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
667
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
649
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Icon, { color: "danger600", as: icons.CrossCircle }),
|
|
668
650
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tooltip, { description: validationErrorsMessages, children: /* @__PURE__ */ jsxRuntime.jsx(TypographyMaxWidth, { textColor: "danger600", variant: "omega", fontWeight: "semiBold", ellipsis: true, children: validationErrorsMessages }) })
|
|
669
651
|
] });
|
|
670
652
|
}
|
|
671
653
|
if (action == "publish") {
|
|
672
654
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
673
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
655
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Icon, { color: "success600", as: icons.CheckCircle }),
|
|
674
656
|
entry.publishedAt ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "success600", fontWeight: "bold", children: formatMessage({
|
|
675
657
|
id: "content-releases.pages.ReleaseDetails.entry-validation.already-published",
|
|
676
658
|
defaultMessage: "Already published"
|
|
@@ -681,7 +663,7 @@ const EntryValidationText = ({ action, schema, entry }) => {
|
|
|
681
663
|
] });
|
|
682
664
|
}
|
|
683
665
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
684
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
666
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Icon, { color: "success600", as: icons.CheckCircle }),
|
|
685
667
|
!entry.publishedAt ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "success600", fontWeight: "bold", children: formatMessage({
|
|
686
668
|
id: "content-releases.pages.ReleaseDetails.entry-validation.already-unpublished",
|
|
687
669
|
defaultMessage: "Already unpublished"
|
|
@@ -701,23 +683,20 @@ const ReleaseDetailsLayout = ({
|
|
|
701
683
|
const {
|
|
702
684
|
data,
|
|
703
685
|
isLoading: isLoadingDetails,
|
|
686
|
+
isError,
|
|
704
687
|
error
|
|
705
|
-
} = index.useGetReleaseQuery(
|
|
706
|
-
{ id: releaseId },
|
|
707
|
-
{
|
|
708
|
-
skip: !releaseId
|
|
709
|
-
}
|
|
710
|
-
);
|
|
688
|
+
} = index.useGetReleaseQuery({ id: releaseId });
|
|
711
689
|
const [publishRelease, { isLoading: isPublishing }] = index.usePublishReleaseMutation();
|
|
712
|
-
const
|
|
713
|
-
const { formatAPIError } =
|
|
714
|
-
const {
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
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();
|
|
718
697
|
const release = data?.data;
|
|
719
|
-
const handlePublishRelease =
|
|
720
|
-
const response = await publishRelease({ id });
|
|
698
|
+
const handlePublishRelease = async () => {
|
|
699
|
+
const response = await publishRelease({ id: releaseId });
|
|
721
700
|
if ("data" in response) {
|
|
722
701
|
toggleNotification({
|
|
723
702
|
type: "success",
|
|
@@ -732,14 +711,14 @@ const ReleaseDetailsLayout = ({
|
|
|
732
711
|
totalPublishedEntries,
|
|
733
712
|
totalUnpublishedEntries
|
|
734
713
|
});
|
|
735
|
-
} else if (
|
|
714
|
+
} else if (index.isAxiosError(response.error)) {
|
|
736
715
|
toggleNotification({
|
|
737
|
-
type: "
|
|
716
|
+
type: "warning",
|
|
738
717
|
message: formatAPIError(response.error)
|
|
739
718
|
});
|
|
740
719
|
} else {
|
|
741
720
|
toggleNotification({
|
|
742
|
-
type: "
|
|
721
|
+
type: "warning",
|
|
743
722
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
744
723
|
});
|
|
745
724
|
}
|
|
@@ -765,20 +744,21 @@ const ReleaseDetailsLayout = ({
|
|
|
765
744
|
return release.createdBy.email;
|
|
766
745
|
};
|
|
767
746
|
if (isLoadingDetails) {
|
|
768
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
747
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Main, { "aria-busy": isLoadingDetails, children: /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.LoadingIndicatorPage, {}) });
|
|
769
748
|
}
|
|
770
|
-
if (
|
|
749
|
+
if (isError || !release) {
|
|
771
750
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
772
|
-
reactRouterDom.
|
|
751
|
+
reactRouterDom.Redirect,
|
|
773
752
|
{
|
|
774
|
-
to:
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
753
|
+
to: {
|
|
754
|
+
pathname: "/plugins/content-releases",
|
|
755
|
+
state: {
|
|
756
|
+
errors: [
|
|
757
|
+
{
|
|
758
|
+
code: error?.code
|
|
759
|
+
}
|
|
760
|
+
]
|
|
761
|
+
}
|
|
782
762
|
}
|
|
783
763
|
}
|
|
784
764
|
);
|
|
@@ -815,30 +795,34 @@ const ReleaseDetailsLayout = ({
|
|
|
815
795
|
) : "";
|
|
816
796
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { "aria-busy": isLoadingDetails, children: [
|
|
817
797
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
818
|
-
|
|
798
|
+
designSystem.HeaderLayout,
|
|
819
799
|
{
|
|
820
800
|
title: release.name,
|
|
821
801
|
subtitle: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, lineHeight: 6, children: [
|
|
822
802
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", variant: "epsilon", children: numberOfEntriesText + (isScheduled ? ` - ${scheduledText}` : "") }),
|
|
823
803
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { ...getBadgeProps(release.status), children: release.status })
|
|
824
804
|
] }),
|
|
825
|
-
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
|
+
}) }),
|
|
826
809
|
primaryAction: !release.releasedAt && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
827
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
810
|
+
/* @__PURE__ */ jsxRuntime.jsxs(v2.Menu.Root, { children: [
|
|
828
811
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
829
|
-
|
|
812
|
+
v2.Menu.Trigger,
|
|
830
813
|
{
|
|
814
|
+
as: designSystem.IconButton,
|
|
831
815
|
paddingLeft: 2,
|
|
832
816
|
paddingRight: 2,
|
|
833
817
|
"aria-label": formatMessage({
|
|
834
818
|
id: "content-releases.header.actions.open-release-actions",
|
|
835
819
|
defaultMessage: "Release edit and delete menu"
|
|
836
820
|
}),
|
|
837
|
-
|
|
838
|
-
|
|
821
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.More, {}),
|
|
822
|
+
variant: "tertiary"
|
|
839
823
|
}
|
|
840
824
|
),
|
|
841
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
825
|
+
/* @__PURE__ */ jsxRuntime.jsxs(v2.Menu.Content, { top: 1, popoverPlacement: "bottom-end", children: [
|
|
842
826
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
843
827
|
designSystem.Flex,
|
|
844
828
|
{
|
|
@@ -860,7 +844,7 @@ const ReleaseDetailsLayout = ({
|
|
|
860
844
|
{
|
|
861
845
|
disabled: !canDelete,
|
|
862
846
|
onSelect: toggleWarningSubmit,
|
|
863
|
-
|
|
847
|
+
variant: "danger",
|
|
864
848
|
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 2, hasRadius: true, width: "100%", children: [
|
|
865
849
|
/* @__PURE__ */ jsxRuntime.jsx(TrashIcon, {}),
|
|
866
850
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { ellipsis: true, textColor: "danger600", children: formatMessage({
|
|
@@ -887,7 +871,7 @@ const ReleaseDetailsLayout = ({
|
|
|
887
871
|
defaultMessage: "Created"
|
|
888
872
|
}) }),
|
|
889
873
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", color: "neutral300", children: [
|
|
890
|
-
/* @__PURE__ */ jsxRuntime.jsx(RelativeTime
|
|
874
|
+
/* @__PURE__ */ jsxRuntime.jsx(helperPlugin.RelativeTime, { timestamp: new Date(release.createdAt) }),
|
|
891
875
|
formatMessage(
|
|
892
876
|
{
|
|
893
877
|
id: "content-releases.header.actions.created.description",
|
|
@@ -905,12 +889,12 @@ const ReleaseDetailsLayout = ({
|
|
|
905
889
|
id: "content-releases.header.actions.refresh",
|
|
906
890
|
defaultMessage: "Refresh"
|
|
907
891
|
}) }),
|
|
908
|
-
|
|
892
|
+
/* @__PURE__ */ jsxRuntime.jsx(helperPlugin.CheckPermissions, { permissions: index.PERMISSIONS.publish, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
909
893
|
designSystem.Button,
|
|
910
894
|
{
|
|
911
895
|
size: "S",
|
|
912
896
|
variant: "default",
|
|
913
|
-
onClick: handlePublishRelease
|
|
897
|
+
onClick: handlePublishRelease,
|
|
914
898
|
loading: isPublishing,
|
|
915
899
|
disabled: release.actions.meta.count === 0,
|
|
916
900
|
children: formatMessage({
|
|
@@ -918,7 +902,7 @@ const ReleaseDetailsLayout = ({
|
|
|
918
902
|
defaultMessage: "Publish"
|
|
919
903
|
})
|
|
920
904
|
}
|
|
921
|
-
)
|
|
905
|
+
) })
|
|
922
906
|
] })
|
|
923
907
|
}
|
|
924
908
|
),
|
|
@@ -945,30 +929,44 @@ const getGroupByOptionLabel = (value) => {
|
|
|
945
929
|
defaultMessage: "Content-Types"
|
|
946
930
|
};
|
|
947
931
|
};
|
|
948
|
-
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 = () => {
|
|
949
948
|
const { formatMessage } = reactIntl.useIntl();
|
|
950
|
-
const
|
|
951
|
-
const {
|
|
952
|
-
const
|
|
949
|
+
const { releaseId } = reactRouterDom.useParams();
|
|
950
|
+
const [{ query }, setQuery] = helperPlugin.useQueryParams();
|
|
951
|
+
const toggleNotification = helperPlugin.useNotification();
|
|
952
|
+
const { formatAPIError } = helperPlugin.useAPIErrorHandler();
|
|
953
953
|
const {
|
|
954
954
|
data: releaseData,
|
|
955
955
|
isLoading: isReleaseLoading,
|
|
956
|
+
isError: isReleaseError,
|
|
956
957
|
error: releaseError
|
|
957
958
|
} = index.useGetReleaseQuery({ id: releaseId });
|
|
958
959
|
const {
|
|
959
960
|
allowedActions: { canUpdate }
|
|
960
|
-
} =
|
|
961
|
-
const runHookWaterfall =
|
|
962
|
-
const {
|
|
961
|
+
} = helperPlugin.useRBAC(index.PERMISSIONS);
|
|
962
|
+
const { runHookWaterfall } = helperPlugin.useStrapiApp();
|
|
963
|
+
const {
|
|
964
|
+
displayedHeaders,
|
|
965
|
+
hasI18nEnabled
|
|
966
|
+
} = runHookWaterfall(
|
|
963
967
|
"ContentReleases/pages/ReleaseDetails/add-locale-in-releases",
|
|
964
968
|
{
|
|
965
|
-
displayedHeaders:
|
|
966
|
-
label: formatMessage({
|
|
967
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.locale",
|
|
968
|
-
defaultMessage: "locale"
|
|
969
|
-
}),
|
|
970
|
-
name: "locale"
|
|
971
|
-
},
|
|
969
|
+
displayedHeaders: DEFAULT_RELEASE_DETAILS_HEADER,
|
|
972
970
|
hasI18nEnabled: false
|
|
973
971
|
}
|
|
974
972
|
);
|
|
@@ -1000,59 +998,65 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1000
998
|
// We are passing the action path to found the position in the cache of the action for optimistic updates
|
|
1001
999
|
});
|
|
1002
1000
|
if ("error" in response) {
|
|
1003
|
-
if (
|
|
1001
|
+
if (index.isAxiosError(response.error)) {
|
|
1004
1002
|
toggleNotification({
|
|
1005
|
-
type: "
|
|
1003
|
+
type: "warning",
|
|
1006
1004
|
message: formatAPIError(response.error)
|
|
1007
1005
|
});
|
|
1008
1006
|
} else {
|
|
1009
1007
|
toggleNotification({
|
|
1010
|
-
type: "
|
|
1008
|
+
type: "warning",
|
|
1011
1009
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
1012
1010
|
});
|
|
1013
1011
|
}
|
|
1014
1012
|
}
|
|
1015
1013
|
};
|
|
1016
1014
|
if (isLoading || isReleaseLoading) {
|
|
1017
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1015
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.ContentLayout, { children: /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.LoadingIndicatorPage, {}) });
|
|
1018
1016
|
}
|
|
1019
1017
|
const releaseActions = data?.data;
|
|
1020
1018
|
const releaseMeta = data?.meta;
|
|
1021
1019
|
const contentTypes = releaseMeta?.contentTypes || {};
|
|
1022
1020
|
const components = releaseMeta?.components || {};
|
|
1023
|
-
if (
|
|
1021
|
+
if (isReleaseError || !release) {
|
|
1024
1022
|
const errorsArray = [];
|
|
1025
|
-
if (releaseError
|
|
1023
|
+
if (releaseError) {
|
|
1026
1024
|
errorsArray.push({
|
|
1027
1025
|
code: releaseError.code
|
|
1028
1026
|
});
|
|
1029
1027
|
}
|
|
1030
|
-
if (releaseActionsError
|
|
1028
|
+
if (releaseActionsError) {
|
|
1031
1029
|
errorsArray.push({
|
|
1032
1030
|
code: releaseActionsError.code
|
|
1033
1031
|
});
|
|
1034
1032
|
}
|
|
1035
1033
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1036
|
-
reactRouterDom.
|
|
1034
|
+
reactRouterDom.Redirect,
|
|
1037
1035
|
{
|
|
1038
|
-
to:
|
|
1039
|
-
|
|
1040
|
-
|
|
1036
|
+
to: {
|
|
1037
|
+
pathname: "/plugins/content-releases",
|
|
1038
|
+
state: {
|
|
1039
|
+
errors: errorsArray
|
|
1040
|
+
}
|
|
1041
1041
|
}
|
|
1042
1042
|
}
|
|
1043
1043
|
);
|
|
1044
1044
|
}
|
|
1045
1045
|
if (isError || !releaseActions) {
|
|
1046
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1046
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.ContentLayout, { children: /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.AnErrorOccurred, {}) });
|
|
1047
1047
|
}
|
|
1048
1048
|
if (Object.keys(releaseActions).length === 0) {
|
|
1049
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1050
|
-
|
|
1049
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.ContentLayout, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1050
|
+
helperPlugin.NoContent,
|
|
1051
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
|
+
},
|
|
1052
1056
|
action: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1053
|
-
|
|
1057
|
+
v2.LinkButton,
|
|
1054
1058
|
{
|
|
1055
|
-
|
|
1059
|
+
as: reactRouterDom.Link,
|
|
1056
1060
|
to: {
|
|
1057
1061
|
pathname: "/content-manager"
|
|
1058
1062
|
},
|
|
@@ -1063,59 +1067,19 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1063
1067
|
defaultMessage: "Open the Content Manager"
|
|
1064
1068
|
})
|
|
1065
1069
|
}
|
|
1066
|
-
)
|
|
1067
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(symbols.EmptyDocuments, { width: "16rem" }),
|
|
1068
|
-
content: formatMessage({
|
|
1069
|
-
id: "content-releases.pages.Details.tab.emptyEntries",
|
|
1070
|
-
defaultMessage: "This release is empty. Open the Content Manager, select an entry and add it to the release."
|
|
1071
|
-
})
|
|
1070
|
+
)
|
|
1072
1071
|
}
|
|
1073
1072
|
) });
|
|
1074
1073
|
}
|
|
1075
|
-
const groupByLabel = formatMessage({
|
|
1076
|
-
id: "content-releases.pages.ReleaseDetails.groupBy.aria-label",
|
|
1077
|
-
defaultMessage: "Group by"
|
|
1078
|
-
});
|
|
1079
|
-
const headers = [
|
|
1080
|
-
// ...displayedHeaders,
|
|
1081
|
-
{
|
|
1082
|
-
label: formatMessage({
|
|
1083
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.name",
|
|
1084
|
-
defaultMessage: "name"
|
|
1085
|
-
}),
|
|
1086
|
-
name: "name"
|
|
1087
|
-
},
|
|
1088
|
-
{
|
|
1089
|
-
label: formatMessage({
|
|
1090
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.content-type",
|
|
1091
|
-
defaultMessage: "content-type"
|
|
1092
|
-
}),
|
|
1093
|
-
name: "content-type"
|
|
1094
|
-
},
|
|
1095
|
-
{
|
|
1096
|
-
label: formatMessage({
|
|
1097
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.action",
|
|
1098
|
-
defaultMessage: "action"
|
|
1099
|
-
}),
|
|
1100
|
-
name: "action"
|
|
1101
|
-
},
|
|
1102
|
-
...!release.releasedAt ? [
|
|
1103
|
-
{
|
|
1104
|
-
label: formatMessage({
|
|
1105
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.status",
|
|
1106
|
-
defaultMessage: "status"
|
|
1107
|
-
}),
|
|
1108
|
-
name: "status"
|
|
1109
|
-
}
|
|
1110
|
-
] : []
|
|
1111
|
-
];
|
|
1112
1074
|
const options = hasI18nEnabled ? GROUP_BY_OPTIONS : GROUP_BY_OPTIONS_NO_LOCALE;
|
|
1113
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1075
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.ContentLayout, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 8, direction: "column", alignItems: "stretch", children: [
|
|
1114
1076
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1115
1077
|
designSystem.SingleSelect,
|
|
1116
1078
|
{
|
|
1117
|
-
|
|
1118
|
-
|
|
1079
|
+
"aria-label": formatMessage({
|
|
1080
|
+
id: "content-releases.pages.ReleaseDetails.groupBy.aria-label",
|
|
1081
|
+
defaultMessage: "Group by"
|
|
1082
|
+
}),
|
|
1119
1083
|
customizeContent: (value) => formatMessage(
|
|
1120
1084
|
{
|
|
1121
1085
|
id: `content-releases.pages.ReleaseDetails.groupBy.label`,
|
|
@@ -1133,18 +1097,62 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1133
1097
|
Object.keys(releaseActions).map((key) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, direction: "column", alignItems: "stretch", children: [
|
|
1134
1098
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { role: "separator", "aria-label": key, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { children: key }) }),
|
|
1135
1099
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1136
|
-
|
|
1100
|
+
helperPlugin.Table.Root,
|
|
1137
1101
|
{
|
|
1138
1102
|
rows: releaseActions[key].map((item) => ({
|
|
1139
1103
|
...item,
|
|
1140
1104
|
id: Number(item.entry.id)
|
|
1141
1105
|
})),
|
|
1142
|
-
|
|
1143
|
-
isLoading
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1147
|
-
|
|
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(
|
|
1148
1156
|
({ id, contentType, locale, type, entry }, actionIndex) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
1149
1157
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "25%", maxWidth: "200px", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { ellipsis: true, children: `${contentType.mainFieldValue || entry.id}` }) }),
|
|
1150
1158
|
hasI18nEnabled && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "10%", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: `${locale?.name ? locale.name : "-"}` }) }),
|
|
@@ -1201,39 +1209,34 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1201
1209
|
}
|
|
1202
1210
|
)
|
|
1203
1211
|
] }, `releases-group-${key}`)),
|
|
1204
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
)
|
|
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
|
+
] })
|
|
1215
1223
|
] }) });
|
|
1216
1224
|
};
|
|
1217
1225
|
const ReleaseDetailsPage = () => {
|
|
1218
1226
|
const { formatMessage } = reactIntl.useIntl();
|
|
1219
1227
|
const { releaseId } = reactRouterDom.useParams();
|
|
1220
|
-
const
|
|
1221
|
-
const { formatAPIError } =
|
|
1222
|
-
const
|
|
1228
|
+
const toggleNotification = helperPlugin.useNotification();
|
|
1229
|
+
const { formatAPIError } = helperPlugin.useAPIErrorHandler();
|
|
1230
|
+
const { replace } = reactRouterDom.useHistory();
|
|
1223
1231
|
const [releaseModalShown, setReleaseModalShown] = React__namespace.useState(false);
|
|
1224
1232
|
const [showWarningSubmit, setWarningSubmit] = React__namespace.useState(false);
|
|
1225
1233
|
const {
|
|
1226
1234
|
isLoading: isLoadingDetails,
|
|
1227
1235
|
data,
|
|
1228
1236
|
isSuccess: isSuccessDetails
|
|
1229
|
-
} = index.useGetReleaseQuery(
|
|
1230
|
-
{ id: releaseId },
|
|
1231
|
-
{
|
|
1232
|
-
skip: !releaseId
|
|
1233
|
-
}
|
|
1234
|
-
);
|
|
1237
|
+
} = index.useGetReleaseQuery({ id: releaseId });
|
|
1235
1238
|
const [updateRelease, { isLoading: isSubmittingForm }] = index.useUpdateReleaseMutation();
|
|
1236
|
-
const [deleteRelease] = index.useDeleteReleaseMutation();
|
|
1239
|
+
const [deleteRelease, { isLoading: isDeletingRelease }] = index.useDeleteReleaseMutation();
|
|
1237
1240
|
const toggleEditReleaseModal = () => {
|
|
1238
1241
|
setReleaseModalShown((prev) => !prev);
|
|
1239
1242
|
};
|
|
@@ -1244,18 +1247,15 @@ const ReleaseDetailsPage = () => {
|
|
|
1244
1247
|
{
|
|
1245
1248
|
toggleEditReleaseModal,
|
|
1246
1249
|
toggleWarningSubmit,
|
|
1247
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1250
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.ContentLayout, { children: /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.LoadingIndicatorPage, {}) })
|
|
1248
1251
|
}
|
|
1249
1252
|
);
|
|
1250
1253
|
}
|
|
1251
|
-
if (!releaseId) {
|
|
1252
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: ".." });
|
|
1253
|
-
}
|
|
1254
1254
|
const releaseData = isSuccessDetails && data?.data || null;
|
|
1255
1255
|
const title = releaseData?.name || "";
|
|
1256
1256
|
const timezone = releaseData?.timezone ?? null;
|
|
1257
1257
|
const scheduledAt = releaseData?.scheduledAt && timezone ? dateFnsTz.utcToZonedTime(releaseData.scheduledAt, timezone) : null;
|
|
1258
|
-
const date = scheduledAt ? format__default.default(scheduledAt, "yyyy-MM-dd") :
|
|
1258
|
+
const date = scheduledAt ? format__default.default(scheduledAt, "yyyy-MM-dd") : null;
|
|
1259
1259
|
const time = scheduledAt ? format__default.default(scheduledAt, "HH:mm") : "";
|
|
1260
1260
|
const handleEditRelease = async (values) => {
|
|
1261
1261
|
const response = await updateRelease({
|
|
@@ -1273,14 +1273,14 @@ const ReleaseDetailsPage = () => {
|
|
|
1273
1273
|
})
|
|
1274
1274
|
});
|
|
1275
1275
|
toggleEditReleaseModal();
|
|
1276
|
-
} else if (
|
|
1276
|
+
} else if (index.isAxiosError(response.error)) {
|
|
1277
1277
|
toggleNotification({
|
|
1278
|
-
type: "
|
|
1278
|
+
type: "warning",
|
|
1279
1279
|
message: formatAPIError(response.error)
|
|
1280
1280
|
});
|
|
1281
1281
|
} else {
|
|
1282
1282
|
toggleNotification({
|
|
1283
|
-
type: "
|
|
1283
|
+
type: "warning",
|
|
1284
1284
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
1285
1285
|
});
|
|
1286
1286
|
}
|
|
@@ -1290,15 +1290,15 @@ const ReleaseDetailsPage = () => {
|
|
|
1290
1290
|
id: releaseId
|
|
1291
1291
|
});
|
|
1292
1292
|
if ("data" in response) {
|
|
1293
|
-
|
|
1294
|
-
} else if (
|
|
1293
|
+
replace("/plugins/content-releases");
|
|
1294
|
+
} else if (index.isAxiosError(response.error)) {
|
|
1295
1295
|
toggleNotification({
|
|
1296
|
-
type: "
|
|
1296
|
+
type: "warning",
|
|
1297
1297
|
message: formatAPIError(response.error)
|
|
1298
1298
|
});
|
|
1299
1299
|
} else {
|
|
1300
1300
|
toggleNotification({
|
|
1301
|
-
type: "
|
|
1301
|
+
type: "warning",
|
|
1302
1302
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
1303
1303
|
});
|
|
1304
1304
|
}
|
|
@@ -1309,11 +1309,10 @@ const ReleaseDetailsPage = () => {
|
|
|
1309
1309
|
toggleEditReleaseModal,
|
|
1310
1310
|
toggleWarningSubmit,
|
|
1311
1311
|
children: [
|
|
1312
|
-
/* @__PURE__ */ jsxRuntime.jsx(ReleaseDetailsBody, {
|
|
1313
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1312
|
+
/* @__PURE__ */ jsxRuntime.jsx(ReleaseDetailsBody, {}),
|
|
1313
|
+
releaseModalShown && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1314
1314
|
ReleaseModal,
|
|
1315
1315
|
{
|
|
1316
|
-
open: releaseModalShown,
|
|
1317
1316
|
handleClose: toggleEditReleaseModal,
|
|
1318
1317
|
handleSubmit: handleEditRelease,
|
|
1319
1318
|
isLoading: isLoadingDetails || isSubmittingForm,
|
|
@@ -1327,19 +1326,28 @@ const ReleaseDetailsPage = () => {
|
|
|
1327
1326
|
}
|
|
1328
1327
|
}
|
|
1329
1328
|
),
|
|
1330
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1329
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1330
|
+
helperPlugin.ConfirmDialog,
|
|
1331
|
+
{
|
|
1332
|
+
bodyText: {
|
|
1333
|
+
id: "content-releases.dialog.confirmation-message",
|
|
1334
|
+
defaultMessage: "Are you sure you want to delete this release?"
|
|
1335
|
+
},
|
|
1336
|
+
isOpen: showWarningSubmit,
|
|
1337
|
+
isConfirmButtonLoading: isDeletingRelease,
|
|
1338
|
+
onToggleDialog: toggleWarningSubmit,
|
|
1339
|
+
onConfirm: handleDeleteRelease
|
|
1340
|
+
}
|
|
1341
|
+
)
|
|
1334
1342
|
]
|
|
1335
1343
|
}
|
|
1336
1344
|
);
|
|
1337
1345
|
};
|
|
1338
1346
|
const App = () => {
|
|
1339
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1340
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, {
|
|
1341
|
-
/* @__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 })
|
|
1342
1350
|
] }) });
|
|
1343
1351
|
};
|
|
1344
1352
|
exports.App = App;
|
|
1345
|
-
//# sourceMappingURL=App-
|
|
1353
|
+
//# sourceMappingURL=App-dLXY5ei3.js.map
|