@strapi/content-releases 0.0.0-experimental.e5740babedd53cf5b6af99d74920b6b9ef1e4c11 → 0.0.0-experimental.e60ec1829240dae21c1e1d29076681c322288813
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{App-HVXzE3i3.mjs → App-BsUSTHVD.mjs} +243 -213
- package/dist/_chunks/App-BsUSTHVD.mjs.map +1 -0
- package/dist/_chunks/{App-l62gIUTX.js → App-CXRpb2hi.js} +258 -228
- package/dist/_chunks/App-CXRpb2hi.js.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-YhAPgpG9.js → PurchaseContentReleases-Be3acS2L.js} +8 -7
- package/dist/_chunks/PurchaseContentReleases-Be3acS2L.js.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-Clm0iACO.mjs → PurchaseContentReleases-_MxP6-Dt.mjs} +9 -8
- package/dist/_chunks/PurchaseContentReleases-_MxP6-Dt.mjs.map +1 -0
- package/dist/_chunks/{en-RdapH-9X.mjs → en-B9Ur3VsE.mjs} +11 -2
- package/dist/_chunks/en-B9Ur3VsE.mjs.map +1 -0
- package/dist/_chunks/{en-faJDuv3q.js → en-DtFJ5ViE.js} +11 -2
- package/dist/_chunks/en-DtFJ5ViE.js.map +1 -0
- package/dist/_chunks/{index-ML_b3php.js → index-B6-lic1Q.js} +340 -113
- package/dist/_chunks/index-B6-lic1Q.js.map +1 -0
- package/dist/_chunks/{index-Ys87ROOe.mjs → index-DJLIZdZv.mjs} +339 -112
- package/dist/_chunks/index-DJLIZdZv.mjs.map +1 -0
- package/dist/admin/index.js +1 -15
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +2 -16
- package/dist/admin/index.mjs.map +1 -1
- package/dist/admin/src/components/CMReleasesContainer.d.ts +22 -0
- package/dist/admin/src/components/RelativeTime.d.ts +28 -0
- package/dist/admin/src/components/ReleaseAction.d.ts +3 -0
- package/dist/admin/src/components/ReleaseActionMenu.d.ts +26 -0
- package/dist/admin/src/components/ReleaseActionOptions.d.ts +9 -0
- package/dist/admin/src/components/ReleaseListCell.d.ts +0 -0
- package/dist/admin/src/components/ReleaseModal.d.ts +16 -0
- package/dist/admin/src/constants.d.ts +58 -0
- package/dist/admin/src/index.d.ts +3 -0
- package/dist/admin/src/pages/App.d.ts +1 -0
- package/dist/admin/src/pages/PurchaseContentReleases.d.ts +2 -0
- package/dist/admin/src/pages/ReleaseDetailsPage.d.ts +2 -0
- package/dist/admin/src/pages/ReleasesPage.d.ts +8 -0
- package/dist/admin/src/pages/tests/mockReleaseDetailsPageData.d.ts +181 -0
- package/dist/admin/src/pages/tests/mockReleasesPageData.d.ts +39 -0
- package/dist/admin/src/pluginId.d.ts +1 -0
- package/dist/admin/src/services/axios.d.ts +29 -0
- package/dist/admin/src/services/release.d.ts +429 -0
- package/dist/admin/src/store/hooks.d.ts +7 -0
- package/dist/admin/src/utils/prefixPluginTranslations.d.ts +3 -0
- package/dist/admin/src/utils/time.d.ts +1 -0
- package/dist/server/index.js +152 -93
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +153 -93
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/bootstrap.d.ts +5 -0
- package/dist/server/src/bootstrap.d.ts.map +1 -0
- package/dist/server/src/constants.d.ts +12 -0
- package/dist/server/src/constants.d.ts.map +1 -0
- package/dist/server/src/content-types/index.d.ts +99 -0
- package/dist/server/src/content-types/index.d.ts.map +1 -0
- package/dist/server/src/content-types/release/index.d.ts +48 -0
- package/dist/server/src/content-types/release/index.d.ts.map +1 -0
- package/dist/server/src/content-types/release/schema.d.ts +47 -0
- package/dist/server/src/content-types/release/schema.d.ts.map +1 -0
- package/dist/server/src/content-types/release-action/index.d.ts +50 -0
- package/dist/server/src/content-types/release-action/index.d.ts.map +1 -0
- package/dist/server/src/content-types/release-action/schema.d.ts +49 -0
- package/dist/server/src/content-types/release-action/schema.d.ts.map +1 -0
- package/dist/server/src/controllers/index.d.ts +20 -0
- package/dist/server/src/controllers/index.d.ts.map +1 -0
- package/dist/server/src/controllers/release-action.d.ts +10 -0
- package/dist/server/src/controllers/release-action.d.ts.map +1 -0
- package/dist/server/src/controllers/release.d.ts +12 -0
- package/dist/server/src/controllers/release.d.ts.map +1 -0
- package/dist/server/src/controllers/validation/release-action.d.ts +8 -0
- package/dist/server/src/controllers/validation/release-action.d.ts.map +1 -0
- package/dist/server/src/controllers/validation/release.d.ts +2 -0
- package/dist/server/src/controllers/validation/release.d.ts.map +1 -0
- package/dist/server/src/destroy.d.ts +5 -0
- package/dist/server/src/destroy.d.ts.map +1 -0
- package/dist/server/src/index.d.ts +2096 -0
- package/dist/server/src/index.d.ts.map +1 -0
- package/dist/server/src/migrations/index.d.ts +13 -0
- package/dist/server/src/migrations/index.d.ts.map +1 -0
- package/dist/server/src/register.d.ts +5 -0
- package/dist/server/src/register.d.ts.map +1 -0
- package/dist/server/src/routes/index.d.ts +35 -0
- package/dist/server/src/routes/index.d.ts.map +1 -0
- package/dist/server/src/routes/release-action.d.ts +18 -0
- package/dist/server/src/routes/release-action.d.ts.map +1 -0
- package/dist/server/src/routes/release.d.ts +18 -0
- package/dist/server/src/routes/release.d.ts.map +1 -0
- package/dist/server/src/services/index.d.ts +1826 -0
- package/dist/server/src/services/index.d.ts.map +1 -0
- package/dist/server/src/services/release.d.ts +66 -0
- package/dist/server/src/services/release.d.ts.map +1 -0
- package/dist/server/src/services/scheduling.d.ts +18 -0
- package/dist/server/src/services/scheduling.d.ts.map +1 -0
- package/dist/server/src/services/validation.d.ts +18 -0
- package/dist/server/src/services/validation.d.ts.map +1 -0
- package/dist/server/src/utils/index.d.ts +14 -0
- package/dist/server/src/utils/index.d.ts.map +1 -0
- package/dist/shared/contracts/release-actions.d.ts +131 -0
- package/dist/shared/contracts/release-actions.d.ts.map +1 -0
- package/dist/shared/contracts/releases.d.ts +182 -0
- package/dist/shared/contracts/releases.d.ts.map +1 -0
- package/dist/shared/types.d.ts +24 -0
- package/dist/shared/types.d.ts.map +1 -0
- package/dist/shared/validation-schemas.d.ts +2 -0
- package/dist/shared/validation-schemas.d.ts.map +1 -0
- package/package.json +26 -31
- package/dist/_chunks/App-HVXzE3i3.mjs.map +0 -1
- package/dist/_chunks/App-l62gIUTX.js.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-Clm0iACO.mjs.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-YhAPgpG9.js.map +0 -1
- package/dist/_chunks/en-RdapH-9X.mjs.map +0 -1
- package/dist/_chunks/en-faJDuv3q.js.map +0 -1
- package/dist/_chunks/index-ML_b3php.js.map +0 -1
- package/dist/_chunks/index-Ys87ROOe.mjs.map +0 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
-
const
|
|
4
|
+
const strapiAdmin = require("@strapi/admin/strapi-admin");
|
|
5
5
|
const reactRouterDom = require("react-router-dom");
|
|
6
|
-
const index = require("./index-
|
|
6
|
+
const index = require("./index-B6-lic1Q.js");
|
|
7
7
|
const React = require("react");
|
|
8
|
-
const strapiAdmin = require("@strapi/
|
|
8
|
+
const strapiAdmin$1 = require("@strapi/content-manager/strapi-admin");
|
|
9
9
|
const designSystem = require("@strapi/design-system");
|
|
10
|
-
const v2 = require("@strapi/design-system/v2");
|
|
11
10
|
const icons = require("@strapi/icons");
|
|
11
|
+
const symbols = require("@strapi/icons/symbols");
|
|
12
12
|
const format = require("date-fns/format");
|
|
13
13
|
const dateFnsTz = require("date-fns-tz");
|
|
14
14
|
const reactIntl = require("react-intl");
|
|
@@ -16,10 +16,8 @@ const styled = require("styled-components");
|
|
|
16
16
|
const dateFns = require("date-fns");
|
|
17
17
|
const formik = require("formik");
|
|
18
18
|
const yup = require("yup");
|
|
19
|
-
require("
|
|
20
|
-
require("
|
|
21
|
-
require("@reduxjs/toolkit/query/react");
|
|
22
|
-
require("react-redux");
|
|
19
|
+
const reactRedux = require("react-redux");
|
|
20
|
+
const ee = require("@strapi/admin/strapi-admin/ee");
|
|
23
21
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
24
22
|
function _interopNamespace(e) {
|
|
25
23
|
if (e && e.__esModule)
|
|
@@ -43,6 +41,36 @@ const React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
|
|
43
41
|
const format__default = /* @__PURE__ */ _interopDefault(format);
|
|
44
42
|
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
45
43
|
const yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
|
|
44
|
+
const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
|
|
45
|
+
const RelativeTime$1 = React__namespace.forwardRef(
|
|
46
|
+
({ timestamp, customIntervals = [], ...restProps }, forwardedRef) => {
|
|
47
|
+
const { formatRelativeTime, formatDate, formatTime } = reactIntl.useIntl();
|
|
48
|
+
const interval = dateFns.intervalToDuration({
|
|
49
|
+
start: timestamp,
|
|
50
|
+
end: Date.now()
|
|
51
|
+
// see https://github.com/date-fns/date-fns/issues/2891 – No idea why it's all partial it returns it every time.
|
|
52
|
+
});
|
|
53
|
+
const unit = intervals.find((intervalUnit) => {
|
|
54
|
+
return interval[intervalUnit] > 0 && Object.keys(interval).includes(intervalUnit);
|
|
55
|
+
});
|
|
56
|
+
const relativeTime = dateFns.isPast(timestamp) ? -interval[unit] : interval[unit];
|
|
57
|
+
const customInterval = customIntervals.find(
|
|
58
|
+
(custom) => interval[custom.unit] < custom.threshold
|
|
59
|
+
);
|
|
60
|
+
const displayText = customInterval ? customInterval.text : formatRelativeTime(relativeTime, unit, { numeric: "auto" });
|
|
61
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
62
|
+
"time",
|
|
63
|
+
{
|
|
64
|
+
ref: forwardedRef,
|
|
65
|
+
dateTime: timestamp.toISOString(),
|
|
66
|
+
role: "time",
|
|
67
|
+
title: `${formatDate(timestamp)} ${formatTime(timestamp)}`,
|
|
68
|
+
...restProps,
|
|
69
|
+
children: displayText
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
);
|
|
46
74
|
const RELEASE_SCHEMA = yup__namespace.object().shape({
|
|
47
75
|
name: yup__namespace.string().trim().required(),
|
|
48
76
|
scheduledAt: yup__namespace.string().nullable(),
|
|
@@ -79,9 +107,8 @@ const ReleaseModal = ({
|
|
|
79
107
|
const { date, time, timezone } = values;
|
|
80
108
|
if (!date || !time || !timezone)
|
|
81
109
|
return null;
|
|
82
|
-
const formattedDate = dateFns.parse(time, "HH:mm", new Date(date));
|
|
83
110
|
const timezoneWithoutOffset = timezone.split("&")[1];
|
|
84
|
-
return dateFnsTz.zonedTimeToUtc(
|
|
111
|
+
return dateFnsTz.zonedTimeToUtc(`${date} ${time}`, timezoneWithoutOffset);
|
|
85
112
|
};
|
|
86
113
|
const getTimezoneWithOffset = () => {
|
|
87
114
|
const currentTimezone = timezoneList.find(
|
|
@@ -281,11 +308,15 @@ const TimezoneComponent = ({ timezoneOptions }) => {
|
|
|
281
308
|
}
|
|
282
309
|
);
|
|
283
310
|
};
|
|
284
|
-
const
|
|
311
|
+
const useTypedDispatch = reactRedux.useDispatch;
|
|
312
|
+
const LinkCard = styled__default.default(designSystem.Link)`
|
|
285
313
|
display: block;
|
|
286
314
|
`;
|
|
287
|
-
const
|
|
288
|
-
|
|
315
|
+
const RelativeTime = styled__default.default(RelativeTime$1)`
|
|
316
|
+
display: inline-block;
|
|
317
|
+
&::first-letter {
|
|
318
|
+
text-transform: uppercase;
|
|
319
|
+
}
|
|
289
320
|
`;
|
|
290
321
|
const getBadgeProps = (status) => {
|
|
291
322
|
let color;
|
|
@@ -315,7 +346,7 @@ const getBadgeProps = (status) => {
|
|
|
315
346
|
const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
316
347
|
const { formatMessage } = reactIntl.useIntl();
|
|
317
348
|
if (isError) {
|
|
318
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
349
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Error, {});
|
|
319
350
|
}
|
|
320
351
|
if (releases?.length === 0) {
|
|
321
352
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -330,7 +361,7 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
330
361
|
target: sectionTitle
|
|
331
362
|
}
|
|
332
363
|
),
|
|
333
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
364
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(symbols.EmptyDocuments, { width: "16rem" })
|
|
334
365
|
}
|
|
335
366
|
);
|
|
336
367
|
}
|
|
@@ -350,7 +381,7 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
350
381
|
children: [
|
|
351
382
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "start", gap: 1, children: [
|
|
352
383
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { as: "h3", variant: "delta", fontWeight: "bold", children: name }),
|
|
353
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: scheduledAt ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
384
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: scheduledAt ? /* @__PURE__ */ jsxRuntime.jsx(RelativeTime, { timestamp: new Date(scheduledAt) }) : formatMessage({
|
|
354
385
|
id: "content-releases.pages.Releases.not-scheduled",
|
|
355
386
|
defaultMessage: "Not scheduled"
|
|
356
387
|
}) })
|
|
@@ -380,23 +411,26 @@ const ReleasesPage = () => {
|
|
|
380
411
|
const tabRef = React__namespace.useRef(null);
|
|
381
412
|
const location = reactRouterDom.useLocation();
|
|
382
413
|
const [releaseModalShown, setReleaseModalShown] = React__namespace.useState(false);
|
|
383
|
-
const toggleNotification =
|
|
414
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
384
415
|
const { formatMessage } = reactIntl.useIntl();
|
|
385
|
-
const
|
|
386
|
-
const { formatAPIError } =
|
|
387
|
-
const [{ query }, setQuery] =
|
|
416
|
+
const navigate = reactRouterDom.useNavigate();
|
|
417
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
418
|
+
const [{ query }, setQuery] = strapiAdmin.useQueryParams();
|
|
388
419
|
const response = index.useGetReleasesQuery(query);
|
|
389
420
|
const [createRelease, { isLoading: isSubmittingForm }] = index.useCreateReleaseMutation();
|
|
390
|
-
const { getFeature } =
|
|
421
|
+
const { getFeature } = ee.useLicenseLimits();
|
|
391
422
|
const { maximumReleases = 3 } = getFeature("cms-content-releases");
|
|
392
|
-
const { trackUsage } =
|
|
423
|
+
const { trackUsage } = strapiAdmin.useTracking();
|
|
424
|
+
const {
|
|
425
|
+
allowedActions: { canCreate }
|
|
426
|
+
} = strapiAdmin.useRBAC(index.PERMISSIONS);
|
|
393
427
|
const { isLoading, isSuccess, isError } = response;
|
|
394
428
|
const activeTab = response?.currentData?.meta?.activeTab || "pending";
|
|
395
429
|
const activeTabIndex = ["pending", "done"].indexOf(activeTab);
|
|
396
430
|
React__namespace.useEffect(() => {
|
|
397
431
|
if (location?.state?.errors) {
|
|
398
432
|
toggleNotification({
|
|
399
|
-
type: "
|
|
433
|
+
type: "danger",
|
|
400
434
|
title: formatMessage({
|
|
401
435
|
id: "content-releases.pages.Releases.notification.error.title",
|
|
402
436
|
defaultMessage: "Your request could not be processed."
|
|
@@ -406,9 +440,9 @@ const ReleasesPage = () => {
|
|
|
406
440
|
defaultMessage: "Please try again or open another release."
|
|
407
441
|
})
|
|
408
442
|
});
|
|
409
|
-
|
|
443
|
+
navigate("", { replace: true, state: null });
|
|
410
444
|
}
|
|
411
|
-
}, [formatMessage, location?.state?.errors,
|
|
445
|
+
}, [formatMessage, location?.state?.errors, navigate, toggleNotification]);
|
|
412
446
|
React__namespace.useEffect(() => {
|
|
413
447
|
if (tabRef.current) {
|
|
414
448
|
tabRef.current._handlers.setSelectedTabIndex(activeTabIndex);
|
|
@@ -418,7 +452,7 @@ const ReleasesPage = () => {
|
|
|
418
452
|
setReleaseModalShown((prev) => !prev);
|
|
419
453
|
};
|
|
420
454
|
if (isLoading) {
|
|
421
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
455
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
|
|
422
456
|
}
|
|
423
457
|
const totalPendingReleases = isSuccess && response.currentData?.meta?.pendingReleasesCount || 0;
|
|
424
458
|
const hasReachedMaximumPendingReleases = totalPendingReleases >= maximumReleases;
|
|
@@ -449,22 +483,22 @@ const ReleasesPage = () => {
|
|
|
449
483
|
})
|
|
450
484
|
});
|
|
451
485
|
trackUsage("didCreateRelease");
|
|
452
|
-
|
|
486
|
+
navigate(response2.data.data.id.toString());
|
|
453
487
|
} else if (index.isAxiosError(response2.error)) {
|
|
454
488
|
toggleNotification({
|
|
455
|
-
type: "
|
|
489
|
+
type: "danger",
|
|
456
490
|
message: formatAPIError(response2.error)
|
|
457
491
|
});
|
|
458
492
|
} else {
|
|
459
493
|
toggleNotification({
|
|
460
|
-
type: "
|
|
494
|
+
type: "danger",
|
|
461
495
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
462
496
|
});
|
|
463
497
|
}
|
|
464
498
|
};
|
|
465
499
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { "aria-busy": isLoading, children: [
|
|
466
500
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
467
|
-
|
|
501
|
+
strapiAdmin.Layouts.Header,
|
|
468
502
|
{
|
|
469
503
|
title: formatMessage({
|
|
470
504
|
id: "content-releases.pages.Releases.title",
|
|
@@ -474,7 +508,7 @@ const ReleasesPage = () => {
|
|
|
474
508
|
id: "content-releases.pages.Releases.header-subtitle",
|
|
475
509
|
defaultMessage: "Create and manage content updates"
|
|
476
510
|
}),
|
|
477
|
-
primaryAction:
|
|
511
|
+
primaryAction: canCreate ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
478
512
|
designSystem.Button,
|
|
479
513
|
{
|
|
480
514
|
startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Plus, {}),
|
|
@@ -485,15 +519,15 @@ const ReleasesPage = () => {
|
|
|
485
519
|
defaultMessage: "New release"
|
|
486
520
|
})
|
|
487
521
|
}
|
|
488
|
-
)
|
|
522
|
+
) : null
|
|
489
523
|
}
|
|
490
524
|
),
|
|
491
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
525
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
492
526
|
hasReachedMaximumPendingReleases && /* @__PURE__ */ jsxRuntime.jsx(
|
|
493
527
|
StyledAlert,
|
|
494
528
|
{
|
|
495
529
|
marginBottom: 6,
|
|
496
|
-
action: /* @__PURE__ */ jsxRuntime.jsx(
|
|
530
|
+
action: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Link, { href: "https://strapi.io/pricing-cloud", isExternal: true, children: formatMessage({
|
|
497
531
|
id: "content-releases.pages.Releases.max-limit-reached.action",
|
|
498
532
|
defaultMessage: "Explore plans"
|
|
499
533
|
}) }),
|
|
@@ -564,23 +598,17 @@ const ReleasesPage = () => {
|
|
|
564
598
|
]
|
|
565
599
|
}
|
|
566
600
|
),
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
pagination: {
|
|
579
|
-
pageCount: response?.currentData?.meta?.pagination?.pageCount || 0
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
)
|
|
583
|
-
] }) : null
|
|
601
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
602
|
+
strapiAdmin.Pagination.Root,
|
|
603
|
+
{
|
|
604
|
+
...response?.currentData?.meta?.pagination,
|
|
605
|
+
defaultPageSize: response?.currentData?.meta?.pagination?.pageSize,
|
|
606
|
+
children: [
|
|
607
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.PageSize, { options: ["8", "16", "32", "64"] }),
|
|
608
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.Links, {})
|
|
609
|
+
]
|
|
610
|
+
}
|
|
611
|
+
)
|
|
584
612
|
] }) }),
|
|
585
613
|
releaseModalShown && /* @__PURE__ */ jsxRuntime.jsx(
|
|
586
614
|
ReleaseModal,
|
|
@@ -599,7 +627,7 @@ const ReleaseInfoWrapper = styled__default.default(designSystem.Flex)`
|
|
|
599
627
|
border-bottom-left-radius: ${({ theme }) => theme.borderRadius};
|
|
600
628
|
border-top: 1px solid ${({ theme }) => theme.colors.neutral150};
|
|
601
629
|
`;
|
|
602
|
-
const StyledMenuItem = styled__default.default(
|
|
630
|
+
const StyledMenuItem = styled__default.default(designSystem.Menu.Item)`
|
|
603
631
|
svg path {
|
|
604
632
|
fill: ${({ theme, disabled }) => disabled && theme.colors.neutral500};
|
|
605
633
|
}
|
|
@@ -628,14 +656,18 @@ const TrashIcon = styled__default.default(icons.Trash)`
|
|
|
628
656
|
const TypographyMaxWidth = styled__default.default(designSystem.Typography)`
|
|
629
657
|
max-width: 300px;
|
|
630
658
|
`;
|
|
631
|
-
const EntryValidationText = ({ action, schema,
|
|
659
|
+
const EntryValidationText = ({ action, schema, entry }) => {
|
|
632
660
|
const { formatMessage } = reactIntl.useIntl();
|
|
633
|
-
const { validate } = strapiAdmin.unstable_useDocument(
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
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) ?? {};
|
|
639
671
|
if (Object.keys(errors).length > 0) {
|
|
640
672
|
const validationErrorsMessages = Object.entries(errors).map(
|
|
641
673
|
([key, value]) => formatMessage(
|
|
@@ -644,13 +676,13 @@ const EntryValidationText = ({ action, schema, components, entry }) => {
|
|
|
644
676
|
)
|
|
645
677
|
).join(" ");
|
|
646
678
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
647
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
679
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.CrossCircle, { fill: "danger600" }),
|
|
648
680
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tooltip, { description: validationErrorsMessages, children: /* @__PURE__ */ jsxRuntime.jsx(TypographyMaxWidth, { textColor: "danger600", variant: "omega", fontWeight: "semiBold", ellipsis: true, children: validationErrorsMessages }) })
|
|
649
681
|
] });
|
|
650
682
|
}
|
|
651
683
|
if (action == "publish") {
|
|
652
684
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
653
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
685
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
|
654
686
|
entry.publishedAt ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "success600", fontWeight: "bold", children: formatMessage({
|
|
655
687
|
id: "content-releases.pages.ReleaseDetails.entry-validation.already-published",
|
|
656
688
|
defaultMessage: "Already published"
|
|
@@ -661,7 +693,7 @@ const EntryValidationText = ({ action, schema, components, entry }) => {
|
|
|
661
693
|
] });
|
|
662
694
|
}
|
|
663
695
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
664
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
696
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
|
665
697
|
!entry.publishedAt ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "success600", fontWeight: "bold", children: formatMessage({
|
|
666
698
|
id: "content-releases.pages.ReleaseDetails.entry-validation.already-unpublished",
|
|
667
699
|
defaultMessage: "Already unpublished"
|
|
@@ -683,18 +715,22 @@ const ReleaseDetailsLayout = ({
|
|
|
683
715
|
isLoading: isLoadingDetails,
|
|
684
716
|
isError,
|
|
685
717
|
error
|
|
686
|
-
} = index.useGetReleaseQuery(
|
|
718
|
+
} = index.useGetReleaseQuery(
|
|
719
|
+
{ id: releaseId },
|
|
720
|
+
{
|
|
721
|
+
skip: !releaseId
|
|
722
|
+
}
|
|
723
|
+
);
|
|
687
724
|
const [publishRelease, { isLoading: isPublishing }] = index.usePublishReleaseMutation();
|
|
688
|
-
const toggleNotification =
|
|
689
|
-
const { formatAPIError } =
|
|
690
|
-
const {
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
const
|
|
694
|
-
const { trackUsage } = helperPlugin.useTracking();
|
|
725
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
726
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
727
|
+
const { allowedActions } = strapiAdmin.useRBAC(index.PERMISSIONS);
|
|
728
|
+
const { canUpdate, canDelete, canPublish } = allowedActions;
|
|
729
|
+
const dispatch = useTypedDispatch();
|
|
730
|
+
const { trackUsage } = strapiAdmin.useTracking();
|
|
695
731
|
const release = data?.data;
|
|
696
|
-
const handlePublishRelease = async () => {
|
|
697
|
-
const response = await publishRelease({ id
|
|
732
|
+
const handlePublishRelease = (id) => async () => {
|
|
733
|
+
const response = await publishRelease({ id });
|
|
698
734
|
if ("data" in response) {
|
|
699
735
|
toggleNotification({
|
|
700
736
|
type: "success",
|
|
@@ -711,12 +747,12 @@ const ReleaseDetailsLayout = ({
|
|
|
711
747
|
});
|
|
712
748
|
} else if (index.isAxiosError(response.error)) {
|
|
713
749
|
toggleNotification({
|
|
714
|
-
type: "
|
|
750
|
+
type: "danger",
|
|
715
751
|
message: formatAPIError(response.error)
|
|
716
752
|
});
|
|
717
753
|
} else {
|
|
718
754
|
toggleNotification({
|
|
719
|
-
type: "
|
|
755
|
+
type: "danger",
|
|
720
756
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
721
757
|
});
|
|
722
758
|
}
|
|
@@ -742,21 +778,19 @@ const ReleaseDetailsLayout = ({
|
|
|
742
778
|
return release.createdBy.email;
|
|
743
779
|
};
|
|
744
780
|
if (isLoadingDetails) {
|
|
745
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
781
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
|
|
746
782
|
}
|
|
747
783
|
if (isError || !release) {
|
|
748
784
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
749
|
-
reactRouterDom.
|
|
785
|
+
reactRouterDom.Navigate,
|
|
750
786
|
{
|
|
751
|
-
to:
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
]
|
|
759
|
-
}
|
|
787
|
+
to: "..",
|
|
788
|
+
state: {
|
|
789
|
+
errors: [
|
|
790
|
+
{
|
|
791
|
+
code: error?.code
|
|
792
|
+
}
|
|
793
|
+
]
|
|
760
794
|
}
|
|
761
795
|
}
|
|
762
796
|
);
|
|
@@ -793,21 +827,18 @@ const ReleaseDetailsLayout = ({
|
|
|
793
827
|
) : "";
|
|
794
828
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { "aria-busy": isLoadingDetails, children: [
|
|
795
829
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
796
|
-
|
|
830
|
+
strapiAdmin.Layouts.Header,
|
|
797
831
|
{
|
|
798
832
|
title: release.name,
|
|
799
833
|
subtitle: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, lineHeight: 6, children: [
|
|
800
834
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", variant: "epsilon", children: numberOfEntriesText + (isScheduled ? ` - ${scheduledText}` : "") }),
|
|
801
835
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { ...getBadgeProps(release.status), children: release.status })
|
|
802
836
|
] }),
|
|
803
|
-
navigationAction: /* @__PURE__ */ jsxRuntime.jsx(
|
|
804
|
-
id: "global.back",
|
|
805
|
-
defaultMessage: "Back"
|
|
806
|
-
}) }),
|
|
837
|
+
navigationAction: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.BackButton, {}),
|
|
807
838
|
primaryAction: !release.releasedAt && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
808
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
839
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Root, { children: [
|
|
809
840
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
810
|
-
|
|
841
|
+
designSystem.Menu.Trigger,
|
|
811
842
|
{
|
|
812
843
|
as: designSystem.IconButton,
|
|
813
844
|
paddingLeft: 2,
|
|
@@ -820,7 +851,7 @@ const ReleaseDetailsLayout = ({
|
|
|
820
851
|
variant: "tertiary"
|
|
821
852
|
}
|
|
822
853
|
),
|
|
823
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
854
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Content, { top: 1, popoverPlacement: "bottom-end", maxHeight: void 0, children: [
|
|
824
855
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
825
856
|
designSystem.Flex,
|
|
826
857
|
{
|
|
@@ -869,7 +900,7 @@ const ReleaseDetailsLayout = ({
|
|
|
869
900
|
defaultMessage: "Created"
|
|
870
901
|
}) }),
|
|
871
902
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", color: "neutral300", children: [
|
|
872
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
903
|
+
/* @__PURE__ */ jsxRuntime.jsx(RelativeTime$1, { timestamp: new Date(release.createdAt) }),
|
|
873
904
|
formatMessage(
|
|
874
905
|
{
|
|
875
906
|
id: "content-releases.header.actions.created.description",
|
|
@@ -887,12 +918,12 @@ const ReleaseDetailsLayout = ({
|
|
|
887
918
|
id: "content-releases.header.actions.refresh",
|
|
888
919
|
defaultMessage: "Refresh"
|
|
889
920
|
}) }),
|
|
890
|
-
|
|
921
|
+
canPublish ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
891
922
|
designSystem.Button,
|
|
892
923
|
{
|
|
893
924
|
size: "S",
|
|
894
925
|
variant: "default",
|
|
895
|
-
onClick: handlePublishRelease,
|
|
926
|
+
onClick: handlePublishRelease(release.id.toString()),
|
|
896
927
|
loading: isPublishing,
|
|
897
928
|
disabled: release.actions.meta.count === 0,
|
|
898
929
|
children: formatMessage({
|
|
@@ -900,7 +931,7 @@ const ReleaseDetailsLayout = ({
|
|
|
900
931
|
defaultMessage: "Publish"
|
|
901
932
|
})
|
|
902
933
|
}
|
|
903
|
-
)
|
|
934
|
+
) : null
|
|
904
935
|
] })
|
|
905
936
|
}
|
|
906
937
|
),
|
|
@@ -908,6 +939,7 @@ const ReleaseDetailsLayout = ({
|
|
|
908
939
|
] });
|
|
909
940
|
};
|
|
910
941
|
const GROUP_BY_OPTIONS = ["contentType", "locale", "action"];
|
|
942
|
+
const GROUP_BY_OPTIONS_NO_LOCALE = ["contentType", "action"];
|
|
911
943
|
const getGroupByOptionLabel = (value) => {
|
|
912
944
|
if (value === "locale") {
|
|
913
945
|
return {
|
|
@@ -926,12 +958,11 @@ const getGroupByOptionLabel = (value) => {
|
|
|
926
958
|
defaultMessage: "Content-Types"
|
|
927
959
|
};
|
|
928
960
|
};
|
|
929
|
-
const ReleaseDetailsBody = () => {
|
|
961
|
+
const ReleaseDetailsBody = ({ releaseId }) => {
|
|
930
962
|
const { formatMessage } = reactIntl.useIntl();
|
|
931
|
-
const {
|
|
932
|
-
const
|
|
933
|
-
const
|
|
934
|
-
const { formatAPIError } = helperPlugin.useAPIErrorHandler();
|
|
963
|
+
const [{ query }, setQuery] = strapiAdmin.useQueryParams();
|
|
964
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
965
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
935
966
|
const {
|
|
936
967
|
data: releaseData,
|
|
937
968
|
isLoading: isReleaseLoading,
|
|
@@ -940,7 +971,21 @@ const ReleaseDetailsBody = () => {
|
|
|
940
971
|
} = index.useGetReleaseQuery({ id: releaseId });
|
|
941
972
|
const {
|
|
942
973
|
allowedActions: { canUpdate }
|
|
943
|
-
} =
|
|
974
|
+
} = strapiAdmin.useRBAC(index.PERMISSIONS);
|
|
975
|
+
const runHookWaterfall = strapiAdmin.useStrapiApp("ReleaseDetailsPage", (state) => state.runHookWaterfall);
|
|
976
|
+
const { hasI18nEnabled } = runHookWaterfall(
|
|
977
|
+
"ContentReleases/pages/ReleaseDetails/add-locale-in-releases",
|
|
978
|
+
{
|
|
979
|
+
displayedHeaders: {
|
|
980
|
+
label: formatMessage({
|
|
981
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.locale",
|
|
982
|
+
defaultMessage: "locale"
|
|
983
|
+
}),
|
|
984
|
+
name: "locale"
|
|
985
|
+
},
|
|
986
|
+
hasI18nEnabled: false
|
|
987
|
+
}
|
|
988
|
+
);
|
|
944
989
|
const release = releaseData?.data;
|
|
945
990
|
const selectedGroupBy = query?.groupBy || "contentType";
|
|
946
991
|
const {
|
|
@@ -971,19 +1016,19 @@ const ReleaseDetailsBody = () => {
|
|
|
971
1016
|
if ("error" in response) {
|
|
972
1017
|
if (index.isAxiosError(response.error)) {
|
|
973
1018
|
toggleNotification({
|
|
974
|
-
type: "
|
|
1019
|
+
type: "danger",
|
|
975
1020
|
message: formatAPIError(response.error)
|
|
976
1021
|
});
|
|
977
1022
|
} else {
|
|
978
1023
|
toggleNotification({
|
|
979
|
-
type: "
|
|
1024
|
+
type: "danger",
|
|
980
1025
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
981
1026
|
});
|
|
982
1027
|
}
|
|
983
1028
|
}
|
|
984
1029
|
};
|
|
985
1030
|
if (isLoading || isReleaseLoading) {
|
|
986
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1031
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
|
|
987
1032
|
}
|
|
988
1033
|
const releaseActions = data?.data;
|
|
989
1034
|
const releaseMeta = data?.meta;
|
|
@@ -1002,30 +1047,24 @@ const ReleaseDetailsBody = () => {
|
|
|
1002
1047
|
});
|
|
1003
1048
|
}
|
|
1004
1049
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1005
|
-
reactRouterDom.
|
|
1050
|
+
reactRouterDom.Navigate,
|
|
1006
1051
|
{
|
|
1007
|
-
to:
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
errors: errorsArray
|
|
1011
|
-
}
|
|
1052
|
+
to: "..",
|
|
1053
|
+
state: {
|
|
1054
|
+
errors: errorsArray
|
|
1012
1055
|
}
|
|
1013
1056
|
}
|
|
1014
1057
|
);
|
|
1015
1058
|
}
|
|
1016
1059
|
if (isError || !releaseActions) {
|
|
1017
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1060
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Error, {});
|
|
1018
1061
|
}
|
|
1019
1062
|
if (Object.keys(releaseActions).length === 0) {
|
|
1020
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1021
|
-
|
|
1063
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1064
|
+
designSystem.EmptyStateLayout,
|
|
1022
1065
|
{
|
|
1023
|
-
content: {
|
|
1024
|
-
id: "content-releases.pages.Details.tab.emptyEntries",
|
|
1025
|
-
defaultMessage: "This release is empty. Open the Content Manager, select an entry and add it to the release."
|
|
1026
|
-
},
|
|
1027
1066
|
action: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1028
|
-
|
|
1067
|
+
designSystem.LinkButton,
|
|
1029
1068
|
{
|
|
1030
1069
|
as: reactRouterDom.Link,
|
|
1031
1070
|
to: {
|
|
@@ -1038,18 +1077,59 @@ const ReleaseDetailsBody = () => {
|
|
|
1038
1077
|
defaultMessage: "Open the Content Manager"
|
|
1039
1078
|
})
|
|
1040
1079
|
}
|
|
1041
|
-
)
|
|
1080
|
+
),
|
|
1081
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(symbols.EmptyDocuments, { width: "16rem" }),
|
|
1082
|
+
content: formatMessage({
|
|
1083
|
+
id: "content-releases.pages.Details.tab.emptyEntries",
|
|
1084
|
+
defaultMessage: "This release is empty. Open the Content Manager, select an entry and add it to the release."
|
|
1085
|
+
})
|
|
1042
1086
|
}
|
|
1043
1087
|
) });
|
|
1044
1088
|
}
|
|
1045
|
-
|
|
1089
|
+
const groupByLabel = formatMessage({
|
|
1090
|
+
id: "content-releases.pages.ReleaseDetails.groupBy.aria-label",
|
|
1091
|
+
defaultMessage: "Group by"
|
|
1092
|
+
});
|
|
1093
|
+
const headers = [
|
|
1094
|
+
// ...displayedHeaders,
|
|
1095
|
+
{
|
|
1096
|
+
label: formatMessage({
|
|
1097
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.name",
|
|
1098
|
+
defaultMessage: "name"
|
|
1099
|
+
}),
|
|
1100
|
+
name: "name"
|
|
1101
|
+
},
|
|
1102
|
+
{
|
|
1103
|
+
label: formatMessage({
|
|
1104
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.content-type",
|
|
1105
|
+
defaultMessage: "content-type"
|
|
1106
|
+
}),
|
|
1107
|
+
name: "content-type"
|
|
1108
|
+
},
|
|
1109
|
+
{
|
|
1110
|
+
label: formatMessage({
|
|
1111
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.action",
|
|
1112
|
+
defaultMessage: "action"
|
|
1113
|
+
}),
|
|
1114
|
+
name: "action"
|
|
1115
|
+
},
|
|
1116
|
+
...!release.releasedAt ? [
|
|
1117
|
+
{
|
|
1118
|
+
label: formatMessage({
|
|
1119
|
+
id: "content-releases.page.ReleaseDetails.table.header.label.status",
|
|
1120
|
+
defaultMessage: "status"
|
|
1121
|
+
}),
|
|
1122
|
+
name: "status"
|
|
1123
|
+
}
|
|
1124
|
+
] : []
|
|
1125
|
+
];
|
|
1126
|
+
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: [
|
|
1046
1128
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1047
1129
|
designSystem.SingleSelect,
|
|
1048
1130
|
{
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
defaultMessage: "Group by"
|
|
1052
|
-
}),
|
|
1131
|
+
placeholder: groupByLabel,
|
|
1132
|
+
"aria-label": groupByLabel,
|
|
1053
1133
|
customizeContent: (value) => formatMessage(
|
|
1054
1134
|
{
|
|
1055
1135
|
id: `content-releases.pages.ReleaseDetails.groupBy.label`,
|
|
@@ -1061,84 +1141,27 @@ const ReleaseDetailsBody = () => {
|
|
|
1061
1141
|
),
|
|
1062
1142
|
value: formatMessage(getGroupByOptionLabel(selectedGroupBy)),
|
|
1063
1143
|
onChange: (value) => setQuery({ groupBy: value }),
|
|
1064
|
-
children:
|
|
1144
|
+
children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: option, children: formatMessage(getGroupByOptionLabel(option)) }, option))
|
|
1065
1145
|
}
|
|
1066
1146
|
) }),
|
|
1067
1147
|
Object.keys(releaseActions).map((key) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, direction: "column", alignItems: "stretch", children: [
|
|
1068
1148
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { role: "separator", "aria-label": key, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { children: key }) }),
|
|
1069
1149
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1070
|
-
|
|
1150
|
+
strapiAdmin.Table.Root,
|
|
1071
1151
|
{
|
|
1072
1152
|
rows: releaseActions[key].map((item) => ({
|
|
1073
1153
|
...item,
|
|
1074
1154
|
id: Number(item.entry.id)
|
|
1075
1155
|
})),
|
|
1076
|
-
|
|
1077
|
-
isLoading,
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1081
|
-
|
|
1082
|
-
helperPlugin.Table.HeaderCell,
|
|
1083
|
-
{
|
|
1084
|
-
fieldSchemaType: "string",
|
|
1085
|
-
label: formatMessage({
|
|
1086
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.name",
|
|
1087
|
-
defaultMessage: "name"
|
|
1088
|
-
}),
|
|
1089
|
-
name: "name"
|
|
1090
|
-
}
|
|
1091
|
-
),
|
|
1092
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1093
|
-
helperPlugin.Table.HeaderCell,
|
|
1094
|
-
{
|
|
1095
|
-
fieldSchemaType: "string",
|
|
1096
|
-
label: formatMessage({
|
|
1097
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.locale",
|
|
1098
|
-
defaultMessage: "locale"
|
|
1099
|
-
}),
|
|
1100
|
-
name: "locale"
|
|
1101
|
-
}
|
|
1102
|
-
),
|
|
1103
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1104
|
-
helperPlugin.Table.HeaderCell,
|
|
1105
|
-
{
|
|
1106
|
-
fieldSchemaType: "string",
|
|
1107
|
-
label: formatMessage({
|
|
1108
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.content-type",
|
|
1109
|
-
defaultMessage: "content-type"
|
|
1110
|
-
}),
|
|
1111
|
-
name: "content-type"
|
|
1112
|
-
}
|
|
1113
|
-
),
|
|
1114
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1115
|
-
helperPlugin.Table.HeaderCell,
|
|
1116
|
-
{
|
|
1117
|
-
fieldSchemaType: "string",
|
|
1118
|
-
label: formatMessage({
|
|
1119
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.action",
|
|
1120
|
-
defaultMessage: "action"
|
|
1121
|
-
}),
|
|
1122
|
-
name: "action"
|
|
1123
|
-
}
|
|
1124
|
-
),
|
|
1125
|
-
!release.releasedAt && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1126
|
-
helperPlugin.Table.HeaderCell,
|
|
1127
|
-
{
|
|
1128
|
-
fieldSchemaType: "string",
|
|
1129
|
-
label: formatMessage({
|
|
1130
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.status",
|
|
1131
|
-
defaultMessage: "status"
|
|
1132
|
-
}),
|
|
1133
|
-
name: "status"
|
|
1134
|
-
}
|
|
1135
|
-
)
|
|
1136
|
-
] }),
|
|
1137
|
-
/* @__PURE__ */ jsxRuntime.jsx(helperPlugin.Table.LoadingBody, {}),
|
|
1138
|
-
/* @__PURE__ */ jsxRuntime.jsx(helperPlugin.Table.Body, { children: releaseActions[key].map(
|
|
1156
|
+
headers,
|
|
1157
|
+
isLoading: isLoading || isFetching,
|
|
1158
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(strapiAdmin.Table.Content, { children: [
|
|
1159
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Head, { children: headers.map((header) => /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.HeaderCell, { ...header }, header.name)) }),
|
|
1160
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Loading, {}),
|
|
1161
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Body, { children: releaseActions[key].map(
|
|
1139
1162
|
({ id, contentType, locale, type, entry }, actionIndex) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
1140
1163
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "25%", maxWidth: "200px", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { ellipsis: true, children: `${contentType.mainFieldValue || entry.id}` }) }),
|
|
1141
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "10%", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: `${locale?.name ? locale.name : "-"}` }) }),
|
|
1164
|
+
hasI18nEnabled && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "10%", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: `${locale?.name ? locale.name : "-"}` }) }),
|
|
1142
1165
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "10%", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: contentType.displayName || "" }) }),
|
|
1143
1166
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "20%", children: release.releasedAt ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage(
|
|
1144
1167
|
{
|
|
@@ -1192,34 +1215,39 @@ const ReleaseDetailsBody = () => {
|
|
|
1192
1215
|
}
|
|
1193
1216
|
)
|
|
1194
1217
|
] }, `releases-group-${key}`)),
|
|
1195
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
}
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1218
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1219
|
+
strapiAdmin.Pagination.Root,
|
|
1220
|
+
{
|
|
1221
|
+
...releaseMeta?.pagination,
|
|
1222
|
+
defaultPageSize: releaseMeta?.pagination?.pageSize,
|
|
1223
|
+
children: [
|
|
1224
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.PageSize, {}),
|
|
1225
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.Links, {})
|
|
1226
|
+
]
|
|
1227
|
+
}
|
|
1228
|
+
)
|
|
1206
1229
|
] }) });
|
|
1207
1230
|
};
|
|
1208
1231
|
const ReleaseDetailsPage = () => {
|
|
1209
1232
|
const { formatMessage } = reactIntl.useIntl();
|
|
1210
1233
|
const { releaseId } = reactRouterDom.useParams();
|
|
1211
|
-
const toggleNotification =
|
|
1212
|
-
const { formatAPIError } =
|
|
1213
|
-
const
|
|
1234
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
1235
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
1236
|
+
const navigate = reactRouterDom.useNavigate();
|
|
1214
1237
|
const [releaseModalShown, setReleaseModalShown] = React__namespace.useState(false);
|
|
1215
1238
|
const [showWarningSubmit, setWarningSubmit] = React__namespace.useState(false);
|
|
1216
1239
|
const {
|
|
1217
1240
|
isLoading: isLoadingDetails,
|
|
1218
1241
|
data,
|
|
1219
1242
|
isSuccess: isSuccessDetails
|
|
1220
|
-
} = index.useGetReleaseQuery(
|
|
1243
|
+
} = index.useGetReleaseQuery(
|
|
1244
|
+
{ id: releaseId },
|
|
1245
|
+
{
|
|
1246
|
+
skip: !releaseId
|
|
1247
|
+
}
|
|
1248
|
+
);
|
|
1221
1249
|
const [updateRelease, { isLoading: isSubmittingForm }] = index.useUpdateReleaseMutation();
|
|
1222
|
-
const [deleteRelease
|
|
1250
|
+
const [deleteRelease] = index.useDeleteReleaseMutation();
|
|
1223
1251
|
const toggleEditReleaseModal = () => {
|
|
1224
1252
|
setReleaseModalShown((prev) => !prev);
|
|
1225
1253
|
};
|
|
@@ -1230,15 +1258,18 @@ const ReleaseDetailsPage = () => {
|
|
|
1230
1258
|
{
|
|
1231
1259
|
toggleEditReleaseModal,
|
|
1232
1260
|
toggleWarningSubmit,
|
|
1233
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1261
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {})
|
|
1234
1262
|
}
|
|
1235
1263
|
);
|
|
1236
1264
|
}
|
|
1265
|
+
if (!releaseId) {
|
|
1266
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: ".." });
|
|
1267
|
+
}
|
|
1237
1268
|
const releaseData = isSuccessDetails && data?.data || null;
|
|
1238
1269
|
const title = releaseData?.name || "";
|
|
1239
1270
|
const timezone = releaseData?.timezone ?? null;
|
|
1240
1271
|
const scheduledAt = releaseData?.scheduledAt && timezone ? dateFnsTz.utcToZonedTime(releaseData.scheduledAt, timezone) : null;
|
|
1241
|
-
const date = scheduledAt ?
|
|
1272
|
+
const date = scheduledAt ? format__default.default(scheduledAt, "yyyy-MM-dd") : null;
|
|
1242
1273
|
const time = scheduledAt ? format__default.default(scheduledAt, "HH:mm") : "";
|
|
1243
1274
|
const handleEditRelease = async (values) => {
|
|
1244
1275
|
const response = await updateRelease({
|
|
@@ -1255,33 +1286,33 @@ const ReleaseDetailsPage = () => {
|
|
|
1255
1286
|
defaultMessage: "Release updated."
|
|
1256
1287
|
})
|
|
1257
1288
|
});
|
|
1289
|
+
toggleEditReleaseModal();
|
|
1258
1290
|
} else if (index.isAxiosError(response.error)) {
|
|
1259
1291
|
toggleNotification({
|
|
1260
|
-
type: "
|
|
1292
|
+
type: "danger",
|
|
1261
1293
|
message: formatAPIError(response.error)
|
|
1262
1294
|
});
|
|
1263
1295
|
} else {
|
|
1264
1296
|
toggleNotification({
|
|
1265
|
-
type: "
|
|
1297
|
+
type: "danger",
|
|
1266
1298
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
1267
1299
|
});
|
|
1268
1300
|
}
|
|
1269
|
-
toggleEditReleaseModal();
|
|
1270
1301
|
};
|
|
1271
1302
|
const handleDeleteRelease = async () => {
|
|
1272
1303
|
const response = await deleteRelease({
|
|
1273
1304
|
id: releaseId
|
|
1274
1305
|
});
|
|
1275
1306
|
if ("data" in response) {
|
|
1276
|
-
|
|
1307
|
+
navigate("..");
|
|
1277
1308
|
} else if (index.isAxiosError(response.error)) {
|
|
1278
1309
|
toggleNotification({
|
|
1279
|
-
type: "
|
|
1310
|
+
type: "danger",
|
|
1280
1311
|
message: formatAPIError(response.error)
|
|
1281
1312
|
});
|
|
1282
1313
|
} else {
|
|
1283
1314
|
toggleNotification({
|
|
1284
|
-
type: "
|
|
1315
|
+
type: "danger",
|
|
1285
1316
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
1286
1317
|
});
|
|
1287
1318
|
}
|
|
@@ -1292,7 +1323,7 @@ const ReleaseDetailsPage = () => {
|
|
|
1292
1323
|
toggleEditReleaseModal,
|
|
1293
1324
|
toggleWarningSubmit,
|
|
1294
1325
|
children: [
|
|
1295
|
-
/* @__PURE__ */ jsxRuntime.jsx(ReleaseDetailsBody, {}),
|
|
1326
|
+
/* @__PURE__ */ jsxRuntime.jsx(ReleaseDetailsBody, { releaseId }),
|
|
1296
1327
|
releaseModalShown && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1297
1328
|
ReleaseModal,
|
|
1298
1329
|
{
|
|
@@ -1310,16 +1341,15 @@ const ReleaseDetailsPage = () => {
|
|
|
1310
1341
|
}
|
|
1311
1342
|
),
|
|
1312
1343
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1313
|
-
|
|
1344
|
+
strapiAdmin.ConfirmDialog,
|
|
1314
1345
|
{
|
|
1315
|
-
|
|
1346
|
+
isOpen: showWarningSubmit,
|
|
1347
|
+
onClose: toggleWarningSubmit,
|
|
1348
|
+
onConfirm: handleDeleteRelease,
|
|
1349
|
+
children: formatMessage({
|
|
1316
1350
|
id: "content-releases.dialog.confirmation-message",
|
|
1317
1351
|
defaultMessage: "Are you sure you want to delete this release?"
|
|
1318
|
-
}
|
|
1319
|
-
isOpen: showWarningSubmit,
|
|
1320
|
-
isConfirmButtonLoading: isDeletingRelease,
|
|
1321
|
-
onToggleDialog: toggleWarningSubmit,
|
|
1322
|
-
onConfirm: handleDeleteRelease
|
|
1352
|
+
})
|
|
1323
1353
|
}
|
|
1324
1354
|
)
|
|
1325
1355
|
]
|
|
@@ -1327,10 +1357,10 @@ const ReleaseDetailsPage = () => {
|
|
|
1327
1357
|
);
|
|
1328
1358
|
};
|
|
1329
1359
|
const App = () => {
|
|
1330
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1331
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, {
|
|
1332
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, {
|
|
1360
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Protect, { permissions: index.PERMISSIONS.main, children: /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.Routes, { children: [
|
|
1361
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { index: true, element: /* @__PURE__ */ jsxRuntime.jsx(ReleasesPage, {}) }),
|
|
1362
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: ":releaseId", element: /* @__PURE__ */ jsxRuntime.jsx(ReleaseDetailsPage, {}) })
|
|
1333
1363
|
] }) });
|
|
1334
1364
|
};
|
|
1335
1365
|
exports.App = App;
|
|
1336
|
-
//# sourceMappingURL=App-
|
|
1366
|
+
//# sourceMappingURL=App-CXRpb2hi.js.map
|