strapi-plugin-bulk-updater 1.5.8 → 1.5.10
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-B58N9HHk.mjs → BulkUpdater-7rkObCic.mjs} +248 -126
- package/dist/_chunks/BulkUpdater-7rkObCic.mjs.map +1 -0
- package/dist/_chunks/{BulkUpdater-ezjrkUaf.js → BulkUpdater-BlSPmNFG.js} +247 -125
- package/dist/_chunks/BulkUpdater-BlSPmNFG.js.map +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/server/index.js +84 -32
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +84 -32
- package/dist/server/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/_chunks/BulkUpdater-B58N9HHk.mjs.map +0 -1
- package/dist/_chunks/BulkUpdater-ezjrkUaf.js.map +0 -1
|
@@ -140,13 +140,104 @@ function extractDocId(row) {
|
|
|
140
140
|
}
|
|
141
141
|
return "";
|
|
142
142
|
}
|
|
143
|
+
function getEntryLifecycleStatus(entry, col, pendingBatches = []) {
|
|
144
|
+
const isPendingApproval = pendingBatches.some((b) => {
|
|
145
|
+
if (b.status !== "pending_approval") return false;
|
|
146
|
+
const targets = b.payload?.selectedEntries || [];
|
|
147
|
+
return targets.some((t) => entry.documentId && t.documentId === entry.documentId || String(t.documentId) === String(entry.id));
|
|
148
|
+
});
|
|
149
|
+
if (isPendingApproval) {
|
|
150
|
+
return {
|
|
151
|
+
status: "pending_review",
|
|
152
|
+
label: "Pending Review",
|
|
153
|
+
badgeColor: "warning100",
|
|
154
|
+
textColor: "warning700"
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
if (col && col.draftAndPublish === false) {
|
|
158
|
+
return {
|
|
159
|
+
status: "published",
|
|
160
|
+
label: "Published",
|
|
161
|
+
badgeColor: "success100",
|
|
162
|
+
textColor: "success700"
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
if (entry.status === "modified") {
|
|
166
|
+
return {
|
|
167
|
+
status: "modified",
|
|
168
|
+
label: "Modified",
|
|
169
|
+
badgeColor: "primary100",
|
|
170
|
+
textColor: "primary700"
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
if (entry.status === "draft") {
|
|
174
|
+
return {
|
|
175
|
+
status: "draft",
|
|
176
|
+
label: "Draft",
|
|
177
|
+
badgeColor: "neutral150",
|
|
178
|
+
textColor: "neutral700"
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
if (entry.status === "published") {
|
|
182
|
+
return {
|
|
183
|
+
status: "published",
|
|
184
|
+
label: "Published",
|
|
185
|
+
badgeColor: "success100",
|
|
186
|
+
textColor: "success700"
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
if (entry.status === "unknown") {
|
|
190
|
+
return {
|
|
191
|
+
status: "unknown",
|
|
192
|
+
label: "Unknown",
|
|
193
|
+
badgeColor: "neutral200",
|
|
194
|
+
textColor: "neutral600"
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
if (!entry.documentId && !entry.id && !entry.slug) {
|
|
198
|
+
return {
|
|
199
|
+
status: "unknown",
|
|
200
|
+
label: "Unknown",
|
|
201
|
+
badgeColor: "neutral200",
|
|
202
|
+
textColor: "neutral600"
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
if (entry.publishedAt) {
|
|
206
|
+
if (entry.updatedAt && new Date(entry.updatedAt).getTime() > new Date(entry.publishedAt).getTime()) {
|
|
207
|
+
return {
|
|
208
|
+
status: "modified",
|
|
209
|
+
label: "Modified",
|
|
210
|
+
badgeColor: "primary100",
|
|
211
|
+
textColor: "primary700"
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
return {
|
|
215
|
+
status: "published",
|
|
216
|
+
label: "Published",
|
|
217
|
+
badgeColor: "success100",
|
|
218
|
+
textColor: "success700"
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
return {
|
|
222
|
+
status: "draft",
|
|
223
|
+
label: "Draft",
|
|
224
|
+
badgeColor: "neutral150",
|
|
225
|
+
textColor: "neutral700"
|
|
226
|
+
};
|
|
227
|
+
}
|
|
143
228
|
function CsvManagerTab() {
|
|
144
229
|
const { get, post } = admin.useFetchClient();
|
|
145
230
|
const { toggleNotification } = admin.useNotification();
|
|
146
231
|
const [collections, setCollections] = React.useState([]);
|
|
147
232
|
const [loadingCollections, setLoadingCollections] = React.useState(true);
|
|
148
233
|
const [selectedUid, setSelectedUid] = React.useState("");
|
|
234
|
+
const [collectionEntries, setCollectionEntries] = React.useState([]);
|
|
235
|
+
const [pendingBatches, setPendingBatches] = React.useState([]);
|
|
149
236
|
const [exportLimit, setExportLimit] = React.useState(0);
|
|
237
|
+
const [exportLimitInput, setExportLimitInput] = React.useState("");
|
|
238
|
+
const [exportingCollection, setExportingCollection] = React.useState(false);
|
|
239
|
+
const [downloadingTemplate, setDownloadingTemplate] = React.useState(false);
|
|
240
|
+
const [exportingViolations, setExportingViolations] = React.useState(false);
|
|
150
241
|
const [exportOnlyViolations, setExportOnlyViolations] = React.useState(false);
|
|
151
242
|
const [rules, setRules] = React.useState([]);
|
|
152
243
|
const [selectedRuleId, setSelectedRuleId] = React.useState("");
|
|
@@ -174,17 +265,24 @@ function CsvManagerTab() {
|
|
|
174
265
|
const fetchInitialData = async () => {
|
|
175
266
|
try {
|
|
176
267
|
setLoadingCollections(true);
|
|
177
|
-
const [modelsRes, rulesRes] = await Promise.all([
|
|
268
|
+
const [modelsRes, rulesRes, batchesRes] = await Promise.all([
|
|
178
269
|
get("/bulk-updater/models"),
|
|
179
|
-
get("/bulk-updater/validation-rules")
|
|
270
|
+
get("/bulk-updater/validation-rules"),
|
|
271
|
+
get("/bulk-updater/pending-batches").catch(() => ({ data: { batches: [] } }))
|
|
180
272
|
]);
|
|
181
273
|
if (modelsRes.data?.executionWindow) {
|
|
182
274
|
setExecutionWindow(modelsRes.data.executionWindow);
|
|
183
275
|
}
|
|
276
|
+
if (batchesRes.data?.batches) {
|
|
277
|
+
setPendingBatches(batchesRes.data.batches);
|
|
278
|
+
}
|
|
279
|
+
let loadedCollections = [];
|
|
184
280
|
if (modelsRes.data?.collections) {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
281
|
+
loadedCollections = modelsRes.data.collections;
|
|
282
|
+
setCollections(loadedCollections);
|
|
283
|
+
if (loadedCollections.length > 0) {
|
|
284
|
+
const firstUid = loadedCollections[0].uid;
|
|
285
|
+
setSelectedUid(firstUid);
|
|
188
286
|
}
|
|
189
287
|
}
|
|
190
288
|
if (rulesRes.data?.rules) {
|
|
@@ -203,9 +301,66 @@ function CsvManagerTab() {
|
|
|
203
301
|
setLoadingCollections(false);
|
|
204
302
|
}
|
|
205
303
|
};
|
|
304
|
+
const fetchAndEnrichEntries = async (colUid, cols = collections, batches = pendingBatches) => {
|
|
305
|
+
if (!colUid) return [];
|
|
306
|
+
try {
|
|
307
|
+
const res = await get(`/bulk-updater/collections/${colUid}/entries?page=1&pageSize=500`);
|
|
308
|
+
if (res.data && (res.data.success || res.data.entries !== void 0)) {
|
|
309
|
+
const fetchedEntries = res.data.entries || [];
|
|
310
|
+
const col = (cols || []).find((c) => c.uid === colUid) || null;
|
|
311
|
+
const enrichedEntries = fetchedEntries.map((entry) => {
|
|
312
|
+
if (!entry.status) {
|
|
313
|
+
const lifecycle = getEntryLifecycleStatus(entry, col, batches);
|
|
314
|
+
return {
|
|
315
|
+
...entry,
|
|
316
|
+
status: lifecycle.status,
|
|
317
|
+
publishedAt: entry.publishedAt ?? (lifecycle.status === "published" ? entry.updatedAt || null : null)
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
return entry;
|
|
321
|
+
});
|
|
322
|
+
setCollectionEntries(enrichedEntries);
|
|
323
|
+
return enrichedEntries;
|
|
324
|
+
}
|
|
325
|
+
} catch (err) {
|
|
326
|
+
if (ValidationRulesTab.isAbortError(err)) return [];
|
|
327
|
+
}
|
|
328
|
+
return [];
|
|
329
|
+
};
|
|
330
|
+
const enrichCsvRowsWithLifecycle = (rows, knownEntries = collectionEntries) => {
|
|
331
|
+
if (!rows || rows.length === 0) return rows;
|
|
332
|
+
const entryByDocId = /* @__PURE__ */ new Map();
|
|
333
|
+
for (const e of knownEntries) {
|
|
334
|
+
if (e.documentId) entryByDocId.set(String(e.documentId), e);
|
|
335
|
+
if (e.id) entryByDocId.set(String(e.id), e);
|
|
336
|
+
}
|
|
337
|
+
return rows.map((row) => {
|
|
338
|
+
const docId = extractDocId(row);
|
|
339
|
+
const matched = docId ? entryByDocId.get(docId) : void 0;
|
|
340
|
+
const existingStatus = row.status || row.Status;
|
|
341
|
+
const existingPubAt = row.publishedAt || row.published_at;
|
|
342
|
+
let status = existingStatus;
|
|
343
|
+
let publishedAt = existingPubAt;
|
|
344
|
+
if (!status && matched?.status) {
|
|
345
|
+
status = matched.status;
|
|
346
|
+
}
|
|
347
|
+
if (!publishedAt && matched?.publishedAt) {
|
|
348
|
+
publishedAt = matched.publishedAt;
|
|
349
|
+
}
|
|
350
|
+
if (status || publishedAt) {
|
|
351
|
+
return {
|
|
352
|
+
...row,
|
|
353
|
+
...status ? { status } : {},
|
|
354
|
+
...publishedAt ? { publishedAt } : {}
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
return row;
|
|
358
|
+
});
|
|
359
|
+
};
|
|
206
360
|
const handleDownloadTemplate = async () => {
|
|
207
|
-
if (!selectedUid) return;
|
|
361
|
+
if (!selectedUid || downloadingTemplate) return;
|
|
208
362
|
try {
|
|
363
|
+
setDownloadingTemplate(true);
|
|
209
364
|
const res = await get(`/bulk-updater/csv/template/${selectedUid}`);
|
|
210
365
|
const csvStr = res.data?.csvContent || (typeof res.data === "string" ? res.data : "");
|
|
211
366
|
const filename = res.data?.filename || `${selectedUid.split(".").pop()}_template.csv`;
|
|
@@ -220,11 +375,14 @@ function CsvManagerTab() {
|
|
|
220
375
|
type: "danger",
|
|
221
376
|
message: err.message || "Failed downloading CSV template"
|
|
222
377
|
});
|
|
378
|
+
} finally {
|
|
379
|
+
setDownloadingTemplate(false);
|
|
223
380
|
}
|
|
224
381
|
};
|
|
225
382
|
const handleExportCollection = async () => {
|
|
226
|
-
if (!selectedUid) return;
|
|
383
|
+
if (!selectedUid || exportingCollection) return;
|
|
227
384
|
try {
|
|
385
|
+
setExportingCollection(true);
|
|
228
386
|
const res = await get(`/bulk-updater/csv/export/${selectedUid}?limit=${exportLimit}`);
|
|
229
387
|
const csvStr = res.data?.csvContent || (typeof res.data === "string" ? res.data : "");
|
|
230
388
|
const filename = res.data?.filename || `${selectedUid.split(".").pop()}_export.csv`;
|
|
@@ -239,11 +397,14 @@ function CsvManagerTab() {
|
|
|
239
397
|
type: "danger",
|
|
240
398
|
message: err.message || "Failed exporting collection to CSV"
|
|
241
399
|
});
|
|
400
|
+
} finally {
|
|
401
|
+
setExportingCollection(false);
|
|
242
402
|
}
|
|
243
403
|
};
|
|
244
404
|
const handleExportViolations = async () => {
|
|
245
|
-
if (!selectedRuleId) return;
|
|
405
|
+
if (!selectedRuleId || exportingViolations) return;
|
|
246
406
|
try {
|
|
407
|
+
setExportingViolations(true);
|
|
247
408
|
const res = await get(`/bulk-updater/csv/export-violations/${selectedRuleId}`);
|
|
248
409
|
const csvStr = res.data?.csvContent || (typeof res.data === "string" ? res.data : "");
|
|
249
410
|
const filename = res.data?.filename || `violations_${selectedRuleId}.csv`;
|
|
@@ -258,6 +419,8 @@ function CsvManagerTab() {
|
|
|
258
419
|
type: "danger",
|
|
259
420
|
message: err.message || "Failed exporting violations to CSV"
|
|
260
421
|
});
|
|
422
|
+
} finally {
|
|
423
|
+
setExportingViolations(false);
|
|
261
424
|
}
|
|
262
425
|
};
|
|
263
426
|
const downloadCsvFile = (content, fallbackName) => {
|
|
@@ -291,7 +454,8 @@ function CsvManagerTab() {
|
|
|
291
454
|
setCsvRawText(text);
|
|
292
455
|
try {
|
|
293
456
|
const records = parseCsv(text);
|
|
294
|
-
|
|
457
|
+
const enriched = enrichCsvRowsWithLifecycle(records, collectionEntries);
|
|
458
|
+
setAllParsedRecords(enriched);
|
|
295
459
|
setPreviewPage(1);
|
|
296
460
|
} catch (err) {
|
|
297
461
|
setAllParsedRecords([]);
|
|
@@ -301,7 +465,12 @@ function CsvManagerTab() {
|
|
|
301
465
|
};
|
|
302
466
|
const handleExecuteImport = async () => {
|
|
303
467
|
if (!selectedUid || allParsedRecords.length === 0) return;
|
|
304
|
-
|
|
468
|
+
let currentEntries = collectionEntries;
|
|
469
|
+
if (currentEntries.length === 0) {
|
|
470
|
+
currentEntries = await fetchAndEnrichEntries(selectedUid);
|
|
471
|
+
}
|
|
472
|
+
const enrichedRecords = enrichCsvRowsWithLifecycle(allParsedRecords, currentEntries);
|
|
473
|
+
const totalRows = enrichedRecords.length;
|
|
305
474
|
const CHUNK_SIZE = 100;
|
|
306
475
|
const totalChunks = Math.ceil(totalRows / CHUNK_SIZE);
|
|
307
476
|
const batchId = `csv_batch_${Date.now()}_${Math.random().toString(36).substring(2, 7)}`;
|
|
@@ -327,7 +496,7 @@ function CsvManagerTab() {
|
|
|
327
496
|
for (let chunkIdx = 0; chunkIdx < totalChunks; chunkIdx++) {
|
|
328
497
|
const startIdx = chunkIdx * CHUNK_SIZE;
|
|
329
498
|
const endIdx = Math.min(startIdx + CHUNK_SIZE, totalRows);
|
|
330
|
-
const chunkRows =
|
|
499
|
+
const chunkRows = enrichedRecords.slice(startIdx, endIdx);
|
|
331
500
|
const isFirst = chunkIdx === 0;
|
|
332
501
|
const isLast = chunkIdx === totalChunks - 1;
|
|
333
502
|
const startRowNumber = startIdx + 2;
|
|
@@ -395,9 +564,14 @@ function CsvManagerTab() {
|
|
|
395
564
|
if (!selectedUid || allParsedRecords.length === 0) return;
|
|
396
565
|
try {
|
|
397
566
|
setPreflightLoading(true);
|
|
567
|
+
let currentEntries = collectionEntries;
|
|
568
|
+
if (currentEntries.length === 0) {
|
|
569
|
+
currentEntries = await fetchAndEnrichEntries(selectedUid);
|
|
570
|
+
}
|
|
571
|
+
const enrichedRecords = enrichCsvRowsWithLifecycle(allParsedRecords, currentEntries);
|
|
398
572
|
const res = await post("/bulk-updater/csv/validate-preflight", {
|
|
399
573
|
uid: selectedUid,
|
|
400
|
-
rows:
|
|
574
|
+
rows: enrichedRecords,
|
|
401
575
|
mode: importMode
|
|
402
576
|
});
|
|
403
577
|
if (res.data && res.data.success) {
|
|
@@ -438,9 +612,14 @@ function CsvManagerTab() {
|
|
|
438
612
|
}
|
|
439
613
|
try {
|
|
440
614
|
setSubmittingBatch(true);
|
|
615
|
+
let currentEntries = collectionEntries;
|
|
616
|
+
if (currentEntries.length === 0) {
|
|
617
|
+
currentEntries = await fetchAndEnrichEntries(selectedUid);
|
|
618
|
+
}
|
|
619
|
+
const enrichedRecords = enrichCsvRowsWithLifecycle(allParsedRecords, currentEntries);
|
|
441
620
|
const res = await post("/bulk-updater/csv/submit-batch", {
|
|
442
621
|
uid: selectedUid,
|
|
443
|
-
rows:
|
|
622
|
+
rows: enrichedRecords,
|
|
444
623
|
executionMode,
|
|
445
624
|
makerNotes: makerNotesInput,
|
|
446
625
|
forceImmediate,
|
|
@@ -522,7 +701,8 @@ function CsvManagerTab() {
|
|
|
522
701
|
variant: "tertiary",
|
|
523
702
|
startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Download, {}),
|
|
524
703
|
onClick: handleDownloadTemplate,
|
|
525
|
-
disabled: !selectedUid,
|
|
704
|
+
disabled: !selectedUid || downloadingTemplate,
|
|
705
|
+
loading: downloadingTemplate,
|
|
526
706
|
children: "Download Sample CSV Template"
|
|
527
707
|
}
|
|
528
708
|
)
|
|
@@ -530,35 +710,61 @@ function CsvManagerTab() {
|
|
|
530
710
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { padding: 5, background: "neutral100", hasRadius: true, children: [
|
|
531
711
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", tag: "h3", fontWeight: "bold", marginBottom: 2, children: "1. Export Data to CSV" }),
|
|
532
712
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", marginBottom: 4, children: "Extract entire collections without artificial limits (streams 10,000+ records in paged chunks) or pinpoint records violating validation quotas." }),
|
|
533
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, wrap: "wrap", alignItems: "
|
|
534
|
-
/* @__PURE__ */ jsxRuntime.
|
|
535
|
-
designSystem.
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
713
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, wrap: "wrap", alignItems: "flex-end", marginTop: 3, children: [
|
|
714
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { width: 220 }, children: [
|
|
715
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", textColor: "neutral800", marginBottom: 1, display: "block", children: "Records to Download" }),
|
|
716
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
717
|
+
designSystem.TextInput,
|
|
718
|
+
{
|
|
719
|
+
type: "number",
|
|
720
|
+
min: 0,
|
|
721
|
+
placeholder: "All records (or enter count)",
|
|
722
|
+
value: exportLimitInput,
|
|
723
|
+
onChange: (e) => {
|
|
724
|
+
const raw = e.target.value;
|
|
725
|
+
setExportLimitInput(raw);
|
|
726
|
+
const parsed = parseInt(raw, 10);
|
|
727
|
+
setExportLimit(!raw || isNaN(parsed) || parsed <= 0 ? 0 : parsed);
|
|
728
|
+
},
|
|
729
|
+
hint: exportLimit === 0 ? "Exporting all records (no limit)" : `Exporting first ${exportLimit.toLocaleString()} records`
|
|
730
|
+
}
|
|
731
|
+
)
|
|
732
|
+
] }),
|
|
733
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
|
|
734
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", marginBottom: 1, display: "block", children: "Quick Presets:" }),
|
|
735
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { gap: 1, wrap: "wrap", children: [
|
|
736
|
+
{ label: "All", value: 0 },
|
|
737
|
+
{ label: "100", value: 100 },
|
|
738
|
+
{ label: "500", value: 500 },
|
|
739
|
+
{ label: "1,000", value: 1e3 },
|
|
740
|
+
{ label: "5,000", value: 5e3 },
|
|
741
|
+
{ label: "10,000", value: 1e4 }
|
|
742
|
+
].map((preset) => {
|
|
743
|
+
const isSelected = preset.value === 0 ? exportLimit === 0 && (!exportLimitInput || exportLimitInput === "0") : exportLimit === preset.value && exportLimitInput === String(preset.value);
|
|
744
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
745
|
+
designSystem.Button,
|
|
746
|
+
{
|
|
747
|
+
variant: isSelected ? "secondary" : "tertiary",
|
|
748
|
+
size: "S",
|
|
749
|
+
onClick: () => {
|
|
750
|
+
setExportLimit(preset.value);
|
|
751
|
+
setExportLimitInput(preset.value === 0 ? "" : String(preset.value));
|
|
752
|
+
},
|
|
753
|
+
children: preset.label
|
|
754
|
+
},
|
|
755
|
+
preset.value
|
|
756
|
+
);
|
|
757
|
+
}) })
|
|
758
|
+
] }),
|
|
759
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
549
760
|
designSystem.Button,
|
|
550
761
|
{
|
|
551
762
|
variant: "default",
|
|
552
763
|
startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Download, {}),
|
|
553
764
|
onClick: handleExportCollection,
|
|
554
|
-
disabled: !selectedUid,
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
exportLimit === 0 ? "All" : `${exportLimit}`,
|
|
558
|
-
" ",
|
|
559
|
-
selectedCol?.displayName || "Collection",
|
|
560
|
-
" Records (.csv)"
|
|
561
|
-
]
|
|
765
|
+
disabled: !selectedUid || exportingCollection,
|
|
766
|
+
loading: exportingCollection,
|
|
767
|
+
children: exportingCollection ? "Preparing CSV download..." : `Export ${exportLimit === 0 ? "All" : exportLimit.toLocaleString()} ${selectedCol?.displayName || "Collection"} Records (.csv)`
|
|
562
768
|
}
|
|
563
769
|
),
|
|
564
770
|
rules.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, alignItems: "center", style: { marginLeft: "auto" }, children: [
|
|
@@ -580,7 +786,8 @@ function CsvManagerTab() {
|
|
|
580
786
|
variant: "danger-light",
|
|
581
787
|
startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Download, {}),
|
|
582
788
|
onClick: handleExportViolations,
|
|
583
|
-
disabled: !selectedRuleId,
|
|
789
|
+
disabled: !selectedRuleId || exportingViolations,
|
|
790
|
+
loading: exportingViolations,
|
|
584
791
|
children: "Export Violators CSV"
|
|
585
792
|
}
|
|
586
793
|
)
|
|
@@ -2857,91 +3064,6 @@ const CheckerReviewModal = ({
|
|
|
2857
3064
|
}
|
|
2858
3065
|
);
|
|
2859
3066
|
};
|
|
2860
|
-
function getEntryLifecycleStatus(entry, col, pendingBatches = []) {
|
|
2861
|
-
const isPendingApproval = pendingBatches.some((b) => {
|
|
2862
|
-
if (b.status !== "pending_approval") return false;
|
|
2863
|
-
const targets = b.payload?.selectedEntries || [];
|
|
2864
|
-
return targets.some((t) => entry.documentId && t.documentId === entry.documentId || String(t.documentId) === String(entry.id));
|
|
2865
|
-
});
|
|
2866
|
-
if (isPendingApproval) {
|
|
2867
|
-
return {
|
|
2868
|
-
status: "pending_review",
|
|
2869
|
-
label: "Pending Review",
|
|
2870
|
-
badgeColor: "warning100",
|
|
2871
|
-
textColor: "warning700"
|
|
2872
|
-
};
|
|
2873
|
-
}
|
|
2874
|
-
if (col && col.draftAndPublish === false) {
|
|
2875
|
-
return {
|
|
2876
|
-
status: "published",
|
|
2877
|
-
label: "Published",
|
|
2878
|
-
badgeColor: "success100",
|
|
2879
|
-
textColor: "success700"
|
|
2880
|
-
};
|
|
2881
|
-
}
|
|
2882
|
-
if (entry.status === "modified") {
|
|
2883
|
-
return {
|
|
2884
|
-
status: "modified",
|
|
2885
|
-
label: "Modified",
|
|
2886
|
-
badgeColor: "primary100",
|
|
2887
|
-
textColor: "primary700"
|
|
2888
|
-
};
|
|
2889
|
-
}
|
|
2890
|
-
if (entry.status === "draft") {
|
|
2891
|
-
return {
|
|
2892
|
-
status: "draft",
|
|
2893
|
-
label: "Draft",
|
|
2894
|
-
badgeColor: "neutral150",
|
|
2895
|
-
textColor: "neutral700"
|
|
2896
|
-
};
|
|
2897
|
-
}
|
|
2898
|
-
if (entry.status === "published") {
|
|
2899
|
-
return {
|
|
2900
|
-
status: "published",
|
|
2901
|
-
label: "Published",
|
|
2902
|
-
badgeColor: "success100",
|
|
2903
|
-
textColor: "success700"
|
|
2904
|
-
};
|
|
2905
|
-
}
|
|
2906
|
-
if (entry.status === "unknown") {
|
|
2907
|
-
return {
|
|
2908
|
-
status: "unknown",
|
|
2909
|
-
label: "Unknown",
|
|
2910
|
-
badgeColor: "neutral200",
|
|
2911
|
-
textColor: "neutral600"
|
|
2912
|
-
};
|
|
2913
|
-
}
|
|
2914
|
-
if (!entry.documentId && !entry.id && !entry.slug) {
|
|
2915
|
-
return {
|
|
2916
|
-
status: "unknown",
|
|
2917
|
-
label: "Unknown",
|
|
2918
|
-
badgeColor: "neutral200",
|
|
2919
|
-
textColor: "neutral600"
|
|
2920
|
-
};
|
|
2921
|
-
}
|
|
2922
|
-
if (entry.publishedAt) {
|
|
2923
|
-
if (entry.updatedAt && new Date(entry.updatedAt).getTime() > new Date(entry.publishedAt).getTime()) {
|
|
2924
|
-
return {
|
|
2925
|
-
status: "modified",
|
|
2926
|
-
label: "Modified",
|
|
2927
|
-
badgeColor: "primary100",
|
|
2928
|
-
textColor: "primary700"
|
|
2929
|
-
};
|
|
2930
|
-
}
|
|
2931
|
-
return {
|
|
2932
|
-
status: "published",
|
|
2933
|
-
label: "Published",
|
|
2934
|
-
badgeColor: "success100",
|
|
2935
|
-
textColor: "success700"
|
|
2936
|
-
};
|
|
2937
|
-
}
|
|
2938
|
-
return {
|
|
2939
|
-
status: "draft",
|
|
2940
|
-
label: "Draft",
|
|
2941
|
-
badgeColor: "neutral150",
|
|
2942
|
-
textColor: "neutral700"
|
|
2943
|
-
};
|
|
2944
|
-
}
|
|
2945
3067
|
function parseDynamicZonePath(path) {
|
|
2946
3068
|
if (!path) return { cleanPath: "", rootKey: "", subPath: "" };
|
|
2947
3069
|
const bracketMatch = path.match(/^([^.[]+)\[([^\]]+)\]\.(.+)$/);
|
|
@@ -7535,4 +7657,4 @@ exports.getNestedValue = getNestedValue;
|
|
|
7535
7657
|
exports.getPropertyValue = getPropertyValue;
|
|
7536
7658
|
exports.getSortOptionsForCollection = getSortOptionsForCollection;
|
|
7537
7659
|
exports.parseDynamicZonePath = parseDynamicZonePath;
|
|
7538
|
-
//# sourceMappingURL=BulkUpdater-
|
|
7660
|
+
//# sourceMappingURL=BulkUpdater-BlSPmNFG.js.map
|