@nivaro/react 0.3.66 → 0.3.68
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 +15 -1
- package/dist/index.js +836 -835
- package/dist/shared/components/ActivityEntry.js +28 -28
- package/dist/shared/components/CollectionBrowserView.js +584 -585
- package/dist/shared/components/ConformanceView.js +34 -34
- package/dist/shared/components/ItemEditForm.js +1758 -1758
- package/dist/shared/components/RecordCompare.js +149 -129
- package/dist/shared/components/ReportView.js +196 -196
- package/dist/shared/components/SlaRulesView.js +36 -36
- package/dist/shared/components/bulk/BulkCompareButton.js +16 -16
- package/dist/shared/components/chat/ChatPanel.js +484 -487
- package/dist/shared/components/chat/ChatViews.js +66 -66
- package/dist/shared/components/chat/RoomParts.js +159 -157
- package/dist/shared/components/help-videos/editor/StatsTab.js +48 -47
- package/dist/shared/components/help-videos/editor/VersionsTab.js +17 -16
- package/dist/shared/components/imports/CollectionImportPanel.js +72 -72
- package/dist/shared/components/integrations/IntegrationObligationsView.js +199 -187
- package/dist/shared/components/integrations/console/EventsView.js +22 -24
- package/dist/shared/components/integrations/console/SubmissionRow.js +6 -13
- package/dist/shared/components/integrations/console/drill/SubmissionDrill.js +29 -28
- package/dist/shared/components/integrations/console/tone.js +22 -21
- package/dist/shared/components/item-edit/FieldRow.js +188 -188
- package/dist/shared/components/item-edit/FilePickerField.js +281 -297
- package/dist/shared/components/item-edit/GroupSection.js +209 -209
- package/dist/shared/components/item-edit/RecordInsights.js +101 -101
- package/dist/shared/components/item-edit/SummaryPanel.js +31 -31
- package/dist/shared/components/layout-editor/assist/ExplainDiff.js +12 -12
- package/dist/shared/components/panels/AddendumPanel.js +409 -411
- package/dist/shared/components/panels/BranchLanes.js +7 -7
- package/dist/shared/components/panels/CommentPanel.js +204 -197
- package/dist/shared/components/panels/PipelinePanel.js +264 -264
- package/dist/shared/components/panels/RecordIntegrityBanner.js +78 -78
- package/dist/shared/components/panels/RevisionsPanel.js +229 -229
- package/dist/shared/components/panels/TaskPanel.js +75 -75
- package/dist/shared/components/queue/QueueWorklist.js +591 -589
- package/dist/shared/lib/compare-value.js +73 -0
- package/dist/shared/lib/format-value.js +18 -17
- package/dist/shared/lib/utils.js +87 -80
- package/package.json +1 -1
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { jsx as e, jsxs as o, Fragment as He } from "react/jsx-runtime";
|
|
2
|
-
import { saveReportFilterPreset as Kt, listReportFilterPresets as
|
|
3
|
-
import { useQuery as Ne, useQueryClient as ht, useMutation as Me, isCancelledError as
|
|
4
|
-
import { X as Ae, Check as Ut, Plus as Yt, Camera as St, Bell as Vt, RefreshCw as Ft, ChevronsUpDown as Jt, Sparkles as
|
|
5
|
-
import { useState as C, useEffect as mt, useCallback as At, useRef as _t, useMemo as ut, Suspense as qt, lazy as Lt, memo as
|
|
2
|
+
import { saveReportFilterPreset as Kt, listReportFilterPresets as ha, deleteReportFilterPreset as fa, readReport as xa, executeCustomQuery as ba, readItems as ga, readReportFilterOptions as va, aiReportFilters as ya, readReportWidgetData as Nt, listReportAlerts as ka, createReportAlert as Na, toggleReportAlert as wa, deleteReportAlert as Sa, readReportAlertLog as _a, resolveReportAlert as Ca } from "@nivaro/sdk";
|
|
3
|
+
import { useQuery as Ne, useQueryClient as ht, useMutation as Me, isCancelledError as $a } from "@tanstack/react-query";
|
|
4
|
+
import { X as Ae, Check as Ut, Plus as Yt, Camera as St, Bell as Vt, RefreshCw as Ft, ChevronsUpDown as Jt, Sparkles as Pt, Info as qa, Table as Ma, Sigma as Fa, StickyNote as Aa, Download as Ta, TrendingUp as Gt, TrendingDown as Ht, Trash2 as Ra } from "lucide-react";
|
|
5
|
+
import { useState as C, useEffect as mt, useCallback as At, useRef as _t, useMemo as ut, Suspense as qt, lazy as Lt, memo as La } from "react";
|
|
6
6
|
import { toast as Xt } from "sonner";
|
|
7
|
-
import { useNivaroClient as Ke, useDrilldown as Zt, useOverlayState as
|
|
8
|
-
import { get as ct, post as pt, del as
|
|
9
|
-
import { useLiveWidget as Da, liveWidgetInterval as
|
|
7
|
+
import { useNivaroClient as Ke, useDrilldown as Zt, useOverlayState as Oa } from "../context.js";
|
|
8
|
+
import { get as ct, post as pt, del as Ka, put as Pa } from "../lib/commands.js";
|
|
9
|
+
import { useLiveWidget as Da, liveWidgetInterval as za } from "../lib/live-widgets.js";
|
|
10
10
|
import { serverErrorText as It, loadErrorText as Tt } from "../lib/load-error.js";
|
|
11
|
-
import { restrictedScopeSelections as
|
|
12
|
-
import { buildReportTree as
|
|
13
|
-
import { uniqueByValue as
|
|
14
|
-
import { useMyScopes as ea, matchScopeDimension as
|
|
15
|
-
import { cn as V } from "../lib/utils.js";
|
|
16
|
-
import { BackgroundRunOffer as
|
|
11
|
+
import { restrictedScopeSelections as ja, cascadeFilter as Ea, fetchCascadeRelations as Wa } from "../lib/quick-filter-cascade.js";
|
|
12
|
+
import { buildReportTree as Ba } from "../lib/report-tree.js";
|
|
13
|
+
import { uniqueByValue as Qa } from "../lib/unique-options.js";
|
|
14
|
+
import { useMyScopes as ea, matchScopeDimension as Ua, translateScopeValues as Dt, effectiveScopeSeedIds as Ya } from "../lib/use-my-scopes.js";
|
|
15
|
+
import { cn as V, toLocalDateString as ta } from "../lib/utils.js";
|
|
16
|
+
import { BackgroundRunOffer as aa } from "./BackgroundRunOffer.js";
|
|
17
17
|
import { RechartsGate as Le } from "./charts/RechartsGate.js";
|
|
18
|
-
import { LoadErrorNote as
|
|
19
|
-
import { RecordDrilldownSheet as
|
|
20
|
-
import { TipLayer as
|
|
21
|
-
import { Command as
|
|
22
|
-
import { Popover as
|
|
18
|
+
import { LoadErrorNote as la } from "./LoadErrorNote.js";
|
|
19
|
+
import { RecordDrilldownSheet as Va } from "./RecordDrilldownSheet.js";
|
|
20
|
+
import { TipLayer as Ja } from "./TipLayer.js";
|
|
21
|
+
import { Command as Ga, CommandInput as Ha, CommandList as Xa, CommandEmpty as Za, CommandItem as Ia } from "./ui/command.js";
|
|
22
|
+
import { Popover as ra, PopoverTrigger as na, PopoverContent as sa } from "./ui/popover.js";
|
|
23
23
|
import { SimpleSelect as wt } from "./ui/SimpleSelect.js";
|
|
24
24
|
import { Skeleton as Oe } from "./ui/skeleton.js";
|
|
25
|
-
async function
|
|
25
|
+
async function el(t, n) {
|
|
26
26
|
const a = t == null ? void 0 : t.querySelector("svg");
|
|
27
27
|
if (!(!a || typeof ClipboardItem > "u"))
|
|
28
28
|
try {
|
|
@@ -42,7 +42,7 @@ async function Ia(t, n) {
|
|
|
42
42
|
} catch {
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
const Ce = (t) => Math.abs(t) >= 1e9 ? `${(t / 1e9).toFixed(1).replace(/\.0$/, "")}B` : Math.abs(t) >= 1e6 ? `${(t / 1e6).toFixed(1).replace(/\.0$/, "")}M` : Math.abs(t) >= 1e3 ? `${(t / 1e3).toFixed(1).replace(/\.0$/, "")}k` : String(t),
|
|
45
|
+
const Ce = (t) => Math.abs(t) >= 1e9 ? `${(t / 1e9).toFixed(1).replace(/\.0$/, "")}B` : Math.abs(t) >= 1e6 ? `${(t / 1e6).toFixed(1).replace(/\.0$/, "")}M` : Math.abs(t) >= 1e3 ? `${(t / 1e3).toFixed(1).replace(/\.0$/, "")}k` : String(t), tl = [
|
|
46
46
|
"Jan",
|
|
47
47
|
"Feb",
|
|
48
48
|
"Mar",
|
|
@@ -55,22 +55,22 @@ const Ce = (t) => Math.abs(t) >= 1e9 ? `${(t / 1e9).toFixed(1).replace(/\.0$/, "
|
|
|
55
55
|
"Oct",
|
|
56
56
|
"Nov",
|
|
57
57
|
"Dec"
|
|
58
|
-
],
|
|
58
|
+
], al = (t) => {
|
|
59
59
|
const n = String(t ?? ""), a = /^(\d{4})-(\d{2})(?:-(\d{2}))?/.exec(n);
|
|
60
60
|
if (a) {
|
|
61
|
-
const s =
|
|
61
|
+
const s = tl[Number(a[2]) - 1] ?? a[2];
|
|
62
62
|
return a[3] ? `${s} ${Number(a[3])}` : `${s} '${a[1].slice(2)}`;
|
|
63
63
|
}
|
|
64
64
|
return n.length > 16 ? `${n.slice(0, 15)}…` : n;
|
|
65
65
|
}, Ct = (t) => ({
|
|
66
66
|
interval: t > 12 ? Math.ceil(t / 12) - 1 : 0,
|
|
67
|
-
tickFormatter:
|
|
67
|
+
tickFormatter: al,
|
|
68
68
|
minTickGap: 4,
|
|
69
69
|
...t > 5 && t <= 12 ? { angle: -35, textAnchor: "end", height: 56 } : {}
|
|
70
|
-
}),
|
|
70
|
+
}), ll = (t) => {
|
|
71
71
|
const n = String(t ?? "");
|
|
72
72
|
return n.length > 22 ? `${n.slice(0, 21)}…` : n;
|
|
73
|
-
}, Ot = () => import("./ReportEditMode.js"),
|
|
73
|
+
}, Ot = () => import("./ReportEditMode.js"), rl = Lt(() => Ot().then((t) => ({ default: t.AddWidgetBar }))), nl = Lt(() => Ot().then((t) => ({ default: t.WidgetConfigSheet }))), sl = Lt(() => Ot().then((t) => ({ default: t.WidgetEditBar }))), Ge = "rgb(var(--nvr-cyan-rgb, 0 206 255))", ce = [
|
|
74
74
|
Ge,
|
|
75
75
|
"#4f7cac",
|
|
76
76
|
// steel blue
|
|
@@ -90,7 +90,7 @@ const Ce = (t) => Math.abs(t) >= 1e9 ? `${(t / 1e9).toFixed(1).replace(/\.0$/, "
|
|
|
90
90
|
// olive
|
|
91
91
|
"#9c7b56"
|
|
92
92
|
// tan
|
|
93
|
-
],
|
|
93
|
+
], il = [
|
|
94
94
|
{ id: "", label: "All time" },
|
|
95
95
|
{ id: "this_month", label: "This month" },
|
|
96
96
|
{ id: "last_30_days", label: "Last 30 days" },
|
|
@@ -125,7 +125,7 @@ function zt({ pct: t }) {
|
|
|
125
125
|
}
|
|
126
126
|
);
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function ia({
|
|
129
129
|
reportId: t,
|
|
130
130
|
field: n,
|
|
131
131
|
label: a,
|
|
@@ -134,23 +134,23 @@ function sa({
|
|
|
134
134
|
onChange: m,
|
|
135
135
|
allowedValues: h
|
|
136
136
|
}) {
|
|
137
|
-
const f = Ke(), u = ht(), [R, M] = C(!1), { scopes: N } = ea(), W = s ?
|
|
137
|
+
const f = Ke(), u = ht(), [R, M] = C(!1), { scopes: N } = ea(), W = s ? ja(s.collection, N) : [], { data: p = [] } = Ne({
|
|
138
138
|
queryKey: ["nivaro-report-filter-opts", t, n, s ?? null, W],
|
|
139
139
|
queryFn: async () => {
|
|
140
140
|
if (s) {
|
|
141
|
-
const F = s.value_field ?? "id", Z = s.label_field ?? F,
|
|
141
|
+
const F = s.value_field ?? "id", Z = s.label_field ?? F, D = W.length ? Ea(
|
|
142
142
|
s.collection,
|
|
143
|
-
await
|
|
143
|
+
await Wa(f, u, s.collection),
|
|
144
144
|
W
|
|
145
145
|
) : null, me = await f.request(
|
|
146
|
-
|
|
146
|
+
ga(s.collection, {
|
|
147
147
|
fields: [.../* @__PURE__ */ new Set(["id", F, Z])],
|
|
148
|
-
...
|
|
148
|
+
...D ? { filter: D } : {},
|
|
149
149
|
sort: s.sort ? [s.sort] : void 0,
|
|
150
150
|
limit: 200
|
|
151
151
|
})
|
|
152
152
|
);
|
|
153
|
-
return
|
|
153
|
+
return Qa(
|
|
154
154
|
(me.data ?? []).map((J) => ({
|
|
155
155
|
value: String(J[F] ?? J.id),
|
|
156
156
|
label: String(J[Z] ?? J[F] ?? J.id)
|
|
@@ -158,13 +158,13 @@ function sa({
|
|
|
158
158
|
(J) => J.value
|
|
159
159
|
);
|
|
160
160
|
}
|
|
161
|
-
return f.request(
|
|
161
|
+
return f.request(va(t, n)).then((F) => F.data);
|
|
162
162
|
},
|
|
163
163
|
enabled: R,
|
|
164
164
|
staleTime: 12e4
|
|
165
165
|
}), S = h != null && h.length ? p.filter((F) => h.some((Z) => String(Z) === F.value)) : p, ee = c.length > 0;
|
|
166
|
-
return /* @__PURE__ */ o(
|
|
167
|
-
/* @__PURE__ */ e(
|
|
166
|
+
return /* @__PURE__ */ o(ra, { open: R, onOpenChange: M, children: [
|
|
167
|
+
/* @__PURE__ */ e(na, { asChild: !0, children: /* @__PURE__ */ o(
|
|
168
168
|
"button",
|
|
169
169
|
{
|
|
170
170
|
type: "button",
|
|
@@ -179,22 +179,22 @@ function sa({
|
|
|
179
179
|
]
|
|
180
180
|
}
|
|
181
181
|
) }),
|
|
182
|
-
/* @__PURE__ */ e(
|
|
183
|
-
/* @__PURE__ */ e(
|
|
184
|
-
/* @__PURE__ */ o(
|
|
185
|
-
/* @__PURE__ */ e(
|
|
182
|
+
/* @__PURE__ */ e(sa, { className: "w-[240px] p-0", align: "start", children: /* @__PURE__ */ o(Ga, { children: [
|
|
183
|
+
/* @__PURE__ */ e(Ha, { placeholder: `Filter ${a}…`, className: "h-8 text-[12.5px]" }),
|
|
184
|
+
/* @__PURE__ */ o(Xa, { className: "max-h-52", children: [
|
|
185
|
+
/* @__PURE__ */ e(Za, { children: "No values." }),
|
|
186
186
|
S.map((F) => {
|
|
187
|
-
const Z = c.some((
|
|
187
|
+
const Z = c.some((D) => String(D) === F.value);
|
|
188
188
|
return /* @__PURE__ */ o(
|
|
189
|
-
|
|
189
|
+
Ia,
|
|
190
190
|
{
|
|
191
191
|
value: F.label,
|
|
192
192
|
onSelect: () => {
|
|
193
|
-
const
|
|
193
|
+
const D = Z ? c.filter((J) => String(J) !== F.value) : [...c, F.value], me = (J) => {
|
|
194
194
|
var B;
|
|
195
195
|
return ((B = p.find((se) => se.value === String(J))) == null ? void 0 : B.label) ?? String(J);
|
|
196
196
|
};
|
|
197
|
-
m(
|
|
197
|
+
m(D, D.map(me));
|
|
198
198
|
},
|
|
199
199
|
className: "text-[12.5px]",
|
|
200
200
|
children: [
|
|
@@ -209,7 +209,7 @@ function sa({
|
|
|
209
209
|
] }) })
|
|
210
210
|
] });
|
|
211
211
|
}
|
|
212
|
-
function
|
|
212
|
+
function oa(t) {
|
|
213
213
|
if (!t) return null;
|
|
214
214
|
const n = /* @__PURE__ */ new Date(), a = (m) => {
|
|
215
215
|
const h = (f) => String(f).padStart(2, "0");
|
|
@@ -234,14 +234,14 @@ function ia(t) {
|
|
|
234
234
|
return null;
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
|
-
const
|
|
237
|
+
const ol = "No workflow number", dl = /^undefined-\d+$/;
|
|
238
238
|
function je(t, n, a) {
|
|
239
239
|
if (t == null || t === "") return "—";
|
|
240
|
-
if (typeof t == "string" &&
|
|
240
|
+
if (typeof t == "string" && dl.test(t)) return ol;
|
|
241
241
|
if (n === "date" || n === "datetime") {
|
|
242
242
|
const m = new Date(String(t));
|
|
243
243
|
if (Number.isNaN(m.getTime())) return String(t);
|
|
244
|
-
const h = m
|
|
244
|
+
const h = ta(m);
|
|
245
245
|
return n === "date" ? h : `${h} ${m.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })}`;
|
|
246
246
|
}
|
|
247
247
|
const s = Number(t);
|
|
@@ -259,8 +259,8 @@ const ze = /* @__PURE__ */ new Set([
|
|
|
259
259
|
"percent",
|
|
260
260
|
"days"
|
|
261
261
|
]);
|
|
262
|
-
function
|
|
263
|
-
const s = {}, c =
|
|
262
|
+
function da(t, n, a) {
|
|
263
|
+
const s = {}, c = oa(n);
|
|
264
264
|
for (const [m, h] of Object.entries(t.params ?? {})) {
|
|
265
265
|
if (h === "$date.start") {
|
|
266
266
|
c && (s[m] = c.start);
|
|
@@ -280,12 +280,12 @@ function oa(t, n, a) {
|
|
|
280
280
|
}
|
|
281
281
|
return s;
|
|
282
282
|
}
|
|
283
|
-
const
|
|
283
|
+
const cl = (t) => `$${Ce(Math.round(t))}`, ml = [
|
|
284
284
|
{ gte: 90, color: "#ef4444" },
|
|
285
285
|
{ gte: 70, color: "#f59e0b" },
|
|
286
286
|
{ gte: -1 / 0, color: "#10b981" }
|
|
287
287
|
];
|
|
288
|
-
function
|
|
288
|
+
function ul({
|
|
289
289
|
rows: t,
|
|
290
290
|
cfg: n,
|
|
291
291
|
onDrill: a
|
|
@@ -294,7 +294,7 @@ function ml({
|
|
|
294
294
|
var S;
|
|
295
295
|
return typeof ((S = t[0]) == null ? void 0 : S[p]) == "number";
|
|
296
296
|
}).slice(0, 3).map((p) => ({ field: p, label: p })), m = ut(
|
|
297
|
-
() => s ?
|
|
297
|
+
() => s ? Ba(
|
|
298
298
|
t,
|
|
299
299
|
s,
|
|
300
300
|
c.map((p) => p.field)
|
|
@@ -310,7 +310,7 @@ function ml({
|
|
|
310
310
|
};
|
|
311
311
|
S(m), f(p), R(!0);
|
|
312
312
|
}, [m, u]);
|
|
313
|
-
const M = (s == null ? void 0 : s.thresholds) ??
|
|
313
|
+
const M = (s == null ? void 0 : s.thresholds) ?? ml, N = (p) => {
|
|
314
314
|
var S;
|
|
315
315
|
return p == null ? void 0 : ((S = M.find((ee) => p >= ee.gte)) == null ? void 0 : S.color) ?? "#10b981";
|
|
316
316
|
}, W = (p) => {
|
|
@@ -330,13 +330,13 @@ function ml({
|
|
|
330
330
|
collection: s.drill.collection,
|
|
331
331
|
itemId: String(p.drillId),
|
|
332
332
|
title: p.label
|
|
333
|
-
}) : f((
|
|
334
|
-
const me = new Set(
|
|
333
|
+
}) : f((D) => {
|
|
334
|
+
const me = new Set(D);
|
|
335
335
|
return me.has(p.key) ? me.delete(p.key) : me.add(p.key), me;
|
|
336
336
|
});
|
|
337
337
|
},
|
|
338
|
-
onKeyDown: (
|
|
339
|
-
(
|
|
338
|
+
onKeyDown: (D) => {
|
|
339
|
+
(D.key === "Enter" || D.key === " ") && D.currentTarget.click();
|
|
340
340
|
},
|
|
341
341
|
children: [
|
|
342
342
|
/* @__PURE__ */ o("div", { className: "flex items-center gap-1.5", children: [
|
|
@@ -391,11 +391,11 @@ function ml({
|
|
|
391
391
|
)
|
|
392
392
|
}
|
|
393
393
|
),
|
|
394
|
-
/* @__PURE__ */ e("div", { className: "ml-[18px] mt-0.5 flex flex-wrap gap-x-3 text-[10px] tabular-nums text-slate-400", children: c.map((
|
|
395
|
-
|
|
394
|
+
/* @__PURE__ */ e("div", { className: "ml-[18px] mt-0.5 flex flex-wrap gap-x-3 text-[10px] tabular-nums text-slate-400", children: c.map((D) => /* @__PURE__ */ o("span", { children: [
|
|
395
|
+
D.label ?? D.field,
|
|
396
396
|
" ",
|
|
397
|
-
/* @__PURE__ */ e("span", { className: "font-medium text-slate-500 dark:text-slate-300", children: p.sums[
|
|
398
|
-
] },
|
|
397
|
+
/* @__PURE__ */ e("span", { className: "font-medium text-slate-500 dark:text-slate-300", children: p.sums[D.field] == null ? D.empty_label ?? "—" : n.value_format === "currency" ? cl(p.sums[D.field]) : p.sums[D.field].toLocaleString() })
|
|
398
|
+
] }, D.field)) })
|
|
399
399
|
]
|
|
400
400
|
}
|
|
401
401
|
),
|
|
@@ -404,7 +404,7 @@ function ml({
|
|
|
404
404
|
};
|
|
405
405
|
return !s || m.length === 0 ? /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No data." }) : /* @__PURE__ */ e("div", { className: "min-h-0 flex-1 space-y-0.5 overflow-y-auto pr-1", children: m.map(W) });
|
|
406
406
|
}
|
|
407
|
-
function
|
|
407
|
+
function pl(t) {
|
|
408
408
|
const [n, a] = C(() => typeof IntersectionObserver > "u");
|
|
409
409
|
return mt(() => {
|
|
410
410
|
if (n) return;
|
|
@@ -426,7 +426,7 @@ function ul(t) {
|
|
|
426
426
|
};
|
|
427
427
|
}, [n, t]), n;
|
|
428
428
|
}
|
|
429
|
-
function
|
|
429
|
+
function hl(t) {
|
|
430
430
|
const n = Ke(), a = _t(!1);
|
|
431
431
|
return async (s) => {
|
|
432
432
|
if (!(!t || a.current)) {
|
|
@@ -441,7 +441,7 @@ function pl(t) {
|
|
|
441
441
|
}
|
|
442
442
|
};
|
|
443
443
|
}
|
|
444
|
-
function
|
|
444
|
+
function ca(t, n) {
|
|
445
445
|
let a = n;
|
|
446
446
|
if (t.group_rows && t.x_field) {
|
|
447
447
|
const s = /* @__PURE__ */ new Map(), c = new Set(
|
|
@@ -466,11 +466,11 @@ function da(t, n) {
|
|
|
466
466
|
}
|
|
467
467
|
return t.limit && t.limit > 0 && (a = a.slice(0, t.limit)), a;
|
|
468
468
|
}
|
|
469
|
-
function
|
|
470
|
-
const c =
|
|
469
|
+
function ma(t, n, a, s) {
|
|
470
|
+
const c = ba(n, a);
|
|
471
471
|
return t.request(s ? { ...c, _signal: s } : c).then((m) => m.data ?? []);
|
|
472
472
|
}
|
|
473
|
-
function
|
|
473
|
+
function fl({
|
|
474
474
|
cfg: t,
|
|
475
475
|
dateRange: n,
|
|
476
476
|
entityFilters: a,
|
|
@@ -480,9 +480,9 @@ function hl({
|
|
|
480
480
|
deferred: h = !1
|
|
481
481
|
}) {
|
|
482
482
|
var re, le;
|
|
483
|
-
const f = Ke(), u =
|
|
483
|
+
const f = Ke(), u = hl(m), [R, M] = C(""), [N, W] = C(0), [p, S] = C(null), ee = da(t, n, a), { data: F, isLoading: Z, error: D, isFetching: me, refetch: J } = Ne({
|
|
484
484
|
queryKey: ["nivaro-report-query", t.slug, ee],
|
|
485
|
-
queryFn: ({ signal: w }) =>
|
|
485
|
+
queryFn: ({ signal: w }) => ma(f, t.slug, ee, w),
|
|
486
486
|
enabled: !h,
|
|
487
487
|
staleTime: 6e4,
|
|
488
488
|
refetchInterval: s,
|
|
@@ -496,7 +496,7 @@ function hl({
|
|
|
496
496
|
return /* @__PURE__ */ o("div", { className: "flex flex-col gap-2 px-1", children: [
|
|
497
497
|
/* @__PURE__ */ e("p", { className: "text-[12px] text-slate-300", children: "Loading…" }),
|
|
498
498
|
/* @__PURE__ */ e(
|
|
499
|
-
|
|
499
|
+
aa,
|
|
500
500
|
{
|
|
501
501
|
pending: !0,
|
|
502
502
|
request: {
|
|
@@ -510,16 +510,16 @@ function hl({
|
|
|
510
510
|
}
|
|
511
511
|
)
|
|
512
512
|
] });
|
|
513
|
-
if (
|
|
513
|
+
if (D)
|
|
514
514
|
return /* @__PURE__ */ e(
|
|
515
|
-
|
|
515
|
+
la,
|
|
516
516
|
{
|
|
517
517
|
className: "px-1",
|
|
518
|
-
message: It(
|
|
518
|
+
message: It(D) ?? Tt(D, "this query"),
|
|
519
519
|
onRetry: () => void J()
|
|
520
520
|
}
|
|
521
521
|
);
|
|
522
|
-
const B =
|
|
522
|
+
const B = ca(t, F ?? []);
|
|
523
523
|
if (B.length === 0) return /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No data." });
|
|
524
524
|
const se = t.columns && t.columns.length > 0 ? t.columns : Object.keys(B[0] ?? {}).map((w) => ({ field: w }));
|
|
525
525
|
if (t.display === "kpis") {
|
|
@@ -561,7 +561,7 @@ function hl({
|
|
|
561
561
|
);
|
|
562
562
|
}
|
|
563
563
|
if (t.display === "tree")
|
|
564
|
-
return /* @__PURE__ */ e(
|
|
564
|
+
return /* @__PURE__ */ e(ul, { rows: B, cfg: t, onDrill: (w) => m == null ? void 0 : m(w) });
|
|
565
565
|
if (t.display === "table") {
|
|
566
566
|
const w = se.filter((_) => ze.has(_.format ?? "")), T = R.trim().toLowerCase(), Q = T ? B.filter(
|
|
567
567
|
(_) => Object.values(_).some(
|
|
@@ -861,7 +861,7 @@ function hl({
|
|
|
861
861
|
stroke: "#94a3b8",
|
|
862
862
|
width: 140,
|
|
863
863
|
interval: 0,
|
|
864
|
-
tickFormatter:
|
|
864
|
+
tickFormatter: Sl
|
|
865
865
|
}
|
|
866
866
|
)
|
|
867
867
|
] }) : /* @__PURE__ */ o(He, { children: [
|
|
@@ -916,8 +916,8 @@ function hl({
|
|
|
916
916
|
G
|
|
917
917
|
] });
|
|
918
918
|
}
|
|
919
|
-
const
|
|
920
|
-
function
|
|
919
|
+
const xl = ["gt", "gte", "lt", "lte", "eq"], ua = { gt: ">", gte: "≥", lt: "<", lte: "≤", eq: "=" }, bl = ["sum", "avg", "max", "min"];
|
|
920
|
+
function gl(t) {
|
|
921
921
|
var s, c, m;
|
|
922
922
|
const n = [
|
|
923
923
|
{ value: "value", label: "Value (widget metric)" },
|
|
@@ -948,15 +948,15 @@ function bl(t) {
|
|
|
948
948
|
function jt(t, n) {
|
|
949
949
|
var h;
|
|
950
950
|
const a = /^(sum|avg|max|min|tile):(.+)$/.exec(t.field), s = a ? a[2] : t.field, c = ((h = n.find((f) => f.value === t.field || f.value === s)) == null ? void 0 : h.label) ?? s;
|
|
951
|
-
return `${a && a[1] !== "sum" && a[1] !== "tile" ? `${a[1]} ` : ""}${c} ${
|
|
951
|
+
return `${a && a[1] !== "sum" && a[1] !== "tile" ? `${a[1]} ` : ""}${c} ${ua[t.op] ?? t.op} ${t.value.toLocaleString()}`;
|
|
952
952
|
}
|
|
953
|
-
function
|
|
953
|
+
function vl({ reportId: t, alert: n }) {
|
|
954
954
|
const a = Ke(), s = ht(), { data: c = [] } = Ne({
|
|
955
955
|
queryKey: ["nivaro-report-alert-log", t, n.id],
|
|
956
|
-
queryFn: () => a.request(
|
|
956
|
+
queryFn: () => a.request(_a(t, n.id)).then((h) => h.data),
|
|
957
957
|
staleTime: 3e4
|
|
958
958
|
}), m = Me({
|
|
959
|
-
mutationFn: () => a.request(
|
|
959
|
+
mutationFn: () => a.request(Ca(t, n.id)),
|
|
960
960
|
onSuccess: () => {
|
|
961
961
|
s.invalidateQueries({ queryKey: ["nivaro-report-alert-log", t, n.id] }), s.invalidateQueries({ queryKey: ["nivaro-report-alerts", t] });
|
|
962
962
|
}
|
|
@@ -987,26 +987,26 @@ function gl({ reportId: t, alert: n }) {
|
|
|
987
987
|
)
|
|
988
988
|
] }, h.id)) });
|
|
989
989
|
}
|
|
990
|
-
function
|
|
990
|
+
function yl({
|
|
991
991
|
reportId: t,
|
|
992
992
|
widget: n,
|
|
993
993
|
filterBar: a
|
|
994
994
|
}) {
|
|
995
995
|
const s = Ke(), c = ht(), [m, h] = C(!1), [f, u] = C(""), [R, M] = C([
|
|
996
996
|
{ field: "value", agg: "sum", op: "gt", value: "" }
|
|
997
|
-
]), [N, W] = C([]), [p, S] = C(!1), [ee, F] = C(null), Z =
|
|
997
|
+
]), [N, W] = C([]), [p, S] = C(!1), [ee, F] = C(null), Z = gl(n), { data: D = [] } = Ne({
|
|
998
998
|
queryKey: ["nivaro-report-alerts", t],
|
|
999
|
-
queryFn: () => s.request(
|
|
999
|
+
queryFn: () => s.request(ka(t)).then((x) => x.data),
|
|
1000
1000
|
enabled: m,
|
|
1001
1001
|
staleTime: 3e4
|
|
1002
|
-
}), me =
|
|
1002
|
+
}), me = D.filter((x) => x.widget === n.id), J = () => void c.invalidateQueries({ queryKey: ["nivaro-report-alerts", t] }), B = () => R.filter((x) => x.value.trim() !== "" && !Number.isNaN(Number(x.value))).map((x) => {
|
|
1003
1003
|
const I = Z.find((G) => G.value === x.field);
|
|
1004
1004
|
return { field: I != null && I.aggregatable && x.agg !== "sum" ? `${x.agg}:${x.field}` : x.field, op: x.op, value: Number(x.value) };
|
|
1005
1005
|
}), se = Me({
|
|
1006
1006
|
mutationFn: () => {
|
|
1007
1007
|
const x = B(), I = x.map((ae) => jt(ae, Z)).join(" & ");
|
|
1008
1008
|
return s.request(
|
|
1009
|
-
|
|
1009
|
+
Na(t, {
|
|
1010
1010
|
widget: n.id,
|
|
1011
1011
|
name: f.trim() || I.slice(0, 120),
|
|
1012
1012
|
conditions: x,
|
|
@@ -1020,14 +1020,14 @@ function vl({
|
|
|
1020
1020
|
u(""), M([{ field: "value", agg: "sum", op: "gt", value: "" }]), W([]), J();
|
|
1021
1021
|
}
|
|
1022
1022
|
}), xe = Me({
|
|
1023
|
-
mutationFn: (x) => s.request(
|
|
1023
|
+
mutationFn: (x) => s.request(wa(t, x.id, !x.is_active)),
|
|
1024
1024
|
onSuccess: J
|
|
1025
1025
|
}), be = Me({
|
|
1026
|
-
mutationFn: (x) => s.request(
|
|
1026
|
+
mutationFn: (x) => s.request(Sa(t, x.id)),
|
|
1027
1027
|
onSuccess: J
|
|
1028
1028
|
}), ge = B().length > 0, $e = me.some((x) => x.firing);
|
|
1029
|
-
return /* @__PURE__ */ o(
|
|
1030
|
-
/* @__PURE__ */ e(
|
|
1029
|
+
return /* @__PURE__ */ o(ra, { open: m, onOpenChange: h, children: [
|
|
1030
|
+
/* @__PURE__ */ e(na, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1031
1031
|
"button",
|
|
1032
1032
|
{
|
|
1033
1033
|
type: "button",
|
|
@@ -1039,7 +1039,7 @@ function vl({
|
|
|
1039
1039
|
children: /* @__PURE__ */ e(Vt, { className: "h-3 w-3" })
|
|
1040
1040
|
}
|
|
1041
1041
|
) }),
|
|
1042
|
-
/* @__PURE__ */ o(
|
|
1042
|
+
/* @__PURE__ */ o(sa, { className: "w-[380px] p-3", align: "end", children: [
|
|
1043
1043
|
/* @__PURE__ */ o("p", { className: "mb-2 text-[12px] font-semibold text-slate-700 dark:text-slate-200", children: [
|
|
1044
1044
|
"Alerts · ",
|
|
1045
1045
|
n.title
|
|
@@ -1084,7 +1084,7 @@ function vl({
|
|
|
1084
1084
|
type: "button",
|
|
1085
1085
|
className: "text-slate-300 hover:text-red-500",
|
|
1086
1086
|
onClick: () => be.mutate(x),
|
|
1087
|
-
children: /* @__PURE__ */ e(
|
|
1087
|
+
children: /* @__PURE__ */ e(Ra, { className: "h-3 w-3" })
|
|
1088
1088
|
}
|
|
1089
1089
|
)
|
|
1090
1090
|
] }),
|
|
@@ -1096,7 +1096,7 @@ function vl({
|
|
|
1096
1096
|
" · Last fired: ",
|
|
1097
1097
|
x.last_fired ? new Date(x.last_fired).toLocaleString() : "Never"
|
|
1098
1098
|
] }),
|
|
1099
|
-
ee === x.id && /* @__PURE__ */ e(
|
|
1099
|
+
ee === x.id && /* @__PURE__ */ e(vl, { reportId: t, alert: x })
|
|
1100
1100
|
]
|
|
1101
1101
|
},
|
|
1102
1102
|
x.id
|
|
@@ -1131,7 +1131,7 @@ function vl({
|
|
|
1131
1131
|
onChange: (G) => M(
|
|
1132
1132
|
(he) => he.map((re, le) => le === I ? { ...re, agg: G } : re)
|
|
1133
1133
|
),
|
|
1134
|
-
options:
|
|
1134
|
+
options: bl.map((G) => ({ value: G, label: G })),
|
|
1135
1135
|
ariaLabel: "Aggregate",
|
|
1136
1136
|
className: "h-7 w-[62px] rounded-md px-1.5 py-0 text-[11.5px] dark:border-border dark:bg-card"
|
|
1137
1137
|
}
|
|
@@ -1143,7 +1143,7 @@ function vl({
|
|
|
1143
1143
|
onChange: (G) => M(
|
|
1144
1144
|
(he) => he.map((re, le) => le === I ? { ...re, op: G } : re)
|
|
1145
1145
|
),
|
|
1146
|
-
options:
|
|
1146
|
+
options: xl.map((G) => ({ value: G, label: ua[G] })),
|
|
1147
1147
|
ariaLabel: "Operator",
|
|
1148
1148
|
className: "h-7 w-[52px] rounded-md px-1.5 py-0 text-[11.5px] dark:border-border dark:bg-card"
|
|
1149
1149
|
}
|
|
@@ -1185,7 +1185,7 @@ function vl({
|
|
|
1185
1185
|
/* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1", children: a.map((x) => {
|
|
1186
1186
|
var I;
|
|
1187
1187
|
return /* @__PURE__ */ e(
|
|
1188
|
-
|
|
1188
|
+
ia,
|
|
1189
1189
|
{
|
|
1190
1190
|
reportId: t,
|
|
1191
1191
|
field: x.field,
|
|
@@ -1233,7 +1233,7 @@ function vl({
|
|
|
1233
1233
|
] })
|
|
1234
1234
|
] });
|
|
1235
1235
|
}
|
|
1236
|
-
const
|
|
1236
|
+
const kl = {
|
|
1237
1237
|
eq: "_eq",
|
|
1238
1238
|
neq: "_neq",
|
|
1239
1239
|
gt: "_gt",
|
|
@@ -1249,14 +1249,14 @@ function Mt(t, n, a, s) {
|
|
|
1249
1249
|
var R, M;
|
|
1250
1250
|
const c = t.config ?? {}, m = [];
|
|
1251
1251
|
for (const N of c.filters ?? []) {
|
|
1252
|
-
const W =
|
|
1252
|
+
const W = kl[N.op];
|
|
1253
1253
|
if (!W) continue;
|
|
1254
1254
|
let p = N.value;
|
|
1255
1255
|
N.op === "in" && typeof p == "string" && (p = p.split(",").map((S) => S.trim())), m.push({ path: [N.field], op: W, value: p });
|
|
1256
1256
|
}
|
|
1257
1257
|
for (const N of n)
|
|
1258
1258
|
(R = N.values) != null && R.length && m.push({ path: [N.field], op: "_in", value: N.values });
|
|
1259
|
-
const h = c.date_field || ((M = c.dimension) != null && M.bucket ? c.dimension.field : null), f =
|
|
1259
|
+
const h = c.date_field || ((M = c.dimension) != null && M.bucket ? c.dimension.field : null), f = oa(a);
|
|
1260
1260
|
f && h && (m.push({ path: [h], op: "_gte", value: f.start }), m.push({ path: [h], op: "_lte", value: `${f.end}T23:59:59` }));
|
|
1261
1261
|
const u = c.dimension;
|
|
1262
1262
|
if (s !== void 0 && (u != null && u.field))
|
|
@@ -1292,7 +1292,7 @@ function Et(t) {
|
|
|
1292
1292
|
}
|
|
1293
1293
|
return a.length > 0 ? a.join(" · ") : "No configuration details";
|
|
1294
1294
|
}
|
|
1295
|
-
function
|
|
1295
|
+
function Nl(t) {
|
|
1296
1296
|
var n, a;
|
|
1297
1297
|
return t ? t.value != null ? Number(t.value) : t.series ? t.series.reduce((s, c) => s + (Number(c.value) || 0), 0) : (n = t.tiles) != null && n.length ? Number(((a = t.tiles[0]) == null ? void 0 : a.value) ?? 0) : t.row_count != null ? Number(t.row_count) : null : null;
|
|
1298
1298
|
}
|
|
@@ -1326,7 +1326,7 @@ function Wt(t, n, a) {
|
|
|
1326
1326
|
const R = u.href;
|
|
1327
1327
|
setTimeout(() => URL.revokeObjectURL(R), 1e4);
|
|
1328
1328
|
}
|
|
1329
|
-
function
|
|
1329
|
+
function wl({
|
|
1330
1330
|
collection: t,
|
|
1331
1331
|
conditions: n,
|
|
1332
1332
|
title: a,
|
|
@@ -1435,7 +1435,7 @@ function Qt(t, n) {
|
|
|
1435
1435
|
const a = Number(n);
|
|
1436
1436
|
return Number.isFinite(a) ? t.op === "gt" ? a > t.value : t.op === "gte" ? a >= t.value : t.op === "lt" ? a < t.value : t.op === "lte" ? a <= t.value : a === t.value : !1;
|
|
1437
1437
|
}
|
|
1438
|
-
const Rt =
|
|
1438
|
+
const Rt = La(function({
|
|
1439
1439
|
reportId: n,
|
|
1440
1440
|
widget: a,
|
|
1441
1441
|
dateRange: s,
|
|
@@ -1453,7 +1453,7 @@ const Rt = Ra(function({
|
|
|
1453
1453
|
currentFilters: ee
|
|
1454
1454
|
}) {
|
|
1455
1455
|
var xt, Ue, bt, Ye, gt, vt, tt, yt, Ve, at, Je, lt, rt, nt, ne, kt, st, it, ot, Re;
|
|
1456
|
-
const F = Ke(), [Z,
|
|
1456
|
+
const F = Ke(), [Z, D] = C(""), [me, J] = C(0), [B, se] = C(null), [xe, be] = C(!1), [ge, $e] = C(""), [x, I] = C(""), [ae, G] = C(!1), [he, re] = C(!1), [le, w] = C([]), T = _t(null), Q = pl(T), [H, ie] = C(!1), [ue, fe] = C(null), [_, z] = C(!1), [pe, ve] = C(null), we = ["bar", "line", "donut", "pareto", "area"].includes(a.type) || a.type === "kpi" && !!((xt = a.config) != null && xt.compare || (Ue = a.config) != null && Ue.sparkline), Te = ht(), [Xe, ye] = C(!1), Ze = async () => {
|
|
1457
1457
|
ye(!0);
|
|
1458
1458
|
try {
|
|
1459
1459
|
const l = await F.request(
|
|
@@ -1487,7 +1487,7 @@ const Rt = Ra(function({
|
|
|
1487
1487
|
}), {
|
|
1488
1488
|
data: Ie,
|
|
1489
1489
|
isLoading: Ee,
|
|
1490
|
-
error:
|
|
1490
|
+
error: Pe,
|
|
1491
1491
|
refetch: We,
|
|
1492
1492
|
isFetching: $t
|
|
1493
1493
|
} = Ne({
|
|
@@ -1504,7 +1504,7 @@ const Rt = Ra(function({
|
|
|
1504
1504
|
enabled: Q && a.type !== "divider" && (a.type !== "query" || !!u),
|
|
1505
1505
|
staleTime: 6e4,
|
|
1506
1506
|
// Per-widget auto-refresh (#168) overrides the report-level interval.
|
|
1507
|
-
refetchInterval:
|
|
1507
|
+
refetchInterval: za(
|
|
1508
1508
|
Fe,
|
|
1509
1509
|
Number((bt = a.config) == null ? void 0 : bt.refresh_secs) >= 10 ? Number(a.config.refresh_secs) * 1e3 : m
|
|
1510
1510
|
),
|
|
@@ -1539,7 +1539,7 @@ const Rt = Ra(function({
|
|
|
1539
1539
|
let X = null;
|
|
1540
1540
|
if (_e != null && _e.slug)
|
|
1541
1541
|
X = /* @__PURE__ */ e(
|
|
1542
|
-
|
|
1542
|
+
fl,
|
|
1543
1543
|
{
|
|
1544
1544
|
cfg: _e,
|
|
1545
1545
|
dateRange: s,
|
|
@@ -1557,7 +1557,7 @@ const Rt = Ra(function({
|
|
|
1557
1557
|
X = /* @__PURE__ */ o("div", { className: "flex flex-col gap-2 px-1", children: [
|
|
1558
1558
|
/* @__PURE__ */ e("p", { className: "text-[12px] text-slate-300", children: "Loading…" }),
|
|
1559
1559
|
/* @__PURE__ */ e(
|
|
1560
|
-
|
|
1560
|
+
aa,
|
|
1561
1561
|
{
|
|
1562
1562
|
pending: !0,
|
|
1563
1563
|
request: {
|
|
@@ -1571,12 +1571,12 @@ const Rt = Ra(function({
|
|
|
1571
1571
|
}
|
|
1572
1572
|
)
|
|
1573
1573
|
] });
|
|
1574
|
-
else if (
|
|
1574
|
+
else if (Pe)
|
|
1575
1575
|
X = /* @__PURE__ */ e(
|
|
1576
|
-
|
|
1576
|
+
la,
|
|
1577
1577
|
{
|
|
1578
1578
|
className: "px-1",
|
|
1579
|
-
message: It(
|
|
1579
|
+
message: It(Pe) ?? Tt(Pe, "this widget"),
|
|
1580
1580
|
onRetry: () => void We()
|
|
1581
1581
|
}
|
|
1582
1582
|
);
|
|
@@ -1715,7 +1715,7 @@ const Rt = Ra(function({
|
|
|
1715
1715
|
const l = O.narrative ?? "";
|
|
1716
1716
|
X = /* @__PURE__ */ o("div", { className: "flex min-h-0 flex-1 flex-col", children: [
|
|
1717
1717
|
/* @__PURE__ */ o("div", { className: "mb-1 flex items-center gap-1.5", children: [
|
|
1718
|
-
/* @__PURE__ */ e(
|
|
1718
|
+
/* @__PURE__ */ e(Pt, { className: "h-3.5 w-3.5 text-[#00a5cc]" }),
|
|
1719
1719
|
/* @__PURE__ */ e("span", { className: "text-[10px] uppercase tracking-wide text-slate-400", children: "AI-generated" }),
|
|
1720
1720
|
/* @__PURE__ */ e(
|
|
1721
1721
|
"button",
|
|
@@ -1869,9 +1869,9 @@ const Rt = Ra(function({
|
|
|
1869
1869
|
} else if (a.type === "scatter") {
|
|
1870
1870
|
const l = O.rows ?? [];
|
|
1871
1871
|
X = l.length === 0 ? /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No data." }) : (() => {
|
|
1872
|
-
const i = l.length, g = l.reduce((b, v) => b + v.x, 0), q = l.reduce((b, v) => b + v.y, 0), $ = l.reduce((b, v) => b + v.x * v.x, 0), K = l.reduce((b, v) => b + v.x * v.y, 0), de = i * $ - g * g, te = de !== 0 ? (i * K - g * q) / de : 0, A = i > 0 ? (q - te * g) / i : 0, j = l.map((b) => b.x), U = Math.min(...j),
|
|
1872
|
+
const i = l.length, g = l.reduce((b, v) => b + v.x, 0), q = l.reduce((b, v) => b + v.y, 0), $ = l.reduce((b, v) => b + v.x * v.x, 0), K = l.reduce((b, v) => b + v.x * v.y, 0), de = i * $ - g * g, te = de !== 0 ? (i * K - g * q) / de : 0, A = i > 0 ? (q - te * g) / i : 0, j = l.map((b) => b.x), U = Math.min(...j), P = Math.max(...j), r = [
|
|
1873
1873
|
{ x: U, y: A + te * U },
|
|
1874
|
-
{ x:
|
|
1874
|
+
{ x: P, y: A + te * P }
|
|
1875
1875
|
];
|
|
1876
1876
|
return /* @__PURE__ */ e("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ e(Le, { fallback: /* @__PURE__ */ e(Oe, { className: "h-full w-full", "aria-busy": "true" }), children: ({
|
|
1877
1877
|
ComposedChart: b,
|
|
@@ -2033,15 +2033,15 @@ const Rt = Ra(function({
|
|
|
2033
2033
|
(d) => Object.values(d).some(
|
|
2034
2034
|
(y) => String(y ?? "").toLowerCase().includes(te)
|
|
2035
2035
|
)
|
|
2036
|
-
) : j,
|
|
2036
|
+
) : j, P = 12, r = Math.max(1, Math.ceil(U.length / P)), b = Math.min(me, r - 1), v = U.length > P ? U.slice(b * P, b * P + P) : U;
|
|
2037
2037
|
X = l.length === 0 ? /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No rows." }) : /* @__PURE__ */ o("div", { className: "flex min-h-0 flex-1 flex-col", children: [
|
|
2038
|
-
l.length >
|
|
2038
|
+
l.length > P && /* @__PURE__ */ o("div", { className: "mb-1 flex items-center gap-2", children: [
|
|
2039
2039
|
/* @__PURE__ */ e(
|
|
2040
2040
|
"input",
|
|
2041
2041
|
{
|
|
2042
2042
|
value: Z,
|
|
2043
2043
|
onChange: (d) => {
|
|
2044
|
-
|
|
2044
|
+
D(d.target.value), J(0);
|
|
2045
2045
|
},
|
|
2046
2046
|
placeholder: "Search rows…",
|
|
2047
2047
|
className: "h-6 w-40 rounded border border-slate-200 bg-white px-1.5 text-[11px] dark:border-border dark:bg-card dark:text-slate-200"
|
|
@@ -2114,8 +2114,8 @@ const Rt = Ra(function({
|
|
|
2114
2114
|
String(d.id)
|
|
2115
2115
|
)) }),
|
|
2116
2116
|
(A == null ? void 0 : A.grand_total) && U.length > 1 && /* @__PURE__ */ e("tfoot", { children: /* @__PURE__ */ e("tr", { className: "border-t border-slate-200 font-semibold dark:border-border", children: g.map((d, y) => {
|
|
2117
|
-
var L, Se,
|
|
2118
|
-
const k = U.map((dt) => Number(dt[d])).filter((dt) => Number.isFinite(dt)), E = k.length > U.length / 2, Y = k.reduce((dt,
|
|
2117
|
+
var L, Se, De;
|
|
2118
|
+
const k = U.map((dt) => Number(dt[d])).filter((dt) => Number.isFinite(dt)), E = k.length > U.length / 2, Y = k.reduce((dt, pa) => dt + pa, 0);
|
|
2119
2119
|
return /* @__PURE__ */ e(
|
|
2120
2120
|
"td",
|
|
2121
2121
|
{
|
|
@@ -2123,7 +2123,7 @@ const Rt = Ra(function({
|
|
|
2123
2123
|
"px-1.5 py-1 text-slate-800 dark:text-slate-100",
|
|
2124
2124
|
E && "text-right tabular-nums"
|
|
2125
2125
|
),
|
|
2126
|
-
children: y === 0 && !E ? "Total" : E ? (L = q(d)) != null && L.format ? je(Y, (Se = q(d)) == null ? void 0 : Se.format, (
|
|
2126
|
+
children: y === 0 && !E ? "Total" : E ? (L = q(d)) != null && L.format ? je(Y, (Se = q(d)) == null ? void 0 : Se.format, (De = q(d)) == null ? void 0 : De.decimals) : Y.toLocaleString() : ""
|
|
2127
2127
|
},
|
|
2128
2128
|
d
|
|
2129
2129
|
);
|
|
@@ -2136,21 +2136,21 @@ const Rt = Ra(function({
|
|
|
2136
2136
|
if (g >= 2 && i && !ae && l.length >= g && (l = l.map((A, j) => {
|
|
2137
2137
|
if (j < g - 1) return A;
|
|
2138
2138
|
const U = l.slice(j - g + 1, j + 1);
|
|
2139
|
-
return { ...A, ma: U.reduce((
|
|
2139
|
+
return { ...A, ma: U.reduce((P, r) => P + r.value, 0) / g };
|
|
2140
2140
|
})), ae && i) {
|
|
2141
2141
|
let A = 0, j = 0, U = 0;
|
|
2142
|
-
l = l.map((
|
|
2143
|
-
...
|
|
2142
|
+
l = l.map((P) => (A += P.value, j += P.prev ?? 0, U += P.value2 ?? 0, {
|
|
2143
|
+
...P,
|
|
2144
2144
|
value: A,
|
|
2145
|
-
...
|
|
2146
|
-
...
|
|
2145
|
+
...P.prev != null ? { prev: j } : {},
|
|
2146
|
+
...P.value2 != null ? { value2: U } : {}
|
|
2147
2147
|
}));
|
|
2148
2148
|
}
|
|
2149
2149
|
const q = l.some((A) => A.value2 != null), $ = ((ne = (nt = a.config) == null ? void 0 : nt.metric2) == null ? void 0 : ne.label) ?? "secondary", K = l.some((A) => A.band != null), de = (() => {
|
|
2150
2150
|
if (!i || ae || l.length < 8) return /* @__PURE__ */ new Set();
|
|
2151
|
-
const A = l.map((
|
|
2151
|
+
const A = l.map((P) => P.value), j = A.reduce((P, r) => P + r, 0) / A.length, U = Math.sqrt(A.reduce((P, r) => P + (r - j) ** 2, 0) / A.length);
|
|
2152
2152
|
return U === 0 ? /* @__PURE__ */ new Set() : new Set(
|
|
2153
|
-
l.filter((
|
|
2153
|
+
l.filter((P) => Math.abs(P.value - j) > 2 * U).map((P) => P.dim)
|
|
2154
2154
|
);
|
|
2155
2155
|
})(), te = (M ?? []).filter(
|
|
2156
2156
|
(A) => A.anchor_date && l.some((j) => j.dim === A.anchor_date)
|
|
@@ -2160,7 +2160,7 @@ const Rt = Ra(function({
|
|
|
2160
2160
|
const A = l.reduce((j, U) => j + U.value, 0);
|
|
2161
2161
|
X = /* @__PURE__ */ o("div", { className: "flex min-h-0 flex-1 items-stretch gap-3", children: [
|
|
2162
2162
|
/* @__PURE__ */ o("div", { className: "relative min-h-[110px] min-w-0 flex-1", children: [
|
|
2163
|
-
/* @__PURE__ */ e(Le, { fallback: /* @__PURE__ */ e(Oe, { className: "h-full w-full", "aria-busy": "true" }), children: ({ Cell: j, Pie: U, PieChart:
|
|
2163
|
+
/* @__PURE__ */ e(Le, { fallback: /* @__PURE__ */ e(Oe, { className: "h-full w-full", "aria-busy": "true" }), children: ({ Cell: j, Pie: U, PieChart: P, ResponsiveContainer: r, Tooltip: b }) => /* @__PURE__ */ e(r, { width: "100%", height: "100%", children: /* @__PURE__ */ o(P, { children: [
|
|
2164
2164
|
/* @__PURE__ */ e(
|
|
2165
2165
|
U,
|
|
2166
2166
|
{
|
|
@@ -2180,8 +2180,8 @@ const Rt = Ra(function({
|
|
|
2180
2180
|
if (Be.length > le.length) {
|
|
2181
2181
|
const Se = le.length === 0 ? (E = (k = a.config) == null ? void 0 : k.dimension) == null ? void 0 : E.field : Be[le.length - 1];
|
|
2182
2182
|
if (Se) {
|
|
2183
|
-
w((
|
|
2184
|
-
...
|
|
2183
|
+
w((De) => [
|
|
2184
|
+
...De,
|
|
2185
2185
|
{ field: Se, value: String((d == null ? void 0 : d.raw) ?? (d == null ? void 0 : d.dim) ?? "") }
|
|
2186
2186
|
]);
|
|
2187
2187
|
return;
|
|
@@ -2247,7 +2247,7 @@ const Rt = Ra(function({
|
|
|
2247
2247
|
Area: A,
|
|
2248
2248
|
ComposedChart: j,
|
|
2249
2249
|
Line: U,
|
|
2250
|
-
ReferenceLine:
|
|
2250
|
+
ReferenceLine: P,
|
|
2251
2251
|
ResponsiveContainer: r,
|
|
2252
2252
|
Tooltip: b,
|
|
2253
2253
|
XAxis: v,
|
|
@@ -2290,7 +2290,7 @@ const Rt = Ra(function({
|
|
|
2290
2290
|
}
|
|
2291
2291
|
),
|
|
2292
2292
|
te.map((k) => /* @__PURE__ */ e(
|
|
2293
|
-
|
|
2293
|
+
P,
|
|
2294
2294
|
{
|
|
2295
2295
|
x: k.anchor_date,
|
|
2296
2296
|
stroke: "#f59e0b",
|
|
@@ -2395,7 +2395,7 @@ const Rt = Ra(function({
|
|
|
2395
2395
|
X = /* @__PURE__ */ e("div", { className: "min-h-[110px] flex-1", children: /* @__PURE__ */ e(Le, { fallback: /* @__PURE__ */ e(Oe, { className: "h-full w-full", "aria-busy": "true" }), children: ({
|
|
2396
2396
|
Bar: j,
|
|
2397
2397
|
Cell: U,
|
|
2398
|
-
ComposedChart:
|
|
2398
|
+
ComposedChart: P,
|
|
2399
2399
|
Line: r,
|
|
2400
2400
|
ReferenceLine: b,
|
|
2401
2401
|
ResponsiveContainer: v,
|
|
@@ -2405,7 +2405,7 @@ const Rt = Ra(function({
|
|
|
2405
2405
|
}) => {
|
|
2406
2406
|
var E;
|
|
2407
2407
|
return /* @__PURE__ */ e(v, { width: "100%", height: "100%", children: /* @__PURE__ */ o(
|
|
2408
|
-
|
|
2408
|
+
P,
|
|
2409
2409
|
{
|
|
2410
2410
|
data: l,
|
|
2411
2411
|
layout: A ? "vertical" : "horizontal",
|
|
@@ -2420,7 +2420,7 @@ const Rt = Ra(function({
|
|
|
2420
2420
|
dataKey: "dim",
|
|
2421
2421
|
tick: { fontSize: 10 },
|
|
2422
2422
|
stroke: "#94a3b8",
|
|
2423
|
-
tickFormatter:
|
|
2423
|
+
tickFormatter: ll,
|
|
2424
2424
|
interval: 0,
|
|
2425
2425
|
width: 140
|
|
2426
2426
|
}
|
|
@@ -2489,11 +2489,11 @@ const Rt = Ra(function({
|
|
|
2489
2489
|
radius: [3, 3, 0, 0],
|
|
2490
2490
|
className: a.collection ? "cursor-pointer" : void 0,
|
|
2491
2491
|
onClick: (Y) => {
|
|
2492
|
-
var
|
|
2492
|
+
var De;
|
|
2493
2493
|
if (!a.collection) return;
|
|
2494
2494
|
const L = Y == null ? void 0 : Y.payload;
|
|
2495
2495
|
if (L != null && L.other) return;
|
|
2496
|
-
const Se = (
|
|
2496
|
+
const Se = (De = a.config) == null ? void 0 : De.dimension;
|
|
2497
2497
|
se({
|
|
2498
2498
|
conditions: Mt(
|
|
2499
2499
|
a,
|
|
@@ -2572,7 +2572,7 @@ const Rt = Ra(function({
|
|
|
2572
2572
|
{
|
|
2573
2573
|
"data-tip": Et(a),
|
|
2574
2574
|
className: "shrink-0 cursor-help text-slate-300 hover:text-slate-500",
|
|
2575
|
-
children: /* @__PURE__ */ e(
|
|
2575
|
+
children: /* @__PURE__ */ e(qa, { className: "h-3 w-3" })
|
|
2576
2576
|
}
|
|
2577
2577
|
),
|
|
2578
2578
|
/* @__PURE__ */ o("span", { className: "ml-auto flex items-center gap-0.5", children: [
|
|
@@ -2586,7 +2586,7 @@ const Rt = Ra(function({
|
|
|
2586
2586
|
he ? "text-[#00a5cc]" : "text-slate-300 hover:text-[#00a5cc]"
|
|
2587
2587
|
),
|
|
2588
2588
|
onClick: () => re((l) => !l),
|
|
2589
|
-
children: /* @__PURE__ */ e(
|
|
2589
|
+
children: /* @__PURE__ */ e(Ma, { className: "h-3 w-3" })
|
|
2590
2590
|
}
|
|
2591
2591
|
),
|
|
2592
2592
|
["bar", "line", "donut", "pareto", "scatter", "heatmap", "waterfall"].includes(
|
|
@@ -2597,7 +2597,7 @@ const Rt = Ra(function({
|
|
|
2597
2597
|
type: "button",
|
|
2598
2598
|
title: "Copy chart as image",
|
|
2599
2599
|
className: "rounded p-0.5 text-slate-300 hover:text-[#00a5cc]",
|
|
2600
|
-
onClick: () => void
|
|
2600
|
+
onClick: () => void el(T.current, a.title),
|
|
2601
2601
|
children: /* @__PURE__ */ e(St, { className: "h-3 w-3" })
|
|
2602
2602
|
}
|
|
2603
2603
|
),
|
|
@@ -2662,7 +2662,7 @@ const Rt = Ra(function({
|
|
|
2662
2662
|
fe(g || "No explanation available.");
|
|
2663
2663
|
}).catch(() => fe("AI is not configured or unavailable.")).finally(() => z(!1));
|
|
2664
2664
|
},
|
|
2665
|
-
children: /* @__PURE__ */ e(
|
|
2665
|
+
children: /* @__PURE__ */ e(Pt, { className: "h-3 w-3" })
|
|
2666
2666
|
}
|
|
2667
2667
|
),
|
|
2668
2668
|
((it = (st = a.config) == null ? void 0 : st.dimension) == null ? void 0 : it.bucket) && /* @__PURE__ */ e(
|
|
@@ -2675,7 +2675,7 @@ const Rt = Ra(function({
|
|
|
2675
2675
|
ae ? "text-[#00a5cc]" : "text-slate-300 hover:text-slate-500"
|
|
2676
2676
|
),
|
|
2677
2677
|
onClick: () => G((l) => !l),
|
|
2678
|
-
children: /* @__PURE__ */ e(
|
|
2678
|
+
children: /* @__PURE__ */ e(Fa, { className: "h-3 w-3" })
|
|
2679
2679
|
}
|
|
2680
2680
|
),
|
|
2681
2681
|
N && /* @__PURE__ */ e(
|
|
@@ -2688,7 +2688,7 @@ const Rt = Ra(function({
|
|
|
2688
2688
|
((M == null ? void 0 : M.length) ?? 0) > 0 ? "text-amber-500" : "text-slate-300 hover:text-slate-500"
|
|
2689
2689
|
),
|
|
2690
2690
|
onClick: () => be((l) => !l),
|
|
2691
|
-
children: /* @__PURE__ */ e(
|
|
2691
|
+
children: /* @__PURE__ */ e(Aa, { className: "h-3 w-3" })
|
|
2692
2692
|
}
|
|
2693
2693
|
),
|
|
2694
2694
|
/* @__PURE__ */ e(
|
|
@@ -2702,19 +2702,19 @@ const Rt = Ra(function({
|
|
|
2702
2702
|
Wt(a, O);
|
|
2703
2703
|
return;
|
|
2704
2704
|
}
|
|
2705
|
-
const l = _e, i =
|
|
2705
|
+
const l = _e, i = da(l, s, c);
|
|
2706
2706
|
Te.fetchQuery({
|
|
2707
2707
|
queryKey: ["nivaro-report-query", l.slug, i],
|
|
2708
|
-
queryFn: () =>
|
|
2708
|
+
queryFn: () => ma(F, l.slug, i),
|
|
2709
2709
|
staleTime: 6e4
|
|
2710
|
-
}).then((g) => Wt(a, void 0,
|
|
2711
|
-
|
|
2710
|
+
}).then((g) => Wt(a, void 0, ca(l, g))).catch((g) => {
|
|
2711
|
+
$a(g) || Xt.error(Tt(g, "this widget"));
|
|
2712
2712
|
});
|
|
2713
2713
|
},
|
|
2714
|
-
children: /* @__PURE__ */ e(
|
|
2714
|
+
children: /* @__PURE__ */ e(Ta, { className: "h-3 w-3" })
|
|
2715
2715
|
}
|
|
2716
2716
|
),
|
|
2717
|
-
/* @__PURE__ */ e(
|
|
2717
|
+
/* @__PURE__ */ e(yl, { reportId: n, widget: a, filterBar: h }),
|
|
2718
2718
|
/* @__PURE__ */ e(
|
|
2719
2719
|
"button",
|
|
2720
2720
|
{
|
|
@@ -2791,7 +2791,7 @@ const Rt = Ra(function({
|
|
|
2791
2791
|
] })
|
|
2792
2792
|
] }),
|
|
2793
2793
|
u && (() => {
|
|
2794
|
-
const l =
|
|
2794
|
+
const l = Nl(O), i = u.value;
|
|
2795
2795
|
if (l == null || i == null) return null;
|
|
2796
2796
|
const g = i === 0 ? null : (l - i) / Math.abs(i) * 100;
|
|
2797
2797
|
return /* @__PURE__ */ o("p", { className: "mb-1 flex items-center gap-1 text-[10.5px] text-slate-400", children: [
|
|
@@ -2883,7 +2883,7 @@ const Rt = Ra(function({
|
|
|
2883
2883
|
] }) }) : X }),
|
|
2884
2884
|
((Re = a.config) == null ? void 0 : Re.footnote) && /* @__PURE__ */ e("p", { className: "mt-1 border-t border-slate-100 pt-1 text-[10.5px] leading-snug text-slate-400 dark:border-border/50", children: a.config.footnote }),
|
|
2885
2885
|
B && /* @__PURE__ */ e(
|
|
2886
|
-
|
|
2886
|
+
wl,
|
|
2887
2887
|
{
|
|
2888
2888
|
collection: a.collection ?? "",
|
|
2889
2889
|
conditions: B.conditions,
|
|
@@ -2905,7 +2905,7 @@ const Rt = Ra(function({
|
|
|
2905
2905
|
}
|
|
2906
2906
|
);
|
|
2907
2907
|
});
|
|
2908
|
-
function
|
|
2908
|
+
function Hl({
|
|
2909
2909
|
reportId: t,
|
|
2910
2910
|
widget: n,
|
|
2911
2911
|
dateRange: a = null,
|
|
@@ -2926,15 +2926,15 @@ function Gl({
|
|
|
2926
2926
|
}
|
|
2927
2927
|
);
|
|
2928
2928
|
}
|
|
2929
|
-
function
|
|
2929
|
+
function Sl(t) {
|
|
2930
2930
|
const n = t == null ? "" : String(t);
|
|
2931
2931
|
return n.length > 24 ? `${n.slice(0, 23)}…` : n;
|
|
2932
2932
|
}
|
|
2933
|
-
function
|
|
2933
|
+
function _l(t) {
|
|
2934
2934
|
const n = t;
|
|
2935
2935
|
return !(n != null && n.admin) || !n.access_scope_label ? null : `(your access scope: ${n.access_scope_label})`;
|
|
2936
2936
|
}
|
|
2937
|
-
function
|
|
2937
|
+
function Xl({
|
|
2938
2938
|
reportId: t,
|
|
2939
2939
|
showFilterBar: n = !0,
|
|
2940
2940
|
dateRange: a,
|
|
@@ -2944,11 +2944,11 @@ function Hl({
|
|
|
2944
2944
|
emptyState: h,
|
|
2945
2945
|
reportUrl: f
|
|
2946
2946
|
}) {
|
|
2947
|
-
var U,
|
|
2948
|
-
const u = Ke(), R = Zt(), M =
|
|
2947
|
+
var U, P;
|
|
2948
|
+
const u = Ke(), R = Zt(), M = Oa("drill.report"), N = M.value, W = At(
|
|
2949
2949
|
(r) => R ? R.open(r) : M.push([r]),
|
|
2950
2950
|
[R, M.push]
|
|
2951
|
-
), [p, S] = C(void 0), [ee, F] = C(s), [Z,
|
|
2951
|
+
), [p, S] = C(void 0), [ee, F] = C(s), [Z, D] = C(void 0), [me, J] = C(s), { scopes: B, ready: se } = ea(), [xe, be] = C(!1), [ge, $e] = C({}), x = ht(), { data: I = [] } = Ne({
|
|
2952
2952
|
queryKey: ["nivaro-report-presets", t],
|
|
2953
2953
|
queryFn: async () => {
|
|
2954
2954
|
try {
|
|
@@ -2967,7 +2967,7 @@ function Hl({
|
|
|
2967
2967
|
}
|
|
2968
2968
|
} catch {
|
|
2969
2969
|
}
|
|
2970
|
-
return u.request(
|
|
2970
|
+
return u.request(ha(t)).then((r) => r.data);
|
|
2971
2971
|
},
|
|
2972
2972
|
staleTime: 6e4
|
|
2973
2973
|
}), ae = () => void x.invalidateQueries({ queryKey: ["nivaro-report-presets", t] }), G = Me({
|
|
@@ -2980,7 +2980,7 @@ function Hl({
|
|
|
2980
2980
|
),
|
|
2981
2981
|
onSuccess: ae
|
|
2982
2982
|
}), he = Me({
|
|
2983
|
-
mutationFn: (r) => u.request(
|
|
2983
|
+
mutationFn: (r) => u.request(fa(t, r)),
|
|
2984
2984
|
onSuccess: ae
|
|
2985
2985
|
}), [re, le] = C(""), [w, T] = C(!1), [Q, H] = C(null), [ie, ue] = C(!1), { data: fe = [] } = Ne({
|
|
2986
2986
|
queryKey: ["nvr-report-snaps", t],
|
|
@@ -3009,7 +3009,7 @@ function Hl({
|
|
|
3009
3009
|
mutationFn: (r) => u.request(pt(`/report-studio/${t}/annotations`, r)),
|
|
3010
3010
|
onSuccess: ve
|
|
3011
3011
|
}), Te = Me({
|
|
3012
|
-
mutationFn: (r) => u.request(
|
|
3012
|
+
mutationFn: (r) => u.request(Ka(`/report-studio/${t}/annotations/${r}`)),
|
|
3013
3013
|
onSuccess: ve
|
|
3014
3014
|
}), Xe = At((r, b, v) => {
|
|
3015
3015
|
const d = {
|
|
@@ -3018,9 +3018,9 @@ function Hl({
|
|
|
3018
3018
|
labels: [v]
|
|
3019
3019
|
};
|
|
3020
3020
|
F((y) => [...y.filter((k) => k.field !== r), d]), J((y) => [...y.filter((k) => k.field !== r), d]);
|
|
3021
|
-
}, []), [ye, Ze] = C(!1), [ke, Fe] = C(null), [Ie, Ee] = C(null),
|
|
3021
|
+
}, []), [ye, Ze] = C(!1), [ke, Fe] = C(null), [Ie, Ee] = C(null), Pe = Me({
|
|
3022
3022
|
mutationFn: (r) => u.request(
|
|
3023
|
-
|
|
3023
|
+
Pa(`/report-studio/${t}/widgets`, {
|
|
3024
3024
|
widgets: r.map((b, v) => ({ ...b, sort: v }))
|
|
3025
3025
|
})
|
|
3026
3026
|
),
|
|
@@ -3056,7 +3056,7 @@ function Hl({
|
|
|
3056
3056
|
return d[y] = { ...Y, x: E.x, y: E.y }, d[k] = { ...E, x: Y.x, y: Y.y }, d;
|
|
3057
3057
|
}), [Ve, at] = C(""), [Je, lt] = C(!1), [rt, nt] = C(null), { data: ne, isLoading: kt } = Ne({
|
|
3058
3058
|
queryKey: ["nivaro-report", t],
|
|
3059
|
-
queryFn: () => u.request(
|
|
3059
|
+
queryFn: () => u.request(xa(t)).then((r) => r.data),
|
|
3060
3060
|
staleTime: 3e4
|
|
3061
3061
|
}), st = _t(null), it = _t([]), ot = ((U = ne == null ? void 0 : ne.global_filters) == null ? void 0 : U.date_range) ?? null, Re = ut(() => p !== void 0 ? p : a !== void 0 ? a : ot, [p, a, ot]);
|
|
3062
3062
|
st.current = Re ?? null, it.current = ee;
|
|
@@ -3065,7 +3065,7 @@ function Hl({
|
|
|
3065
3065
|
var r;
|
|
3066
3066
|
return ((r = ne == null ? void 0 : ne.global_filters) == null ? void 0 : r.filter_bar) ?? [];
|
|
3067
3067
|
},
|
|
3068
|
-
[(
|
|
3068
|
+
[(P = ne == null ? void 0 : ne.global_filters) == null ? void 0 : P.filter_bar]
|
|
3069
3069
|
);
|
|
3070
3070
|
mt(() => {
|
|
3071
3071
|
if (!xe && !(!se || !ne)) {
|
|
@@ -3077,21 +3077,21 @@ function Hl({
|
|
|
3077
3077
|
var v;
|
|
3078
3078
|
const r = [], b = {};
|
|
3079
3079
|
for (const d of l) {
|
|
3080
|
-
const y =
|
|
3080
|
+
const y = Ua(B, {
|
|
3081
3081
|
key: d.field,
|
|
3082
3082
|
collection: (v = d.options) == null ? void 0 : v.collection
|
|
3083
3083
|
});
|
|
3084
3084
|
if (!y) continue;
|
|
3085
3085
|
const k = d.options ? d.options.value_field ?? "id" : "id", E = B.restricted[y.name] ?? [];
|
|
3086
3086
|
if (E.length > 0) {
|
|
3087
|
-
const L = await
|
|
3087
|
+
const L = await Dt(u, y, E, k).catch(
|
|
3088
3088
|
() => []
|
|
3089
3089
|
);
|
|
3090
3090
|
L.length > 0 && (b[d.field] = L);
|
|
3091
3091
|
}
|
|
3092
|
-
const Y =
|
|
3092
|
+
const Y = Ya(B, y.name);
|
|
3093
3093
|
if (Y.length > 0) {
|
|
3094
|
-
const L = await
|
|
3094
|
+
const L = await Dt(u, y, Y, k).catch(
|
|
3095
3095
|
() => []
|
|
3096
3096
|
);
|
|
3097
3097
|
L.length > 0 && r.push({ field: d.field, values: L, labels: L.map(String) });
|
|
@@ -3110,11 +3110,11 @@ function Hl({
|
|
|
3110
3110
|
}
|
|
3111
3111
|
}, [xe, se, ne, B, l]);
|
|
3112
3112
|
const i = (ne == null ? void 0 : ne.widgets) ?? [], g = Z !== void 0 ? Z : Re, q = ee.filter((r) => r.values.length > 0).length + (Re ? 1 : 0), $ = JSON.stringify(me) !== JSON.stringify(ee) || Z !== void 0, K = () => {
|
|
3113
|
-
F(me), Z !== void 0 && (S(Z),
|
|
3113
|
+
F(me), Z !== void 0 && (S(Z), D(void 0));
|
|
3114
3114
|
}, de = () => {
|
|
3115
|
-
J([]), F([]), S(null),
|
|
3115
|
+
J([]), F([]), S(null), D(void 0);
|
|
3116
3116
|
}, te = (r) => {
|
|
3117
|
-
J(r.entity_filters), F(r.entity_filters), S(r.date_range),
|
|
3117
|
+
J(r.entity_filters), F(r.entity_filters), S(r.date_range), D(void 0);
|
|
3118
3118
|
}, A = async () => {
|
|
3119
3119
|
var b, v;
|
|
3120
3120
|
const r = Ve.trim();
|
|
@@ -3122,7 +3122,7 @@ function Hl({
|
|
|
3122
3122
|
lt(!0), nt(null);
|
|
3123
3123
|
try {
|
|
3124
3124
|
const d = await u.request(
|
|
3125
|
-
|
|
3125
|
+
ya(
|
|
3126
3126
|
t,
|
|
3127
3127
|
r,
|
|
3128
3128
|
l.map((k) => ({ field: k.field, label: k.label }))
|
|
@@ -3131,7 +3131,7 @@ function Hl({
|
|
|
3131
3131
|
var E;
|
|
3132
3132
|
return l.some((Y) => Y.field === k.field) && ((E = k.values) == null ? void 0 : E.length) > 0;
|
|
3133
3133
|
}).map((k) => ({ field: k.field, values: k.values, labels: k.values.map(String) }));
|
|
3134
|
-
J(y), F(y), S(d.data.date_range ?? null),
|
|
3134
|
+
J(y), F(y), S(d.data.date_range ?? null), D(void 0), at("");
|
|
3135
3135
|
} catch (d) {
|
|
3136
3136
|
nt(
|
|
3137
3137
|
((v = (b = d.response) == null ? void 0 : b.data) == null ? void 0 : v.error) ?? "Could not parse that"
|
|
@@ -3145,7 +3145,7 @@ function Hl({
|
|
|
3145
3145
|
return /* @__PURE__ */ e("div", { className: V("p-6 text-[13px] text-slate-400", m), children: "Loading report…" });
|
|
3146
3146
|
if (!ne)
|
|
3147
3147
|
return /* @__PURE__ */ e("div", { className: V("p-6 text-[13px] text-slate-400", m), children: "Report not found." });
|
|
3148
|
-
const j =
|
|
3148
|
+
const j = _l(B);
|
|
3149
3149
|
return /* @__PURE__ */ o("div", { className: V("flex flex-col gap-3", m), children: [
|
|
3150
3150
|
j && (!n || i.length === 0 && l.length === 0) && /* @__PURE__ */ e("p", { className: "text-[11.5px] text-amber-700 dark:text-amber-300", children: j }),
|
|
3151
3151
|
n && (i.length > 0 || l.length > 0) && /* @__PURE__ */ o("div", { className: "space-y-1.5", children: [
|
|
@@ -3162,8 +3162,8 @@ function Hl({
|
|
|
3162
3162
|
wt,
|
|
3163
3163
|
{
|
|
3164
3164
|
value: (g == null ? void 0 : g.preset) ?? "",
|
|
3165
|
-
onChange: (r) =>
|
|
3166
|
-
options:
|
|
3165
|
+
onChange: (r) => D(r ? { preset: r } : null),
|
|
3166
|
+
options: il.map((r) => ({ value: r.id, label: r.label })),
|
|
3167
3167
|
ariaLabel: "Date range",
|
|
3168
3168
|
className: "h-7 w-auto rounded-md px-1.5 py-0 text-[12px] text-slate-600 dark:border-border dark:bg-card dark:text-slate-300"
|
|
3169
3169
|
}
|
|
@@ -3171,7 +3171,7 @@ function Hl({
|
|
|
3171
3171
|
l.map((r) => {
|
|
3172
3172
|
var b;
|
|
3173
3173
|
return /* @__PURE__ */ e(
|
|
3174
|
-
|
|
3174
|
+
ia,
|
|
3175
3175
|
{
|
|
3176
3176
|
reportId: t,
|
|
3177
3177
|
field: r.field,
|
|
@@ -3281,7 +3281,7 @@ function Hl({
|
|
|
3281
3281
|
"button",
|
|
3282
3282
|
{
|
|
3283
3283
|
type: "button",
|
|
3284
|
-
title: `Compare against ${r.name} (${
|
|
3284
|
+
title: `Compare against ${r.name} (${ta(r.taken_at)})`,
|
|
3285
3285
|
onClick: () => H((b) => b === r.id ? null : r.id),
|
|
3286
3286
|
className: V(
|
|
3287
3287
|
"inline-flex h-6 items-center gap-1 rounded-full border px-2 text-[11px]",
|
|
@@ -3457,10 +3457,10 @@ function Hl({
|
|
|
3457
3457
|
"button",
|
|
3458
3458
|
{
|
|
3459
3459
|
type: "button",
|
|
3460
|
-
disabled:
|
|
3461
|
-
onClick: () => ke &&
|
|
3460
|
+
disabled: Pe.isPending,
|
|
3461
|
+
onClick: () => ke && Pe.mutate(ke),
|
|
3462
3462
|
className: "rounded-md bg-nvr-cyan px-3 py-1 text-[12px] font-semibold text-white hover:brightness-110 disabled:opacity-40",
|
|
3463
|
-
children:
|
|
3463
|
+
children: Pe.isPending ? "Saving…" : "Save layout"
|
|
3464
3464
|
}
|
|
3465
3465
|
),
|
|
3466
3466
|
/* @__PURE__ */ e(
|
|
@@ -3485,7 +3485,7 @@ function Hl({
|
|
|
3485
3485
|
}
|
|
3486
3486
|
) }),
|
|
3487
3487
|
ye && ke && /* @__PURE__ */ e("div", { className: "mb-3", children: /* @__PURE__ */ e(qt, { fallback: null, children: /* @__PURE__ */ e(
|
|
3488
|
-
|
|
3488
|
+
rl,
|
|
3489
3489
|
{
|
|
3490
3490
|
maxY: Math.max(0, ...ke.map((r) => (r.y ?? 0) + (r.h ?? 1))),
|
|
3491
3491
|
onAdd: (r) => Fe((b) => [...b ?? [], r])
|
|
@@ -3532,7 +3532,7 @@ function Hl({
|
|
|
3532
3532
|
)
|
|
3533
3533
|
] }, d)) }) : /* @__PURE__ */ o(He, { children: [
|
|
3534
3534
|
ye && /* @__PURE__ */ e(qt, { fallback: null, children: /* @__PURE__ */ e(
|
|
3535
|
-
|
|
3535
|
+
sl,
|
|
3536
3536
|
{
|
|
3537
3537
|
widget: r,
|
|
3538
3538
|
onConfigure: () => Ee(r.id),
|
|
@@ -3573,7 +3573,7 @@ function Hl({
|
|
|
3573
3573
|
}
|
|
3574
3574
|
),
|
|
3575
3575
|
ye && Ie && (ke == null ? void 0 : ke.some((r) => r.id === Ie)) && /* @__PURE__ */ e(qt, { fallback: null, children: /* @__PURE__ */ e(
|
|
3576
|
-
|
|
3576
|
+
nl,
|
|
3577
3577
|
{
|
|
3578
3578
|
widget: ke.find((r) => r.id === Ie),
|
|
3579
3579
|
allWidgets: ke,
|
|
@@ -3581,9 +3581,9 @@ function Hl({
|
|
|
3581
3581
|
onClose: () => Ee(null)
|
|
3582
3582
|
}
|
|
3583
3583
|
) }),
|
|
3584
|
-
/* @__PURE__ */ e(
|
|
3584
|
+
/* @__PURE__ */ e(Ja, {}),
|
|
3585
3585
|
!R && (N != null && N.length) ? /* @__PURE__ */ e(
|
|
3586
|
-
|
|
3586
|
+
Va,
|
|
3587
3587
|
{
|
|
3588
3588
|
collection: N[0].collection,
|
|
3589
3589
|
itemId: N[0].itemId,
|
|
@@ -3598,14 +3598,14 @@ function Hl({
|
|
|
3598
3598
|
] });
|
|
3599
3599
|
}
|
|
3600
3600
|
export {
|
|
3601
|
-
|
|
3601
|
+
yl as AlertBell,
|
|
3602
3602
|
ce as CHART_COLORS,
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3603
|
+
ol as NO_WORKFLOW_NUMBER,
|
|
3604
|
+
fl as QueryWidgetBody,
|
|
3605
|
+
Xl as ReportView,
|
|
3606
|
+
Hl as ReportWidgetCard,
|
|
3607
|
+
_l as adminAccessScopeNote,
|
|
3608
3608
|
je as fmtCell,
|
|
3609
|
-
|
|
3610
|
-
|
|
3609
|
+
ca as shapeQueryRows,
|
|
3610
|
+
Sl as shortCategoryLabel
|
|
3611
3611
|
};
|