@strapi/content-releases 0.0.0-experimental.e60ec1829240dae21c1e1d29076681c322288813 → 0.0.0-experimental.e8d8fc824d0f6a695b2a9ebaa4680ed21c3645ca
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-BsUSTHVD.mjs → App-CiZCkScI.mjs} +643 -428
- package/dist/_chunks/App-CiZCkScI.mjs.map +1 -0
- package/dist/_chunks/{App-CXRpb2hi.js → App-SGjO5UPV.js} +682 -470
- package/dist/_chunks/App-SGjO5UPV.js.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-Be3acS2L.js → PurchaseContentReleases--qQepXpP.js} +2 -2
- package/dist/_chunks/PurchaseContentReleases--qQepXpP.js.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-_MxP6-Dt.mjs → PurchaseContentReleases-D-n-w-st.mjs} +2 -2
- package/dist/_chunks/{PurchaseContentReleases-_MxP6-Dt.mjs.map → PurchaseContentReleases-D-n-w-st.mjs.map} +1 -1
- package/dist/_chunks/ReleasesSettingsPage-Cto_NLUd.js +178 -0
- package/dist/_chunks/ReleasesSettingsPage-Cto_NLUd.js.map +1 -0
- package/dist/_chunks/ReleasesSettingsPage-DQT8N3A-.mjs +178 -0
- package/dist/_chunks/ReleasesSettingsPage-DQT8N3A-.mjs.map +1 -0
- package/dist/_chunks/{en-DtFJ5ViE.js → en-BWPPsSH-.js} +18 -2
- package/dist/_chunks/en-BWPPsSH-.js.map +1 -0
- package/dist/_chunks/{en-B9Ur3VsE.mjs → en-D9Q4YW03.mjs} +18 -2
- package/dist/_chunks/en-D9Q4YW03.mjs.map +1 -0
- package/dist/_chunks/{index-DJLIZdZv.mjs → index-BjvFfTtA.mjs} +751 -605
- package/dist/_chunks/index-BjvFfTtA.mjs.map +1 -0
- package/dist/_chunks/{index-B6-lic1Q.js → index-CyU534vL.js} +739 -596
- package/dist/_chunks/index-CyU534vL.js.map +1 -0
- package/dist/_chunks/schemas-DBYv9gK8.js +61 -0
- package/dist/_chunks/schemas-DBYv9gK8.js.map +1 -0
- package/dist/_chunks/schemas-DdA2ic2U.mjs +44 -0
- package/dist/_chunks/schemas-DdA2ic2U.mjs.map +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +2 -2
- package/dist/admin/src/components/EntryValidationPopover.d.ts +13 -0
- package/dist/admin/src/components/ReleaseActionMenu.d.ts +3 -3
- package/dist/admin/src/components/{CMReleasesContainer.d.ts → ReleaseActionModal.d.ts} +3 -1
- package/dist/admin/src/components/ReleaseListCell.d.ts +28 -0
- package/dist/admin/src/components/ReleaseModal.d.ts +3 -2
- package/dist/admin/src/components/ReleasesPanel.d.ts +3 -0
- package/dist/admin/src/constants.d.ts +18 -0
- package/dist/admin/src/modules/hooks.d.ts +7 -0
- package/dist/admin/src/pages/ReleasesSettingsPage.d.ts +1 -0
- package/dist/admin/src/services/release.d.ts +53 -370
- package/dist/admin/src/utils/api.d.ts +6 -0
- package/dist/admin/src/utils/time.d.ts +9 -0
- package/dist/admin/src/validation/schemas.d.ts +6 -0
- package/dist/server/index.js +889 -614
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +889 -613
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/bootstrap.d.ts.map +1 -1
- package/dist/server/src/constants.d.ts +11 -2
- package/dist/server/src/constants.d.ts.map +1 -1
- package/dist/server/src/content-types/index.d.ts +3 -5
- package/dist/server/src/content-types/index.d.ts.map +1 -1
- package/dist/server/src/content-types/release-action/index.d.ts +3 -5
- package/dist/server/src/content-types/release-action/index.d.ts.map +1 -1
- package/dist/server/src/content-types/release-action/schema.d.ts +3 -5
- package/dist/server/src/content-types/release-action/schema.d.ts.map +1 -1
- package/dist/server/src/controllers/index.d.ts +6 -1
- package/dist/server/src/controllers/index.d.ts.map +1 -1
- package/dist/server/src/controllers/release-action.d.ts.map +1 -1
- package/dist/server/src/controllers/release.d.ts +7 -1
- package/dist/server/src/controllers/release.d.ts.map +1 -1
- package/dist/server/src/controllers/settings.d.ts +11 -0
- package/dist/server/src/controllers/settings.d.ts.map +1 -0
- package/dist/server/src/controllers/validation/release-action.d.ts +7 -1
- package/dist/server/src/controllers/validation/release-action.d.ts.map +1 -1
- package/dist/server/src/controllers/validation/release.d.ts +2 -0
- package/dist/server/src/controllers/validation/release.d.ts.map +1 -1
- package/dist/server/src/controllers/validation/settings.d.ts +3 -0
- package/dist/server/src/controllers/validation/settings.d.ts.map +1 -0
- package/dist/server/src/index.d.ts +64 -49
- package/dist/server/src/index.d.ts.map +1 -1
- package/dist/server/src/middlewares/documents.d.ts +6 -0
- package/dist/server/src/middlewares/documents.d.ts.map +1 -0
- package/dist/server/src/migrations/database/5.0.0-document-id-in-actions.d.ts +9 -0
- package/dist/server/src/migrations/database/5.0.0-document-id-in-actions.d.ts.map +1 -0
- package/dist/server/src/migrations/index.d.ts.map +1 -1
- package/dist/server/src/register.d.ts.map +1 -1
- package/dist/server/src/routes/index.d.ts +16 -0
- package/dist/server/src/routes/index.d.ts.map +1 -1
- package/dist/server/src/routes/release.d.ts.map +1 -1
- package/dist/server/src/routes/settings.d.ts +18 -0
- package/dist/server/src/routes/settings.d.ts.map +1 -0
- package/dist/server/src/services/index.d.ts +36 -38
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/server/src/services/release-action.d.ts +34 -0
- package/dist/server/src/services/release-action.d.ts.map +1 -0
- package/dist/server/src/services/release.d.ts +6 -41
- package/dist/server/src/services/release.d.ts.map +1 -1
- package/dist/server/src/services/settings.d.ts +13 -0
- package/dist/server/src/services/settings.d.ts.map +1 -0
- package/dist/server/src/services/validation.d.ts +1 -1
- package/dist/server/src/services/validation.d.ts.map +1 -1
- package/dist/server/src/utils/index.d.ts +29 -8
- package/dist/server/src/utils/index.d.ts.map +1 -1
- package/dist/shared/contracts/release-actions.d.ts +17 -11
- package/dist/shared/contracts/release-actions.d.ts.map +1 -1
- package/dist/shared/contracts/releases.d.ts +9 -7
- package/dist/shared/contracts/releases.d.ts.map +1 -1
- package/dist/shared/contracts/settings.d.ts +39 -0
- package/dist/shared/contracts/settings.d.ts.map +1 -0
- package/package.json +24 -23
- package/dist/_chunks/App-BsUSTHVD.mjs.map +0 -1
- package/dist/_chunks/App-CXRpb2hi.js.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-Be3acS2L.js.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-B6-lic1Q.js.map +0 -1
- package/dist/_chunks/index-DJLIZdZv.mjs.map +0 -1
- package/dist/admin/src/services/axios.d.ts +0 -29
- package/dist/shared/validation-schemas.d.ts +0 -2
- package/dist/shared/validation-schemas.d.ts.map +0 -1
- package/strapi-server.js +0 -3
|
@@ -1,21 +1,306 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useNotification, useAPIErrorHandler, useQueryParams, useTracking, useRBAC, Page, Layouts, Pagination, ConfirmDialog, BackButton, useStrapiApp, Table } from "@strapi/admin/strapi-admin";
|
|
3
|
-
import { useLocation, useNavigate, useParams, Navigate,
|
|
4
|
-
import { g as
|
|
1
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useNotification, useAPIErrorHandler, useQueryParams, useTracking, useRBAC, Page, Layouts, Pagination, isFetchError, ConfirmDialog, BackButton, useStrapiApp, Table } from "@strapi/admin/strapi-admin";
|
|
3
|
+
import { Link, useLocation, useNavigate, NavLink, useParams, Navigate, Routes, Route } from "react-router-dom";
|
|
4
|
+
import { g as getTimezones, p as pluginId, u as useGetReleasesQuery, a as useGetReleaseSettingsQuery, b as useCreateReleaseMutation, P as PERMISSIONS, c as useGetReleaseQuery, d as useUpdateReleaseMutation, e as useDeleteReleaseMutation, f as usePublishReleaseMutation, h as getTimezoneOffset, i as useGetReleaseActionsQuery, j as useUpdateReleaseActionMutation, R as ReleaseActionOptions, k as ReleaseActionMenu, r as releaseApi } from "./index-BjvFfTtA.mjs";
|
|
5
5
|
import * as React from "react";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { Plus, Pencil, Trash, More, CrossCircle, CheckCircle } from "@strapi/icons";
|
|
6
|
+
import { Flex, Popover, Button, Typography, LinkButton, Modal, Field, TextInput, Box, Checkbox, DatePicker, TimePicker, Combobox, ComboboxOption, Link as Link$1, Alert, Main, Tabs, Divider, EmptyStateLayout, Grid, Badge, MenuItem, SimpleMenu, Dialog, SingleSelect, SingleSelectOption, Tr, Td } from "@strapi/design-system";
|
|
7
|
+
import { CrossCircle, CaretDown, CheckCircle, ArrowsCounterClockwise, Plus, Pencil, Trash, More } from "@strapi/icons";
|
|
9
8
|
import { EmptyDocuments } from "@strapi/icons/symbols";
|
|
10
|
-
import format from "date-fns/format";
|
|
9
|
+
import format$1 from "date-fns/format";
|
|
11
10
|
import { utcToZonedTime, zonedTimeToUtc } from "date-fns-tz";
|
|
12
11
|
import { useIntl } from "react-intl";
|
|
13
|
-
import styled from "styled-components";
|
|
14
|
-
import {
|
|
12
|
+
import { styled } from "styled-components";
|
|
13
|
+
import { unstable_useDocument } from "@strapi/content-manager/strapi-admin";
|
|
14
|
+
import { stringify } from "qs";
|
|
15
|
+
import { intervalToDuration, isPast, formatISO, format } from "date-fns";
|
|
15
16
|
import { Formik, Form, useFormikContext } from "formik";
|
|
16
|
-
import
|
|
17
|
+
import { R as RELEASE_SCHEMA } from "./schemas-DdA2ic2U.mjs";
|
|
17
18
|
import { useDispatch } from "react-redux";
|
|
18
19
|
import { useLicenseLimits } from "@strapi/admin/strapi-admin/ee";
|
|
20
|
+
const StyledPopoverFlex = styled(Flex)`
|
|
21
|
+
width: 100%;
|
|
22
|
+
max-width: 256px;
|
|
23
|
+
|
|
24
|
+
& > * {
|
|
25
|
+
border-bottom: 1px solid ${({ theme }) => theme.colors.neutral150};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
& > *:last-child {
|
|
29
|
+
border-bottom: none;
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
32
|
+
const EntryStatusTrigger = ({
|
|
33
|
+
action,
|
|
34
|
+
status,
|
|
35
|
+
hasErrors,
|
|
36
|
+
requiredStage,
|
|
37
|
+
entryStage
|
|
38
|
+
}) => {
|
|
39
|
+
const { formatMessage } = useIntl();
|
|
40
|
+
if (action === "publish") {
|
|
41
|
+
if (hasErrors || requiredStage && requiredStage.id !== entryStage?.id) {
|
|
42
|
+
return /* @__PURE__ */ jsx(Popover.Trigger, { children: /* @__PURE__ */ jsx(
|
|
43
|
+
Button,
|
|
44
|
+
{
|
|
45
|
+
variant: "ghost",
|
|
46
|
+
startIcon: /* @__PURE__ */ jsx(CrossCircle, { fill: "danger600" }),
|
|
47
|
+
endIcon: /* @__PURE__ */ jsx(CaretDown, {}),
|
|
48
|
+
children: /* @__PURE__ */ jsx(Typography, { textColor: "danger600", variant: "omega", fontWeight: "bold", children: formatMessage({
|
|
49
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.not-ready",
|
|
50
|
+
defaultMessage: "Not ready to publish"
|
|
51
|
+
}) })
|
|
52
|
+
}
|
|
53
|
+
) });
|
|
54
|
+
}
|
|
55
|
+
if (status === "draft") {
|
|
56
|
+
return /* @__PURE__ */ jsx(Popover.Trigger, { children: /* @__PURE__ */ jsx(
|
|
57
|
+
Button,
|
|
58
|
+
{
|
|
59
|
+
variant: "ghost",
|
|
60
|
+
startIcon: /* @__PURE__ */ jsx(CheckCircle, { fill: "success600" }),
|
|
61
|
+
endIcon: /* @__PURE__ */ jsx(CaretDown, {}),
|
|
62
|
+
children: /* @__PURE__ */ jsx(Typography, { textColor: "success600", variant: "omega", fontWeight: "bold", children: formatMessage({
|
|
63
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.ready-to-publish",
|
|
64
|
+
defaultMessage: "Ready to publish"
|
|
65
|
+
}) })
|
|
66
|
+
}
|
|
67
|
+
) });
|
|
68
|
+
}
|
|
69
|
+
if (status === "modified") {
|
|
70
|
+
return /* @__PURE__ */ jsx(Popover.Trigger, { children: /* @__PURE__ */ jsx(
|
|
71
|
+
Button,
|
|
72
|
+
{
|
|
73
|
+
variant: "ghost",
|
|
74
|
+
startIcon: /* @__PURE__ */ jsx(ArrowsCounterClockwise, { fill: "alternative600" }),
|
|
75
|
+
endIcon: /* @__PURE__ */ jsx(CaretDown, {}),
|
|
76
|
+
children: /* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: "bold", textColor: "alternative600", children: formatMessage({
|
|
77
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.modified",
|
|
78
|
+
defaultMessage: "Ready to publish changes"
|
|
79
|
+
}) })
|
|
80
|
+
}
|
|
81
|
+
) });
|
|
82
|
+
}
|
|
83
|
+
return /* @__PURE__ */ jsx(Popover.Trigger, { children: /* @__PURE__ */ jsx(
|
|
84
|
+
Button,
|
|
85
|
+
{
|
|
86
|
+
variant: "ghost",
|
|
87
|
+
startIcon: /* @__PURE__ */ jsx(CheckCircle, { fill: "success600" }),
|
|
88
|
+
endIcon: /* @__PURE__ */ jsx(CaretDown, {}),
|
|
89
|
+
children: /* @__PURE__ */ jsx(Typography, { textColor: "success600", variant: "omega", fontWeight: "bold", children: formatMessage({
|
|
90
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.already-published",
|
|
91
|
+
defaultMessage: "Already published"
|
|
92
|
+
}) })
|
|
93
|
+
}
|
|
94
|
+
) });
|
|
95
|
+
}
|
|
96
|
+
if (status === "published") {
|
|
97
|
+
return /* @__PURE__ */ jsx(Popover.Trigger, { children: /* @__PURE__ */ jsx(
|
|
98
|
+
Button,
|
|
99
|
+
{
|
|
100
|
+
variant: "ghost",
|
|
101
|
+
startIcon: /* @__PURE__ */ jsx(CheckCircle, { fill: "success600" }),
|
|
102
|
+
endIcon: /* @__PURE__ */ jsx(CaretDown, {}),
|
|
103
|
+
children: /* @__PURE__ */ jsx(Typography, { textColor: "success600", variant: "omega", fontWeight: "bold", children: formatMessage({
|
|
104
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.ready-to-unpublish",
|
|
105
|
+
defaultMessage: "Ready to unpublish"
|
|
106
|
+
}) })
|
|
107
|
+
}
|
|
108
|
+
) });
|
|
109
|
+
}
|
|
110
|
+
return /* @__PURE__ */ jsx(Popover.Trigger, { children: /* @__PURE__ */ jsx(Button, { variant: "ghost", startIcon: /* @__PURE__ */ jsx(CheckCircle, { fill: "success600" }), endIcon: /* @__PURE__ */ jsx(CaretDown, {}), children: /* @__PURE__ */ jsx(Typography, { textColor: "success600", variant: "omega", fontWeight: "bold", children: formatMessage({
|
|
111
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.already-unpublished",
|
|
112
|
+
defaultMessage: "Already unpublished"
|
|
113
|
+
}) }) }) });
|
|
114
|
+
};
|
|
115
|
+
const FieldsValidation = ({
|
|
116
|
+
hasErrors,
|
|
117
|
+
errors,
|
|
118
|
+
kind,
|
|
119
|
+
contentTypeUid,
|
|
120
|
+
documentId,
|
|
121
|
+
locale
|
|
122
|
+
}) => {
|
|
123
|
+
const { formatMessage } = useIntl();
|
|
124
|
+
return /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 1, width: "100%", padding: 5, children: [
|
|
125
|
+
/* @__PURE__ */ jsxs(Flex, { gap: 2, width: "100%", children: [
|
|
126
|
+
/* @__PURE__ */ jsx(Typography, { fontWeight: "bold", children: formatMessage({
|
|
127
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.fields",
|
|
128
|
+
defaultMessage: "Fields"
|
|
129
|
+
}) }),
|
|
130
|
+
hasErrors ? /* @__PURE__ */ jsx(CrossCircle, { fill: "danger600" }) : /* @__PURE__ */ jsx(CheckCircle, { fill: "success600" })
|
|
131
|
+
] }),
|
|
132
|
+
/* @__PURE__ */ jsx(Typography, { width: "100%", textColor: "neutral600", children: hasErrors ? formatMessage(
|
|
133
|
+
{
|
|
134
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.fields.error",
|
|
135
|
+
defaultMessage: "{errors} errors on fields."
|
|
136
|
+
},
|
|
137
|
+
{ errors: errors ? Object.keys(errors).length : 0 }
|
|
138
|
+
) : formatMessage({
|
|
139
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.fields.success",
|
|
140
|
+
defaultMessage: "All fields are filled correctly."
|
|
141
|
+
}) }),
|
|
142
|
+
hasErrors && /* @__PURE__ */ jsx(
|
|
143
|
+
LinkButton,
|
|
144
|
+
{
|
|
145
|
+
tag: Link,
|
|
146
|
+
to: {
|
|
147
|
+
pathname: `/content-manager/${kind === "collectionType" ? "collection-types" : "single-types"}/${contentTypeUid}/${documentId}`,
|
|
148
|
+
search: locale ? stringify({
|
|
149
|
+
plugins: {
|
|
150
|
+
i18n: {
|
|
151
|
+
locale
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}) : ""
|
|
155
|
+
},
|
|
156
|
+
variant: "secondary",
|
|
157
|
+
fullWidth: true,
|
|
158
|
+
state: { forceValidation: true },
|
|
159
|
+
children: formatMessage({
|
|
160
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.fields.see-errors",
|
|
161
|
+
defaultMessage: "See errors"
|
|
162
|
+
})
|
|
163
|
+
}
|
|
164
|
+
)
|
|
165
|
+
] });
|
|
166
|
+
};
|
|
167
|
+
const getReviewStageIcon = ({
|
|
168
|
+
contentTypeHasReviewWorkflow,
|
|
169
|
+
requiredStage,
|
|
170
|
+
entryStage
|
|
171
|
+
}) => {
|
|
172
|
+
if (!contentTypeHasReviewWorkflow) {
|
|
173
|
+
return /* @__PURE__ */ jsx(CheckCircle, { fill: "neutral200" });
|
|
174
|
+
}
|
|
175
|
+
if (requiredStage && requiredStage.id !== entryStage?.id) {
|
|
176
|
+
return /* @__PURE__ */ jsx(CrossCircle, { fill: "danger600" });
|
|
177
|
+
}
|
|
178
|
+
return /* @__PURE__ */ jsx(CheckCircle, { fill: "success600" });
|
|
179
|
+
};
|
|
180
|
+
const getReviewStageMessage = ({
|
|
181
|
+
contentTypeHasReviewWorkflow,
|
|
182
|
+
requiredStage,
|
|
183
|
+
entryStage,
|
|
184
|
+
formatMessage
|
|
185
|
+
}) => {
|
|
186
|
+
if (!contentTypeHasReviewWorkflow) {
|
|
187
|
+
return formatMessage({
|
|
188
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.review-stage.not-enabled",
|
|
189
|
+
defaultMessage: "This entry is not associated to any workflow."
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
if (requiredStage && requiredStage.id !== entryStage?.id) {
|
|
193
|
+
return formatMessage(
|
|
194
|
+
{
|
|
195
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.review-stage.not-ready",
|
|
196
|
+
defaultMessage: "This entry is not at the required stage for publishing. ({stageName})"
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
stageName: requiredStage?.name ?? ""
|
|
200
|
+
}
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
if (requiredStage && requiredStage.id === entryStage?.id) {
|
|
204
|
+
return formatMessage(
|
|
205
|
+
{
|
|
206
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.review-stage.ready",
|
|
207
|
+
defaultMessage: "This entry is at the required stage for publishing. ({stageName})"
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
stageName: requiredStage?.name ?? ""
|
|
211
|
+
}
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
return formatMessage({
|
|
215
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.review-stage.stage-not-required",
|
|
216
|
+
defaultMessage: "No required stage for publication"
|
|
217
|
+
});
|
|
218
|
+
};
|
|
219
|
+
const ReviewStageValidation = ({
|
|
220
|
+
contentTypeHasReviewWorkflow,
|
|
221
|
+
requiredStage,
|
|
222
|
+
entryStage
|
|
223
|
+
}) => {
|
|
224
|
+
const { formatMessage } = useIntl();
|
|
225
|
+
const Icon = getReviewStageIcon({
|
|
226
|
+
contentTypeHasReviewWorkflow,
|
|
227
|
+
requiredStage,
|
|
228
|
+
entryStage
|
|
229
|
+
});
|
|
230
|
+
return /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 1, width: "100%", padding: 5, children: [
|
|
231
|
+
/* @__PURE__ */ jsxs(Flex, { gap: 2, width: "100%", children: [
|
|
232
|
+
/* @__PURE__ */ jsx(Typography, { fontWeight: "bold", children: formatMessage({
|
|
233
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.review-stage",
|
|
234
|
+
defaultMessage: "Review stage"
|
|
235
|
+
}) }),
|
|
236
|
+
Icon
|
|
237
|
+
] }),
|
|
238
|
+
/* @__PURE__ */ jsx(Typography, { textColor: "neutral600", children: getReviewStageMessage({
|
|
239
|
+
contentTypeHasReviewWorkflow,
|
|
240
|
+
requiredStage,
|
|
241
|
+
entryStage,
|
|
242
|
+
formatMessage
|
|
243
|
+
}) })
|
|
244
|
+
] });
|
|
245
|
+
};
|
|
246
|
+
const EntryValidationPopover = ({
|
|
247
|
+
schema,
|
|
248
|
+
entry,
|
|
249
|
+
status,
|
|
250
|
+
action
|
|
251
|
+
}) => {
|
|
252
|
+
const { validate, isLoading } = unstable_useDocument(
|
|
253
|
+
{
|
|
254
|
+
collectionType: schema?.kind ?? "",
|
|
255
|
+
model: schema?.uid ?? ""
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
// useDocument makes a request to get more data about the entry, but we only want to have the validation function so we skip the request
|
|
259
|
+
skip: true
|
|
260
|
+
}
|
|
261
|
+
);
|
|
262
|
+
const errors = isLoading ? null : validate(entry);
|
|
263
|
+
const hasErrors = errors ? Object.keys(errors).length > 0 : false;
|
|
264
|
+
const contentTypeHasReviewWorkflow = schema?.hasReviewWorkflow ?? false;
|
|
265
|
+
const requiredStage = schema?.stageRequiredToPublish;
|
|
266
|
+
const entryStage = entry.strapi_stage;
|
|
267
|
+
if (isLoading) {
|
|
268
|
+
return null;
|
|
269
|
+
}
|
|
270
|
+
return /* @__PURE__ */ jsxs(Popover.Root, { children: [
|
|
271
|
+
/* @__PURE__ */ jsx(
|
|
272
|
+
EntryStatusTrigger,
|
|
273
|
+
{
|
|
274
|
+
action,
|
|
275
|
+
status,
|
|
276
|
+
hasErrors,
|
|
277
|
+
requiredStage,
|
|
278
|
+
entryStage
|
|
279
|
+
}
|
|
280
|
+
),
|
|
281
|
+
/* @__PURE__ */ jsx(Popover.Content, { children: /* @__PURE__ */ jsxs(StyledPopoverFlex, { direction: "column", children: [
|
|
282
|
+
/* @__PURE__ */ jsx(
|
|
283
|
+
FieldsValidation,
|
|
284
|
+
{
|
|
285
|
+
hasErrors,
|
|
286
|
+
errors,
|
|
287
|
+
contentTypeUid: schema?.uid,
|
|
288
|
+
kind: schema?.kind,
|
|
289
|
+
documentId: entry.documentId,
|
|
290
|
+
locale: entry.locale
|
|
291
|
+
}
|
|
292
|
+
),
|
|
293
|
+
/* @__PURE__ */ jsx(
|
|
294
|
+
ReviewStageValidation,
|
|
295
|
+
{
|
|
296
|
+
contentTypeHasReviewWorkflow,
|
|
297
|
+
requiredStage,
|
|
298
|
+
entryStage
|
|
299
|
+
}
|
|
300
|
+
)
|
|
301
|
+
] }) })
|
|
302
|
+
] });
|
|
303
|
+
};
|
|
19
304
|
const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
|
|
20
305
|
const RelativeTime$1 = React.forwardRef(
|
|
21
306
|
({ timestamp, customIntervals = [], ...restProps }, forwardedRef) => {
|
|
@@ -46,28 +331,9 @@ const RelativeTime$1 = React.forwardRef(
|
|
|
46
331
|
);
|
|
47
332
|
}
|
|
48
333
|
);
|
|
49
|
-
const RELEASE_SCHEMA = yup.object().shape({
|
|
50
|
-
name: yup.string().trim().required(),
|
|
51
|
-
scheduledAt: yup.string().nullable(),
|
|
52
|
-
isScheduled: yup.boolean().optional(),
|
|
53
|
-
time: yup.string().when("isScheduled", {
|
|
54
|
-
is: true,
|
|
55
|
-
then: yup.string().trim().required(),
|
|
56
|
-
otherwise: yup.string().nullable()
|
|
57
|
-
}),
|
|
58
|
-
timezone: yup.string().when("isScheduled", {
|
|
59
|
-
is: true,
|
|
60
|
-
then: yup.string().required().nullable(),
|
|
61
|
-
otherwise: yup.string().nullable()
|
|
62
|
-
}),
|
|
63
|
-
date: yup.string().when("isScheduled", {
|
|
64
|
-
is: true,
|
|
65
|
-
then: yup.string().required().nullable(),
|
|
66
|
-
otherwise: yup.string().nullable()
|
|
67
|
-
})
|
|
68
|
-
}).required().noUnknown();
|
|
69
334
|
const ReleaseModal = ({
|
|
70
335
|
handleClose,
|
|
336
|
+
open,
|
|
71
337
|
handleSubmit,
|
|
72
338
|
initialValues,
|
|
73
339
|
isLoading = false
|
|
@@ -80,8 +346,7 @@ const ReleaseModal = ({
|
|
|
80
346
|
);
|
|
81
347
|
const getScheduledTimestamp = (values) => {
|
|
82
348
|
const { date, time, timezone } = values;
|
|
83
|
-
if (!date || !time || !timezone)
|
|
84
|
-
return null;
|
|
349
|
+
if (!date || !time || !timezone) return null;
|
|
85
350
|
const timezoneWithoutOffset = timezone.split("&")[1];
|
|
86
351
|
return zonedTimeToUtc(`${date} ${time}`, timezoneWithoutOffset);
|
|
87
352
|
};
|
|
@@ -91,8 +356,8 @@ const ReleaseModal = ({
|
|
|
91
356
|
);
|
|
92
357
|
return currentTimezone?.value || systemTimezone.value;
|
|
93
358
|
};
|
|
94
|
-
return /* @__PURE__ */
|
|
95
|
-
/* @__PURE__ */ jsx(
|
|
359
|
+
return /* @__PURE__ */ jsx(Modal.Root, { open, onOpenChange: handleClose, children: /* @__PURE__ */ jsxs(Modal.Content, { children: [
|
|
360
|
+
/* @__PURE__ */ jsx(Modal.Header, { children: /* @__PURE__ */ jsx(Modal.Title, { children: formatMessage(
|
|
96
361
|
{
|
|
97
362
|
id: "content-releases.modal.title",
|
|
98
363
|
defaultMessage: "{isCreatingRelease, select, true {New release} other {Edit release}}"
|
|
@@ -115,133 +380,143 @@ const ReleaseModal = ({
|
|
|
115
380
|
},
|
|
116
381
|
validationSchema: RELEASE_SCHEMA,
|
|
117
382
|
validateOnChange: false,
|
|
118
|
-
children: ({ values, errors, handleChange, setFieldValue }) =>
|
|
119
|
-
|
|
120
|
-
/* @__PURE__ */ jsx(
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
defaultMessage:
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
setFieldValue("
|
|
144
|
-
|
|
145
|
-
} else {
|
|
146
|
-
setFieldValue("date", initialValues.date);
|
|
147
|
-
setFieldValue("time", initialValues.time);
|
|
148
|
-
setFieldValue("timezone", initialValues.timezone ?? systemTimezone?.value);
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
children: /* @__PURE__ */ jsx(
|
|
152
|
-
Typography,
|
|
153
|
-
{
|
|
154
|
-
textColor: values.isScheduled ? "primary600" : "neutral800",
|
|
155
|
-
fontWeight: values.isScheduled ? "semiBold" : "regular",
|
|
156
|
-
children: formatMessage({
|
|
157
|
-
id: "modal.form.input.label.schedule-release",
|
|
158
|
-
defaultMessage: "Schedule release"
|
|
159
|
-
})
|
|
160
|
-
}
|
|
161
|
-
)
|
|
162
|
-
}
|
|
163
|
-
) }),
|
|
164
|
-
values.isScheduled && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
165
|
-
/* @__PURE__ */ jsxs(Flex, { gap: 4, alignItems: "start", children: [
|
|
166
|
-
/* @__PURE__ */ jsx(Box, { width: "100%", children: /* @__PURE__ */ jsx(
|
|
167
|
-
DatePicker,
|
|
168
|
-
{
|
|
169
|
-
label: formatMessage({
|
|
170
|
-
id: "content-releases.modal.form.input.label.date",
|
|
171
|
-
defaultMessage: "Date"
|
|
172
|
-
}),
|
|
173
|
-
name: "date",
|
|
174
|
-
error: errors.date,
|
|
175
|
-
onChange: (date) => {
|
|
176
|
-
const isoFormatDate = date ? formatISO(date, { representation: "date" }) : null;
|
|
177
|
-
setFieldValue("date", isoFormatDate);
|
|
178
|
-
},
|
|
179
|
-
clearLabel: formatMessage({
|
|
180
|
-
id: "content-releases.modal.form.input.clearLabel",
|
|
181
|
-
defaultMessage: "Clear"
|
|
182
|
-
}),
|
|
183
|
-
onClear: () => {
|
|
383
|
+
children: ({ values, errors, handleChange, setFieldValue }) => {
|
|
384
|
+
return /* @__PURE__ */ jsxs(Form, { children: [
|
|
385
|
+
/* @__PURE__ */ jsx(Modal.Body, { children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
|
|
386
|
+
/* @__PURE__ */ jsxs(
|
|
387
|
+
Field.Root,
|
|
388
|
+
{
|
|
389
|
+
name: "name",
|
|
390
|
+
error: errors.name && formatMessage({ id: errors.name, defaultMessage: errors.name }),
|
|
391
|
+
required: true,
|
|
392
|
+
children: [
|
|
393
|
+
/* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
|
|
394
|
+
id: "content-releases.modal.form.input.label.release-name",
|
|
395
|
+
defaultMessage: "Name"
|
|
396
|
+
}) }),
|
|
397
|
+
/* @__PURE__ */ jsx(TextInput, { value: values.name, onChange: handleChange }),
|
|
398
|
+
/* @__PURE__ */ jsx(Field.Error, {})
|
|
399
|
+
]
|
|
400
|
+
}
|
|
401
|
+
),
|
|
402
|
+
/* @__PURE__ */ jsx(Box, { width: "max-content", children: /* @__PURE__ */ jsx(
|
|
403
|
+
Checkbox,
|
|
404
|
+
{
|
|
405
|
+
name: "isScheduled",
|
|
406
|
+
checked: values.isScheduled,
|
|
407
|
+
onCheckedChange: (checked) => {
|
|
408
|
+
setFieldValue("isScheduled", checked);
|
|
409
|
+
if (!checked) {
|
|
184
410
|
setFieldValue("date", null);
|
|
185
|
-
},
|
|
186
|
-
selectedDate: values.date || void 0,
|
|
187
|
-
required: true,
|
|
188
|
-
minDate: utcToZonedTime(/* @__PURE__ */ new Date(), values.timezone.split("&")[1])
|
|
189
|
-
}
|
|
190
|
-
) }),
|
|
191
|
-
/* @__PURE__ */ jsx(Box, { width: "100%", children: /* @__PURE__ */ jsx(
|
|
192
|
-
TimePicker,
|
|
193
|
-
{
|
|
194
|
-
label: formatMessage({
|
|
195
|
-
id: "content-releases.modal.form.input.label.time",
|
|
196
|
-
defaultMessage: "Time"
|
|
197
|
-
}),
|
|
198
|
-
name: "time",
|
|
199
|
-
error: errors.time,
|
|
200
|
-
onChange: (time) => {
|
|
201
|
-
setFieldValue("time", time);
|
|
202
|
-
},
|
|
203
|
-
clearLabel: formatMessage({
|
|
204
|
-
id: "content-releases.modal.form.input.clearLabel",
|
|
205
|
-
defaultMessage: "Clear"
|
|
206
|
-
}),
|
|
207
|
-
onClear: () => {
|
|
208
411
|
setFieldValue("time", "");
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
412
|
+
setFieldValue("timezone", null);
|
|
413
|
+
} else {
|
|
414
|
+
setFieldValue("date", initialValues.date);
|
|
415
|
+
setFieldValue("time", initialValues.time);
|
|
416
|
+
setFieldValue(
|
|
417
|
+
"timezone",
|
|
418
|
+
initialValues.timezone ?? systemTimezone?.value
|
|
419
|
+
);
|
|
420
|
+
}
|
|
421
|
+
},
|
|
422
|
+
children: /* @__PURE__ */ jsx(
|
|
423
|
+
Typography,
|
|
424
|
+
{
|
|
425
|
+
textColor: values.isScheduled ? "primary600" : "neutral800",
|
|
426
|
+
fontWeight: values.isScheduled ? "semiBold" : "regular",
|
|
427
|
+
children: formatMessage({
|
|
428
|
+
id: "modal.form.input.label.schedule-release",
|
|
429
|
+
defaultMessage: "Schedule release"
|
|
430
|
+
})
|
|
431
|
+
}
|
|
432
|
+
)
|
|
433
|
+
}
|
|
434
|
+
) }),
|
|
435
|
+
values.isScheduled && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
436
|
+
/* @__PURE__ */ jsxs(Flex, { gap: 4, alignItems: "start", children: [
|
|
437
|
+
/* @__PURE__ */ jsx(Box, { width: "100%", children: /* @__PURE__ */ jsxs(
|
|
438
|
+
Field.Root,
|
|
439
|
+
{
|
|
440
|
+
name: "date",
|
|
441
|
+
error: errors.date && formatMessage({ id: errors.date, defaultMessage: errors.date }),
|
|
442
|
+
required: true,
|
|
443
|
+
children: [
|
|
444
|
+
/* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
|
|
445
|
+
id: "content-releases.modal.form.input.label.date",
|
|
446
|
+
defaultMessage: "Date"
|
|
447
|
+
}) }),
|
|
448
|
+
/* @__PURE__ */ jsx(
|
|
449
|
+
DatePicker,
|
|
450
|
+
{
|
|
451
|
+
onChange: (date) => {
|
|
452
|
+
const isoFormatDate = date ? formatISO(date, { representation: "date" }) : null;
|
|
453
|
+
setFieldValue("date", isoFormatDate);
|
|
454
|
+
},
|
|
455
|
+
clearLabel: formatMessage({
|
|
456
|
+
id: "content-releases.modal.form.input.clearLabel",
|
|
457
|
+
defaultMessage: "Clear"
|
|
458
|
+
}),
|
|
459
|
+
onClear: () => {
|
|
460
|
+
setFieldValue("date", null);
|
|
461
|
+
},
|
|
462
|
+
value: values.date ? new Date(values.date) : /* @__PURE__ */ new Date(),
|
|
463
|
+
minDate: utcToZonedTime(/* @__PURE__ */ new Date(), values.timezone.split("&")[1])
|
|
464
|
+
}
|
|
465
|
+
),
|
|
466
|
+
/* @__PURE__ */ jsx(Field.Error, {})
|
|
467
|
+
]
|
|
468
|
+
}
|
|
469
|
+
) }),
|
|
470
|
+
/* @__PURE__ */ jsx(Box, { width: "100%", children: /* @__PURE__ */ jsxs(
|
|
471
|
+
Field.Root,
|
|
472
|
+
{
|
|
473
|
+
name: "time",
|
|
474
|
+
error: errors.time && formatMessage({ id: errors.time, defaultMessage: errors.time }),
|
|
475
|
+
required: true,
|
|
476
|
+
children: [
|
|
477
|
+
/* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
|
|
478
|
+
id: "content-releases.modal.form.input.label.time",
|
|
479
|
+
defaultMessage: "Time"
|
|
480
|
+
}) }),
|
|
481
|
+
/* @__PURE__ */ jsx(
|
|
482
|
+
TimePicker,
|
|
483
|
+
{
|
|
484
|
+
onChange: (time) => {
|
|
485
|
+
setFieldValue("time", time);
|
|
486
|
+
},
|
|
487
|
+
clearLabel: formatMessage({
|
|
488
|
+
id: "content-releases.modal.form.input.clearLabel",
|
|
489
|
+
defaultMessage: "Clear"
|
|
490
|
+
}),
|
|
491
|
+
onClear: () => {
|
|
492
|
+
setFieldValue("time", "");
|
|
493
|
+
},
|
|
494
|
+
value: values.time || void 0
|
|
495
|
+
}
|
|
496
|
+
),
|
|
497
|
+
/* @__PURE__ */ jsx(Field.Error, {})
|
|
498
|
+
]
|
|
499
|
+
}
|
|
500
|
+
) })
|
|
501
|
+
] }),
|
|
502
|
+
/* @__PURE__ */ jsx(TimezoneComponent, { timezoneOptions: timezoneList })
|
|
503
|
+
] })
|
|
504
|
+
] }) }),
|
|
505
|
+
/* @__PURE__ */ jsxs(Modal.Footer, { children: [
|
|
506
|
+
/* @__PURE__ */ jsx(Modal.Close, { children: /* @__PURE__ */ jsx(Button, { variant: "tertiary", name: "cancel", children: formatMessage({ id: "cancel", defaultMessage: "Cancel" }) }) }),
|
|
507
|
+
/* @__PURE__ */ jsx(Button, { name: "submit", loading: isLoading, type: "submit", children: formatMessage(
|
|
223
508
|
{
|
|
224
509
|
id: "content-releases.modal.form.button.submit",
|
|
225
510
|
defaultMessage: "{isCreatingRelease, select, true {Continue} other {Save}}"
|
|
226
511
|
},
|
|
227
512
|
{ isCreatingRelease }
|
|
228
513
|
) })
|
|
229
|
-
}
|
|
230
|
-
)
|
|
231
|
-
|
|
514
|
+
] })
|
|
515
|
+
] });
|
|
516
|
+
}
|
|
232
517
|
}
|
|
233
518
|
)
|
|
234
|
-
] });
|
|
235
|
-
};
|
|
236
|
-
const getTimezones = (selectedDate) => {
|
|
237
|
-
const timezoneList = Intl.supportedValuesOf("timeZone").map((timezone) => {
|
|
238
|
-
const utcOffset = getTimezoneOffset(timezone, selectedDate);
|
|
239
|
-
return { offset: utcOffset, value: `${utcOffset}&${timezone}` };
|
|
240
|
-
});
|
|
241
|
-
const systemTimezone = timezoneList.find(
|
|
242
|
-
(timezone) => timezone.value.split("&")[1] === Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
243
|
-
);
|
|
244
|
-
return { timezoneList, systemTimezone };
|
|
519
|
+
] }) });
|
|
245
520
|
};
|
|
246
521
|
const TimezoneComponent = ({ timezoneOptions }) => {
|
|
247
522
|
const { values, errors, setFieldValue } = useFormikContext();
|
|
@@ -257,34 +532,45 @@ const TimezoneComponent = ({ timezoneOptions }) => {
|
|
|
257
532
|
}
|
|
258
533
|
}
|
|
259
534
|
}, [setFieldValue, values.date, values.timezone]);
|
|
260
|
-
return /* @__PURE__ */
|
|
261
|
-
|
|
535
|
+
return /* @__PURE__ */ jsxs(
|
|
536
|
+
Field.Root,
|
|
262
537
|
{
|
|
263
|
-
label: formatMessage({
|
|
264
|
-
id: "content-releases.modal.form.input.label.timezone",
|
|
265
|
-
defaultMessage: "Timezone"
|
|
266
|
-
}),
|
|
267
|
-
autocomplete: { type: "list", filter: "contains" },
|
|
268
538
|
name: "timezone",
|
|
269
|
-
|
|
270
|
-
textValue: values.timezone ? values.timezone.replace(/&/, " ") : void 0,
|
|
271
|
-
onChange: (timezone) => {
|
|
272
|
-
setFieldValue("timezone", timezone);
|
|
273
|
-
},
|
|
274
|
-
onTextValueChange: (timezone) => {
|
|
275
|
-
setFieldValue("timezone", timezone);
|
|
276
|
-
},
|
|
277
|
-
onClear: () => {
|
|
278
|
-
setFieldValue("timezone", "");
|
|
279
|
-
},
|
|
280
|
-
error: errors.timezone,
|
|
539
|
+
error: errors.timezone && formatMessage({ id: errors.timezone, defaultMessage: errors.timezone }),
|
|
281
540
|
required: true,
|
|
282
|
-
children:
|
|
541
|
+
children: [
|
|
542
|
+
/* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
|
|
543
|
+
id: "content-releases.modal.form.input.label.timezone",
|
|
544
|
+
defaultMessage: "Timezone"
|
|
545
|
+
}) }),
|
|
546
|
+
/* @__PURE__ */ jsx(
|
|
547
|
+
Combobox,
|
|
548
|
+
{
|
|
549
|
+
autocomplete: { type: "list", filter: "contains" },
|
|
550
|
+
value: values.timezone || void 0,
|
|
551
|
+
textValue: values.timezone ? values.timezone.replace(/&/, " ") : void 0,
|
|
552
|
+
onChange: (timezone) => {
|
|
553
|
+
setFieldValue("timezone", timezone);
|
|
554
|
+
},
|
|
555
|
+
onTextValueChange: (timezone) => {
|
|
556
|
+
setFieldValue("timezone", timezone);
|
|
557
|
+
},
|
|
558
|
+
onClear: () => {
|
|
559
|
+
setFieldValue("timezone", "");
|
|
560
|
+
},
|
|
561
|
+
children: timezoneList.map((timezone) => /* @__PURE__ */ jsx(ComboboxOption, { value: timezone.value, children: timezone.value.replace(/&/, " ") }, timezone.value))
|
|
562
|
+
}
|
|
563
|
+
),
|
|
564
|
+
/* @__PURE__ */ jsx(Field.Error, {})
|
|
565
|
+
]
|
|
283
566
|
}
|
|
284
567
|
);
|
|
285
568
|
};
|
|
286
569
|
const useTypedDispatch = useDispatch;
|
|
287
|
-
const
|
|
570
|
+
const isBaseQueryError = (error) => {
|
|
571
|
+
return typeof error !== "undefined" && error.name !== void 0;
|
|
572
|
+
};
|
|
573
|
+
const LinkCard = styled(Link$1)`
|
|
288
574
|
display: block;
|
|
289
575
|
`;
|
|
290
576
|
const RelativeTime = styled(RelativeTime$1)`
|
|
@@ -340,7 +626,7 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
340
626
|
}
|
|
341
627
|
);
|
|
342
628
|
}
|
|
343
|
-
return /* @__PURE__ */ jsx(Grid, { gap: 4, children: releases.map(({ id, name, scheduledAt, status }) => /* @__PURE__ */ jsx(
|
|
629
|
+
return /* @__PURE__ */ jsx(Grid.Root, { gap: 4, children: releases.map(({ id, name, scheduledAt, status }) => /* @__PURE__ */ jsx(Grid.Item, { col: 3, s: 6, xs: 12, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsx(LinkCard, { tag: NavLink, to: `${id}`, isExternal: false, children: /* @__PURE__ */ jsxs(
|
|
344
630
|
Flex,
|
|
345
631
|
{
|
|
346
632
|
direction: "column",
|
|
@@ -355,7 +641,7 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
355
641
|
gap: 4,
|
|
356
642
|
children: [
|
|
357
643
|
/* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "start", gap: 1, children: [
|
|
358
|
-
/* @__PURE__ */ jsx(Typography, {
|
|
644
|
+
/* @__PURE__ */ jsx(Typography, { textColor: "neutral800", tag: "h3", variant: "delta", fontWeight: "bold", children: name }),
|
|
359
645
|
/* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", children: scheduledAt ? /* @__PURE__ */ jsx(RelativeTime, { timestamp: new Date(scheduledAt) }) : formatMessage({
|
|
360
646
|
id: "content-releases.pages.Releases.not-scheduled",
|
|
361
647
|
defaultMessage: "Not scheduled"
|
|
@@ -376,14 +662,13 @@ const StyledAlert = styled(Alert)`
|
|
|
376
662
|
`;
|
|
377
663
|
const INITIAL_FORM_VALUES = {
|
|
378
664
|
name: "",
|
|
379
|
-
date:
|
|
665
|
+
date: format(/* @__PURE__ */ new Date(), "yyyy-MM-dd"),
|
|
380
666
|
time: "",
|
|
381
667
|
isScheduled: true,
|
|
382
668
|
scheduledAt: null,
|
|
383
669
|
timezone: null
|
|
384
670
|
};
|
|
385
671
|
const ReleasesPage = () => {
|
|
386
|
-
const tabRef = React.useRef(null);
|
|
387
672
|
const location = useLocation();
|
|
388
673
|
const [releaseModalShown, setReleaseModalShown] = React.useState(false);
|
|
389
674
|
const { toggleNotification } = useNotification();
|
|
@@ -392,6 +677,7 @@ const ReleasesPage = () => {
|
|
|
392
677
|
const { formatAPIError } = useAPIErrorHandler();
|
|
393
678
|
const [{ query }, setQuery] = useQueryParams();
|
|
394
679
|
const response = useGetReleasesQuery(query);
|
|
680
|
+
const { data, isLoading: isLoadingSettings } = useGetReleaseSettingsQuery();
|
|
395
681
|
const [createRelease, { isLoading: isSubmittingForm }] = useCreateReleaseMutation();
|
|
396
682
|
const { getFeature } = useLicenseLimits();
|
|
397
683
|
const { maximumReleases = 3 } = getFeature("cms-content-releases");
|
|
@@ -399,9 +685,8 @@ const ReleasesPage = () => {
|
|
|
399
685
|
const {
|
|
400
686
|
allowedActions: { canCreate }
|
|
401
687
|
} = useRBAC(PERMISSIONS);
|
|
402
|
-
const { isLoading, isSuccess, isError } = response;
|
|
688
|
+
const { isLoading: isLoadingReleases, isSuccess, isError } = response;
|
|
403
689
|
const activeTab = response?.currentData?.meta?.activeTab || "pending";
|
|
404
|
-
const activeTabIndex = ["pending", "done"].indexOf(activeTab);
|
|
405
690
|
React.useEffect(() => {
|
|
406
691
|
if (location?.state?.errors) {
|
|
407
692
|
toggleNotification({
|
|
@@ -418,27 +703,22 @@ const ReleasesPage = () => {
|
|
|
418
703
|
navigate("", { replace: true, state: null });
|
|
419
704
|
}
|
|
420
705
|
}, [formatMessage, location?.state?.errors, navigate, toggleNotification]);
|
|
421
|
-
React.useEffect(() => {
|
|
422
|
-
if (tabRef.current) {
|
|
423
|
-
tabRef.current._handlers.setSelectedTabIndex(activeTabIndex);
|
|
424
|
-
}
|
|
425
|
-
}, [activeTabIndex]);
|
|
426
706
|
const toggleAddReleaseModal = () => {
|
|
427
707
|
setReleaseModalShown((prev) => !prev);
|
|
428
708
|
};
|
|
429
|
-
if (
|
|
709
|
+
if (isLoadingReleases || isLoadingSettings) {
|
|
430
710
|
return /* @__PURE__ */ jsx(Page.Loading, {});
|
|
431
711
|
}
|
|
432
712
|
const totalPendingReleases = isSuccess && response.currentData?.meta?.pendingReleasesCount || 0;
|
|
433
713
|
const hasReachedMaximumPendingReleases = totalPendingReleases >= maximumReleases;
|
|
434
|
-
const handleTabChange = (
|
|
714
|
+
const handleTabChange = (tabValue) => {
|
|
435
715
|
setQuery({
|
|
436
716
|
...query,
|
|
437
717
|
page: 1,
|
|
438
718
|
pageSize: response?.currentData?.meta?.pagination?.pageSize || 16,
|
|
439
719
|
filters: {
|
|
440
720
|
releasedAt: {
|
|
441
|
-
$notNull:
|
|
721
|
+
$notNull: tabValue !== "pending"
|
|
442
722
|
}
|
|
443
723
|
}
|
|
444
724
|
});
|
|
@@ -459,7 +739,7 @@ const ReleasesPage = () => {
|
|
|
459
739
|
});
|
|
460
740
|
trackUsage("didCreateRelease");
|
|
461
741
|
navigate(response2.data.data.id.toString());
|
|
462
|
-
} else if (
|
|
742
|
+
} else if (isFetchError(response2.error)) {
|
|
463
743
|
toggleNotification({
|
|
464
744
|
type: "danger",
|
|
465
745
|
message: formatAPIError(response2.error)
|
|
@@ -471,7 +751,7 @@ const ReleasesPage = () => {
|
|
|
471
751
|
});
|
|
472
752
|
}
|
|
473
753
|
};
|
|
474
|
-
return /* @__PURE__ */ jsxs(Main, { "aria-busy":
|
|
754
|
+
return /* @__PURE__ */ jsxs(Main, { "aria-busy": isLoadingReleases || isLoadingSettings, children: [
|
|
475
755
|
/* @__PURE__ */ jsx(
|
|
476
756
|
Layouts.Header,
|
|
477
757
|
{
|
|
@@ -502,7 +782,7 @@ const ReleasesPage = () => {
|
|
|
502
782
|
StyledAlert,
|
|
503
783
|
{
|
|
504
784
|
marginBottom: 6,
|
|
505
|
-
action: /* @__PURE__ */ jsx(Link, { href: "https://strapi.io/pricing-cloud", isExternal: true, children: formatMessage({
|
|
785
|
+
action: /* @__PURE__ */ jsx(Link$1, { href: "https://strapi.io/pricing-cloud", isExternal: true, children: formatMessage({
|
|
506
786
|
id: "content-releases.pages.Releases.max-limit-reached.action",
|
|
507
787
|
defaultMessage: "Explore plans"
|
|
508
788
|
}) }),
|
|
@@ -522,21 +802,17 @@ const ReleasesPage = () => {
|
|
|
522
802
|
})
|
|
523
803
|
}
|
|
524
804
|
),
|
|
525
|
-
/* @__PURE__ */ jsxs(
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
children: [
|
|
537
|
-
/* @__PURE__ */ jsxs(Box, { paddingBottom: 8, children: [
|
|
538
|
-
/* @__PURE__ */ jsxs(Tabs, { children: [
|
|
539
|
-
/* @__PURE__ */ jsx(Tab, { children: formatMessage(
|
|
805
|
+
/* @__PURE__ */ jsxs(Tabs.Root, { variant: "simple", onValueChange: handleTabChange, value: activeTab, children: [
|
|
806
|
+
/* @__PURE__ */ jsxs(Box, { paddingBottom: 8, children: [
|
|
807
|
+
/* @__PURE__ */ jsxs(
|
|
808
|
+
Tabs.List,
|
|
809
|
+
{
|
|
810
|
+
"aria-label": formatMessage({
|
|
811
|
+
id: "content-releases.pages.Releases.tab-group.label",
|
|
812
|
+
defaultMessage: "Releases list"
|
|
813
|
+
}),
|
|
814
|
+
children: [
|
|
815
|
+
/* @__PURE__ */ jsx(Tabs.Trigger, { value: "pending", children: formatMessage(
|
|
540
816
|
{
|
|
541
817
|
id: "content-releases.pages.Releases.tab.pending",
|
|
542
818
|
defaultMessage: "Pending ({count})"
|
|
@@ -545,34 +821,32 @@ const ReleasesPage = () => {
|
|
|
545
821
|
count: totalPendingReleases
|
|
546
822
|
}
|
|
547
823
|
) }),
|
|
548
|
-
/* @__PURE__ */ jsx(
|
|
824
|
+
/* @__PURE__ */ jsx(Tabs.Trigger, { value: "done", children: formatMessage({
|
|
549
825
|
id: "content-releases.pages.Releases.tab.done",
|
|
550
826
|
defaultMessage: "Done"
|
|
551
827
|
}) })
|
|
552
|
-
]
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
}
|
|
575
|
-
),
|
|
828
|
+
]
|
|
829
|
+
}
|
|
830
|
+
),
|
|
831
|
+
/* @__PURE__ */ jsx(Divider, {})
|
|
832
|
+
] }),
|
|
833
|
+
/* @__PURE__ */ jsx(Tabs.Content, { value: "pending", children: /* @__PURE__ */ jsx(
|
|
834
|
+
ReleasesGrid,
|
|
835
|
+
{
|
|
836
|
+
sectionTitle: "pending",
|
|
837
|
+
releases: response?.currentData?.data,
|
|
838
|
+
isError
|
|
839
|
+
}
|
|
840
|
+
) }),
|
|
841
|
+
/* @__PURE__ */ jsx(Tabs.Content, { value: "done", children: /* @__PURE__ */ jsx(
|
|
842
|
+
ReleasesGrid,
|
|
843
|
+
{
|
|
844
|
+
sectionTitle: "done",
|
|
845
|
+
releases: response?.currentData?.data,
|
|
846
|
+
isError
|
|
847
|
+
}
|
|
848
|
+
) })
|
|
849
|
+
] }),
|
|
576
850
|
/* @__PURE__ */ jsxs(
|
|
577
851
|
Pagination.Root,
|
|
578
852
|
{
|
|
@@ -585,13 +859,17 @@ const ReleasesPage = () => {
|
|
|
585
859
|
}
|
|
586
860
|
)
|
|
587
861
|
] }) }),
|
|
588
|
-
|
|
862
|
+
/* @__PURE__ */ jsx(
|
|
589
863
|
ReleaseModal,
|
|
590
864
|
{
|
|
865
|
+
open: releaseModalShown,
|
|
591
866
|
handleClose: toggleAddReleaseModal,
|
|
592
867
|
handleSubmit: handleAddRelease,
|
|
593
868
|
isLoading: isSubmittingForm,
|
|
594
|
-
initialValues:
|
|
869
|
+
initialValues: {
|
|
870
|
+
...INITIAL_FORM_VALUES,
|
|
871
|
+
timezone: data?.data.defaultTimezone ? data.data.defaultTimezone.split("&")[1] : null
|
|
872
|
+
}
|
|
595
873
|
}
|
|
596
874
|
)
|
|
597
875
|
] });
|
|
@@ -602,7 +880,7 @@ const ReleaseInfoWrapper = styled(Flex)`
|
|
|
602
880
|
border-bottom-left-radius: ${({ theme }) => theme.borderRadius};
|
|
603
881
|
border-top: 1px solid ${({ theme }) => theme.colors.neutral150};
|
|
604
882
|
`;
|
|
605
|
-
const StyledMenuItem = styled(
|
|
883
|
+
const StyledMenuItem = styled(MenuItem)`
|
|
606
884
|
svg path {
|
|
607
885
|
fill: ${({ theme, disabled }) => disabled && theme.colors.neutral500};
|
|
608
886
|
}
|
|
@@ -611,73 +889,23 @@ const StyledMenuItem = styled(Menu.Item)`
|
|
|
611
889
|
}
|
|
612
890
|
|
|
613
891
|
&:hover {
|
|
614
|
-
background: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}100`]};
|
|
892
|
+
background: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}100`]};
|
|
615
893
|
}
|
|
616
894
|
`;
|
|
617
895
|
const PencilIcon = styled(Pencil)`
|
|
618
|
-
width: ${({ theme }) => theme.spaces[
|
|
619
|
-
height: ${({ theme }) => theme.spaces[
|
|
896
|
+
width: ${({ theme }) => theme.spaces[4]};
|
|
897
|
+
height: ${({ theme }) => theme.spaces[4]};
|
|
620
898
|
path {
|
|
621
899
|
fill: ${({ theme }) => theme.colors.neutral600};
|
|
622
900
|
}
|
|
623
901
|
`;
|
|
624
902
|
const TrashIcon = styled(Trash)`
|
|
625
|
-
width: ${({ theme }) => theme.spaces[
|
|
626
|
-
height: ${({ theme }) => theme.spaces[
|
|
903
|
+
width: ${({ theme }) => theme.spaces[4]};
|
|
904
|
+
height: ${({ theme }) => theme.spaces[4]};
|
|
627
905
|
path {
|
|
628
906
|
fill: ${({ theme }) => theme.colors.danger600};
|
|
629
907
|
}
|
|
630
908
|
`;
|
|
631
|
-
const TypographyMaxWidth = styled(Typography)`
|
|
632
|
-
max-width: 300px;
|
|
633
|
-
`;
|
|
634
|
-
const EntryValidationText = ({ action, schema, entry }) => {
|
|
635
|
-
const { formatMessage } = useIntl();
|
|
636
|
-
const { validate } = unstable_useDocument(
|
|
637
|
-
{
|
|
638
|
-
collectionType: schema?.kind ?? "",
|
|
639
|
-
model: schema?.uid ?? ""
|
|
640
|
-
},
|
|
641
|
-
{
|
|
642
|
-
skip: !schema
|
|
643
|
-
}
|
|
644
|
-
);
|
|
645
|
-
const errors = validate(entry) ?? {};
|
|
646
|
-
if (Object.keys(errors).length > 0) {
|
|
647
|
-
const validationErrorsMessages = Object.entries(errors).map(
|
|
648
|
-
([key, value]) => formatMessage(
|
|
649
|
-
{ id: `${value.id}.withField`, defaultMessage: value.defaultMessage },
|
|
650
|
-
{ field: key }
|
|
651
|
-
)
|
|
652
|
-
).join(" ");
|
|
653
|
-
return /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
654
|
-
/* @__PURE__ */ jsx(CrossCircle, { fill: "danger600" }),
|
|
655
|
-
/* @__PURE__ */ jsx(Tooltip, { description: validationErrorsMessages, children: /* @__PURE__ */ jsx(TypographyMaxWidth, { textColor: "danger600", variant: "omega", fontWeight: "semiBold", ellipsis: true, children: validationErrorsMessages }) })
|
|
656
|
-
] });
|
|
657
|
-
}
|
|
658
|
-
if (action == "publish") {
|
|
659
|
-
return /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
660
|
-
/* @__PURE__ */ jsx(CheckCircle, { fill: "success600" }),
|
|
661
|
-
entry.publishedAt ? /* @__PURE__ */ jsx(Typography, { textColor: "success600", fontWeight: "bold", children: formatMessage({
|
|
662
|
-
id: "content-releases.pages.ReleaseDetails.entry-validation.already-published",
|
|
663
|
-
defaultMessage: "Already published"
|
|
664
|
-
}) }) : /* @__PURE__ */ jsx(Typography, { children: formatMessage({
|
|
665
|
-
id: "content-releases.pages.ReleaseDetails.entry-validation.ready-to-publish",
|
|
666
|
-
defaultMessage: "Ready to publish"
|
|
667
|
-
}) })
|
|
668
|
-
] });
|
|
669
|
-
}
|
|
670
|
-
return /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
671
|
-
/* @__PURE__ */ jsx(CheckCircle, { fill: "success600" }),
|
|
672
|
-
!entry.publishedAt ? /* @__PURE__ */ jsx(Typography, { textColor: "success600", fontWeight: "bold", children: formatMessage({
|
|
673
|
-
id: "content-releases.pages.ReleaseDetails.entry-validation.already-unpublished",
|
|
674
|
-
defaultMessage: "Already unpublished"
|
|
675
|
-
}) }) : /* @__PURE__ */ jsx(Typography, { children: formatMessage({
|
|
676
|
-
id: "content-releases.pages.ReleaseDetails.entry-validation.ready-to-unpublish",
|
|
677
|
-
defaultMessage: "Ready to unpublish"
|
|
678
|
-
}) })
|
|
679
|
-
] });
|
|
680
|
-
};
|
|
681
909
|
const ReleaseDetailsLayout = ({
|
|
682
910
|
toggleEditReleaseModal,
|
|
683
911
|
toggleWarningSubmit,
|
|
@@ -688,7 +916,6 @@ const ReleaseDetailsLayout = ({
|
|
|
688
916
|
const {
|
|
689
917
|
data,
|
|
690
918
|
isLoading: isLoadingDetails,
|
|
691
|
-
isError,
|
|
692
919
|
error
|
|
693
920
|
} = useGetReleaseQuery(
|
|
694
921
|
{ id: releaseId },
|
|
@@ -720,7 +947,7 @@ const ReleaseDetailsLayout = ({
|
|
|
720
947
|
totalPublishedEntries,
|
|
721
948
|
totalUnpublishedEntries
|
|
722
949
|
});
|
|
723
|
-
} else if (
|
|
950
|
+
} else if (isFetchError(response.error)) {
|
|
724
951
|
toggleNotification({
|
|
725
952
|
type: "danger",
|
|
726
953
|
message: formatAPIError(response.error)
|
|
@@ -755,7 +982,7 @@ const ReleaseDetailsLayout = ({
|
|
|
755
982
|
if (isLoadingDetails) {
|
|
756
983
|
return /* @__PURE__ */ jsx(Page.Loading, {});
|
|
757
984
|
}
|
|
758
|
-
if (
|
|
985
|
+
if (isBaseQueryError(error) && "code" in error || !release) {
|
|
759
986
|
return /* @__PURE__ */ jsx(
|
|
760
987
|
Navigate,
|
|
761
988
|
{
|
|
@@ -763,6 +990,7 @@ const ReleaseDetailsLayout = ({
|
|
|
763
990
|
state: {
|
|
764
991
|
errors: [
|
|
765
992
|
{
|
|
993
|
+
// @ts-expect-error – TODO: fix this weird error flow
|
|
766
994
|
code: error?.code
|
|
767
995
|
}
|
|
768
996
|
]
|
|
@@ -809,86 +1037,73 @@ const ReleaseDetailsLayout = ({
|
|
|
809
1037
|
/* @__PURE__ */ jsx(Typography, { textColor: "neutral600", variant: "epsilon", children: numberOfEntriesText + (isScheduled ? ` - ${scheduledText}` : "") }),
|
|
810
1038
|
/* @__PURE__ */ jsx(Badge, { ...getBadgeProps(release.status), children: release.status })
|
|
811
1039
|
] }),
|
|
812
|
-
navigationAction: /* @__PURE__ */ jsx(BackButton, {}),
|
|
1040
|
+
navigationAction: /* @__PURE__ */ jsx(BackButton, { fallback: ".." }),
|
|
813
1041
|
primaryAction: !release.releasedAt && /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
814
|
-
/* @__PURE__ */ jsxs(
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
{
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
1042
|
+
/* @__PURE__ */ jsxs(
|
|
1043
|
+
SimpleMenuButton,
|
|
1044
|
+
{
|
|
1045
|
+
label: /* @__PURE__ */ jsx(More, {}),
|
|
1046
|
+
variant: "tertiary",
|
|
1047
|
+
endIcon: null,
|
|
1048
|
+
paddingLeft: "7px",
|
|
1049
|
+
paddingRight: "7px",
|
|
1050
|
+
"aria-label": formatMessage({
|
|
1051
|
+
id: "content-releases.header.actions.open-release-actions",
|
|
1052
|
+
defaultMessage: "Release edit and delete menu"
|
|
1053
|
+
}),
|
|
1054
|
+
popoverPlacement: "bottom-end",
|
|
1055
|
+
children: [
|
|
1056
|
+
/* @__PURE__ */ jsx(StyledMenuItem, { disabled: !canUpdate, onSelect: toggleEditReleaseModal, children: /* @__PURE__ */ jsxs(Flex, { alignItems: "center", gap: 2, hasRadius: true, width: "100%", children: [
|
|
1057
|
+
/* @__PURE__ */ jsx(PencilIcon, {}),
|
|
1058
|
+
/* @__PURE__ */ jsx(Typography, { ellipsis: true, children: formatMessage({
|
|
1059
|
+
id: "content-releases.header.actions.edit",
|
|
1060
|
+
defaultMessage: "Edit"
|
|
1061
|
+
}) })
|
|
1062
|
+
] }) }),
|
|
1063
|
+
/* @__PURE__ */ jsx(
|
|
1064
|
+
StyledMenuItem,
|
|
1065
|
+
{
|
|
1066
|
+
disabled: !canDelete,
|
|
1067
|
+
onSelect: toggleWarningSubmit,
|
|
1068
|
+
$variant: "danger",
|
|
1069
|
+
children: /* @__PURE__ */ jsxs(Flex, { alignItems: "center", gap: 2, hasRadius: true, width: "100%", children: [
|
|
1070
|
+
/* @__PURE__ */ jsx(TrashIcon, {}),
|
|
1071
|
+
/* @__PURE__ */ jsx(Typography, { ellipsis: true, textColor: "danger600", children: formatMessage({
|
|
1072
|
+
id: "content-releases.header.actions.delete",
|
|
1073
|
+
defaultMessage: "Delete"
|
|
844
1074
|
}) })
|
|
845
|
-
] }) }),
|
|
846
|
-
/* @__PURE__ */ jsx(
|
|
847
|
-
StyledMenuItem,
|
|
848
|
-
{
|
|
849
|
-
disabled: !canDelete,
|
|
850
|
-
onSelect: toggleWarningSubmit,
|
|
851
|
-
variant: "danger",
|
|
852
|
-
children: /* @__PURE__ */ jsxs(Flex, { alignItems: "center", gap: 2, hasRadius: true, width: "100%", children: [
|
|
853
|
-
/* @__PURE__ */ jsx(TrashIcon, {}),
|
|
854
|
-
/* @__PURE__ */ jsx(Typography, { ellipsis: true, textColor: "danger600", children: formatMessage({
|
|
855
|
-
id: "content-releases.header.actions.delete",
|
|
856
|
-
defaultMessage: "Delete"
|
|
857
|
-
}) })
|
|
858
|
-
] })
|
|
859
|
-
}
|
|
860
|
-
)
|
|
861
|
-
]
|
|
862
|
-
}
|
|
863
|
-
),
|
|
864
|
-
/* @__PURE__ */ jsxs(
|
|
865
|
-
ReleaseInfoWrapper,
|
|
866
|
-
{
|
|
867
|
-
direction: "column",
|
|
868
|
-
justifyContent: "center",
|
|
869
|
-
alignItems: "flex-start",
|
|
870
|
-
gap: 1,
|
|
871
|
-
padding: 5,
|
|
872
|
-
children: [
|
|
873
|
-
/* @__PURE__ */ jsx(Typography, { variant: "pi", fontWeight: "bold", children: formatMessage({
|
|
874
|
-
id: "content-releases.header.actions.created",
|
|
875
|
-
defaultMessage: "Created"
|
|
876
|
-
}) }),
|
|
877
|
-
/* @__PURE__ */ jsxs(Typography, { variant: "pi", color: "neutral300", children: [
|
|
878
|
-
/* @__PURE__ */ jsx(RelativeTime$1, { timestamp: new Date(release.createdAt) }),
|
|
879
|
-
formatMessage(
|
|
880
|
-
{
|
|
881
|
-
id: "content-releases.header.actions.created.description",
|
|
882
|
-
defaultMessage: "{hasCreatedByUser, select, true { by {createdBy}} other { by deleted user}}"
|
|
883
|
-
},
|
|
884
|
-
{ createdBy: getCreatedByUser(), hasCreatedByUser }
|
|
885
|
-
)
|
|
886
1075
|
] })
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
1076
|
+
}
|
|
1077
|
+
),
|
|
1078
|
+
/* @__PURE__ */ jsxs(
|
|
1079
|
+
ReleaseInfoWrapper,
|
|
1080
|
+
{
|
|
1081
|
+
direction: "column",
|
|
1082
|
+
justifyContent: "center",
|
|
1083
|
+
alignItems: "flex-start",
|
|
1084
|
+
gap: 1,
|
|
1085
|
+
padding: 4,
|
|
1086
|
+
children: [
|
|
1087
|
+
/* @__PURE__ */ jsx(Typography, { variant: "pi", fontWeight: "bold", children: formatMessage({
|
|
1088
|
+
id: "content-releases.header.actions.created",
|
|
1089
|
+
defaultMessage: "Created"
|
|
1090
|
+
}) }),
|
|
1091
|
+
/* @__PURE__ */ jsxs(Typography, { variant: "pi", color: "neutral300", children: [
|
|
1092
|
+
/* @__PURE__ */ jsx(RelativeTime$1, { timestamp: new Date(release.createdAt) }),
|
|
1093
|
+
formatMessage(
|
|
1094
|
+
{
|
|
1095
|
+
id: "content-releases.header.actions.created.description",
|
|
1096
|
+
defaultMessage: "{hasCreatedByUser, select, true { by {createdBy}} other { by deleted user}}"
|
|
1097
|
+
},
|
|
1098
|
+
{ createdBy: getCreatedByUser(), hasCreatedByUser }
|
|
1099
|
+
)
|
|
1100
|
+
] })
|
|
1101
|
+
]
|
|
1102
|
+
}
|
|
1103
|
+
)
|
|
1104
|
+
]
|
|
1105
|
+
}
|
|
1106
|
+
),
|
|
892
1107
|
/* @__PURE__ */ jsx(Button, { size: "S", variant: "tertiary", onClick: handleRefresh, children: formatMessage({
|
|
893
1108
|
id: "content-releases.header.actions.refresh",
|
|
894
1109
|
defaultMessage: "Refresh"
|
|
@@ -913,6 +1128,11 @@ const ReleaseDetailsLayout = ({
|
|
|
913
1128
|
children
|
|
914
1129
|
] });
|
|
915
1130
|
};
|
|
1131
|
+
const SimpleMenuButton = styled(SimpleMenu)`
|
|
1132
|
+
& > span {
|
|
1133
|
+
display: flex;
|
|
1134
|
+
}
|
|
1135
|
+
`;
|
|
916
1136
|
const GROUP_BY_OPTIONS = ["contentType", "locale", "action"];
|
|
917
1137
|
const GROUP_BY_OPTIONS_NO_LOCALE = ["contentType", "action"];
|
|
918
1138
|
const getGroupByOptionLabel = (value) => {
|
|
@@ -941,26 +1161,24 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
941
1161
|
const {
|
|
942
1162
|
data: releaseData,
|
|
943
1163
|
isLoading: isReleaseLoading,
|
|
944
|
-
isError: isReleaseError,
|
|
945
1164
|
error: releaseError
|
|
946
1165
|
} = useGetReleaseQuery({ id: releaseId });
|
|
947
1166
|
const {
|
|
948
1167
|
allowedActions: { canUpdate }
|
|
949
1168
|
} = useRBAC(PERMISSIONS);
|
|
950
1169
|
const runHookWaterfall = useStrapiApp("ReleaseDetailsPage", (state) => state.runHookWaterfall);
|
|
951
|
-
const { hasI18nEnabled } = runHookWaterfall(
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
);
|
|
1170
|
+
const { displayedHeaders, hasI18nEnabled } = runHookWaterfall("ContentReleases/pages/ReleaseDetails/add-locale-in-releases", {
|
|
1171
|
+
displayedHeaders: [
|
|
1172
|
+
{
|
|
1173
|
+
label: {
|
|
1174
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.name",
|
|
1175
|
+
defaultMessage: "name"
|
|
1176
|
+
},
|
|
1177
|
+
name: "name"
|
|
1178
|
+
}
|
|
1179
|
+
],
|
|
1180
|
+
hasI18nEnabled: false
|
|
1181
|
+
});
|
|
964
1182
|
const release = releaseData?.data;
|
|
965
1183
|
const selectedGroupBy = query?.groupBy || "contentType";
|
|
966
1184
|
const {
|
|
@@ -989,7 +1207,7 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
989
1207
|
// We are passing the action path to found the position in the cache of the action for optimistic updates
|
|
990
1208
|
});
|
|
991
1209
|
if ("error" in response) {
|
|
992
|
-
if (
|
|
1210
|
+
if (isFetchError(response.error)) {
|
|
993
1211
|
toggleNotification({
|
|
994
1212
|
type: "danger",
|
|
995
1213
|
message: formatAPIError(response.error)
|
|
@@ -1008,15 +1226,15 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1008
1226
|
const releaseActions = data?.data;
|
|
1009
1227
|
const releaseMeta = data?.meta;
|
|
1010
1228
|
const contentTypes = releaseMeta?.contentTypes || {};
|
|
1011
|
-
|
|
1012
|
-
if (
|
|
1229
|
+
releaseMeta?.components || {};
|
|
1230
|
+
if (isBaseQueryError(releaseError) || !release) {
|
|
1013
1231
|
const errorsArray = [];
|
|
1014
|
-
if (releaseError) {
|
|
1232
|
+
if (releaseError && "code" in releaseError) {
|
|
1015
1233
|
errorsArray.push({
|
|
1016
1234
|
code: releaseError.code
|
|
1017
1235
|
});
|
|
1018
1236
|
}
|
|
1019
|
-
if (releaseActionsError) {
|
|
1237
|
+
if (releaseActionsError && "code" in releaseActionsError) {
|
|
1020
1238
|
errorsArray.push({
|
|
1021
1239
|
code: releaseActionsError.code
|
|
1022
1240
|
});
|
|
@@ -1041,7 +1259,7 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1041
1259
|
action: /* @__PURE__ */ jsx(
|
|
1042
1260
|
LinkButton,
|
|
1043
1261
|
{
|
|
1044
|
-
|
|
1262
|
+
tag: Link,
|
|
1045
1263
|
to: {
|
|
1046
1264
|
pathname: "/content-manager"
|
|
1047
1265
|
},
|
|
@@ -1066,34 +1284,27 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1066
1284
|
defaultMessage: "Group by"
|
|
1067
1285
|
});
|
|
1068
1286
|
const headers = [
|
|
1069
|
-
|
|
1070
|
-
{
|
|
1071
|
-
label: formatMessage({
|
|
1072
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.name",
|
|
1073
|
-
defaultMessage: "name"
|
|
1074
|
-
}),
|
|
1075
|
-
name: "name"
|
|
1076
|
-
},
|
|
1287
|
+
...displayedHeaders,
|
|
1077
1288
|
{
|
|
1078
|
-
label:
|
|
1289
|
+
label: {
|
|
1079
1290
|
id: "content-releases.page.ReleaseDetails.table.header.label.content-type",
|
|
1080
1291
|
defaultMessage: "content-type"
|
|
1081
|
-
}
|
|
1292
|
+
},
|
|
1082
1293
|
name: "content-type"
|
|
1083
1294
|
},
|
|
1084
1295
|
{
|
|
1085
|
-
label:
|
|
1296
|
+
label: {
|
|
1086
1297
|
id: "content-releases.page.ReleaseDetails.table.header.label.action",
|
|
1087
1298
|
defaultMessage: "action"
|
|
1088
|
-
}
|
|
1299
|
+
},
|
|
1089
1300
|
name: "action"
|
|
1090
1301
|
},
|
|
1091
1302
|
...!release.releasedAt ? [
|
|
1092
1303
|
{
|
|
1093
|
-
label:
|
|
1304
|
+
label: {
|
|
1094
1305
|
id: "content-releases.page.ReleaseDetails.table.header.label.status",
|
|
1095
1306
|
defaultMessage: "status"
|
|
1096
|
-
}
|
|
1307
|
+
},
|
|
1097
1308
|
name: "status"
|
|
1098
1309
|
}
|
|
1099
1310
|
] : []
|
|
@@ -1131,10 +1342,10 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1131
1342
|
headers,
|
|
1132
1343
|
isLoading: isLoading || isFetching,
|
|
1133
1344
|
children: /* @__PURE__ */ jsxs(Table.Content, { children: [
|
|
1134
|
-
/* @__PURE__ */ jsx(Table.Head, { children: headers.map((
|
|
1345
|
+
/* @__PURE__ */ jsx(Table.Head, { children: headers.map(({ label, name }) => /* @__PURE__ */ jsx(Table.HeaderCell, { label: formatMessage(label), name }, name)) }),
|
|
1135
1346
|
/* @__PURE__ */ jsx(Table.Loading, {}),
|
|
1136
1347
|
/* @__PURE__ */ jsx(Table.Body, { children: releaseActions[key].map(
|
|
1137
|
-
({ id, contentType, locale, type, entry }, actionIndex) => /* @__PURE__ */ jsxs(Tr, { children: [
|
|
1348
|
+
({ id, contentType, locale, type, entry, status }, actionIndex) => /* @__PURE__ */ jsxs(Tr, { children: [
|
|
1138
1349
|
/* @__PURE__ */ jsx(Td, { width: "25%", maxWidth: "200px", children: /* @__PURE__ */ jsx(Typography, { ellipsis: true, children: `${contentType.mainFieldValue || entry.id}` }) }),
|
|
1139
1350
|
hasI18nEnabled && /* @__PURE__ */ jsx(Td, { width: "10%", children: /* @__PURE__ */ jsx(Typography, { children: `${locale?.name ? locale.name : "-"}` }) }),
|
|
1140
1351
|
/* @__PURE__ */ jsx(Td, { width: "10%", children: /* @__PURE__ */ jsx(Typography, { children: contentType.displayName || "" }) }),
|
|
@@ -1158,12 +1369,12 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1158
1369
|
) }),
|
|
1159
1370
|
!release.releasedAt && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1160
1371
|
/* @__PURE__ */ jsx(Td, { width: "20%", minWidth: "200px", children: /* @__PURE__ */ jsx(
|
|
1161
|
-
|
|
1372
|
+
EntryValidationPopover,
|
|
1162
1373
|
{
|
|
1163
1374
|
action: type,
|
|
1164
1375
|
schema: contentTypes?.[contentType.uid],
|
|
1165
|
-
|
|
1166
|
-
|
|
1376
|
+
entry,
|
|
1377
|
+
status
|
|
1167
1378
|
}
|
|
1168
1379
|
) }),
|
|
1169
1380
|
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Flex, { justifyContent: "flex-end", children: /* @__PURE__ */ jsxs(ReleaseActionMenu.Root, { children: [
|
|
@@ -1171,7 +1382,7 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1171
1382
|
ReleaseActionMenu.ReleaseActionEntryLinkItem,
|
|
1172
1383
|
{
|
|
1173
1384
|
contentTypeUid: contentType.uid,
|
|
1174
|
-
|
|
1385
|
+
documentId: entry.documentId,
|
|
1175
1386
|
locale: locale?.code
|
|
1176
1387
|
}
|
|
1177
1388
|
),
|
|
@@ -1221,13 +1432,24 @@ const ReleaseDetailsPage = () => {
|
|
|
1221
1432
|
skip: !releaseId
|
|
1222
1433
|
}
|
|
1223
1434
|
);
|
|
1435
|
+
const { data: dataTimezone, isLoading: isLoadingTimezone } = useGetReleaseSettingsQuery();
|
|
1224
1436
|
const [updateRelease, { isLoading: isSubmittingForm }] = useUpdateReleaseMutation();
|
|
1225
1437
|
const [deleteRelease] = useDeleteReleaseMutation();
|
|
1226
1438
|
const toggleEditReleaseModal = () => {
|
|
1227
1439
|
setReleaseModalShown((prev) => !prev);
|
|
1228
1440
|
};
|
|
1441
|
+
const getTimezoneValue = () => {
|
|
1442
|
+
if (releaseData?.timezone) {
|
|
1443
|
+
return releaseData.timezone;
|
|
1444
|
+
} else {
|
|
1445
|
+
if (dataTimezone?.data.defaultTimezone) {
|
|
1446
|
+
return dataTimezone.data.defaultTimezone;
|
|
1447
|
+
}
|
|
1448
|
+
return null;
|
|
1449
|
+
}
|
|
1450
|
+
};
|
|
1229
1451
|
const toggleWarningSubmit = () => setWarningSubmit((prevState) => !prevState);
|
|
1230
|
-
if (isLoadingDetails) {
|
|
1452
|
+
if (isLoadingDetails || isLoadingTimezone) {
|
|
1231
1453
|
return /* @__PURE__ */ jsx(
|
|
1232
1454
|
ReleaseDetailsLayout,
|
|
1233
1455
|
{
|
|
@@ -1242,10 +1464,10 @@ const ReleaseDetailsPage = () => {
|
|
|
1242
1464
|
}
|
|
1243
1465
|
const releaseData = isSuccessDetails && data?.data || null;
|
|
1244
1466
|
const title = releaseData?.name || "";
|
|
1245
|
-
const timezone =
|
|
1467
|
+
const timezone = getTimezoneValue();
|
|
1246
1468
|
const scheduledAt = releaseData?.scheduledAt && timezone ? utcToZonedTime(releaseData.scheduledAt, timezone) : null;
|
|
1247
|
-
const date = scheduledAt ? format(scheduledAt, "yyyy-MM-dd") :
|
|
1248
|
-
const time = scheduledAt ? format(scheduledAt, "HH:mm") : "";
|
|
1469
|
+
const date = scheduledAt ? format$1(scheduledAt, "yyyy-MM-dd") : void 0;
|
|
1470
|
+
const time = scheduledAt ? format$1(scheduledAt, "HH:mm") : "";
|
|
1249
1471
|
const handleEditRelease = async (values) => {
|
|
1250
1472
|
const response = await updateRelease({
|
|
1251
1473
|
id: releaseId,
|
|
@@ -1262,7 +1484,7 @@ const ReleaseDetailsPage = () => {
|
|
|
1262
1484
|
})
|
|
1263
1485
|
});
|
|
1264
1486
|
toggleEditReleaseModal();
|
|
1265
|
-
} else if (
|
|
1487
|
+
} else if (isFetchError(response.error)) {
|
|
1266
1488
|
toggleNotification({
|
|
1267
1489
|
type: "danger",
|
|
1268
1490
|
message: formatAPIError(response.error)
|
|
@@ -1280,7 +1502,7 @@ const ReleaseDetailsPage = () => {
|
|
|
1280
1502
|
});
|
|
1281
1503
|
if ("data" in response) {
|
|
1282
1504
|
navigate("..");
|
|
1283
|
-
} else if (
|
|
1505
|
+
} else if (isFetchError(response.error)) {
|
|
1284
1506
|
toggleNotification({
|
|
1285
1507
|
type: "danger",
|
|
1286
1508
|
message: formatAPIError(response.error)
|
|
@@ -1299,9 +1521,10 @@ const ReleaseDetailsPage = () => {
|
|
|
1299
1521
|
toggleWarningSubmit,
|
|
1300
1522
|
children: [
|
|
1301
1523
|
/* @__PURE__ */ jsx(ReleaseDetailsBody, { releaseId }),
|
|
1302
|
-
|
|
1524
|
+
/* @__PURE__ */ jsx(
|
|
1303
1525
|
ReleaseModal,
|
|
1304
1526
|
{
|
|
1527
|
+
open: releaseModalShown,
|
|
1305
1528
|
handleClose: toggleEditReleaseModal,
|
|
1306
1529
|
handleSubmit: handleEditRelease,
|
|
1307
1530
|
isLoading: isLoadingDetails || isSubmittingForm,
|
|
@@ -1315,18 +1538,10 @@ const ReleaseDetailsPage = () => {
|
|
|
1315
1538
|
}
|
|
1316
1539
|
}
|
|
1317
1540
|
),
|
|
1318
|
-
/* @__PURE__ */ jsx(
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
onClose: toggleWarningSubmit,
|
|
1323
|
-
onConfirm: handleDeleteRelease,
|
|
1324
|
-
children: formatMessage({
|
|
1325
|
-
id: "content-releases.dialog.confirmation-message",
|
|
1326
|
-
defaultMessage: "Are you sure you want to delete this release?"
|
|
1327
|
-
})
|
|
1328
|
-
}
|
|
1329
|
-
)
|
|
1541
|
+
/* @__PURE__ */ jsx(Dialog.Root, { open: showWarningSubmit, onOpenChange: toggleWarningSubmit, children: /* @__PURE__ */ jsx(ConfirmDialog, { onConfirm: handleDeleteRelease, children: formatMessage({
|
|
1542
|
+
id: "content-releases.dialog.confirmation-message",
|
|
1543
|
+
defaultMessage: "Are you sure you want to delete this release?"
|
|
1544
|
+
}) }) })
|
|
1330
1545
|
]
|
|
1331
1546
|
}
|
|
1332
1547
|
);
|
|
@@ -1340,4 +1555,4 @@ const App = () => {
|
|
|
1340
1555
|
export {
|
|
1341
1556
|
App
|
|
1342
1557
|
};
|
|
1343
|
-
//# sourceMappingURL=App-
|
|
1558
|
+
//# sourceMappingURL=App-CiZCkScI.mjs.map
|