@nivaro/react 0.3.102 → 0.3.104
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 +4 -2
- package/dist/shared/components/CollectionBrowserView.js +1 -1
- package/dist/shared/components/ItemEditForm.js +2867 -2845
- package/dist/shared/components/imports/CollectionImportPanel.js +483 -459
- package/dist/shared/components/integrations/IntegrationStatusLines.js +71 -68
- package/dist/shared/components/item-edit/UserChip.js +38 -38
- package/dist/shared/components/layout-editor/DesignNode.js +16 -14
- package/dist/shared/components/layout-editor/LayoutEditor.js +445 -441
- package/dist/shared/components/layout-editor/inspector/Inspector.js +18 -18
- package/dist/shared/components/layout-editor/inspector/SlotInspector.js +80 -52
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/layout-editor/settings/ButtonsSection.js +54 -26
- package/dist/shared/components/layout-editor/settings/settings-registry.js +23 -15
- package/dist/shared/components/layout-editor/useLayoutDraft.js +211 -196
- package/dist/shared/components/panels/ExternalRequestsChip.js +141 -122
- package/dist/shared/lib/entry-config.js +7 -7
- package/dist/shared/lib/integration-chip.js +10 -6
- package/dist/shared/lib/owners-header-tile.js +63 -0
- package/package.json +1 -1
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { Upload as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { useNivaroClient as
|
|
6
|
-
import { get as W, del as
|
|
7
|
-
import { errorSentence as
|
|
8
|
-
import { formatNumber as
|
|
9
|
-
import { DataTable as
|
|
1
|
+
import { jsx as e, jsxs as r, Fragment as Ve } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as je, useQuery as U, useMutation as K } from "@tanstack/react-query";
|
|
3
|
+
import { Upload as We, Plus as $e, ArrowLeft as Re, FileUp as He, Link2 as Ge, Loader2 as me, Sparkles as Ze, ArrowRight as Ee, MoreHorizontal as Xe, Trash2 as Ye, ChevronsUpDown as et, Check as tt } from "lucide-react";
|
|
4
|
+
import { useState as f, useMemo as V, useEffect as Ie, useRef as Te } from "react";
|
|
5
|
+
import { useNivaroClient as ae, useNavigation as rt } from "../../context.js";
|
|
6
|
+
import { get as W, del as at, post as L } from "../../lib/commands.js";
|
|
7
|
+
import { errorSentence as st, rowErrorSentence as De } from "../../lib/error-message.js";
|
|
8
|
+
import { formatNumber as C, toLocalDateString as lt, cn as k, formatRelative as ot, formatDateTime as te } from "../../lib/utils.js";
|
|
9
|
+
import { DataTable as nt } from "../DataTable.js";
|
|
10
10
|
import { Button as F } from "../ui/button.js";
|
|
11
|
-
import { Command as
|
|
12
|
-
import { DropdownMenu as
|
|
13
|
-
import { Input as
|
|
11
|
+
import { Command as dt, CommandInput as it, CommandList as ct, CommandEmpty as mt, CommandItem as pt } from "../ui/command.js";
|
|
12
|
+
import { DropdownMenu as ut, DropdownMenuTrigger as xt, DropdownMenuContent as ht, DropdownMenuItem as xe } from "../ui/dropdown-menu.js";
|
|
13
|
+
import { Input as Ae } from "../ui/input.js";
|
|
14
14
|
import { Label as J } from "../ui/label.js";
|
|
15
|
-
import { Popover as
|
|
16
|
-
import { SimpleSelect as
|
|
17
|
-
import { Sheet as
|
|
15
|
+
import { Popover as bt, PopoverTrigger as ft, PopoverContent as gt } from "../ui/popover.js";
|
|
16
|
+
import { SimpleSelect as vt } from "../ui/SimpleSelect.js";
|
|
17
|
+
import { Sheet as kt, SheetContent as wt } from "../ui/sheet.js";
|
|
18
18
|
import { Switch as Nt } from "../ui/switch.js";
|
|
19
|
-
import { Textarea as
|
|
19
|
+
import { Textarea as yt } from "../ui/textarea.js";
|
|
20
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: {
|
|
@@ -30,19 +30,19 @@ const pe = 25, ue = ["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
|
-
},
|
|
34
|
-
function
|
|
35
|
-
disabled:
|
|
33
|
+
}, _t = "Roll back this import? Created rows are deleted (to trash) and overwritten rows restored to their prior values. One-shot.";
|
|
34
|
+
function Ct({
|
|
35
|
+
disabled: d,
|
|
36
36
|
rolledBack: n,
|
|
37
37
|
onConfirm: l
|
|
38
38
|
}) {
|
|
39
|
-
const [m, i] =
|
|
39
|
+
const [m, i] = f(!1);
|
|
40
40
|
return /* @__PURE__ */ e(
|
|
41
|
-
|
|
41
|
+
xe,
|
|
42
42
|
{
|
|
43
|
-
disabled:
|
|
43
|
+
disabled: d,
|
|
44
44
|
"data-armed": m ? "" : void 0,
|
|
45
|
-
className:
|
|
45
|
+
className: k(
|
|
46
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
47
|
),
|
|
48
48
|
onSelect: (s) => {
|
|
@@ -52,84 +52,84 @@ function yt({
|
|
|
52
52
|
}
|
|
53
53
|
i(!1), l();
|
|
54
54
|
},
|
|
55
|
-
children: m ? /* @__PURE__ */
|
|
56
|
-
|
|
55
|
+
children: m ? /* @__PURE__ */ r("span", { className: "block", children: [
|
|
56
|
+
_t,
|
|
57
57
|
/* @__PURE__ */ e("span", { className: "mt-1 block text-[11px] font-semibold", children: "Choose again to roll back" })
|
|
58
58
|
] }) : n ? "Rolled back" : "Roll back this import"
|
|
59
59
|
}
|
|
60
60
|
);
|
|
61
61
|
}
|
|
62
|
-
function
|
|
63
|
-
const n = j[
|
|
64
|
-
return /* @__PURE__ */
|
|
65
|
-
/* @__PURE__ */
|
|
66
|
-
|
|
62
|
+
function Le({ status: d }) {
|
|
63
|
+
const n = j[d] ?? j.pending;
|
|
64
|
+
return /* @__PURE__ */ r("span", { className: k("flex items-center gap-1.5 text-[12px] font-medium", n.text), children: [
|
|
65
|
+
/* @__PURE__ */ r("span", { className: "relative flex h-1.5 w-1.5 shrink-0", children: [
|
|
66
|
+
d === "processing" && /* @__PURE__ */ e(
|
|
67
67
|
"span",
|
|
68
68
|
{
|
|
69
|
-
className:
|
|
69
|
+
className: k(
|
|
70
70
|
"absolute inline-flex h-full w-full rounded-full opacity-75 motion-safe:animate-ping",
|
|
71
71
|
n.dot
|
|
72
72
|
)
|
|
73
73
|
}
|
|
74
74
|
),
|
|
75
|
-
/* @__PURE__ */ e("span", { className:
|
|
75
|
+
/* @__PURE__ */ e("span", { className: k("relative inline-flex h-1.5 w-1.5 rounded-full", n.dot) })
|
|
76
76
|
] }),
|
|
77
77
|
n.label
|
|
78
78
|
] });
|
|
79
79
|
}
|
|
80
|
-
function
|
|
81
|
-
processed:
|
|
80
|
+
function St({
|
|
81
|
+
processed: d,
|
|
82
82
|
total: n,
|
|
83
83
|
failed: l
|
|
84
84
|
}) {
|
|
85
85
|
if (!n) return /* @__PURE__ */ e("span", { className: "text-[12px] text-slate-300", children: "—" });
|
|
86
|
-
const m = Math.min(100, Math.round((
|
|
87
|
-
return /* @__PURE__ */
|
|
86
|
+
const m = Math.min(100, Math.round((d ?? 0) / n * 100));
|
|
87
|
+
return /* @__PURE__ */ r("div", { className: "flex min-w-[92px] items-center gap-2", children: [
|
|
88
88
|
/* @__PURE__ */ e("div", { className: "h-1.5 flex-1 overflow-hidden rounded-full bg-slate-100 dark:bg-muted", children: /* @__PURE__ */ e(
|
|
89
89
|
"div",
|
|
90
90
|
{
|
|
91
|
-
className:
|
|
91
|
+
className: k(
|
|
92
92
|
"h-full rounded-full transition-[width] duration-500",
|
|
93
93
|
l ? "bg-red-500" : "bg-nvr-cyan"
|
|
94
94
|
),
|
|
95
95
|
style: { width: `${m}%` }
|
|
96
96
|
}
|
|
97
97
|
) }),
|
|
98
|
-
/* @__PURE__ */
|
|
98
|
+
/* @__PURE__ */ r("span", { className: "w-8 text-right text-[11px] tabular-nums text-slate-400", children: [
|
|
99
99
|
m,
|
|
100
100
|
"%"
|
|
101
101
|
] })
|
|
102
102
|
] });
|
|
103
103
|
}
|
|
104
|
-
function
|
|
104
|
+
function re(d) {
|
|
105
105
|
const n = [];
|
|
106
106
|
let l = "", m = !1;
|
|
107
|
-
for (let i = 0; i <
|
|
108
|
-
const s =
|
|
109
|
-
m ? s === '"' &&
|
|
107
|
+
for (let i = 0; i < d.length; i++) {
|
|
108
|
+
const s = d[i];
|
|
109
|
+
m ? s === '"' && d[i + 1] === '"' ? (l += '"', i++) : s === '"' ? m = !1 : l += s : s === '"' ? m = !0 : s === "," ? (n.push(l), l = "") : l += s;
|
|
110
110
|
}
|
|
111
111
|
return n.push(l), n.map((i) => i.trim());
|
|
112
112
|
}
|
|
113
|
-
function
|
|
114
|
-
const n =
|
|
113
|
+
function Pt(d) {
|
|
114
|
+
const n = d.split(/\r?\n/).filter((i) => i.trim());
|
|
115
115
|
if (n.length === 0) return { headers: [], rows: [], rowCount: 0 };
|
|
116
|
-
const l =
|
|
116
|
+
const l = re(n[0]), m = n.slice(1, 6).map(re);
|
|
117
117
|
return { headers: l, rows: m, rowCount: Math.max(0, n.length - 1) };
|
|
118
118
|
}
|
|
119
119
|
function X({
|
|
120
|
-
value:
|
|
120
|
+
value: d,
|
|
121
121
|
onChange: n,
|
|
122
122
|
options: l,
|
|
123
123
|
placeholder: m = "Select…",
|
|
124
124
|
className: i
|
|
125
125
|
}) {
|
|
126
|
-
const [s, g] =
|
|
127
|
-
return /* @__PURE__ */
|
|
128
|
-
/* @__PURE__ */ e(
|
|
126
|
+
const [s, g] = f(!1), S = l.find((x) => x.value === d);
|
|
127
|
+
return /* @__PURE__ */ r(bt, { open: s, onOpenChange: g, children: [
|
|
128
|
+
/* @__PURE__ */ e(ft, { asChild: !0, children: /* @__PURE__ */ r(
|
|
129
129
|
"button",
|
|
130
130
|
{
|
|
131
131
|
type: "button",
|
|
132
|
-
className:
|
|
132
|
+
className: k(
|
|
133
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",
|
|
134
134
|
i
|
|
135
135
|
),
|
|
@@ -137,54 +137,54 @@ function X({
|
|
|
137
137
|
/* @__PURE__ */ e(
|
|
138
138
|
"span",
|
|
139
139
|
{
|
|
140
|
-
className:
|
|
140
|
+
className: k(
|
|
141
141
|
"truncate font-mono",
|
|
142
|
-
|
|
142
|
+
S ? "text-slate-800 dark:text-foreground" : "text-slate-400"
|
|
143
143
|
),
|
|
144
|
-
children: (
|
|
144
|
+
children: (S == null ? void 0 : S.label) ?? m
|
|
145
145
|
}
|
|
146
146
|
),
|
|
147
|
-
/* @__PURE__ */ e(
|
|
147
|
+
/* @__PURE__ */ e(et, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
|
|
148
148
|
]
|
|
149
149
|
}
|
|
150
150
|
) }),
|
|
151
|
-
/* @__PURE__ */ e(
|
|
152
|
-
/* @__PURE__ */ e(
|
|
153
|
-
/* @__PURE__ */
|
|
154
|
-
/* @__PURE__ */ e(
|
|
155
|
-
l.map((
|
|
156
|
-
|
|
151
|
+
/* @__PURE__ */ e(gt, { className: "w-[240px] p-0", align: "start", children: /* @__PURE__ */ r(dt, { children: [
|
|
152
|
+
/* @__PURE__ */ e(it, { placeholder: "Search…", className: "h-8 text-[12px]" }),
|
|
153
|
+
/* @__PURE__ */ r(ct, { children: [
|
|
154
|
+
/* @__PURE__ */ e(mt, { children: "Nothing matches." }),
|
|
155
|
+
l.map((x) => /* @__PURE__ */ r(
|
|
156
|
+
pt,
|
|
157
157
|
{
|
|
158
|
-
value:
|
|
158
|
+
value: x.label,
|
|
159
159
|
onSelect: () => {
|
|
160
|
-
n(
|
|
160
|
+
n(x.value), g(!1);
|
|
161
161
|
},
|
|
162
162
|
className: "text-[12px]",
|
|
163
163
|
children: [
|
|
164
164
|
/* @__PURE__ */ e(
|
|
165
|
-
|
|
165
|
+
tt,
|
|
166
166
|
{
|
|
167
|
-
className:
|
|
167
|
+
className: k(
|
|
168
168
|
"h-3.5 w-3.5",
|
|
169
|
-
|
|
169
|
+
x.value === d ? "text-nvr-cyan opacity-100" : "opacity-0"
|
|
170
170
|
)
|
|
171
171
|
}
|
|
172
172
|
),
|
|
173
|
-
/* @__PURE__ */ e("span", { className: "font-mono", children:
|
|
173
|
+
/* @__PURE__ */ e("span", { className: "font-mono", children: x.label })
|
|
174
174
|
]
|
|
175
175
|
},
|
|
176
|
-
|
|
176
|
+
x.value || "__skip__"
|
|
177
177
|
))
|
|
178
178
|
] })
|
|
179
179
|
] }) })
|
|
180
180
|
] });
|
|
181
181
|
}
|
|
182
|
-
function
|
|
183
|
-
const n = Math.round(
|
|
184
|
-
return /* @__PURE__ */
|
|
182
|
+
function Mt({ confidence: d }) {
|
|
183
|
+
const n = Math.round(d * 100), l = n >= 80 ? "text-emerald-700 dark:text-emerald-400" : n >= 50 ? "text-amber-700 dark:text-amber-400" : "text-slate-500";
|
|
184
|
+
return /* @__PURE__ */ r(
|
|
185
185
|
"span",
|
|
186
186
|
{
|
|
187
|
-
className:
|
|
187
|
+
className: k("shrink-0 text-[10.5px] font-medium tabular-nums", l),
|
|
188
188
|
title: "AI mapping confidence",
|
|
189
189
|
children: [
|
|
190
190
|
"AI ",
|
|
@@ -194,74 +194,74 @@ function St({ confidence: o }) {
|
|
|
194
194
|
}
|
|
195
195
|
);
|
|
196
196
|
}
|
|
197
|
-
function
|
|
198
|
-
initialJobId:
|
|
197
|
+
function Yt({
|
|
198
|
+
initialJobId: d,
|
|
199
199
|
onJobOpen: n
|
|
200
200
|
}) {
|
|
201
|
-
var
|
|
202
|
-
const l =
|
|
201
|
+
var Q;
|
|
202
|
+
const l = ae(), m = je(), [i, s] = f("list"), [g, S] = f(d ?? null), [x, T] = f("all"), [p, c] = f(1), [v, w] = f(null), u = U({
|
|
203
203
|
queryKey: ["collection-import-jobs"],
|
|
204
204
|
// The endpoint returns every job the caller may see, so the counters below
|
|
205
205
|
// are exact rather than page-scoped.
|
|
206
206
|
queryFn: () => l.request(W("/imports")),
|
|
207
|
-
refetchInterval: (
|
|
208
|
-
var
|
|
209
|
-
return (((
|
|
207
|
+
refetchInterval: (a) => {
|
|
208
|
+
var N;
|
|
209
|
+
return (((N = a.state.data) == null ? void 0 : N.data) ?? []).some((A) => A.status === "pending" || A.status === "processing") ? 3e3 : !1;
|
|
210
210
|
},
|
|
211
|
-
placeholderData: (
|
|
212
|
-
}),
|
|
213
|
-
var
|
|
214
|
-
return ((
|
|
215
|
-
}, [(
|
|
216
|
-
const
|
|
217
|
-
for (const
|
|
218
|
-
return
|
|
219
|
-
}, [
|
|
220
|
-
() =>
|
|
221
|
-
(
|
|
222
|
-
created:
|
|
223
|
-
updated:
|
|
224
|
-
skipped:
|
|
225
|
-
errors:
|
|
211
|
+
placeholderData: (a) => a
|
|
212
|
+
}), $ = V(() => {
|
|
213
|
+
var a;
|
|
214
|
+
return ((a = u.data) == null ? void 0 : a.data) ?? [];
|
|
215
|
+
}, [(Q = u.data) == null ? void 0 : Q.data]), P = V(() => {
|
|
216
|
+
const a = {};
|
|
217
|
+
for (const N of $) a[N.status] = (a[N.status] ?? 0) + 1;
|
|
218
|
+
return a;
|
|
219
|
+
}, [$]), D = V(
|
|
220
|
+
() => $.reduce(
|
|
221
|
+
(a, N) => ({
|
|
222
|
+
created: a.created + (N.created_rows ?? 0),
|
|
223
|
+
updated: a.updated + (N.updated_rows ?? 0),
|
|
224
|
+
skipped: a.skipped + (N.skipped_rows ?? 0),
|
|
225
|
+
errors: a.errors + (N.error_rows ?? 0)
|
|
226
226
|
}),
|
|
227
227
|
{ created: 0, updated: 0, skipped: 0, errors: 0 }
|
|
228
228
|
),
|
|
229
|
-
[
|
|
230
|
-
), O =
|
|
231
|
-
|
|
232
|
-
const E =
|
|
233
|
-
mutationFn: (
|
|
229
|
+
[$]
|
|
230
|
+
), O = x === "all" ? $ : $.filter((a) => a.status === x), H = O.slice((p - 1) * pe, p * pe);
|
|
231
|
+
Ie(() => c(1), [x]);
|
|
232
|
+
const E = K({
|
|
233
|
+
mutationFn: (a) => l.request(at(`/imports/${a}`)),
|
|
234
234
|
onSuccess: () => {
|
|
235
|
-
|
|
235
|
+
w(null), m.invalidateQueries({ queryKey: ["collection-import-jobs"] });
|
|
236
236
|
},
|
|
237
|
-
onError: (
|
|
238
|
-
}), G =
|
|
239
|
-
mutationFn: (
|
|
237
|
+
onError: (a) => w(a.message)
|
|
238
|
+
}), G = K({
|
|
239
|
+
mutationFn: (a) => l.request(L(`/imports/${a}/rollback`, {})),
|
|
240
240
|
onSuccess: () => {
|
|
241
|
-
|
|
241
|
+
w(null), m.invalidateQueries({ queryKey: ["collection-import-jobs"] });
|
|
242
242
|
},
|
|
243
|
-
onError: (
|
|
243
|
+
onError: (a) => w(a.message)
|
|
244
244
|
});
|
|
245
|
-
function
|
|
246
|
-
|
|
245
|
+
function R(a) {
|
|
246
|
+
S(a), n == null || n(a);
|
|
247
247
|
}
|
|
248
248
|
const Z = [
|
|
249
249
|
{
|
|
250
250
|
key: "status",
|
|
251
251
|
header: "Status",
|
|
252
252
|
className: "w-[110px]",
|
|
253
|
-
render: (
|
|
253
|
+
render: (a) => /* @__PURE__ */ e(Le, { status: a.status })
|
|
254
254
|
},
|
|
255
255
|
{
|
|
256
256
|
key: "file_name",
|
|
257
257
|
header: "File",
|
|
258
258
|
className: "max-w-[220px]",
|
|
259
|
-
render: (
|
|
259
|
+
render: (a) => /* @__PURE__ */ e(
|
|
260
260
|
"span",
|
|
261
261
|
{
|
|
262
262
|
className: "block truncate font-mono text-[11.5px] text-slate-800 dark:text-foreground",
|
|
263
|
-
title:
|
|
264
|
-
children:
|
|
263
|
+
title: a.file_name,
|
|
264
|
+
children: a.file_name
|
|
265
265
|
}
|
|
266
266
|
)
|
|
267
267
|
},
|
|
@@ -269,18 +269,18 @@ function Xt({
|
|
|
269
269
|
key: "collection",
|
|
270
270
|
header: "Collection",
|
|
271
271
|
className: "w-[170px]",
|
|
272
|
-
render: (
|
|
272
|
+
render: (a) => /* @__PURE__ */ e("span", { className: "truncate font-mono text-[11.5px] text-slate-600 dark:text-muted-foreground", children: a.collection })
|
|
273
273
|
},
|
|
274
274
|
{
|
|
275
275
|
key: "progress",
|
|
276
276
|
header: "Progress",
|
|
277
277
|
className: "w-[130px]",
|
|
278
|
-
render: (
|
|
279
|
-
|
|
278
|
+
render: (a) => /* @__PURE__ */ e(
|
|
279
|
+
St,
|
|
280
280
|
{
|
|
281
|
-
processed:
|
|
282
|
-
total:
|
|
283
|
-
failed:
|
|
281
|
+
processed: a.processed_rows,
|
|
282
|
+
total: a.total_rows,
|
|
283
|
+
failed: a.status === "failed"
|
|
284
284
|
}
|
|
285
285
|
)
|
|
286
286
|
},
|
|
@@ -289,39 +289,39 @@ function Xt({
|
|
|
289
289
|
header: "Created",
|
|
290
290
|
className: "w-[76px] text-right",
|
|
291
291
|
headerClassName: "text-right",
|
|
292
|
-
render: (
|
|
292
|
+
render: (a) => /* @__PURE__ */ e(Y, { n: a.created_rows })
|
|
293
293
|
},
|
|
294
294
|
{
|
|
295
295
|
key: "updated_rows",
|
|
296
296
|
header: "Updated",
|
|
297
297
|
className: "w-[76px] text-right",
|
|
298
298
|
headerClassName: "text-right",
|
|
299
|
-
render: (
|
|
299
|
+
render: (a) => /* @__PURE__ */ e(Y, { n: a.updated_rows })
|
|
300
300
|
},
|
|
301
301
|
{
|
|
302
302
|
key: "skipped_rows",
|
|
303
303
|
header: "Skipped",
|
|
304
304
|
className: "w-[76px] text-right",
|
|
305
305
|
headerClassName: "text-right",
|
|
306
|
-
render: (
|
|
306
|
+
render: (a) => /* @__PURE__ */ e(Y, { n: a.skipped_rows })
|
|
307
307
|
},
|
|
308
308
|
{
|
|
309
309
|
key: "error_rows",
|
|
310
310
|
header: "Errors",
|
|
311
311
|
className: "w-[70px] text-right",
|
|
312
312
|
headerClassName: "text-right",
|
|
313
|
-
render: (
|
|
313
|
+
render: (a) => (a.error_rows ?? 0) > 0 ? /* @__PURE__ */ e("span", { className: "font-mono text-[11.5px] font-medium tabular-nums text-red-600 dark:text-red-400", children: C(a.error_rows ?? 0) }) : /* @__PURE__ */ e(Y, { n: 0 })
|
|
314
314
|
},
|
|
315
315
|
{
|
|
316
316
|
key: "created_at",
|
|
317
317
|
header: "Queued",
|
|
318
318
|
className: "w-[110px]",
|
|
319
|
-
render: (
|
|
319
|
+
render: (a) => /* @__PURE__ */ e(
|
|
320
320
|
"span",
|
|
321
321
|
{
|
|
322
322
|
className: "text-[12px] text-slate-500 dark:text-muted-foreground",
|
|
323
|
-
title: te(
|
|
324
|
-
children:
|
|
323
|
+
title: te(a.created_at),
|
|
324
|
+
children: ot(a.created_at)
|
|
325
325
|
}
|
|
326
326
|
)
|
|
327
327
|
},
|
|
@@ -329,33 +329,33 @@ function Xt({
|
|
|
329
329
|
key: "__actions__",
|
|
330
330
|
header: "",
|
|
331
331
|
className: "w-[44px]",
|
|
332
|
-
render: (
|
|
333
|
-
/* @__PURE__ */ e(
|
|
332
|
+
render: (a) => /* @__PURE__ */ e("div", { onClick: (N) => N.stopPropagation(), onKeyDown: (N) => N.stopPropagation(), children: /* @__PURE__ */ r(ut, { children: [
|
|
333
|
+
/* @__PURE__ */ e(xt, { asChild: !0, children: /* @__PURE__ */ e(
|
|
334
334
|
"button",
|
|
335
335
|
{
|
|
336
336
|
type: "button",
|
|
337
337
|
className: "rounded p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted",
|
|
338
|
-
"aria-label": `Actions for ${
|
|
339
|
-
children: /* @__PURE__ */ e(
|
|
338
|
+
"aria-label": `Actions for ${a.file_name}`,
|
|
339
|
+
children: /* @__PURE__ */ e(Xe, { className: "h-4 w-4" })
|
|
340
340
|
}
|
|
341
341
|
) }),
|
|
342
|
-
/* @__PURE__ */
|
|
343
|
-
/* @__PURE__ */ e(
|
|
342
|
+
/* @__PURE__ */ r(ht, { align: "end", className: "text-[12.5px]", children: [
|
|
343
|
+
/* @__PURE__ */ e(xe, { onSelect: () => R(a.id), children: "View details" }),
|
|
344
344
|
/* @__PURE__ */ e(
|
|
345
|
-
|
|
345
|
+
Ct,
|
|
346
346
|
{
|
|
347
|
-
disabled:
|
|
348
|
-
rolledBack: !!
|
|
349
|
-
onConfirm: () => G.mutate(
|
|
347
|
+
disabled: a.status !== "complete" || !!a.rolled_back_at,
|
|
348
|
+
rolledBack: !!a.rolled_back_at,
|
|
349
|
+
onConfirm: () => G.mutate(a.id)
|
|
350
350
|
}
|
|
351
351
|
),
|
|
352
|
-
/* @__PURE__ */
|
|
353
|
-
|
|
352
|
+
/* @__PURE__ */ r(
|
|
353
|
+
xe,
|
|
354
354
|
{
|
|
355
|
-
disabled:
|
|
356
|
-
onSelect: () => E.mutate(
|
|
355
|
+
disabled: a.status !== "complete" && a.status !== "failed",
|
|
356
|
+
onSelect: () => E.mutate(a.id),
|
|
357
357
|
children: [
|
|
358
|
-
/* @__PURE__ */ e(
|
|
358
|
+
/* @__PURE__ */ e(Ye, { className: "h-3.5 w-3.5" }),
|
|
359
359
|
" Delete job"
|
|
360
360
|
]
|
|
361
361
|
}
|
|
@@ -365,93 +365,93 @@ function Xt({
|
|
|
365
365
|
}
|
|
366
366
|
];
|
|
367
367
|
return i === "wizard" ? /* @__PURE__ */ e(
|
|
368
|
-
|
|
368
|
+
qt,
|
|
369
369
|
{
|
|
370
370
|
onCancel: () => s("list"),
|
|
371
|
-
onCreated: (
|
|
372
|
-
s("list"), m.invalidateQueries({ queryKey: ["collection-import-jobs"] }),
|
|
371
|
+
onCreated: (a) => {
|
|
372
|
+
s("list"), m.invalidateQueries({ queryKey: ["collection-import-jobs"] }), R(a);
|
|
373
373
|
}
|
|
374
374
|
}
|
|
375
|
-
) : /* @__PURE__ */
|
|
375
|
+
) : /* @__PURE__ */ r("div", { className: "flex min-h-0 flex-1 flex-col gap-3", children: [
|
|
376
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 }),
|
|
377
|
-
/* @__PURE__ */
|
|
377
|
+
/* @__PURE__ */ r("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: [
|
|
378
378
|
/* @__PURE__ */ e(
|
|
379
|
-
|
|
379
|
+
Fe,
|
|
380
380
|
{
|
|
381
381
|
label: "All",
|
|
382
|
-
count:
|
|
383
|
-
active:
|
|
384
|
-
onClick: () =>
|
|
382
|
+
count: $.length,
|
|
383
|
+
active: x === "all",
|
|
384
|
+
onClick: () => T("all")
|
|
385
385
|
}
|
|
386
386
|
),
|
|
387
|
-
Object.keys(j).map((
|
|
388
|
-
|
|
387
|
+
Object.keys(j).map((a) => /* @__PURE__ */ e(
|
|
388
|
+
Fe,
|
|
389
389
|
{
|
|
390
|
-
label: j[
|
|
391
|
-
dot: j[
|
|
392
|
-
count:
|
|
393
|
-
active:
|
|
394
|
-
onClick: () =>
|
|
390
|
+
label: j[a].label,
|
|
391
|
+
dot: j[a].dot,
|
|
392
|
+
count: P[a] ?? 0,
|
|
393
|
+
active: x === a,
|
|
394
|
+
onClick: () => T(x === a ? "all" : a)
|
|
395
395
|
},
|
|
396
|
-
|
|
396
|
+
a
|
|
397
397
|
)),
|
|
398
|
-
/* @__PURE__ */
|
|
399
|
-
/* @__PURE__ */ e(ee, { label: "Records created", value:
|
|
400
|
-
/* @__PURE__ */ e(ee, { label: "Records updated", value:
|
|
401
|
-
/* @__PURE__ */ e(ee, { label: "Skipped", value:
|
|
398
|
+
/* @__PURE__ */ r("div", { className: "ml-auto flex items-stretch divide-x divide-slate-200 dark:divide-border", children: [
|
|
399
|
+
/* @__PURE__ */ e(ee, { label: "Records created", value: C(D.created) }),
|
|
400
|
+
/* @__PURE__ */ e(ee, { label: "Records updated", value: C(D.updated) }),
|
|
401
|
+
/* @__PURE__ */ e(ee, { label: "Skipped", value: C(D.skipped) }),
|
|
402
402
|
/* @__PURE__ */ e(
|
|
403
403
|
ee,
|
|
404
404
|
{
|
|
405
405
|
label: "Row errors",
|
|
406
|
-
value:
|
|
407
|
-
tone:
|
|
406
|
+
value: C(D.errors),
|
|
407
|
+
tone: D.errors > 0 ? "red" : void 0
|
|
408
408
|
}
|
|
409
409
|
)
|
|
410
410
|
] })
|
|
411
411
|
] }),
|
|
412
|
-
|
|
413
|
-
/* @__PURE__ */ e(
|
|
412
|
+
$.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__ */ r("div", { className: "max-w-[58ch]", children: [
|
|
413
|
+
/* @__PURE__ */ e(We, { className: "h-5 w-5 text-slate-300" }),
|
|
414
414
|
/* @__PURE__ */ e("h3", { className: "mt-3 text-[15px] font-semibold text-slate-900 dark:text-foreground", children: "No collection imports yet" }),
|
|
415
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." }),
|
|
416
|
-
/* @__PURE__ */
|
|
417
|
-
/* @__PURE__ */ e(
|
|
416
|
+
/* @__PURE__ */ r(F, { size: "sm", className: "mt-4", onClick: () => s("wizard"), children: [
|
|
417
|
+
/* @__PURE__ */ e($e, { className: "h-3.5 w-3.5" }),
|
|
418
418
|
" Start an import"
|
|
419
419
|
] })
|
|
420
420
|
] }) }) : /* @__PURE__ */ e("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ e(
|
|
421
|
-
|
|
421
|
+
nt,
|
|
422
422
|
{
|
|
423
423
|
columns: Z,
|
|
424
424
|
rows: H,
|
|
425
|
-
rowKey: (
|
|
425
|
+
rowKey: (a) => a.id,
|
|
426
426
|
total: O.length,
|
|
427
427
|
page: p,
|
|
428
428
|
limit: pe,
|
|
429
429
|
onPageChange: c,
|
|
430
430
|
isLoading: u.isLoading,
|
|
431
|
-
onRowClick: (
|
|
431
|
+
onRowClick: (a) => R(a.id),
|
|
432
432
|
nowrapCells: !0,
|
|
433
433
|
minBodyHeight: 280,
|
|
434
434
|
emptyMessage: "No import jobs match this filter.",
|
|
435
|
-
rowClassName: (
|
|
436
|
-
toolbarRight: /* @__PURE__ */
|
|
437
|
-
/* @__PURE__ */ e(
|
|
435
|
+
rowClassName: (a) => a.status === "processing" ? "bg-nvr-cyan/5 dark:bg-nvr-cyan/10" : void 0,
|
|
436
|
+
toolbarRight: /* @__PURE__ */ r(F, { size: "sm", className: "h-7", onClick: () => s("wizard"), children: [
|
|
437
|
+
/* @__PURE__ */ e($e, { className: "h-3.5 w-3.5" }),
|
|
438
438
|
" New collection import"
|
|
439
439
|
] })
|
|
440
440
|
}
|
|
441
441
|
) }),
|
|
442
|
-
/* @__PURE__ */ e(
|
|
442
|
+
/* @__PURE__ */ e(Rt, { jobId: g, onClose: () => R(null) })
|
|
443
443
|
] });
|
|
444
444
|
}
|
|
445
|
-
function Y({ n:
|
|
446
|
-
return /* @__PURE__ */ e("span", { className: "font-mono text-[11.5px] tabular-nums text-slate-600 dark:text-muted-foreground", children:
|
|
445
|
+
function Y({ n: d }) {
|
|
446
|
+
return /* @__PURE__ */ e("span", { className: "font-mono text-[11.5px] tabular-nums text-slate-600 dark:text-muted-foreground", children: C(d ?? 0) });
|
|
447
447
|
}
|
|
448
|
-
function ee({ label:
|
|
449
|
-
return /* @__PURE__ */
|
|
450
|
-
/* @__PURE__ */ e("p", { className: "text-[10.5px] font-medium text-slate-400 dark:text-muted-foreground", children:
|
|
448
|
+
function ee({ label: d, value: n, tone: l }) {
|
|
449
|
+
return /* @__PURE__ */ r("div", { className: "px-3.5 py-2", children: [
|
|
450
|
+
/* @__PURE__ */ e("p", { className: "text-[10.5px] font-medium text-slate-400 dark:text-muted-foreground", children: d }),
|
|
451
451
|
/* @__PURE__ */ e(
|
|
452
452
|
"p",
|
|
453
453
|
{
|
|
454
|
-
className:
|
|
454
|
+
className: k(
|
|
455
455
|
"mt-0.5 text-[15px] font-semibold leading-none tabular-nums",
|
|
456
456
|
l === "red" ? "text-red-600 dark:text-red-400" : "text-slate-900 dark:text-foreground"
|
|
457
457
|
),
|
|
@@ -460,50 +460,50 @@ function ee({ label: o, value: n, tone: l }) {
|
|
|
460
460
|
)
|
|
461
461
|
] });
|
|
462
462
|
}
|
|
463
|
-
function
|
|
464
|
-
label:
|
|
463
|
+
function Fe({
|
|
464
|
+
label: d,
|
|
465
465
|
count: n,
|
|
466
466
|
dot: l,
|
|
467
467
|
active: m,
|
|
468
468
|
onClick: i
|
|
469
469
|
}) {
|
|
470
|
-
return /* @__PURE__ */
|
|
470
|
+
return /* @__PURE__ */ r(
|
|
471
471
|
"button",
|
|
472
472
|
{
|
|
473
473
|
type: "button",
|
|
474
474
|
onClick: i,
|
|
475
475
|
"aria-pressed": m,
|
|
476
|
-
className:
|
|
476
|
+
className: k(
|
|
477
477
|
"flex items-center gap-1.5 px-3 py-2 transition-colors hover:bg-slate-50 dark:hover:bg-muted/40",
|
|
478
478
|
m && "bg-nvr-cyan/10 ring-1 ring-inset ring-nvr-cyan dark:bg-nvr-cyan/15",
|
|
479
479
|
!m && n === 0 && "opacity-45"
|
|
480
480
|
),
|
|
481
481
|
children: [
|
|
482
|
-
l && /* @__PURE__ */ e("span", { className:
|
|
483
|
-
/* @__PURE__ */ e("span", { className: "text-[14px] font-semibold leading-none tabular-nums text-slate-900 dark:text-foreground", children:
|
|
484
|
-
/* @__PURE__ */ e("span", { className: "text-[11px] font-medium leading-none text-slate-400 dark:text-muted-foreground", children:
|
|
482
|
+
l && /* @__PURE__ */ e("span", { className: k("h-1.5 w-1.5 shrink-0 rounded-full", l) }),
|
|
483
|
+
/* @__PURE__ */ e("span", { className: "text-[14px] font-semibold leading-none tabular-nums text-slate-900 dark:text-foreground", children: C(n) }),
|
|
484
|
+
/* @__PURE__ */ e("span", { className: "text-[11px] font-medium leading-none text-slate-400 dark:text-muted-foreground", children: d })
|
|
485
485
|
]
|
|
486
486
|
}
|
|
487
487
|
);
|
|
488
488
|
}
|
|
489
|
-
function
|
|
490
|
-
onCancel:
|
|
489
|
+
function qt({
|
|
490
|
+
onCancel: d,
|
|
491
491
|
onCreated: n
|
|
492
492
|
}) {
|
|
493
|
-
var
|
|
494
|
-
const l =
|
|
495
|
-
|
|
493
|
+
var ye, _e, Ce, Se;
|
|
494
|
+
const l = ae(), m = Te(null), [i, s] = f(0), [g, S] = f(""), [x, T] = f({}), [p, c] = f(""), [v, w] = f(""), [u, $] = f(""), [P, D] = f({}), [O, H] = f({}), [E, G] = f("skip"), [R, Z] = f(""), [Q, a] = f(!1), [N, A] = f(null), [Oe, se] = f(!1), [ze, Ue] = f(null), he = Te(null), { headers: y, rows: be, rowCount: le } = V(() => Pt(g), [g]);
|
|
495
|
+
Ie(() => {
|
|
496
496
|
if (!u || y.length === 0) return;
|
|
497
497
|
const t = `${u}|${y.join("")}`;
|
|
498
|
-
|
|
499
|
-
const
|
|
500
|
-
|
|
501
|
-
if (Object.values(
|
|
502
|
-
const
|
|
503
|
-
for (const
|
|
504
|
-
return Object.keys(
|
|
505
|
-
|
|
506
|
-
),
|
|
498
|
+
he.current !== t && (he.current = t, l.request(L("/imports/mappings/lookup", { collection: u, headers: y })).then((o) => {
|
|
499
|
+
const b = o.data;
|
|
500
|
+
b && D((M) => {
|
|
501
|
+
if (Object.values(M).some((h) => h == null ? void 0 : h.trim())) return M;
|
|
502
|
+
const q = {};
|
|
503
|
+
for (const h of y) b.column_map[h] && (q[h] = b.column_map[h]);
|
|
504
|
+
return Object.keys(q).length === 0 ? M : (Ue(
|
|
505
|
+
b.updated_at ? `Applied your saved mapping from ${lt(b.updated_at)}` : "Applied your saved mapping"
|
|
506
|
+
), b.id_field && Z((h) => h || b.id_field || ""), b.duplicate_strategy && G((h) => h === "skip" && b.duplicate_strategy || h), q);
|
|
507
507
|
});
|
|
508
508
|
}).catch(() => {
|
|
509
509
|
}));
|
|
@@ -512,135 +512,137 @@ function Pt({
|
|
|
512
512
|
queryKey: [
|
|
513
513
|
"import-diff-preview",
|
|
514
514
|
u,
|
|
515
|
-
|
|
515
|
+
R,
|
|
516
516
|
E,
|
|
517
517
|
g.length,
|
|
518
|
-
JSON.stringify(
|
|
518
|
+
JSON.stringify(P)
|
|
519
519
|
],
|
|
520
520
|
queryFn: () => l.request(
|
|
521
|
-
|
|
521
|
+
L("/imports/preview", {
|
|
522
522
|
collection: u,
|
|
523
523
|
csv_data: g,
|
|
524
|
-
column_map:
|
|
525
|
-
id_field:
|
|
524
|
+
column_map: P,
|
|
525
|
+
id_field: R || null,
|
|
526
526
|
duplicate_strategy: E
|
|
527
527
|
})
|
|
528
528
|
),
|
|
529
529
|
enabled: i === 3 && !!u && !!g,
|
|
530
530
|
staleTime: 3e4,
|
|
531
531
|
retry: !1
|
|
532
|
-
}),
|
|
532
|
+
}), _ = (ye = fe.data) == null ? void 0 : ye.data, Ke = (((_e = U({
|
|
533
533
|
queryKey: ["import-collections"],
|
|
534
534
|
queryFn: () => l.request(W("/collections")),
|
|
535
535
|
staleTime: 6e4
|
|
536
|
-
}).data) == null ? void 0 :
|
|
536
|
+
}).data) == null ? void 0 : _e.data) ?? []).filter((t) => !t.collection.toLowerCase().startsWith("nivaro_")).map((t) => ({ value: t.collection, label: t.collection })), ge = U({
|
|
537
537
|
queryKey: ["import-collection-meta", u],
|
|
538
538
|
queryFn: () => l.request(
|
|
539
|
-
W(
|
|
540
|
-
`/collections/${u}`
|
|
541
|
-
)
|
|
539
|
+
W(`/collections/${u}`)
|
|
542
540
|
),
|
|
543
541
|
enabled: !!u,
|
|
544
542
|
staleTime: 6e4
|
|
545
|
-
}).data) == null ? void 0 :
|
|
543
|
+
}), oe = (((Se = (Ce = ge.data) == null ? void 0 : Ce.data) == null ? void 0 : Se.fields) ?? []).filter((t) => !t.hidden).map((t) => t.field), ve = (t) => {
|
|
544
|
+
var M, q, h;
|
|
545
|
+
const o = t ? (h = (q = (M = ge.data) == null ? void 0 : M.data) == null ? void 0 : q.fields) == null ? void 0 : h.find((I) => I.field === t) : void 0, b = `${(o == null ? void 0 : o.special) ?? ""} ${(o == null ? void 0 : o.interface) ?? ""}`.toLowerCase();
|
|
546
|
+
return /m2m|many-to-many/.test(b) ? "Links several: separate names (or ids) with commas" : /m2o|many-to-one/.test(b) ? "Matched by name or id" : null;
|
|
547
|
+
}, ne = K({
|
|
546
548
|
mutationFn: (t) => l.request(
|
|
547
|
-
|
|
549
|
+
L("/imports/from-url", {
|
|
548
550
|
url: t,
|
|
549
551
|
preview: !0
|
|
550
552
|
})
|
|
551
553
|
),
|
|
552
554
|
onSuccess: (t) => {
|
|
553
|
-
|
|
555
|
+
A(null), S(t.data.csv_data), c(t.data.file_name);
|
|
554
556
|
},
|
|
555
|
-
onError: (t) =>
|
|
556
|
-
}), de =
|
|
557
|
+
onError: (t) => A(t.message)
|
|
558
|
+
}), de = K({
|
|
557
559
|
mutationFn: () => l.request(
|
|
558
|
-
|
|
560
|
+
L("/ai/map-columns", {
|
|
559
561
|
collection: u,
|
|
560
562
|
columns: y,
|
|
561
563
|
sample_rows: be.slice(0, 5)
|
|
562
564
|
})
|
|
563
565
|
),
|
|
564
566
|
onSuccess: (t) => {
|
|
565
|
-
var
|
|
566
|
-
const
|
|
567
|
-
for (const
|
|
568
|
-
y.includes(
|
|
569
|
-
|
|
567
|
+
var q;
|
|
568
|
+
const o = ((q = t.data) == null ? void 0 : q.mappings) ?? t.mappings ?? [], b = { ...P }, M = {};
|
|
569
|
+
for (const h of o)
|
|
570
|
+
y.includes(h.column) && (b[h.column] = h.field ?? "", h.field && (M[h.column] = h.confidence ?? 0));
|
|
571
|
+
D(b), H(M), A(null);
|
|
570
572
|
},
|
|
571
|
-
onError: (t) =>
|
|
573
|
+
onError: (t) => A(
|
|
572
574
|
t.status === 503 ? "AI mapping needs an Anthropic API key — add one in Settings, or map the columns by hand." : t.message
|
|
573
575
|
)
|
|
574
|
-
}), ie =
|
|
576
|
+
}), ie = K({
|
|
575
577
|
mutationFn: () => l.request(
|
|
576
|
-
|
|
578
|
+
L("/imports", {
|
|
577
579
|
collection: u,
|
|
578
580
|
csv_data: g,
|
|
579
|
-
column_map:
|
|
580
|
-
transforms: Object.fromEntries(Object.entries(
|
|
581
|
+
column_map: P,
|
|
582
|
+
transforms: Object.fromEntries(Object.entries(x).filter(([, t]) => t)),
|
|
581
583
|
duplicate_strategy: E,
|
|
582
|
-
id_field:
|
|
584
|
+
id_field: R || void 0,
|
|
583
585
|
file_name: p || "import.csv",
|
|
584
|
-
through_items:
|
|
586
|
+
through_items: Q
|
|
585
587
|
})
|
|
586
588
|
),
|
|
587
589
|
onSuccess: (t) => n(t.data.id),
|
|
588
|
-
onError: (t) =>
|
|
590
|
+
onError: (t) => A(t.message)
|
|
589
591
|
});
|
|
590
|
-
function
|
|
591
|
-
|
|
592
|
-
const
|
|
593
|
-
return delete
|
|
592
|
+
function ke(t, o) {
|
|
593
|
+
D((b) => ({ ...b, [t]: o })), O[t] !== void 0 && H((b) => {
|
|
594
|
+
const M = { ...b };
|
|
595
|
+
return delete M[t], M;
|
|
594
596
|
});
|
|
595
597
|
}
|
|
596
|
-
async function
|
|
597
|
-
t && (
|
|
598
|
+
async function we(t) {
|
|
599
|
+
t && (A(null), S(await t.text()), c(t.name));
|
|
598
600
|
}
|
|
599
|
-
const
|
|
600
|
-
const t = g.split(/\r?\n/).filter((
|
|
601
|
+
const z = V(() => {
|
|
602
|
+
const t = g.split(/\r?\n/).filter((q) => q.trim());
|
|
601
603
|
if (t.length < 2) return {};
|
|
602
|
-
const
|
|
603
|
-
return
|
|
604
|
-
let
|
|
605
|
-
for (const
|
|
606
|
-
const B = (
|
|
607
|
-
B && (
|
|
604
|
+
const o = re(t[0]), b = t.slice(1, 2001).map(re), M = {};
|
|
605
|
+
return o.forEach((q, h) => {
|
|
606
|
+
let I = 0, Pe = 0, Me = 0, qe = 0;
|
|
607
|
+
for (const Je of b) {
|
|
608
|
+
const B = (Je[h] ?? "").trim();
|
|
609
|
+
B && (I++, /^-?\$?[\d,]+(\.\d+)?$/.test(B) ? Pe++ : /^\d{4}-\d{2}-\d{2}/.test(B) || /^\d{1,2}\/\d{1,2}\/\d{2,4}$/.test(B) ? Me++ : /^(true|false|yes|no|y|n)$/i.test(B) && qe++);
|
|
608
610
|
}
|
|
609
|
-
const
|
|
610
|
-
q
|
|
611
|
-
}),
|
|
611
|
+
const Be = I === 0 ? "empty" : Pe / I > 0.9 ? "number" : Me / I > 0.9 ? "date" : qe / I > 0.9 ? "boolean" : "text";
|
|
612
|
+
M[q] = { fill: Math.round(I / b.length * 100), guess: Be };
|
|
613
|
+
}), M;
|
|
612
614
|
}, [g]), ce = y.filter((t) => {
|
|
613
|
-
var
|
|
614
|
-
return (
|
|
615
|
-
}).length, Ne =
|
|
616
|
-
return /* @__PURE__ */
|
|
617
|
-
/* @__PURE__ */
|
|
618
|
-
/* @__PURE__ */
|
|
619
|
-
/* @__PURE__ */ e(
|
|
615
|
+
var o;
|
|
616
|
+
return (o = P[t]) == null ? void 0 : o.trim();
|
|
617
|
+
}).length, Ne = ze, Qe = i === 0 ? y.length > 0 : i === 1 ? !!u && ce > 0 : !0;
|
|
618
|
+
return /* @__PURE__ */ r("div", { className: "flex min-h-0 flex-1 flex-col gap-4", children: [
|
|
619
|
+
/* @__PURE__ */ r("div", { className: "flex items-center gap-3", children: [
|
|
620
|
+
/* @__PURE__ */ r(F, { variant: "ghost", size: "sm", className: "h-7 px-2", onClick: d, children: [
|
|
621
|
+
/* @__PURE__ */ e(Re, { className: "h-3.5 w-3.5" }),
|
|
620
622
|
" Back to jobs"
|
|
621
623
|
] }),
|
|
622
|
-
/* @__PURE__ */ e("ol", { className: "flex items-center gap-1.5", children: ue.map((t,
|
|
623
|
-
/* @__PURE__ */
|
|
624
|
+
/* @__PURE__ */ e("ol", { className: "flex items-center gap-1.5", children: ue.map((t, o) => /* @__PURE__ */ r("li", { className: "flex items-center gap-1.5", children: [
|
|
625
|
+
/* @__PURE__ */ r(
|
|
624
626
|
"button",
|
|
625
627
|
{
|
|
626
628
|
type: "button",
|
|
627
|
-
onClick: () =>
|
|
628
|
-
disabled:
|
|
629
|
-
className:
|
|
629
|
+
onClick: () => o < i && s(o),
|
|
630
|
+
disabled: o > i,
|
|
631
|
+
className: k(
|
|
630
632
|
"flex items-center gap-1.5 rounded-md px-2 py-1 text-[12px] font-medium transition-colors",
|
|
631
|
-
|
|
633
|
+
o === i ? "bg-nvr-cyan/15 text-nvr-navy dark:bg-nvr-cyan/20 dark:text-nvr-cyan" : o < i ? "text-slate-600 hover:bg-slate-100 dark:text-muted-foreground dark:hover:bg-muted" : "text-slate-300 dark:text-slate-600"
|
|
632
634
|
),
|
|
633
635
|
children: [
|
|
634
|
-
/* @__PURE__ */ e("span", { className: "tabular-nums", children:
|
|
636
|
+
/* @__PURE__ */ e("span", { className: "tabular-nums", children: o + 1 }),
|
|
635
637
|
t
|
|
636
638
|
]
|
|
637
639
|
}
|
|
638
640
|
),
|
|
639
|
-
|
|
641
|
+
o < ue.length - 1 && /* @__PURE__ */ e("span", { className: "text-slate-300", children: "›" })
|
|
640
642
|
] }, t)) })
|
|
641
643
|
] }),
|
|
642
|
-
/* @__PURE__ */
|
|
643
|
-
i === 0 && /* @__PURE__ */
|
|
644
|
+
/* @__PURE__ */ r("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: [
|
|
645
|
+
i === 0 && /* @__PURE__ */ r("div", { className: "max-w-[980px] space-y-5", children: [
|
|
644
646
|
/* @__PURE__ */ e(
|
|
645
647
|
"input",
|
|
646
648
|
{
|
|
@@ -649,13 +651,13 @@ function Pt({
|
|
|
649
651
|
accept: ".csv,text/csv",
|
|
650
652
|
className: "hidden",
|
|
651
653
|
onChange: (t) => {
|
|
652
|
-
var
|
|
653
|
-
|
|
654
|
+
var o;
|
|
655
|
+
we(((o = t.target.files) == null ? void 0 : o[0]) ?? null), t.target.value = "";
|
|
654
656
|
}
|
|
655
657
|
}
|
|
656
658
|
),
|
|
657
|
-
/* @__PURE__ */
|
|
658
|
-
/* @__PURE__ */
|
|
659
|
+
/* @__PURE__ */ r("div", { className: "grid gap-4 lg:grid-cols-2", children: [
|
|
660
|
+
/* @__PURE__ */ r(
|
|
659
661
|
"button",
|
|
660
662
|
{
|
|
661
663
|
type: "button",
|
|
@@ -668,38 +670,38 @@ function Pt({
|
|
|
668
670
|
},
|
|
669
671
|
onDragLeave: () => se(!1),
|
|
670
672
|
onDrop: (t) => {
|
|
671
|
-
var
|
|
672
|
-
t.preventDefault(), se(!1),
|
|
673
|
+
var o;
|
|
674
|
+
t.preventDefault(), se(!1), we(((o = t.dataTransfer.files) == null ? void 0 : o[0]) ?? null);
|
|
673
675
|
},
|
|
674
|
-
className:
|
|
676
|
+
className: k(
|
|
675
677
|
"flex flex-col items-center justify-center gap-1.5 rounded-md border border-dashed px-4 py-8 transition-colors",
|
|
676
|
-
|
|
678
|
+
Oe ? "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"
|
|
677
679
|
),
|
|
678
680
|
children: [
|
|
679
|
-
/* @__PURE__ */ e(
|
|
681
|
+
/* @__PURE__ */ e(He, { className: "h-4 w-4 text-slate-400" }),
|
|
680
682
|
/* @__PURE__ */ e("span", { className: "text-[12.5px] font-medium text-slate-700 dark:text-foreground", children: "Drop a CSV, or click to choose" }),
|
|
681
683
|
p && /* @__PURE__ */ e("span", { className: "font-mono text-[11px] text-slate-500", children: p })
|
|
682
684
|
]
|
|
683
685
|
}
|
|
684
686
|
),
|
|
685
|
-
/* @__PURE__ */
|
|
686
|
-
/* @__PURE__ */
|
|
687
|
-
/* @__PURE__ */ e(
|
|
687
|
+
/* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
|
|
688
|
+
/* @__PURE__ */ r(J, { className: "flex items-center gap-1.5 text-[11.5px]", children: [
|
|
689
|
+
/* @__PURE__ */ e(Ge, { className: "h-3.5 w-3.5 text-slate-400" }),
|
|
688
690
|
" Or fetch from a URL"
|
|
689
691
|
] }),
|
|
690
|
-
/* @__PURE__ */
|
|
692
|
+
/* @__PURE__ */ r(
|
|
691
693
|
"form",
|
|
692
694
|
{
|
|
693
695
|
className: "flex items-center gap-2",
|
|
694
696
|
onSubmit: (t) => {
|
|
695
|
-
t.preventDefault(), v.trim() &&
|
|
697
|
+
t.preventDefault(), v.trim() && ne.mutate(v.trim());
|
|
696
698
|
},
|
|
697
699
|
children: [
|
|
698
700
|
/* @__PURE__ */ e(
|
|
699
|
-
|
|
701
|
+
Ae,
|
|
700
702
|
{
|
|
701
703
|
value: v,
|
|
702
|
-
onChange: (t) =>
|
|
704
|
+
onChange: (t) => w(t.target.value),
|
|
703
705
|
placeholder: "https://example.com/data.csv",
|
|
704
706
|
className: "h-8 font-mono text-[12px]"
|
|
705
707
|
}
|
|
@@ -711,8 +713,8 @@ function Pt({
|
|
|
711
713
|
variant: "outline",
|
|
712
714
|
size: "sm",
|
|
713
715
|
className: "h-8 shrink-0",
|
|
714
|
-
disabled: !v.trim() ||
|
|
715
|
-
children:
|
|
716
|
+
disabled: !v.trim() || ne.isPending,
|
|
717
|
+
children: ne.isPending ? /* @__PURE__ */ e(me, { className: "h-3.5 w-3.5 animate-spin" }) : "Fetch"
|
|
716
718
|
}
|
|
717
719
|
)
|
|
718
720
|
]
|
|
@@ -721,14 +723,14 @@ function Pt({
|
|
|
721
723
|
/* @__PURE__ */ e("p", { className: "text-[11px] leading-snug text-slate-400", children: "The server fetches it (25MB max, CSV or plain text) so the file never has to round-trip through your machine." })
|
|
722
724
|
] })
|
|
723
725
|
] }),
|
|
724
|
-
/* @__PURE__ */
|
|
726
|
+
/* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
|
|
725
727
|
/* @__PURE__ */ e(J, { className: "text-[11.5px]", children: "Or paste the rows" }),
|
|
726
728
|
/* @__PURE__ */ e(
|
|
727
|
-
|
|
729
|
+
yt,
|
|
728
730
|
{
|
|
729
731
|
value: g,
|
|
730
732
|
onChange: (t) => {
|
|
731
|
-
|
|
733
|
+
S(t.target.value), p || c("pasted.csv");
|
|
732
734
|
},
|
|
733
735
|
rows: 5,
|
|
734
736
|
spellCheck: !1,
|
|
@@ -738,9 +740,9 @@ val1,val2,val3`,
|
|
|
738
740
|
}
|
|
739
741
|
)
|
|
740
742
|
] }),
|
|
741
|
-
y.length > 0 && /* @__PURE__ */
|
|
742
|
-
/* @__PURE__ */
|
|
743
|
-
/* @__PURE__ */ e("span", { className: "font-semibold text-slate-900 dark:text-foreground", children:
|
|
743
|
+
y.length > 0 && /* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
744
|
+
/* @__PURE__ */ r("p", { className: "text-[12px] text-slate-600 dark:text-muted-foreground", children: [
|
|
745
|
+
/* @__PURE__ */ e("span", { className: "font-semibold text-slate-900 dark:text-foreground", children: C(le) }),
|
|
744
746
|
" ",
|
|
745
747
|
"data rows ×",
|
|
746
748
|
" ",
|
|
@@ -748,28 +750,28 @@ val1,val2,val3`,
|
|
|
748
750
|
" ",
|
|
749
751
|
"columns"
|
|
750
752
|
] }),
|
|
751
|
-
/* @__PURE__ */ e(
|
|
753
|
+
/* @__PURE__ */ e($t, { headers: y, rows: be })
|
|
752
754
|
] })
|
|
753
755
|
] }),
|
|
754
756
|
i === 1 && // Bounded width: a mapping row is a form field, and stretching the
|
|
755
757
|
// pickers to a 1600px viewport puts the CSV column and the field it
|
|
756
758
|
// maps to half a screen apart.
|
|
757
|
-
/* @__PURE__ */
|
|
758
|
-
/* @__PURE__ */
|
|
759
|
-
/* @__PURE__ */
|
|
759
|
+
/* @__PURE__ */ r("div", { className: "max-w-[860px] space-y-4", children: [
|
|
760
|
+
/* @__PURE__ */ r("div", { className: "flex flex-wrap items-end justify-between gap-3", children: [
|
|
761
|
+
/* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
|
|
760
762
|
/* @__PURE__ */ e(J, { className: "text-[11.5px]", children: "Target collection" }),
|
|
761
763
|
/* @__PURE__ */ e("div", { className: "w-[260px]", children: /* @__PURE__ */ e(
|
|
762
764
|
X,
|
|
763
765
|
{
|
|
764
766
|
value: u,
|
|
765
|
-
onChange:
|
|
766
|
-
options:
|
|
767
|
+
onChange: $,
|
|
768
|
+
options: Ke,
|
|
767
769
|
placeholder: "Choose a collection…"
|
|
768
770
|
}
|
|
769
771
|
) }),
|
|
770
772
|
/* @__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." })
|
|
771
773
|
] }),
|
|
772
|
-
/* @__PURE__ */
|
|
774
|
+
/* @__PURE__ */ r(
|
|
773
775
|
F,
|
|
774
776
|
{
|
|
775
777
|
variant: "outline",
|
|
@@ -778,86 +780,89 @@ val1,val2,val3`,
|
|
|
778
780
|
disabled: !u || y.length === 0 || de.isPending,
|
|
779
781
|
onClick: () => de.mutate(),
|
|
780
782
|
children: [
|
|
781
|
-
de.isPending ? /* @__PURE__ */ e(me, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(
|
|
783
|
+
de.isPending ? /* @__PURE__ */ e(me, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(Ze, { className: "h-3.5 w-3.5 text-nvr-cyan" }),
|
|
782
784
|
"Match columns with AI"
|
|
783
785
|
]
|
|
784
786
|
}
|
|
785
787
|
)
|
|
786
788
|
] }),
|
|
787
|
-
/* @__PURE__ */ e("div", { className: "overflow-hidden rounded-md border border-slate-200 dark:border-border", children: /* @__PURE__ */
|
|
788
|
-
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */
|
|
789
|
+
/* @__PURE__ */ e("div", { className: "overflow-hidden rounded-md border border-slate-200 dark:border-border", children: /* @__PURE__ */ r("table", { className: "w-full border-collapse", children: [
|
|
790
|
+
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ r("tr", { className: "bg-slate-50 dark:bg-muted/40", children: [
|
|
789
791
|
/* @__PURE__ */ e("th", { className: "w-[45%] border-b border-slate-200 px-3 py-1.5 text-left text-[10.5px] font-medium uppercase tracking-wide text-slate-400 dark:border-border", children: "CSV column" }),
|
|
790
792
|
/* @__PURE__ */ e("th", { className: "border-b border-slate-200 px-3 py-1.5 text-left text-[10.5px] font-medium uppercase tracking-wide text-slate-400 dark:border-border", children: "Collection field" })
|
|
791
793
|
] }) }),
|
|
792
|
-
/* @__PURE__ */ e("tbody", { children: y.map((t) => /* @__PURE__ */
|
|
794
|
+
/* @__PURE__ */ e("tbody", { children: y.map((t) => /* @__PURE__ */ r(
|
|
793
795
|
"tr",
|
|
794
796
|
{
|
|
795
797
|
className: "border-b border-slate-100 last:border-b-0 dark:border-border/60",
|
|
796
798
|
children: [
|
|
797
|
-
/* @__PURE__ */
|
|
799
|
+
/* @__PURE__ */ r("td", { className: "px-3 py-1.5 font-mono text-[11.5px] text-slate-600 dark:text-muted-foreground", children: [
|
|
798
800
|
t,
|
|
799
|
-
|
|
801
|
+
z[t] && /* @__PURE__ */ r(
|
|
800
802
|
"span",
|
|
801
803
|
{
|
|
802
|
-
className:
|
|
804
|
+
className: k(
|
|
803
805
|
"ml-2 rounded px-1 py-0.5 font-sans text-[9.5px] font-medium",
|
|
804
|
-
|
|
806
|
+
z[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"
|
|
805
807
|
),
|
|
806
|
-
"data-tip": `${
|
|
808
|
+
"data-tip": `${z[t].fill}% of rows have a value · looks like ${z[t].guess}`,
|
|
807
809
|
children: [
|
|
808
|
-
|
|
810
|
+
z[t].guess,
|
|
809
811
|
" · ",
|
|
810
|
-
|
|
812
|
+
z[t].fill,
|
|
811
813
|
"%"
|
|
812
814
|
]
|
|
813
815
|
}
|
|
814
816
|
)
|
|
815
817
|
] }),
|
|
816
|
-
/* @__PURE__ */
|
|
817
|
-
/* @__PURE__ */
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
818
|
+
/* @__PURE__ */ r("td", { className: "px-3 py-1.5", children: [
|
|
819
|
+
/* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
820
|
+
/* @__PURE__ */ e("div", { className: "w-[220px]", children: oe.length > 0 ? /* @__PURE__ */ e(
|
|
821
|
+
X,
|
|
822
|
+
{
|
|
823
|
+
value: P[t] ?? "",
|
|
824
|
+
onChange: (o) => ke(t, o),
|
|
825
|
+
options: [
|
|
826
|
+
{ value: "", label: "— skip this column —" },
|
|
827
|
+
...oe.map((o) => ({ value: o, label: o }))
|
|
828
|
+
],
|
|
829
|
+
placeholder: "— skip this column —"
|
|
830
|
+
}
|
|
831
|
+
) : /* @__PURE__ */ e(
|
|
832
|
+
Ae,
|
|
833
|
+
{
|
|
834
|
+
value: P[t] ?? "",
|
|
835
|
+
onChange: (o) => ke(t, o.target.value),
|
|
836
|
+
placeholder: "field_name",
|
|
837
|
+
className: "h-8 font-mono text-[12px]"
|
|
838
|
+
}
|
|
839
|
+
) }),
|
|
840
|
+
O[t] !== void 0 && P[t] && /* @__PURE__ */ e(Mt, { confidence: O[t] }),
|
|
841
|
+
P[t] && /* @__PURE__ */ e("div", { className: "w-[120px]", children: /* @__PURE__ */ e(
|
|
842
|
+
X,
|
|
843
|
+
{
|
|
844
|
+
value: x[t] ?? "",
|
|
845
|
+
onChange: (o) => T((b) => ({ ...b, [t]: o })),
|
|
846
|
+
options: [
|
|
847
|
+
{ value: "", label: "As-is" },
|
|
848
|
+
{ value: "trim", label: "Trim" },
|
|
849
|
+
{ value: "upper", label: "UPPERCASE" },
|
|
850
|
+
{ value: "lower", label: "lowercase" },
|
|
851
|
+
{ value: "title", label: "Title Case" },
|
|
852
|
+
{ value: "null_empty", label: "Empty → null" }
|
|
853
|
+
],
|
|
854
|
+
placeholder: "As-is"
|
|
855
|
+
}
|
|
856
|
+
) })
|
|
857
|
+
] }),
|
|
858
|
+
ve(P[t]) && /* @__PURE__ */ e("p", { className: "mt-1 text-[11px] text-slate-500 dark:text-muted-foreground", children: ve(P[t]) })
|
|
859
|
+
] })
|
|
855
860
|
]
|
|
856
861
|
},
|
|
857
862
|
t
|
|
858
863
|
)) })
|
|
859
864
|
] }) }),
|
|
860
|
-
/* @__PURE__ */
|
|
865
|
+
/* @__PURE__ */ r("p", { className: "text-[11.5px] text-slate-500 dark:text-muted-foreground", children: [
|
|
861
866
|
ce,
|
|
862
867
|
" of ",
|
|
863
868
|
y.length,
|
|
@@ -865,11 +870,11 @@ val1,val2,val3`,
|
|
|
865
870
|
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 })
|
|
866
871
|
] })
|
|
867
872
|
] }),
|
|
868
|
-
i === 2 && /* @__PURE__ */
|
|
869
|
-
/* @__PURE__ */
|
|
873
|
+
i === 2 && /* @__PURE__ */ r("div", { className: "max-w-[520px] space-y-4", children: [
|
|
874
|
+
/* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
|
|
870
875
|
/* @__PURE__ */ e(J, { className: "text-[11.5px]", children: "When a record already exists" }),
|
|
871
876
|
/* @__PURE__ */ e(
|
|
872
|
-
|
|
877
|
+
vt,
|
|
873
878
|
{
|
|
874
879
|
value: E,
|
|
875
880
|
onChange: G,
|
|
@@ -882,32 +887,32 @@ val1,val2,val3`,
|
|
|
882
887
|
}
|
|
883
888
|
)
|
|
884
889
|
] }),
|
|
885
|
-
/* @__PURE__ */
|
|
890
|
+
/* @__PURE__ */ r("div", { className: "flex items-start gap-2.5 rounded-md border border-slate-200 bg-white px-3 py-2 dark:border-border dark:bg-card", children: [
|
|
886
891
|
/* @__PURE__ */ e(
|
|
887
892
|
Nt,
|
|
888
893
|
{
|
|
889
894
|
id: "csv-through-items",
|
|
890
|
-
checked:
|
|
891
|
-
onCheckedChange:
|
|
895
|
+
checked: Q,
|
|
896
|
+
onCheckedChange: a,
|
|
892
897
|
className: "mt-0.5",
|
|
893
898
|
"data-csv-through-items": !0
|
|
894
899
|
}
|
|
895
900
|
),
|
|
896
|
-
/* @__PURE__ */
|
|
901
|
+
/* @__PURE__ */ r("label", { htmlFor: "csv-through-items", className: "cursor-pointer", children: [
|
|
897
902
|
/* @__PURE__ */ e("span", { className: "block text-[12px] font-medium text-slate-800 dark:text-foreground", children: "Apply rules and keep history" }),
|
|
898
903
|
/* @__PURE__ */ e("span", { className: "block text-[11px] leading-snug text-slate-500 dark:text-muted-foreground", children: "Each row is saved the way the form saves it: field rules, validation, automations, and a revision on every record, credited to you. Rows that break a rule are reported instead of written. Unchanged fields are left alone. Slower on large files." })
|
|
899
904
|
] })
|
|
900
905
|
] }),
|
|
901
|
-
/* @__PURE__ */
|
|
906
|
+
/* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
|
|
902
907
|
/* @__PURE__ */ e(J, { className: "text-[11.5px]", children: "Match records on" }),
|
|
903
908
|
/* @__PURE__ */ e(
|
|
904
909
|
X,
|
|
905
910
|
{
|
|
906
|
-
value:
|
|
911
|
+
value: R,
|
|
907
912
|
onChange: Z,
|
|
908
913
|
options: [
|
|
909
914
|
{ value: "", label: "— always create new records —" },
|
|
910
|
-
...
|
|
915
|
+
...oe.map((t) => ({ value: t, label: t }))
|
|
911
916
|
],
|
|
912
917
|
placeholder: "— always create new records —",
|
|
913
918
|
className: "w-[260px]"
|
|
@@ -916,62 +921,62 @@ val1,val2,val3`,
|
|
|
916
921
|
/* @__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." })
|
|
917
922
|
] })
|
|
918
923
|
] }),
|
|
919
|
-
i === 3 && /* @__PURE__ */
|
|
924
|
+
i === 3 && /* @__PURE__ */ r("div", { className: "max-w-[620px] space-y-4", children: [
|
|
920
925
|
fe.isLoading && /* @__PURE__ */ e("p", { className: "text-[12px] text-slate-400", children: "Comparing against the live data…" }),
|
|
921
|
-
|
|
922
|
-
/* @__PURE__ */
|
|
926
|
+
_ && /* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
927
|
+
/* @__PURE__ */ r("div", { className: "flex flex-wrap gap-2", children: [
|
|
923
928
|
[
|
|
924
929
|
{
|
|
925
930
|
label: "new",
|
|
926
|
-
n:
|
|
931
|
+
n: _.new,
|
|
927
932
|
cls: "border-emerald-300 text-emerald-700 dark:border-emerald-500/40 dark:text-emerald-400"
|
|
928
933
|
},
|
|
929
934
|
{
|
|
930
935
|
label: "changed",
|
|
931
|
-
n:
|
|
936
|
+
n: _.changed,
|
|
932
937
|
cls: "border-amber-300 text-amber-700 dark:border-amber-500/40 dark:text-amber-400"
|
|
933
938
|
},
|
|
934
939
|
{
|
|
935
|
-
label:
|
|
936
|
-
n:
|
|
940
|
+
label: _.conflicts === 1 ? "conflict" : "conflicts",
|
|
941
|
+
n: _.conflicts,
|
|
937
942
|
cls: "border-red-300 text-red-700 dark:border-red-500/40 dark:text-red-400"
|
|
938
943
|
},
|
|
939
944
|
{
|
|
940
945
|
label: "unchanged",
|
|
941
|
-
n:
|
|
946
|
+
n: _.unchanged,
|
|
942
947
|
cls: "border-slate-200 text-slate-500 dark:border-border dark:text-slate-400"
|
|
943
948
|
}
|
|
944
|
-
].map((t) => /* @__PURE__ */
|
|
949
|
+
].map((t) => /* @__PURE__ */ r(
|
|
945
950
|
"span",
|
|
946
951
|
{
|
|
947
|
-
className:
|
|
952
|
+
className: k(
|
|
948
953
|
"inline-flex items-center gap-1.5 rounded-full border bg-white px-2.5 py-1 text-[12px] font-medium dark:bg-card",
|
|
949
954
|
t.cls
|
|
950
955
|
),
|
|
951
956
|
children: [
|
|
952
|
-
/* @__PURE__ */ e("span", { className: "tabular-nums", children:
|
|
957
|
+
/* @__PURE__ */ e("span", { className: "tabular-nums", children: C(t.n) }),
|
|
953
958
|
" ",
|
|
954
959
|
t.label
|
|
955
960
|
]
|
|
956
961
|
},
|
|
957
962
|
t.label
|
|
958
963
|
)),
|
|
959
|
-
|
|
964
|
+
_.truncated && /* @__PURE__ */ r("span", { className: "self-center text-[11px] text-slate-400", children: [
|
|
960
965
|
"(first ",
|
|
961
|
-
_
|
|
966
|
+
C(_.total),
|
|
962
967
|
" rows scanned)"
|
|
963
968
|
] })
|
|
964
969
|
] }),
|
|
965
|
-
|
|
970
|
+
_.diffs.length > 0 && /* @__PURE__ */ e("div", { className: "max-h-56 overflow-y-auto rounded-md border border-slate-200 dark:border-border", children: _.diffs.map((t) => /* @__PURE__ */ r(
|
|
966
971
|
"div",
|
|
967
972
|
{
|
|
968
973
|
className: "border-b border-slate-100 px-3 py-2 text-[12px] last:border-b-0 dark:border-border/60",
|
|
969
974
|
children: [
|
|
970
|
-
/* @__PURE__ */
|
|
975
|
+
/* @__PURE__ */ r("p", { className: "flex items-center gap-2", children: [
|
|
971
976
|
/* @__PURE__ */ e(
|
|
972
977
|
"span",
|
|
973
978
|
{
|
|
974
|
-
className:
|
|
979
|
+
className: k(
|
|
975
980
|
"rounded px-1.5 py-0.5 text-[10.5px] font-semibold uppercase tracking-wide",
|
|
976
981
|
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"
|
|
977
982
|
),
|
|
@@ -979,32 +984,51 @@ val1,val2,val3`,
|
|
|
979
984
|
}
|
|
980
985
|
),
|
|
981
986
|
/* @__PURE__ */ e("span", { className: "font-mono text-[11.5px]", children: t.id }),
|
|
982
|
-
/* @__PURE__ */
|
|
987
|
+
/* @__PURE__ */ r("span", { className: "text-[11px] text-slate-400", children: [
|
|
983
988
|
"row ",
|
|
984
989
|
t.row
|
|
985
990
|
] })
|
|
986
991
|
] }),
|
|
987
992
|
t.reason && /* @__PURE__ */ e("p", { className: "mt-0.5 text-[11px] text-slate-500 dark:text-muted-foreground", children: t.reason }),
|
|
988
|
-
t.fields.map((
|
|
989
|
-
/* @__PURE__ */
|
|
990
|
-
|
|
993
|
+
t.fields.map((o) => /* @__PURE__ */ r("p", { className: "mt-0.5 font-mono text-[11px]", children: [
|
|
994
|
+
/* @__PURE__ */ r("span", { className: "text-slate-400", children: [
|
|
995
|
+
o.field,
|
|
991
996
|
":"
|
|
992
997
|
] }),
|
|
993
998
|
" ",
|
|
994
|
-
/* @__PURE__ */ e("span", { className: "text-red-600 line-through dark:text-red-400", children: String(
|
|
999
|
+
/* @__PURE__ */ e("span", { className: "text-red-600 line-through dark:text-red-400", children: String(o.old ?? "—") }),
|
|
995
1000
|
" ",
|
|
996
|
-
/* @__PURE__ */ e("span", { className: "text-emerald-600 dark:text-emerald-400", children: String(
|
|
997
|
-
] },
|
|
1001
|
+
/* @__PURE__ */ e("span", { className: "text-emerald-600 dark:text-emerald-400", children: String(o.new ?? "—") })
|
|
1002
|
+
] }, o.field))
|
|
998
1003
|
]
|
|
999
1004
|
},
|
|
1000
1005
|
`${t.row}-${t.id}`
|
|
1001
1006
|
)) }),
|
|
1002
|
-
|
|
1007
|
+
_.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." }),
|
|
1008
|
+
(_.link_error_rows ?? 0) > 0 && /* @__PURE__ */ r("div", { className: "rounded-md border border-red-200 bg-red-50 px-3 py-2 dark:border-red-500/30 dark:bg-red-500/10", children: [
|
|
1009
|
+
/* @__PURE__ */ r("p", { className: "text-[12px] font-medium text-red-700 dark:text-red-300", children: [
|
|
1010
|
+
C(_.link_error_rows ?? 0),
|
|
1011
|
+
" ",
|
|
1012
|
+
_.link_error_rows === 1 ? "row names" : "rows name",
|
|
1013
|
+
" a record that does not exist — ",
|
|
1014
|
+
_.link_error_rows === 1 ? "it" : "they",
|
|
1015
|
+
" will not be imported"
|
|
1016
|
+
] }),
|
|
1017
|
+
/* @__PURE__ */ e("ul", { className: "mt-1 max-h-32 space-y-0.5 overflow-y-auto text-[11.5px] text-red-700 dark:text-red-300", children: (_.link_problems ?? []).map((t) => /* @__PURE__ */ r("li", { children: [
|
|
1018
|
+
/* @__PURE__ */ r("span", { className: "text-red-500/80 dark:text-red-400/70", children: [
|
|
1019
|
+
"Row ",
|
|
1020
|
+
t.row,
|
|
1021
|
+
":"
|
|
1022
|
+
] }),
|
|
1023
|
+
" ",
|
|
1024
|
+
t.error
|
|
1025
|
+
] }, `${t.row}-${t.error}`)) })
|
|
1026
|
+
] })
|
|
1003
1027
|
] }),
|
|
1004
1028
|
/* @__PURE__ */ e("div", { className: "overflow-hidden rounded-md border border-slate-200 dark:border-border", children: [
|
|
1005
1029
|
{ label: "File", value: p || "pasted.csv", mono: !0 },
|
|
1006
1030
|
{ label: "Collection", value: u, mono: !0 },
|
|
1007
|
-
{ label: "Data rows", value:
|
|
1031
|
+
{ label: "Data rows", value: C(le) },
|
|
1008
1032
|
{ label: "Mapped columns", value: `${ce} of ${y.length}` },
|
|
1009
1033
|
{
|
|
1010
1034
|
label: "Duplicates",
|
|
@@ -1012,10 +1036,10 @@ val1,val2,val3`,
|
|
|
1012
1036
|
},
|
|
1013
1037
|
{
|
|
1014
1038
|
label: "Matched on",
|
|
1015
|
-
value:
|
|
1016
|
-
mono: !!
|
|
1039
|
+
value: R || "nothing — every row is new",
|
|
1040
|
+
mono: !!R
|
|
1017
1041
|
}
|
|
1018
|
-
].map((t) => /* @__PURE__ */
|
|
1042
|
+
].map((t) => /* @__PURE__ */ r(
|
|
1019
1043
|
"div",
|
|
1020
1044
|
{
|
|
1021
1045
|
className: "flex items-center gap-4 border-b border-slate-100 px-3.5 py-2 last:border-b-0 dark:border-border/60",
|
|
@@ -1024,7 +1048,7 @@ val1,val2,val3`,
|
|
|
1024
1048
|
/* @__PURE__ */ e(
|
|
1025
1049
|
"span",
|
|
1026
1050
|
{
|
|
1027
|
-
className:
|
|
1051
|
+
className: k(
|
|
1028
1052
|
"truncate text-[12.5px] text-slate-800 dark:text-foreground",
|
|
1029
1053
|
t.mono && "font-mono text-[12px]"
|
|
1030
1054
|
),
|
|
@@ -1035,9 +1059,9 @@ val1,val2,val3`,
|
|
|
1035
1059
|
},
|
|
1036
1060
|
t.label
|
|
1037
1061
|
)) }),
|
|
1038
|
-
/* @__PURE__ */
|
|
1062
|
+
/* @__PURE__ */ r("p", { className: "text-[12px] leading-relaxed text-slate-500 dark:text-muted-foreground", children: [
|
|
1039
1063
|
"Starting the import writes ",
|
|
1040
|
-
|
|
1064
|
+
C(le),
|
|
1041
1065
|
" rows into",
|
|
1042
1066
|
" ",
|
|
1043
1067
|
/* @__PURE__ */ e("span", { className: "font-mono text-slate-700 dark:text-foreground", children: u }),
|
|
@@ -1046,18 +1070,18 @@ val1,val2,val3`,
|
|
|
1046
1070
|
] })
|
|
1047
1071
|
] })
|
|
1048
1072
|
] }),
|
|
1049
|
-
/* @__PURE__ */
|
|
1050
|
-
i > 0 && /* @__PURE__ */
|
|
1051
|
-
/* @__PURE__ */ e(
|
|
1073
|
+
/* @__PURE__ */ r("div", { className: "flex shrink-0 items-center gap-2", children: [
|
|
1074
|
+
i > 0 && /* @__PURE__ */ r(F, { variant: "ghost", size: "sm", onClick: () => s((t) => t - 1), children: [
|
|
1075
|
+
/* @__PURE__ */ e(Re, { className: "h-3.5 w-3.5" }),
|
|
1052
1076
|
" Back"
|
|
1053
1077
|
] }),
|
|
1054
|
-
|
|
1055
|
-
/* @__PURE__ */
|
|
1056
|
-
/* @__PURE__ */ e(F, { variant: "ghost", size: "sm", onClick:
|
|
1057
|
-
i < ue.length - 1 ? /* @__PURE__ */
|
|
1078
|
+
N && /* @__PURE__ */ e("p", { className: "text-[12px] text-red-600 dark:text-red-400", children: N }),
|
|
1079
|
+
/* @__PURE__ */ r("div", { className: "ml-auto flex items-center gap-2", children: [
|
|
1080
|
+
/* @__PURE__ */ e(F, { variant: "ghost", size: "sm", onClick: d, children: "Cancel" }),
|
|
1081
|
+
i < ue.length - 1 ? /* @__PURE__ */ r(F, { size: "sm", disabled: !Qe, onClick: () => s((t) => t + 1), children: [
|
|
1058
1082
|
"Next ",
|
|
1059
|
-
/* @__PURE__ */ e(
|
|
1060
|
-
] }) : /* @__PURE__ */ e(F, { size: "sm", disabled: ie.isPending, onClick: () => ie.mutate(), children: ie.isPending ? /* @__PURE__ */
|
|
1083
|
+
/* @__PURE__ */ e(Ee, { className: "h-3.5 w-3.5" })
|
|
1084
|
+
] }) : /* @__PURE__ */ e(F, { size: "sm", disabled: ie.isPending, onClick: () => ie.mutate(), children: ie.isPending ? /* @__PURE__ */ r(Ve, { children: [
|
|
1061
1085
|
/* @__PURE__ */ e(me, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
1062
1086
|
" Starting…"
|
|
1063
1087
|
] }) : "Start import" })
|
|
@@ -1065,9 +1089,9 @@ val1,val2,val3`,
|
|
|
1065
1089
|
] })
|
|
1066
1090
|
] });
|
|
1067
1091
|
}
|
|
1068
|
-
function
|
|
1069
|
-
return /* @__PURE__ */ e("div", { className: "overflow-x-auto rounded-md border border-slate-200 dark:border-border", children: /* @__PURE__ */
|
|
1070
|
-
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { className: "bg-slate-50 dark:bg-muted/40", children:
|
|
1092
|
+
function $t({ headers: d, rows: n }) {
|
|
1093
|
+
return /* @__PURE__ */ e("div", { className: "overflow-x-auto rounded-md border border-slate-200 dark:border-border", children: /* @__PURE__ */ r("table", { className: "w-full border-collapse", children: [
|
|
1094
|
+
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { className: "bg-slate-50 dark:bg-muted/40", children: d.map((l) => /* @__PURE__ */ e(
|
|
1071
1095
|
"th",
|
|
1072
1096
|
{
|
|
1073
1097
|
className: "whitespace-nowrap border-b border-slate-200 px-2.5 py-1.5 text-left font-mono text-[10.5px] font-medium text-slate-500 dark:border-border dark:text-muted-foreground",
|
|
@@ -1077,7 +1101,7 @@ function qt({ headers: o, rows: n }) {
|
|
|
1077
1101
|
)) }) }),
|
|
1078
1102
|
/* @__PURE__ */ e("tbody", { children: n.map((l, m) => (
|
|
1079
1103
|
// eslint-disable-next-line react/no-array-index-key
|
|
1080
|
-
/* @__PURE__ */ e("tr", { className: "border-b border-slate-100 last:border-b-0 dark:border-border/60", children:
|
|
1104
|
+
/* @__PURE__ */ e("tr", { className: "border-b border-slate-100 last:border-b-0 dark:border-border/60", children: d.map((i, s) => /* @__PURE__ */ e(
|
|
1081
1105
|
"td",
|
|
1082
1106
|
{
|
|
1083
1107
|
className: "max-w-[200px] truncate whitespace-nowrap px-2.5 py-1 font-mono text-[11px] text-slate-700 dark:text-foreground",
|
|
@@ -1089,22 +1113,22 @@ function qt({ headers: o, rows: n }) {
|
|
|
1089
1113
|
)) })
|
|
1090
1114
|
] }) });
|
|
1091
1115
|
}
|
|
1092
|
-
function
|
|
1093
|
-
var
|
|
1094
|
-
const l =
|
|
1095
|
-
queryKey: ["collection-import-job",
|
|
1096
|
-
queryFn: () => m.request(W(`/imports/${
|
|
1097
|
-
enabled: !!
|
|
1116
|
+
function Rt({ jobId: d, onClose: n }) {
|
|
1117
|
+
var x, T;
|
|
1118
|
+
const l = rt(), m = ae(), s = (x = U({
|
|
1119
|
+
queryKey: ["collection-import-job", d],
|
|
1120
|
+
queryFn: () => m.request(W(`/imports/${d}`)),
|
|
1121
|
+
enabled: !!d,
|
|
1098
1122
|
refetchInterval: (p) => {
|
|
1099
|
-
var c, v,
|
|
1100
|
-
return ((v = (c = p.state.data) == null ? void 0 : c.data) == null ? void 0 : v.status) === "processing" || ((u = (
|
|
1123
|
+
var c, v, w, u;
|
|
1124
|
+
return ((v = (c = p.state.data) == null ? void 0 : c.data) == null ? void 0 : v.status) === "processing" || ((u = (w = p.state.data) == null ? void 0 : w.data) == null ? void 0 : u.status) === "pending" ? 2e3 : !1;
|
|
1101
1125
|
}
|
|
1102
|
-
}).data) == null ? void 0 :
|
|
1103
|
-
return /* @__PURE__ */ e(
|
|
1104
|
-
/* @__PURE__ */
|
|
1105
|
-
/* @__PURE__ */ e(
|
|
1126
|
+
}).data) == null ? void 0 : x.data, g = Array.isArray(s == null ? void 0 : s.errors) ? s.errors : [], S = 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;
|
|
1127
|
+
return /* @__PURE__ */ e(kt, { open: !!d, onOpenChange: (p) => !p && n(), children: /* @__PURE__ */ e(wt, { side: "right", className: "w-[min(560px,94vw)] p-0 sm:max-w-none", children: s ? /* @__PURE__ */ r("div", { className: "flex h-full flex-col", children: [
|
|
1128
|
+
/* @__PURE__ */ r("header", { className: "shrink-0 border-b border-slate-200 px-5 py-4 dark:border-border", children: [
|
|
1129
|
+
/* @__PURE__ */ e(Le, { status: s.status }),
|
|
1106
1130
|
/* @__PURE__ */ e("h2", { className: "mt-1.5 truncate font-mono text-[15px] font-semibold text-slate-900 dark:text-foreground", children: s.file_name }),
|
|
1107
|
-
/* @__PURE__ */
|
|
1131
|
+
/* @__PURE__ */ r("p", { className: "text-[11.5px] text-slate-400", children: [
|
|
1108
1132
|
"into ",
|
|
1109
1133
|
/* @__PURE__ */ e("span", { className: "font-mono", children: s.collection }),
|
|
1110
1134
|
" ·",
|
|
@@ -1112,30 +1136,30 @@ function Mt({ jobId: o, onClose: n }) {
|
|
|
1112
1136
|
te(s.created_at)
|
|
1113
1137
|
] })
|
|
1114
1138
|
] }),
|
|
1115
|
-
/* @__PURE__ */
|
|
1116
|
-
/* @__PURE__ */
|
|
1117
|
-
/* @__PURE__ */
|
|
1139
|
+
/* @__PURE__ */ r("div", { className: "min-h-0 flex-1 space-y-5 overflow-y-auto px-5 py-4", children: [
|
|
1140
|
+
/* @__PURE__ */ r("section", { className: "space-y-2", children: [
|
|
1141
|
+
/* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
|
|
1118
1142
|
/* @__PURE__ */ e("h3", { className: "text-[11.5px] font-semibold text-slate-500 dark:text-muted-foreground", children: "Progress" }),
|
|
1119
|
-
/* @__PURE__ */
|
|
1120
|
-
|
|
1143
|
+
/* @__PURE__ */ r("span", { className: "text-[12px] font-medium tabular-nums text-slate-700 dark:text-foreground", children: [
|
|
1144
|
+
S,
|
|
1121
1145
|
"%"
|
|
1122
1146
|
] })
|
|
1123
1147
|
] }),
|
|
1124
1148
|
/* @__PURE__ */ e("div", { className: "h-2 overflow-hidden rounded-full bg-slate-100 dark:bg-muted", children: /* @__PURE__ */ e(
|
|
1125
1149
|
"div",
|
|
1126
1150
|
{
|
|
1127
|
-
className:
|
|
1151
|
+
className: k(
|
|
1128
1152
|
"h-full rounded-full transition-[width] duration-500",
|
|
1129
1153
|
s.status === "failed" ? "bg-red-500" : "bg-nvr-cyan"
|
|
1130
1154
|
),
|
|
1131
|
-
style: { width: `${
|
|
1155
|
+
style: { width: `${S}%` }
|
|
1132
1156
|
}
|
|
1133
1157
|
) }),
|
|
1134
|
-
/* @__PURE__ */
|
|
1135
|
-
|
|
1158
|
+
/* @__PURE__ */ r("p", { className: "text-[11.5px] text-slate-500 dark:text-muted-foreground", children: [
|
|
1159
|
+
C(s.processed_rows ?? 0),
|
|
1136
1160
|
" of",
|
|
1137
1161
|
" ",
|
|
1138
|
-
s.total_rows == null ? "?" :
|
|
1162
|
+
s.total_rows == null ? "?" : C(s.total_rows),
|
|
1139
1163
|
" rows processed"
|
|
1140
1164
|
] })
|
|
1141
1165
|
] }),
|
|
@@ -1144,20 +1168,20 @@ function Mt({ jobId: o, onClose: n }) {
|
|
|
1144
1168
|
{ label: "Updated", value: s.updated_rows ?? 0 },
|
|
1145
1169
|
{ label: "Skipped", value: s.skipped_rows ?? 0 },
|
|
1146
1170
|
{ label: "Errors", value: s.error_rows ?? 0, bad: (s.error_rows ?? 0) > 0 }
|
|
1147
|
-
].map((p) => /* @__PURE__ */
|
|
1171
|
+
].map((p) => /* @__PURE__ */ r("div", { className: "bg-white px-3 py-2 dark:bg-card", children: [
|
|
1148
1172
|
/* @__PURE__ */ e("p", { className: "text-[10.5px] text-slate-400", children: p.label }),
|
|
1149
1173
|
/* @__PURE__ */ e(
|
|
1150
1174
|
"p",
|
|
1151
1175
|
{
|
|
1152
|
-
className:
|
|
1176
|
+
className: k(
|
|
1153
1177
|
"text-[15px] font-semibold tabular-nums",
|
|
1154
1178
|
p.bad ? "text-red-600 dark:text-red-400" : "text-slate-900 dark:text-foreground"
|
|
1155
1179
|
),
|
|
1156
|
-
children:
|
|
1180
|
+
children: C(p.value)
|
|
1157
1181
|
}
|
|
1158
1182
|
)
|
|
1159
1183
|
] }, p.label)) }),
|
|
1160
|
-
/* @__PURE__ */
|
|
1184
|
+
/* @__PURE__ */ r("section", { children: [
|
|
1161
1185
|
/* @__PURE__ */ e("h3", { className: "mb-1 text-[11.5px] font-semibold text-slate-500 dark:text-muted-foreground", children: "Settings" }),
|
|
1162
1186
|
[
|
|
1163
1187
|
{ label: "Duplicates", value: s.duplicate_strategy },
|
|
@@ -1174,7 +1198,7 @@ function Mt({ jobId: o, onClose: n }) {
|
|
|
1174
1198
|
label: "Completed",
|
|
1175
1199
|
value: s.completed_at ? te(s.completed_at) : "—"
|
|
1176
1200
|
}
|
|
1177
|
-
].map((p) => /* @__PURE__ */
|
|
1201
|
+
].map((p) => /* @__PURE__ */ r(
|
|
1178
1202
|
"div",
|
|
1179
1203
|
{
|
|
1180
1204
|
className: "flex items-baseline justify-between gap-4 border-b border-slate-100 py-1.5 last:border-b-0 dark:border-border/60",
|
|
@@ -1186,22 +1210,22 @@ function Mt({ jobId: o, onClose: n }) {
|
|
|
1186
1210
|
p.label
|
|
1187
1211
|
))
|
|
1188
1212
|
] }),
|
|
1189
|
-
s.column_map && Object.keys(s.column_map).length > 0 && /* @__PURE__ */
|
|
1213
|
+
s.column_map && Object.keys(s.column_map).length > 0 && /* @__PURE__ */ r("section", { children: [
|
|
1190
1214
|
/* @__PURE__ */ e("h3", { className: "mb-1.5 text-[11.5px] font-semibold text-slate-500 dark:text-muted-foreground", children: "Column mapping" }),
|
|
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__ */
|
|
1215
|
+
/* @__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__ */ r(
|
|
1192
1216
|
"div",
|
|
1193
1217
|
{
|
|
1194
1218
|
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",
|
|
1195
1219
|
children: [
|
|
1196
1220
|
/* @__PURE__ */ e("span", { className: "flex-1 truncate text-slate-500 dark:text-muted-foreground", children: p }),
|
|
1197
|
-
/* @__PURE__ */ e(
|
|
1221
|
+
/* @__PURE__ */ e(Ee, { className: "h-3 w-3 shrink-0 text-slate-300" }),
|
|
1198
1222
|
/* @__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" }) })
|
|
1199
1223
|
]
|
|
1200
1224
|
},
|
|
1201
1225
|
p
|
|
1202
1226
|
)) })
|
|
1203
1227
|
] }),
|
|
1204
|
-
s.created_ids && (((
|
|
1228
|
+
s.created_ids && (((T = s.created_ids) == null ? void 0 : T.length) ?? 0) > 0 && /* @__PURE__ */ e("section", { children: /* @__PURE__ */ r(
|
|
1205
1229
|
"button",
|
|
1206
1230
|
{
|
|
1207
1231
|
type: "button",
|
|
@@ -1228,22 +1252,22 @@ function Mt({ jobId: o, onClose: n }) {
|
|
|
1228
1252
|
] }) : /* @__PURE__ */ e("div", { className: "p-5 text-[12.5px] text-slate-400", children: "Loading job…" }) }) });
|
|
1229
1253
|
}
|
|
1230
1254
|
function Tt({
|
|
1231
|
-
jobId:
|
|
1255
|
+
jobId: d,
|
|
1232
1256
|
errors: n
|
|
1233
1257
|
}) {
|
|
1234
|
-
const l =
|
|
1235
|
-
queryKey: ["import-failed-rows",
|
|
1258
|
+
const l = ae(), [m, i] = f({}), [s, g] = f({}), { data: S } = U({
|
|
1259
|
+
queryKey: ["import-failed-rows", d],
|
|
1236
1260
|
queryFn: () => l.request(
|
|
1237
|
-
W(`/imports/${
|
|
1261
|
+
W(`/imports/${d}/failed-rows`)
|
|
1238
1262
|
).then((c) => c.data ?? []),
|
|
1239
1263
|
staleTime: 3e4
|
|
1240
|
-
}),
|
|
1241
|
-
mutationFn: ({ row: c, values: v }) => l.request(
|
|
1264
|
+
}), x = S ?? [], T = x[0] ? Object.keys(x[0].values) : [], p = K({
|
|
1265
|
+
mutationFn: ({ row: c, values: v }) => l.request(L(`/imports/${d}/repair-row`, { values: v })).then(() => c),
|
|
1242
1266
|
onSuccess: (c) => g((v) => ({ ...v, [c]: "ok" })),
|
|
1243
|
-
onError: (c, v) => g((
|
|
1267
|
+
onError: (c, v) => g((w) => ({ ...w, [v.row]: st(c, "The row was not created") }))
|
|
1244
1268
|
});
|
|
1245
|
-
return
|
|
1246
|
-
/* @__PURE__ */
|
|
1269
|
+
return x.length === 0 ? /* @__PURE__ */ r("section", { children: [
|
|
1270
|
+
/* @__PURE__ */ r("h3", { className: "mb-1.5 text-[11.5px] font-semibold text-red-700 dark:text-red-400", children: [
|
|
1247
1271
|
"Row errors (",
|
|
1248
1272
|
n.length,
|
|
1249
1273
|
")"
|
|
@@ -1252,8 +1276,8 @@ function Tt({
|
|
|
1252
1276
|
"div",
|
|
1253
1277
|
{
|
|
1254
1278
|
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",
|
|
1255
|
-
children: /* @__PURE__ */
|
|
1256
|
-
/* @__PURE__ */
|
|
1279
|
+
children: /* @__PURE__ */ r("span", { className: "text-red-700 dark:text-red-400", children: [
|
|
1280
|
+
/* @__PURE__ */ r("span", { className: "font-medium tabular-nums", children: [
|
|
1257
1281
|
"Row ",
|
|
1258
1282
|
c.row,
|
|
1259
1283
|
":"
|
|
@@ -1264,39 +1288,39 @@ function Tt({
|
|
|
1264
1288
|
},
|
|
1265
1289
|
`${c.row}-${c.error}`
|
|
1266
1290
|
)) })
|
|
1267
|
-
] }) : /* @__PURE__ */
|
|
1268
|
-
/* @__PURE__ */
|
|
1291
|
+
] }) : /* @__PURE__ */ r("section", { children: [
|
|
1292
|
+
/* @__PURE__ */ r("h3", { className: "mb-1.5 text-[11.5px] font-semibold text-red-700 dark:text-red-400", children: [
|
|
1269
1293
|
"Failed rows (",
|
|
1270
|
-
|
|
1294
|
+
x.length,
|
|
1271
1295
|
") — fix and resubmit"
|
|
1272
1296
|
] }),
|
|
1273
|
-
/* @__PURE__ */ e("div", { className: "max-h-[320px] overflow-auto rounded-md border border-red-200 dark:border-red-900", children: /* @__PURE__ */
|
|
1274
|
-
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */
|
|
1297
|
+
/* @__PURE__ */ e("div", { className: "max-h-[320px] overflow-auto rounded-md border border-red-200 dark:border-red-900", children: /* @__PURE__ */ r("table", { className: "w-full text-[11.5px]", children: [
|
|
1298
|
+
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ r("tr", { className: "bg-red-50/60 text-left text-[10px] uppercase tracking-wide text-slate-400 dark:bg-red-950/30", children: [
|
|
1275
1299
|
/* @__PURE__ */ e("th", { className: "px-2 py-1", children: "Row" }),
|
|
1276
|
-
|
|
1300
|
+
T.map((c) => /* @__PURE__ */ e("th", { className: "px-2 py-1 font-mono normal-case", children: c }, c)),
|
|
1277
1301
|
/* @__PURE__ */ e("th", { className: "px-2 py-1" })
|
|
1278
1302
|
] }) }),
|
|
1279
|
-
/* @__PURE__ */ e("tbody", { children:
|
|
1280
|
-
const v = m[c.row] ?? c.values,
|
|
1281
|
-
return /* @__PURE__ */
|
|
1303
|
+
/* @__PURE__ */ e("tbody", { children: x.map((c) => {
|
|
1304
|
+
const v = m[c.row] ?? c.values, w = s[c.row];
|
|
1305
|
+
return /* @__PURE__ */ r(
|
|
1282
1306
|
"tr",
|
|
1283
1307
|
{
|
|
1284
1308
|
className: "border-t border-red-100 align-top dark:border-red-900/50",
|
|
1285
1309
|
children: [
|
|
1286
|
-
/* @__PURE__ */
|
|
1310
|
+
/* @__PURE__ */ r("td", { className: "px-2 py-1 font-mono tabular-nums text-slate-400", children: [
|
|
1287
1311
|
c.row,
|
|
1288
1312
|
/* @__PURE__ */ e("p", { className: "max-w-[120px] whitespace-normal text-[10px] text-red-500", children: De(c.error) })
|
|
1289
1313
|
] }),
|
|
1290
|
-
|
|
1314
|
+
T.map((u) => /* @__PURE__ */ e("td", { className: "px-1 py-1", children: /* @__PURE__ */ e(
|
|
1291
1315
|
"input",
|
|
1292
1316
|
{
|
|
1293
1317
|
value: String(v[u] ?? ""),
|
|
1294
|
-
disabled:
|
|
1295
|
-
onChange: (
|
|
1318
|
+
disabled: w === "ok",
|
|
1319
|
+
onChange: ($) => i((P) => ({ ...P, [c.row]: { ...v, [u]: $.target.value } })),
|
|
1296
1320
|
className: "h-6 w-full min-w-[80px] rounded border border-slate-200 bg-background px-1 text-[11px] dark:border-border"
|
|
1297
1321
|
}
|
|
1298
1322
|
) }, u)),
|
|
1299
|
-
/* @__PURE__ */ e("td", { className: "px-2 py-1", children:
|
|
1323
|
+
/* @__PURE__ */ e("td", { className: "px-2 py-1", children: w === "ok" ? /* @__PURE__ */ e("span", { className: "text-[10.5px] font-medium text-emerald-600", children: "✓ Created" }) : /* @__PURE__ */ r("div", { children: [
|
|
1300
1324
|
/* @__PURE__ */ e(
|
|
1301
1325
|
"button",
|
|
1302
1326
|
{
|
|
@@ -1307,7 +1331,7 @@ function Tt({
|
|
|
1307
1331
|
children: "Resubmit"
|
|
1308
1332
|
}
|
|
1309
1333
|
),
|
|
1310
|
-
|
|
1334
|
+
w && w !== "ok" && /* @__PURE__ */ e("p", { className: "max-w-[140px] whitespace-normal text-[9.5px] text-red-500", children: w })
|
|
1311
1335
|
] }) })
|
|
1312
1336
|
]
|
|
1313
1337
|
},
|
|
@@ -1318,7 +1342,7 @@ function Tt({
|
|
|
1318
1342
|
] });
|
|
1319
1343
|
}
|
|
1320
1344
|
export {
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1345
|
+
Yt as CollectionImportPanel,
|
|
1346
|
+
_t as ROLLBACK_QUESTION,
|
|
1347
|
+
Ct as RollbackJobItem
|
|
1324
1348
|
};
|