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