strapi-plugin-bulk-updater 1.6.1 → 1.6.2
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/{BulkUpdater-DTJLdJJy.js → BulkUpdater-Y09TGkcC.js} +46 -6
- package/dist/_chunks/BulkUpdater-Y09TGkcC.js.map +1 -0
- package/dist/_chunks/{BulkUpdater-xj4wH_iI.mjs → BulkUpdater-e7N4vMse.mjs} +47 -7
- package/dist/_chunks/BulkUpdater-e7N4vMse.mjs.map +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/server/index.js +1543 -1264
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +1543 -1264
- package/dist/server/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/_chunks/BulkUpdater-DTJLdJJy.js.map +0 -1
- package/dist/_chunks/BulkUpdater-xj4wH_iI.mjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import React__default, { useRef, useState, useEffect, useMemo } from "react";
|
|
3
3
|
import { useFetchClient, useNotification } from "@strapi/strapi/admin";
|
|
4
|
-
import { Box, Flex, Typography, Button, Combobox, ComboboxOption, Badge, SingleSelect, SingleSelectOption, TextInput,
|
|
4
|
+
import { Box, Flex, Typography, Button, Combobox, ComboboxOption, Badge, SingleSelect, SingleSelectOption, TextInput, Alert, Checkbox, Table, Thead, Tr, Th, Tbody, Td, Loader, Textarea, Field } from "@strapi/design-system";
|
|
5
5
|
import { ArrowClockwise, Download, Search, Upload, ChevronLeft, ChevronRight, Eye, Check, Cog, Play } from "@strapi/icons";
|
|
6
6
|
import { i as isAbortError, V as ValidationRulesTab } from "./ValidationRulesTab-BtOCWK8E.mjs";
|
|
7
7
|
function parseCsvRows(csvText) {
|
|
@@ -411,11 +411,14 @@ function buildEntriesQueryParams(options) {
|
|
|
411
411
|
return params;
|
|
412
412
|
}
|
|
413
413
|
function buildCsvExportQueryParams(options) {
|
|
414
|
-
const { limit, filter } = options;
|
|
414
|
+
const { limit, filter, exportMode } = options;
|
|
415
415
|
const queryParams = new URLSearchParams();
|
|
416
416
|
if (limit && limit > 0) {
|
|
417
417
|
queryParams.set("limit", String(limit));
|
|
418
418
|
}
|
|
419
|
+
if (exportMode) {
|
|
420
|
+
queryParams.set("exportMode", exportMode);
|
|
421
|
+
}
|
|
419
422
|
if (filter.searchAttribute) {
|
|
420
423
|
queryParams.set("searchAttribute", filter.searchAttribute);
|
|
421
424
|
}
|
|
@@ -459,6 +462,7 @@ function CsvManagerTab() {
|
|
|
459
462
|
const hasPendingFilterChanges = !areSearchFiltersEqual(draftFilter, appliedFilter);
|
|
460
463
|
const [searchRelationOptions, setSearchRelationOptions] = useState([]);
|
|
461
464
|
const [searchRelationOptionsLoading, setSearchRelationOptionsLoading] = useState(false);
|
|
465
|
+
const [exportMode, setExportMode] = useState("all");
|
|
462
466
|
const [exportLimit, setExportLimit] = useState(0);
|
|
463
467
|
const [exportLimitInput, setExportLimitInput] = useState("");
|
|
464
468
|
const [exportingCollection, setExportingCollection] = useState(false);
|
|
@@ -732,7 +736,8 @@ function CsvManagerTab() {
|
|
|
732
736
|
setExportingCollection(true);
|
|
733
737
|
const queryParams = buildCsvExportQueryParams({
|
|
734
738
|
limit: exportLimit,
|
|
735
|
-
filter: appliedFilterRef.current
|
|
739
|
+
filter: appliedFilterRef.current,
|
|
740
|
+
exportMode
|
|
736
741
|
});
|
|
737
742
|
const res = await get(`/bulk-updater/csv/export/${selectedUid}?${queryParams.toString()}`);
|
|
738
743
|
const csvStr = res.data?.csvContent || (typeof res.data === "string" ? res.data : "");
|
|
@@ -1376,6 +1381,22 @@ function CsvManagerTab() {
|
|
|
1376
1381
|
);
|
|
1377
1382
|
}) })
|
|
1378
1383
|
] }),
|
|
1384
|
+
/* @__PURE__ */ jsxs(Box, { style: { width: 220 }, children: [
|
|
1385
|
+
/* @__PURE__ */ jsx(Typography, { variant: "pi", fontWeight: "bold", textColor: "neutral800", marginBottom: 1, display: "block", children: "Object Export Mode" }),
|
|
1386
|
+
/* @__PURE__ */ jsxs(
|
|
1387
|
+
SingleSelect,
|
|
1388
|
+
{
|
|
1389
|
+
value: exportMode,
|
|
1390
|
+
onChange: (val) => setExportMode(val === "metafields" || val === "topbarconfig" ? val : "all"),
|
|
1391
|
+
disabled: exportingCollection,
|
|
1392
|
+
children: [
|
|
1393
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "all", children: "All" }),
|
|
1394
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "metafields", children: "Metafields" }),
|
|
1395
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "topbarconfig", children: "Topbarconfig" })
|
|
1396
|
+
]
|
|
1397
|
+
}
|
|
1398
|
+
)
|
|
1399
|
+
] }),
|
|
1379
1400
|
/* @__PURE__ */ jsx(
|
|
1380
1401
|
Button,
|
|
1381
1402
|
{
|
|
@@ -1412,7 +1433,8 @@ function CsvManagerTab() {
|
|
|
1412
1433
|
}
|
|
1413
1434
|
)
|
|
1414
1435
|
] })
|
|
1415
|
-
] })
|
|
1436
|
+
] }),
|
|
1437
|
+
/* @__PURE__ */ jsx(Box, { marginTop: 3, children: exportMode === "all" ? /* @__PURE__ */ jsx(Alert, { closeLabel: "Close", variant: "warning", title: "Data Migration Export Mode", children: "All exports the complete collection data and is intended for data migration. Do not use this mode for routine updates. For targeted updates, select Metafields or Topbarconfig." }) : /* @__PURE__ */ jsx(Box, { padding: 3, background: "primary100", hasRadius: true, children: /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "primary700", children: exportMode === "metafields" ? "Exports metafields as individual first-level columns for targeted updates. Other fields retain their existing structure." : "Exports topbarconfig as individual first-level columns for targeted updates. Other fields retain their existing structure." }) }) })
|
|
1416
1438
|
] }),
|
|
1417
1439
|
/* @__PURE__ */ jsxs(Box, { padding: 5, background: "neutral100", hasRadius: true, children: [
|
|
1418
1440
|
/* @__PURE__ */ jsx(Typography, { variant: "delta", tag: "h3", fontWeight: "bold", marginBottom: 2, children: "2. Import & Batch Override CSV" }),
|
|
@@ -1482,7 +1504,21 @@ function CsvManagerTab() {
|
|
|
1482
1504
|
const totalRows = allParsedRecords.length;
|
|
1483
1505
|
const missingDocIdCount = allParsedRecords.filter((row) => !extractDocId(row)).length;
|
|
1484
1506
|
const updateCount = totalRows - missingDocIdCount;
|
|
1485
|
-
const headers = Object.keys(allParsedRecords[0])
|
|
1507
|
+
const headers = Object.keys(allParsedRecords[0]).filter(
|
|
1508
|
+
(h) => h !== "__bulk_updater_metadata" && h !== "_bulk_updater_metadata"
|
|
1509
|
+
);
|
|
1510
|
+
let detectedPreviewMode = "legacy";
|
|
1511
|
+
try {
|
|
1512
|
+
const rawMetaCell = allParsedRecords[0]["__bulk_updater_metadata"] || allParsedRecords[0]["_bulk_updater_metadata"];
|
|
1513
|
+
if (rawMetaCell) {
|
|
1514
|
+
const parsedMeta = typeof rawMetaCell === "string" ? JSON.parse(rawMetaCell) : rawMetaCell;
|
|
1515
|
+
if (parsedMeta?.exportMode) {
|
|
1516
|
+
detectedPreviewMode = String(parsedMeta.exportMode);
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1519
|
+
} catch {
|
|
1520
|
+
}
|
|
1521
|
+
const modeDisplayLabel = detectedPreviewMode === "metafields" ? "Metafields (1-Level Targeted)" : detectedPreviewMode === "topbarconfig" ? "Topbarconfig (1-Level Targeted)" : detectedPreviewMode === "all" ? "All (Full Migration Export)" : "Legacy";
|
|
1486
1522
|
const totalPages = Math.ceil(totalRows / previewPageSize) || 1;
|
|
1487
1523
|
const safePage = Math.min(Math.max(1, previewPage), totalPages);
|
|
1488
1524
|
const startIndex = (safePage - 1) * previewPageSize;
|
|
@@ -1507,7 +1543,11 @@ function CsvManagerTab() {
|
|
|
1507
1543
|
missingDocIdCount > 0 ? `${missingDocIdCount.toLocaleString()} new entries (missing documentId)` : ""
|
|
1508
1544
|
] })
|
|
1509
1545
|
] }),
|
|
1510
|
-
/* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
1546
|
+
/* @__PURE__ */ jsxs(Flex, { gap: 2, wrap: "wrap", children: [
|
|
1547
|
+
/* @__PURE__ */ jsxs(Badge, { backgroundColor: "neutral150", textColor: "neutral700", children: [
|
|
1548
|
+
"Mode: ",
|
|
1549
|
+
modeDisplayLabel
|
|
1550
|
+
] }),
|
|
1511
1551
|
/* @__PURE__ */ jsxs(Badge, { backgroundColor: "primary100", textColor: "primary700", children: [
|
|
1512
1552
|
"🔄 ",
|
|
1513
1553
|
updateCount.toLocaleString(),
|
|
@@ -10126,4 +10166,4 @@ export {
|
|
|
10126
10166
|
getSortOptionsForCollection,
|
|
10127
10167
|
parseDynamicZonePath
|
|
10128
10168
|
};
|
|
10129
|
-
//# sourceMappingURL=BulkUpdater-
|
|
10169
|
+
//# sourceMappingURL=BulkUpdater-e7N4vMse.mjs.map
|