@strapi/content-releases 0.0.0-experimental.f7b9b47085e387e97f990d8695971b51d7f7149a → 0.0.0-experimental.fb8e9fec2e10d6b55e3aee59c4eb76bb7a11432a
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-a4843fda.mjs → App-L1jSxCiL.mjs} +277 -117
- package/dist/_chunks/App-L1jSxCiL.mjs.map +1 -0
- package/dist/_chunks/{App-f2cafd81.js → App-_20W9dYa.js} +274 -114
- package/dist/_chunks/App-_20W9dYa.js.map +1 -0
- package/dist/_chunks/{en-e98d8b57.mjs → en-MyLPoISH.mjs} +14 -4
- package/dist/_chunks/en-MyLPoISH.mjs.map +1 -0
- package/dist/_chunks/{en-13576ce2.js → en-gYDqKYFd.js} +14 -4
- package/dist/_chunks/en-gYDqKYFd.js.map +1 -0
- package/dist/_chunks/{index-66d129ac.js → index-KJa1Rb5F.js} +107 -37
- package/dist/_chunks/index-KJa1Rb5F.js.map +1 -0
- package/dist/_chunks/{index-937f8179.mjs → index-c4zRX_sg.mjs} +117 -47
- package/dist/_chunks/index-c4zRX_sg.mjs.map +1 -0
- package/dist/admin/index.js +2 -1
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +3 -2
- package/dist/admin/index.mjs.map +1 -1
- package/dist/server/index.js +359 -102
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +357 -103
- package/dist/server/index.mjs.map +1 -1
- package/package.json +11 -9
- package/dist/_chunks/App-a4843fda.mjs.map +0 -1
- package/dist/_chunks/App-f2cafd81.js.map +0 -1
- package/dist/_chunks/en-13576ce2.js.map +0 -1
- package/dist/_chunks/en-e98d8b57.mjs.map +0 -1
- package/dist/_chunks/index-66d129ac.js.map +0 -1
- package/dist/_chunks/index-937f8179.mjs.map +0 -1
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { useNotification, useAPIErrorHandler, LoadingIndicatorPage, ConfirmDialog, useRBAC, RelativeTime, CheckPermissions, useQueryParams, AnErrorOccurred, NoContent, Table, PageSizeURLQuery, PaginationURLQuery, CheckPagePermissions } from "@strapi/helper-plugin";
|
|
3
|
+
import { useLocation, useParams, useHistory, Redirect, Link as Link$1, Switch, Route } from "react-router-dom";
|
|
4
|
+
import { p as pluginId, u as useGetReleaseQuery, a as useUpdateReleaseMutation, b as useDeleteReleaseMutation, c as usePublishReleaseMutation, P as PERMISSIONS, d as useTypedDispatch, e as useGetReleaseActionsQuery, f as useUpdateReleaseActionMutation, R as ReleaseActionOptions, g as ReleaseActionMenu, i as isAxiosError, r as releaseApi, h as useGetReleasesQuery, j as useCreateReleaseMutation } from "./index-c4zRX_sg.mjs";
|
|
4
5
|
import * as React from "react";
|
|
5
|
-
import {
|
|
6
|
+
import { unstable_useDocument } from "@strapi/admin/strapi-admin";
|
|
7
|
+
import { ModalLayout, ModalHeader, Typography, ModalBody, TextInput, ModalFooter, Button, Flex, ContentLayout, Main, HeaderLayout, Link, IconButton, Popover, SingleSelect, SingleSelectOption, Badge, Tr, Td, Icon, Tooltip, TabGroup, Box, Tabs, Tab, Divider, TabPanels, TabPanel, EmptyStateLayout, Grid, GridItem } from "@strapi/design-system";
|
|
6
8
|
import { LinkButton, Link as Link$2 } from "@strapi/design-system/v2";
|
|
7
|
-
import {
|
|
8
|
-
import { Pencil, Trash, ArrowLeft, More, Plus, EmptyDocuments } from "@strapi/icons";
|
|
9
|
+
import { Pencil, Trash, ArrowLeft, More, CrossCircle, CheckCircle, Plus, EmptyDocuments } from "@strapi/icons";
|
|
9
10
|
import { useIntl } from "react-intl";
|
|
10
11
|
import styled from "styled-components";
|
|
11
12
|
import { Formik, Form } from "formik";
|
|
@@ -13,6 +14,7 @@ import * as yup from "yup";
|
|
|
13
14
|
import "@reduxjs/toolkit/query";
|
|
14
15
|
import "axios";
|
|
15
16
|
import "@reduxjs/toolkit/query/react";
|
|
17
|
+
import "react-redux";
|
|
16
18
|
const RELEASE_SCHEMA = yup.object().shape({
|
|
17
19
|
name: yup.string().trim().required()
|
|
18
20
|
}).required().noUnknown();
|
|
@@ -23,11 +25,16 @@ const ReleaseModal = ({
|
|
|
23
25
|
isLoading = false
|
|
24
26
|
}) => {
|
|
25
27
|
const { formatMessage } = useIntl();
|
|
28
|
+
const { pathname } = useLocation();
|
|
29
|
+
const isCreatingRelease = pathname === `/plugins/${pluginId}`;
|
|
26
30
|
return /* @__PURE__ */ jsxs(ModalLayout, { onClose: handleClose, labelledBy: "title", children: [
|
|
27
|
-
/* @__PURE__ */ jsx(ModalHeader, { children: /* @__PURE__ */ jsx(Typography, { id: "title", fontWeight: "bold", textColor: "neutral800", children: formatMessage(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
/* @__PURE__ */ jsx(ModalHeader, { children: /* @__PURE__ */ jsx(Typography, { id: "title", fontWeight: "bold", textColor: "neutral800", children: formatMessage(
|
|
32
|
+
{
|
|
33
|
+
id: "content-releases.modal.title",
|
|
34
|
+
defaultMessage: "{isCreatingRelease, select, true {New release} other {Edit release}}"
|
|
35
|
+
},
|
|
36
|
+
{ isCreatingRelease }
|
|
37
|
+
) }) }),
|
|
31
38
|
/* @__PURE__ */ jsx(
|
|
32
39
|
Formik,
|
|
33
40
|
{
|
|
@@ -54,10 +61,22 @@ const ReleaseModal = ({
|
|
|
54
61
|
ModalFooter,
|
|
55
62
|
{
|
|
56
63
|
startActions: /* @__PURE__ */ jsx(Button, { onClick: handleClose, variant: "tertiary", name: "cancel", children: formatMessage({ id: "cancel", defaultMessage: "Cancel" }) }),
|
|
57
|
-
endActions: /* @__PURE__ */ jsx(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
64
|
+
endActions: /* @__PURE__ */ jsx(
|
|
65
|
+
Button,
|
|
66
|
+
{
|
|
67
|
+
name: "submit",
|
|
68
|
+
loading: isLoading,
|
|
69
|
+
disabled: !values.name || values.name === initialValues.name,
|
|
70
|
+
type: "submit",
|
|
71
|
+
children: formatMessage(
|
|
72
|
+
{
|
|
73
|
+
id: "content-releases.modal.form.button.submit",
|
|
74
|
+
defaultMessage: "{isCreatingRelease, select, true {Continue} other {Save}}"
|
|
75
|
+
},
|
|
76
|
+
{ isCreatingRelease }
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
)
|
|
61
80
|
}
|
|
62
81
|
)
|
|
63
82
|
] })
|
|
@@ -96,6 +115,9 @@ const TrashIcon = styled(Trash)`
|
|
|
96
115
|
fill: ${({ theme }) => theme.colors.danger600};
|
|
97
116
|
}
|
|
98
117
|
`;
|
|
118
|
+
const TypographyMaxWidth = styled(Typography)`
|
|
119
|
+
max-width: 300px;
|
|
120
|
+
`;
|
|
99
121
|
const PopoverButton = ({ onClick, disabled, children }) => {
|
|
100
122
|
return /* @__PURE__ */ jsx(
|
|
101
123
|
StyledFlex,
|
|
@@ -114,6 +136,49 @@ const PopoverButton = ({ onClick, disabled, children }) => {
|
|
|
114
136
|
}
|
|
115
137
|
);
|
|
116
138
|
};
|
|
139
|
+
const EntryValidationText = ({ action, schema, components, entry }) => {
|
|
140
|
+
const { formatMessage } = useIntl();
|
|
141
|
+
const { validate } = unstable_useDocument();
|
|
142
|
+
const { errors } = validate(entry, {
|
|
143
|
+
contentType: schema,
|
|
144
|
+
components,
|
|
145
|
+
isCreatingEntry: false
|
|
146
|
+
});
|
|
147
|
+
if (Object.keys(errors).length > 0) {
|
|
148
|
+
const validationErrorsMessages = Object.entries(errors).map(
|
|
149
|
+
([key, value]) => formatMessage(
|
|
150
|
+
{ id: `${value.id}.withField`, defaultMessage: value.defaultMessage },
|
|
151
|
+
{ field: key }
|
|
152
|
+
)
|
|
153
|
+
).join(" ");
|
|
154
|
+
return /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
155
|
+
/* @__PURE__ */ jsx(Icon, { color: "danger600", as: CrossCircle }),
|
|
156
|
+
/* @__PURE__ */ jsx(Tooltip, { description: validationErrorsMessages, children: /* @__PURE__ */ jsx(TypographyMaxWidth, { textColor: "danger600", variant: "omega", fontWeight: "semiBold", ellipsis: true, children: validationErrorsMessages }) })
|
|
157
|
+
] });
|
|
158
|
+
}
|
|
159
|
+
if (action == "publish") {
|
|
160
|
+
return /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
161
|
+
/* @__PURE__ */ jsx(Icon, { color: "success600", as: CheckCircle }),
|
|
162
|
+
entry.publishedAt ? /* @__PURE__ */ jsx(Typography, { textColor: "success600", fontWeight: "bold", children: formatMessage({
|
|
163
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.already-published",
|
|
164
|
+
defaultMessage: "Already published"
|
|
165
|
+
}) }) : /* @__PURE__ */ jsx(Typography, { children: formatMessage({
|
|
166
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.ready-to-publish",
|
|
167
|
+
defaultMessage: "Ready to publish"
|
|
168
|
+
}) })
|
|
169
|
+
] });
|
|
170
|
+
}
|
|
171
|
+
return /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
172
|
+
/* @__PURE__ */ jsx(Icon, { color: "success600", as: CheckCircle }),
|
|
173
|
+
!entry.publishedAt ? /* @__PURE__ */ jsx(Typography, { textColor: "success600", fontWeight: "bold", children: formatMessage({
|
|
174
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.already-unpublished",
|
|
175
|
+
defaultMessage: "Already unpublished"
|
|
176
|
+
}) }) : /* @__PURE__ */ jsx(Typography, { children: formatMessage({
|
|
177
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.ready-to-unpublish",
|
|
178
|
+
defaultMessage: "Ready to unpublish"
|
|
179
|
+
}) })
|
|
180
|
+
] });
|
|
181
|
+
};
|
|
117
182
|
const ReleaseDetailsLayout = ({
|
|
118
183
|
toggleEditReleaseModal,
|
|
119
184
|
toggleWarningSubmit,
|
|
@@ -135,6 +200,7 @@ const ReleaseDetailsLayout = ({
|
|
|
135
200
|
const {
|
|
136
201
|
allowedActions: { canUpdate, canDelete }
|
|
137
202
|
} = useRBAC(PERMISSIONS);
|
|
203
|
+
const dispatch = useTypedDispatch();
|
|
138
204
|
const release = data?.data;
|
|
139
205
|
const handleTogglePopover = () => {
|
|
140
206
|
setIsPopoverVisible((prev) => !prev);
|
|
@@ -169,6 +235,9 @@ const ReleaseDetailsLayout = ({
|
|
|
169
235
|
toggleWarningSubmit();
|
|
170
236
|
handleTogglePopover();
|
|
171
237
|
};
|
|
238
|
+
const handleRefresh = () => {
|
|
239
|
+
dispatch(releaseApi.util.invalidateTags([{ type: "ReleaseAction", id: "LIST" }]));
|
|
240
|
+
};
|
|
172
241
|
if (isLoadingDetails) {
|
|
173
242
|
return /* @__PURE__ */ jsx(Main, { "aria-busy": isLoadingDetails, children: /* @__PURE__ */ jsx(LoadingIndicatorPage, {}) });
|
|
174
243
|
}
|
|
@@ -190,7 +259,7 @@ const ReleaseDetailsLayout = ({
|
|
|
190
259
|
);
|
|
191
260
|
}
|
|
192
261
|
const totalEntries = release.actions.meta.count || 0;
|
|
193
|
-
const createdBy = `${release.createdBy.firstname} ${release.createdBy.lastname}`;
|
|
262
|
+
const createdBy = release.createdBy.lastname ? `${release.createdBy.firstname} ${release.createdBy.lastname}` : `${release.createdBy.firstname}`;
|
|
194
263
|
return /* @__PURE__ */ jsxs(Main, { "aria-busy": isLoadingDetails, children: [
|
|
195
264
|
/* @__PURE__ */ jsx(
|
|
196
265
|
HeaderLayout,
|
|
@@ -274,6 +343,10 @@ const ReleaseDetailsLayout = ({
|
|
|
274
343
|
]
|
|
275
344
|
}
|
|
276
345
|
),
|
|
346
|
+
/* @__PURE__ */ jsx(Button, { size: "S", variant: "tertiary", onClick: handleRefresh, children: formatMessage({
|
|
347
|
+
id: "content-releases.header.actions.refresh",
|
|
348
|
+
defaultMessage: "Refresh"
|
|
349
|
+
}) }),
|
|
277
350
|
/* @__PURE__ */ jsx(CheckPermissions, { permissions: PERMISSIONS.publish, children: /* @__PURE__ */ jsx(
|
|
278
351
|
Button,
|
|
279
352
|
{
|
|
@@ -294,10 +367,29 @@ const ReleaseDetailsLayout = ({
|
|
|
294
367
|
children
|
|
295
368
|
] });
|
|
296
369
|
};
|
|
370
|
+
const GROUP_BY_OPTIONS = ["contentType", "locale", "action"];
|
|
371
|
+
const getGroupByOptionLabel = (value) => {
|
|
372
|
+
if (value === "locale") {
|
|
373
|
+
return {
|
|
374
|
+
id: "content-releases.pages.ReleaseDetails.groupBy.option.locales",
|
|
375
|
+
defaultMessage: "Locales"
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
if (value === "action") {
|
|
379
|
+
return {
|
|
380
|
+
id: "content-releases.pages.ReleaseDetails.groupBy.option.actions",
|
|
381
|
+
defaultMessage: "Actions"
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
return {
|
|
385
|
+
id: "content-releases.pages.ReleaseDetails.groupBy.option.content-type",
|
|
386
|
+
defaultMessage: "Content-Types"
|
|
387
|
+
};
|
|
388
|
+
};
|
|
297
389
|
const ReleaseDetailsBody = () => {
|
|
298
390
|
const { formatMessage } = useIntl();
|
|
299
391
|
const { releaseId } = useParams();
|
|
300
|
-
const [{ query }] = useQueryParams();
|
|
392
|
+
const [{ query }, setQuery] = useQueryParams();
|
|
301
393
|
const toggleNotification = useNotification();
|
|
302
394
|
const { formatAPIError } = useAPIErrorHandler();
|
|
303
395
|
const {
|
|
@@ -307,6 +399,7 @@ const ReleaseDetailsBody = () => {
|
|
|
307
399
|
error: releaseError
|
|
308
400
|
} = useGetReleaseQuery({ id: releaseId });
|
|
309
401
|
const release = releaseData?.data;
|
|
402
|
+
const selectedGroupBy = query?.groupBy || "contentType";
|
|
310
403
|
const {
|
|
311
404
|
isLoading,
|
|
312
405
|
isFetching,
|
|
@@ -345,7 +438,11 @@ const ReleaseDetailsBody = () => {
|
|
|
345
438
|
if (isLoading || isReleaseLoading) {
|
|
346
439
|
return /* @__PURE__ */ jsx(ContentLayout, { children: /* @__PURE__ */ jsx(LoadingIndicatorPage, {}) });
|
|
347
440
|
}
|
|
348
|
-
|
|
441
|
+
const releaseActions = data?.data;
|
|
442
|
+
const releaseMeta = data?.meta;
|
|
443
|
+
const contentTypes = releaseMeta?.contentTypes || {};
|
|
444
|
+
const components = releaseMeta?.components || {};
|
|
445
|
+
if (isReleaseError || !release) {
|
|
349
446
|
const errorsArray = [];
|
|
350
447
|
if (releaseError) {
|
|
351
448
|
errorsArray.push({
|
|
@@ -369,9 +466,10 @@ const ReleaseDetailsBody = () => {
|
|
|
369
466
|
}
|
|
370
467
|
);
|
|
371
468
|
}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
469
|
+
if (isError || !releaseActions) {
|
|
470
|
+
return /* @__PURE__ */ jsx(ContentLayout, { children: /* @__PURE__ */ jsx(AnErrorOccurred, {}) });
|
|
471
|
+
}
|
|
472
|
+
if (Object.keys(releaseActions).length === 0) {
|
|
375
473
|
return /* @__PURE__ */ jsx(ContentLayout, { children: /* @__PURE__ */ jsx(
|
|
376
474
|
NoContent,
|
|
377
475
|
{
|
|
@@ -397,90 +495,153 @@ const ReleaseDetailsBody = () => {
|
|
|
397
495
|
}
|
|
398
496
|
) });
|
|
399
497
|
}
|
|
400
|
-
return /* @__PURE__ */ jsx(ContentLayout, { children: /* @__PURE__ */ jsxs(Flex, { gap:
|
|
401
|
-
/* @__PURE__ */ jsx(
|
|
402
|
-
|
|
498
|
+
return /* @__PURE__ */ jsx(ContentLayout, { children: /* @__PURE__ */ jsxs(Flex, { gap: 8, direction: "column", alignItems: "stretch", children: [
|
|
499
|
+
/* @__PURE__ */ jsx(Flex, { children: /* @__PURE__ */ jsx(
|
|
500
|
+
SingleSelect,
|
|
403
501
|
{
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
})
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
}),
|
|
421
|
-
name: "name"
|
|
422
|
-
}
|
|
423
|
-
),
|
|
424
|
-
/* @__PURE__ */ jsx(
|
|
425
|
-
Table.HeaderCell,
|
|
426
|
-
{
|
|
427
|
-
fieldSchemaType: "string",
|
|
428
|
-
label: formatMessage({
|
|
429
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.locale",
|
|
430
|
-
defaultMessage: "locale"
|
|
431
|
-
}),
|
|
432
|
-
name: "locale"
|
|
433
|
-
}
|
|
434
|
-
),
|
|
435
|
-
/* @__PURE__ */ jsx(
|
|
436
|
-
Table.HeaderCell,
|
|
437
|
-
{
|
|
438
|
-
fieldSchemaType: "string",
|
|
439
|
-
label: formatMessage({
|
|
440
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.content-type",
|
|
441
|
-
defaultMessage: "content-type"
|
|
442
|
-
}),
|
|
443
|
-
name: "content-type"
|
|
444
|
-
}
|
|
445
|
-
),
|
|
446
|
-
/* @__PURE__ */ jsx(
|
|
447
|
-
Table.HeaderCell,
|
|
448
|
-
{
|
|
449
|
-
fieldSchemaType: "string",
|
|
450
|
-
label: formatMessage({
|
|
451
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.action",
|
|
452
|
-
defaultMessage: "action"
|
|
453
|
-
}),
|
|
454
|
-
name: "action"
|
|
455
|
-
}
|
|
456
|
-
)
|
|
457
|
-
] }),
|
|
458
|
-
/* @__PURE__ */ jsx(Table.LoadingBody, {}),
|
|
459
|
-
/* @__PURE__ */ jsx(Table.Body, { children: releaseActions.map(({ id, type, entry }) => /* @__PURE__ */ jsxs(Tr, { children: [
|
|
460
|
-
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { children: `${entry.contentType.mainFieldValue || entry.id}` }) }),
|
|
461
|
-
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { children: `${entry?.locale?.name ? entry.locale.name : "-"}` }) }),
|
|
462
|
-
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { children: entry.contentType.displayName || "" }) }),
|
|
463
|
-
/* @__PURE__ */ jsx(Td, { children: release.releasedAt ? /* @__PURE__ */ jsx(Typography, { children: formatMessage(
|
|
464
|
-
{
|
|
465
|
-
id: "content-releases.page.ReleaseDetails.table.action-published",
|
|
466
|
-
defaultMessage: "This entry was <b>{isPublish, select, true {published} other {unpublished}}</b>."
|
|
467
|
-
},
|
|
468
|
-
{
|
|
469
|
-
isPublish: type === "publish",
|
|
470
|
-
b: (children) => /* @__PURE__ */ jsx(Typography, { fontWeight: "bold", children })
|
|
471
|
-
}
|
|
472
|
-
) }) : /* @__PURE__ */ jsx(
|
|
473
|
-
ReleaseActionOptions,
|
|
474
|
-
{
|
|
475
|
-
selected: type,
|
|
476
|
-
handleChange: (e) => handleChangeType(e, id),
|
|
477
|
-
name: `release-action-${id}-type`
|
|
478
|
-
}
|
|
479
|
-
) })
|
|
480
|
-
] }, id)) })
|
|
481
|
-
] })
|
|
502
|
+
"aria-label": formatMessage({
|
|
503
|
+
id: "content-releases.pages.ReleaseDetails.groupBy.label",
|
|
504
|
+
defaultMessage: "Group by"
|
|
505
|
+
}),
|
|
506
|
+
customizeContent: (value) => formatMessage(
|
|
507
|
+
{
|
|
508
|
+
id: `content-releases.pages.ReleaseDetails.groupBy.label`,
|
|
509
|
+
defaultMessage: `Group by {groupBy}`
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
groupBy: value
|
|
513
|
+
}
|
|
514
|
+
),
|
|
515
|
+
value: formatMessage(getGroupByOptionLabel(selectedGroupBy)),
|
|
516
|
+
onChange: (value) => setQuery({ groupBy: value }),
|
|
517
|
+
children: GROUP_BY_OPTIONS.map((option) => /* @__PURE__ */ jsx(SingleSelectOption, { value: option, children: formatMessage(getGroupByOptionLabel(option)) }, option))
|
|
482
518
|
}
|
|
483
|
-
),
|
|
519
|
+
) }),
|
|
520
|
+
Object.keys(releaseActions).map((key) => /* @__PURE__ */ jsxs(Flex, { gap: 4, direction: "column", alignItems: "stretch", children: [
|
|
521
|
+
/* @__PURE__ */ jsx(Flex, { children: /* @__PURE__ */ jsx(Badge, { children: key }) }),
|
|
522
|
+
/* @__PURE__ */ jsx(
|
|
523
|
+
Table.Root,
|
|
524
|
+
{
|
|
525
|
+
rows: releaseActions[key].map((item) => ({
|
|
526
|
+
...item,
|
|
527
|
+
id: Number(item.entry.id)
|
|
528
|
+
})),
|
|
529
|
+
colCount: releaseActions[key].length,
|
|
530
|
+
isLoading,
|
|
531
|
+
isFetching,
|
|
532
|
+
children: /* @__PURE__ */ jsxs(Table.Content, { children: [
|
|
533
|
+
/* @__PURE__ */ jsxs(Table.Head, { children: [
|
|
534
|
+
/* @__PURE__ */ jsx(
|
|
535
|
+
Table.HeaderCell,
|
|
536
|
+
{
|
|
537
|
+
fieldSchemaType: "string",
|
|
538
|
+
label: formatMessage({
|
|
539
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.name",
|
|
540
|
+
defaultMessage: "name"
|
|
541
|
+
}),
|
|
542
|
+
name: "name"
|
|
543
|
+
}
|
|
544
|
+
),
|
|
545
|
+
/* @__PURE__ */ jsx(
|
|
546
|
+
Table.HeaderCell,
|
|
547
|
+
{
|
|
548
|
+
fieldSchemaType: "string",
|
|
549
|
+
label: formatMessage({
|
|
550
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.locale",
|
|
551
|
+
defaultMessage: "locale"
|
|
552
|
+
}),
|
|
553
|
+
name: "locale"
|
|
554
|
+
}
|
|
555
|
+
),
|
|
556
|
+
/* @__PURE__ */ jsx(
|
|
557
|
+
Table.HeaderCell,
|
|
558
|
+
{
|
|
559
|
+
fieldSchemaType: "string",
|
|
560
|
+
label: formatMessage({
|
|
561
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.content-type",
|
|
562
|
+
defaultMessage: "content-type"
|
|
563
|
+
}),
|
|
564
|
+
name: "content-type"
|
|
565
|
+
}
|
|
566
|
+
),
|
|
567
|
+
/* @__PURE__ */ jsx(
|
|
568
|
+
Table.HeaderCell,
|
|
569
|
+
{
|
|
570
|
+
fieldSchemaType: "string",
|
|
571
|
+
label: formatMessage({
|
|
572
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.action",
|
|
573
|
+
defaultMessage: "action"
|
|
574
|
+
}),
|
|
575
|
+
name: "action"
|
|
576
|
+
}
|
|
577
|
+
),
|
|
578
|
+
!release.releasedAt && /* @__PURE__ */ jsx(
|
|
579
|
+
Table.HeaderCell,
|
|
580
|
+
{
|
|
581
|
+
fieldSchemaType: "string",
|
|
582
|
+
label: formatMessage({
|
|
583
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.status",
|
|
584
|
+
defaultMessage: "status"
|
|
585
|
+
}),
|
|
586
|
+
name: "status"
|
|
587
|
+
}
|
|
588
|
+
)
|
|
589
|
+
] }),
|
|
590
|
+
/* @__PURE__ */ jsx(Table.LoadingBody, {}),
|
|
591
|
+
/* @__PURE__ */ jsx(Table.Body, { children: releaseActions[key].map(({ id, contentType, locale, type, entry }) => /* @__PURE__ */ jsxs(Tr, { children: [
|
|
592
|
+
/* @__PURE__ */ jsx(Td, { width: "25%", maxWidth: "200px", children: /* @__PURE__ */ jsx(Typography, { ellipsis: true, children: `${contentType.mainFieldValue || entry.id}` }) }),
|
|
593
|
+
/* @__PURE__ */ jsx(Td, { width: "10%", children: /* @__PURE__ */ jsx(Typography, { children: `${locale?.name ? locale.name : "-"}` }) }),
|
|
594
|
+
/* @__PURE__ */ jsx(Td, { width: "10%", children: /* @__PURE__ */ jsx(Typography, { children: contentType.displayName || "" }) }),
|
|
595
|
+
/* @__PURE__ */ jsx(Td, { width: "20%", children: release.releasedAt ? /* @__PURE__ */ jsx(Typography, { children: formatMessage(
|
|
596
|
+
{
|
|
597
|
+
id: "content-releases.page.ReleaseDetails.table.action-published",
|
|
598
|
+
defaultMessage: "This entry was <b>{isPublish, select, true {published} other {unpublished}}</b>."
|
|
599
|
+
},
|
|
600
|
+
{
|
|
601
|
+
isPublish: type === "publish",
|
|
602
|
+
b: (children) => /* @__PURE__ */ jsx(Typography, { fontWeight: "bold", children })
|
|
603
|
+
}
|
|
604
|
+
) }) : /* @__PURE__ */ jsx(
|
|
605
|
+
ReleaseActionOptions,
|
|
606
|
+
{
|
|
607
|
+
selected: type,
|
|
608
|
+
handleChange: (e) => handleChangeType(e, id),
|
|
609
|
+
name: `release-action-${id}-type`
|
|
610
|
+
}
|
|
611
|
+
) }),
|
|
612
|
+
!release.releasedAt && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
613
|
+
/* @__PURE__ */ jsx(Td, { width: "20%", minWidth: "200px", children: /* @__PURE__ */ jsx(
|
|
614
|
+
EntryValidationText,
|
|
615
|
+
{
|
|
616
|
+
action: type,
|
|
617
|
+
schema: contentTypes?.[contentType.uid],
|
|
618
|
+
components,
|
|
619
|
+
entry
|
|
620
|
+
}
|
|
621
|
+
) }),
|
|
622
|
+
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Flex, { justifyContent: "flex-end", children: /* @__PURE__ */ jsxs(ReleaseActionMenu.Root, { children: [
|
|
623
|
+
/* @__PURE__ */ jsx(
|
|
624
|
+
ReleaseActionMenu.ReleaseActionEntryLinkItem,
|
|
625
|
+
{
|
|
626
|
+
contentTypeUid: contentType.uid,
|
|
627
|
+
entryId: entry.id,
|
|
628
|
+
locale: locale?.code
|
|
629
|
+
}
|
|
630
|
+
),
|
|
631
|
+
/* @__PURE__ */ jsx(
|
|
632
|
+
ReleaseActionMenu.DeleteReleaseActionItem,
|
|
633
|
+
{
|
|
634
|
+
releaseId: release.id,
|
|
635
|
+
actionId: id
|
|
636
|
+
}
|
|
637
|
+
)
|
|
638
|
+
] }) }) })
|
|
639
|
+
] })
|
|
640
|
+
] }, id)) })
|
|
641
|
+
] })
|
|
642
|
+
}
|
|
643
|
+
)
|
|
644
|
+
] }, `releases-group-${key}`)),
|
|
484
645
|
/* @__PURE__ */ jsxs(Flex, { paddingTop: 4, alignItems: "flex-end", justifyContent: "space-between", children: [
|
|
485
646
|
/* @__PURE__ */ jsx(PageSizeURLQuery, { defaultValue: releaseMeta?.pagination?.pageSize.toString() }),
|
|
486
647
|
/* @__PURE__ */ jsx(
|
|
@@ -601,7 +762,6 @@ const ReleaseDetailsPage = () => {
|
|
|
601
762
|
}
|
|
602
763
|
);
|
|
603
764
|
};
|
|
604
|
-
const ProtectedReleaseDetailsPage = () => /* @__PURE__ */ jsx(CheckPermissions, { permissions: PERMISSIONS.main, children: /* @__PURE__ */ jsx(ReleaseDetailsPage, {}) });
|
|
605
765
|
const ReleasesLayout = ({
|
|
606
766
|
isLoading,
|
|
607
767
|
totalReleases,
|
|
@@ -688,6 +848,7 @@ const INITIAL_FORM_VALUES = {
|
|
|
688
848
|
name: ""
|
|
689
849
|
};
|
|
690
850
|
const ReleasesPage = () => {
|
|
851
|
+
const tabRef = React.useRef(null);
|
|
691
852
|
const location = useLocation();
|
|
692
853
|
const [releaseModalShown, setReleaseModalShown] = React.useState(false);
|
|
693
854
|
const toggleNotification = useNotification();
|
|
@@ -698,6 +859,8 @@ const ReleasesPage = () => {
|
|
|
698
859
|
const response = useGetReleasesQuery(query);
|
|
699
860
|
const [createRelease, { isLoading: isSubmittingForm }] = useCreateReleaseMutation();
|
|
700
861
|
const { isLoading, isSuccess, isError } = response;
|
|
862
|
+
const activeTab = response?.currentData?.meta?.activeTab || "pending";
|
|
863
|
+
const activeTabIndex = ["pending", "done"].indexOf(activeTab);
|
|
701
864
|
React.useEffect(() => {
|
|
702
865
|
if (location?.state?.errors) {
|
|
703
866
|
toggleNotification({
|
|
@@ -714,6 +877,11 @@ const ReleasesPage = () => {
|
|
|
714
877
|
replace({ state: null });
|
|
715
878
|
}
|
|
716
879
|
}, [formatMessage, location?.state?.errors, replace, toggleNotification]);
|
|
880
|
+
React.useEffect(() => {
|
|
881
|
+
if (tabRef.current) {
|
|
882
|
+
tabRef.current._handlers.setSelectedTabIndex(activeTabIndex);
|
|
883
|
+
}
|
|
884
|
+
}, [activeTabIndex]);
|
|
717
885
|
const toggleAddReleaseModal = () => {
|
|
718
886
|
setReleaseModalShown((prev) => !prev);
|
|
719
887
|
};
|
|
@@ -733,7 +901,6 @@ const ReleasesPage = () => {
|
|
|
733
901
|
}
|
|
734
902
|
});
|
|
735
903
|
};
|
|
736
|
-
const activeTab = response?.currentData?.meta?.activeTab || "pending";
|
|
737
904
|
const handleAddRelease = async (values) => {
|
|
738
905
|
const response2 = await createRelease({
|
|
739
906
|
name: values.name
|
|
@@ -769,8 +936,9 @@ const ReleasesPage = () => {
|
|
|
769
936
|
defaultMessage: "Releases list"
|
|
770
937
|
}),
|
|
771
938
|
variant: "simple",
|
|
772
|
-
initialSelectedTabIndex:
|
|
939
|
+
initialSelectedTabIndex: activeTabIndex,
|
|
773
940
|
onTabChange: handleTabChange,
|
|
941
|
+
ref: tabRef,
|
|
774
942
|
children: [
|
|
775
943
|
/* @__PURE__ */ jsxs(Box, { paddingBottom: 8, children: [
|
|
776
944
|
/* @__PURE__ */ jsxs(Tabs, { children: [
|
|
@@ -835,21 +1003,13 @@ const ReleasesPage = () => {
|
|
|
835
1003
|
)
|
|
836
1004
|
] });
|
|
837
1005
|
};
|
|
838
|
-
const ProtectedReleasesPage = () => /* @__PURE__ */ jsx(CheckPermissions, { permissions: PERMISSIONS.main, children: /* @__PURE__ */ jsx(ReleasesPage, {}) });
|
|
839
1006
|
const App = () => {
|
|
840
|
-
return /* @__PURE__ */ jsxs(Switch, { children: [
|
|
841
|
-
/* @__PURE__ */ jsx(Route, { exact: true, path: `/plugins/${pluginId}`, component:
|
|
842
|
-
/* @__PURE__ */ jsx(
|
|
843
|
-
|
|
844
|
-
{
|
|
845
|
-
exact: true,
|
|
846
|
-
path: `/plugins/${pluginId}/:releaseId`,
|
|
847
|
-
component: ProtectedReleaseDetailsPage
|
|
848
|
-
}
|
|
849
|
-
)
|
|
850
|
-
] });
|
|
1007
|
+
return /* @__PURE__ */ jsx(CheckPagePermissions, { permissions: PERMISSIONS.main, children: /* @__PURE__ */ jsxs(Switch, { children: [
|
|
1008
|
+
/* @__PURE__ */ jsx(Route, { exact: true, path: `/plugins/${pluginId}`, component: ReleasesPage }),
|
|
1009
|
+
/* @__PURE__ */ jsx(Route, { exact: true, path: `/plugins/${pluginId}/:releaseId`, component: ReleaseDetailsPage })
|
|
1010
|
+
] }) });
|
|
851
1011
|
};
|
|
852
1012
|
export {
|
|
853
1013
|
App
|
|
854
1014
|
};
|
|
855
|
-
//# sourceMappingURL=App-
|
|
1015
|
+
//# sourceMappingURL=App-L1jSxCiL.mjs.map
|