@strapi/content-releases 0.0.0-experimental.e47108ccbbc4ad1bfaf4526fa6b70d6ace1ca7a9 → 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-XbK-TdJn.mjs → App-BsUSTHVD.mjs} +241 -210
- package/dist/_chunks/App-BsUSTHVD.mjs.map +1 -0
- package/dist/_chunks/{App-ftICpqDz.js → App-CXRpb2hi.js} +256 -225
- package/dist/_chunks/App-CXRpb2hi.js.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-bpIYXOfu.js → PurchaseContentReleases-Be3acS2L.js} +7 -6
- package/dist/_chunks/PurchaseContentReleases-Be3acS2L.js.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-3tRbmbY3.mjs → PurchaseContentReleases-_MxP6-Dt.mjs} +8 -7
- package/dist/_chunks/PurchaseContentReleases-_MxP6-Dt.mjs.map +1 -0
- package/dist/_chunks/{en-pOJ6G5fC.mjs → en-B9Ur3VsE.mjs} +10 -1
- package/dist/_chunks/en-B9Ur3VsE.mjs.map +1 -0
- package/dist/_chunks/{en-4CUzVH2g.js → en-DtFJ5ViE.js} +10 -1
- package/dist/_chunks/en-DtFJ5ViE.js.map +1 -0
- package/dist/_chunks/{index-RYVGXFeL.js → index-B6-lic1Q.js} +340 -113
- package/dist/_chunks/index-B6-lic1Q.js.map +1 -0
- package/dist/_chunks/{index-8LrruHqK.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-XbK-TdJn.mjs.map +0 -1
- package/dist/_chunks/App-ftICpqDz.js.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-3tRbmbY3.mjs.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-bpIYXOfu.js.map +0 -1
- package/dist/_chunks/en-4CUzVH2g.js.map +0 -1
- package/dist/_chunks/en-pOJ6G5fC.mjs.map +0 -1
- package/dist/_chunks/index-8LrruHqK.mjs.map +0 -1
- package/dist/_chunks/index-RYVGXFeL.js.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(),
|
|
@@ -280,11 +308,15 @@ const TimezoneComponent = ({ timezoneOptions }) => {
|
|
|
280
308
|
}
|
|
281
309
|
);
|
|
282
310
|
};
|
|
283
|
-
const
|
|
311
|
+
const useTypedDispatch = reactRedux.useDispatch;
|
|
312
|
+
const LinkCard = styled__default.default(designSystem.Link)`
|
|
284
313
|
display: block;
|
|
285
314
|
`;
|
|
286
|
-
const
|
|
287
|
-
|
|
315
|
+
const RelativeTime = styled__default.default(RelativeTime$1)`
|
|
316
|
+
display: inline-block;
|
|
317
|
+
&::first-letter {
|
|
318
|
+
text-transform: uppercase;
|
|
319
|
+
}
|
|
288
320
|
`;
|
|
289
321
|
const getBadgeProps = (status) => {
|
|
290
322
|
let color;
|
|
@@ -314,7 +346,7 @@ const getBadgeProps = (status) => {
|
|
|
314
346
|
const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
315
347
|
const { formatMessage } = reactIntl.useIntl();
|
|
316
348
|
if (isError) {
|
|
317
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
349
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Error, {});
|
|
318
350
|
}
|
|
319
351
|
if (releases?.length === 0) {
|
|
320
352
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -329,7 +361,7 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
329
361
|
target: sectionTitle
|
|
330
362
|
}
|
|
331
363
|
),
|
|
332
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
364
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(symbols.EmptyDocuments, { width: "16rem" })
|
|
333
365
|
}
|
|
334
366
|
);
|
|
335
367
|
}
|
|
@@ -349,7 +381,7 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
349
381
|
children: [
|
|
350
382
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "start", gap: 1, children: [
|
|
351
383
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { as: "h3", variant: "delta", fontWeight: "bold", children: name }),
|
|
352
|
-
/* @__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({
|
|
353
385
|
id: "content-releases.pages.Releases.not-scheduled",
|
|
354
386
|
defaultMessage: "Not scheduled"
|
|
355
387
|
}) })
|
|
@@ -379,23 +411,26 @@ const ReleasesPage = () => {
|
|
|
379
411
|
const tabRef = React__namespace.useRef(null);
|
|
380
412
|
const location = reactRouterDom.useLocation();
|
|
381
413
|
const [releaseModalShown, setReleaseModalShown] = React__namespace.useState(false);
|
|
382
|
-
const toggleNotification =
|
|
414
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
383
415
|
const { formatMessage } = reactIntl.useIntl();
|
|
384
|
-
const
|
|
385
|
-
const { formatAPIError } =
|
|
386
|
-
const [{ query }, setQuery] =
|
|
416
|
+
const navigate = reactRouterDom.useNavigate();
|
|
417
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
418
|
+
const [{ query }, setQuery] = strapiAdmin.useQueryParams();
|
|
387
419
|
const response = index.useGetReleasesQuery(query);
|
|
388
420
|
const [createRelease, { isLoading: isSubmittingForm }] = index.useCreateReleaseMutation();
|
|
389
|
-
const { getFeature } =
|
|
421
|
+
const { getFeature } = ee.useLicenseLimits();
|
|
390
422
|
const { maximumReleases = 3 } = getFeature("cms-content-releases");
|
|
391
|
-
const { trackUsage } =
|
|
423
|
+
const { trackUsage } = strapiAdmin.useTracking();
|
|
424
|
+
const {
|
|
425
|
+
allowedActions: { canCreate }
|
|
426
|
+
} = strapiAdmin.useRBAC(index.PERMISSIONS);
|
|
392
427
|
const { isLoading, isSuccess, isError } = response;
|
|
393
428
|
const activeTab = response?.currentData?.meta?.activeTab || "pending";
|
|
394
429
|
const activeTabIndex = ["pending", "done"].indexOf(activeTab);
|
|
395
430
|
React__namespace.useEffect(() => {
|
|
396
431
|
if (location?.state?.errors) {
|
|
397
432
|
toggleNotification({
|
|
398
|
-
type: "
|
|
433
|
+
type: "danger",
|
|
399
434
|
title: formatMessage({
|
|
400
435
|
id: "content-releases.pages.Releases.notification.error.title",
|
|
401
436
|
defaultMessage: "Your request could not be processed."
|
|
@@ -405,9 +440,9 @@ const ReleasesPage = () => {
|
|
|
405
440
|
defaultMessage: "Please try again or open another release."
|
|
406
441
|
})
|
|
407
442
|
});
|
|
408
|
-
|
|
443
|
+
navigate("", { replace: true, state: null });
|
|
409
444
|
}
|
|
410
|
-
}, [formatMessage, location?.state?.errors,
|
|
445
|
+
}, [formatMessage, location?.state?.errors, navigate, toggleNotification]);
|
|
411
446
|
React__namespace.useEffect(() => {
|
|
412
447
|
if (tabRef.current) {
|
|
413
448
|
tabRef.current._handlers.setSelectedTabIndex(activeTabIndex);
|
|
@@ -417,7 +452,7 @@ const ReleasesPage = () => {
|
|
|
417
452
|
setReleaseModalShown((prev) => !prev);
|
|
418
453
|
};
|
|
419
454
|
if (isLoading) {
|
|
420
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
455
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
|
|
421
456
|
}
|
|
422
457
|
const totalPendingReleases = isSuccess && response.currentData?.meta?.pendingReleasesCount || 0;
|
|
423
458
|
const hasReachedMaximumPendingReleases = totalPendingReleases >= maximumReleases;
|
|
@@ -448,22 +483,22 @@ const ReleasesPage = () => {
|
|
|
448
483
|
})
|
|
449
484
|
});
|
|
450
485
|
trackUsage("didCreateRelease");
|
|
451
|
-
|
|
486
|
+
navigate(response2.data.data.id.toString());
|
|
452
487
|
} else if (index.isAxiosError(response2.error)) {
|
|
453
488
|
toggleNotification({
|
|
454
|
-
type: "
|
|
489
|
+
type: "danger",
|
|
455
490
|
message: formatAPIError(response2.error)
|
|
456
491
|
});
|
|
457
492
|
} else {
|
|
458
493
|
toggleNotification({
|
|
459
|
-
type: "
|
|
494
|
+
type: "danger",
|
|
460
495
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
461
496
|
});
|
|
462
497
|
}
|
|
463
498
|
};
|
|
464
499
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { "aria-busy": isLoading, children: [
|
|
465
500
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
466
|
-
|
|
501
|
+
strapiAdmin.Layouts.Header,
|
|
467
502
|
{
|
|
468
503
|
title: formatMessage({
|
|
469
504
|
id: "content-releases.pages.Releases.title",
|
|
@@ -473,7 +508,7 @@ const ReleasesPage = () => {
|
|
|
473
508
|
id: "content-releases.pages.Releases.header-subtitle",
|
|
474
509
|
defaultMessage: "Create and manage content updates"
|
|
475
510
|
}),
|
|
476
|
-
primaryAction:
|
|
511
|
+
primaryAction: canCreate ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
477
512
|
designSystem.Button,
|
|
478
513
|
{
|
|
479
514
|
startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Plus, {}),
|
|
@@ -484,15 +519,15 @@ const ReleasesPage = () => {
|
|
|
484
519
|
defaultMessage: "New release"
|
|
485
520
|
})
|
|
486
521
|
}
|
|
487
|
-
)
|
|
522
|
+
) : null
|
|
488
523
|
}
|
|
489
524
|
),
|
|
490
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
525
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
491
526
|
hasReachedMaximumPendingReleases && /* @__PURE__ */ jsxRuntime.jsx(
|
|
492
527
|
StyledAlert,
|
|
493
528
|
{
|
|
494
529
|
marginBottom: 6,
|
|
495
|
-
action: /* @__PURE__ */ jsxRuntime.jsx(
|
|
530
|
+
action: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Link, { href: "https://strapi.io/pricing-cloud", isExternal: true, children: formatMessage({
|
|
496
531
|
id: "content-releases.pages.Releases.max-limit-reached.action",
|
|
497
532
|
defaultMessage: "Explore plans"
|
|
498
533
|
}) }),
|
|
@@ -563,23 +598,17 @@ const ReleasesPage = () => {
|
|
|
563
598
|
]
|
|
564
599
|
}
|
|
565
600
|
),
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
pagination: {
|
|
578
|
-
pageCount: response?.currentData?.meta?.pagination?.pageCount || 0
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
)
|
|
582
|
-
] }) : 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
|
+
)
|
|
583
612
|
] }) }),
|
|
584
613
|
releaseModalShown && /* @__PURE__ */ jsxRuntime.jsx(
|
|
585
614
|
ReleaseModal,
|
|
@@ -598,7 +627,7 @@ const ReleaseInfoWrapper = styled__default.default(designSystem.Flex)`
|
|
|
598
627
|
border-bottom-left-radius: ${({ theme }) => theme.borderRadius};
|
|
599
628
|
border-top: 1px solid ${({ theme }) => theme.colors.neutral150};
|
|
600
629
|
`;
|
|
601
|
-
const StyledMenuItem = styled__default.default(
|
|
630
|
+
const StyledMenuItem = styled__default.default(designSystem.Menu.Item)`
|
|
602
631
|
svg path {
|
|
603
632
|
fill: ${({ theme, disabled }) => disabled && theme.colors.neutral500};
|
|
604
633
|
}
|
|
@@ -627,14 +656,18 @@ const TrashIcon = styled__default.default(icons.Trash)`
|
|
|
627
656
|
const TypographyMaxWidth = styled__default.default(designSystem.Typography)`
|
|
628
657
|
max-width: 300px;
|
|
629
658
|
`;
|
|
630
|
-
const EntryValidationText = ({ action, schema,
|
|
659
|
+
const EntryValidationText = ({ action, schema, entry }) => {
|
|
631
660
|
const { formatMessage } = reactIntl.useIntl();
|
|
632
|
-
const { validate } = strapiAdmin.unstable_useDocument(
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
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) ?? {};
|
|
638
671
|
if (Object.keys(errors).length > 0) {
|
|
639
672
|
const validationErrorsMessages = Object.entries(errors).map(
|
|
640
673
|
([key, value]) => formatMessage(
|
|
@@ -643,13 +676,13 @@ const EntryValidationText = ({ action, schema, components, entry }) => {
|
|
|
643
676
|
)
|
|
644
677
|
).join(" ");
|
|
645
678
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
646
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
679
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.CrossCircle, { fill: "danger600" }),
|
|
647
680
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tooltip, { description: validationErrorsMessages, children: /* @__PURE__ */ jsxRuntime.jsx(TypographyMaxWidth, { textColor: "danger600", variant: "omega", fontWeight: "semiBold", ellipsis: true, children: validationErrorsMessages }) })
|
|
648
681
|
] });
|
|
649
682
|
}
|
|
650
683
|
if (action == "publish") {
|
|
651
684
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
652
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
685
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
|
653
686
|
entry.publishedAt ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "success600", fontWeight: "bold", children: formatMessage({
|
|
654
687
|
id: "content-releases.pages.ReleaseDetails.entry-validation.already-published",
|
|
655
688
|
defaultMessage: "Already published"
|
|
@@ -660,7 +693,7 @@ const EntryValidationText = ({ action, schema, components, entry }) => {
|
|
|
660
693
|
] });
|
|
661
694
|
}
|
|
662
695
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
663
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
696
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
|
664
697
|
!entry.publishedAt ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "success600", fontWeight: "bold", children: formatMessage({
|
|
665
698
|
id: "content-releases.pages.ReleaseDetails.entry-validation.already-unpublished",
|
|
666
699
|
defaultMessage: "Already unpublished"
|
|
@@ -682,18 +715,22 @@ const ReleaseDetailsLayout = ({
|
|
|
682
715
|
isLoading: isLoadingDetails,
|
|
683
716
|
isError,
|
|
684
717
|
error
|
|
685
|
-
} = index.useGetReleaseQuery(
|
|
718
|
+
} = index.useGetReleaseQuery(
|
|
719
|
+
{ id: releaseId },
|
|
720
|
+
{
|
|
721
|
+
skip: !releaseId
|
|
722
|
+
}
|
|
723
|
+
);
|
|
686
724
|
const [publishRelease, { isLoading: isPublishing }] = index.usePublishReleaseMutation();
|
|
687
|
-
const toggleNotification =
|
|
688
|
-
const { formatAPIError } =
|
|
689
|
-
const {
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
const
|
|
693
|
-
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();
|
|
694
731
|
const release = data?.data;
|
|
695
|
-
const handlePublishRelease = async () => {
|
|
696
|
-
const response = await publishRelease({ id
|
|
732
|
+
const handlePublishRelease = (id) => async () => {
|
|
733
|
+
const response = await publishRelease({ id });
|
|
697
734
|
if ("data" in response) {
|
|
698
735
|
toggleNotification({
|
|
699
736
|
type: "success",
|
|
@@ -710,12 +747,12 @@ const ReleaseDetailsLayout = ({
|
|
|
710
747
|
});
|
|
711
748
|
} else if (index.isAxiosError(response.error)) {
|
|
712
749
|
toggleNotification({
|
|
713
|
-
type: "
|
|
750
|
+
type: "danger",
|
|
714
751
|
message: formatAPIError(response.error)
|
|
715
752
|
});
|
|
716
753
|
} else {
|
|
717
754
|
toggleNotification({
|
|
718
|
-
type: "
|
|
755
|
+
type: "danger",
|
|
719
756
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
720
757
|
});
|
|
721
758
|
}
|
|
@@ -741,21 +778,19 @@ const ReleaseDetailsLayout = ({
|
|
|
741
778
|
return release.createdBy.email;
|
|
742
779
|
};
|
|
743
780
|
if (isLoadingDetails) {
|
|
744
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
781
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
|
|
745
782
|
}
|
|
746
783
|
if (isError || !release) {
|
|
747
784
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
748
|
-
reactRouterDom.
|
|
785
|
+
reactRouterDom.Navigate,
|
|
749
786
|
{
|
|
750
|
-
to:
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
]
|
|
758
|
-
}
|
|
787
|
+
to: "..",
|
|
788
|
+
state: {
|
|
789
|
+
errors: [
|
|
790
|
+
{
|
|
791
|
+
code: error?.code
|
|
792
|
+
}
|
|
793
|
+
]
|
|
759
794
|
}
|
|
760
795
|
}
|
|
761
796
|
);
|
|
@@ -792,21 +827,18 @@ const ReleaseDetailsLayout = ({
|
|
|
792
827
|
) : "";
|
|
793
828
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { "aria-busy": isLoadingDetails, children: [
|
|
794
829
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
795
|
-
|
|
830
|
+
strapiAdmin.Layouts.Header,
|
|
796
831
|
{
|
|
797
832
|
title: release.name,
|
|
798
833
|
subtitle: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, lineHeight: 6, children: [
|
|
799
834
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", variant: "epsilon", children: numberOfEntriesText + (isScheduled ? ` - ${scheduledText}` : "") }),
|
|
800
835
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { ...getBadgeProps(release.status), children: release.status })
|
|
801
836
|
] }),
|
|
802
|
-
navigationAction: /* @__PURE__ */ jsxRuntime.jsx(
|
|
803
|
-
id: "global.back",
|
|
804
|
-
defaultMessage: "Back"
|
|
805
|
-
}) }),
|
|
837
|
+
navigationAction: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.BackButton, {}),
|
|
806
838
|
primaryAction: !release.releasedAt && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
807
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
839
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Root, { children: [
|
|
808
840
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
809
|
-
|
|
841
|
+
designSystem.Menu.Trigger,
|
|
810
842
|
{
|
|
811
843
|
as: designSystem.IconButton,
|
|
812
844
|
paddingLeft: 2,
|
|
@@ -819,7 +851,7 @@ const ReleaseDetailsLayout = ({
|
|
|
819
851
|
variant: "tertiary"
|
|
820
852
|
}
|
|
821
853
|
),
|
|
822
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
854
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Content, { top: 1, popoverPlacement: "bottom-end", maxHeight: void 0, children: [
|
|
823
855
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
824
856
|
designSystem.Flex,
|
|
825
857
|
{
|
|
@@ -868,7 +900,7 @@ const ReleaseDetailsLayout = ({
|
|
|
868
900
|
defaultMessage: "Created"
|
|
869
901
|
}) }),
|
|
870
902
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", color: "neutral300", children: [
|
|
871
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
903
|
+
/* @__PURE__ */ jsxRuntime.jsx(RelativeTime$1, { timestamp: new Date(release.createdAt) }),
|
|
872
904
|
formatMessage(
|
|
873
905
|
{
|
|
874
906
|
id: "content-releases.header.actions.created.description",
|
|
@@ -886,12 +918,12 @@ const ReleaseDetailsLayout = ({
|
|
|
886
918
|
id: "content-releases.header.actions.refresh",
|
|
887
919
|
defaultMessage: "Refresh"
|
|
888
920
|
}) }),
|
|
889
|
-
|
|
921
|
+
canPublish ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
890
922
|
designSystem.Button,
|
|
891
923
|
{
|
|
892
924
|
size: "S",
|
|
893
925
|
variant: "default",
|
|
894
|
-
onClick: handlePublishRelease,
|
|
926
|
+
onClick: handlePublishRelease(release.id.toString()),
|
|
895
927
|
loading: isPublishing,
|
|
896
928
|
disabled: release.actions.meta.count === 0,
|
|
897
929
|
children: formatMessage({
|
|
@@ -899,7 +931,7 @@ const ReleaseDetailsLayout = ({
|
|
|
899
931
|
defaultMessage: "Publish"
|
|
900
932
|
})
|
|
901
933
|
}
|
|
902
|
-
)
|
|
934
|
+
) : null
|
|
903
935
|
] })
|
|
904
936
|
}
|
|
905
937
|
),
|
|
@@ -907,6 +939,7 @@ const ReleaseDetailsLayout = ({
|
|
|
907
939
|
] });
|
|
908
940
|
};
|
|
909
941
|
const GROUP_BY_OPTIONS = ["contentType", "locale", "action"];
|
|
942
|
+
const GROUP_BY_OPTIONS_NO_LOCALE = ["contentType", "action"];
|
|
910
943
|
const getGroupByOptionLabel = (value) => {
|
|
911
944
|
if (value === "locale") {
|
|
912
945
|
return {
|
|
@@ -925,12 +958,11 @@ const getGroupByOptionLabel = (value) => {
|
|
|
925
958
|
defaultMessage: "Content-Types"
|
|
926
959
|
};
|
|
927
960
|
};
|
|
928
|
-
const ReleaseDetailsBody = () => {
|
|
961
|
+
const ReleaseDetailsBody = ({ releaseId }) => {
|
|
929
962
|
const { formatMessage } = reactIntl.useIntl();
|
|
930
|
-
const {
|
|
931
|
-
const
|
|
932
|
-
const
|
|
933
|
-
const { formatAPIError } = helperPlugin.useAPIErrorHandler();
|
|
963
|
+
const [{ query }, setQuery] = strapiAdmin.useQueryParams();
|
|
964
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
965
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
934
966
|
const {
|
|
935
967
|
data: releaseData,
|
|
936
968
|
isLoading: isReleaseLoading,
|
|
@@ -939,7 +971,21 @@ const ReleaseDetailsBody = () => {
|
|
|
939
971
|
} = index.useGetReleaseQuery({ id: releaseId });
|
|
940
972
|
const {
|
|
941
973
|
allowedActions: { canUpdate }
|
|
942
|
-
} =
|
|
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
|
+
);
|
|
943
989
|
const release = releaseData?.data;
|
|
944
990
|
const selectedGroupBy = query?.groupBy || "contentType";
|
|
945
991
|
const {
|
|
@@ -970,19 +1016,19 @@ const ReleaseDetailsBody = () => {
|
|
|
970
1016
|
if ("error" in response) {
|
|
971
1017
|
if (index.isAxiosError(response.error)) {
|
|
972
1018
|
toggleNotification({
|
|
973
|
-
type: "
|
|
1019
|
+
type: "danger",
|
|
974
1020
|
message: formatAPIError(response.error)
|
|
975
1021
|
});
|
|
976
1022
|
} else {
|
|
977
1023
|
toggleNotification({
|
|
978
|
-
type: "
|
|
1024
|
+
type: "danger",
|
|
979
1025
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
980
1026
|
});
|
|
981
1027
|
}
|
|
982
1028
|
}
|
|
983
1029
|
};
|
|
984
1030
|
if (isLoading || isReleaseLoading) {
|
|
985
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1031
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
|
|
986
1032
|
}
|
|
987
1033
|
const releaseActions = data?.data;
|
|
988
1034
|
const releaseMeta = data?.meta;
|
|
@@ -1001,30 +1047,24 @@ const ReleaseDetailsBody = () => {
|
|
|
1001
1047
|
});
|
|
1002
1048
|
}
|
|
1003
1049
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1004
|
-
reactRouterDom.
|
|
1050
|
+
reactRouterDom.Navigate,
|
|
1005
1051
|
{
|
|
1006
|
-
to:
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
errors: errorsArray
|
|
1010
|
-
}
|
|
1052
|
+
to: "..",
|
|
1053
|
+
state: {
|
|
1054
|
+
errors: errorsArray
|
|
1011
1055
|
}
|
|
1012
1056
|
}
|
|
1013
1057
|
);
|
|
1014
1058
|
}
|
|
1015
1059
|
if (isError || !releaseActions) {
|
|
1016
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1060
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Error, {});
|
|
1017
1061
|
}
|
|
1018
1062
|
if (Object.keys(releaseActions).length === 0) {
|
|
1019
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1020
|
-
|
|
1063
|
+
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1064
|
+
designSystem.EmptyStateLayout,
|
|
1021
1065
|
{
|
|
1022
|
-
content: {
|
|
1023
|
-
id: "content-releases.pages.Details.tab.emptyEntries",
|
|
1024
|
-
defaultMessage: "This release is empty. Open the Content Manager, select an entry and add it to the release."
|
|
1025
|
-
},
|
|
1026
1066
|
action: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1027
|
-
|
|
1067
|
+
designSystem.LinkButton,
|
|
1028
1068
|
{
|
|
1029
1069
|
as: reactRouterDom.Link,
|
|
1030
1070
|
to: {
|
|
@@ -1037,18 +1077,59 @@ const ReleaseDetailsBody = () => {
|
|
|
1037
1077
|
defaultMessage: "Open the Content Manager"
|
|
1038
1078
|
})
|
|
1039
1079
|
}
|
|
1040
|
-
)
|
|
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
|
+
})
|
|
1041
1086
|
}
|
|
1042
1087
|
) });
|
|
1043
1088
|
}
|
|
1044
|
-
|
|
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: [
|
|
1045
1128
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1046
1129
|
designSystem.SingleSelect,
|
|
1047
1130
|
{
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
defaultMessage: "Group by"
|
|
1051
|
-
}),
|
|
1131
|
+
placeholder: groupByLabel,
|
|
1132
|
+
"aria-label": groupByLabel,
|
|
1052
1133
|
customizeContent: (value) => formatMessage(
|
|
1053
1134
|
{
|
|
1054
1135
|
id: `content-releases.pages.ReleaseDetails.groupBy.label`,
|
|
@@ -1060,84 +1141,27 @@ const ReleaseDetailsBody = () => {
|
|
|
1060
1141
|
),
|
|
1061
1142
|
value: formatMessage(getGroupByOptionLabel(selectedGroupBy)),
|
|
1062
1143
|
onChange: (value) => setQuery({ groupBy: value }),
|
|
1063
|
-
children:
|
|
1144
|
+
children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: option, children: formatMessage(getGroupByOptionLabel(option)) }, option))
|
|
1064
1145
|
}
|
|
1065
1146
|
) }),
|
|
1066
1147
|
Object.keys(releaseActions).map((key) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, direction: "column", alignItems: "stretch", children: [
|
|
1067
1148
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { role: "separator", "aria-label": key, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { children: key }) }),
|
|
1068
1149
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1069
|
-
|
|
1150
|
+
strapiAdmin.Table.Root,
|
|
1070
1151
|
{
|
|
1071
1152
|
rows: releaseActions[key].map((item) => ({
|
|
1072
1153
|
...item,
|
|
1073
1154
|
id: Number(item.entry.id)
|
|
1074
1155
|
})),
|
|
1075
|
-
|
|
1076
|
-
isLoading,
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1080
|
-
|
|
1081
|
-
helperPlugin.Table.HeaderCell,
|
|
1082
|
-
{
|
|
1083
|
-
fieldSchemaType: "string",
|
|
1084
|
-
label: formatMessage({
|
|
1085
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.name",
|
|
1086
|
-
defaultMessage: "name"
|
|
1087
|
-
}),
|
|
1088
|
-
name: "name"
|
|
1089
|
-
}
|
|
1090
|
-
),
|
|
1091
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1092
|
-
helperPlugin.Table.HeaderCell,
|
|
1093
|
-
{
|
|
1094
|
-
fieldSchemaType: "string",
|
|
1095
|
-
label: formatMessage({
|
|
1096
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.locale",
|
|
1097
|
-
defaultMessage: "locale"
|
|
1098
|
-
}),
|
|
1099
|
-
name: "locale"
|
|
1100
|
-
}
|
|
1101
|
-
),
|
|
1102
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1103
|
-
helperPlugin.Table.HeaderCell,
|
|
1104
|
-
{
|
|
1105
|
-
fieldSchemaType: "string",
|
|
1106
|
-
label: formatMessage({
|
|
1107
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.content-type",
|
|
1108
|
-
defaultMessage: "content-type"
|
|
1109
|
-
}),
|
|
1110
|
-
name: "content-type"
|
|
1111
|
-
}
|
|
1112
|
-
),
|
|
1113
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1114
|
-
helperPlugin.Table.HeaderCell,
|
|
1115
|
-
{
|
|
1116
|
-
fieldSchemaType: "string",
|
|
1117
|
-
label: formatMessage({
|
|
1118
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.action",
|
|
1119
|
-
defaultMessage: "action"
|
|
1120
|
-
}),
|
|
1121
|
-
name: "action"
|
|
1122
|
-
}
|
|
1123
|
-
),
|
|
1124
|
-
!release.releasedAt && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1125
|
-
helperPlugin.Table.HeaderCell,
|
|
1126
|
-
{
|
|
1127
|
-
fieldSchemaType: "string",
|
|
1128
|
-
label: formatMessage({
|
|
1129
|
-
id: "content-releases.page.ReleaseDetails.table.header.label.status",
|
|
1130
|
-
defaultMessage: "status"
|
|
1131
|
-
}),
|
|
1132
|
-
name: "status"
|
|
1133
|
-
}
|
|
1134
|
-
)
|
|
1135
|
-
] }),
|
|
1136
|
-
/* @__PURE__ */ jsxRuntime.jsx(helperPlugin.Table.LoadingBody, {}),
|
|
1137
|
-
/* @__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(
|
|
1138
1162
|
({ id, contentType, locale, type, entry }, actionIndex) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
1139
1163
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "25%", maxWidth: "200px", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { ellipsis: true, children: `${contentType.mainFieldValue || entry.id}` }) }),
|
|
1140
|
-
/* @__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 : "-"}` }) }),
|
|
1141
1165
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "10%", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: contentType.displayName || "" }) }),
|
|
1142
1166
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "20%", children: release.releasedAt ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage(
|
|
1143
1167
|
{
|
|
@@ -1191,34 +1215,39 @@ const ReleaseDetailsBody = () => {
|
|
|
1191
1215
|
}
|
|
1192
1216
|
)
|
|
1193
1217
|
] }, `releases-group-${key}`)),
|
|
1194
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
}
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
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
|
+
)
|
|
1205
1229
|
] }) });
|
|
1206
1230
|
};
|
|
1207
1231
|
const ReleaseDetailsPage = () => {
|
|
1208
1232
|
const { formatMessage } = reactIntl.useIntl();
|
|
1209
1233
|
const { releaseId } = reactRouterDom.useParams();
|
|
1210
|
-
const toggleNotification =
|
|
1211
|
-
const { formatAPIError } =
|
|
1212
|
-
const
|
|
1234
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
1235
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
1236
|
+
const navigate = reactRouterDom.useNavigate();
|
|
1213
1237
|
const [releaseModalShown, setReleaseModalShown] = React__namespace.useState(false);
|
|
1214
1238
|
const [showWarningSubmit, setWarningSubmit] = React__namespace.useState(false);
|
|
1215
1239
|
const {
|
|
1216
1240
|
isLoading: isLoadingDetails,
|
|
1217
1241
|
data,
|
|
1218
1242
|
isSuccess: isSuccessDetails
|
|
1219
|
-
} = index.useGetReleaseQuery(
|
|
1243
|
+
} = index.useGetReleaseQuery(
|
|
1244
|
+
{ id: releaseId },
|
|
1245
|
+
{
|
|
1246
|
+
skip: !releaseId
|
|
1247
|
+
}
|
|
1248
|
+
);
|
|
1220
1249
|
const [updateRelease, { isLoading: isSubmittingForm }] = index.useUpdateReleaseMutation();
|
|
1221
|
-
const [deleteRelease
|
|
1250
|
+
const [deleteRelease] = index.useDeleteReleaseMutation();
|
|
1222
1251
|
const toggleEditReleaseModal = () => {
|
|
1223
1252
|
setReleaseModalShown((prev) => !prev);
|
|
1224
1253
|
};
|
|
@@ -1229,10 +1258,13 @@ const ReleaseDetailsPage = () => {
|
|
|
1229
1258
|
{
|
|
1230
1259
|
toggleEditReleaseModal,
|
|
1231
1260
|
toggleWarningSubmit,
|
|
1232
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1261
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {})
|
|
1233
1262
|
}
|
|
1234
1263
|
);
|
|
1235
1264
|
}
|
|
1265
|
+
if (!releaseId) {
|
|
1266
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: ".." });
|
|
1267
|
+
}
|
|
1236
1268
|
const releaseData = isSuccessDetails && data?.data || null;
|
|
1237
1269
|
const title = releaseData?.name || "";
|
|
1238
1270
|
const timezone = releaseData?.timezone ?? null;
|
|
@@ -1254,33 +1286,33 @@ const ReleaseDetailsPage = () => {
|
|
|
1254
1286
|
defaultMessage: "Release updated."
|
|
1255
1287
|
})
|
|
1256
1288
|
});
|
|
1289
|
+
toggleEditReleaseModal();
|
|
1257
1290
|
} else if (index.isAxiosError(response.error)) {
|
|
1258
1291
|
toggleNotification({
|
|
1259
|
-
type: "
|
|
1292
|
+
type: "danger",
|
|
1260
1293
|
message: formatAPIError(response.error)
|
|
1261
1294
|
});
|
|
1262
1295
|
} else {
|
|
1263
1296
|
toggleNotification({
|
|
1264
|
-
type: "
|
|
1297
|
+
type: "danger",
|
|
1265
1298
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
1266
1299
|
});
|
|
1267
1300
|
}
|
|
1268
|
-
toggleEditReleaseModal();
|
|
1269
1301
|
};
|
|
1270
1302
|
const handleDeleteRelease = async () => {
|
|
1271
1303
|
const response = await deleteRelease({
|
|
1272
1304
|
id: releaseId
|
|
1273
1305
|
});
|
|
1274
1306
|
if ("data" in response) {
|
|
1275
|
-
|
|
1307
|
+
navigate("..");
|
|
1276
1308
|
} else if (index.isAxiosError(response.error)) {
|
|
1277
1309
|
toggleNotification({
|
|
1278
|
-
type: "
|
|
1310
|
+
type: "danger",
|
|
1279
1311
|
message: formatAPIError(response.error)
|
|
1280
1312
|
});
|
|
1281
1313
|
} else {
|
|
1282
1314
|
toggleNotification({
|
|
1283
|
-
type: "
|
|
1315
|
+
type: "danger",
|
|
1284
1316
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
1285
1317
|
});
|
|
1286
1318
|
}
|
|
@@ -1291,7 +1323,7 @@ const ReleaseDetailsPage = () => {
|
|
|
1291
1323
|
toggleEditReleaseModal,
|
|
1292
1324
|
toggleWarningSubmit,
|
|
1293
1325
|
children: [
|
|
1294
|
-
/* @__PURE__ */ jsxRuntime.jsx(ReleaseDetailsBody, {}),
|
|
1326
|
+
/* @__PURE__ */ jsxRuntime.jsx(ReleaseDetailsBody, { releaseId }),
|
|
1295
1327
|
releaseModalShown && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1296
1328
|
ReleaseModal,
|
|
1297
1329
|
{
|
|
@@ -1309,16 +1341,15 @@ const ReleaseDetailsPage = () => {
|
|
|
1309
1341
|
}
|
|
1310
1342
|
),
|
|
1311
1343
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1312
|
-
|
|
1344
|
+
strapiAdmin.ConfirmDialog,
|
|
1313
1345
|
{
|
|
1314
|
-
|
|
1346
|
+
isOpen: showWarningSubmit,
|
|
1347
|
+
onClose: toggleWarningSubmit,
|
|
1348
|
+
onConfirm: handleDeleteRelease,
|
|
1349
|
+
children: formatMessage({
|
|
1315
1350
|
id: "content-releases.dialog.confirmation-message",
|
|
1316
1351
|
defaultMessage: "Are you sure you want to delete this release?"
|
|
1317
|
-
}
|
|
1318
|
-
isOpen: showWarningSubmit,
|
|
1319
|
-
isConfirmButtonLoading: isDeletingRelease,
|
|
1320
|
-
onToggleDialog: toggleWarningSubmit,
|
|
1321
|
-
onConfirm: handleDeleteRelease
|
|
1352
|
+
})
|
|
1322
1353
|
}
|
|
1323
1354
|
)
|
|
1324
1355
|
]
|
|
@@ -1326,10 +1357,10 @@ const ReleaseDetailsPage = () => {
|
|
|
1326
1357
|
);
|
|
1327
1358
|
};
|
|
1328
1359
|
const App = () => {
|
|
1329
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1330
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, {
|
|
1331
|
-
/* @__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, {}) })
|
|
1332
1363
|
] }) });
|
|
1333
1364
|
};
|
|
1334
1365
|
exports.App = App;
|
|
1335
|
-
//# sourceMappingURL=App-
|
|
1366
|
+
//# sourceMappingURL=App-CXRpb2hi.js.map
|