strapi-plugin-bulk-updater 1.6.11 → 1.7.0

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.
Files changed (28) hide show
  1. package/dist/_chunks/{BulkUpdater-CFStXO-q.mjs → BulkUpdater-CV49TvOV.mjs} +46 -21
  2. package/dist/_chunks/BulkUpdater-CV49TvOV.mjs.map +1 -0
  3. package/dist/_chunks/{BulkUpdater-BSlEEUTV.js → BulkUpdater-Cnzgw4UH.js} +46 -21
  4. package/dist/_chunks/BulkUpdater-Cnzgw4UH.js.map +1 -0
  5. package/dist/_chunks/{SettingsPage-BrfS4_qy.mjs → SettingsPage-DXRWLRp_.mjs} +2 -2
  6. package/dist/_chunks/{SettingsPage-BrfS4_qy.mjs.map → SettingsPage-DXRWLRp_.mjs.map} +1 -1
  7. package/dist/_chunks/{SettingsPage-BgEO2BNP.js → SettingsPage-w_Lz-N0V.js} +2 -2
  8. package/dist/_chunks/{SettingsPage-BgEO2BNP.js.map → SettingsPage-w_Lz-N0V.js.map} +1 -1
  9. package/dist/_chunks/{ValidationRulesTab-BslJyrBj.mjs → ValidationRulesTab-eN_vH3TB.mjs} +22 -2
  10. package/dist/_chunks/ValidationRulesTab-eN_vH3TB.mjs.map +1 -0
  11. package/dist/_chunks/{ValidationRulesTab-Cs0YDlMx.js → ValidationRulesTab-of8bIzre.js} +22 -2
  12. package/dist/_chunks/ValidationRulesTab-of8bIzre.js.map +1 -0
  13. package/dist/_chunks/{index-4eNIGyGu.mjs → index-2DodYa70.mjs} +7 -3
  14. package/dist/_chunks/index-2DodYa70.mjs.map +1 -0
  15. package/dist/_chunks/{index-CjR6IZqM.js → index-C2HoRm23.js} +7 -3
  16. package/dist/_chunks/{index-4eNIGyGu.mjs.map → index-C2HoRm23.js.map} +1 -1
  17. package/dist/admin/index.js +1 -1
  18. package/dist/admin/index.mjs +1 -1
  19. package/dist/server/index.js +157 -69
  20. package/dist/server/index.js.map +1 -1
  21. package/dist/server/index.mjs +157 -69
  22. package/dist/server/index.mjs.map +1 -1
  23. package/package.json +1 -1
  24. package/dist/_chunks/BulkUpdater-BSlEEUTV.js.map +0 -1
  25. package/dist/_chunks/BulkUpdater-CFStXO-q.mjs.map +0 -1
  26. package/dist/_chunks/ValidationRulesTab-BslJyrBj.mjs.map +0 -1
  27. package/dist/_chunks/ValidationRulesTab-Cs0YDlMx.js.map +0 -1
  28. package/dist/_chunks/index-CjR6IZqM.js.map +0 -1
@@ -3,7 +3,7 @@ import React__default, { useRef, useState, useEffect, useCallback, useMemo } fro
3
3
  import { useFetchClient, useNotification } from "@strapi/strapi/admin";
4
4
  import { Box, Flex, Typography, Button, Combobox, ComboboxOption, Badge, SingleSelect, SingleSelectOption, TextInput, Checkbox, Alert, Table, Thead, Tr, Th, Tbody, Td, Loader, Textarea, Field } from "@strapi/design-system";
5
5
  import { ArrowClockwise, Download, Search, Cog, Upload, ChevronLeft, ChevronRight, Eye, Check, Play } from "@strapi/icons";
6
- import { u as useBulkUpdaterRBAC, i as isAbortError, V as ValidationRulesTab } from "./ValidationRulesTab-BslJyrBj.mjs";
6
+ import { u as useBulkUpdaterRBAC, i as isAbortError, V as ValidationRulesTab } from "./ValidationRulesTab-eN_vH3TB.mjs";
7
7
  function parseCsvRows(csvText) {
8
8
  if (!csvText) return [];
9
9
  let text = csvText;
@@ -4156,6 +4156,7 @@ const BulkUpdatePreviewModal = ({
4156
4156
  isOpen,
4157
4157
  onClose,
4158
4158
  onProceed,
4159
+ canProceed,
4159
4160
  loading,
4160
4161
  previewData,
4161
4162
  attribute,
@@ -4166,6 +4167,8 @@ const BulkUpdatePreviewModal = ({
4166
4167
  }) => {
4167
4168
  const [filterTab, setFilterTab] = useState("all");
4168
4169
  const [searchQuery, setSearchQuery] = useState("");
4170
+ const { canWorkspaceProceedToExecute } = useBulkUpdaterRBAC();
4171
+ const allowProceed = canProceed !== void 0 ? canProceed : canWorkspaceProceedToExecute;
4169
4172
  const filteredDiffs = useMemo(() => {
4170
4173
  if (!previewData || !previewData.diffs) return [];
4171
4174
  let items = previewData.diffs;
@@ -4512,7 +4515,7 @@ const BulkUpdatePreviewModal = ({
4512
4515
  },
4513
4516
  children: /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "center", children: [
4514
4517
  /* @__PURE__ */ jsx(Button, { variant: "tertiary", size: "M", onClick: onClose, children: "Close Preview" }),
4515
- /* @__PURE__ */ jsxs(
4518
+ allowProceed && /* @__PURE__ */ jsxs(
4516
4519
  Button,
4517
4520
  {
4518
4521
  variant: "default",
@@ -6526,6 +6529,7 @@ const BulkUpdater = () => {
6526
6529
  const { get, post } = useFetchClient();
6527
6530
  const { toggleNotification } = useNotification();
6528
6531
  const permissions = useBulkUpdaterRBAC();
6532
+ const canAnyUpdateExecution = permissions.canWorkspaceSubmitForChecker || permissions.canWorkspaceForceRunNow || permissions.canWorkspaceQueueForOffPeak;
6529
6533
  const getInitialTab = () => {
6530
6534
  try {
6531
6535
  const params = new URLSearchParams(window.location.search);
@@ -6574,6 +6578,7 @@ const BulkUpdater = () => {
6574
6578
  const [auditEnabled, setAuditEnabled] = useState(false);
6575
6579
  const [executionWindow, setExecutionWindow] = useState(null);
6576
6580
  const [showConfirmModal, setShowConfirmModal] = useState(false);
6581
+ const [confirmModalSource, setConfirmModalSource] = useState("direct");
6577
6582
  const [pendingBatches, setPendingBatches] = useState([]);
6578
6583
  const [pendingBatchesLoading, setPendingBatchesLoading] = useState(false);
6579
6584
  const [approvingBatchId, setApprovingBatchId] = useState(null);
@@ -7326,13 +7331,13 @@ const BulkUpdater = () => {
7326
7331
  }, [availableColAttributes, componentDepth, attributesMeta, selectedCol]);
7327
7332
  const memoizedComboboxOptions = useMemo(() => {
7328
7333
  if (depthFilteredAttributes.length === 0) {
7329
- return /* @__PURE__ */ jsx(ComboboxOption, { value: "__none__", disabled: true, textValue: "No attributes available", children: /* @__PURE__ */ jsxs(Typography, { variant: "pi", textColor: "neutral600", children: [
7334
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(ComboboxOption, { value: "__none__", disabled: true, textValue: "No attributes available", children: /* @__PURE__ */ jsxs(Typography, { variant: "pi", textColor: "neutral600", children: [
7330
7335
  "No attributes available for this collection type (Depth L",
7331
7336
  componentDepth,
7332
7337
  ")"
7333
- ] }) });
7338
+ ] }) }) });
7334
7339
  }
7335
- return depthFilteredAttributes.map((attr) => {
7340
+ return /* @__PURE__ */ jsx(Fragment, { children: depthFilteredAttributes.map((attr) => {
7336
7341
  const rel = getEffectiveRelMeta(attr);
7337
7342
  const depth = getAttrDepth(attr);
7338
7343
  const friendlyLabel = formatAttributeHeaderLabel(attr);
@@ -7352,7 +7357,7 @@ const BulkUpdater = () => {
7352
7357
  " component"
7353
7358
  ] }) : null
7354
7359
  ] }) }, attr);
7355
- });
7360
+ }) });
7356
7361
  }, [depthFilteredAttributes, getEffectiveRelMeta, selectedAttribute, componentDepth, attributesMeta]);
7357
7362
  const memoizedSearchComboboxOptions = useMemo(() => {
7358
7363
  return /* @__PURE__ */ jsx(Fragment, { children: depthFilteredAttributes.map((attr) => {
@@ -7671,7 +7676,7 @@ const BulkUpdater = () => {
7671
7676
  () => gridEditMode ? computeLifecycleStatsForKeys(gridTargetKeys) : selectedLifecycleStats,
7672
7677
  [gridEditMode, gridTargetKeys, computeLifecycleStatsForKeys, selectedLifecycleStats]
7673
7678
  );
7674
- const handleOpenConfirmModal = () => {
7679
+ const handleOpenConfirmModal = (source = "direct") => {
7675
7680
  if (!selectedAttribute) {
7676
7681
  toggleNotification({
7677
7682
  type: "warning",
@@ -7706,6 +7711,7 @@ const BulkUpdater = () => {
7706
7711
  }
7707
7712
  setPublishStrategy("safe");
7708
7713
  setUnreviewedConsent(false);
7714
+ setConfirmModalSource(source === "preview" ? "preview" : "direct");
7709
7715
  setShowConfirmModal(true);
7710
7716
  };
7711
7717
  const handleOpenPreviewModal = async () => {
@@ -7821,8 +7827,10 @@ const BulkUpdater = () => {
7821
7827
  }
7822
7828
  const displaySummaryVal = gridEditMode ? `Grid Editing (${gridSerialized.totalEditCount} edits across ${targets.length} records)` : attributeValue;
7823
7829
  try {
7830
+ const isFromPreview = confirmModalSource === "preview";
7824
7831
  setUpdating(true);
7825
7832
  setShowConfirmModal(false);
7833
+ setConfirmModalSource("direct");
7826
7834
  setShowProcessingDashboard(true);
7827
7835
  setIsSubmittingBatch(true);
7828
7836
  setLastResults(null);
@@ -7860,7 +7868,8 @@ const BulkUpdater = () => {
7860
7868
  publishOnApproval,
7861
7869
  publishStrategy,
7862
7870
  unreviewedConsent,
7863
- unreviewedCount: selectedLifecycleStats.unreviewedCount
7871
+ unreviewedCount: selectedLifecycleStats.unreviewedCount,
7872
+ ...isFromPreview ? { initiatedFromPreview: true } : {}
7864
7873
  };
7865
7874
  const res = await post("/bulk-updater/batch-update", payload);
7866
7875
  setIsSubmittingBatch(false);
@@ -9751,10 +9760,10 @@ const BulkUpdater = () => {
9751
9760
  startIcon: /* @__PURE__ */ jsx(Play, {}),
9752
9761
  variant: "default",
9753
9762
  size: "L",
9754
- onClick: handleOpenConfirmModal,
9763
+ onClick: () => handleOpenConfirmModal("direct"),
9755
9764
  loading: updating,
9756
- disabled: !permissions.canWorkspaceExecute || (loading || !selectedAttribute || !selectedAttribute.trim() || (gridEditMode ? gridSerialized.targets.length === 0 || gridSerialized.hasValidationErrors : totalSelectedCount === 0)),
9757
- title: !permissions.canWorkspaceExecute ? "You do not have permission to execute bulk updates (action: plugin::bulk-updater.workspace.execute)." : void 0,
9765
+ disabled: !(permissions.canWorkspaceExecute || canAnyUpdateExecution) || (loading || !selectedAttribute || !selectedAttribute.trim() || (gridEditMode ? gridSerialized.targets.length === 0 || gridSerialized.hasValidationErrors : totalSelectedCount === 0)),
9766
+ title: !(permissions.canWorkspaceExecute || canAnyUpdateExecution) ? "You do not have permission to execute bulk updates (action: plugin::bulk-updater.workspace.execute)." : void 0,
9758
9767
  children: [
9759
9768
  "Update Selected (",
9760
9769
  gridEditMode ? gridSerialized.targets.length : totalSelectedCount,
@@ -10330,7 +10339,10 @@ const BulkUpdater = () => {
10330
10339
  boxSizing: "border-box",
10331
10340
  overflowY: "auto"
10332
10341
  },
10333
- onClick: () => setShowConfirmModal(false),
10342
+ onClick: () => {
10343
+ setShowConfirmModal(false);
10344
+ setConfirmModalSource("direct");
10345
+ },
10334
10346
  children: /* @__PURE__ */ jsxs(
10335
10347
  Box,
10336
10348
  {
@@ -10674,9 +10686,20 @@ const BulkUpdater = () => {
10674
10686
  children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 2, style: { width: "100%" }, children: [
10675
10687
  publishOnApproval && updateModalLifecycleStats.unreviewedCount > 0 && publishStrategy === "all" && !unreviewedConsent && /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "danger700", fontWeight: "bold", children: "⚠️ Explicit consent is required before publishing records with unreviewed draft revisions." }),
10676
10688
  /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "center", gap: 3, style: { width: "100%" }, children: [
10677
- /* @__PURE__ */ jsx(Button, { variant: "tertiary", size: "M", onClick: () => setShowConfirmModal(false), children: "Cancel" }),
10678
- /* @__PURE__ */ jsxs(Flex, { gap: 2, wrap: "wrap", justifyContent: "flex-end", alignItems: "center", children: [
10679
- /* @__PURE__ */ jsx(
10689
+ /* @__PURE__ */ jsx(
10690
+ Button,
10691
+ {
10692
+ variant: "tertiary",
10693
+ size: "M",
10694
+ onClick: () => {
10695
+ setShowConfirmModal(false);
10696
+ setConfirmModalSource("direct");
10697
+ },
10698
+ children: "Cancel"
10699
+ }
10700
+ ),
10701
+ /* @__PURE__ */ jsx(Flex, { gap: 2, wrap: "wrap", justifyContent: "flex-end", alignItems: "center", children: !canAnyUpdateExecution ? /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "danger700", fontWeight: "bold", children: "You do not have permission to Submit for Checker, Queue for Off-Peak, or Force Run bulk updates." }) : /* @__PURE__ */ jsxs(Fragment, { children: [
10702
+ permissions.canWorkspaceSubmitForChecker && /* @__PURE__ */ jsx(
10680
10703
  Button,
10681
10704
  {
10682
10705
  variant: executionWindow?.isBusinessHours ? "default" : "secondary",
@@ -10688,7 +10711,7 @@ const BulkUpdater = () => {
10688
10711
  }
10689
10712
  ),
10690
10713
  executionWindow?.isBusinessHours ? /* @__PURE__ */ jsxs(Fragment, { children: [
10691
- /* @__PURE__ */ jsxs(
10714
+ permissions.canWorkspaceQueueForOffPeak && /* @__PURE__ */ jsxs(
10692
10715
  Button,
10693
10716
  {
10694
10717
  variant: "secondary",
@@ -10703,7 +10726,7 @@ const BulkUpdater = () => {
10703
10726
  ]
10704
10727
  }
10705
10728
  ),
10706
- /* @__PURE__ */ jsx(
10729
+ permissions.canWorkspaceForceRunNow && /* @__PURE__ */ jsx(
10707
10730
  Button,
10708
10731
  {
10709
10732
  variant: "danger-light",
@@ -10714,7 +10737,7 @@ const BulkUpdater = () => {
10714
10737
  children: "Force Run Now"
10715
10738
  }
10716
10739
  )
10717
- ] }) : /* @__PURE__ */ jsx(
10740
+ ] }) : permissions.canWorkspaceForceRunNow && /* @__PURE__ */ jsx(
10718
10741
  Button,
10719
10742
  {
10720
10743
  variant: "default",
@@ -10725,7 +10748,7 @@ const BulkUpdater = () => {
10725
10748
  children: "Confirm & Execute Now"
10726
10749
  }
10727
10750
  )
10728
- ] })
10751
+ ] }) })
10729
10752
  ] })
10730
10753
  ] })
10731
10754
  }
@@ -11003,9 +11026,11 @@ const BulkUpdater = () => {
11003
11026
  {
11004
11027
  isOpen: showPreviewModal,
11005
11028
  onClose: () => setShowPreviewModal(false),
11029
+ canProceed: permissions.canWorkspaceProceedToExecute,
11006
11030
  onProceed: () => {
11031
+ if (!permissions.canWorkspaceProceedToExecute) return;
11007
11032
  setShowPreviewModal(false);
11008
- handleOpenConfirmModal();
11033
+ handleOpenConfirmModal("preview");
11009
11034
  },
11010
11035
  loading: previewLoading,
11011
11036
  previewData,
@@ -11061,4 +11086,4 @@ export {
11061
11086
  resolveEffectiveRelationMeta,
11062
11087
  resolveEntityLabel
11063
11088
  };
11064
- //# sourceMappingURL=BulkUpdater-CFStXO-q.mjs.map
11089
+ //# sourceMappingURL=BulkUpdater-CV49TvOV.mjs.map