@nivaro/react 0.3.61 → 0.3.63
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/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +66 -0
- package/dist/index.js +239 -235
- package/dist/shared/components/CollectionBrowserView.js +424 -420
- package/dist/shared/components/ItemEditForm.js +3576 -3561
- package/dist/shared/components/QualityRulesView.js +212 -138
- package/dist/shared/components/alerts/AlertManagerView.js +341 -335
- package/dist/shared/components/help-videos/library/LearningPathsPanel.js +102 -98
- package/dist/shared/components/help-videos/library/PurgeVideoDialog.js +8 -8
- package/dist/shared/components/import/reimportDiff.js +67 -46
- package/dist/shared/components/imports/CollectionImportPanel.js +273 -247
- package/dist/shared/components/item-edit/QueueReturnChip.js +17 -13
- package/dist/shared/components/item-edit/staged-links.js +21 -21
- package/dist/shared/components/pipeline/PipelineEditorView.js +636 -632
- package/dist/shared/components/pipeline/PipelineStateOwners.js +88 -87
- package/dist/shared/components/queue/QueueWorklist.js +224 -222
- package/dist/shared/lib/batch-gets.js +68 -0
- package/dist/shared/lib/list-page-memory.js +40 -32
- package/dist/shared/lib/request-gate.js +284 -230
- package/package.json +1 -1
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { jsx as e, jsxs as a, Fragment as Be } from "react/jsx-runtime";
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { Upload as
|
|
4
|
-
import { useState as
|
|
2
|
+
import { useQueryClient as Je, useQuery as U, useMutation as Q } from "@tanstack/react-query";
|
|
3
|
+
import { Upload as Ve, Plus as qe, ArrowLeft as Me, FileUp as je, Link2 as We, Loader2 as me, Sparkles as He, ArrowRight as $e, MoreHorizontal as Ge, Trash2 as Ze, ChevronsUpDown as Xe, Check as Ye } from "lucide-react";
|
|
4
|
+
import { useState as x, useMemo as V, useEffect as Fe, useRef as De } from "react";
|
|
5
5
|
import { useNivaroClient as re, useNavigation as et } from "../../context.js";
|
|
6
6
|
import { get as W, del as tt, post as I } from "../../lib/commands.js";
|
|
7
7
|
import { errorSentence as at, rowErrorSentence as Te } from "../../lib/error-message.js";
|
|
8
|
-
import { formatNumber as _, cn as
|
|
8
|
+
import { formatNumber as _, cn as N, formatRelative as rt, formatDateTime as te } from "../../lib/utils.js";
|
|
9
9
|
import { DataTable as st } from "../DataTable.js";
|
|
10
|
-
import { Button as
|
|
10
|
+
import { Button as F } from "../ui/button.js";
|
|
11
11
|
import { Command as lt, CommandInput as nt, CommandList as ot, CommandEmpty as dt, CommandItem as it } from "../ui/command.js";
|
|
12
|
-
import { DropdownMenu as ct, DropdownMenuTrigger as mt, DropdownMenuContent as pt, DropdownMenuItem as
|
|
13
|
-
import { Input as
|
|
14
|
-
import { Label as
|
|
12
|
+
import { DropdownMenu as ct, DropdownMenuTrigger as mt, DropdownMenuContent as pt, DropdownMenuItem as he } from "../ui/dropdown-menu.js";
|
|
13
|
+
import { Input as Re } from "../ui/input.js";
|
|
14
|
+
import { Label as J } from "../ui/label.js";
|
|
15
15
|
import { Popover as ut, PopoverTrigger as ht, PopoverContent as xt } from "../ui/popover.js";
|
|
16
16
|
import { SimpleSelect as bt } from "../ui/SimpleSelect.js";
|
|
17
17
|
import { Sheet as ft, SheetContent as gt } from "../ui/sheet.js";
|
|
18
18
|
import { Switch as vt } from "../ui/switch.js";
|
|
19
|
-
import { Textarea as
|
|
20
|
-
const
|
|
19
|
+
import { Textarea as Nt } from "../ui/textarea.js";
|
|
20
|
+
const pe = 25, ue = ["Source", "Map columns", "Options", "Confirm"], j = {
|
|
21
21
|
pending: { dot: "bg-slate-400", text: "text-slate-600 dark:text-slate-300", label: "Pending" },
|
|
22
22
|
processing: {
|
|
23
23
|
dot: "bg-nvr-cyan",
|
|
@@ -30,90 +30,118 @@ const ue = 25, he = ["Source", "Map columns", "Options", "Confirm"], J = {
|
|
|
30
30
|
label: "Complete"
|
|
31
31
|
},
|
|
32
32
|
failed: { dot: "bg-red-500", text: "text-red-700 dark:text-red-400", label: "Failed" }
|
|
33
|
-
};
|
|
33
|
+
}, kt = "Roll back this import? Created rows are deleted (to trash) and overwritten rows restored to their prior values. One-shot.";
|
|
34
|
+
function wt({
|
|
35
|
+
disabled: o,
|
|
36
|
+
rolledBack: n,
|
|
37
|
+
onConfirm: l
|
|
38
|
+
}) {
|
|
39
|
+
const [m, i] = x(!1);
|
|
40
|
+
return /* @__PURE__ */ e(
|
|
41
|
+
he,
|
|
42
|
+
{
|
|
43
|
+
disabled: o,
|
|
44
|
+
"data-armed": m ? "" : void 0,
|
|
45
|
+
className: N(
|
|
46
|
+
m && "max-w-[300px] whitespace-normal bg-red-50 font-medium text-red-700 focus:bg-red-100 focus:text-red-800 dark:bg-red-500/10 dark:text-red-400 dark:focus:bg-red-500/20 dark:focus:text-red-300"
|
|
47
|
+
),
|
|
48
|
+
onSelect: (s) => {
|
|
49
|
+
if (!m) {
|
|
50
|
+
s.preventDefault(), i(!0);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
i(!1), l();
|
|
54
|
+
},
|
|
55
|
+
children: m ? /* @__PURE__ */ a("span", { className: "block", children: [
|
|
56
|
+
kt,
|
|
57
|
+
/* @__PURE__ */ e("span", { className: "mt-1 block text-[11px] font-semibold", children: "Choose again to roll back" })
|
|
58
|
+
] }) : n ? "Rolled back" : "Roll back this import"
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
}
|
|
34
62
|
function Ee({ status: o }) {
|
|
35
|
-
const n =
|
|
36
|
-
return /* @__PURE__ */ a("span", { className:
|
|
63
|
+
const n = j[o] ?? j.pending;
|
|
64
|
+
return /* @__PURE__ */ a("span", { className: N("flex items-center gap-1.5 text-[12px] font-medium", n.text), children: [
|
|
37
65
|
/* @__PURE__ */ a("span", { className: "relative flex h-1.5 w-1.5 shrink-0", children: [
|
|
38
66
|
o === "processing" && /* @__PURE__ */ e(
|
|
39
67
|
"span",
|
|
40
68
|
{
|
|
41
|
-
className:
|
|
69
|
+
className: N(
|
|
42
70
|
"absolute inline-flex h-full w-full rounded-full opacity-75 motion-safe:animate-ping",
|
|
43
71
|
n.dot
|
|
44
72
|
)
|
|
45
73
|
}
|
|
46
74
|
),
|
|
47
|
-
/* @__PURE__ */ e("span", { className:
|
|
75
|
+
/* @__PURE__ */ e("span", { className: N("relative inline-flex h-1.5 w-1.5 rounded-full", n.dot) })
|
|
48
76
|
] }),
|
|
49
77
|
n.label
|
|
50
78
|
] });
|
|
51
79
|
}
|
|
52
|
-
function
|
|
80
|
+
function yt({
|
|
53
81
|
processed: o,
|
|
54
82
|
total: n,
|
|
55
83
|
failed: l
|
|
56
84
|
}) {
|
|
57
85
|
if (!n) return /* @__PURE__ */ e("span", { className: "text-[12px] text-slate-300", children: "—" });
|
|
58
|
-
const
|
|
86
|
+
const m = Math.min(100, Math.round((o ?? 0) / n * 100));
|
|
59
87
|
return /* @__PURE__ */ a("div", { className: "flex min-w-[92px] items-center gap-2", children: [
|
|
60
88
|
/* @__PURE__ */ e("div", { className: "h-1.5 flex-1 overflow-hidden rounded-full bg-slate-100 dark:bg-muted", children: /* @__PURE__ */ e(
|
|
61
89
|
"div",
|
|
62
90
|
{
|
|
63
|
-
className:
|
|
91
|
+
className: N(
|
|
64
92
|
"h-full rounded-full transition-[width] duration-500",
|
|
65
93
|
l ? "bg-red-500" : "bg-nvr-cyan"
|
|
66
94
|
),
|
|
67
|
-
style: { width: `${
|
|
95
|
+
style: { width: `${m}%` }
|
|
68
96
|
}
|
|
69
97
|
) }),
|
|
70
98
|
/* @__PURE__ */ a("span", { className: "w-8 text-right text-[11px] tabular-nums text-slate-400", children: [
|
|
71
|
-
|
|
99
|
+
m,
|
|
72
100
|
"%"
|
|
73
101
|
] })
|
|
74
102
|
] });
|
|
75
103
|
}
|
|
76
104
|
function ae(o) {
|
|
77
105
|
const n = [];
|
|
78
|
-
let l = "",
|
|
79
|
-
for (let
|
|
80
|
-
const s = o[
|
|
81
|
-
|
|
106
|
+
let l = "", m = !1;
|
|
107
|
+
for (let i = 0; i < o.length; i++) {
|
|
108
|
+
const s = o[i];
|
|
109
|
+
m ? s === '"' && o[i + 1] === '"' ? (l += '"', i++) : s === '"' ? m = !1 : l += s : s === '"' ? m = !0 : s === "," ? (n.push(l), l = "") : l += s;
|
|
82
110
|
}
|
|
83
|
-
return n.push(l), n.map((
|
|
111
|
+
return n.push(l), n.map((i) => i.trim());
|
|
84
112
|
}
|
|
85
|
-
function
|
|
86
|
-
const n = o.split(/\r?\n/).filter((
|
|
113
|
+
function Ct(o) {
|
|
114
|
+
const n = o.split(/\r?\n/).filter((i) => i.trim());
|
|
87
115
|
if (n.length === 0) return { headers: [], rows: [], rowCount: 0 };
|
|
88
|
-
const l = ae(n[0]),
|
|
89
|
-
return { headers: l, rows:
|
|
116
|
+
const l = ae(n[0]), m = n.slice(1, 6).map(ae);
|
|
117
|
+
return { headers: l, rows: m, rowCount: Math.max(0, n.length - 1) };
|
|
90
118
|
}
|
|
91
119
|
function X({
|
|
92
120
|
value: o,
|
|
93
121
|
onChange: n,
|
|
94
122
|
options: l,
|
|
95
|
-
placeholder:
|
|
96
|
-
className:
|
|
123
|
+
placeholder: m = "Select…",
|
|
124
|
+
className: i
|
|
97
125
|
}) {
|
|
98
|
-
const [s, g] =
|
|
126
|
+
const [s, g] = x(!1), C = l.find((h) => h.value === o);
|
|
99
127
|
return /* @__PURE__ */ a(ut, { open: s, onOpenChange: g, children: [
|
|
100
128
|
/* @__PURE__ */ e(ht, { asChild: !0, children: /* @__PURE__ */ a(
|
|
101
129
|
"button",
|
|
102
130
|
{
|
|
103
131
|
type: "button",
|
|
104
|
-
className:
|
|
132
|
+
className: N(
|
|
105
133
|
"flex h-8 w-full items-center justify-between gap-2 rounded-md border border-slate-200 bg-white px-2.5 text-left text-[12px] transition-colors hover:border-slate-300 dark:border-border dark:bg-card",
|
|
106
|
-
|
|
134
|
+
i
|
|
107
135
|
),
|
|
108
136
|
children: [
|
|
109
137
|
/* @__PURE__ */ e(
|
|
110
138
|
"span",
|
|
111
139
|
{
|
|
112
|
-
className:
|
|
140
|
+
className: N(
|
|
113
141
|
"truncate font-mono",
|
|
114
142
|
C ? "text-slate-800 dark:text-foreground" : "text-slate-400"
|
|
115
143
|
),
|
|
116
|
-
children: (C == null ? void 0 : C.label) ??
|
|
144
|
+
children: (C == null ? void 0 : C.label) ?? m
|
|
117
145
|
}
|
|
118
146
|
),
|
|
119
147
|
/* @__PURE__ */ e(Xe, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
|
|
@@ -136,7 +164,7 @@ function X({
|
|
|
136
164
|
/* @__PURE__ */ e(
|
|
137
165
|
Ye,
|
|
138
166
|
{
|
|
139
|
-
className:
|
|
167
|
+
className: N(
|
|
140
168
|
"h-3.5 w-3.5",
|
|
141
169
|
h.value === o ? "text-nvr-cyan opacity-100" : "opacity-0"
|
|
142
170
|
)
|
|
@@ -151,12 +179,12 @@ function X({
|
|
|
151
179
|
] }) })
|
|
152
180
|
] });
|
|
153
181
|
}
|
|
154
|
-
function
|
|
182
|
+
function _t({ confidence: o }) {
|
|
155
183
|
const n = Math.round(o * 100), l = n >= 80 ? "text-emerald-700 dark:text-emerald-400" : n >= 50 ? "text-amber-700 dark:text-amber-400" : "text-slate-500";
|
|
156
184
|
return /* @__PURE__ */ a(
|
|
157
185
|
"span",
|
|
158
186
|
{
|
|
159
|
-
className:
|
|
187
|
+
className: N("shrink-0 text-[10.5px] font-medium tabular-nums", l),
|
|
160
188
|
title: "AI mapping confidence",
|
|
161
189
|
children: [
|
|
162
190
|
"AI ",
|
|
@@ -166,53 +194,53 @@ function yt({ confidence: o }) {
|
|
|
166
194
|
}
|
|
167
195
|
);
|
|
168
196
|
}
|
|
169
|
-
function
|
|
197
|
+
function Zt({
|
|
170
198
|
initialJobId: o,
|
|
171
199
|
onJobOpen: n
|
|
172
200
|
}) {
|
|
173
201
|
var K;
|
|
174
|
-
const l = re(),
|
|
202
|
+
const l = re(), m = Je(), [i, s] = x("list"), [g, C] = x(o ?? null), [h, T] = x("all"), [p, c] = x(1), [v, k] = x(null), u = U({
|
|
175
203
|
queryKey: ["collection-import-jobs"],
|
|
176
204
|
// The endpoint returns every job the caller may see, so the counters below
|
|
177
205
|
// are exact rather than page-scoped.
|
|
178
206
|
queryFn: () => l.request(W("/imports")),
|
|
179
207
|
refetchInterval: (r) => {
|
|
180
|
-
var
|
|
181
|
-
return (((
|
|
208
|
+
var w;
|
|
209
|
+
return (((w = r.state.data) == null ? void 0 : w.data) ?? []).some(($) => $.status === "pending" || $.status === "processing") ? 3e3 : !1;
|
|
182
210
|
},
|
|
183
211
|
placeholderData: (r) => r
|
|
184
|
-
}), P =
|
|
212
|
+
}), P = V(() => {
|
|
185
213
|
var r;
|
|
186
|
-
return ((r =
|
|
187
|
-
}, [(K =
|
|
214
|
+
return ((r = u.data) == null ? void 0 : r.data) ?? [];
|
|
215
|
+
}, [(K = u.data) == null ? void 0 : K.data]), S = V(() => {
|
|
188
216
|
const r = {};
|
|
189
|
-
for (const
|
|
217
|
+
for (const w of P) r[w.status] = (r[w.status] ?? 0) + 1;
|
|
190
218
|
return r;
|
|
191
|
-
}, [P]),
|
|
219
|
+
}, [P]), A = V(
|
|
192
220
|
() => P.reduce(
|
|
193
|
-
(r,
|
|
194
|
-
created: r.created + (
|
|
195
|
-
updated: r.updated + (
|
|
196
|
-
skipped: r.skipped + (
|
|
197
|
-
errors: r.errors + (
|
|
221
|
+
(r, w) => ({
|
|
222
|
+
created: r.created + (w.created_rows ?? 0),
|
|
223
|
+
updated: r.updated + (w.updated_rows ?? 0),
|
|
224
|
+
skipped: r.skipped + (w.skipped_rows ?? 0),
|
|
225
|
+
errors: r.errors + (w.error_rows ?? 0)
|
|
198
226
|
}),
|
|
199
227
|
{ created: 0, updated: 0, skipped: 0, errors: 0 }
|
|
200
228
|
),
|
|
201
229
|
[P]
|
|
202
|
-
), O = h === "all" ? P : P.filter((r) => r.status === h), H = O.slice((
|
|
203
|
-
|
|
230
|
+
), O = h === "all" ? P : P.filter((r) => r.status === h), H = O.slice((p - 1) * pe, p * pe);
|
|
231
|
+
Fe(() => c(1), [h]);
|
|
204
232
|
const E = Q({
|
|
205
233
|
mutationFn: (r) => l.request(tt(`/imports/${r}`)),
|
|
206
234
|
onSuccess: () => {
|
|
207
|
-
|
|
235
|
+
k(null), m.invalidateQueries({ queryKey: ["collection-import-jobs"] });
|
|
208
236
|
},
|
|
209
|
-
onError: (r) =>
|
|
237
|
+
onError: (r) => k(r.message)
|
|
210
238
|
}), G = Q({
|
|
211
239
|
mutationFn: (r) => l.request(I(`/imports/${r}/rollback`, {})),
|
|
212
240
|
onSuccess: () => {
|
|
213
|
-
|
|
241
|
+
k(null), m.invalidateQueries({ queryKey: ["collection-import-jobs"] });
|
|
214
242
|
},
|
|
215
|
-
onError: (r) =>
|
|
243
|
+
onError: (r) => k(r.message)
|
|
216
244
|
});
|
|
217
245
|
function M(r) {
|
|
218
246
|
C(r), n == null || n(r);
|
|
@@ -248,7 +276,7 @@ function Ht({
|
|
|
248
276
|
header: "Progress",
|
|
249
277
|
className: "w-[130px]",
|
|
250
278
|
render: (r) => /* @__PURE__ */ e(
|
|
251
|
-
|
|
279
|
+
yt,
|
|
252
280
|
{
|
|
253
281
|
processed: r.processed_rows,
|
|
254
282
|
total: r.total_rows,
|
|
@@ -301,7 +329,7 @@ function Ht({
|
|
|
301
329
|
key: "__actions__",
|
|
302
330
|
header: "",
|
|
303
331
|
className: "w-[44px]",
|
|
304
|
-
render: (r) => /* @__PURE__ */ e("div", { onClick: (
|
|
332
|
+
render: (r) => /* @__PURE__ */ e("div", { onClick: (w) => w.stopPropagation(), onKeyDown: (w) => w.stopPropagation(), children: /* @__PURE__ */ a(ct, { children: [
|
|
305
333
|
/* @__PURE__ */ e(mt, { asChild: !0, children: /* @__PURE__ */ e(
|
|
306
334
|
"button",
|
|
307
335
|
{
|
|
@@ -312,21 +340,17 @@ function Ht({
|
|
|
312
340
|
}
|
|
313
341
|
) }),
|
|
314
342
|
/* @__PURE__ */ a(pt, { align: "end", className: "text-[12.5px]", children: [
|
|
315
|
-
/* @__PURE__ */ e(
|
|
343
|
+
/* @__PURE__ */ e(he, { onSelect: () => M(r.id), children: "View details" }),
|
|
316
344
|
/* @__PURE__ */ e(
|
|
317
|
-
|
|
345
|
+
wt,
|
|
318
346
|
{
|
|
319
347
|
disabled: r.status !== "complete" || !!r.rolled_back_at,
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
"Roll back this import? Created rows are deleted (to trash) and overwritten rows restored to their prior values. One-shot."
|
|
323
|
-
) && G.mutate(r.id);
|
|
324
|
-
},
|
|
325
|
-
children: r.rolled_back_at ? "Rolled back" : "Roll back this import"
|
|
348
|
+
rolledBack: !!r.rolled_back_at,
|
|
349
|
+
onConfirm: () => G.mutate(r.id)
|
|
326
350
|
}
|
|
327
351
|
),
|
|
328
352
|
/* @__PURE__ */ a(
|
|
329
|
-
|
|
353
|
+
he,
|
|
330
354
|
{
|
|
331
355
|
disabled: r.status !== "complete" && r.status !== "failed",
|
|
332
356
|
onSelect: () => E.mutate(r.id),
|
|
@@ -340,19 +364,19 @@ function Ht({
|
|
|
340
364
|
] }) })
|
|
341
365
|
}
|
|
342
366
|
];
|
|
343
|
-
return
|
|
344
|
-
|
|
367
|
+
return i === "wizard" ? /* @__PURE__ */ e(
|
|
368
|
+
St,
|
|
345
369
|
{
|
|
346
370
|
onCancel: () => s("list"),
|
|
347
371
|
onCreated: (r) => {
|
|
348
|
-
s("list"),
|
|
372
|
+
s("list"), m.invalidateQueries({ queryKey: ["collection-import-jobs"] }), M(r);
|
|
349
373
|
}
|
|
350
374
|
}
|
|
351
375
|
) : /* @__PURE__ */ a("div", { className: "flex min-h-0 flex-1 flex-col gap-3", children: [
|
|
352
376
|
v && /* @__PURE__ */ e("p", { className: "rounded-md border border-red-200 bg-red-50 px-3 py-2 text-[12px] text-red-700 dark:border-red-900 dark:bg-red-950/40 dark:text-red-400", children: v }),
|
|
353
377
|
/* @__PURE__ */ a("div", { className: "flex flex-wrap items-stretch divide-x divide-slate-200 overflow-hidden rounded-lg border border-slate-200 bg-white dark:divide-border dark:border-border dark:bg-card", children: [
|
|
354
378
|
/* @__PURE__ */ e(
|
|
355
|
-
|
|
379
|
+
Ae,
|
|
356
380
|
{
|
|
357
381
|
label: "All",
|
|
358
382
|
count: P.length,
|
|
@@ -360,11 +384,11 @@ function Ht({
|
|
|
360
384
|
onClick: () => T("all")
|
|
361
385
|
}
|
|
362
386
|
),
|
|
363
|
-
Object.keys(
|
|
364
|
-
|
|
387
|
+
Object.keys(j).map((r) => /* @__PURE__ */ e(
|
|
388
|
+
Ae,
|
|
365
389
|
{
|
|
366
|
-
label:
|
|
367
|
-
dot:
|
|
390
|
+
label: j[r].label,
|
|
391
|
+
dot: j[r].dot,
|
|
368
392
|
count: S[r] ?? 0,
|
|
369
393
|
active: h === r,
|
|
370
394
|
onClick: () => T(h === r ? "all" : r)
|
|
@@ -372,24 +396,24 @@ function Ht({
|
|
|
372
396
|
r
|
|
373
397
|
)),
|
|
374
398
|
/* @__PURE__ */ a("div", { className: "ml-auto flex items-stretch divide-x divide-slate-200 dark:divide-border", children: [
|
|
375
|
-
/* @__PURE__ */ e(ee, { label: "Records created", value: _(
|
|
376
|
-
/* @__PURE__ */ e(ee, { label: "Records updated", value: _(
|
|
377
|
-
/* @__PURE__ */ e(ee, { label: "Skipped", value: _(
|
|
399
|
+
/* @__PURE__ */ e(ee, { label: "Records created", value: _(A.created) }),
|
|
400
|
+
/* @__PURE__ */ e(ee, { label: "Records updated", value: _(A.updated) }),
|
|
401
|
+
/* @__PURE__ */ e(ee, { label: "Skipped", value: _(A.skipped) }),
|
|
378
402
|
/* @__PURE__ */ e(
|
|
379
403
|
ee,
|
|
380
404
|
{
|
|
381
405
|
label: "Row errors",
|
|
382
|
-
value: _(
|
|
383
|
-
tone:
|
|
406
|
+
value: _(A.errors),
|
|
407
|
+
tone: A.errors > 0 ? "red" : void 0
|
|
384
408
|
}
|
|
385
409
|
)
|
|
386
410
|
] })
|
|
387
411
|
] }),
|
|
388
|
-
P.length === 0 && !
|
|
389
|
-
/* @__PURE__ */ e(
|
|
412
|
+
P.length === 0 && !u.isLoading ? /* @__PURE__ */ e("div", { className: "rounded-lg border border-dashed border-slate-300 bg-white px-6 py-12 dark:border-border dark:bg-card", children: /* @__PURE__ */ a("div", { className: "max-w-[58ch]", children: [
|
|
413
|
+
/* @__PURE__ */ e(Ve, { className: "h-5 w-5 text-slate-300" }),
|
|
390
414
|
/* @__PURE__ */ e("h3", { className: "mt-3 text-[15px] font-semibold text-slate-900 dark:text-foreground", children: "No collection imports yet" }),
|
|
391
415
|
/* @__PURE__ */ e("p", { className: "mt-1.5 text-[12.5px] leading-relaxed text-slate-500 dark:text-muted-foreground", children: "This is the row-by-row importer: a CSV's columns are mapped onto a collection's fields, and each row is created or updated through the normal item API — so validation, hooks and permissions all apply. Use it when you want records, not a staging table." }),
|
|
392
|
-
/* @__PURE__ */ a(
|
|
416
|
+
/* @__PURE__ */ a(F, { size: "sm", className: "mt-4", onClick: () => s("wizard"), children: [
|
|
393
417
|
/* @__PURE__ */ e(qe, { className: "h-3.5 w-3.5" }),
|
|
394
418
|
" Start an import"
|
|
395
419
|
] })
|
|
@@ -400,22 +424,22 @@ function Ht({
|
|
|
400
424
|
rows: H,
|
|
401
425
|
rowKey: (r) => r.id,
|
|
402
426
|
total: O.length,
|
|
403
|
-
page:
|
|
404
|
-
limit:
|
|
405
|
-
onPageChange:
|
|
406
|
-
isLoading:
|
|
427
|
+
page: p,
|
|
428
|
+
limit: pe,
|
|
429
|
+
onPageChange: c,
|
|
430
|
+
isLoading: u.isLoading,
|
|
407
431
|
onRowClick: (r) => M(r.id),
|
|
408
432
|
nowrapCells: !0,
|
|
409
433
|
minBodyHeight: 280,
|
|
410
434
|
emptyMessage: "No import jobs match this filter.",
|
|
411
435
|
rowClassName: (r) => r.status === "processing" ? "bg-nvr-cyan/5 dark:bg-nvr-cyan/10" : void 0,
|
|
412
|
-
toolbarRight: /* @__PURE__ */ a(
|
|
436
|
+
toolbarRight: /* @__PURE__ */ a(F, { size: "sm", className: "h-7", onClick: () => s("wizard"), children: [
|
|
413
437
|
/* @__PURE__ */ e(qe, { className: "h-3.5 w-3.5" }),
|
|
414
438
|
" New collection import"
|
|
415
439
|
] })
|
|
416
440
|
}
|
|
417
441
|
) }),
|
|
418
|
-
/* @__PURE__ */ e(
|
|
442
|
+
/* @__PURE__ */ e(qt, { jobId: g, onClose: () => M(null) })
|
|
419
443
|
] });
|
|
420
444
|
}
|
|
421
445
|
function Y({ n: o }) {
|
|
@@ -427,7 +451,7 @@ function ee({ label: o, value: n, tone: l }) {
|
|
|
427
451
|
/* @__PURE__ */ e(
|
|
428
452
|
"p",
|
|
429
453
|
{
|
|
430
|
-
className:
|
|
454
|
+
className: N(
|
|
431
455
|
"mt-0.5 text-[15px] font-semibold leading-none tabular-nums",
|
|
432
456
|
l === "red" ? "text-red-600 dark:text-red-400" : "text-slate-900 dark:text-foreground"
|
|
433
457
|
),
|
|
@@ -436,58 +460,58 @@ function ee({ label: o, value: n, tone: l }) {
|
|
|
436
460
|
)
|
|
437
461
|
] });
|
|
438
462
|
}
|
|
439
|
-
function
|
|
463
|
+
function Ae({
|
|
440
464
|
label: o,
|
|
441
465
|
count: n,
|
|
442
466
|
dot: l,
|
|
443
|
-
active:
|
|
444
|
-
onClick:
|
|
467
|
+
active: m,
|
|
468
|
+
onClick: i
|
|
445
469
|
}) {
|
|
446
470
|
return /* @__PURE__ */ a(
|
|
447
471
|
"button",
|
|
448
472
|
{
|
|
449
473
|
type: "button",
|
|
450
|
-
onClick:
|
|
451
|
-
"aria-pressed":
|
|
452
|
-
className:
|
|
474
|
+
onClick: i,
|
|
475
|
+
"aria-pressed": m,
|
|
476
|
+
className: N(
|
|
453
477
|
"flex items-center gap-1.5 px-3 py-2 transition-colors hover:bg-slate-50 dark:hover:bg-muted/40",
|
|
454
|
-
|
|
455
|
-
!
|
|
478
|
+
m && "bg-nvr-cyan/10 ring-1 ring-inset ring-nvr-cyan dark:bg-nvr-cyan/15",
|
|
479
|
+
!m && n === 0 && "opacity-45"
|
|
456
480
|
),
|
|
457
481
|
children: [
|
|
458
|
-
l && /* @__PURE__ */ e("span", { className:
|
|
482
|
+
l && /* @__PURE__ */ e("span", { className: N("h-1.5 w-1.5 shrink-0 rounded-full", l) }),
|
|
459
483
|
/* @__PURE__ */ e("span", { className: "text-[14px] font-semibold leading-none tabular-nums text-slate-900 dark:text-foreground", children: _(n) }),
|
|
460
484
|
/* @__PURE__ */ e("span", { className: "text-[11px] font-medium leading-none text-slate-400 dark:text-muted-foreground", children: o })
|
|
461
485
|
]
|
|
462
486
|
}
|
|
463
487
|
);
|
|
464
488
|
}
|
|
465
|
-
function
|
|
489
|
+
function St({
|
|
466
490
|
onCancel: o,
|
|
467
491
|
onCreated: n
|
|
468
492
|
}) {
|
|
469
|
-
var
|
|
470
|
-
const l = re(),
|
|
471
|
-
|
|
472
|
-
if (!
|
|
473
|
-
const t = `${
|
|
474
|
-
xe.current !== t && (xe.current = t, l.request(I("/imports/mappings/lookup", { collection:
|
|
493
|
+
var ke, we, ye, Ce;
|
|
494
|
+
const l = re(), m = De(null), [i, s] = x(0), [g, C] = x(""), [h, T] = x({}), [p, c] = x(""), [v, k] = x(""), [u, P] = x(""), [S, A] = x({}), [O, H] = x({}), [E, G] = x("skip"), [M, Z] = x(""), [K, r] = x(!1), [w, $] = x(null), [Ie, se] = x(!1), [Oe, Le] = x(null), xe = De(null), { headers: y, rows: be, rowCount: le } = V(() => Ct(g), [g]);
|
|
495
|
+
Fe(() => {
|
|
496
|
+
if (!u || y.length === 0) return;
|
|
497
|
+
const t = `${u}|${y.join("")}`;
|
|
498
|
+
xe.current !== t && (xe.current = t, l.request(I("/imports/mappings/lookup", { collection: u, headers: y })).then((d) => {
|
|
475
499
|
const f = d.data;
|
|
476
|
-
f &&
|
|
477
|
-
if (Object.values(q).some((
|
|
478
|
-
const
|
|
479
|
-
for (const
|
|
480
|
-
return Object.keys(
|
|
500
|
+
f && A((q) => {
|
|
501
|
+
if (Object.values(q).some((b) => b == null ? void 0 : b.trim())) return q;
|
|
502
|
+
const R = {};
|
|
503
|
+
for (const b of y) f.column_map[b] && (R[b] = f.column_map[b]);
|
|
504
|
+
return Object.keys(R).length === 0 ? q : (Le(
|
|
481
505
|
f.updated_at ? `Applied your saved mapping from ${new Date(f.updated_at).toLocaleDateString()}` : "Applied your saved mapping"
|
|
482
|
-
), f.id_field && Z((
|
|
506
|
+
), f.id_field && Z((b) => b || f.id_field || ""), f.duplicate_strategy && G((b) => b === "skip" && f.duplicate_strategy || b), R);
|
|
483
507
|
});
|
|
484
508
|
}).catch(() => {
|
|
485
509
|
}));
|
|
486
|
-
}, [
|
|
510
|
+
}, [u, y, l]);
|
|
487
511
|
const fe = U({
|
|
488
512
|
queryKey: [
|
|
489
513
|
"import-diff-preview",
|
|
490
|
-
|
|
514
|
+
u,
|
|
491
515
|
M,
|
|
492
516
|
E,
|
|
493
517
|
g.length,
|
|
@@ -495,28 +519,28 @@ function Ct({
|
|
|
495
519
|
],
|
|
496
520
|
queryFn: () => l.request(
|
|
497
521
|
I("/imports/preview", {
|
|
498
|
-
collection:
|
|
522
|
+
collection: u,
|
|
499
523
|
csv_data: g,
|
|
500
524
|
column_map: S,
|
|
501
525
|
id_field: M || null,
|
|
502
526
|
duplicate_strategy: E
|
|
503
527
|
})
|
|
504
528
|
),
|
|
505
|
-
enabled:
|
|
529
|
+
enabled: i === 3 && !!u && !!g,
|
|
506
530
|
staleTime: 3e4,
|
|
507
531
|
retry: !1
|
|
508
|
-
}), D = (
|
|
532
|
+
}), D = (ke = fe.data) == null ? void 0 : ke.data, ze = (((we = U({
|
|
509
533
|
queryKey: ["import-collections"],
|
|
510
534
|
queryFn: () => l.request(W("/collections")),
|
|
511
535
|
staleTime: 6e4
|
|
512
|
-
}).data) == null ? void 0 :
|
|
513
|
-
queryKey: ["import-collection-meta",
|
|
536
|
+
}).data) == null ? void 0 : we.data) ?? []).filter((t) => !t.collection.toLowerCase().startsWith("nivaro_")).map((t) => ({ value: t.collection, label: t.collection })), ne = (((Ce = (ye = U({
|
|
537
|
+
queryKey: ["import-collection-meta", u],
|
|
514
538
|
queryFn: () => l.request(
|
|
515
539
|
W(
|
|
516
|
-
`/collections/${
|
|
540
|
+
`/collections/${u}`
|
|
517
541
|
)
|
|
518
542
|
),
|
|
519
|
-
enabled: !!
|
|
543
|
+
enabled: !!u,
|
|
520
544
|
staleTime: 6e4
|
|
521
545
|
}).data) == null ? void 0 : ye.data) == null ? void 0 : Ce.fields) ?? []).filter((t) => !t.hidden).map((t) => t.field), oe = Q({
|
|
522
546
|
mutationFn: (t) => l.request(
|
|
@@ -526,85 +550,85 @@ function Ct({
|
|
|
526
550
|
})
|
|
527
551
|
),
|
|
528
552
|
onSuccess: (t) => {
|
|
529
|
-
|
|
553
|
+
$(null), C(t.data.csv_data), c(t.data.file_name);
|
|
530
554
|
},
|
|
531
|
-
onError: (t) =>
|
|
555
|
+
onError: (t) => $(t.message)
|
|
532
556
|
}), de = Q({
|
|
533
557
|
mutationFn: () => l.request(
|
|
534
558
|
I("/ai/map-columns", {
|
|
535
|
-
collection:
|
|
559
|
+
collection: u,
|
|
536
560
|
columns: y,
|
|
537
561
|
sample_rows: be.slice(0, 5)
|
|
538
562
|
})
|
|
539
563
|
),
|
|
540
564
|
onSuccess: (t) => {
|
|
541
|
-
var
|
|
542
|
-
const d = ((
|
|
543
|
-
for (const
|
|
544
|
-
y.includes(
|
|
545
|
-
|
|
565
|
+
var R;
|
|
566
|
+
const d = ((R = t.data) == null ? void 0 : R.mappings) ?? t.mappings ?? [], f = { ...S }, q = {};
|
|
567
|
+
for (const b of d)
|
|
568
|
+
y.includes(b.column) && (f[b.column] = b.field ?? "", b.field && (q[b.column] = b.confidence ?? 0));
|
|
569
|
+
A(f), H(q), $(null);
|
|
546
570
|
},
|
|
547
|
-
onError: (t) =>
|
|
571
|
+
onError: (t) => $(
|
|
548
572
|
t.status === 503 ? "AI mapping needs an Anthropic API key — add one in Settings, or map the columns by hand." : t.message
|
|
549
573
|
)
|
|
550
574
|
}), ie = Q({
|
|
551
575
|
mutationFn: () => l.request(
|
|
552
576
|
I("/imports", {
|
|
553
|
-
collection:
|
|
577
|
+
collection: u,
|
|
554
578
|
csv_data: g,
|
|
555
579
|
column_map: S,
|
|
556
580
|
transforms: Object.fromEntries(Object.entries(h).filter(([, t]) => t)),
|
|
557
581
|
duplicate_strategy: E,
|
|
558
582
|
id_field: M || void 0,
|
|
559
|
-
file_name:
|
|
583
|
+
file_name: p || "import.csv",
|
|
560
584
|
through_items: K
|
|
561
585
|
})
|
|
562
586
|
),
|
|
563
587
|
onSuccess: (t) => n(t.data.id),
|
|
564
|
-
onError: (t) =>
|
|
588
|
+
onError: (t) => $(t.message)
|
|
565
589
|
});
|
|
566
590
|
function ge(t, d) {
|
|
567
|
-
|
|
591
|
+
A((f) => ({ ...f, [t]: d })), O[t] !== void 0 && H((f) => {
|
|
568
592
|
const q = { ...f };
|
|
569
593
|
return delete q[t], q;
|
|
570
594
|
});
|
|
571
595
|
}
|
|
572
596
|
async function ve(t) {
|
|
573
|
-
t && (
|
|
597
|
+
t && ($(null), C(await t.text()), c(t.name));
|
|
574
598
|
}
|
|
575
|
-
const L =
|
|
576
|
-
const t = g.split(/\r?\n/).filter((
|
|
599
|
+
const L = V(() => {
|
|
600
|
+
const t = g.split(/\r?\n/).filter((R) => R.trim());
|
|
577
601
|
if (t.length < 2) return {};
|
|
578
602
|
const d = ae(t[0]), f = t.slice(1, 2001).map(ae), q = {};
|
|
579
|
-
return d.forEach((
|
|
603
|
+
return d.forEach((R, b) => {
|
|
580
604
|
let z = 0, _e = 0, Se = 0, Pe = 0;
|
|
581
605
|
for (const Ke of f) {
|
|
582
|
-
const B = (Ke[
|
|
606
|
+
const B = (Ke[b] ?? "").trim();
|
|
583
607
|
B && (z++, /^-?\$?[\d,]+(\.\d+)?$/.test(B) ? _e++ : /^\d{4}-\d{2}-\d{2}/.test(B) || /^\d{1,2}\/\d{1,2}\/\d{2,4}$/.test(B) ? Se++ : /^(true|false|yes|no|y|n)$/i.test(B) && Pe++);
|
|
584
608
|
}
|
|
585
609
|
const Qe = z === 0 ? "empty" : _e / z > 0.9 ? "number" : Se / z > 0.9 ? "date" : Pe / z > 0.9 ? "boolean" : "text";
|
|
586
|
-
q[
|
|
610
|
+
q[R] = { fill: Math.round(z / f.length * 100), guess: Qe };
|
|
587
611
|
}), q;
|
|
588
612
|
}, [g]), ce = y.filter((t) => {
|
|
589
613
|
var d;
|
|
590
614
|
return (d = S[t]) == null ? void 0 : d.trim();
|
|
591
|
-
}).length,
|
|
615
|
+
}).length, Ne = Oe, Ue = i === 0 ? y.length > 0 : i === 1 ? !!u && ce > 0 : !0;
|
|
592
616
|
return /* @__PURE__ */ a("div", { className: "flex min-h-0 flex-1 flex-col gap-4", children: [
|
|
593
617
|
/* @__PURE__ */ a("div", { className: "flex items-center gap-3", children: [
|
|
594
|
-
/* @__PURE__ */ a(
|
|
618
|
+
/* @__PURE__ */ a(F, { variant: "ghost", size: "sm", className: "h-7 px-2", onClick: o, children: [
|
|
595
619
|
/* @__PURE__ */ e(Me, { className: "h-3.5 w-3.5" }),
|
|
596
620
|
" Back to jobs"
|
|
597
621
|
] }),
|
|
598
|
-
/* @__PURE__ */ e("ol", { className: "flex items-center gap-1.5", children:
|
|
622
|
+
/* @__PURE__ */ e("ol", { className: "flex items-center gap-1.5", children: ue.map((t, d) => /* @__PURE__ */ a("li", { className: "flex items-center gap-1.5", children: [
|
|
599
623
|
/* @__PURE__ */ a(
|
|
600
624
|
"button",
|
|
601
625
|
{
|
|
602
626
|
type: "button",
|
|
603
|
-
onClick: () => d <
|
|
604
|
-
disabled: d >
|
|
605
|
-
className:
|
|
627
|
+
onClick: () => d < i && s(d),
|
|
628
|
+
disabled: d > i,
|
|
629
|
+
className: N(
|
|
606
630
|
"flex items-center gap-1.5 rounded-md px-2 py-1 text-[12px] font-medium transition-colors",
|
|
607
|
-
d ===
|
|
631
|
+
d === i ? "bg-nvr-cyan/15 text-nvr-navy dark:bg-nvr-cyan/20 dark:text-nvr-cyan" : d < i ? "text-slate-600 hover:bg-slate-100 dark:text-muted-foreground dark:hover:bg-muted" : "text-slate-300 dark:text-slate-600"
|
|
608
632
|
),
|
|
609
633
|
children: [
|
|
610
634
|
/* @__PURE__ */ e("span", { className: "tabular-nums", children: d + 1 }),
|
|
@@ -612,15 +636,15 @@ function Ct({
|
|
|
612
636
|
]
|
|
613
637
|
}
|
|
614
638
|
),
|
|
615
|
-
d <
|
|
639
|
+
d < ue.length - 1 && /* @__PURE__ */ e("span", { className: "text-slate-300", children: "›" })
|
|
616
640
|
] }, t)) })
|
|
617
641
|
] }),
|
|
618
642
|
/* @__PURE__ */ a("div", { className: "min-h-0 flex-1 overflow-y-auto rounded-lg border border-slate-200 bg-white p-5 dark:border-border dark:bg-card", children: [
|
|
619
|
-
|
|
643
|
+
i === 0 && /* @__PURE__ */ a("div", { className: "max-w-[980px] space-y-5", children: [
|
|
620
644
|
/* @__PURE__ */ e(
|
|
621
645
|
"input",
|
|
622
646
|
{
|
|
623
|
-
ref:
|
|
647
|
+
ref: m,
|
|
624
648
|
type: "file",
|
|
625
649
|
accept: ".csv,text/csv",
|
|
626
650
|
className: "hidden",
|
|
@@ -637,7 +661,7 @@ function Ct({
|
|
|
637
661
|
type: "button",
|
|
638
662
|
onClick: () => {
|
|
639
663
|
var t;
|
|
640
|
-
return (t =
|
|
664
|
+
return (t = m.current) == null ? void 0 : t.click();
|
|
641
665
|
},
|
|
642
666
|
onDragOver: (t) => {
|
|
643
667
|
t.preventDefault(), se(!0);
|
|
@@ -647,19 +671,19 @@ function Ct({
|
|
|
647
671
|
var d;
|
|
648
672
|
t.preventDefault(), se(!1), ve(((d = t.dataTransfer.files) == null ? void 0 : d[0]) ?? null);
|
|
649
673
|
},
|
|
650
|
-
className:
|
|
674
|
+
className: N(
|
|
651
675
|
"flex flex-col items-center justify-center gap-1.5 rounded-md border border-dashed px-4 py-8 transition-colors",
|
|
652
676
|
Ie ? "border-nvr-cyan bg-nvr-cyan/10" : "border-slate-300 hover:border-slate-400 hover:bg-slate-50 dark:border-border dark:hover:bg-muted/30"
|
|
653
677
|
),
|
|
654
678
|
children: [
|
|
655
|
-
/* @__PURE__ */ e(
|
|
679
|
+
/* @__PURE__ */ e(je, { className: "h-4 w-4 text-slate-400" }),
|
|
656
680
|
/* @__PURE__ */ e("span", { className: "text-[12.5px] font-medium text-slate-700 dark:text-foreground", children: "Drop a CSV, or click to choose" }),
|
|
657
|
-
|
|
681
|
+
p && /* @__PURE__ */ e("span", { className: "font-mono text-[11px] text-slate-500", children: p })
|
|
658
682
|
]
|
|
659
683
|
}
|
|
660
684
|
),
|
|
661
685
|
/* @__PURE__ */ a("div", { className: "space-y-1.5", children: [
|
|
662
|
-
/* @__PURE__ */ a(
|
|
686
|
+
/* @__PURE__ */ a(J, { className: "flex items-center gap-1.5 text-[11.5px]", children: [
|
|
663
687
|
/* @__PURE__ */ e(We, { className: "h-3.5 w-3.5 text-slate-400" }),
|
|
664
688
|
" Or fetch from a URL"
|
|
665
689
|
] }),
|
|
@@ -672,16 +696,16 @@ function Ct({
|
|
|
672
696
|
},
|
|
673
697
|
children: [
|
|
674
698
|
/* @__PURE__ */ e(
|
|
675
|
-
|
|
699
|
+
Re,
|
|
676
700
|
{
|
|
677
701
|
value: v,
|
|
678
|
-
onChange: (t) =>
|
|
702
|
+
onChange: (t) => k(t.target.value),
|
|
679
703
|
placeholder: "https://example.com/data.csv",
|
|
680
704
|
className: "h-8 font-mono text-[12px]"
|
|
681
705
|
}
|
|
682
706
|
),
|
|
683
707
|
/* @__PURE__ */ e(
|
|
684
|
-
|
|
708
|
+
F,
|
|
685
709
|
{
|
|
686
710
|
type: "submit",
|
|
687
711
|
variant: "outline",
|
|
@@ -698,13 +722,13 @@ function Ct({
|
|
|
698
722
|
] })
|
|
699
723
|
] }),
|
|
700
724
|
/* @__PURE__ */ a("div", { className: "space-y-1.5", children: [
|
|
701
|
-
/* @__PURE__ */ e(
|
|
725
|
+
/* @__PURE__ */ e(J, { className: "text-[11.5px]", children: "Or paste the rows" }),
|
|
702
726
|
/* @__PURE__ */ e(
|
|
703
|
-
|
|
727
|
+
Nt,
|
|
704
728
|
{
|
|
705
729
|
value: g,
|
|
706
730
|
onChange: (t) => {
|
|
707
|
-
C(t.target.value),
|
|
731
|
+
C(t.target.value), p || c("pasted.csv");
|
|
708
732
|
},
|
|
709
733
|
rows: 5,
|
|
710
734
|
spellCheck: !1,
|
|
@@ -724,20 +748,20 @@ val1,val2,val3`,
|
|
|
724
748
|
" ",
|
|
725
749
|
"columns"
|
|
726
750
|
] }),
|
|
727
|
-
/* @__PURE__ */ e(
|
|
751
|
+
/* @__PURE__ */ e(Pt, { headers: y, rows: be })
|
|
728
752
|
] })
|
|
729
753
|
] }),
|
|
730
|
-
|
|
754
|
+
i === 1 && // Bounded width: a mapping row is a form field, and stretching the
|
|
731
755
|
// pickers to a 1600px viewport puts the CSV column and the field it
|
|
732
756
|
// maps to half a screen apart.
|
|
733
757
|
/* @__PURE__ */ a("div", { className: "max-w-[860px] space-y-4", children: [
|
|
734
758
|
/* @__PURE__ */ a("div", { className: "flex flex-wrap items-end justify-between gap-3", children: [
|
|
735
759
|
/* @__PURE__ */ a("div", { className: "space-y-1.5", children: [
|
|
736
|
-
/* @__PURE__ */ e(
|
|
760
|
+
/* @__PURE__ */ e(J, { className: "text-[11.5px]", children: "Target collection" }),
|
|
737
761
|
/* @__PURE__ */ e("div", { className: "w-[260px]", children: /* @__PURE__ */ e(
|
|
738
762
|
X,
|
|
739
763
|
{
|
|
740
|
-
value:
|
|
764
|
+
value: u,
|
|
741
765
|
onChange: P,
|
|
742
766
|
options: ze,
|
|
743
767
|
placeholder: "Choose a collection…"
|
|
@@ -746,12 +770,12 @@ val1,val2,val3`,
|
|
|
746
770
|
/* @__PURE__ */ e("p", { className: "text-[11px] text-slate-400", children: "Rows are written through the item API, so this collection's validation, hooks and permissions all apply." })
|
|
747
771
|
] }),
|
|
748
772
|
/* @__PURE__ */ a(
|
|
749
|
-
|
|
773
|
+
F,
|
|
750
774
|
{
|
|
751
775
|
variant: "outline",
|
|
752
776
|
size: "sm",
|
|
753
777
|
className: "h-8",
|
|
754
|
-
disabled: !
|
|
778
|
+
disabled: !u || y.length === 0 || de.isPending,
|
|
755
779
|
onClick: () => de.mutate(),
|
|
756
780
|
children: [
|
|
757
781
|
de.isPending ? /* @__PURE__ */ e(me, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(He, { className: "h-3.5 w-3.5 text-nvr-cyan" }),
|
|
@@ -775,7 +799,7 @@ val1,val2,val3`,
|
|
|
775
799
|
L[t] && /* @__PURE__ */ a(
|
|
776
800
|
"span",
|
|
777
801
|
{
|
|
778
|
-
className:
|
|
802
|
+
className: N(
|
|
779
803
|
"ml-2 rounded px-1 py-0.5 font-sans text-[9.5px] font-medium",
|
|
780
804
|
L[t].fill < 50 ? "bg-amber-100 text-amber-700 dark:bg-amber-400/15 dark:text-amber-400" : "bg-slate-100 text-slate-500 dark:bg-muted dark:text-slate-400"
|
|
781
805
|
),
|
|
@@ -802,7 +826,7 @@ val1,val2,val3`,
|
|
|
802
826
|
placeholder: "— skip this column —"
|
|
803
827
|
}
|
|
804
828
|
) : /* @__PURE__ */ e(
|
|
805
|
-
|
|
829
|
+
Re,
|
|
806
830
|
{
|
|
807
831
|
value: S[t] ?? "",
|
|
808
832
|
onChange: (d) => ge(t, d.target.value),
|
|
@@ -810,7 +834,7 @@ val1,val2,val3`,
|
|
|
810
834
|
className: "h-8 font-mono text-[12px]"
|
|
811
835
|
}
|
|
812
836
|
) }),
|
|
813
|
-
O[t] !== void 0 && S[t] && /* @__PURE__ */ e(
|
|
837
|
+
O[t] !== void 0 && S[t] && /* @__PURE__ */ e(_t, { confidence: O[t] }),
|
|
814
838
|
S[t] && /* @__PURE__ */ e("div", { className: "w-[120px]", children: /* @__PURE__ */ e(
|
|
815
839
|
X,
|
|
816
840
|
{
|
|
@@ -838,12 +862,12 @@ val1,val2,val3`,
|
|
|
838
862
|
" of ",
|
|
839
863
|
y.length,
|
|
840
864
|
" columns mapped — unmapped columns are ignored.",
|
|
841
|
-
|
|
865
|
+
Ne && /* @__PURE__ */ e("span", { className: "ml-1.5 rounded bg-sky-500/10 px-1.5 py-0.5 text-[10.5px] font-medium text-sky-700 dark:text-sky-400", children: Ne })
|
|
842
866
|
] })
|
|
843
867
|
] }),
|
|
844
|
-
|
|
868
|
+
i === 2 && /* @__PURE__ */ a("div", { className: "max-w-[520px] space-y-4", children: [
|
|
845
869
|
/* @__PURE__ */ a("div", { className: "space-y-1.5", children: [
|
|
846
|
-
/* @__PURE__ */ e(
|
|
870
|
+
/* @__PURE__ */ e(J, { className: "text-[11.5px]", children: "When a record already exists" }),
|
|
847
871
|
/* @__PURE__ */ e(
|
|
848
872
|
bt,
|
|
849
873
|
{
|
|
@@ -875,7 +899,7 @@ val1,val2,val3`,
|
|
|
875
899
|
] })
|
|
876
900
|
] }),
|
|
877
901
|
/* @__PURE__ */ a("div", { className: "space-y-1.5", children: [
|
|
878
|
-
/* @__PURE__ */ e(
|
|
902
|
+
/* @__PURE__ */ e(J, { className: "text-[11.5px]", children: "Match records on" }),
|
|
879
903
|
/* @__PURE__ */ e(
|
|
880
904
|
X,
|
|
881
905
|
{
|
|
@@ -892,7 +916,7 @@ val1,val2,val3`,
|
|
|
892
916
|
/* @__PURE__ */ e("p", { className: "text-[11px] leading-snug text-slate-400", children: "The field used to decide whether a row is a duplicate. Leave it empty and every row becomes a new record." })
|
|
893
917
|
] })
|
|
894
918
|
] }),
|
|
895
|
-
|
|
919
|
+
i === 3 && /* @__PURE__ */ a("div", { className: "max-w-[620px] space-y-4", children: [
|
|
896
920
|
fe.isLoading && /* @__PURE__ */ e("p", { className: "text-[12px] text-slate-400", children: "Comparing against the live data…" }),
|
|
897
921
|
D && /* @__PURE__ */ a("div", { className: "space-y-2", children: [
|
|
898
922
|
/* @__PURE__ */ a("div", { className: "flex flex-wrap gap-2", children: [
|
|
@@ -920,7 +944,7 @@ val1,val2,val3`,
|
|
|
920
944
|
].map((t) => /* @__PURE__ */ a(
|
|
921
945
|
"span",
|
|
922
946
|
{
|
|
923
|
-
className:
|
|
947
|
+
className: N(
|
|
924
948
|
"inline-flex items-center gap-1.5 rounded-full border bg-white px-2.5 py-1 text-[12px] font-medium dark:bg-card",
|
|
925
949
|
t.cls
|
|
926
950
|
),
|
|
@@ -947,7 +971,7 @@ val1,val2,val3`,
|
|
|
947
971
|
/* @__PURE__ */ e(
|
|
948
972
|
"span",
|
|
949
973
|
{
|
|
950
|
-
className:
|
|
974
|
+
className: N(
|
|
951
975
|
"rounded px-1.5 py-0.5 text-[10.5px] font-semibold uppercase tracking-wide",
|
|
952
976
|
t.kind === "conflict" ? "bg-red-500/10 text-red-600 dark:text-red-400" : "bg-amber-400/10 text-amber-600 dark:text-amber-400"
|
|
953
977
|
),
|
|
@@ -978,8 +1002,8 @@ val1,val2,val3`,
|
|
|
978
1002
|
D.conflicts > 0 && /* @__PURE__ */ e("p", { className: "text-[11.5px] text-red-600 dark:text-red-400", children: "Conflicts need a look before you start — they are rows the import will silently drop or resolve by last-write-wins." })
|
|
979
1003
|
] }),
|
|
980
1004
|
/* @__PURE__ */ e("div", { className: "overflow-hidden rounded-md border border-slate-200 dark:border-border", children: [
|
|
981
|
-
{ label: "File", value:
|
|
982
|
-
{ label: "Collection", value:
|
|
1005
|
+
{ label: "File", value: p || "pasted.csv", mono: !0 },
|
|
1006
|
+
{ label: "Collection", value: u, mono: !0 },
|
|
983
1007
|
{ label: "Data rows", value: _(le) },
|
|
984
1008
|
{ label: "Mapped columns", value: `${ce} of ${y.length}` },
|
|
985
1009
|
{
|
|
@@ -1000,7 +1024,7 @@ val1,val2,val3`,
|
|
|
1000
1024
|
/* @__PURE__ */ e(
|
|
1001
1025
|
"span",
|
|
1002
1026
|
{
|
|
1003
|
-
className:
|
|
1027
|
+
className: N(
|
|
1004
1028
|
"truncate text-[12.5px] text-slate-800 dark:text-foreground",
|
|
1005
1029
|
t.mono && "font-mono text-[12px]"
|
|
1006
1030
|
),
|
|
@@ -1016,24 +1040,24 @@ val1,val2,val3`,
|
|
|
1016
1040
|
_(le),
|
|
1017
1041
|
" rows into",
|
|
1018
1042
|
" ",
|
|
1019
|
-
/* @__PURE__ */ e("span", { className: "font-mono text-slate-700 dark:text-foreground", children:
|
|
1043
|
+
/* @__PURE__ */ e("span", { className: "font-mono text-slate-700 dark:text-foreground", children: u }),
|
|
1020
1044
|
" ",
|
|
1021
1045
|
"one at a time. Progress appears in the job list as it runs."
|
|
1022
1046
|
] })
|
|
1023
1047
|
] })
|
|
1024
1048
|
] }),
|
|
1025
1049
|
/* @__PURE__ */ a("div", { className: "flex shrink-0 items-center gap-2", children: [
|
|
1026
|
-
|
|
1050
|
+
i > 0 && /* @__PURE__ */ a(F, { variant: "ghost", size: "sm", onClick: () => s((t) => t - 1), children: [
|
|
1027
1051
|
/* @__PURE__ */ e(Me, { className: "h-3.5 w-3.5" }),
|
|
1028
1052
|
" Back"
|
|
1029
1053
|
] }),
|
|
1030
|
-
|
|
1054
|
+
w && /* @__PURE__ */ e("p", { className: "text-[12px] text-red-600 dark:text-red-400", children: w }),
|
|
1031
1055
|
/* @__PURE__ */ a("div", { className: "ml-auto flex items-center gap-2", children: [
|
|
1032
|
-
/* @__PURE__ */ e(
|
|
1033
|
-
|
|
1056
|
+
/* @__PURE__ */ e(F, { variant: "ghost", size: "sm", onClick: o, children: "Cancel" }),
|
|
1057
|
+
i < ue.length - 1 ? /* @__PURE__ */ a(F, { size: "sm", disabled: !Ue, onClick: () => s((t) => t + 1), children: [
|
|
1034
1058
|
"Next ",
|
|
1035
|
-
/* @__PURE__ */ e(
|
|
1036
|
-
] }) : /* @__PURE__ */ e(
|
|
1059
|
+
/* @__PURE__ */ e($e, { className: "h-3.5 w-3.5" })
|
|
1060
|
+
] }) : /* @__PURE__ */ e(F, { size: "sm", disabled: ie.isPending, onClick: () => ie.mutate(), children: ie.isPending ? /* @__PURE__ */ a(Be, { children: [
|
|
1037
1061
|
/* @__PURE__ */ e(me, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
1038
1062
|
" Starting…"
|
|
1039
1063
|
] }) : "Start import" })
|
|
@@ -1041,7 +1065,7 @@ val1,val2,val3`,
|
|
|
1041
1065
|
] })
|
|
1042
1066
|
] });
|
|
1043
1067
|
}
|
|
1044
|
-
function
|
|
1068
|
+
function Pt({ headers: o, rows: n }) {
|
|
1045
1069
|
return /* @__PURE__ */ e("div", { className: "overflow-x-auto rounded-md border border-slate-200 dark:border-border", children: /* @__PURE__ */ a("table", { className: "w-full border-collapse", children: [
|
|
1046
1070
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { className: "bg-slate-50 dark:bg-muted/40", children: o.map((l) => /* @__PURE__ */ e(
|
|
1047
1071
|
"th",
|
|
@@ -1051,9 +1075,9 @@ function _t({ headers: o, rows: n }) {
|
|
|
1051
1075
|
},
|
|
1052
1076
|
l
|
|
1053
1077
|
)) }) }),
|
|
1054
|
-
/* @__PURE__ */ e("tbody", { children: n.map((l,
|
|
1078
|
+
/* @__PURE__ */ e("tbody", { children: n.map((l, m) => (
|
|
1055
1079
|
// eslint-disable-next-line react/no-array-index-key
|
|
1056
|
-
/* @__PURE__ */ e("tr", { className: "border-b border-slate-100 last:border-b-0 dark:border-border/60", children: o.map((
|
|
1080
|
+
/* @__PURE__ */ e("tr", { className: "border-b border-slate-100 last:border-b-0 dark:border-border/60", children: o.map((i, s) => /* @__PURE__ */ e(
|
|
1057
1081
|
"td",
|
|
1058
1082
|
{
|
|
1059
1083
|
className: "max-w-[200px] truncate whitespace-nowrap px-2.5 py-1 font-mono text-[11px] text-slate-700 dark:text-foreground",
|
|
@@ -1061,22 +1085,22 @@ function _t({ headers: o, rows: n }) {
|
|
|
1061
1085
|
children: l[s] || /* @__PURE__ */ e("span", { className: "text-slate-300", children: "—" })
|
|
1062
1086
|
},
|
|
1063
1087
|
s
|
|
1064
|
-
)) },
|
|
1088
|
+
)) }, m)
|
|
1065
1089
|
)) })
|
|
1066
1090
|
] }) });
|
|
1067
1091
|
}
|
|
1068
|
-
function
|
|
1092
|
+
function qt({ jobId: o, onClose: n }) {
|
|
1069
1093
|
var h, T;
|
|
1070
|
-
const l = et(),
|
|
1094
|
+
const l = et(), m = re(), s = (h = U({
|
|
1071
1095
|
queryKey: ["collection-import-job", o],
|
|
1072
|
-
queryFn: () =>
|
|
1096
|
+
queryFn: () => m.request(W(`/imports/${o}`)),
|
|
1073
1097
|
enabled: !!o,
|
|
1074
|
-
refetchInterval: (
|
|
1075
|
-
var
|
|
1076
|
-
return ((v = (
|
|
1098
|
+
refetchInterval: (p) => {
|
|
1099
|
+
var c, v, k, u;
|
|
1100
|
+
return ((v = (c = p.state.data) == null ? void 0 : c.data) == null ? void 0 : v.status) === "processing" || ((u = (k = p.state.data) == null ? void 0 : k.data) == null ? void 0 : u.status) === "pending" ? 2e3 : !1;
|
|
1077
1101
|
}
|
|
1078
1102
|
}).data) == null ? void 0 : h.data, g = Array.isArray(s == null ? void 0 : s.errors) ? s.errors : [], C = s != null && s.total_rows ? Math.min(100, Math.round((s.processed_rows ?? 0) / s.total_rows * 100)) : (s == null ? void 0 : s.status) === "complete" ? 100 : 0;
|
|
1079
|
-
return /* @__PURE__ */ e(ft, { open: !!o, onOpenChange: (
|
|
1103
|
+
return /* @__PURE__ */ e(ft, { open: !!o, onOpenChange: (p) => !p && n(), children: /* @__PURE__ */ e(gt, { side: "right", className: "w-[min(560px,94vw)] p-0 sm:max-w-none", children: s ? /* @__PURE__ */ a("div", { className: "flex h-full flex-col", children: [
|
|
1080
1104
|
/* @__PURE__ */ a("header", { className: "shrink-0 border-b border-slate-200 px-5 py-4 dark:border-border", children: [
|
|
1081
1105
|
/* @__PURE__ */ e(Ee, { status: s.status }),
|
|
1082
1106
|
/* @__PURE__ */ e("h2", { className: "mt-1.5 truncate font-mono text-[15px] font-semibold text-slate-900 dark:text-foreground", children: s.file_name }),
|
|
@@ -1100,7 +1124,7 @@ function St({ jobId: o, onClose: n }) {
|
|
|
1100
1124
|
/* @__PURE__ */ e("div", { className: "h-2 overflow-hidden rounded-full bg-slate-100 dark:bg-muted", children: /* @__PURE__ */ e(
|
|
1101
1125
|
"div",
|
|
1102
1126
|
{
|
|
1103
|
-
className:
|
|
1127
|
+
className: N(
|
|
1104
1128
|
"h-full rounded-full transition-[width] duration-500",
|
|
1105
1129
|
s.status === "failed" ? "bg-red-500" : "bg-nvr-cyan"
|
|
1106
1130
|
),
|
|
@@ -1120,19 +1144,19 @@ function St({ jobId: o, onClose: n }) {
|
|
|
1120
1144
|
{ label: "Updated", value: s.updated_rows ?? 0 },
|
|
1121
1145
|
{ label: "Skipped", value: s.skipped_rows ?? 0 },
|
|
1122
1146
|
{ label: "Errors", value: s.error_rows ?? 0, bad: (s.error_rows ?? 0) > 0 }
|
|
1123
|
-
].map((
|
|
1124
|
-
/* @__PURE__ */ e("p", { className: "text-[10.5px] text-slate-400", children:
|
|
1147
|
+
].map((p) => /* @__PURE__ */ a("div", { className: "bg-white px-3 py-2 dark:bg-card", children: [
|
|
1148
|
+
/* @__PURE__ */ e("p", { className: "text-[10.5px] text-slate-400", children: p.label }),
|
|
1125
1149
|
/* @__PURE__ */ e(
|
|
1126
1150
|
"p",
|
|
1127
1151
|
{
|
|
1128
|
-
className:
|
|
1152
|
+
className: N(
|
|
1129
1153
|
"text-[15px] font-semibold tabular-nums",
|
|
1130
|
-
|
|
1154
|
+
p.bad ? "text-red-600 dark:text-red-400" : "text-slate-900 dark:text-foreground"
|
|
1131
1155
|
),
|
|
1132
|
-
children: _(
|
|
1156
|
+
children: _(p.value)
|
|
1133
1157
|
}
|
|
1134
1158
|
)
|
|
1135
|
-
] },
|
|
1159
|
+
] }, p.label)) }),
|
|
1136
1160
|
/* @__PURE__ */ a("section", { children: [
|
|
1137
1161
|
/* @__PURE__ */ e("h3", { className: "mb-1 text-[11.5px] font-semibold text-slate-500 dark:text-muted-foreground", children: "Settings" }),
|
|
1138
1162
|
[
|
|
@@ -1150,31 +1174,31 @@ function St({ jobId: o, onClose: n }) {
|
|
|
1150
1174
|
label: "Completed",
|
|
1151
1175
|
value: s.completed_at ? te(s.completed_at) : "—"
|
|
1152
1176
|
}
|
|
1153
|
-
].map((
|
|
1177
|
+
].map((p) => /* @__PURE__ */ a(
|
|
1154
1178
|
"div",
|
|
1155
1179
|
{
|
|
1156
1180
|
className: "flex items-baseline justify-between gap-4 border-b border-slate-100 py-1.5 last:border-b-0 dark:border-border/60",
|
|
1157
1181
|
children: [
|
|
1158
|
-
/* @__PURE__ */ e("span", { className: "text-[11.5px] text-slate-400", children:
|
|
1159
|
-
/* @__PURE__ */ e("span", { className: "truncate text-[12px] text-slate-800 dark:text-foreground", children:
|
|
1182
|
+
/* @__PURE__ */ e("span", { className: "text-[11.5px] text-slate-400", children: p.label }),
|
|
1183
|
+
/* @__PURE__ */ e("span", { className: "truncate text-[12px] text-slate-800 dark:text-foreground", children: p.value })
|
|
1160
1184
|
]
|
|
1161
1185
|
},
|
|
1162
|
-
|
|
1186
|
+
p.label
|
|
1163
1187
|
))
|
|
1164
1188
|
] }),
|
|
1165
1189
|
s.column_map && Object.keys(s.column_map).length > 0 && /* @__PURE__ */ a("section", { children: [
|
|
1166
1190
|
/* @__PURE__ */ e("h3", { className: "mb-1.5 text-[11.5px] font-semibold text-slate-500 dark:text-muted-foreground", children: "Column mapping" }),
|
|
1167
|
-
/* @__PURE__ */ e("div", { className: "overflow-hidden rounded-md border border-slate-200 dark:border-border", children: Object.entries(s.column_map).map(([
|
|
1191
|
+
/* @__PURE__ */ e("div", { className: "overflow-hidden rounded-md border border-slate-200 dark:border-border", children: Object.entries(s.column_map).map(([p, c]) => /* @__PURE__ */ a(
|
|
1168
1192
|
"div",
|
|
1169
1193
|
{
|
|
1170
1194
|
className: "flex items-center gap-2 border-b border-slate-100 px-3 py-1.5 font-mono text-[11.5px] last:border-b-0 dark:border-border/60",
|
|
1171
1195
|
children: [
|
|
1172
|
-
/* @__PURE__ */ e("span", { className: "flex-1 truncate text-slate-500 dark:text-muted-foreground", children:
|
|
1173
|
-
/* @__PURE__ */ e(
|
|
1174
|
-
/* @__PURE__ */ e("span", { className: "flex-1 truncate text-slate-800 dark:text-foreground", children:
|
|
1196
|
+
/* @__PURE__ */ e("span", { className: "flex-1 truncate text-slate-500 dark:text-muted-foreground", children: p }),
|
|
1197
|
+
/* @__PURE__ */ e($e, { className: "h-3 w-3 shrink-0 text-slate-300" }),
|
|
1198
|
+
/* @__PURE__ */ e("span", { className: "flex-1 truncate text-slate-800 dark:text-foreground", children: c || /* @__PURE__ */ e("span", { className: "font-sans text-slate-400", children: "skipped" }) })
|
|
1175
1199
|
]
|
|
1176
1200
|
},
|
|
1177
|
-
|
|
1201
|
+
p
|
|
1178
1202
|
)) })
|
|
1179
1203
|
] }),
|
|
1180
1204
|
s.created_ids && (((T = s.created_ids) == null ? void 0 : T.length) ?? 0) > 0 && /* @__PURE__ */ e("section", { children: /* @__PURE__ */ a(
|
|
@@ -1182,9 +1206,9 @@ function St({ jobId: o, onClose: n }) {
|
|
|
1182
1206
|
{
|
|
1183
1207
|
type: "button",
|
|
1184
1208
|
onClick: () => {
|
|
1185
|
-
const
|
|
1209
|
+
const p = (s.created_ids ?? []).map(String).join(",");
|
|
1186
1210
|
l.navigate(
|
|
1187
|
-
`/collections/${s.collection}?ids=${encodeURIComponent(
|
|
1211
|
+
`/collections/${s.collection}?ids=${encodeURIComponent(p)}`
|
|
1188
1212
|
);
|
|
1189
1213
|
},
|
|
1190
1214
|
className: "inline-flex h-8 items-center gap-1.5 rounded-md border border-nvr-cyan/40 bg-nvr-cyan/5 px-3 text-[12px] font-medium text-[#007a99] dark:text-nvr-cyan",
|
|
@@ -1199,24 +1223,24 @@ function St({ jobId: o, onClose: n }) {
|
|
|
1199
1223
|
]
|
|
1200
1224
|
}
|
|
1201
1225
|
) }),
|
|
1202
|
-
g.length > 0 && /* @__PURE__ */ e(
|
|
1226
|
+
g.length > 0 && /* @__PURE__ */ e(Mt, { jobId: String(s.id), errors: g })
|
|
1203
1227
|
] })
|
|
1204
1228
|
] }) : /* @__PURE__ */ e("div", { className: "p-5 text-[12.5px] text-slate-400", children: "Loading job…" }) }) });
|
|
1205
1229
|
}
|
|
1206
|
-
function
|
|
1230
|
+
function Mt({
|
|
1207
1231
|
jobId: o,
|
|
1208
1232
|
errors: n
|
|
1209
1233
|
}) {
|
|
1210
|
-
const l = re(), [
|
|
1234
|
+
const l = re(), [m, i] = x({}), [s, g] = x({}), { data: C } = U({
|
|
1211
1235
|
queryKey: ["import-failed-rows", o],
|
|
1212
1236
|
queryFn: () => l.request(
|
|
1213
1237
|
W(`/imports/${o}/failed-rows`)
|
|
1214
|
-
).then((
|
|
1238
|
+
).then((c) => c.data ?? []),
|
|
1215
1239
|
staleTime: 3e4
|
|
1216
|
-
}), h = C ?? [], T = h[0] ? Object.keys(h[0].values) : [],
|
|
1217
|
-
mutationFn: ({ row:
|
|
1218
|
-
onSuccess: (
|
|
1219
|
-
onError: (
|
|
1240
|
+
}), h = C ?? [], T = h[0] ? Object.keys(h[0].values) : [], p = Q({
|
|
1241
|
+
mutationFn: ({ row: c, values: v }) => l.request(I(`/imports/${o}/repair-row`, { values: v })).then(() => c),
|
|
1242
|
+
onSuccess: (c) => g((v) => ({ ...v, [c]: "ok" })),
|
|
1243
|
+
onError: (c, v) => g((k) => ({ ...k, [v.row]: at(c, "The row was not created") }))
|
|
1220
1244
|
});
|
|
1221
1245
|
return h.length === 0 ? /* @__PURE__ */ a("section", { children: [
|
|
1222
1246
|
/* @__PURE__ */ a("h3", { className: "mb-1.5 text-[11.5px] font-semibold text-red-700 dark:text-red-400", children: [
|
|
@@ -1224,21 +1248,21 @@ function Pt({
|
|
|
1224
1248
|
n.length,
|
|
1225
1249
|
")"
|
|
1226
1250
|
] }),
|
|
1227
|
-
/* @__PURE__ */ e("div", { className: "max-h-[200px] overflow-auto rounded-md border border-red-200 dark:border-red-900", children: n.map((
|
|
1251
|
+
/* @__PURE__ */ e("div", { className: "max-h-[200px] overflow-auto rounded-md border border-red-200 dark:border-red-900", children: n.map((c) => /* @__PURE__ */ e(
|
|
1228
1252
|
"div",
|
|
1229
1253
|
{
|
|
1230
1254
|
className: "flex gap-3 border-b border-red-100 px-3 py-1.5 text-[11.5px] last:border-b-0 dark:border-red-900/60",
|
|
1231
1255
|
children: /* @__PURE__ */ a("span", { className: "text-red-700 dark:text-red-400", children: [
|
|
1232
1256
|
/* @__PURE__ */ a("span", { className: "font-medium tabular-nums", children: [
|
|
1233
1257
|
"Row ",
|
|
1234
|
-
|
|
1258
|
+
c.row,
|
|
1235
1259
|
":"
|
|
1236
1260
|
] }),
|
|
1237
1261
|
" ",
|
|
1238
|
-
Te(
|
|
1262
|
+
Te(c.error)
|
|
1239
1263
|
] })
|
|
1240
1264
|
},
|
|
1241
|
-
`${
|
|
1265
|
+
`${c.row}-${c.error}`
|
|
1242
1266
|
)) })
|
|
1243
1267
|
] }) : /* @__PURE__ */ a("section", { children: [
|
|
1244
1268
|
/* @__PURE__ */ a("h3", { className: "mb-1.5 text-[11.5px] font-semibold text-red-700 dark:text-red-400", children: [
|
|
@@ -1249,50 +1273,52 @@ function Pt({
|
|
|
1249
1273
|
/* @__PURE__ */ e("div", { className: "max-h-[320px] overflow-auto rounded-md border border-red-200 dark:border-red-900", children: /* @__PURE__ */ a("table", { className: "w-full text-[11.5px]", children: [
|
|
1250
1274
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ a("tr", { className: "bg-red-50/60 text-left text-[10px] uppercase tracking-wide text-slate-400 dark:bg-red-950/30", children: [
|
|
1251
1275
|
/* @__PURE__ */ e("th", { className: "px-2 py-1", children: "Row" }),
|
|
1252
|
-
T.map((
|
|
1276
|
+
T.map((c) => /* @__PURE__ */ e("th", { className: "px-2 py-1 font-mono normal-case", children: c }, c)),
|
|
1253
1277
|
/* @__PURE__ */ e("th", { className: "px-2 py-1" })
|
|
1254
1278
|
] }) }),
|
|
1255
|
-
/* @__PURE__ */ e("tbody", { children: h.map((
|
|
1256
|
-
const v =
|
|
1279
|
+
/* @__PURE__ */ e("tbody", { children: h.map((c) => {
|
|
1280
|
+
const v = m[c.row] ?? c.values, k = s[c.row];
|
|
1257
1281
|
return /* @__PURE__ */ a(
|
|
1258
1282
|
"tr",
|
|
1259
1283
|
{
|
|
1260
1284
|
className: "border-t border-red-100 align-top dark:border-red-900/50",
|
|
1261
1285
|
children: [
|
|
1262
1286
|
/* @__PURE__ */ a("td", { className: "px-2 py-1 font-mono tabular-nums text-slate-400", children: [
|
|
1263
|
-
|
|
1264
|
-
/* @__PURE__ */ e("p", { className: "max-w-[120px] whitespace-normal text-[10px] text-red-500", children: Te(
|
|
1287
|
+
c.row,
|
|
1288
|
+
/* @__PURE__ */ e("p", { className: "max-w-[120px] whitespace-normal text-[10px] text-red-500", children: Te(c.error) })
|
|
1265
1289
|
] }),
|
|
1266
|
-
T.map((
|
|
1290
|
+
T.map((u) => /* @__PURE__ */ e("td", { className: "px-1 py-1", children: /* @__PURE__ */ e(
|
|
1267
1291
|
"input",
|
|
1268
1292
|
{
|
|
1269
|
-
value: String(v[
|
|
1270
|
-
disabled:
|
|
1271
|
-
onChange: (P) =>
|
|
1293
|
+
value: String(v[u] ?? ""),
|
|
1294
|
+
disabled: k === "ok",
|
|
1295
|
+
onChange: (P) => i((S) => ({ ...S, [c.row]: { ...v, [u]: P.target.value } })),
|
|
1272
1296
|
className: "h-6 w-full min-w-[80px] rounded border border-slate-200 bg-background px-1 text-[11px] dark:border-border"
|
|
1273
1297
|
}
|
|
1274
|
-
) },
|
|
1275
|
-
/* @__PURE__ */ e("td", { className: "px-2 py-1", children:
|
|
1298
|
+
) }, u)),
|
|
1299
|
+
/* @__PURE__ */ e("td", { className: "px-2 py-1", children: k === "ok" ? /* @__PURE__ */ e("span", { className: "text-[10.5px] font-medium text-emerald-600", children: "✓ Created" }) : /* @__PURE__ */ a("div", { children: [
|
|
1276
1300
|
/* @__PURE__ */ e(
|
|
1277
1301
|
"button",
|
|
1278
1302
|
{
|
|
1279
1303
|
type: "button",
|
|
1280
|
-
disabled:
|
|
1281
|
-
onClick: () =>
|
|
1304
|
+
disabled: p.isPending,
|
|
1305
|
+
onClick: () => p.mutate({ row: c.row, values: v }),
|
|
1282
1306
|
className: "rounded border border-slate-200 px-1.5 py-0.5 text-[10.5px] hover:bg-muted disabled:opacity-50 dark:border-border",
|
|
1283
1307
|
children: "Resubmit"
|
|
1284
1308
|
}
|
|
1285
1309
|
),
|
|
1286
|
-
|
|
1310
|
+
k && k !== "ok" && /* @__PURE__ */ e("p", { className: "max-w-[140px] whitespace-normal text-[9.5px] text-red-500", children: k })
|
|
1287
1311
|
] }) })
|
|
1288
1312
|
]
|
|
1289
1313
|
},
|
|
1290
|
-
|
|
1314
|
+
c.row
|
|
1291
1315
|
);
|
|
1292
1316
|
}) })
|
|
1293
1317
|
] }) })
|
|
1294
1318
|
] });
|
|
1295
1319
|
}
|
|
1296
1320
|
export {
|
|
1297
|
-
|
|
1321
|
+
Zt as CollectionImportPanel,
|
|
1322
|
+
kt as ROLLBACK_QUESTION,
|
|
1323
|
+
wt as RollbackJobItem
|
|
1298
1324
|
};
|