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
@@ -5,7 +5,7 @@ const React = require("react");
5
5
  const admin = require("@strapi/strapi/admin");
6
6
  const designSystem = require("@strapi/design-system");
7
7
  const icons = require("@strapi/icons");
8
- const ValidationRulesTab = require("./ValidationRulesTab-Cs0YDlMx.js");
8
+ const ValidationRulesTab = require("./ValidationRulesTab-of8bIzre.js");
9
9
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
10
10
  const React__default = /* @__PURE__ */ _interopDefault(React);
11
11
  function parseCsvRows(csvText) {
@@ -4160,6 +4160,7 @@ const BulkUpdatePreviewModal = ({
4160
4160
  isOpen,
4161
4161
  onClose,
4162
4162
  onProceed,
4163
+ canProceed,
4163
4164
  loading,
4164
4165
  previewData,
4165
4166
  attribute,
@@ -4170,6 +4171,8 @@ const BulkUpdatePreviewModal = ({
4170
4171
  }) => {
4171
4172
  const [filterTab, setFilterTab] = React.useState("all");
4172
4173
  const [searchQuery, setSearchQuery] = React.useState("");
4174
+ const { canWorkspaceProceedToExecute } = ValidationRulesTab.useBulkUpdaterRBAC();
4175
+ const allowProceed = canProceed !== void 0 ? canProceed : canWorkspaceProceedToExecute;
4173
4176
  const filteredDiffs = React.useMemo(() => {
4174
4177
  if (!previewData || !previewData.diffs) return [];
4175
4178
  let items = previewData.diffs;
@@ -4516,7 +4519,7 @@ const BulkUpdatePreviewModal = ({
4516
4519
  },
4517
4520
  children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", children: [
4518
4521
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", size: "M", onClick: onClose, children: "Close Preview" }),
4519
- /* @__PURE__ */ jsxRuntime.jsxs(
4522
+ allowProceed && /* @__PURE__ */ jsxRuntime.jsxs(
4520
4523
  designSystem.Button,
4521
4524
  {
4522
4525
  variant: "default",
@@ -6530,6 +6533,7 @@ const BulkUpdater = () => {
6530
6533
  const { get, post } = admin.useFetchClient();
6531
6534
  const { toggleNotification } = admin.useNotification();
6532
6535
  const permissions = ValidationRulesTab.useBulkUpdaterRBAC();
6536
+ const canAnyUpdateExecution = permissions.canWorkspaceSubmitForChecker || permissions.canWorkspaceForceRunNow || permissions.canWorkspaceQueueForOffPeak;
6533
6537
  const getInitialTab = () => {
6534
6538
  try {
6535
6539
  const params = new URLSearchParams(window.location.search);
@@ -6578,6 +6582,7 @@ const BulkUpdater = () => {
6578
6582
  const [auditEnabled, setAuditEnabled] = React.useState(false);
6579
6583
  const [executionWindow, setExecutionWindow] = React.useState(null);
6580
6584
  const [showConfirmModal, setShowConfirmModal] = React.useState(false);
6585
+ const [confirmModalSource, setConfirmModalSource] = React.useState("direct");
6581
6586
  const [pendingBatches, setPendingBatches] = React.useState([]);
6582
6587
  const [pendingBatchesLoading, setPendingBatchesLoading] = React.useState(false);
6583
6588
  const [approvingBatchId, setApprovingBatchId] = React.useState(null);
@@ -7330,13 +7335,13 @@ const BulkUpdater = () => {
7330
7335
  }, [availableColAttributes, componentDepth, attributesMeta, selectedCol]);
7331
7336
  const memoizedComboboxOptions = React.useMemo(() => {
7332
7337
  if (depthFilteredAttributes.length === 0) {
7333
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.ComboboxOption, { value: "__none__", disabled: true, textValue: "No attributes available", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: [
7338
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.ComboboxOption, { value: "__none__", disabled: true, textValue: "No attributes available", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: [
7334
7339
  "No attributes available for this collection type (Depth L",
7335
7340
  componentDepth,
7336
7341
  ")"
7337
- ] }) });
7342
+ ] }) }) });
7338
7343
  }
7339
- return depthFilteredAttributes.map((attr) => {
7344
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: depthFilteredAttributes.map((attr) => {
7340
7345
  const rel = getEffectiveRelMeta(attr);
7341
7346
  const depth = getAttrDepth(attr);
7342
7347
  const friendlyLabel = formatAttributeHeaderLabel(attr);
@@ -7356,7 +7361,7 @@ const BulkUpdater = () => {
7356
7361
  " component"
7357
7362
  ] }) : null
7358
7363
  ] }) }, attr);
7359
- });
7364
+ }) });
7360
7365
  }, [depthFilteredAttributes, getEffectiveRelMeta, selectedAttribute, componentDepth, attributesMeta]);
7361
7366
  const memoizedSearchComboboxOptions = React.useMemo(() => {
7362
7367
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: depthFilteredAttributes.map((attr) => {
@@ -7675,7 +7680,7 @@ const BulkUpdater = () => {
7675
7680
  () => gridEditMode ? computeLifecycleStatsForKeys(gridTargetKeys) : selectedLifecycleStats,
7676
7681
  [gridEditMode, gridTargetKeys, computeLifecycleStatsForKeys, selectedLifecycleStats]
7677
7682
  );
7678
- const handleOpenConfirmModal = () => {
7683
+ const handleOpenConfirmModal = (source = "direct") => {
7679
7684
  if (!selectedAttribute) {
7680
7685
  toggleNotification({
7681
7686
  type: "warning",
@@ -7710,6 +7715,7 @@ const BulkUpdater = () => {
7710
7715
  }
7711
7716
  setPublishStrategy("safe");
7712
7717
  setUnreviewedConsent(false);
7718
+ setConfirmModalSource(source === "preview" ? "preview" : "direct");
7713
7719
  setShowConfirmModal(true);
7714
7720
  };
7715
7721
  const handleOpenPreviewModal = async () => {
@@ -7825,8 +7831,10 @@ const BulkUpdater = () => {
7825
7831
  }
7826
7832
  const displaySummaryVal = gridEditMode ? `Grid Editing (${gridSerialized.totalEditCount} edits across ${targets.length} records)` : attributeValue;
7827
7833
  try {
7834
+ const isFromPreview = confirmModalSource === "preview";
7828
7835
  setUpdating(true);
7829
7836
  setShowConfirmModal(false);
7837
+ setConfirmModalSource("direct");
7830
7838
  setShowProcessingDashboard(true);
7831
7839
  setIsSubmittingBatch(true);
7832
7840
  setLastResults(null);
@@ -7864,7 +7872,8 @@ const BulkUpdater = () => {
7864
7872
  publishOnApproval,
7865
7873
  publishStrategy,
7866
7874
  unreviewedConsent,
7867
- unreviewedCount: selectedLifecycleStats.unreviewedCount
7875
+ unreviewedCount: selectedLifecycleStats.unreviewedCount,
7876
+ ...isFromPreview ? { initiatedFromPreview: true } : {}
7868
7877
  };
7869
7878
  const res = await post("/bulk-updater/batch-update", payload);
7870
7879
  setIsSubmittingBatch(false);
@@ -9755,10 +9764,10 @@ const BulkUpdater = () => {
9755
9764
  startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Play, {}),
9756
9765
  variant: "default",
9757
9766
  size: "L",
9758
- onClick: handleOpenConfirmModal,
9767
+ onClick: () => handleOpenConfirmModal("direct"),
9759
9768
  loading: updating,
9760
- disabled: !permissions.canWorkspaceExecute || (loading || !selectedAttribute || !selectedAttribute.trim() || (gridEditMode ? gridSerialized.targets.length === 0 || gridSerialized.hasValidationErrors : totalSelectedCount === 0)),
9761
- title: !permissions.canWorkspaceExecute ? "You do not have permission to execute bulk updates (action: plugin::bulk-updater.workspace.execute)." : void 0,
9769
+ disabled: !(permissions.canWorkspaceExecute || canAnyUpdateExecution) || (loading || !selectedAttribute || !selectedAttribute.trim() || (gridEditMode ? gridSerialized.targets.length === 0 || gridSerialized.hasValidationErrors : totalSelectedCount === 0)),
9770
+ title: !(permissions.canWorkspaceExecute || canAnyUpdateExecution) ? "You do not have permission to execute bulk updates (action: plugin::bulk-updater.workspace.execute)." : void 0,
9762
9771
  children: [
9763
9772
  "Update Selected (",
9764
9773
  gridEditMode ? gridSerialized.targets.length : totalSelectedCount,
@@ -10334,7 +10343,10 @@ const BulkUpdater = () => {
10334
10343
  boxSizing: "border-box",
10335
10344
  overflowY: "auto"
10336
10345
  },
10337
- onClick: () => setShowConfirmModal(false),
10346
+ onClick: () => {
10347
+ setShowConfirmModal(false);
10348
+ setConfirmModalSource("direct");
10349
+ },
10338
10350
  children: /* @__PURE__ */ jsxRuntime.jsxs(
10339
10351
  designSystem.Box,
10340
10352
  {
@@ -10678,9 +10690,20 @@ const BulkUpdater = () => {
10678
10690
  children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, style: { width: "100%" }, children: [
10679
10691
  publishOnApproval && updateModalLifecycleStats.unreviewedCount > 0 && publishStrategy === "all" && !unreviewedConsent && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "danger700", fontWeight: "bold", children: "⚠️ Explicit consent is required before publishing records with unreviewed draft revisions." }),
10680
10692
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", gap: 3, style: { width: "100%" }, children: [
10681
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", size: "M", onClick: () => setShowConfirmModal(false), children: "Cancel" }),
10682
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, wrap: "wrap", justifyContent: "flex-end", alignItems: "center", children: [
10683
- /* @__PURE__ */ jsxRuntime.jsx(
10693
+ /* @__PURE__ */ jsxRuntime.jsx(
10694
+ designSystem.Button,
10695
+ {
10696
+ variant: "tertiary",
10697
+ size: "M",
10698
+ onClick: () => {
10699
+ setShowConfirmModal(false);
10700
+ setConfirmModalSource("direct");
10701
+ },
10702
+ children: "Cancel"
10703
+ }
10704
+ ),
10705
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { gap: 2, wrap: "wrap", justifyContent: "flex-end", alignItems: "center", children: !canAnyUpdateExecution ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.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__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
10706
+ permissions.canWorkspaceSubmitForChecker && /* @__PURE__ */ jsxRuntime.jsx(
10684
10707
  designSystem.Button,
10685
10708
  {
10686
10709
  variant: executionWindow?.isBusinessHours ? "default" : "secondary",
@@ -10692,7 +10715,7 @@ const BulkUpdater = () => {
10692
10715
  }
10693
10716
  ),
10694
10717
  executionWindow?.isBusinessHours ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
10695
- /* @__PURE__ */ jsxRuntime.jsxs(
10718
+ permissions.canWorkspaceQueueForOffPeak && /* @__PURE__ */ jsxRuntime.jsxs(
10696
10719
  designSystem.Button,
10697
10720
  {
10698
10721
  variant: "secondary",
@@ -10707,7 +10730,7 @@ const BulkUpdater = () => {
10707
10730
  ]
10708
10731
  }
10709
10732
  ),
10710
- /* @__PURE__ */ jsxRuntime.jsx(
10733
+ permissions.canWorkspaceForceRunNow && /* @__PURE__ */ jsxRuntime.jsx(
10711
10734
  designSystem.Button,
10712
10735
  {
10713
10736
  variant: "danger-light",
@@ -10718,7 +10741,7 @@ const BulkUpdater = () => {
10718
10741
  children: "Force Run Now"
10719
10742
  }
10720
10743
  )
10721
- ] }) : /* @__PURE__ */ jsxRuntime.jsx(
10744
+ ] }) : permissions.canWorkspaceForceRunNow && /* @__PURE__ */ jsxRuntime.jsx(
10722
10745
  designSystem.Button,
10723
10746
  {
10724
10747
  variant: "default",
@@ -10729,7 +10752,7 @@ const BulkUpdater = () => {
10729
10752
  children: "Confirm & Execute Now"
10730
10753
  }
10731
10754
  )
10732
- ] })
10755
+ ] }) })
10733
10756
  ] })
10734
10757
  ] })
10735
10758
  }
@@ -11007,9 +11030,11 @@ const BulkUpdater = () => {
11007
11030
  {
11008
11031
  isOpen: showPreviewModal,
11009
11032
  onClose: () => setShowPreviewModal(false),
11033
+ canProceed: permissions.canWorkspaceProceedToExecute,
11010
11034
  onProceed: () => {
11035
+ if (!permissions.canWorkspaceProceedToExecute) return;
11011
11036
  setShowPreviewModal(false);
11012
- handleOpenConfirmModal();
11037
+ handleOpenConfirmModal("preview");
11013
11038
  },
11014
11039
  loading: previewLoading,
11015
11040
  previewData,
@@ -11063,4 +11088,4 @@ exports.parseDynamicZonePath = parseDynamicZonePath;
11063
11088
  exports.registerRelationOptions = registerRelationOptions;
11064
11089
  exports.resolveEffectiveRelationMeta = resolveEffectiveRelationMeta;
11065
11090
  exports.resolveEntityLabel = resolveEntityLabel;
11066
- //# sourceMappingURL=BulkUpdater-BSlEEUTV.js.map
11091
+ //# sourceMappingURL=BulkUpdater-Cnzgw4UH.js.map