@firecms/data_import_export 3.0.0-canary.4 → 3.0.0-canary.6
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/components/ImportSaveInProgress.d.ts +2 -1
- package/dist/index.es.js +26 -23
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/package.json +4 -4
- package/src/components/ImportSaveInProgress.tsx +8 -3
- package/src/export_import/ImportCollectionAction.tsx +1 -0
@@ -1,6 +1,7 @@
|
|
1
1
|
import { EntityCollection } from "@firecms/core";
|
2
2
|
import { ImportConfig } from "../types";
|
3
|
-
export declare function ImportSaveInProgress<C extends EntityCollection>({ importConfig, collection, onImportSuccess }: {
|
3
|
+
export declare function ImportSaveInProgress<C extends EntityCollection>({ path, importConfig, collection, onImportSuccess }: {
|
4
|
+
path: string;
|
4
5
|
importConfig: ImportConfig;
|
5
6
|
collection: C;
|
6
7
|
onImportSuccess: (collection: C) => void;
|
package/dist/index.es.js
CHANGED
@@ -332,48 +332,50 @@ function Dt({
|
|
332
332
|
) });
|
333
333
|
}
|
334
334
|
function lt({
|
335
|
-
|
336
|
-
|
337
|
-
|
335
|
+
path: e,
|
336
|
+
importConfig: r,
|
337
|
+
collection: n,
|
338
|
+
onImportSuccess: t
|
338
339
|
}) {
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
340
|
+
console.log("ImportSaveInProgress", e);
|
341
|
+
const a = me(), i = Oe(!1), [o, l] = j(0);
|
342
|
+
function d() {
|
343
|
+
i.current || (i.current = !0, we(
|
344
|
+
a,
|
345
|
+
n,
|
346
|
+
e,
|
347
|
+
r.entities,
|
345
348
|
0,
|
346
349
|
25,
|
347
|
-
|
350
|
+
l
|
348
351
|
).then(() => {
|
349
|
-
n
|
352
|
+
t(n), i.current = !1;
|
350
353
|
}));
|
351
354
|
}
|
352
355
|
return ce(() => {
|
353
|
-
|
356
|
+
d();
|
354
357
|
}, []), /* @__PURE__ */ p(Ve, { className: "flex flex-col gap-4 items-center", children: [
|
355
358
|
/* @__PURE__ */ s(ge, {}),
|
356
359
|
/* @__PURE__ */ s(u, { variant: "h6", children: "Saving data" }),
|
357
360
|
/* @__PURE__ */ p(u, { variant: "body2", children: [
|
358
|
-
|
361
|
+
o,
|
359
362
|
"/",
|
360
|
-
|
363
|
+
r.entities.length,
|
361
364
|
" entities saved"
|
362
365
|
] }),
|
363
366
|
/* @__PURE__ */ s(u, { variant: "caption", children: "Do not close this tab or the import will be interrupted." })
|
364
367
|
] });
|
365
368
|
}
|
366
|
-
function we(e, r, n, t = 0,
|
367
|
-
console.debug("Saving imported data",
|
368
|
-
const
|
369
|
-
return Promise.all(
|
370
|
-
path:
|
371
|
-
|
372
|
-
|
373
|
-
entityId: l.id,
|
369
|
+
function we(e, r, n, t, a = 0, i = 25, o) {
|
370
|
+
console.debug("Saving imported data", a, i);
|
371
|
+
const l = t.slice(a, a + i);
|
372
|
+
return Promise.all(l.map((d) => e.saveEntity({
|
373
|
+
path: n,
|
374
|
+
values: d.values,
|
375
|
+
entityId: d.id,
|
374
376
|
collection: r,
|
375
377
|
status: "new"
|
376
|
-
}))).then(() =>
|
378
|
+
}))).then(() => a + i < t.length ? (o(a + i), we(e, r, n, t, a + i, i, o)) : (o(t.length), Promise.resolve()));
|
377
379
|
}
|
378
380
|
function ct({
|
379
381
|
collection: e,
|
@@ -471,6 +473,7 @@ function ct({
|
|
471
473
|
{
|
472
474
|
importConfig: c,
|
473
475
|
collection: e,
|
476
|
+
path: r,
|
474
477
|
onImportSuccess: (g) => {
|
475
478
|
m(), a.open({
|
476
479
|
type: "info",
|