@strapi/content-releases 0.0.0-experimental.edc24aaa3bb5a90fa5fd4fee208167dd4e2e38d4 → 0.0.0-experimental.f0a0bc26f5ef0693aaea2a616bc6b816cfee54b6
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-UQxgTJY5.mjs → App-FQyYFBJT.mjs} +313 -105
- package/dist/_chunks/App-FQyYFBJT.mjs.map +1 -0
- package/dist/_chunks/{App-D-lWdVb2.js → App-lx4Ucy9W.js} +352 -144
- package/dist/_chunks/App-lx4Ucy9W.js.map +1 -0
- package/dist/_chunks/{ReleasesSettingsPage-CuUXvABk.mjs → ReleasesSettingsPage-DqBxvJ9i.mjs} +4 -4
- package/dist/_chunks/ReleasesSettingsPage-DqBxvJ9i.mjs.map +1 -0
- package/dist/_chunks/{ReleasesSettingsPage-xfAoY8N3.js → ReleasesSettingsPage-T5VEAV03.js} +4 -4
- package/dist/_chunks/ReleasesSettingsPage-T5VEAV03.js.map +1 -0
- package/dist/_chunks/{en-BCDLTJn3.js → en-BWPPsSH-.js} +12 -2
- package/dist/_chunks/en-BWPPsSH-.js.map +1 -0
- package/dist/_chunks/{en-CGXIF4vQ.mjs → en-D9Q4YW03.mjs} +12 -2
- package/dist/_chunks/en-D9Q4YW03.mjs.map +1 -0
- package/dist/_chunks/{index-b3Ej95H7.mjs → index-CK9G80CL.mjs} +307 -26
- package/dist/_chunks/index-CK9G80CL.mjs.map +1 -0
- package/dist/_chunks/{index-jnv9zdcE.js → index-Cl3tM1YW.js} +304 -23
- package/dist/_chunks/index-Cl3tM1YW.js.map +1 -0
- package/dist/_chunks/{schemas-z5zp-_Gd.js → schemas-BE1LxE9J.js} +2 -2
- package/dist/_chunks/schemas-BE1LxE9J.js.map +1 -0
- package/dist/_chunks/{schemas-63pFihNF.mjs → schemas-DdA2ic2U.mjs} +2 -2
- package/dist/_chunks/schemas-DdA2ic2U.mjs.map +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/components/EntryValidationPopover.d.ts +13 -0
- package/dist/admin/src/components/ReleaseListCell.d.ts +28 -0
- package/dist/admin/src/services/release.d.ts +34 -32
- package/dist/server/index.js +191 -88
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +191 -88
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/controllers/index.d.ts +2 -0
- package/dist/server/src/controllers/index.d.ts.map +1 -1
- package/dist/server/src/controllers/release-action.d.ts +1 -0
- package/dist/server/src/controllers/release-action.d.ts.map +1 -1
- package/dist/server/src/controllers/release.d.ts +1 -0
- package/dist/server/src/controllers/release.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +6 -6
- package/dist/server/src/middlewares/documents.d.ts.map +1 -1
- package/dist/server/src/migrations/database/5.0.0-document-id-in-actions.d.ts.map +1 -1
- package/dist/server/src/routes/release-action.d.ts.map +1 -1
- package/dist/server/src/routes/release.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts +4 -6
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/server/src/services/release-action.d.ts +6 -8
- package/dist/server/src/services/release-action.d.ts.map +1 -1
- package/dist/server/src/utils/index.d.ts.map +1 -1
- package/dist/shared/contracts/release-actions.d.ts +11 -6
- package/dist/shared/contracts/release-actions.d.ts.map +1 -1
- package/dist/shared/contracts/releases.d.ts +3 -2
- package/dist/shared/contracts/releases.d.ts.map +1 -1
- package/package.json +17 -15
- package/dist/_chunks/App-D-lWdVb2.js.map +0 -1
- package/dist/_chunks/App-UQxgTJY5.mjs.map +0 -1
- package/dist/_chunks/ReleasesSettingsPage-CuUXvABk.mjs.map +0 -1
- package/dist/_chunks/ReleasesSettingsPage-xfAoY8N3.js.map +0 -1
- package/dist/_chunks/en-BCDLTJn3.js.map +0 -1
- package/dist/_chunks/en-CGXIF4vQ.mjs.map +0 -1
- package/dist/_chunks/index-b3Ej95H7.mjs.map +0 -1
- package/dist/_chunks/index-jnv9zdcE.js.map +0 -1
- package/dist/_chunks/schemas-63pFihNF.mjs.map +0 -1
- package/dist/_chunks/schemas-z5zp-_Gd.js.map +0 -1
- package/strapi-server.js +0 -3
|
@@ -1,21 +1,306 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useNotification, useAPIErrorHandler, useQueryParams, useTracking, useRBAC, Page, Layouts, Pagination, isFetchError, ConfirmDialog, BackButton, useStrapiApp, Table } from "@strapi/admin/strapi-admin";
|
|
3
|
-
import { useLocation, useNavigate, NavLink, useParams, Navigate,
|
|
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-
|
|
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-CK9G80CL.mjs";
|
|
5
5
|
import * as React from "react";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { Plus, Pencil, Trash, More, CrossCircle, CheckCircle, ArrowsCounterClockwise } 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
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
12
|
import { styled } from "styled-components";
|
|
13
|
+
import { unstable_useDocument } from "@strapi/content-manager/strapi-admin";
|
|
14
|
+
import { stringify } from "qs";
|
|
14
15
|
import { intervalToDuration, isPast, formatISO, format } from "date-fns";
|
|
15
16
|
import { Formik, Form, useFormikContext } from "formik";
|
|
16
|
-
import { R as RELEASE_SCHEMA } from "./schemas-
|
|
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) => {
|
|
@@ -286,7 +571,7 @@ const useTypedDispatch = useDispatch;
|
|
|
286
571
|
const isBaseQueryError = (error) => {
|
|
287
572
|
return typeof error !== "undefined" && error.name !== void 0;
|
|
288
573
|
};
|
|
289
|
-
const LinkCard = styled(Link)`
|
|
574
|
+
const LinkCard = styled(Link$1)`
|
|
290
575
|
display: block;
|
|
291
576
|
`;
|
|
292
577
|
const RelativeTime = styled(RelativeTime$1)`
|
|
@@ -342,7 +627,7 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
342
627
|
}
|
|
343
628
|
);
|
|
344
629
|
}
|
|
345
|
-
return /* @__PURE__ */ jsx(Grid.Root, { gap: 4, children: releases.map(({ id, name, scheduledAt, status }) => /* @__PURE__ */ jsx(Grid.Item, { col: 3, s: 6, xs: 12, children: /* @__PURE__ */ jsx(LinkCard, { tag: NavLink, to: `${id}`, isExternal: false, children: /* @__PURE__ */ jsxs(
|
|
630
|
+
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(
|
|
346
631
|
Flex,
|
|
347
632
|
{
|
|
348
633
|
direction: "column",
|
|
@@ -498,7 +783,7 @@ const ReleasesPage = () => {
|
|
|
498
783
|
StyledAlert,
|
|
499
784
|
{
|
|
500
785
|
marginBottom: 6,
|
|
501
|
-
action: /* @__PURE__ */ jsx(Link, { href: "https://strapi.io/pricing-cloud", isExternal: true, children: formatMessage({
|
|
786
|
+
action: /* @__PURE__ */ jsx(Link$1, { href: "https://strapi.io/pricing-cloud", isExternal: true, children: formatMessage({
|
|
502
787
|
id: "content-releases.pages.Releases.max-limit-reached.action",
|
|
503
788
|
defaultMessage: "Explore plans"
|
|
504
789
|
}) }),
|
|
@@ -609,100 +894,19 @@ const StyledMenuItem = styled(MenuItem)`
|
|
|
609
894
|
}
|
|
610
895
|
`;
|
|
611
896
|
const PencilIcon = styled(Pencil)`
|
|
612
|
-
width: ${({ theme }) => theme.spaces[
|
|
613
|
-
height: ${({ theme }) => theme.spaces[
|
|
897
|
+
width: ${({ theme }) => theme.spaces[4]};
|
|
898
|
+
height: ${({ theme }) => theme.spaces[4]};
|
|
614
899
|
path {
|
|
615
900
|
fill: ${({ theme }) => theme.colors.neutral600};
|
|
616
901
|
}
|
|
617
902
|
`;
|
|
618
903
|
const TrashIcon = styled(Trash)`
|
|
619
|
-
width: ${({ theme }) => theme.spaces[
|
|
620
|
-
height: ${({ theme }) => theme.spaces[
|
|
904
|
+
width: ${({ theme }) => theme.spaces[4]};
|
|
905
|
+
height: ${({ theme }) => theme.spaces[4]};
|
|
621
906
|
path {
|
|
622
907
|
fill: ${({ theme }) => theme.colors.danger600};
|
|
623
908
|
}
|
|
624
909
|
`;
|
|
625
|
-
const TypographyMaxWidth = styled(Typography)`
|
|
626
|
-
max-width: 300px;
|
|
627
|
-
`;
|
|
628
|
-
const EntryValidationText = ({ action, schema, entry, status }) => {
|
|
629
|
-
const { formatMessage } = useIntl();
|
|
630
|
-
const { validate, isLoading } = unstable_useDocument(
|
|
631
|
-
{
|
|
632
|
-
collectionType: schema?.kind ?? "",
|
|
633
|
-
model: schema?.uid ?? ""
|
|
634
|
-
},
|
|
635
|
-
{
|
|
636
|
-
// 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
|
|
637
|
-
skip: true
|
|
638
|
-
}
|
|
639
|
-
);
|
|
640
|
-
if (isLoading) {
|
|
641
|
-
return null;
|
|
642
|
-
}
|
|
643
|
-
const errors = validate(entry) ?? {};
|
|
644
|
-
if (action === "publish") {
|
|
645
|
-
if (Object.keys(errors).length > 0) {
|
|
646
|
-
const validationErrorsMessages = Object.entries(errors).map(
|
|
647
|
-
([key, value]) => formatMessage(
|
|
648
|
-
// @ts-expect-error – TODO: fix this will better checks
|
|
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(
|
|
656
|
-
TypographyMaxWidth,
|
|
657
|
-
{
|
|
658
|
-
textColor: "danger600",
|
|
659
|
-
variant: "omega",
|
|
660
|
-
fontWeight: "semiBold",
|
|
661
|
-
ellipsis: true,
|
|
662
|
-
children: validationErrorsMessages
|
|
663
|
-
}
|
|
664
|
-
) })
|
|
665
|
-
] });
|
|
666
|
-
}
|
|
667
|
-
if (status === "draft") {
|
|
668
|
-
return /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
669
|
-
/* @__PURE__ */ jsx(CheckCircle, { fill: "success600" }),
|
|
670
|
-
/* @__PURE__ */ jsx(Typography, { children: formatMessage({
|
|
671
|
-
id: "content-releases.pages.ReleaseDetails.entry-validation.ready-to-publish",
|
|
672
|
-
defaultMessage: "Ready to publish"
|
|
673
|
-
}) })
|
|
674
|
-
] });
|
|
675
|
-
}
|
|
676
|
-
if (status === "modified") {
|
|
677
|
-
return /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
678
|
-
/* @__PURE__ */ jsx(ArrowsCounterClockwise, { fill: "alternative600" }),
|
|
679
|
-
/* @__PURE__ */ jsx(Typography, { children: formatMessage({
|
|
680
|
-
id: "content-releases.pages.ReleaseDetails.entry-validation.modified",
|
|
681
|
-
defaultMessage: "Ready to publish changes"
|
|
682
|
-
}) })
|
|
683
|
-
] });
|
|
684
|
-
}
|
|
685
|
-
if (status === "published") {
|
|
686
|
-
return /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
687
|
-
/* @__PURE__ */ jsx(CheckCircle, { fill: "success600" }),
|
|
688
|
-
/* @__PURE__ */ jsx(Typography, { children: formatMessage({
|
|
689
|
-
id: "content-releases.pages.ReleaseDetails.entry-validation.already-published",
|
|
690
|
-
defaultMessage: "Already published"
|
|
691
|
-
}) })
|
|
692
|
-
] });
|
|
693
|
-
}
|
|
694
|
-
}
|
|
695
|
-
return /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
696
|
-
/* @__PURE__ */ jsx(CheckCircle, { fill: "success600" }),
|
|
697
|
-
!entry.publishedAt ? /* @__PURE__ */ jsx(Typography, { textColor: "success600", fontWeight: "bold", children: formatMessage({
|
|
698
|
-
id: "content-releases.pages.ReleaseDetails.entry-validation.already-unpublished",
|
|
699
|
-
defaultMessage: "Already unpublished"
|
|
700
|
-
}) }) : /* @__PURE__ */ jsx(Typography, { children: formatMessage({
|
|
701
|
-
id: "content-releases.pages.ReleaseDetails.entry-validation.ready-to-unpublish",
|
|
702
|
-
defaultMessage: "Ready to unpublish"
|
|
703
|
-
}) })
|
|
704
|
-
] });
|
|
705
|
-
};
|
|
706
910
|
const ReleaseDetailsLayout = ({
|
|
707
911
|
toggleEditReleaseModal,
|
|
708
912
|
toggleWarningSubmit,
|
|
@@ -834,16 +1038,16 @@ const ReleaseDetailsLayout = ({
|
|
|
834
1038
|
/* @__PURE__ */ jsx(Typography, { textColor: "neutral600", variant: "epsilon", children: numberOfEntriesText + (isScheduled ? ` - ${scheduledText}` : "") }),
|
|
835
1039
|
/* @__PURE__ */ jsx(Badge, { ...getBadgeProps(release.status), children: release.status })
|
|
836
1040
|
] }),
|
|
837
|
-
navigationAction: /* @__PURE__ */ jsx(BackButton, {}),
|
|
1041
|
+
navigationAction: /* @__PURE__ */ jsx(BackButton, { fallback: ".." }),
|
|
838
1042
|
primaryAction: !release.releasedAt && /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
839
1043
|
/* @__PURE__ */ jsxs(
|
|
840
|
-
|
|
1044
|
+
SimpleMenuButton,
|
|
841
1045
|
{
|
|
842
1046
|
label: /* @__PURE__ */ jsx(More, {}),
|
|
843
1047
|
variant: "tertiary",
|
|
844
1048
|
endIcon: null,
|
|
845
|
-
paddingLeft:
|
|
846
|
-
paddingRight:
|
|
1049
|
+
paddingLeft: "7px",
|
|
1050
|
+
paddingRight: "7px",
|
|
847
1051
|
"aria-label": formatMessage({
|
|
848
1052
|
id: "content-releases.header.actions.open-release-actions",
|
|
849
1053
|
defaultMessage: "Release edit and delete menu"
|
|
@@ -879,7 +1083,7 @@ const ReleaseDetailsLayout = ({
|
|
|
879
1083
|
justifyContent: "center",
|
|
880
1084
|
alignItems: "flex-start",
|
|
881
1085
|
gap: 1,
|
|
882
|
-
padding:
|
|
1086
|
+
padding: 4,
|
|
883
1087
|
children: [
|
|
884
1088
|
/* @__PURE__ */ jsx(Typography, { variant: "pi", fontWeight: "bold", children: formatMessage({
|
|
885
1089
|
id: "content-releases.header.actions.created",
|
|
@@ -925,6 +1129,11 @@ const ReleaseDetailsLayout = ({
|
|
|
925
1129
|
children
|
|
926
1130
|
] });
|
|
927
1131
|
};
|
|
1132
|
+
const SimpleMenuButton = styled(SimpleMenu)`
|
|
1133
|
+
& > span {
|
|
1134
|
+
display: flex;
|
|
1135
|
+
}
|
|
1136
|
+
`;
|
|
928
1137
|
const GROUP_BY_OPTIONS = ["contentType", "locale", "action"];
|
|
929
1138
|
const GROUP_BY_OPTIONS_NO_LOCALE = ["contentType", "action"];
|
|
930
1139
|
const getGroupByOptionLabel = (value) => {
|
|
@@ -1018,7 +1227,7 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1018
1227
|
const releaseActions = data?.data;
|
|
1019
1228
|
const releaseMeta = data?.meta;
|
|
1020
1229
|
const contentTypes = releaseMeta?.contentTypes || {};
|
|
1021
|
-
|
|
1230
|
+
releaseMeta?.components || {};
|
|
1022
1231
|
if (isBaseQueryError(releaseError) || !release) {
|
|
1023
1232
|
const errorsArray = [];
|
|
1024
1233
|
if (releaseError && "code" in releaseError) {
|
|
@@ -1051,7 +1260,7 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1051
1260
|
action: /* @__PURE__ */ jsx(
|
|
1052
1261
|
LinkButton,
|
|
1053
1262
|
{
|
|
1054
|
-
tag: Link
|
|
1263
|
+
tag: Link,
|
|
1055
1264
|
to: {
|
|
1056
1265
|
pathname: "/content-manager"
|
|
1057
1266
|
},
|
|
@@ -1161,11 +1370,10 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1161
1370
|
) }),
|
|
1162
1371
|
!release.releasedAt && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1163
1372
|
/* @__PURE__ */ jsx(Td, { width: "20%", minWidth: "200px", children: /* @__PURE__ */ jsx(
|
|
1164
|
-
|
|
1373
|
+
EntryValidationPopover,
|
|
1165
1374
|
{
|
|
1166
1375
|
action: type,
|
|
1167
1376
|
schema: contentTypes?.[contentType.uid],
|
|
1168
|
-
components,
|
|
1169
1377
|
entry,
|
|
1170
1378
|
status
|
|
1171
1379
|
}
|
|
@@ -1348,4 +1556,4 @@ const App = () => {
|
|
|
1348
1556
|
export {
|
|
1349
1557
|
App
|
|
1350
1558
|
};
|
|
1351
|
-
//# sourceMappingURL=App-
|
|
1559
|
+
//# sourceMappingURL=App-FQyYFBJT.mjs.map
|