@nivaro/react 0.3.40 → 0.3.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/LayoutForm.js +100 -98
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +645 -16
- package/dist/index.js +814 -775
- package/dist/shared/components/ActivityEntry.js +154 -0
- package/dist/shared/components/AudienceConfirmPanel.js +98 -0
- package/dist/shared/components/BackgroundRunOffer.js +43 -31
- package/dist/shared/components/BroadcastView.js +225 -204
- package/dist/shared/components/CollectionBrowserView.js +3924 -3584
- package/dist/shared/components/ConfigHistory.js +153 -0
- package/dist/shared/components/ConfigReadBack.js +65 -0
- package/dist/shared/components/DataTable.js +379 -346
- package/dist/shared/components/ForceReloadBanner.js +47 -40
- package/dist/shared/components/IdleReloadWatcher.js +69 -0
- package/dist/shared/components/ItemEditForm.js +4041 -3853
- package/dist/shared/components/MyWorkView.js +278 -213
- package/dist/shared/components/NotificationBell.js +130 -121
- package/dist/shared/components/PickerExcludedRows.js +3 -3
- package/dist/shared/components/ProfileView.js +776 -1003
- package/dist/shared/components/RecentRecordsRail.js +34 -16
- package/dist/shared/components/RecordReadView.js +500 -477
- package/dist/shared/components/Skeletons.js +199 -0
- package/dist/shared/components/SlowNotice.js +63 -0
- package/dist/shared/components/Term.js +23 -0
- package/dist/shared/components/WidgetSlot.js +350 -353
- package/dist/shared/components/access/PermissionSummary.js +106 -0
- package/dist/shared/components/bulk/BulkActionButtons.js +76 -73
- package/dist/shared/components/chat/ChatPanel.js +902 -886
- package/dist/shared/components/chat/MemberPaging.js +70 -0
- package/dist/shared/components/chat/RoomParts.js +147 -117
- package/dist/shared/components/chat/ScreenClip.js +73 -69
- package/dist/shared/components/chat/chat-core.js +449 -396
- package/dist/shared/components/chat/huddle/huddle-store.js +48 -43
- package/dist/shared/components/help-videos/api.js +2 -5
- package/dist/shared/components/help-videos/viewer/HelpVideoMatchChip.js +79 -0
- package/dist/shared/components/help-videos/viewer/matchChip.js +50 -0
- package/dist/shared/components/imports/CollectionImportPanel.js +139 -133
- package/dist/shared/components/imports/RunDetailSheet.js +222 -227
- package/dist/shared/components/integrations/console/ErrorExplanation.js +121 -0
- package/dist/shared/components/integrations/console/PartnerDetail.js +175 -174
- package/dist/shared/components/integrations/console/SubmissionRow.js +36 -34
- package/dist/shared/components/integrations/console/drill/SubmissionDrill.js +50 -48
- package/dist/shared/components/item-edit/FieldComments.js +212 -0
- package/dist/shared/components/item-edit/FieldRow.js +340 -336
- package/dist/shared/components/item-edit/RecordGrantTools.js +28 -28
- package/dist/shared/components/item-edit/RecordHeaderActions.js +23 -22
- package/dist/shared/components/item-edit/RelationCombobox.js +231 -222
- package/dist/shared/components/item-edit/RuleHiddenNotes.js +55 -0
- package/dist/shared/components/item-edit/field-comments-context.js +6 -0
- package/dist/shared/components/item-edit/field-sources.js +33 -0
- package/dist/shared/components/item-edit/rule-hidden.js +30 -0
- package/dist/shared/components/layout-editor/HistoryPanel.js +113 -96
- package/dist/shared/components/layout-editor/editors/cascade-filters.js +170 -145
- package/dist/shared/components/layout-editor/inspector/Breadcrumb.js +22 -18
- package/dist/shared/components/layout-editor/inspector/GroupInspector.js +177 -159
- package/dist/shared/components/layout-editor/inspector/PickerTab.js +35 -34
- package/dist/shared/components/layout-editor/inspector/RulesTab.js +124 -111
- package/dist/shared/components/layout-editor/inspector/kit.js +292 -277
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/layout-editor/settings/settings-registry.js +1 -1
- package/dist/shared/components/list/CopyListLinkButton.js +41 -0
- package/dist/shared/components/list/InlineEdit.js +363 -0
- package/dist/shared/components/notifications/NotificationCenterView.js +213 -181
- package/dist/shared/components/notifications/NotificationDetailBits.js +205 -82
- package/dist/shared/components/notifications/NotificationRulesEditor.js +515 -0
- package/dist/shared/components/notifications/TestMyRules.js +137 -0
- package/dist/shared/components/notifications/changes-lines.js +24 -0
- package/dist/shared/components/notifications/why-lines.js +64 -0
- package/dist/shared/components/panels/CommentPanel.js +316 -281
- package/dist/shared/components/panels/LegalHoldBanner.js +38 -0
- package/dist/shared/components/panels/PipelinePanel.js +201 -196
- package/dist/shared/components/panels/RevisionsPanel.js +496 -479
- package/dist/shared/components/pipeline/PipelineEditorView.js +1587 -1560
- package/dist/shared/components/pipeline/PipelineStateOwners.js +116 -103
- package/dist/shared/components/profile/PersonDidPanel.js +188 -0
- package/dist/shared/components/profile/PersonProfile.js +57 -52
- package/dist/shared/components/queue/QueueWorklist.js +1526 -1365
- package/dist/shared/hooks/useSlowReason.js +39 -0
- package/dist/shared/lib/activity-sentence.js +670 -0
- package/dist/shared/lib/config-sentences.js +418 -0
- package/dist/shared/lib/core-glossary.js +229 -0
- package/dist/shared/lib/error-hints.js +159 -0
- package/dist/shared/lib/error-message.js +105 -0
- package/dist/shared/lib/error-toast.js +22 -0
- package/dist/shared/lib/field-comments.js +25 -0
- package/dist/shared/lib/filter-sentence.js +261 -0
- package/dist/shared/lib/glossary.js +55 -48
- package/dist/shared/lib/idle-reload.js +138 -0
- package/dist/shared/lib/layout-resolve.js +42 -29
- package/dist/shared/lib/list-inline-edit.js +190 -0
- package/dist/shared/lib/list-link.js +147 -0
- package/dist/shared/lib/prefetch.js +259 -106
- package/dist/shared/lib/record-ref.js +72 -0
- package/dist/shared/lib/reload-holds.js +25 -0
- package/dist/shared/lib/safe-error.js +52 -24
- package/dist/shared/lib/skeleton-shapes.js +72 -0
- package/dist/shared/lib/slow-reason.js +63 -0
- package/package.json +1 -1
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { jsx as e, jsxs as a, Fragment as
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { Upload as
|
|
1
|
+
import { jsx as e, jsxs as a, Fragment as Be } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as Ve, useQuery as U, useMutation as Q } from "@tanstack/react-query";
|
|
3
|
+
import { Upload as je, Plus as qe, ArrowLeft as Me, FileUp as Je, Link2 as We, Loader2 as me, Sparkles as He, ArrowRight as Re, MoreHorizontal as Ge, Trash2 as Ze, ChevronsUpDown as Xe, Check as Ye } from "lucide-react";
|
|
4
4
|
import { useState as b, useMemo as j, useEffect as Ae, useRef as De } from "react";
|
|
5
|
-
import { useNivaroClient as re, useNavigation as
|
|
6
|
-
import { get as W, del as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
5
|
+
import { useNivaroClient as re, useNavigation as et } from "../../context.js";
|
|
6
|
+
import { get as W, del as tt, post as I } from "../../lib/commands.js";
|
|
7
|
+
import { errorSentence as at, rowErrorSentence as Te } from "../../lib/error-message.js";
|
|
8
|
+
import { formatNumber as _, cn as w, formatRelative as rt, formatDateTime as te } from "../../lib/utils.js";
|
|
9
|
+
import { DataTable as st } from "../DataTable.js";
|
|
10
|
+
import { Button as A } from "../ui/button.js";
|
|
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 pe } from "../ui/dropdown-menu.js";
|
|
13
|
+
import { Input as $e } from "../ui/input.js";
|
|
13
14
|
import { Label as V } from "../ui/label.js";
|
|
14
|
-
import { Popover as
|
|
15
|
-
import { SimpleSelect as
|
|
16
|
-
import { Sheet as
|
|
17
|
-
import { Switch as
|
|
18
|
-
import { Textarea as
|
|
15
|
+
import { Popover as ut, PopoverTrigger as ht, PopoverContent as xt } from "../ui/popover.js";
|
|
16
|
+
import { SimpleSelect as bt } from "../ui/SimpleSelect.js";
|
|
17
|
+
import { Sheet as ft, SheetContent as gt } from "../ui/sheet.js";
|
|
18
|
+
import { Switch as vt } from "../ui/switch.js";
|
|
19
|
+
import { Textarea as wt } from "../ui/textarea.js";
|
|
19
20
|
const ue = 25, he = ["Source", "Map columns", "Options", "Confirm"], J = {
|
|
20
21
|
pending: { dot: "bg-slate-400", text: "text-slate-600 dark:text-slate-300", label: "Pending" },
|
|
21
22
|
processing: {
|
|
@@ -30,25 +31,25 @@ const ue = 25, he = ["Source", "Map columns", "Options", "Confirm"], J = {
|
|
|
30
31
|
},
|
|
31
32
|
failed: { dot: "bg-red-500", text: "text-red-700 dark:text-red-400", label: "Failed" }
|
|
32
33
|
};
|
|
33
|
-
function
|
|
34
|
+
function Ee({ status: o }) {
|
|
34
35
|
const n = J[o] ?? J.pending;
|
|
35
|
-
return /* @__PURE__ */ a("span", { className:
|
|
36
|
+
return /* @__PURE__ */ a("span", { className: w("flex items-center gap-1.5 text-[12px] font-medium", n.text), children: [
|
|
36
37
|
/* @__PURE__ */ a("span", { className: "relative flex h-1.5 w-1.5 shrink-0", children: [
|
|
37
38
|
o === "processing" && /* @__PURE__ */ e(
|
|
38
39
|
"span",
|
|
39
40
|
{
|
|
40
|
-
className:
|
|
41
|
+
className: w(
|
|
41
42
|
"absolute inline-flex h-full w-full rounded-full opacity-75 motion-safe:animate-ping",
|
|
42
43
|
n.dot
|
|
43
44
|
)
|
|
44
45
|
}
|
|
45
46
|
),
|
|
46
|
-
/* @__PURE__ */ e("span", { className:
|
|
47
|
+
/* @__PURE__ */ e("span", { className: w("relative inline-flex h-1.5 w-1.5 rounded-full", n.dot) })
|
|
47
48
|
] }),
|
|
48
49
|
n.label
|
|
49
50
|
] });
|
|
50
51
|
}
|
|
51
|
-
function
|
|
52
|
+
function Nt({
|
|
52
53
|
processed: o,
|
|
53
54
|
total: n,
|
|
54
55
|
failed: l
|
|
@@ -59,7 +60,7 @@ function vt({
|
|
|
59
60
|
/* @__PURE__ */ e("div", { className: "h-1.5 flex-1 overflow-hidden rounded-full bg-slate-100 dark:bg-muted", children: /* @__PURE__ */ e(
|
|
60
61
|
"div",
|
|
61
62
|
{
|
|
62
|
-
className:
|
|
63
|
+
className: w(
|
|
63
64
|
"h-full rounded-full transition-[width] duration-500",
|
|
64
65
|
l ? "bg-red-500" : "bg-nvr-cyan"
|
|
65
66
|
),
|
|
@@ -81,7 +82,7 @@ function ae(o) {
|
|
|
81
82
|
}
|
|
82
83
|
return n.push(l), n.map((c) => c.trim());
|
|
83
84
|
}
|
|
84
|
-
function
|
|
85
|
+
function kt(o) {
|
|
85
86
|
const n = o.split(/\r?\n/).filter((c) => c.trim());
|
|
86
87
|
if (n.length === 0) return { headers: [], rows: [], rowCount: 0 };
|
|
87
88
|
const l = ae(n[0]), u = n.slice(1, 6).map(ae);
|
|
@@ -95,12 +96,12 @@ function X({
|
|
|
95
96
|
className: c
|
|
96
97
|
}) {
|
|
97
98
|
const [s, g] = b(!1), C = l.find((h) => h.value === o);
|
|
98
|
-
return /* @__PURE__ */ a(
|
|
99
|
-
/* @__PURE__ */ e(
|
|
99
|
+
return /* @__PURE__ */ a(ut, { open: s, onOpenChange: g, children: [
|
|
100
|
+
/* @__PURE__ */ e(ht, { asChild: !0, children: /* @__PURE__ */ a(
|
|
100
101
|
"button",
|
|
101
102
|
{
|
|
102
103
|
type: "button",
|
|
103
|
-
className:
|
|
104
|
+
className: w(
|
|
104
105
|
"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",
|
|
105
106
|
c
|
|
106
107
|
),
|
|
@@ -108,23 +109,23 @@ function X({
|
|
|
108
109
|
/* @__PURE__ */ e(
|
|
109
110
|
"span",
|
|
110
111
|
{
|
|
111
|
-
className:
|
|
112
|
+
className: w(
|
|
112
113
|
"truncate font-mono",
|
|
113
114
|
C ? "text-slate-800 dark:text-foreground" : "text-slate-400"
|
|
114
115
|
),
|
|
115
116
|
children: (C == null ? void 0 : C.label) ?? u
|
|
116
117
|
}
|
|
117
118
|
),
|
|
118
|
-
/* @__PURE__ */ e(
|
|
119
|
+
/* @__PURE__ */ e(Xe, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
|
|
119
120
|
]
|
|
120
121
|
}
|
|
121
122
|
) }),
|
|
122
|
-
/* @__PURE__ */ e(
|
|
123
|
-
/* @__PURE__ */ e(
|
|
124
|
-
/* @__PURE__ */ a(
|
|
125
|
-
/* @__PURE__ */ e(
|
|
123
|
+
/* @__PURE__ */ e(xt, { className: "w-[240px] p-0", align: "start", children: /* @__PURE__ */ a(lt, { children: [
|
|
124
|
+
/* @__PURE__ */ e(nt, { placeholder: "Search…", className: "h-8 text-[12px]" }),
|
|
125
|
+
/* @__PURE__ */ a(ot, { children: [
|
|
126
|
+
/* @__PURE__ */ e(dt, { children: "Nothing matches." }),
|
|
126
127
|
l.map((h) => /* @__PURE__ */ a(
|
|
127
|
-
|
|
128
|
+
it,
|
|
128
129
|
{
|
|
129
130
|
value: h.label,
|
|
130
131
|
onSelect: () => {
|
|
@@ -133,9 +134,9 @@ function X({
|
|
|
133
134
|
className: "text-[12px]",
|
|
134
135
|
children: [
|
|
135
136
|
/* @__PURE__ */ e(
|
|
136
|
-
|
|
137
|
+
Ye,
|
|
137
138
|
{
|
|
138
|
-
className:
|
|
139
|
+
className: w(
|
|
139
140
|
"h-3.5 w-3.5",
|
|
140
141
|
h.value === o ? "text-nvr-cyan opacity-100" : "opacity-0"
|
|
141
142
|
)
|
|
@@ -150,12 +151,12 @@ function X({
|
|
|
150
151
|
] }) })
|
|
151
152
|
] });
|
|
152
153
|
}
|
|
153
|
-
function
|
|
154
|
+
function yt({ confidence: o }) {
|
|
154
155
|
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";
|
|
155
156
|
return /* @__PURE__ */ a(
|
|
156
157
|
"span",
|
|
157
158
|
{
|
|
158
|
-
className:
|
|
159
|
+
className: w("shrink-0 text-[10.5px] font-medium tabular-nums", l),
|
|
159
160
|
title: "AI mapping confidence",
|
|
160
161
|
children: [
|
|
161
162
|
"AI ",
|
|
@@ -165,19 +166,19 @@ function wt({ confidence: o }) {
|
|
|
165
166
|
}
|
|
166
167
|
);
|
|
167
168
|
}
|
|
168
|
-
function
|
|
169
|
+
function Ht({
|
|
169
170
|
initialJobId: o,
|
|
170
171
|
onJobOpen: n
|
|
171
172
|
}) {
|
|
172
173
|
var K;
|
|
173
|
-
const l = re(), u =
|
|
174
|
+
const l = re(), u = Ve(), [c, s] = b("list"), [g, C] = b(o ?? null), [h, T] = b("all"), [m, i] = b(1), [v, N] = b(null), p = U({
|
|
174
175
|
queryKey: ["collection-import-jobs"],
|
|
175
176
|
// The endpoint returns every job the caller may see, so the counters below
|
|
176
177
|
// are exact rather than page-scoped.
|
|
177
178
|
queryFn: () => l.request(W("/imports")),
|
|
178
179
|
refetchInterval: (r) => {
|
|
179
180
|
var k;
|
|
180
|
-
return (((k = r.state.data) == null ? void 0 : k.data) ?? []).some((
|
|
181
|
+
return (((k = r.state.data) == null ? void 0 : k.data) ?? []).some((R) => R.status === "pending" || R.status === "processing") ? 3e3 : !1;
|
|
181
182
|
},
|
|
182
183
|
placeholderData: (r) => r
|
|
183
184
|
}), P = j(() => {
|
|
@@ -201,17 +202,17 @@ function jt({
|
|
|
201
202
|
), O = h === "all" ? P : P.filter((r) => r.status === h), H = O.slice((m - 1) * ue, m * ue);
|
|
202
203
|
Ae(() => i(1), [h]);
|
|
203
204
|
const E = Q({
|
|
204
|
-
mutationFn: (r) => l.request(
|
|
205
|
+
mutationFn: (r) => l.request(tt(`/imports/${r}`)),
|
|
205
206
|
onSuccess: () => {
|
|
206
|
-
|
|
207
|
+
N(null), u.invalidateQueries({ queryKey: ["collection-import-jobs"] });
|
|
207
208
|
},
|
|
208
|
-
onError: (r) =>
|
|
209
|
+
onError: (r) => N(r.message)
|
|
209
210
|
}), G = Q({
|
|
210
211
|
mutationFn: (r) => l.request(I(`/imports/${r}/rollback`, {})),
|
|
211
212
|
onSuccess: () => {
|
|
212
|
-
|
|
213
|
+
N(null), u.invalidateQueries({ queryKey: ["collection-import-jobs"] });
|
|
213
214
|
},
|
|
214
|
-
onError: (r) =>
|
|
215
|
+
onError: (r) => N(r.message)
|
|
215
216
|
});
|
|
216
217
|
function M(r) {
|
|
217
218
|
C(r), n == null || n(r);
|
|
@@ -221,7 +222,7 @@ function jt({
|
|
|
221
222
|
key: "status",
|
|
222
223
|
header: "Status",
|
|
223
224
|
className: "w-[110px]",
|
|
224
|
-
render: (r) => /* @__PURE__ */ e(
|
|
225
|
+
render: (r) => /* @__PURE__ */ e(Ee, { status: r.status })
|
|
225
226
|
},
|
|
226
227
|
{
|
|
227
228
|
key: "file_name",
|
|
@@ -247,7 +248,7 @@ function jt({
|
|
|
247
248
|
header: "Progress",
|
|
248
249
|
className: "w-[130px]",
|
|
249
250
|
render: (r) => /* @__PURE__ */ e(
|
|
250
|
-
|
|
251
|
+
Nt,
|
|
251
252
|
{
|
|
252
253
|
processed: r.processed_rows,
|
|
253
254
|
total: r.total_rows,
|
|
@@ -292,7 +293,7 @@ function jt({
|
|
|
292
293
|
{
|
|
293
294
|
className: "text-[12px] text-slate-500 dark:text-muted-foreground",
|
|
294
295
|
title: te(r.created_at),
|
|
295
|
-
children:
|
|
296
|
+
children: rt(r.created_at)
|
|
296
297
|
}
|
|
297
298
|
)
|
|
298
299
|
},
|
|
@@ -300,17 +301,17 @@ function jt({
|
|
|
300
301
|
key: "__actions__",
|
|
301
302
|
header: "",
|
|
302
303
|
className: "w-[44px]",
|
|
303
|
-
render: (r) => /* @__PURE__ */ e("div", { onClick: (k) => k.stopPropagation(), onKeyDown: (k) => k.stopPropagation(), children: /* @__PURE__ */ a(
|
|
304
|
-
/* @__PURE__ */ e(
|
|
304
|
+
render: (r) => /* @__PURE__ */ e("div", { onClick: (k) => k.stopPropagation(), onKeyDown: (k) => k.stopPropagation(), children: /* @__PURE__ */ a(ct, { children: [
|
|
305
|
+
/* @__PURE__ */ e(mt, { asChild: !0, children: /* @__PURE__ */ e(
|
|
305
306
|
"button",
|
|
306
307
|
{
|
|
307
308
|
type: "button",
|
|
308
309
|
className: "rounded p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted",
|
|
309
310
|
"aria-label": `Actions for ${r.file_name}`,
|
|
310
|
-
children: /* @__PURE__ */ e(
|
|
311
|
+
children: /* @__PURE__ */ e(Ge, { className: "h-4 w-4" })
|
|
311
312
|
}
|
|
312
313
|
) }),
|
|
313
|
-
/* @__PURE__ */ a(
|
|
314
|
+
/* @__PURE__ */ a(pt, { align: "end", className: "text-[12.5px]", children: [
|
|
314
315
|
/* @__PURE__ */ e(pe, { onSelect: () => M(r.id), children: "View details" }),
|
|
315
316
|
/* @__PURE__ */ e(
|
|
316
317
|
pe,
|
|
@@ -330,7 +331,7 @@ function jt({
|
|
|
330
331
|
disabled: r.status !== "complete" && r.status !== "failed",
|
|
331
332
|
onSelect: () => E.mutate(r.id),
|
|
332
333
|
children: [
|
|
333
|
-
/* @__PURE__ */ e(
|
|
334
|
+
/* @__PURE__ */ e(Ze, { className: "h-3.5 w-3.5" }),
|
|
334
335
|
" Delete job"
|
|
335
336
|
]
|
|
336
337
|
}
|
|
@@ -340,7 +341,7 @@ function jt({
|
|
|
340
341
|
}
|
|
341
342
|
];
|
|
342
343
|
return c === "wizard" ? /* @__PURE__ */ e(
|
|
343
|
-
|
|
344
|
+
Ct,
|
|
344
345
|
{
|
|
345
346
|
onCancel: () => s("list"),
|
|
346
347
|
onCreated: (r) => {
|
|
@@ -351,7 +352,7 @@ function jt({
|
|
|
351
352
|
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 }),
|
|
352
353
|
/* @__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: [
|
|
353
354
|
/* @__PURE__ */ e(
|
|
354
|
-
|
|
355
|
+
Fe,
|
|
355
356
|
{
|
|
356
357
|
label: "All",
|
|
357
358
|
count: P.length,
|
|
@@ -360,7 +361,7 @@ function jt({
|
|
|
360
361
|
}
|
|
361
362
|
),
|
|
362
363
|
Object.keys(J).map((r) => /* @__PURE__ */ e(
|
|
363
|
-
|
|
364
|
+
Fe,
|
|
364
365
|
{
|
|
365
366
|
label: J[r].label,
|
|
366
367
|
dot: J[r].dot,
|
|
@@ -385,15 +386,15 @@ function jt({
|
|
|
385
386
|
] })
|
|
386
387
|
] }),
|
|
387
388
|
P.length === 0 && !p.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: [
|
|
388
|
-
/* @__PURE__ */ e(
|
|
389
|
+
/* @__PURE__ */ e(je, { className: "h-5 w-5 text-slate-300" }),
|
|
389
390
|
/* @__PURE__ */ e("h3", { className: "mt-3 text-[15px] font-semibold text-slate-900 dark:text-foreground", children: "No collection imports yet" }),
|
|
390
391
|
/* @__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." }),
|
|
391
|
-
/* @__PURE__ */ a(
|
|
392
|
+
/* @__PURE__ */ a(A, { size: "sm", className: "mt-4", onClick: () => s("wizard"), children: [
|
|
392
393
|
/* @__PURE__ */ e(qe, { className: "h-3.5 w-3.5" }),
|
|
393
394
|
" Start an import"
|
|
394
395
|
] })
|
|
395
396
|
] }) }) : /* @__PURE__ */ e("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ e(
|
|
396
|
-
|
|
397
|
+
st,
|
|
397
398
|
{
|
|
398
399
|
columns: Z,
|
|
399
400
|
rows: H,
|
|
@@ -408,13 +409,13 @@ function jt({
|
|
|
408
409
|
minBodyHeight: 280,
|
|
409
410
|
emptyMessage: "No import jobs match this filter.",
|
|
410
411
|
rowClassName: (r) => r.status === "processing" ? "bg-nvr-cyan/5 dark:bg-nvr-cyan/10" : void 0,
|
|
411
|
-
toolbarRight: /* @__PURE__ */ a(
|
|
412
|
+
toolbarRight: /* @__PURE__ */ a(A, { size: "sm", className: "h-7", onClick: () => s("wizard"), children: [
|
|
412
413
|
/* @__PURE__ */ e(qe, { className: "h-3.5 w-3.5" }),
|
|
413
414
|
" New collection import"
|
|
414
415
|
] })
|
|
415
416
|
}
|
|
416
417
|
) }),
|
|
417
|
-
/* @__PURE__ */ e(
|
|
418
|
+
/* @__PURE__ */ e(St, { jobId: g, onClose: () => M(null) })
|
|
418
419
|
] });
|
|
419
420
|
}
|
|
420
421
|
function Y({ n: o }) {
|
|
@@ -426,7 +427,7 @@ function ee({ label: o, value: n, tone: l }) {
|
|
|
426
427
|
/* @__PURE__ */ e(
|
|
427
428
|
"p",
|
|
428
429
|
{
|
|
429
|
-
className:
|
|
430
|
+
className: w(
|
|
430
431
|
"mt-0.5 text-[15px] font-semibold leading-none tabular-nums",
|
|
431
432
|
l === "red" ? "text-red-600 dark:text-red-400" : "text-slate-900 dark:text-foreground"
|
|
432
433
|
),
|
|
@@ -435,7 +436,7 @@ function ee({ label: o, value: n, tone: l }) {
|
|
|
435
436
|
)
|
|
436
437
|
] });
|
|
437
438
|
}
|
|
438
|
-
function
|
|
439
|
+
function Fe({
|
|
439
440
|
label: o,
|
|
440
441
|
count: n,
|
|
441
442
|
dot: l,
|
|
@@ -448,25 +449,25 @@ function $e({
|
|
|
448
449
|
type: "button",
|
|
449
450
|
onClick: c,
|
|
450
451
|
"aria-pressed": u,
|
|
451
|
-
className:
|
|
452
|
+
className: w(
|
|
452
453
|
"flex items-center gap-1.5 px-3 py-2 transition-colors hover:bg-slate-50 dark:hover:bg-muted/40",
|
|
453
454
|
u && "bg-nvr-cyan/10 ring-1 ring-inset ring-nvr-cyan dark:bg-nvr-cyan/15",
|
|
454
455
|
!u && n === 0 && "opacity-45"
|
|
455
456
|
),
|
|
456
457
|
children: [
|
|
457
|
-
l && /* @__PURE__ */ e("span", { className:
|
|
458
|
+
l && /* @__PURE__ */ e("span", { className: w("h-1.5 w-1.5 shrink-0 rounded-full", l) }),
|
|
458
459
|
/* @__PURE__ */ e("span", { className: "text-[14px] font-semibold leading-none tabular-nums text-slate-900 dark:text-foreground", children: _(n) }),
|
|
459
460
|
/* @__PURE__ */ e("span", { className: "text-[11px] font-medium leading-none text-slate-400 dark:text-muted-foreground", children: o })
|
|
460
461
|
]
|
|
461
462
|
}
|
|
462
463
|
);
|
|
463
464
|
}
|
|
464
|
-
function
|
|
465
|
+
function Ct({
|
|
465
466
|
onCancel: o,
|
|
466
467
|
onCreated: n
|
|
467
468
|
}) {
|
|
468
|
-
var
|
|
469
|
-
const l = re(), u = De(null), [c, s] = b(0), [g, C] = b(""), [h, T] = b({}), [m, i] = b(""), [v,
|
|
469
|
+
var Ne, ke, ye, Ce;
|
|
470
|
+
const l = re(), u = De(null), [c, s] = b(0), [g, C] = b(""), [h, T] = b({}), [m, i] = b(""), [v, N] = b(""), [p, P] = b(""), [S, F] = b({}), [O, H] = b({}), [E, G] = b("skip"), [M, Z] = b(""), [K, r] = b(!1), [k, R] = b(null), [Ie, se] = b(!1), [Oe, Le] = b(null), xe = De(null), { headers: y, rows: be, rowCount: le } = j(() => kt(g), [g]);
|
|
470
471
|
Ae(() => {
|
|
471
472
|
if (!p || y.length === 0) return;
|
|
472
473
|
const t = `${p}|${y.join("")}`;
|
|
@@ -476,7 +477,7 @@ function kt({
|
|
|
476
477
|
if (Object.values(q).some((x) => x == null ? void 0 : x.trim())) return q;
|
|
477
478
|
const $ = {};
|
|
478
479
|
for (const x of y) f.column_map[x] && ($[x] = f.column_map[x]);
|
|
479
|
-
return Object.keys($).length === 0 ? q : (
|
|
480
|
+
return Object.keys($).length === 0 ? q : (Le(
|
|
480
481
|
f.updated_at ? `Applied your saved mapping from ${new Date(f.updated_at).toLocaleDateString()}` : "Applied your saved mapping"
|
|
481
482
|
), f.id_field && Z((x) => x || f.id_field || ""), f.duplicate_strategy && G((x) => x === "skip" && f.duplicate_strategy || x), $);
|
|
482
483
|
});
|
|
@@ -504,7 +505,7 @@ function kt({
|
|
|
504
505
|
enabled: c === 3 && !!p && !!g,
|
|
505
506
|
staleTime: 3e4,
|
|
506
507
|
retry: !1
|
|
507
|
-
}), D = (
|
|
508
|
+
}), D = (Ne = fe.data) == null ? void 0 : Ne.data, ze = (((ke = U({
|
|
508
509
|
queryKey: ["import-collections"],
|
|
509
510
|
queryFn: () => l.request(W("/collections")),
|
|
510
511
|
staleTime: 6e4
|
|
@@ -525,9 +526,9 @@ function kt({
|
|
|
525
526
|
})
|
|
526
527
|
),
|
|
527
528
|
onSuccess: (t) => {
|
|
528
|
-
|
|
529
|
+
R(null), C(t.data.csv_data), i(t.data.file_name);
|
|
529
530
|
},
|
|
530
|
-
onError: (t) =>
|
|
531
|
+
onError: (t) => R(t.message)
|
|
531
532
|
}), de = Q({
|
|
532
533
|
mutationFn: () => l.request(
|
|
533
534
|
I("/ai/map-columns", {
|
|
@@ -541,9 +542,9 @@ function kt({
|
|
|
541
542
|
const d = (($ = t.data) == null ? void 0 : $.mappings) ?? t.mappings ?? [], f = { ...S }, q = {};
|
|
542
543
|
for (const x of d)
|
|
543
544
|
y.includes(x.column) && (f[x.column] = x.field ?? "", x.field && (q[x.column] = x.confidence ?? 0));
|
|
544
|
-
F(f), H(q),
|
|
545
|
+
F(f), H(q), R(null);
|
|
545
546
|
},
|
|
546
|
-
onError: (t) =>
|
|
547
|
+
onError: (t) => R(
|
|
547
548
|
t.status === 503 ? "AI mapping needs an Anthropic API key — add one in Settings, or map the columns by hand." : t.message
|
|
548
549
|
)
|
|
549
550
|
}), ie = Q({
|
|
@@ -560,7 +561,7 @@ function kt({
|
|
|
560
561
|
})
|
|
561
562
|
),
|
|
562
563
|
onSuccess: (t) => n(t.data.id),
|
|
563
|
-
onError: (t) =>
|
|
564
|
+
onError: (t) => R(t.message)
|
|
564
565
|
});
|
|
565
566
|
function ge(t, d) {
|
|
566
567
|
F((f) => ({ ...f, [t]: d })), O[t] !== void 0 && H((f) => {
|
|
@@ -569,7 +570,7 @@ function kt({
|
|
|
569
570
|
});
|
|
570
571
|
}
|
|
571
572
|
async function ve(t) {
|
|
572
|
-
t && (
|
|
573
|
+
t && (R(null), C(await t.text()), i(t.name));
|
|
573
574
|
}
|
|
574
575
|
const L = j(() => {
|
|
575
576
|
const t = g.split(/\r?\n/).filter(($) => $.trim());
|
|
@@ -577,20 +578,20 @@ function kt({
|
|
|
577
578
|
const d = ae(t[0]), f = t.slice(1, 2001).map(ae), q = {};
|
|
578
579
|
return d.forEach(($, x) => {
|
|
579
580
|
let z = 0, _e = 0, Se = 0, Pe = 0;
|
|
580
|
-
for (const
|
|
581
|
-
const B = (
|
|
581
|
+
for (const Ke of f) {
|
|
582
|
+
const B = (Ke[x] ?? "").trim();
|
|
582
583
|
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++);
|
|
583
584
|
}
|
|
584
|
-
const
|
|
585
|
-
q[$] = { fill: Math.round(z / f.length * 100), guess:
|
|
585
|
+
const Qe = z === 0 ? "empty" : _e / z > 0.9 ? "number" : Se / z > 0.9 ? "date" : Pe / z > 0.9 ? "boolean" : "text";
|
|
586
|
+
q[$] = { fill: Math.round(z / f.length * 100), guess: Qe };
|
|
586
587
|
}), q;
|
|
587
588
|
}, [g]), ce = y.filter((t) => {
|
|
588
589
|
var d;
|
|
589
590
|
return (d = S[t]) == null ? void 0 : d.trim();
|
|
590
|
-
}).length,
|
|
591
|
+
}).length, we = Oe, Ue = c === 0 ? y.length > 0 : c === 1 ? !!p && ce > 0 : !0;
|
|
591
592
|
return /* @__PURE__ */ a("div", { className: "flex min-h-0 flex-1 flex-col gap-4", children: [
|
|
592
593
|
/* @__PURE__ */ a("div", { className: "flex items-center gap-3", children: [
|
|
593
|
-
/* @__PURE__ */ a(
|
|
594
|
+
/* @__PURE__ */ a(A, { variant: "ghost", size: "sm", className: "h-7 px-2", onClick: o, children: [
|
|
594
595
|
/* @__PURE__ */ e(Me, { className: "h-3.5 w-3.5" }),
|
|
595
596
|
" Back to jobs"
|
|
596
597
|
] }),
|
|
@@ -601,7 +602,7 @@ function kt({
|
|
|
601
602
|
type: "button",
|
|
602
603
|
onClick: () => d < c && s(d),
|
|
603
604
|
disabled: d > c,
|
|
604
|
-
className:
|
|
605
|
+
className: w(
|
|
605
606
|
"flex items-center gap-1.5 rounded-md px-2 py-1 text-[12px] font-medium transition-colors",
|
|
606
607
|
d === c ? "bg-nvr-cyan/15 text-nvr-navy dark:bg-nvr-cyan/20 dark:text-nvr-cyan" : d < c ? "text-slate-600 hover:bg-slate-100 dark:text-muted-foreground dark:hover:bg-muted" : "text-slate-300 dark:text-slate-600"
|
|
607
608
|
),
|
|
@@ -646,12 +647,12 @@ function kt({
|
|
|
646
647
|
var d;
|
|
647
648
|
t.preventDefault(), se(!1), ve(((d = t.dataTransfer.files) == null ? void 0 : d[0]) ?? null);
|
|
648
649
|
},
|
|
649
|
-
className:
|
|
650
|
+
className: w(
|
|
650
651
|
"flex flex-col items-center justify-center gap-1.5 rounded-md border border-dashed px-4 py-8 transition-colors",
|
|
651
|
-
|
|
652
|
+
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"
|
|
652
653
|
),
|
|
653
654
|
children: [
|
|
654
|
-
/* @__PURE__ */ e(
|
|
655
|
+
/* @__PURE__ */ e(Je, { className: "h-4 w-4 text-slate-400" }),
|
|
655
656
|
/* @__PURE__ */ e("span", { className: "text-[12.5px] font-medium text-slate-700 dark:text-foreground", children: "Drop a CSV, or click to choose" }),
|
|
656
657
|
m && /* @__PURE__ */ e("span", { className: "font-mono text-[11px] text-slate-500", children: m })
|
|
657
658
|
]
|
|
@@ -659,7 +660,7 @@ function kt({
|
|
|
659
660
|
),
|
|
660
661
|
/* @__PURE__ */ a("div", { className: "space-y-1.5", children: [
|
|
661
662
|
/* @__PURE__ */ a(V, { className: "flex items-center gap-1.5 text-[11.5px]", children: [
|
|
662
|
-
/* @__PURE__ */ e(
|
|
663
|
+
/* @__PURE__ */ e(We, { className: "h-3.5 w-3.5 text-slate-400" }),
|
|
663
664
|
" Or fetch from a URL"
|
|
664
665
|
] }),
|
|
665
666
|
/* @__PURE__ */ a(
|
|
@@ -671,16 +672,16 @@ function kt({
|
|
|
671
672
|
},
|
|
672
673
|
children: [
|
|
673
674
|
/* @__PURE__ */ e(
|
|
674
|
-
|
|
675
|
+
$e,
|
|
675
676
|
{
|
|
676
677
|
value: v,
|
|
677
|
-
onChange: (t) =>
|
|
678
|
+
onChange: (t) => N(t.target.value),
|
|
678
679
|
placeholder: "https://example.com/data.csv",
|
|
679
680
|
className: "h-8 font-mono text-[12px]"
|
|
680
681
|
}
|
|
681
682
|
),
|
|
682
683
|
/* @__PURE__ */ e(
|
|
683
|
-
|
|
684
|
+
A,
|
|
684
685
|
{
|
|
685
686
|
type: "submit",
|
|
686
687
|
variant: "outline",
|
|
@@ -699,7 +700,7 @@ function kt({
|
|
|
699
700
|
/* @__PURE__ */ a("div", { className: "space-y-1.5", children: [
|
|
700
701
|
/* @__PURE__ */ e(V, { className: "text-[11.5px]", children: "Or paste the rows" }),
|
|
701
702
|
/* @__PURE__ */ e(
|
|
702
|
-
|
|
703
|
+
wt,
|
|
703
704
|
{
|
|
704
705
|
value: g,
|
|
705
706
|
onChange: (t) => {
|
|
@@ -723,7 +724,7 @@ val1,val2,val3`,
|
|
|
723
724
|
" ",
|
|
724
725
|
"columns"
|
|
725
726
|
] }),
|
|
726
|
-
/* @__PURE__ */ e(
|
|
727
|
+
/* @__PURE__ */ e(_t, { headers: y, rows: be })
|
|
727
728
|
] })
|
|
728
729
|
] }),
|
|
729
730
|
c === 1 && // Bounded width: a mapping row is a form field, and stretching the
|
|
@@ -738,14 +739,14 @@ val1,val2,val3`,
|
|
|
738
739
|
{
|
|
739
740
|
value: p,
|
|
740
741
|
onChange: P,
|
|
741
|
-
options:
|
|
742
|
+
options: ze,
|
|
742
743
|
placeholder: "Choose a collection…"
|
|
743
744
|
}
|
|
744
745
|
) }),
|
|
745
746
|
/* @__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." })
|
|
746
747
|
] }),
|
|
747
748
|
/* @__PURE__ */ a(
|
|
748
|
-
|
|
749
|
+
A,
|
|
749
750
|
{
|
|
750
751
|
variant: "outline",
|
|
751
752
|
size: "sm",
|
|
@@ -753,7 +754,7 @@ val1,val2,val3`,
|
|
|
753
754
|
disabled: !p || y.length === 0 || de.isPending,
|
|
754
755
|
onClick: () => de.mutate(),
|
|
755
756
|
children: [
|
|
756
|
-
de.isPending ? /* @__PURE__ */ e(me, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(
|
|
757
|
+
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" }),
|
|
757
758
|
"Match columns with AI"
|
|
758
759
|
]
|
|
759
760
|
}
|
|
@@ -774,7 +775,7 @@ val1,val2,val3`,
|
|
|
774
775
|
L[t] && /* @__PURE__ */ a(
|
|
775
776
|
"span",
|
|
776
777
|
{
|
|
777
|
-
className:
|
|
778
|
+
className: w(
|
|
778
779
|
"ml-2 rounded px-1 py-0.5 font-sans text-[9.5px] font-medium",
|
|
779
780
|
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"
|
|
780
781
|
),
|
|
@@ -801,7 +802,7 @@ val1,val2,val3`,
|
|
|
801
802
|
placeholder: "— skip this column —"
|
|
802
803
|
}
|
|
803
804
|
) : /* @__PURE__ */ e(
|
|
804
|
-
|
|
805
|
+
$e,
|
|
805
806
|
{
|
|
806
807
|
value: S[t] ?? "",
|
|
807
808
|
onChange: (d) => ge(t, d.target.value),
|
|
@@ -809,7 +810,7 @@ val1,val2,val3`,
|
|
|
809
810
|
className: "h-8 font-mono text-[12px]"
|
|
810
811
|
}
|
|
811
812
|
) }),
|
|
812
|
-
O[t] !== void 0 && S[t] && /* @__PURE__ */ e(
|
|
813
|
+
O[t] !== void 0 && S[t] && /* @__PURE__ */ e(yt, { confidence: O[t] }),
|
|
813
814
|
S[t] && /* @__PURE__ */ e("div", { className: "w-[120px]", children: /* @__PURE__ */ e(
|
|
814
815
|
X,
|
|
815
816
|
{
|
|
@@ -837,14 +838,14 @@ val1,val2,val3`,
|
|
|
837
838
|
" of ",
|
|
838
839
|
y.length,
|
|
839
840
|
" columns mapped — unmapped columns are ignored.",
|
|
840
|
-
|
|
841
|
+
we && /* @__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: we })
|
|
841
842
|
] })
|
|
842
843
|
] }),
|
|
843
844
|
c === 2 && /* @__PURE__ */ a("div", { className: "max-w-[520px] space-y-4", children: [
|
|
844
845
|
/* @__PURE__ */ a("div", { className: "space-y-1.5", children: [
|
|
845
846
|
/* @__PURE__ */ e(V, { className: "text-[11.5px]", children: "When a record already exists" }),
|
|
846
847
|
/* @__PURE__ */ e(
|
|
847
|
-
|
|
848
|
+
bt,
|
|
848
849
|
{
|
|
849
850
|
value: E,
|
|
850
851
|
onChange: G,
|
|
@@ -859,7 +860,7 @@ val1,val2,val3`,
|
|
|
859
860
|
] }),
|
|
860
861
|
/* @__PURE__ */ a("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: [
|
|
861
862
|
/* @__PURE__ */ e(
|
|
862
|
-
|
|
863
|
+
vt,
|
|
863
864
|
{
|
|
864
865
|
id: "csv-through-items",
|
|
865
866
|
checked: K,
|
|
@@ -919,7 +920,7 @@ val1,val2,val3`,
|
|
|
919
920
|
].map((t) => /* @__PURE__ */ a(
|
|
920
921
|
"span",
|
|
921
922
|
{
|
|
922
|
-
className:
|
|
923
|
+
className: w(
|
|
923
924
|
"inline-flex items-center gap-1.5 rounded-full border bg-white px-2.5 py-1 text-[12px] font-medium dark:bg-card",
|
|
924
925
|
t.cls
|
|
925
926
|
),
|
|
@@ -946,7 +947,7 @@ val1,val2,val3`,
|
|
|
946
947
|
/* @__PURE__ */ e(
|
|
947
948
|
"span",
|
|
948
949
|
{
|
|
949
|
-
className:
|
|
950
|
+
className: w(
|
|
950
951
|
"rounded px-1.5 py-0.5 text-[10.5px] font-semibold uppercase tracking-wide",
|
|
951
952
|
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"
|
|
952
953
|
),
|
|
@@ -999,7 +1000,7 @@ val1,val2,val3`,
|
|
|
999
1000
|
/* @__PURE__ */ e(
|
|
1000
1001
|
"span",
|
|
1001
1002
|
{
|
|
1002
|
-
className:
|
|
1003
|
+
className: w(
|
|
1003
1004
|
"truncate text-[12.5px] text-slate-800 dark:text-foreground",
|
|
1004
1005
|
t.mono && "font-mono text-[12px]"
|
|
1005
1006
|
),
|
|
@@ -1022,17 +1023,17 @@ val1,val2,val3`,
|
|
|
1022
1023
|
] })
|
|
1023
1024
|
] }),
|
|
1024
1025
|
/* @__PURE__ */ a("div", { className: "flex shrink-0 items-center gap-2", children: [
|
|
1025
|
-
c > 0 && /* @__PURE__ */ a(
|
|
1026
|
+
c > 0 && /* @__PURE__ */ a(A, { variant: "ghost", size: "sm", onClick: () => s((t) => t - 1), children: [
|
|
1026
1027
|
/* @__PURE__ */ e(Me, { className: "h-3.5 w-3.5" }),
|
|
1027
1028
|
" Back"
|
|
1028
1029
|
] }),
|
|
1029
1030
|
k && /* @__PURE__ */ e("p", { className: "text-[12px] text-red-600 dark:text-red-400", children: k }),
|
|
1030
1031
|
/* @__PURE__ */ a("div", { className: "ml-auto flex items-center gap-2", children: [
|
|
1031
|
-
/* @__PURE__ */ e(
|
|
1032
|
-
c < he.length - 1 ? /* @__PURE__ */ a(
|
|
1032
|
+
/* @__PURE__ */ e(A, { variant: "ghost", size: "sm", onClick: o, children: "Cancel" }),
|
|
1033
|
+
c < he.length - 1 ? /* @__PURE__ */ a(A, { size: "sm", disabled: !Ue, onClick: () => s((t) => t + 1), children: [
|
|
1033
1034
|
"Next ",
|
|
1034
|
-
/* @__PURE__ */ e(
|
|
1035
|
-
] }) : /* @__PURE__ */ e(
|
|
1035
|
+
/* @__PURE__ */ e(Re, { className: "h-3.5 w-3.5" })
|
|
1036
|
+
] }) : /* @__PURE__ */ e(A, { size: "sm", disabled: ie.isPending, onClick: () => ie.mutate(), children: ie.isPending ? /* @__PURE__ */ a(Be, { children: [
|
|
1036
1037
|
/* @__PURE__ */ e(me, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
1037
1038
|
" Starting…"
|
|
1038
1039
|
] }) : "Start import" })
|
|
@@ -1040,7 +1041,7 @@ val1,val2,val3`,
|
|
|
1040
1041
|
] })
|
|
1041
1042
|
] });
|
|
1042
1043
|
}
|
|
1043
|
-
function
|
|
1044
|
+
function _t({ headers: o, rows: n }) {
|
|
1044
1045
|
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: [
|
|
1045
1046
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { className: "bg-slate-50 dark:bg-muted/40", children: o.map((l) => /* @__PURE__ */ e(
|
|
1046
1047
|
"th",
|
|
@@ -1064,20 +1065,20 @@ function yt({ headers: o, rows: n }) {
|
|
|
1064
1065
|
)) })
|
|
1065
1066
|
] }) });
|
|
1066
1067
|
}
|
|
1067
|
-
function
|
|
1068
|
+
function St({ jobId: o, onClose: n }) {
|
|
1068
1069
|
var h, T;
|
|
1069
|
-
const l =
|
|
1070
|
+
const l = et(), u = re(), s = (h = U({
|
|
1070
1071
|
queryKey: ["collection-import-job", o],
|
|
1071
1072
|
queryFn: () => u.request(W(`/imports/${o}`)),
|
|
1072
1073
|
enabled: !!o,
|
|
1073
1074
|
refetchInterval: (m) => {
|
|
1074
|
-
var i, v,
|
|
1075
|
-
return ((v = (i = m.state.data) == null ? void 0 : i.data) == null ? void 0 : v.status) === "processing" || ((p = (
|
|
1075
|
+
var i, v, N, p;
|
|
1076
|
+
return ((v = (i = m.state.data) == null ? void 0 : i.data) == null ? void 0 : v.status) === "processing" || ((p = (N = m.state.data) == null ? void 0 : N.data) == null ? void 0 : p.status) === "pending" ? 2e3 : !1;
|
|
1076
1077
|
}
|
|
1077
1078
|
}).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;
|
|
1078
|
-
return /* @__PURE__ */ e(
|
|
1079
|
+
return /* @__PURE__ */ e(ft, { open: !!o, onOpenChange: (m) => !m && 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: [
|
|
1079
1080
|
/* @__PURE__ */ a("header", { className: "shrink-0 border-b border-slate-200 px-5 py-4 dark:border-border", children: [
|
|
1080
|
-
/* @__PURE__ */ e(
|
|
1081
|
+
/* @__PURE__ */ e(Ee, { status: s.status }),
|
|
1081
1082
|
/* @__PURE__ */ e("h2", { className: "mt-1.5 truncate font-mono text-[15px] font-semibold text-slate-900 dark:text-foreground", children: s.file_name }),
|
|
1082
1083
|
/* @__PURE__ */ a("p", { className: "text-[11.5px] text-slate-400", children: [
|
|
1083
1084
|
"into ",
|
|
@@ -1099,7 +1100,7 @@ function Ct({ jobId: o, onClose: n }) {
|
|
|
1099
1100
|
/* @__PURE__ */ e("div", { className: "h-2 overflow-hidden rounded-full bg-slate-100 dark:bg-muted", children: /* @__PURE__ */ e(
|
|
1100
1101
|
"div",
|
|
1101
1102
|
{
|
|
1102
|
-
className:
|
|
1103
|
+
className: w(
|
|
1103
1104
|
"h-full rounded-full transition-[width] duration-500",
|
|
1104
1105
|
s.status === "failed" ? "bg-red-500" : "bg-nvr-cyan"
|
|
1105
1106
|
),
|
|
@@ -1124,7 +1125,7 @@ function Ct({ jobId: o, onClose: n }) {
|
|
|
1124
1125
|
/* @__PURE__ */ e(
|
|
1125
1126
|
"p",
|
|
1126
1127
|
{
|
|
1127
|
-
className:
|
|
1128
|
+
className: w(
|
|
1128
1129
|
"text-[15px] font-semibold tabular-nums",
|
|
1129
1130
|
m.bad ? "text-red-600 dark:text-red-400" : "text-slate-900 dark:text-foreground"
|
|
1130
1131
|
),
|
|
@@ -1169,7 +1170,7 @@ function Ct({ jobId: o, onClose: n }) {
|
|
|
1169
1170
|
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",
|
|
1170
1171
|
children: [
|
|
1171
1172
|
/* @__PURE__ */ e("span", { className: "flex-1 truncate text-slate-500 dark:text-muted-foreground", children: m }),
|
|
1172
|
-
/* @__PURE__ */ e(
|
|
1173
|
+
/* @__PURE__ */ e(Re, { className: "h-3 w-3 shrink-0 text-slate-300" }),
|
|
1173
1174
|
/* @__PURE__ */ e("span", { className: "flex-1 truncate text-slate-800 dark:text-foreground", children: i || /* @__PURE__ */ e("span", { className: "font-sans text-slate-400", children: "skipped" }) })
|
|
1174
1175
|
]
|
|
1175
1176
|
},
|
|
@@ -1198,11 +1199,11 @@ function Ct({ jobId: o, onClose: n }) {
|
|
|
1198
1199
|
]
|
|
1199
1200
|
}
|
|
1200
1201
|
) }),
|
|
1201
|
-
g.length > 0 && /* @__PURE__ */ e(
|
|
1202
|
+
g.length > 0 && /* @__PURE__ */ e(Pt, { jobId: String(s.id), errors: g })
|
|
1202
1203
|
] })
|
|
1203
1204
|
] }) : /* @__PURE__ */ e("div", { className: "p-5 text-[12.5px] text-slate-400", children: "Loading job…" }) }) });
|
|
1204
1205
|
}
|
|
1205
|
-
function
|
|
1206
|
+
function Pt({
|
|
1206
1207
|
jobId: o,
|
|
1207
1208
|
errors: n
|
|
1208
1209
|
}) {
|
|
@@ -1215,7 +1216,7 @@ function _t({
|
|
|
1215
1216
|
}), h = C ?? [], T = h[0] ? Object.keys(h[0].values) : [], m = Q({
|
|
1216
1217
|
mutationFn: ({ row: i, values: v }) => l.request(I(`/imports/${o}/repair-row`, { values: v })).then(() => i),
|
|
1217
1218
|
onSuccess: (i) => g((v) => ({ ...v, [i]: "ok" })),
|
|
1218
|
-
onError: (i, v) => g((
|
|
1219
|
+
onError: (i, v) => g((N) => ({ ...N, [v.row]: at(i, "The row was not created") }))
|
|
1219
1220
|
});
|
|
1220
1221
|
return h.length === 0 ? /* @__PURE__ */ a("section", { children: [
|
|
1221
1222
|
/* @__PURE__ */ a("h3", { className: "mb-1.5 text-[11.5px] font-semibold text-red-700 dark:text-red-400", children: [
|
|
@@ -1223,14 +1224,19 @@ function _t({
|
|
|
1223
1224
|
n.length,
|
|
1224
1225
|
")"
|
|
1225
1226
|
] }),
|
|
1226
|
-
/* @__PURE__ */ e("div", { className: "max-h-[200px] overflow-auto rounded-md border border-red-200 dark:border-red-900", children: n.map((i) => /* @__PURE__ */
|
|
1227
|
+
/* @__PURE__ */ e("div", { className: "max-h-[200px] overflow-auto rounded-md border border-red-200 dark:border-red-900", children: n.map((i) => /* @__PURE__ */ e(
|
|
1227
1228
|
"div",
|
|
1228
1229
|
{
|
|
1229
1230
|
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",
|
|
1230
|
-
children: [
|
|
1231
|
-
/* @__PURE__ */
|
|
1232
|
-
|
|
1233
|
-
|
|
1231
|
+
children: /* @__PURE__ */ a("span", { className: "text-red-700 dark:text-red-400", children: [
|
|
1232
|
+
/* @__PURE__ */ a("span", { className: "font-medium tabular-nums", children: [
|
|
1233
|
+
"Row ",
|
|
1234
|
+
i.row,
|
|
1235
|
+
":"
|
|
1236
|
+
] }),
|
|
1237
|
+
" ",
|
|
1238
|
+
Te(i.error)
|
|
1239
|
+
] })
|
|
1234
1240
|
},
|
|
1235
1241
|
`${i.row}-${i.error}`
|
|
1236
1242
|
)) })
|
|
@@ -1247,7 +1253,7 @@ function _t({
|
|
|
1247
1253
|
/* @__PURE__ */ e("th", { className: "px-2 py-1" })
|
|
1248
1254
|
] }) }),
|
|
1249
1255
|
/* @__PURE__ */ e("tbody", { children: h.map((i) => {
|
|
1250
|
-
const v = u[i.row] ?? i.values,
|
|
1256
|
+
const v = u[i.row] ?? i.values, N = s[i.row];
|
|
1251
1257
|
return /* @__PURE__ */ a(
|
|
1252
1258
|
"tr",
|
|
1253
1259
|
{
|
|
@@ -1255,18 +1261,18 @@ function _t({
|
|
|
1255
1261
|
children: [
|
|
1256
1262
|
/* @__PURE__ */ a("td", { className: "px-2 py-1 font-mono tabular-nums text-slate-400", children: [
|
|
1257
1263
|
i.row,
|
|
1258
|
-
/* @__PURE__ */ e("p", { className: "max-w-[120px] whitespace-normal text-[10px] text-red-500", children: i.error })
|
|
1264
|
+
/* @__PURE__ */ e("p", { className: "max-w-[120px] whitespace-normal text-[10px] text-red-500", children: Te(i.error) })
|
|
1259
1265
|
] }),
|
|
1260
1266
|
T.map((p) => /* @__PURE__ */ e("td", { className: "px-1 py-1", children: /* @__PURE__ */ e(
|
|
1261
1267
|
"input",
|
|
1262
1268
|
{
|
|
1263
1269
|
value: String(v[p] ?? ""),
|
|
1264
|
-
disabled:
|
|
1270
|
+
disabled: N === "ok",
|
|
1265
1271
|
onChange: (P) => c((S) => ({ ...S, [i.row]: { ...v, [p]: P.target.value } })),
|
|
1266
1272
|
className: "h-6 w-full min-w-[80px] rounded border border-slate-200 bg-background px-1 text-[11px] dark:border-border"
|
|
1267
1273
|
}
|
|
1268
1274
|
) }, p)),
|
|
1269
|
-
/* @__PURE__ */ e("td", { className: "px-2 py-1", children:
|
|
1275
|
+
/* @__PURE__ */ e("td", { className: "px-2 py-1", children: N === "ok" ? /* @__PURE__ */ e("span", { className: "text-[10.5px] font-medium text-emerald-600", children: "✓ Created" }) : /* @__PURE__ */ a("div", { children: [
|
|
1270
1276
|
/* @__PURE__ */ e(
|
|
1271
1277
|
"button",
|
|
1272
1278
|
{
|
|
@@ -1277,7 +1283,7 @@ function _t({
|
|
|
1277
1283
|
children: "Resubmit"
|
|
1278
1284
|
}
|
|
1279
1285
|
),
|
|
1280
|
-
|
|
1286
|
+
N && N !== "ok" && /* @__PURE__ */ e("p", { className: "max-w-[140px] whitespace-normal text-[9.5px] text-red-500", children: N })
|
|
1281
1287
|
] }) })
|
|
1282
1288
|
]
|
|
1283
1289
|
},
|
|
@@ -1288,5 +1294,5 @@ function _t({
|
|
|
1288
1294
|
] });
|
|
1289
1295
|
}
|
|
1290
1296
|
export {
|
|
1291
|
-
|
|
1297
|
+
Ht as CollectionImportPanel
|
|
1292
1298
|
};
|