@strapi/content-releases 0.0.0-experimental.e60ec1829240dae21c1e1d29076681c322288813 → 0.0.0-experimental.eba25ec571b091c6bde1104eb6c753debdf15462
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-FQyYFBJT.mjs} +642 -426
- package/dist/_chunks/App-FQyYFBJT.mjs.map +1 -0
- package/dist/_chunks/{App-CXRpb2hi.js → App-lx4Ucy9W.js} +680 -466
- package/dist/_chunks/App-lx4Ucy9W.js.map +1 -0
- package/dist/_chunks/ReleasesSettingsPage-DqBxvJ9i.mjs +178 -0
- package/dist/_chunks/ReleasesSettingsPage-DqBxvJ9i.mjs.map +1 -0
- package/dist/_chunks/ReleasesSettingsPage-T5VEAV03.js +178 -0
- package/dist/_chunks/ReleasesSettingsPage-T5VEAV03.js.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-CK9G80CL.mjs} +740 -600
- package/dist/_chunks/index-CK9G80CL.mjs.map +1 -0
- package/dist/_chunks/{index-B6-lic1Q.js → index-Cl3tM1YW.js} +731 -593
- package/dist/_chunks/index-Cl3tM1YW.js.map +1 -0
- package/dist/_chunks/schemas-BE1LxE9J.js +62 -0
- package/dist/_chunks/schemas-BE1LxE9J.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 +888 -612
- 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 +23 -22
- package/dist/_chunks/App-BsUSTHVD.mjs.map +0 -1
- package/dist/_chunks/App-CXRpb2hi.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,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
-
const strapiAdmin = require("@strapi/admin/strapi-admin");
|
|
4
|
+
const strapiAdmin$1 = require("@strapi/admin/strapi-admin");
|
|
5
5
|
const reactRouterDom = require("react-router-dom");
|
|
6
|
-
const index = require("./index-
|
|
6
|
+
const index = require("./index-Cl3tM1YW.js");
|
|
7
7
|
const React = require("react");
|
|
8
|
-
const strapiAdmin$1 = require("@strapi/content-manager/strapi-admin");
|
|
9
8
|
const designSystem = require("@strapi/design-system");
|
|
10
9
|
const icons = require("@strapi/icons");
|
|
11
10
|
const symbols = require("@strapi/icons/symbols");
|
|
12
11
|
const format = require("date-fns/format");
|
|
13
12
|
const dateFnsTz = require("date-fns-tz");
|
|
14
13
|
const reactIntl = require("react-intl");
|
|
15
|
-
const
|
|
14
|
+
const styledComponents = require("styled-components");
|
|
15
|
+
const strapiAdmin = require("@strapi/content-manager/strapi-admin");
|
|
16
|
+
const qs = require("qs");
|
|
16
17
|
const dateFns = require("date-fns");
|
|
17
18
|
const formik = require("formik");
|
|
18
|
-
const
|
|
19
|
+
const schemas = require("./schemas-BE1LxE9J.js");
|
|
19
20
|
const reactRedux = require("react-redux");
|
|
20
21
|
const ee = require("@strapi/admin/strapi-admin/ee");
|
|
21
22
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
@@ -39,8 +40,290 @@ function _interopNamespace(e) {
|
|
|
39
40
|
}
|
|
40
41
|
const React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
|
41
42
|
const format__default = /* @__PURE__ */ _interopDefault(format);
|
|
42
|
-
const
|
|
43
|
-
|
|
43
|
+
const StyledPopoverFlex = styledComponents.styled(designSystem.Flex)`
|
|
44
|
+
width: 100%;
|
|
45
|
+
max-width: 256px;
|
|
46
|
+
|
|
47
|
+
& > * {
|
|
48
|
+
border-bottom: 1px solid ${({ theme }) => theme.colors.neutral150};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
& > *:last-child {
|
|
52
|
+
border-bottom: none;
|
|
53
|
+
}
|
|
54
|
+
`;
|
|
55
|
+
const EntryStatusTrigger = ({
|
|
56
|
+
action,
|
|
57
|
+
status,
|
|
58
|
+
hasErrors,
|
|
59
|
+
requiredStage,
|
|
60
|
+
entryStage
|
|
61
|
+
}) => {
|
|
62
|
+
const { formatMessage } = reactIntl.useIntl();
|
|
63
|
+
if (action === "publish") {
|
|
64
|
+
if (hasErrors || requiredStage && requiredStage.id !== entryStage?.id) {
|
|
65
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
66
|
+
designSystem.Button,
|
|
67
|
+
{
|
|
68
|
+
variant: "ghost",
|
|
69
|
+
startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.CrossCircle, { fill: "danger600" }),
|
|
70
|
+
endIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.CaretDown, {}),
|
|
71
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "danger600", variant: "omega", fontWeight: "bold", children: formatMessage({
|
|
72
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.not-ready",
|
|
73
|
+
defaultMessage: "Not ready to publish"
|
|
74
|
+
}) })
|
|
75
|
+
}
|
|
76
|
+
) });
|
|
77
|
+
}
|
|
78
|
+
if (status === "draft") {
|
|
79
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
80
|
+
designSystem.Button,
|
|
81
|
+
{
|
|
82
|
+
variant: "ghost",
|
|
83
|
+
startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
|
84
|
+
endIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.CaretDown, {}),
|
|
85
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "success600", variant: "omega", fontWeight: "bold", children: formatMessage({
|
|
86
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.ready-to-publish",
|
|
87
|
+
defaultMessage: "Ready to publish"
|
|
88
|
+
}) })
|
|
89
|
+
}
|
|
90
|
+
) });
|
|
91
|
+
}
|
|
92
|
+
if (status === "modified") {
|
|
93
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
94
|
+
designSystem.Button,
|
|
95
|
+
{
|
|
96
|
+
variant: "ghost",
|
|
97
|
+
startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowsCounterClockwise, { fill: "alternative600" }),
|
|
98
|
+
endIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.CaretDown, {}),
|
|
99
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "bold", textColor: "alternative600", children: formatMessage({
|
|
100
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.modified",
|
|
101
|
+
defaultMessage: "Ready to publish changes"
|
|
102
|
+
}) })
|
|
103
|
+
}
|
|
104
|
+
) });
|
|
105
|
+
}
|
|
106
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
107
|
+
designSystem.Button,
|
|
108
|
+
{
|
|
109
|
+
variant: "ghost",
|
|
110
|
+
startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
|
111
|
+
endIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.CaretDown, {}),
|
|
112
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "success600", variant: "omega", fontWeight: "bold", children: formatMessage({
|
|
113
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.already-published",
|
|
114
|
+
defaultMessage: "Already published"
|
|
115
|
+
}) })
|
|
116
|
+
}
|
|
117
|
+
) });
|
|
118
|
+
}
|
|
119
|
+
if (status === "published") {
|
|
120
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
121
|
+
designSystem.Button,
|
|
122
|
+
{
|
|
123
|
+
variant: "ghost",
|
|
124
|
+
startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
|
125
|
+
endIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.CaretDown, {}),
|
|
126
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "success600", variant: "omega", fontWeight: "bold", children: formatMessage({
|
|
127
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.ready-to-unpublish",
|
|
128
|
+
defaultMessage: "Ready to unpublish"
|
|
129
|
+
}) })
|
|
130
|
+
}
|
|
131
|
+
) });
|
|
132
|
+
}
|
|
133
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "ghost", startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }), endIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.CaretDown, {}), children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "success600", variant: "omega", fontWeight: "bold", children: formatMessage({
|
|
134
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.already-unpublished",
|
|
135
|
+
defaultMessage: "Already unpublished"
|
|
136
|
+
}) }) }) });
|
|
137
|
+
};
|
|
138
|
+
const FieldsValidation = ({
|
|
139
|
+
hasErrors,
|
|
140
|
+
errors,
|
|
141
|
+
kind,
|
|
142
|
+
contentTypeUid,
|
|
143
|
+
documentId,
|
|
144
|
+
locale
|
|
145
|
+
}) => {
|
|
146
|
+
const { formatMessage } = reactIntl.useIntl();
|
|
147
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 1, width: "100%", padding: 5, children: [
|
|
148
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, width: "100%", children: [
|
|
149
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", children: formatMessage({
|
|
150
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.fields",
|
|
151
|
+
defaultMessage: "Fields"
|
|
152
|
+
}) }),
|
|
153
|
+
hasErrors ? /* @__PURE__ */ jsxRuntime.jsx(icons.CrossCircle, { fill: "danger600" }) : /* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" })
|
|
154
|
+
] }),
|
|
155
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { width: "100%", textColor: "neutral600", children: hasErrors ? formatMessage(
|
|
156
|
+
{
|
|
157
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.fields.error",
|
|
158
|
+
defaultMessage: "{errors} errors on fields."
|
|
159
|
+
},
|
|
160
|
+
{ errors: errors ? Object.keys(errors).length : 0 }
|
|
161
|
+
) : formatMessage({
|
|
162
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.fields.success",
|
|
163
|
+
defaultMessage: "All fields are filled correctly."
|
|
164
|
+
}) }),
|
|
165
|
+
hasErrors && /* @__PURE__ */ jsxRuntime.jsx(
|
|
166
|
+
designSystem.LinkButton,
|
|
167
|
+
{
|
|
168
|
+
tag: reactRouterDom.Link,
|
|
169
|
+
to: {
|
|
170
|
+
pathname: `/content-manager/${kind === "collectionType" ? "collection-types" : "single-types"}/${contentTypeUid}/${documentId}`,
|
|
171
|
+
search: locale ? qs.stringify({
|
|
172
|
+
plugins: {
|
|
173
|
+
i18n: {
|
|
174
|
+
locale
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}) : ""
|
|
178
|
+
},
|
|
179
|
+
variant: "secondary",
|
|
180
|
+
fullWidth: true,
|
|
181
|
+
state: { forceValidation: true },
|
|
182
|
+
children: formatMessage({
|
|
183
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.fields.see-errors",
|
|
184
|
+
defaultMessage: "See errors"
|
|
185
|
+
})
|
|
186
|
+
}
|
|
187
|
+
)
|
|
188
|
+
] });
|
|
189
|
+
};
|
|
190
|
+
const getReviewStageIcon = ({
|
|
191
|
+
contentTypeHasReviewWorkflow,
|
|
192
|
+
requiredStage,
|
|
193
|
+
entryStage
|
|
194
|
+
}) => {
|
|
195
|
+
if (!contentTypeHasReviewWorkflow) {
|
|
196
|
+
return /* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "neutral200" });
|
|
197
|
+
}
|
|
198
|
+
if (requiredStage && requiredStage.id !== entryStage?.id) {
|
|
199
|
+
return /* @__PURE__ */ jsxRuntime.jsx(icons.CrossCircle, { fill: "danger600" });
|
|
200
|
+
}
|
|
201
|
+
return /* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" });
|
|
202
|
+
};
|
|
203
|
+
const getReviewStageMessage = ({
|
|
204
|
+
contentTypeHasReviewWorkflow,
|
|
205
|
+
requiredStage,
|
|
206
|
+
entryStage,
|
|
207
|
+
formatMessage
|
|
208
|
+
}) => {
|
|
209
|
+
if (!contentTypeHasReviewWorkflow) {
|
|
210
|
+
return formatMessage({
|
|
211
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.review-stage.not-enabled",
|
|
212
|
+
defaultMessage: "This entry is not associated to any workflow."
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
if (requiredStage && requiredStage.id !== entryStage?.id) {
|
|
216
|
+
return formatMessage(
|
|
217
|
+
{
|
|
218
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.review-stage.not-ready",
|
|
219
|
+
defaultMessage: "This entry is not at the required stage for publishing. ({stageName})"
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
stageName: requiredStage?.name ?? ""
|
|
223
|
+
}
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
if (requiredStage && requiredStage.id === entryStage?.id) {
|
|
227
|
+
return formatMessage(
|
|
228
|
+
{
|
|
229
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.review-stage.ready",
|
|
230
|
+
defaultMessage: "This entry is at the required stage for publishing. ({stageName})"
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
stageName: requiredStage?.name ?? ""
|
|
234
|
+
}
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
return formatMessage({
|
|
238
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.review-stage.stage-not-required",
|
|
239
|
+
defaultMessage: "No required stage for publication"
|
|
240
|
+
});
|
|
241
|
+
};
|
|
242
|
+
const ReviewStageValidation = ({
|
|
243
|
+
contentTypeHasReviewWorkflow,
|
|
244
|
+
requiredStage,
|
|
245
|
+
entryStage
|
|
246
|
+
}) => {
|
|
247
|
+
const { formatMessage } = reactIntl.useIntl();
|
|
248
|
+
const Icon = getReviewStageIcon({
|
|
249
|
+
contentTypeHasReviewWorkflow,
|
|
250
|
+
requiredStage,
|
|
251
|
+
entryStage
|
|
252
|
+
});
|
|
253
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 1, width: "100%", padding: 5, children: [
|
|
254
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, width: "100%", children: [
|
|
255
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", children: formatMessage({
|
|
256
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.review-stage",
|
|
257
|
+
defaultMessage: "Review stage"
|
|
258
|
+
}) }),
|
|
259
|
+
Icon
|
|
260
|
+
] }),
|
|
261
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: getReviewStageMessage({
|
|
262
|
+
contentTypeHasReviewWorkflow,
|
|
263
|
+
requiredStage,
|
|
264
|
+
entryStage,
|
|
265
|
+
formatMessage
|
|
266
|
+
}) })
|
|
267
|
+
] });
|
|
268
|
+
};
|
|
269
|
+
const EntryValidationPopover = ({
|
|
270
|
+
schema,
|
|
271
|
+
entry,
|
|
272
|
+
status,
|
|
273
|
+
action
|
|
274
|
+
}) => {
|
|
275
|
+
const { validate, isLoading } = strapiAdmin.unstable_useDocument(
|
|
276
|
+
{
|
|
277
|
+
collectionType: schema?.kind ?? "",
|
|
278
|
+
model: schema?.uid ?? ""
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
// 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
|
|
282
|
+
skip: true
|
|
283
|
+
}
|
|
284
|
+
);
|
|
285
|
+
const errors = isLoading ? null : validate(entry);
|
|
286
|
+
const hasErrors = errors ? Object.keys(errors).length > 0 : false;
|
|
287
|
+
const contentTypeHasReviewWorkflow = schema?.hasReviewWorkflow ?? false;
|
|
288
|
+
const requiredStage = schema?.stageRequiredToPublish;
|
|
289
|
+
const entryStage = entry.strapi_stage;
|
|
290
|
+
if (isLoading) {
|
|
291
|
+
return null;
|
|
292
|
+
}
|
|
293
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Popover.Root, { children: [
|
|
294
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
295
|
+
EntryStatusTrigger,
|
|
296
|
+
{
|
|
297
|
+
action,
|
|
298
|
+
status,
|
|
299
|
+
hasErrors,
|
|
300
|
+
requiredStage,
|
|
301
|
+
entryStage
|
|
302
|
+
}
|
|
303
|
+
),
|
|
304
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover.Content, { children: /* @__PURE__ */ jsxRuntime.jsxs(StyledPopoverFlex, { direction: "column", children: [
|
|
305
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
306
|
+
FieldsValidation,
|
|
307
|
+
{
|
|
308
|
+
hasErrors,
|
|
309
|
+
errors,
|
|
310
|
+
contentTypeUid: schema?.uid,
|
|
311
|
+
kind: schema?.kind,
|
|
312
|
+
documentId: entry.documentId,
|
|
313
|
+
locale: entry.locale
|
|
314
|
+
}
|
|
315
|
+
),
|
|
316
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
317
|
+
ReviewStageValidation,
|
|
318
|
+
{
|
|
319
|
+
contentTypeHasReviewWorkflow,
|
|
320
|
+
requiredStage,
|
|
321
|
+
entryStage
|
|
322
|
+
}
|
|
323
|
+
)
|
|
324
|
+
] }) })
|
|
325
|
+
] });
|
|
326
|
+
};
|
|
44
327
|
const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
|
|
45
328
|
const RelativeTime$1 = React__namespace.forwardRef(
|
|
46
329
|
({ timestamp, customIntervals = [], ...restProps }, forwardedRef) => {
|
|
@@ -71,28 +354,9 @@ const RelativeTime$1 = React__namespace.forwardRef(
|
|
|
71
354
|
);
|
|
72
355
|
}
|
|
73
356
|
);
|
|
74
|
-
const RELEASE_SCHEMA = yup__namespace.object().shape({
|
|
75
|
-
name: yup__namespace.string().trim().required(),
|
|
76
|
-
scheduledAt: yup__namespace.string().nullable(),
|
|
77
|
-
isScheduled: yup__namespace.boolean().optional(),
|
|
78
|
-
time: yup__namespace.string().when("isScheduled", {
|
|
79
|
-
is: true,
|
|
80
|
-
then: yup__namespace.string().trim().required(),
|
|
81
|
-
otherwise: yup__namespace.string().nullable()
|
|
82
|
-
}),
|
|
83
|
-
timezone: yup__namespace.string().when("isScheduled", {
|
|
84
|
-
is: true,
|
|
85
|
-
then: yup__namespace.string().required().nullable(),
|
|
86
|
-
otherwise: yup__namespace.string().nullable()
|
|
87
|
-
}),
|
|
88
|
-
date: yup__namespace.string().when("isScheduled", {
|
|
89
|
-
is: true,
|
|
90
|
-
then: yup__namespace.string().required().nullable(),
|
|
91
|
-
otherwise: yup__namespace.string().nullable()
|
|
92
|
-
})
|
|
93
|
-
}).required().noUnknown();
|
|
94
357
|
const ReleaseModal = ({
|
|
95
358
|
handleClose,
|
|
359
|
+
open,
|
|
96
360
|
handleSubmit,
|
|
97
361
|
initialValues,
|
|
98
362
|
isLoading = false
|
|
@@ -100,7 +364,7 @@ const ReleaseModal = ({
|
|
|
100
364
|
const { formatMessage } = reactIntl.useIntl();
|
|
101
365
|
const { pathname } = reactRouterDom.useLocation();
|
|
102
366
|
const isCreatingRelease = pathname === `/plugins/${index.pluginId}`;
|
|
103
|
-
const { timezoneList, systemTimezone = { value: "UTC+00:00-Africa/Abidjan " } } = getTimezones(
|
|
367
|
+
const { timezoneList, systemTimezone = { value: "UTC+00:00-Africa/Abidjan " } } = index.getTimezones(
|
|
104
368
|
initialValues.scheduledAt ? new Date(initialValues.scheduledAt) : /* @__PURE__ */ new Date()
|
|
105
369
|
);
|
|
106
370
|
const getScheduledTimestamp = (values) => {
|
|
@@ -116,8 +380,8 @@ const ReleaseModal = ({
|
|
|
116
380
|
);
|
|
117
381
|
return currentTimezone?.value || systemTimezone.value;
|
|
118
382
|
};
|
|
119
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
120
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
383
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Root, { open, onOpenChange: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Content, { children: [
|
|
384
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Title, { children: formatMessage(
|
|
121
385
|
{
|
|
122
386
|
id: "content-releases.modal.title",
|
|
123
387
|
defaultMessage: "{isCreatingRelease, select, true {New release} other {Edit release}}"
|
|
@@ -138,135 +402,145 @@ const ReleaseModal = ({
|
|
|
138
402
|
...initialValues,
|
|
139
403
|
timezone: initialValues.timezone ? getTimezoneWithOffset() : systemTimezone.value
|
|
140
404
|
},
|
|
141
|
-
validationSchema: RELEASE_SCHEMA,
|
|
405
|
+
validationSchema: schemas.RELEASE_SCHEMA,
|
|
142
406
|
validateOnChange: false,
|
|
143
|
-
children: ({ values, errors, handleChange, setFieldValue }) =>
|
|
144
|
-
|
|
145
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
defaultMessage:
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
setFieldValue("
|
|
169
|
-
|
|
170
|
-
} else {
|
|
171
|
-
setFieldValue("date", initialValues.date);
|
|
172
|
-
setFieldValue("time", initialValues.time);
|
|
173
|
-
setFieldValue("timezone", initialValues.timezone ?? systemTimezone?.value);
|
|
174
|
-
}
|
|
175
|
-
},
|
|
176
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
177
|
-
designSystem.Typography,
|
|
178
|
-
{
|
|
179
|
-
textColor: values.isScheduled ? "primary600" : "neutral800",
|
|
180
|
-
fontWeight: values.isScheduled ? "semiBold" : "regular",
|
|
181
|
-
children: formatMessage({
|
|
182
|
-
id: "modal.form.input.label.schedule-release",
|
|
183
|
-
defaultMessage: "Schedule release"
|
|
184
|
-
})
|
|
185
|
-
}
|
|
186
|
-
)
|
|
187
|
-
}
|
|
188
|
-
) }),
|
|
189
|
-
values.isScheduled && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
190
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, alignItems: "start", children: [
|
|
191
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
192
|
-
designSystem.DatePicker,
|
|
193
|
-
{
|
|
194
|
-
label: formatMessage({
|
|
195
|
-
id: "content-releases.modal.form.input.label.date",
|
|
196
|
-
defaultMessage: "Date"
|
|
197
|
-
}),
|
|
198
|
-
name: "date",
|
|
199
|
-
error: errors.date,
|
|
200
|
-
onChange: (date) => {
|
|
201
|
-
const isoFormatDate = date ? dateFns.formatISO(date, { representation: "date" }) : null;
|
|
202
|
-
setFieldValue("date", isoFormatDate);
|
|
203
|
-
},
|
|
204
|
-
clearLabel: formatMessage({
|
|
205
|
-
id: "content-releases.modal.form.input.clearLabel",
|
|
206
|
-
defaultMessage: "Clear"
|
|
207
|
-
}),
|
|
208
|
-
onClear: () => {
|
|
407
|
+
children: ({ values, errors, handleChange, setFieldValue }) => {
|
|
408
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(formik.Form, { children: [
|
|
409
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Body, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
|
|
410
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
411
|
+
designSystem.Field.Root,
|
|
412
|
+
{
|
|
413
|
+
name: "name",
|
|
414
|
+
error: errors.name && formatMessage({ id: errors.name, defaultMessage: errors.name }),
|
|
415
|
+
required: true,
|
|
416
|
+
children: [
|
|
417
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
418
|
+
id: "content-releases.modal.form.input.label.release-name",
|
|
419
|
+
defaultMessage: "Name"
|
|
420
|
+
}) }),
|
|
421
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.TextInput, { value: values.name, onChange: handleChange }),
|
|
422
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
423
|
+
]
|
|
424
|
+
}
|
|
425
|
+
),
|
|
426
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "max-content", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
427
|
+
designSystem.Checkbox,
|
|
428
|
+
{
|
|
429
|
+
name: "isScheduled",
|
|
430
|
+
checked: values.isScheduled,
|
|
431
|
+
onCheckedChange: (checked) => {
|
|
432
|
+
setFieldValue("isScheduled", checked);
|
|
433
|
+
if (!checked) {
|
|
209
434
|
setFieldValue("date", null);
|
|
210
|
-
},
|
|
211
|
-
selectedDate: values.date || void 0,
|
|
212
|
-
required: true,
|
|
213
|
-
minDate: dateFnsTz.utcToZonedTime(/* @__PURE__ */ new Date(), values.timezone.split("&")[1])
|
|
214
|
-
}
|
|
215
|
-
) }),
|
|
216
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
217
|
-
designSystem.TimePicker,
|
|
218
|
-
{
|
|
219
|
-
label: formatMessage({
|
|
220
|
-
id: "content-releases.modal.form.input.label.time",
|
|
221
|
-
defaultMessage: "Time"
|
|
222
|
-
}),
|
|
223
|
-
name: "time",
|
|
224
|
-
error: errors.time,
|
|
225
|
-
onChange: (time) => {
|
|
226
|
-
setFieldValue("time", time);
|
|
227
|
-
},
|
|
228
|
-
clearLabel: formatMessage({
|
|
229
|
-
id: "content-releases.modal.form.input.clearLabel",
|
|
230
|
-
defaultMessage: "Clear"
|
|
231
|
-
}),
|
|
232
|
-
onClear: () => {
|
|
233
435
|
setFieldValue("time", "");
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
436
|
+
setFieldValue("timezone", null);
|
|
437
|
+
} else {
|
|
438
|
+
setFieldValue("date", initialValues.date);
|
|
439
|
+
setFieldValue("time", initialValues.time);
|
|
440
|
+
setFieldValue(
|
|
441
|
+
"timezone",
|
|
442
|
+
initialValues.timezone ?? systemTimezone?.value
|
|
443
|
+
);
|
|
444
|
+
}
|
|
445
|
+
},
|
|
446
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
447
|
+
designSystem.Typography,
|
|
448
|
+
{
|
|
449
|
+
textColor: values.isScheduled ? "primary600" : "neutral800",
|
|
450
|
+
fontWeight: values.isScheduled ? "semiBold" : "regular",
|
|
451
|
+
children: formatMessage({
|
|
452
|
+
id: "modal.form.input.label.schedule-release",
|
|
453
|
+
defaultMessage: "Schedule release"
|
|
454
|
+
})
|
|
455
|
+
}
|
|
456
|
+
)
|
|
457
|
+
}
|
|
458
|
+
) }),
|
|
459
|
+
values.isScheduled && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
460
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, alignItems: "start", children: [
|
|
461
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
462
|
+
designSystem.Field.Root,
|
|
463
|
+
{
|
|
464
|
+
name: "date",
|
|
465
|
+
error: errors.date && formatMessage({ id: errors.date, defaultMessage: errors.date }),
|
|
466
|
+
required: true,
|
|
467
|
+
children: [
|
|
468
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
469
|
+
id: "content-releases.modal.form.input.label.date",
|
|
470
|
+
defaultMessage: "Date"
|
|
471
|
+
}) }),
|
|
472
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
473
|
+
designSystem.DatePicker,
|
|
474
|
+
{
|
|
475
|
+
onChange: (date) => {
|
|
476
|
+
const isoFormatDate = date ? dateFns.formatISO(date, { representation: "date" }) : null;
|
|
477
|
+
setFieldValue("date", isoFormatDate);
|
|
478
|
+
},
|
|
479
|
+
clearLabel: formatMessage({
|
|
480
|
+
id: "content-releases.modal.form.input.clearLabel",
|
|
481
|
+
defaultMessage: "Clear"
|
|
482
|
+
}),
|
|
483
|
+
onClear: () => {
|
|
484
|
+
setFieldValue("date", null);
|
|
485
|
+
},
|
|
486
|
+
value: values.date ? new Date(values.date) : /* @__PURE__ */ new Date(),
|
|
487
|
+
minDate: dateFnsTz.utcToZonedTime(/* @__PURE__ */ new Date(), values.timezone.split("&")[1])
|
|
488
|
+
}
|
|
489
|
+
),
|
|
490
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
491
|
+
]
|
|
492
|
+
}
|
|
493
|
+
) }),
|
|
494
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
495
|
+
designSystem.Field.Root,
|
|
496
|
+
{
|
|
497
|
+
name: "time",
|
|
498
|
+
error: errors.time && formatMessage({ id: errors.time, defaultMessage: errors.time }),
|
|
499
|
+
required: true,
|
|
500
|
+
children: [
|
|
501
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
502
|
+
id: "content-releases.modal.form.input.label.time",
|
|
503
|
+
defaultMessage: "Time"
|
|
504
|
+
}) }),
|
|
505
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
506
|
+
designSystem.TimePicker,
|
|
507
|
+
{
|
|
508
|
+
onChange: (time) => {
|
|
509
|
+
setFieldValue("time", time);
|
|
510
|
+
},
|
|
511
|
+
clearLabel: formatMessage({
|
|
512
|
+
id: "content-releases.modal.form.input.clearLabel",
|
|
513
|
+
defaultMessage: "Clear"
|
|
514
|
+
}),
|
|
515
|
+
onClear: () => {
|
|
516
|
+
setFieldValue("time", "");
|
|
517
|
+
},
|
|
518
|
+
value: values.time || void 0
|
|
519
|
+
}
|
|
520
|
+
),
|
|
521
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
522
|
+
]
|
|
523
|
+
}
|
|
524
|
+
) })
|
|
525
|
+
] }),
|
|
526
|
+
/* @__PURE__ */ jsxRuntime.jsx(TimezoneComponent, { timezoneOptions: timezoneList })
|
|
527
|
+
] })
|
|
528
|
+
] }) }),
|
|
529
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Footer, { children: [
|
|
530
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Close, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", name: "cancel", children: formatMessage({ id: "cancel", defaultMessage: "Cancel" }) }) }),
|
|
531
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { name: "submit", loading: isLoading, type: "submit", children: formatMessage(
|
|
248
532
|
{
|
|
249
533
|
id: "content-releases.modal.form.button.submit",
|
|
250
534
|
defaultMessage: "{isCreatingRelease, select, true {Continue} other {Save}}"
|
|
251
535
|
},
|
|
252
536
|
{ isCreatingRelease }
|
|
253
537
|
) })
|
|
254
|
-
}
|
|
255
|
-
)
|
|
256
|
-
|
|
538
|
+
] })
|
|
539
|
+
] });
|
|
540
|
+
}
|
|
257
541
|
}
|
|
258
542
|
)
|
|
259
|
-
] });
|
|
260
|
-
};
|
|
261
|
-
const getTimezones = (selectedDate) => {
|
|
262
|
-
const timezoneList = Intl.supportedValuesOf("timeZone").map((timezone) => {
|
|
263
|
-
const utcOffset = index.getTimezoneOffset(timezone, selectedDate);
|
|
264
|
-
return { offset: utcOffset, value: `${utcOffset}&${timezone}` };
|
|
265
|
-
});
|
|
266
|
-
const systemTimezone = timezoneList.find(
|
|
267
|
-
(timezone) => timezone.value.split("&")[1] === Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
268
|
-
);
|
|
269
|
-
return { timezoneList, systemTimezone };
|
|
543
|
+
] }) });
|
|
270
544
|
};
|
|
271
545
|
const TimezoneComponent = ({ timezoneOptions }) => {
|
|
272
546
|
const { values, errors, setFieldValue } = formik.useFormikContext();
|
|
@@ -274,7 +548,7 @@ const TimezoneComponent = ({ timezoneOptions }) => {
|
|
|
274
548
|
const [timezoneList, setTimezoneList] = React__namespace.useState(timezoneOptions);
|
|
275
549
|
React__namespace.useEffect(() => {
|
|
276
550
|
if (values.date) {
|
|
277
|
-
const { timezoneList: timezoneList2 } = getTimezones(new Date(values.date));
|
|
551
|
+
const { timezoneList: timezoneList2 } = index.getTimezones(new Date(values.date));
|
|
278
552
|
setTimezoneList(timezoneList2);
|
|
279
553
|
const updatedTimezone = values.timezone && timezoneList2.find((tz) => tz.value.split("&")[1] === values.timezone.split("&")[1]);
|
|
280
554
|
if (updatedTimezone) {
|
|
@@ -282,37 +556,48 @@ const TimezoneComponent = ({ timezoneOptions }) => {
|
|
|
282
556
|
}
|
|
283
557
|
}
|
|
284
558
|
}, [setFieldValue, values.date, values.timezone]);
|
|
285
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
286
|
-
designSystem.
|
|
559
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
560
|
+
designSystem.Field.Root,
|
|
287
561
|
{
|
|
288
|
-
label: formatMessage({
|
|
289
|
-
id: "content-releases.modal.form.input.label.timezone",
|
|
290
|
-
defaultMessage: "Timezone"
|
|
291
|
-
}),
|
|
292
|
-
autocomplete: { type: "list", filter: "contains" },
|
|
293
562
|
name: "timezone",
|
|
294
|
-
|
|
295
|
-
textValue: values.timezone ? values.timezone.replace(/&/, " ") : void 0,
|
|
296
|
-
onChange: (timezone) => {
|
|
297
|
-
setFieldValue("timezone", timezone);
|
|
298
|
-
},
|
|
299
|
-
onTextValueChange: (timezone) => {
|
|
300
|
-
setFieldValue("timezone", timezone);
|
|
301
|
-
},
|
|
302
|
-
onClear: () => {
|
|
303
|
-
setFieldValue("timezone", "");
|
|
304
|
-
},
|
|
305
|
-
error: errors.timezone,
|
|
563
|
+
error: errors.timezone && formatMessage({ id: errors.timezone, defaultMessage: errors.timezone }),
|
|
306
564
|
required: true,
|
|
307
|
-
children:
|
|
565
|
+
children: [
|
|
566
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
567
|
+
id: "content-releases.modal.form.input.label.timezone",
|
|
568
|
+
defaultMessage: "Timezone"
|
|
569
|
+
}) }),
|
|
570
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
571
|
+
designSystem.Combobox,
|
|
572
|
+
{
|
|
573
|
+
autocomplete: { type: "list", filter: "contains" },
|
|
574
|
+
value: values.timezone || void 0,
|
|
575
|
+
textValue: values.timezone ? values.timezone.replace(/&/, " ") : void 0,
|
|
576
|
+
onChange: (timezone) => {
|
|
577
|
+
setFieldValue("timezone", timezone);
|
|
578
|
+
},
|
|
579
|
+
onTextValueChange: (timezone) => {
|
|
580
|
+
setFieldValue("timezone", timezone);
|
|
581
|
+
},
|
|
582
|
+
onClear: () => {
|
|
583
|
+
setFieldValue("timezone", "");
|
|
584
|
+
},
|
|
585
|
+
children: timezoneList.map((timezone) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.ComboboxOption, { value: timezone.value, children: timezone.value.replace(/&/, " ") }, timezone.value))
|
|
586
|
+
}
|
|
587
|
+
),
|
|
588
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
589
|
+
]
|
|
308
590
|
}
|
|
309
591
|
);
|
|
310
592
|
};
|
|
311
593
|
const useTypedDispatch = reactRedux.useDispatch;
|
|
312
|
-
const
|
|
594
|
+
const isBaseQueryError = (error) => {
|
|
595
|
+
return typeof error !== "undefined" && error.name !== void 0;
|
|
596
|
+
};
|
|
597
|
+
const LinkCard = styledComponents.styled(designSystem.Link)`
|
|
313
598
|
display: block;
|
|
314
599
|
`;
|
|
315
|
-
const RelativeTime =
|
|
600
|
+
const RelativeTime = styledComponents.styled(RelativeTime$1)`
|
|
316
601
|
display: inline-block;
|
|
317
602
|
&::first-letter {
|
|
318
603
|
text-transform: uppercase;
|
|
@@ -346,7 +631,7 @@ const getBadgeProps = (status) => {
|
|
|
346
631
|
const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
347
632
|
const { formatMessage } = reactIntl.useIntl();
|
|
348
633
|
if (isError) {
|
|
349
|
-
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Error, {});
|
|
634
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Page.Error, {});
|
|
350
635
|
}
|
|
351
636
|
if (releases?.length === 0) {
|
|
352
637
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -365,7 +650,7 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
365
650
|
}
|
|
366
651
|
);
|
|
367
652
|
}
|
|
368
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid, { gap: 4, children: releases.map(({ id, name, scheduledAt, status }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
653
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Root, { gap: 4, children: releases.map(({ id, name, scheduledAt, status }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 3, s: 6, xs: 12, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsxRuntime.jsx(LinkCard, { tag: reactRouterDom.NavLink, to: `${id}`, isExternal: false, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
369
654
|
designSystem.Flex,
|
|
370
655
|
{
|
|
371
656
|
direction: "column",
|
|
@@ -380,7 +665,7 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
380
665
|
gap: 4,
|
|
381
666
|
children: [
|
|
382
667
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "start", gap: 1, children: [
|
|
383
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, {
|
|
668
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", tag: "h3", variant: "delta", fontWeight: "bold", children: name }),
|
|
384
669
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: scheduledAt ? /* @__PURE__ */ jsxRuntime.jsx(RelativeTime, { timestamp: new Date(scheduledAt) }) : formatMessage({
|
|
385
670
|
id: "content-releases.pages.Releases.not-scheduled",
|
|
386
671
|
defaultMessage: "Not scheduled"
|
|
@@ -391,7 +676,7 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
391
676
|
}
|
|
392
677
|
) }) }, id)) });
|
|
393
678
|
};
|
|
394
|
-
const StyledAlert =
|
|
679
|
+
const StyledAlert = styledComponents.styled(designSystem.Alert)`
|
|
395
680
|
button {
|
|
396
681
|
display: none;
|
|
397
682
|
}
|
|
@@ -401,32 +686,31 @@ const StyledAlert = styled__default.default(designSystem.Alert)`
|
|
|
401
686
|
`;
|
|
402
687
|
const INITIAL_FORM_VALUES = {
|
|
403
688
|
name: "",
|
|
404
|
-
date:
|
|
689
|
+
date: dateFns.format(/* @__PURE__ */ new Date(), "yyyy-MM-dd"),
|
|
405
690
|
time: "",
|
|
406
691
|
isScheduled: true,
|
|
407
692
|
scheduledAt: null,
|
|
408
693
|
timezone: null
|
|
409
694
|
};
|
|
410
695
|
const ReleasesPage = () => {
|
|
411
|
-
const tabRef = React__namespace.useRef(null);
|
|
412
696
|
const location = reactRouterDom.useLocation();
|
|
413
697
|
const [releaseModalShown, setReleaseModalShown] = React__namespace.useState(false);
|
|
414
|
-
const { toggleNotification } = strapiAdmin.useNotification();
|
|
698
|
+
const { toggleNotification } = strapiAdmin$1.useNotification();
|
|
415
699
|
const { formatMessage } = reactIntl.useIntl();
|
|
416
700
|
const navigate = reactRouterDom.useNavigate();
|
|
417
|
-
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
418
|
-
const [{ query }, setQuery] = strapiAdmin.useQueryParams();
|
|
701
|
+
const { formatAPIError } = strapiAdmin$1.useAPIErrorHandler();
|
|
702
|
+
const [{ query }, setQuery] = strapiAdmin$1.useQueryParams();
|
|
419
703
|
const response = index.useGetReleasesQuery(query);
|
|
704
|
+
const { data, isLoading: isLoadingSettings } = index.useGetReleaseSettingsQuery();
|
|
420
705
|
const [createRelease, { isLoading: isSubmittingForm }] = index.useCreateReleaseMutation();
|
|
421
706
|
const { getFeature } = ee.useLicenseLimits();
|
|
422
707
|
const { maximumReleases = 3 } = getFeature("cms-content-releases");
|
|
423
|
-
const { trackUsage } = strapiAdmin.useTracking();
|
|
708
|
+
const { trackUsage } = strapiAdmin$1.useTracking();
|
|
424
709
|
const {
|
|
425
710
|
allowedActions: { canCreate }
|
|
426
|
-
} = strapiAdmin.useRBAC(index.PERMISSIONS);
|
|
427
|
-
const { isLoading, isSuccess, isError } = response;
|
|
711
|
+
} = strapiAdmin$1.useRBAC(index.PERMISSIONS);
|
|
712
|
+
const { isLoading: isLoadingReleases, isSuccess, isError } = response;
|
|
428
713
|
const activeTab = response?.currentData?.meta?.activeTab || "pending";
|
|
429
|
-
const activeTabIndex = ["pending", "done"].indexOf(activeTab);
|
|
430
714
|
React__namespace.useEffect(() => {
|
|
431
715
|
if (location?.state?.errors) {
|
|
432
716
|
toggleNotification({
|
|
@@ -443,27 +727,22 @@ const ReleasesPage = () => {
|
|
|
443
727
|
navigate("", { replace: true, state: null });
|
|
444
728
|
}
|
|
445
729
|
}, [formatMessage, location?.state?.errors, navigate, toggleNotification]);
|
|
446
|
-
React__namespace.useEffect(() => {
|
|
447
|
-
if (tabRef.current) {
|
|
448
|
-
tabRef.current._handlers.setSelectedTabIndex(activeTabIndex);
|
|
449
|
-
}
|
|
450
|
-
}, [activeTabIndex]);
|
|
451
730
|
const toggleAddReleaseModal = () => {
|
|
452
731
|
setReleaseModalShown((prev) => !prev);
|
|
453
732
|
};
|
|
454
|
-
if (
|
|
455
|
-
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
|
|
733
|
+
if (isLoadingReleases || isLoadingSettings) {
|
|
734
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Page.Loading, {});
|
|
456
735
|
}
|
|
457
736
|
const totalPendingReleases = isSuccess && response.currentData?.meta?.pendingReleasesCount || 0;
|
|
458
737
|
const hasReachedMaximumPendingReleases = totalPendingReleases >= maximumReleases;
|
|
459
|
-
const handleTabChange = (
|
|
738
|
+
const handleTabChange = (tabValue) => {
|
|
460
739
|
setQuery({
|
|
461
740
|
...query,
|
|
462
741
|
page: 1,
|
|
463
742
|
pageSize: response?.currentData?.meta?.pagination?.pageSize || 16,
|
|
464
743
|
filters: {
|
|
465
744
|
releasedAt: {
|
|
466
|
-
$notNull:
|
|
745
|
+
$notNull: tabValue !== "pending"
|
|
467
746
|
}
|
|
468
747
|
}
|
|
469
748
|
});
|
|
@@ -484,7 +763,7 @@ const ReleasesPage = () => {
|
|
|
484
763
|
});
|
|
485
764
|
trackUsage("didCreateRelease");
|
|
486
765
|
navigate(response2.data.data.id.toString());
|
|
487
|
-
} else if (
|
|
766
|
+
} else if (strapiAdmin$1.isFetchError(response2.error)) {
|
|
488
767
|
toggleNotification({
|
|
489
768
|
type: "danger",
|
|
490
769
|
message: formatAPIError(response2.error)
|
|
@@ -496,9 +775,9 @@ const ReleasesPage = () => {
|
|
|
496
775
|
});
|
|
497
776
|
}
|
|
498
777
|
};
|
|
499
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { "aria-busy":
|
|
778
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { "aria-busy": isLoadingReleases || isLoadingSettings, children: [
|
|
500
779
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
501
|
-
strapiAdmin.Layouts.Header,
|
|
780
|
+
strapiAdmin$1.Layouts.Header,
|
|
502
781
|
{
|
|
503
782
|
title: formatMessage({
|
|
504
783
|
id: "content-releases.pages.Releases.title",
|
|
@@ -522,7 +801,7 @@ const ReleasesPage = () => {
|
|
|
522
801
|
) : null
|
|
523
802
|
}
|
|
524
803
|
),
|
|
525
|
-
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
804
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
526
805
|
hasReachedMaximumPendingReleases && /* @__PURE__ */ jsxRuntime.jsx(
|
|
527
806
|
StyledAlert,
|
|
528
807
|
{
|
|
@@ -547,21 +826,17 @@ const ReleasesPage = () => {
|
|
|
547
826
|
})
|
|
548
827
|
}
|
|
549
828
|
),
|
|
550
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
551
|
-
designSystem.
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
children: [
|
|
562
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { paddingBottom: 8, children: [
|
|
563
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tabs, { children: [
|
|
564
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tab, { children: formatMessage(
|
|
829
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tabs.Root, { variant: "simple", onValueChange: handleTabChange, value: activeTab, children: [
|
|
830
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { paddingBottom: 8, children: [
|
|
831
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
832
|
+
designSystem.Tabs.List,
|
|
833
|
+
{
|
|
834
|
+
"aria-label": formatMessage({
|
|
835
|
+
id: "content-releases.pages.Releases.tab-group.label",
|
|
836
|
+
defaultMessage: "Releases list"
|
|
837
|
+
}),
|
|
838
|
+
children: [
|
|
839
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Trigger, { value: "pending", children: formatMessage(
|
|
565
840
|
{
|
|
566
841
|
id: "content-releases.pages.Releases.tab.pending",
|
|
567
842
|
defaultMessage: "Pending ({count})"
|
|
@@ -570,64 +845,66 @@ const ReleasesPage = () => {
|
|
|
570
845
|
count: totalPendingReleases
|
|
571
846
|
}
|
|
572
847
|
) }),
|
|
573
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
848
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Trigger, { value: "done", children: formatMessage({
|
|
574
849
|
id: "content-releases.pages.Releases.tab.done",
|
|
575
850
|
defaultMessage: "Done"
|
|
576
851
|
}) })
|
|
577
|
-
]
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
}
|
|
600
|
-
),
|
|
852
|
+
]
|
|
853
|
+
}
|
|
854
|
+
),
|
|
855
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Divider, {})
|
|
856
|
+
] }),
|
|
857
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Content, { value: "pending", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
858
|
+
ReleasesGrid,
|
|
859
|
+
{
|
|
860
|
+
sectionTitle: "pending",
|
|
861
|
+
releases: response?.currentData?.data,
|
|
862
|
+
isError
|
|
863
|
+
}
|
|
864
|
+
) }),
|
|
865
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Content, { value: "done", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
866
|
+
ReleasesGrid,
|
|
867
|
+
{
|
|
868
|
+
sectionTitle: "done",
|
|
869
|
+
releases: response?.currentData?.data,
|
|
870
|
+
isError
|
|
871
|
+
}
|
|
872
|
+
) })
|
|
873
|
+
] }),
|
|
601
874
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
602
|
-
strapiAdmin.Pagination.Root,
|
|
875
|
+
strapiAdmin$1.Pagination.Root,
|
|
603
876
|
{
|
|
604
877
|
...response?.currentData?.meta?.pagination,
|
|
605
878
|
defaultPageSize: response?.currentData?.meta?.pagination?.pageSize,
|
|
606
879
|
children: [
|
|
607
|
-
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.PageSize, { options: ["8", "16", "32", "64"] }),
|
|
608
|
-
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.Links, {})
|
|
880
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Pagination.PageSize, { options: ["8", "16", "32", "64"] }),
|
|
881
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Pagination.Links, {})
|
|
609
882
|
]
|
|
610
883
|
}
|
|
611
884
|
)
|
|
612
885
|
] }) }),
|
|
613
|
-
|
|
886
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
614
887
|
ReleaseModal,
|
|
615
888
|
{
|
|
889
|
+
open: releaseModalShown,
|
|
616
890
|
handleClose: toggleAddReleaseModal,
|
|
617
891
|
handleSubmit: handleAddRelease,
|
|
618
892
|
isLoading: isSubmittingForm,
|
|
619
|
-
initialValues:
|
|
893
|
+
initialValues: {
|
|
894
|
+
...INITIAL_FORM_VALUES,
|
|
895
|
+
timezone: data?.data.defaultTimezone ? data.data.defaultTimezone.split("&")[1] : null
|
|
896
|
+
}
|
|
620
897
|
}
|
|
621
898
|
)
|
|
622
899
|
] });
|
|
623
900
|
};
|
|
624
|
-
const ReleaseInfoWrapper =
|
|
901
|
+
const ReleaseInfoWrapper = styledComponents.styled(designSystem.Flex)`
|
|
625
902
|
align-self: stretch;
|
|
626
903
|
border-bottom-right-radius: ${({ theme }) => theme.borderRadius};
|
|
627
904
|
border-bottom-left-radius: ${({ theme }) => theme.borderRadius};
|
|
628
905
|
border-top: 1px solid ${({ theme }) => theme.colors.neutral150};
|
|
629
906
|
`;
|
|
630
|
-
const StyledMenuItem =
|
|
907
|
+
const StyledMenuItem = styledComponents.styled(designSystem.MenuItem)`
|
|
631
908
|
svg path {
|
|
632
909
|
fill: ${({ theme, disabled }) => disabled && theme.colors.neutral500};
|
|
633
910
|
}
|
|
@@ -636,73 +913,23 @@ const StyledMenuItem = styled__default.default(designSystem.Menu.Item)`
|
|
|
636
913
|
}
|
|
637
914
|
|
|
638
915
|
&:hover {
|
|
639
|
-
background: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}100`]};
|
|
916
|
+
background: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}100`]};
|
|
640
917
|
}
|
|
641
918
|
`;
|
|
642
|
-
const PencilIcon =
|
|
643
|
-
width: ${({ theme }) => theme.spaces[
|
|
644
|
-
height: ${({ theme }) => theme.spaces[
|
|
919
|
+
const PencilIcon = styledComponents.styled(icons.Pencil)`
|
|
920
|
+
width: ${({ theme }) => theme.spaces[4]};
|
|
921
|
+
height: ${({ theme }) => theme.spaces[4]};
|
|
645
922
|
path {
|
|
646
923
|
fill: ${({ theme }) => theme.colors.neutral600};
|
|
647
924
|
}
|
|
648
925
|
`;
|
|
649
|
-
const TrashIcon =
|
|
650
|
-
width: ${({ theme }) => theme.spaces[
|
|
651
|
-
height: ${({ theme }) => theme.spaces[
|
|
926
|
+
const TrashIcon = styledComponents.styled(icons.Trash)`
|
|
927
|
+
width: ${({ theme }) => theme.spaces[4]};
|
|
928
|
+
height: ${({ theme }) => theme.spaces[4]};
|
|
652
929
|
path {
|
|
653
930
|
fill: ${({ theme }) => theme.colors.danger600};
|
|
654
931
|
}
|
|
655
932
|
`;
|
|
656
|
-
const TypographyMaxWidth = styled__default.default(designSystem.Typography)`
|
|
657
|
-
max-width: 300px;
|
|
658
|
-
`;
|
|
659
|
-
const EntryValidationText = ({ action, schema, entry }) => {
|
|
660
|
-
const { formatMessage } = reactIntl.useIntl();
|
|
661
|
-
const { validate } = strapiAdmin$1.unstable_useDocument(
|
|
662
|
-
{
|
|
663
|
-
collectionType: schema?.kind ?? "",
|
|
664
|
-
model: schema?.uid ?? ""
|
|
665
|
-
},
|
|
666
|
-
{
|
|
667
|
-
skip: !schema
|
|
668
|
-
}
|
|
669
|
-
);
|
|
670
|
-
const errors = validate(entry) ?? {};
|
|
671
|
-
if (Object.keys(errors).length > 0) {
|
|
672
|
-
const validationErrorsMessages = Object.entries(errors).map(
|
|
673
|
-
([key, value]) => formatMessage(
|
|
674
|
-
{ id: `${value.id}.withField`, defaultMessage: value.defaultMessage },
|
|
675
|
-
{ field: key }
|
|
676
|
-
)
|
|
677
|
-
).join(" ");
|
|
678
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
679
|
-
/* @__PURE__ */ jsxRuntime.jsx(icons.CrossCircle, { fill: "danger600" }),
|
|
680
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tooltip, { description: validationErrorsMessages, children: /* @__PURE__ */ jsxRuntime.jsx(TypographyMaxWidth, { textColor: "danger600", variant: "omega", fontWeight: "semiBold", ellipsis: true, children: validationErrorsMessages }) })
|
|
681
|
-
] });
|
|
682
|
-
}
|
|
683
|
-
if (action == "publish") {
|
|
684
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
685
|
-
/* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
|
686
|
-
entry.publishedAt ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "success600", fontWeight: "bold", children: formatMessage({
|
|
687
|
-
id: "content-releases.pages.ReleaseDetails.entry-validation.already-published",
|
|
688
|
-
defaultMessage: "Already published"
|
|
689
|
-
}) }) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
|
|
690
|
-
id: "content-releases.pages.ReleaseDetails.entry-validation.ready-to-publish",
|
|
691
|
-
defaultMessage: "Ready to publish"
|
|
692
|
-
}) })
|
|
693
|
-
] });
|
|
694
|
-
}
|
|
695
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
696
|
-
/* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
|
697
|
-
!entry.publishedAt ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "success600", fontWeight: "bold", children: formatMessage({
|
|
698
|
-
id: "content-releases.pages.ReleaseDetails.entry-validation.already-unpublished",
|
|
699
|
-
defaultMessage: "Already unpublished"
|
|
700
|
-
}) }) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
|
|
701
|
-
id: "content-releases.pages.ReleaseDetails.entry-validation.ready-to-unpublish",
|
|
702
|
-
defaultMessage: "Ready to unpublish"
|
|
703
|
-
}) })
|
|
704
|
-
] });
|
|
705
|
-
};
|
|
706
933
|
const ReleaseDetailsLayout = ({
|
|
707
934
|
toggleEditReleaseModal,
|
|
708
935
|
toggleWarningSubmit,
|
|
@@ -713,7 +940,6 @@ const ReleaseDetailsLayout = ({
|
|
|
713
940
|
const {
|
|
714
941
|
data,
|
|
715
942
|
isLoading: isLoadingDetails,
|
|
716
|
-
isError,
|
|
717
943
|
error
|
|
718
944
|
} = index.useGetReleaseQuery(
|
|
719
945
|
{ id: releaseId },
|
|
@@ -722,12 +948,12 @@ const ReleaseDetailsLayout = ({
|
|
|
722
948
|
}
|
|
723
949
|
);
|
|
724
950
|
const [publishRelease, { isLoading: isPublishing }] = index.usePublishReleaseMutation();
|
|
725
|
-
const { toggleNotification } = strapiAdmin.useNotification();
|
|
726
|
-
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
727
|
-
const { allowedActions } = strapiAdmin.useRBAC(index.PERMISSIONS);
|
|
951
|
+
const { toggleNotification } = strapiAdmin$1.useNotification();
|
|
952
|
+
const { formatAPIError } = strapiAdmin$1.useAPIErrorHandler();
|
|
953
|
+
const { allowedActions } = strapiAdmin$1.useRBAC(index.PERMISSIONS);
|
|
728
954
|
const { canUpdate, canDelete, canPublish } = allowedActions;
|
|
729
955
|
const dispatch = useTypedDispatch();
|
|
730
|
-
const { trackUsage } = strapiAdmin.useTracking();
|
|
956
|
+
const { trackUsage } = strapiAdmin$1.useTracking();
|
|
731
957
|
const release = data?.data;
|
|
732
958
|
const handlePublishRelease = (id) => async () => {
|
|
733
959
|
const response = await publishRelease({ id });
|
|
@@ -745,7 +971,7 @@ const ReleaseDetailsLayout = ({
|
|
|
745
971
|
totalPublishedEntries,
|
|
746
972
|
totalUnpublishedEntries
|
|
747
973
|
});
|
|
748
|
-
} else if (
|
|
974
|
+
} else if (strapiAdmin$1.isFetchError(response.error)) {
|
|
749
975
|
toggleNotification({
|
|
750
976
|
type: "danger",
|
|
751
977
|
message: formatAPIError(response.error)
|
|
@@ -778,9 +1004,9 @@ const ReleaseDetailsLayout = ({
|
|
|
778
1004
|
return release.createdBy.email;
|
|
779
1005
|
};
|
|
780
1006
|
if (isLoadingDetails) {
|
|
781
|
-
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
|
|
1007
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Page.Loading, {});
|
|
782
1008
|
}
|
|
783
|
-
if (
|
|
1009
|
+
if (isBaseQueryError(error) && "code" in error || !release) {
|
|
784
1010
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
785
1011
|
reactRouterDom.Navigate,
|
|
786
1012
|
{
|
|
@@ -788,6 +1014,7 @@ const ReleaseDetailsLayout = ({
|
|
|
788
1014
|
state: {
|
|
789
1015
|
errors: [
|
|
790
1016
|
{
|
|
1017
|
+
// @ts-expect-error – TODO: fix this weird error flow
|
|
791
1018
|
code: error?.code
|
|
792
1019
|
}
|
|
793
1020
|
]
|
|
@@ -827,93 +1054,80 @@ const ReleaseDetailsLayout = ({
|
|
|
827
1054
|
) : "";
|
|
828
1055
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { "aria-busy": isLoadingDetails, children: [
|
|
829
1056
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
830
|
-
strapiAdmin.Layouts.Header,
|
|
1057
|
+
strapiAdmin$1.Layouts.Header,
|
|
831
1058
|
{
|
|
832
1059
|
title: release.name,
|
|
833
1060
|
subtitle: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, lineHeight: 6, children: [
|
|
834
1061
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", variant: "epsilon", children: numberOfEntriesText + (isScheduled ? ` - ${scheduledText}` : "") }),
|
|
835
1062
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { ...getBadgeProps(release.status), children: release.status })
|
|
836
1063
|
] }),
|
|
837
|
-
navigationAction: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.BackButton, {}),
|
|
1064
|
+
navigationAction: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.BackButton, { fallback: ".." }),
|
|
838
1065
|
primaryAction: !release.releasedAt && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
839
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
{
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
1066
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1067
|
+
SimpleMenuButton,
|
|
1068
|
+
{
|
|
1069
|
+
label: /* @__PURE__ */ jsxRuntime.jsx(icons.More, {}),
|
|
1070
|
+
variant: "tertiary",
|
|
1071
|
+
endIcon: null,
|
|
1072
|
+
paddingLeft: "7px",
|
|
1073
|
+
paddingRight: "7px",
|
|
1074
|
+
"aria-label": formatMessage({
|
|
1075
|
+
id: "content-releases.header.actions.open-release-actions",
|
|
1076
|
+
defaultMessage: "Release edit and delete menu"
|
|
1077
|
+
}),
|
|
1078
|
+
popoverPlacement: "bottom-end",
|
|
1079
|
+
children: [
|
|
1080
|
+
/* @__PURE__ */ jsxRuntime.jsx(StyledMenuItem, { disabled: !canUpdate, onSelect: toggleEditReleaseModal, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 2, hasRadius: true, width: "100%", children: [
|
|
1081
|
+
/* @__PURE__ */ jsxRuntime.jsx(PencilIcon, {}),
|
|
1082
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { ellipsis: true, children: formatMessage({
|
|
1083
|
+
id: "content-releases.header.actions.edit",
|
|
1084
|
+
defaultMessage: "Edit"
|
|
1085
|
+
}) })
|
|
1086
|
+
] }) }),
|
|
1087
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1088
|
+
StyledMenuItem,
|
|
1089
|
+
{
|
|
1090
|
+
disabled: !canDelete,
|
|
1091
|
+
onSelect: toggleWarningSubmit,
|
|
1092
|
+
$variant: "danger",
|
|
1093
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 2, hasRadius: true, width: "100%", children: [
|
|
1094
|
+
/* @__PURE__ */ jsxRuntime.jsx(TrashIcon, {}),
|
|
1095
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { ellipsis: true, textColor: "danger600", children: formatMessage({
|
|
1096
|
+
id: "content-releases.header.actions.delete",
|
|
1097
|
+
defaultMessage: "Delete"
|
|
869
1098
|
}) })
|
|
870
|
-
] }) }),
|
|
871
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
872
|
-
StyledMenuItem,
|
|
873
|
-
{
|
|
874
|
-
disabled: !canDelete,
|
|
875
|
-
onSelect: toggleWarningSubmit,
|
|
876
|
-
variant: "danger",
|
|
877
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 2, hasRadius: true, width: "100%", children: [
|
|
878
|
-
/* @__PURE__ */ jsxRuntime.jsx(TrashIcon, {}),
|
|
879
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { ellipsis: true, textColor: "danger600", children: formatMessage({
|
|
880
|
-
id: "content-releases.header.actions.delete",
|
|
881
|
-
defaultMessage: "Delete"
|
|
882
|
-
}) })
|
|
883
|
-
] })
|
|
884
|
-
}
|
|
885
|
-
)
|
|
886
|
-
]
|
|
887
|
-
}
|
|
888
|
-
),
|
|
889
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
890
|
-
ReleaseInfoWrapper,
|
|
891
|
-
{
|
|
892
|
-
direction: "column",
|
|
893
|
-
justifyContent: "center",
|
|
894
|
-
alignItems: "flex-start",
|
|
895
|
-
gap: 1,
|
|
896
|
-
padding: 5,
|
|
897
|
-
children: [
|
|
898
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", children: formatMessage({
|
|
899
|
-
id: "content-releases.header.actions.created",
|
|
900
|
-
defaultMessage: "Created"
|
|
901
|
-
}) }),
|
|
902
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", color: "neutral300", children: [
|
|
903
|
-
/* @__PURE__ */ jsxRuntime.jsx(RelativeTime$1, { timestamp: new Date(release.createdAt) }),
|
|
904
|
-
formatMessage(
|
|
905
|
-
{
|
|
906
|
-
id: "content-releases.header.actions.created.description",
|
|
907
|
-
defaultMessage: "{hasCreatedByUser, select, true { by {createdBy}} other { by deleted user}}"
|
|
908
|
-
},
|
|
909
|
-
{ createdBy: getCreatedByUser(), hasCreatedByUser }
|
|
910
|
-
)
|
|
911
1099
|
] })
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
1100
|
+
}
|
|
1101
|
+
),
|
|
1102
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1103
|
+
ReleaseInfoWrapper,
|
|
1104
|
+
{
|
|
1105
|
+
direction: "column",
|
|
1106
|
+
justifyContent: "center",
|
|
1107
|
+
alignItems: "flex-start",
|
|
1108
|
+
gap: 1,
|
|
1109
|
+
padding: 4,
|
|
1110
|
+
children: [
|
|
1111
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", children: formatMessage({
|
|
1112
|
+
id: "content-releases.header.actions.created",
|
|
1113
|
+
defaultMessage: "Created"
|
|
1114
|
+
}) }),
|
|
1115
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", color: "neutral300", children: [
|
|
1116
|
+
/* @__PURE__ */ jsxRuntime.jsx(RelativeTime$1, { timestamp: new Date(release.createdAt) }),
|
|
1117
|
+
formatMessage(
|
|
1118
|
+
{
|
|
1119
|
+
id: "content-releases.header.actions.created.description",
|
|
1120
|
+
defaultMessage: "{hasCreatedByUser, select, true { by {createdBy}} other { by deleted user}}"
|
|
1121
|
+
},
|
|
1122
|
+
{ createdBy: getCreatedByUser(), hasCreatedByUser }
|
|
1123
|
+
)
|
|
1124
|
+
] })
|
|
1125
|
+
]
|
|
1126
|
+
}
|
|
1127
|
+
)
|
|
1128
|
+
]
|
|
1129
|
+
}
|
|
1130
|
+
),
|
|
917
1131
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { size: "S", variant: "tertiary", onClick: handleRefresh, children: formatMessage({
|
|
918
1132
|
id: "content-releases.header.actions.refresh",
|
|
919
1133
|
defaultMessage: "Refresh"
|
|
@@ -938,6 +1152,11 @@ const ReleaseDetailsLayout = ({
|
|
|
938
1152
|
children
|
|
939
1153
|
] });
|
|
940
1154
|
};
|
|
1155
|
+
const SimpleMenuButton = styledComponents.styled(designSystem.SimpleMenu)`
|
|
1156
|
+
& > span {
|
|
1157
|
+
display: flex;
|
|
1158
|
+
}
|
|
1159
|
+
`;
|
|
941
1160
|
const GROUP_BY_OPTIONS = ["contentType", "locale", "action"];
|
|
942
1161
|
const GROUP_BY_OPTIONS_NO_LOCALE = ["contentType", "action"];
|
|
943
1162
|
const getGroupByOptionLabel = (value) => {
|
|
@@ -960,32 +1179,30 @@ const getGroupByOptionLabel = (value) => {
|
|
|
960
1179
|
};
|
|
961
1180
|
const ReleaseDetailsBody = ({ releaseId }) => {
|
|
962
1181
|
const { formatMessage } = reactIntl.useIntl();
|
|
963
|
-
const [{ query }, setQuery] = strapiAdmin.useQueryParams();
|
|
964
|
-
const { toggleNotification } = strapiAdmin.useNotification();
|
|
965
|
-
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
1182
|
+
const [{ query }, setQuery] = strapiAdmin$1.useQueryParams();
|
|
1183
|
+
const { toggleNotification } = strapiAdmin$1.useNotification();
|
|
1184
|
+
const { formatAPIError } = strapiAdmin$1.useAPIErrorHandler();
|
|
966
1185
|
const {
|
|
967
1186
|
data: releaseData,
|
|
968
1187
|
isLoading: isReleaseLoading,
|
|
969
|
-
isError: isReleaseError,
|
|
970
1188
|
error: releaseError
|
|
971
1189
|
} = index.useGetReleaseQuery({ id: releaseId });
|
|
972
1190
|
const {
|
|
973
1191
|
allowedActions: { canUpdate }
|
|
974
|
-
} = strapiAdmin.useRBAC(index.PERMISSIONS);
|
|
975
|
-
const runHookWaterfall = strapiAdmin.useStrapiApp("ReleaseDetailsPage", (state) => state.runHookWaterfall);
|
|
976
|
-
const { hasI18nEnabled } = runHookWaterfall(
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
);
|
|
1192
|
+
} = strapiAdmin$1.useRBAC(index.PERMISSIONS);
|
|
1193
|
+
const runHookWaterfall = strapiAdmin$1.useStrapiApp("ReleaseDetailsPage", (state) => state.runHookWaterfall);
|
|
1194
|
+
const { displayedHeaders, hasI18nEnabled } = runHookWaterfall("ContentReleases/pages/ReleaseDetails/add-locale-in-releases", {
|
|
1195
|
+
displayedHeaders: [
|
|
1196
|
+
{
|
|
1197
|
+
label: {
|
|
1198
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.name",
|
|
1199
|
+
defaultMessage: "name"
|
|
1200
|
+
},
|
|
1201
|
+
name: "name"
|
|
1202
|
+
}
|
|
1203
|
+
],
|
|
1204
|
+
hasI18nEnabled: false
|
|
1205
|
+
});
|
|
989
1206
|
const release = releaseData?.data;
|
|
990
1207
|
const selectedGroupBy = query?.groupBy || "contentType";
|
|
991
1208
|
const {
|
|
@@ -1014,7 +1231,7 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1014
1231
|
// We are passing the action path to found the position in the cache of the action for optimistic updates
|
|
1015
1232
|
});
|
|
1016
1233
|
if ("error" in response) {
|
|
1017
|
-
if (
|
|
1234
|
+
if (strapiAdmin$1.isFetchError(response.error)) {
|
|
1018
1235
|
toggleNotification({
|
|
1019
1236
|
type: "danger",
|
|
1020
1237
|
message: formatAPIError(response.error)
|
|
@@ -1028,20 +1245,20 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1028
1245
|
}
|
|
1029
1246
|
};
|
|
1030
1247
|
if (isLoading || isReleaseLoading) {
|
|
1031
|
-
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
|
|
1248
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Page.Loading, {});
|
|
1032
1249
|
}
|
|
1033
1250
|
const releaseActions = data?.data;
|
|
1034
1251
|
const releaseMeta = data?.meta;
|
|
1035
1252
|
const contentTypes = releaseMeta?.contentTypes || {};
|
|
1036
|
-
|
|
1037
|
-
if (
|
|
1253
|
+
releaseMeta?.components || {};
|
|
1254
|
+
if (isBaseQueryError(releaseError) || !release) {
|
|
1038
1255
|
const errorsArray = [];
|
|
1039
|
-
if (releaseError) {
|
|
1256
|
+
if (releaseError && "code" in releaseError) {
|
|
1040
1257
|
errorsArray.push({
|
|
1041
1258
|
code: releaseError.code
|
|
1042
1259
|
});
|
|
1043
1260
|
}
|
|
1044
|
-
if (releaseActionsError) {
|
|
1261
|
+
if (releaseActionsError && "code" in releaseActionsError) {
|
|
1045
1262
|
errorsArray.push({
|
|
1046
1263
|
code: releaseActionsError.code
|
|
1047
1264
|
});
|
|
@@ -1057,16 +1274,16 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1057
1274
|
);
|
|
1058
1275
|
}
|
|
1059
1276
|
if (isError || !releaseActions) {
|
|
1060
|
-
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Error, {});
|
|
1277
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Page.Error, {});
|
|
1061
1278
|
}
|
|
1062
1279
|
if (Object.keys(releaseActions).length === 0) {
|
|
1063
|
-
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1280
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1064
1281
|
designSystem.EmptyStateLayout,
|
|
1065
1282
|
{
|
|
1066
1283
|
action: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1067
1284
|
designSystem.LinkButton,
|
|
1068
1285
|
{
|
|
1069
|
-
|
|
1286
|
+
tag: reactRouterDom.Link,
|
|
1070
1287
|
to: {
|
|
1071
1288
|
pathname: "/content-manager"
|
|
1072
1289
|
},
|
|
@@ -1091,40 +1308,33 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1091
1308
|
defaultMessage: "Group by"
|
|
1092
1309
|
});
|
|
1093
1310
|
const headers = [
|
|
1094
|
-
|
|
1095
|
-
{
|
|
1096
|
-
label: formatMessage({
|
|
1097
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.name",
|
|
1098
|
-
defaultMessage: "name"
|
|
1099
|
-
}),
|
|
1100
|
-
name: "name"
|
|
1101
|
-
},
|
|
1311
|
+
...displayedHeaders,
|
|
1102
1312
|
{
|
|
1103
|
-
label:
|
|
1313
|
+
label: {
|
|
1104
1314
|
id: "content-releases.page.ReleaseDetails.table.header.label.content-type",
|
|
1105
1315
|
defaultMessage: "content-type"
|
|
1106
|
-
}
|
|
1316
|
+
},
|
|
1107
1317
|
name: "content-type"
|
|
1108
1318
|
},
|
|
1109
1319
|
{
|
|
1110
|
-
label:
|
|
1320
|
+
label: {
|
|
1111
1321
|
id: "content-releases.page.ReleaseDetails.table.header.label.action",
|
|
1112
1322
|
defaultMessage: "action"
|
|
1113
|
-
}
|
|
1323
|
+
},
|
|
1114
1324
|
name: "action"
|
|
1115
1325
|
},
|
|
1116
1326
|
...!release.releasedAt ? [
|
|
1117
1327
|
{
|
|
1118
|
-
label:
|
|
1328
|
+
label: {
|
|
1119
1329
|
id: "content-releases.page.ReleaseDetails.table.header.label.status",
|
|
1120
1330
|
defaultMessage: "status"
|
|
1121
|
-
}
|
|
1331
|
+
},
|
|
1122
1332
|
name: "status"
|
|
1123
1333
|
}
|
|
1124
1334
|
] : []
|
|
1125
1335
|
];
|
|
1126
1336
|
const options = hasI18nEnabled ? GROUP_BY_OPTIONS : GROUP_BY_OPTIONS_NO_LOCALE;
|
|
1127
|
-
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 8, direction: "column", alignItems: "stretch", children: [
|
|
1337
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 8, direction: "column", alignItems: "stretch", children: [
|
|
1128
1338
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1129
1339
|
designSystem.SingleSelect,
|
|
1130
1340
|
{
|
|
@@ -1147,7 +1357,7 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1147
1357
|
Object.keys(releaseActions).map((key) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, direction: "column", alignItems: "stretch", children: [
|
|
1148
1358
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { role: "separator", "aria-label": key, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { children: key }) }),
|
|
1149
1359
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1150
|
-
strapiAdmin.Table.Root,
|
|
1360
|
+
strapiAdmin$1.Table.Root,
|
|
1151
1361
|
{
|
|
1152
1362
|
rows: releaseActions[key].map((item) => ({
|
|
1153
1363
|
...item,
|
|
@@ -1155,11 +1365,11 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1155
1365
|
})),
|
|
1156
1366
|
headers,
|
|
1157
1367
|
isLoading: isLoading || isFetching,
|
|
1158
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(strapiAdmin.Table.Content, { children: [
|
|
1159
|
-
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Head, { children: headers.map((
|
|
1160
|
-
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Loading, {}),
|
|
1161
|
-
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Body, { children: releaseActions[key].map(
|
|
1162
|
-
({ id, contentType, locale, type, entry }, actionIndex) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
1368
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(strapiAdmin$1.Table.Content, { children: [
|
|
1369
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Table.Head, { children: headers.map(({ label, name }) => /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Table.HeaderCell, { label: formatMessage(label), name }, name)) }),
|
|
1370
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Table.Loading, {}),
|
|
1371
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Table.Body, { children: releaseActions[key].map(
|
|
1372
|
+
({ id, contentType, locale, type, entry, status }, actionIndex) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
1163
1373
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "25%", maxWidth: "200px", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { ellipsis: true, children: `${contentType.mainFieldValue || entry.id}` }) }),
|
|
1164
1374
|
hasI18nEnabled && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "10%", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: `${locale?.name ? locale.name : "-"}` }) }),
|
|
1165
1375
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "10%", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: contentType.displayName || "" }) }),
|
|
@@ -1183,12 +1393,12 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1183
1393
|
) }),
|
|
1184
1394
|
!release.releasedAt && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1185
1395
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "20%", minWidth: "200px", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1186
|
-
|
|
1396
|
+
EntryValidationPopover,
|
|
1187
1397
|
{
|
|
1188
1398
|
action: type,
|
|
1189
1399
|
schema: contentTypes?.[contentType.uid],
|
|
1190
|
-
|
|
1191
|
-
|
|
1400
|
+
entry,
|
|
1401
|
+
status
|
|
1192
1402
|
}
|
|
1193
1403
|
) }),
|
|
1194
1404
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsxs(index.ReleaseActionMenu.Root, { children: [
|
|
@@ -1196,7 +1406,7 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1196
1406
|
index.ReleaseActionMenu.ReleaseActionEntryLinkItem,
|
|
1197
1407
|
{
|
|
1198
1408
|
contentTypeUid: contentType.uid,
|
|
1199
|
-
|
|
1409
|
+
documentId: entry.documentId,
|
|
1200
1410
|
locale: locale?.code
|
|
1201
1411
|
}
|
|
1202
1412
|
),
|
|
@@ -1216,13 +1426,13 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1216
1426
|
)
|
|
1217
1427
|
] }, `releases-group-${key}`)),
|
|
1218
1428
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1219
|
-
strapiAdmin.Pagination.Root,
|
|
1429
|
+
strapiAdmin$1.Pagination.Root,
|
|
1220
1430
|
{
|
|
1221
1431
|
...releaseMeta?.pagination,
|
|
1222
1432
|
defaultPageSize: releaseMeta?.pagination?.pageSize,
|
|
1223
1433
|
children: [
|
|
1224
|
-
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.PageSize, {}),
|
|
1225
|
-
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.Links, {})
|
|
1434
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Pagination.PageSize, {}),
|
|
1435
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Pagination.Links, {})
|
|
1226
1436
|
]
|
|
1227
1437
|
}
|
|
1228
1438
|
)
|
|
@@ -1231,8 +1441,8 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1231
1441
|
const ReleaseDetailsPage = () => {
|
|
1232
1442
|
const { formatMessage } = reactIntl.useIntl();
|
|
1233
1443
|
const { releaseId } = reactRouterDom.useParams();
|
|
1234
|
-
const { toggleNotification } = strapiAdmin.useNotification();
|
|
1235
|
-
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
1444
|
+
const { toggleNotification } = strapiAdmin$1.useNotification();
|
|
1445
|
+
const { formatAPIError } = strapiAdmin$1.useAPIErrorHandler();
|
|
1236
1446
|
const navigate = reactRouterDom.useNavigate();
|
|
1237
1447
|
const [releaseModalShown, setReleaseModalShown] = React__namespace.useState(false);
|
|
1238
1448
|
const [showWarningSubmit, setWarningSubmit] = React__namespace.useState(false);
|
|
@@ -1246,19 +1456,30 @@ const ReleaseDetailsPage = () => {
|
|
|
1246
1456
|
skip: !releaseId
|
|
1247
1457
|
}
|
|
1248
1458
|
);
|
|
1459
|
+
const { data: dataTimezone, isLoading: isLoadingTimezone } = index.useGetReleaseSettingsQuery();
|
|
1249
1460
|
const [updateRelease, { isLoading: isSubmittingForm }] = index.useUpdateReleaseMutation();
|
|
1250
1461
|
const [deleteRelease] = index.useDeleteReleaseMutation();
|
|
1251
1462
|
const toggleEditReleaseModal = () => {
|
|
1252
1463
|
setReleaseModalShown((prev) => !prev);
|
|
1253
1464
|
};
|
|
1465
|
+
const getTimezoneValue = () => {
|
|
1466
|
+
if (releaseData?.timezone) {
|
|
1467
|
+
return releaseData.timezone;
|
|
1468
|
+
} else {
|
|
1469
|
+
if (dataTimezone?.data.defaultTimezone) {
|
|
1470
|
+
return dataTimezone.data.defaultTimezone;
|
|
1471
|
+
}
|
|
1472
|
+
return null;
|
|
1473
|
+
}
|
|
1474
|
+
};
|
|
1254
1475
|
const toggleWarningSubmit = () => setWarningSubmit((prevState) => !prevState);
|
|
1255
|
-
if (isLoadingDetails) {
|
|
1476
|
+
if (isLoadingDetails || isLoadingTimezone) {
|
|
1256
1477
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1257
1478
|
ReleaseDetailsLayout,
|
|
1258
1479
|
{
|
|
1259
1480
|
toggleEditReleaseModal,
|
|
1260
1481
|
toggleWarningSubmit,
|
|
1261
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {})
|
|
1482
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Page.Loading, {})
|
|
1262
1483
|
}
|
|
1263
1484
|
);
|
|
1264
1485
|
}
|
|
@@ -1267,9 +1488,9 @@ const ReleaseDetailsPage = () => {
|
|
|
1267
1488
|
}
|
|
1268
1489
|
const releaseData = isSuccessDetails && data?.data || null;
|
|
1269
1490
|
const title = releaseData?.name || "";
|
|
1270
|
-
const timezone =
|
|
1491
|
+
const timezone = getTimezoneValue();
|
|
1271
1492
|
const scheduledAt = releaseData?.scheduledAt && timezone ? dateFnsTz.utcToZonedTime(releaseData.scheduledAt, timezone) : null;
|
|
1272
|
-
const date = scheduledAt ? format__default.default(scheduledAt, "yyyy-MM-dd") :
|
|
1493
|
+
const date = scheduledAt ? format__default.default(scheduledAt, "yyyy-MM-dd") : void 0;
|
|
1273
1494
|
const time = scheduledAt ? format__default.default(scheduledAt, "HH:mm") : "";
|
|
1274
1495
|
const handleEditRelease = async (values) => {
|
|
1275
1496
|
const response = await updateRelease({
|
|
@@ -1287,7 +1508,7 @@ const ReleaseDetailsPage = () => {
|
|
|
1287
1508
|
})
|
|
1288
1509
|
});
|
|
1289
1510
|
toggleEditReleaseModal();
|
|
1290
|
-
} else if (
|
|
1511
|
+
} else if (strapiAdmin$1.isFetchError(response.error)) {
|
|
1291
1512
|
toggleNotification({
|
|
1292
1513
|
type: "danger",
|
|
1293
1514
|
message: formatAPIError(response.error)
|
|
@@ -1305,7 +1526,7 @@ const ReleaseDetailsPage = () => {
|
|
|
1305
1526
|
});
|
|
1306
1527
|
if ("data" in response) {
|
|
1307
1528
|
navigate("..");
|
|
1308
|
-
} else if (
|
|
1529
|
+
} else if (strapiAdmin$1.isFetchError(response.error)) {
|
|
1309
1530
|
toggleNotification({
|
|
1310
1531
|
type: "danger",
|
|
1311
1532
|
message: formatAPIError(response.error)
|
|
@@ -1324,9 +1545,10 @@ const ReleaseDetailsPage = () => {
|
|
|
1324
1545
|
toggleWarningSubmit,
|
|
1325
1546
|
children: [
|
|
1326
1547
|
/* @__PURE__ */ jsxRuntime.jsx(ReleaseDetailsBody, { releaseId }),
|
|
1327
|
-
|
|
1548
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1328
1549
|
ReleaseModal,
|
|
1329
1550
|
{
|
|
1551
|
+
open: releaseModalShown,
|
|
1330
1552
|
handleClose: toggleEditReleaseModal,
|
|
1331
1553
|
handleSubmit: handleEditRelease,
|
|
1332
1554
|
isLoading: isLoadingDetails || isSubmittingForm,
|
|
@@ -1340,27 +1562,19 @@ const ReleaseDetailsPage = () => {
|
|
|
1340
1562
|
}
|
|
1341
1563
|
}
|
|
1342
1564
|
),
|
|
1343
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
onClose: toggleWarningSubmit,
|
|
1348
|
-
onConfirm: handleDeleteRelease,
|
|
1349
|
-
children: formatMessage({
|
|
1350
|
-
id: "content-releases.dialog.confirmation-message",
|
|
1351
|
-
defaultMessage: "Are you sure you want to delete this release?"
|
|
1352
|
-
})
|
|
1353
|
-
}
|
|
1354
|
-
)
|
|
1565
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Root, { open: showWarningSubmit, onOpenChange: toggleWarningSubmit, children: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.ConfirmDialog, { onConfirm: handleDeleteRelease, children: formatMessage({
|
|
1566
|
+
id: "content-releases.dialog.confirmation-message",
|
|
1567
|
+
defaultMessage: "Are you sure you want to delete this release?"
|
|
1568
|
+
}) }) })
|
|
1355
1569
|
]
|
|
1356
1570
|
}
|
|
1357
1571
|
);
|
|
1358
1572
|
};
|
|
1359
1573
|
const App = () => {
|
|
1360
|
-
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Protect, { permissions: index.PERMISSIONS.main, children: /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.Routes, { children: [
|
|
1574
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Page.Protect, { permissions: index.PERMISSIONS.main, children: /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.Routes, { children: [
|
|
1361
1575
|
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { index: true, element: /* @__PURE__ */ jsxRuntime.jsx(ReleasesPage, {}) }),
|
|
1362
1576
|
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: ":releaseId", element: /* @__PURE__ */ jsxRuntime.jsx(ReleaseDetailsPage, {}) })
|
|
1363
1577
|
] }) });
|
|
1364
1578
|
};
|
|
1365
1579
|
exports.App = App;
|
|
1366
|
-
//# sourceMappingURL=App-
|
|
1580
|
+
//# sourceMappingURL=App-lx4Ucy9W.js.map
|