@nivaro/react 0.3.116 → 0.3.117
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/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/shared/components/CollectionBrowserView.js +1629 -1621
- package/dist/shared/components/ReportView.js +1086 -1091
- package/dist/shared/components/cbv/column-totals.js +62 -57
- package/dist/shared/components/charts/category-axis.js +93 -0
- package/dist/shared/components/pipeline/BindingStartStateSettings.js +163 -0
- package/dist/shared/components/pipeline/PipelineEditorView.js +313 -297
- package/dist/shared/lib/use-query-entry.js +17 -0
- package/package.json +1 -1
|
@@ -1,31 +1,33 @@
|
|
|
1
|
-
import { jsx as e, jsxs as o, Fragment as
|
|
2
|
-
import { saveReportFilterPreset as
|
|
3
|
-
import { useQuery as
|
|
4
|
-
import { X as
|
|
5
|
-
import { useState as
|
|
1
|
+
import { jsx as e, jsxs as o, Fragment as We } from "react/jsx-runtime";
|
|
2
|
+
import { saveReportFilterPreset as jt, listReportFilterPresets as Na, deleteReportFilterPreset as wa, readReport as zt, executeCustomQuery as Sa, readItems as _a, readReportFilterOptions as Ca, aiReportFilters as $a, readReportWidgetData as Ct, listReportAlerts as qa, createReportAlert as Aa, toggleReportAlert as Ma, deleteReportAlert as Fa, readReportAlertLog as Ra, resolveReportAlert as Ta } from "@nivaro/sdk";
|
|
3
|
+
import { useQuery as _e, useQueryClient as nt, useMutation as Me, isCancelledError as La } from "@tanstack/react-query";
|
|
4
|
+
import { X as Re, Check as Ht, Plus as Xt, Camera as Lt, Bell as Zt, RefreshCw as At, ChevronsUpDown as It, Sparkles as Wt, Info as Oa, Table as Ka, Sigma as Da, StickyNote as Pa, Download as Ea, TrendingUp as ea, TrendingDown as ta, Trash2 as ja } from "lucide-react";
|
|
5
|
+
import { useState as S, useEffect as tt, useCallback as gt, useRef as at, useMemo as lt, Suspense as Rt, createContext as za, lazy as Pt, memo as Wa, useContext as Ba } from "react";
|
|
6
6
|
import { toast as aa } from "sonner";
|
|
7
|
-
import { useNivaroClient as
|
|
8
|
-
import { get as bt, post as
|
|
9
|
-
import { changedWidgetIds as
|
|
7
|
+
import { useNivaroClient as Te, useDrilldown as la, useOverlayState as Qa } from "../context.js";
|
|
8
|
+
import { get as bt, post as rt, del as Ua, put as Ja } from "../lib/commands.js";
|
|
9
|
+
import { changedWidgetIds as Va, useConfigWatch as Ya } from "../lib/config-watch.js";
|
|
10
10
|
import { useAutoRefreshPref as Ga, useLiveStamp as Ha } from "../lib/live-data-changed.js";
|
|
11
11
|
import { useLiveWidget as Xa, liveWidgetInterval as Za } from "../lib/live-widgets.js";
|
|
12
12
|
import { serverErrorText as ra, loadErrorText as Ot } from "../lib/load-error.js";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
13
|
+
import { useQueryEntryState as Ia } from "../lib/use-query-entry.js";
|
|
14
|
+
import { restrictedScopeSelections as el, cascadeFilter as tl, fetchCascadeRelations as al } from "../lib/quick-filter-cascade.js";
|
|
15
|
+
import { buildReportTree as ll } from "../lib/report-tree.js";
|
|
16
|
+
import { uniqueByValue as rl } from "../lib/unique-options.js";
|
|
17
|
+
import { useMyScopes as na, matchScopeDimension as nl, translateScopeValues as Bt, effectiveScopeSeedIds as sl } from "../lib/use-my-scopes.js";
|
|
17
18
|
import { cn as P, toLocalDateString as sa } from "../lib/utils.js";
|
|
18
19
|
import { BackgroundRunOffer as oa } from "./BackgroundRunOffer.js";
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
20
|
+
import { CategoryAxisBox as ia } from "./charts/category-axis.js";
|
|
21
|
+
import { RechartsGate as Pe } from "./charts/RechartsGate.js";
|
|
22
|
+
import { LoadErrorNote as da } from "./LoadErrorNote.js";
|
|
23
|
+
import { RecordDrilldownSheet as ol } from "./RecordDrilldownSheet.js";
|
|
24
|
+
import { TipLayer as il } from "./TipLayer.js";
|
|
25
|
+
import { Command as dl, CommandInput as cl, CommandList as ul, CommandEmpty as ml, CommandItem as pl } from "./ui/command.js";
|
|
26
|
+
import { Popover as ca, PopoverTrigger as ua, PopoverContent as ma } from "./ui/popover.js";
|
|
25
27
|
import { SimpleSelect as $t } from "./ui/SimpleSelect.js";
|
|
26
|
-
import { Skeleton as
|
|
27
|
-
import { WidgetImageMenu as
|
|
28
|
-
const
|
|
28
|
+
import { Skeleton as Ee } from "./ui/skeleton.js";
|
|
29
|
+
import { WidgetImageMenu as hl } from "./WidgetImageMenu.js";
|
|
30
|
+
const $e = (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), fl = [
|
|
29
31
|
"Jan",
|
|
30
32
|
"Feb",
|
|
31
33
|
"Mar",
|
|
@@ -38,23 +40,20 @@ const Ce = (t) => Math.abs(t) >= 1e9 ? `${(t / 1e9).toFixed(1).replace(/\.0$/, "
|
|
|
38
40
|
"Oct",
|
|
39
41
|
"Nov",
|
|
40
42
|
"Dec"
|
|
41
|
-
],
|
|
43
|
+
], xl = (t) => {
|
|
42
44
|
const n = String(t ?? ""), a = /^(\d{4})-(\d{2})(?:-(\d{2}))?/.exec(n);
|
|
43
45
|
if (a) {
|
|
44
|
-
const s =
|
|
46
|
+
const s = fl[Number(a[2]) - 1] ?? a[2];
|
|
45
47
|
return a[3] ? `${s} ${Number(a[3])}` : `${s} '${a[1].slice(2)}`;
|
|
46
48
|
}
|
|
47
49
|
return n.length > 16 ? `${n.slice(0, 15)}…` : n;
|
|
48
|
-
},
|
|
50
|
+
}, Mt = (t) => ({
|
|
49
51
|
interval: t > 12 ? Math.ceil(t / 12) - 1 : 0,
|
|
50
|
-
tickFormatter:
|
|
52
|
+
tickFormatter: xl,
|
|
51
53
|
minTickGap: 4,
|
|
52
54
|
...t > 5 && t <= 12 ? { angle: -35, textAnchor: "end", height: 56 } : {}
|
|
53
|
-
}),
|
|
54
|
-
|
|
55
|
-
return n.length > 22 ? `${n.slice(0, 21)}…` : n;
|
|
56
|
-
}, zt = () => import("./ReportEditMode.js"), bl = Pt(() => zt().then((t) => ({ default: t.AddWidgetBar }))), gl = Pt(() => zt().then((t) => ({ default: t.WidgetConfigSheet }))), vl = Pt(() => zt().then((t) => ({ default: t.WidgetEditBar }))), Xe = "rgb(var(--nvr-cyan-rgb, 0 206 255))", ce = [
|
|
57
|
-
Xe,
|
|
55
|
+
}), Et = () => import("./ReportEditMode.js"), bl = Pt(() => Et().then((t) => ({ default: t.AddWidgetBar }))), gl = Pt(() => Et().then((t) => ({ default: t.WidgetConfigSheet }))), vl = Pt(() => Et().then((t) => ({ default: t.WidgetEditBar }))), et = "rgb(var(--nvr-cyan-rgb, 0 206 255))", ue = [
|
|
56
|
+
et,
|
|
58
57
|
"#4f7cac",
|
|
59
58
|
// steel blue
|
|
60
59
|
"#c2703d",
|
|
@@ -82,7 +81,7 @@ const Ce = (t) => Math.abs(t) >= 1e9 ? `${(t / 1e9).toFixed(1).replace(/\.0$/, "
|
|
|
82
81
|
{ id: "last_12_months", label: "Last 12 months" },
|
|
83
82
|
{ id: "ytd", label: "Year to date" }
|
|
84
83
|
];
|
|
85
|
-
function
|
|
84
|
+
function Ae(t, n) {
|
|
86
85
|
if (t == null) return "—";
|
|
87
86
|
const a = (n == null ? void 0 : n.decimals) != null ? t.toLocaleString(void 0, {
|
|
88
87
|
minimumFractionDigits: n.decimals,
|
|
@@ -108,7 +107,7 @@ function Qt({ pct: t }) {
|
|
|
108
107
|
}
|
|
109
108
|
);
|
|
110
109
|
}
|
|
111
|
-
function
|
|
110
|
+
function pa({
|
|
112
111
|
reportId: t,
|
|
113
112
|
field: n,
|
|
114
113
|
label: a,
|
|
@@ -117,82 +116,82 @@ function ma({
|
|
|
117
116
|
onChange: u,
|
|
118
117
|
allowedValues: h
|
|
119
118
|
}) {
|
|
120
|
-
const g =
|
|
119
|
+
const g = Te(), p = nt(), [K, L] = S(!1), { scopes: y } = na(), Q = s ? el(s.collection, y) : [], { data: m = [] } = _e({
|
|
121
120
|
queryKey: ["nivaro-report-filter-opts", t, n, s ?? null, Q],
|
|
122
121
|
queryFn: async () => {
|
|
123
122
|
if (s) {
|
|
124
|
-
const
|
|
123
|
+
const q = s.value_field ?? "id", Z = s.label_field ?? q, E = Q.length ? tl(
|
|
125
124
|
s.collection,
|
|
126
|
-
await
|
|
125
|
+
await al(g, p, s.collection),
|
|
127
126
|
Q
|
|
128
|
-
) : null,
|
|
129
|
-
|
|
130
|
-
fields: [.../* @__PURE__ */ new Set(["id",
|
|
131
|
-
...
|
|
127
|
+
) : null, me = await g.request(
|
|
128
|
+
_a(s.collection, {
|
|
129
|
+
fields: [.../* @__PURE__ */ new Set(["id", q, Z])],
|
|
130
|
+
...E ? { filter: E } : {},
|
|
132
131
|
sort: s.sort ? [s.sort] : void 0,
|
|
133
132
|
limit: 200
|
|
134
133
|
})
|
|
135
134
|
);
|
|
136
|
-
return
|
|
137
|
-
(
|
|
138
|
-
value: String(J[
|
|
139
|
-
label: String(J[
|
|
135
|
+
return rl(
|
|
136
|
+
(me.data ?? []).map((J) => ({
|
|
137
|
+
value: String(J[q] ?? J.id),
|
|
138
|
+
label: String(J[Z] ?? J[q] ?? J.id)
|
|
140
139
|
})),
|
|
141
140
|
(J) => J.value
|
|
142
141
|
);
|
|
143
142
|
}
|
|
144
|
-
return g.request(
|
|
143
|
+
return g.request(Ca(t, n)).then((q) => q.data);
|
|
145
144
|
},
|
|
146
|
-
enabled:
|
|
145
|
+
enabled: K,
|
|
147
146
|
staleTime: 12e4
|
|
148
|
-
}),
|
|
149
|
-
return /* @__PURE__ */ o(
|
|
150
|
-
/* @__PURE__ */ e(
|
|
147
|
+
}), N = h != null && h.length ? m.filter((q) => h.some((Z) => String(Z) === q.value)) : m, H = c.length > 0;
|
|
148
|
+
return /* @__PURE__ */ o(ca, { open: K, onOpenChange: L, children: [
|
|
149
|
+
/* @__PURE__ */ e(ua, { asChild: !0, children: /* @__PURE__ */ o(
|
|
151
150
|
"button",
|
|
152
151
|
{
|
|
153
152
|
type: "button",
|
|
154
153
|
className: P(
|
|
155
154
|
"flex h-7 items-center gap-1.5 rounded-md border px-2 text-[12px]",
|
|
156
|
-
|
|
155
|
+
H ? "border-nvr-cyan bg-accent font-medium text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 text-slate-500 hover:border-slate-300 dark:border-border"
|
|
157
156
|
),
|
|
158
157
|
children: [
|
|
159
158
|
a,
|
|
160
|
-
|
|
159
|
+
H && /* @__PURE__ */ e("span", { className: "rounded-full bg-white/60 px-1 text-[10px] dark:bg-black/20", children: c.length }),
|
|
161
160
|
/* @__PURE__ */ e(It, { className: "h-3 w-3 opacity-50" })
|
|
162
161
|
]
|
|
163
162
|
}
|
|
164
163
|
) }),
|
|
165
|
-
/* @__PURE__ */ e(
|
|
166
|
-
/* @__PURE__ */ e(
|
|
167
|
-
/* @__PURE__ */ o(
|
|
168
|
-
/* @__PURE__ */ e(
|
|
169
|
-
|
|
170
|
-
const
|
|
164
|
+
/* @__PURE__ */ e(ma, { className: "w-[240px] p-0", align: "start", children: /* @__PURE__ */ o(dl, { children: [
|
|
165
|
+
/* @__PURE__ */ e(cl, { placeholder: `Filter ${a}…`, className: "h-8 text-[12.5px]" }),
|
|
166
|
+
/* @__PURE__ */ o(ul, { className: "max-h-52", children: [
|
|
167
|
+
/* @__PURE__ */ e(ml, { children: "No values." }),
|
|
168
|
+
N.map((q) => {
|
|
169
|
+
const Z = c.some((E) => String(E) === q.value);
|
|
171
170
|
return /* @__PURE__ */ o(
|
|
172
|
-
|
|
171
|
+
pl,
|
|
173
172
|
{
|
|
174
|
-
value:
|
|
173
|
+
value: q.label,
|
|
175
174
|
onSelect: () => {
|
|
176
|
-
const
|
|
175
|
+
const E = Z ? c.filter((J) => String(J) !== q.value) : [...c, q.value], me = (J) => {
|
|
177
176
|
var W;
|
|
178
|
-
return ((W = m.find((
|
|
177
|
+
return ((W = m.find((ie) => ie.value === String(J))) == null ? void 0 : W.label) ?? String(J);
|
|
179
178
|
};
|
|
180
|
-
u(
|
|
179
|
+
u(E, E.map(me));
|
|
181
180
|
},
|
|
182
181
|
className: "text-[12.5px]",
|
|
183
182
|
children: [
|
|
184
|
-
/* @__PURE__ */ e(Ht, { className: P("mr-1.5 h-3 w-3",
|
|
185
|
-
|
|
183
|
+
/* @__PURE__ */ e(Ht, { className: P("mr-1.5 h-3 w-3", Z ? "opacity-100" : "opacity-0") }),
|
|
184
|
+
q.label
|
|
186
185
|
]
|
|
187
186
|
},
|
|
188
|
-
|
|
187
|
+
q.value
|
|
189
188
|
);
|
|
190
189
|
})
|
|
191
190
|
] })
|
|
192
191
|
] }) })
|
|
193
192
|
] });
|
|
194
193
|
}
|
|
195
|
-
function
|
|
194
|
+
function ha(t) {
|
|
196
195
|
if (!t) return null;
|
|
197
196
|
const n = /* @__PURE__ */ new Date(), a = (u) => {
|
|
198
197
|
const h = (g) => String(g).padStart(2, "0");
|
|
@@ -235,7 +234,7 @@ function ze(t, n, a) {
|
|
|
235
234
|
});
|
|
236
235
|
return n === "currency" ? `$${c(0, 0)}` : n === "percent" ? `${c(0, 1)}%` : n === "days" ? `${c(0, 1)}d` : n === "integer" ? Math.round(s).toLocaleString() : n === "number" ? c(0, 2) : String(t);
|
|
237
236
|
}
|
|
238
|
-
const
|
|
237
|
+
const je = /* @__PURE__ */ new Set([
|
|
239
238
|
"currency",
|
|
240
239
|
"number",
|
|
241
240
|
"integer",
|
|
@@ -243,7 +242,7 @@ const Pe = /* @__PURE__ */ new Set([
|
|
|
243
242
|
"days"
|
|
244
243
|
]);
|
|
245
244
|
function Kt(t, n, a) {
|
|
246
|
-
const s = {}, c =
|
|
245
|
+
const s = {}, c = ha(n);
|
|
247
246
|
for (const [u, h] of Object.entries(t.params ?? {})) {
|
|
248
247
|
if (h === "$date.start") {
|
|
249
248
|
c && (s[u] = c.start);
|
|
@@ -255,15 +254,15 @@ function Kt(t, n, a) {
|
|
|
255
254
|
}
|
|
256
255
|
const g = /^\$filters\.([\w.]+?)(:values)?$/.exec(h);
|
|
257
256
|
if (g) {
|
|
258
|
-
const p = a.find((
|
|
259
|
-
|
|
257
|
+
const p = a.find((L) => L.field === g[1]), K = g[2] ? p == null ? void 0 : p.values : p != null && p.labels && p.labels.length > 0 ? p.labels : p == null ? void 0 : p.values;
|
|
258
|
+
K && K.length > 0 && (s[u] = K.join(","));
|
|
260
259
|
continue;
|
|
261
260
|
}
|
|
262
261
|
s[u] = h;
|
|
263
262
|
}
|
|
264
263
|
return s;
|
|
265
264
|
}
|
|
266
|
-
const wl = (t) => `$${
|
|
265
|
+
const wl = (t) => `$${$e(Math.round(t))}`, Sl = [
|
|
267
266
|
{ gte: 90, color: "#ef4444" },
|
|
268
267
|
{ gte: 70, color: "#f59e0b" },
|
|
269
268
|
{ gte: -1 / 0, color: "#10b981" }
|
|
@@ -274,65 +273,65 @@ function _l({
|
|
|
274
273
|
onDrill: a
|
|
275
274
|
}) {
|
|
276
275
|
const s = n.tree, c = n.series && n.series.length > 0 ? n.series : Object.keys(t[0] ?? {}).filter((m) => {
|
|
277
|
-
var
|
|
278
|
-
return typeof ((
|
|
279
|
-
}).slice(0, 3).map((m) => ({ field: m, label: m })), u =
|
|
280
|
-
() => s ?
|
|
276
|
+
var N;
|
|
277
|
+
return typeof ((N = t[0]) == null ? void 0 : N[m]) == "number";
|
|
278
|
+
}).slice(0, 3).map((m) => ({ field: m, label: m })), u = lt(
|
|
279
|
+
() => s ? ll(
|
|
281
280
|
t,
|
|
282
281
|
s,
|
|
283
282
|
c.map((m) => m.field)
|
|
284
283
|
) : [],
|
|
285
284
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
286
285
|
[t, s]
|
|
287
|
-
), [h, g] =
|
|
288
|
-
|
|
286
|
+
), [h, g] = S(() => /* @__PURE__ */ new Set()), [p, K] = S(!1);
|
|
287
|
+
tt(() => {
|
|
289
288
|
if (p || u.length === 0) return;
|
|
290
|
-
const m = /* @__PURE__ */ new Set(),
|
|
291
|
-
for (const
|
|
292
|
-
(
|
|
289
|
+
const m = /* @__PURE__ */ new Set(), N = (H) => {
|
|
290
|
+
for (const q of H)
|
|
291
|
+
(q.depth > 0 || u.length === 1) && m.add(q.key), N(q.children);
|
|
293
292
|
};
|
|
294
|
-
|
|
293
|
+
N(u), g(m), K(!0);
|
|
295
294
|
}, [u, p]);
|
|
296
|
-
const
|
|
297
|
-
var
|
|
298
|
-
return m == null ? void 0 : ((
|
|
295
|
+
const L = (s == null ? void 0 : s.thresholds) ?? Sl, y = (m) => {
|
|
296
|
+
var N;
|
|
297
|
+
return m == null ? void 0 : ((N = L.find((H) => m >= H.gte)) == null ? void 0 : N.color) ?? "#10b981";
|
|
299
298
|
}, Q = (m) => {
|
|
300
|
-
const
|
|
299
|
+
const N = m.children.length === 0, H = h.has(m.key), q = y(m.pct), Z = N && (s == null ? void 0 : s.drill) && m.drillId != null;
|
|
301
300
|
return /* @__PURE__ */ o("div", { style: { paddingLeft: m.depth === 0 ? 0 : 14 }, children: [
|
|
302
301
|
/* @__PURE__ */ o(
|
|
303
302
|
"div",
|
|
304
303
|
{
|
|
305
|
-
role:
|
|
306
|
-
tabIndex:
|
|
304
|
+
role: Z || !N ? "button" : void 0,
|
|
305
|
+
tabIndex: Z || !N ? 0 : void 0,
|
|
307
306
|
className: P(
|
|
308
307
|
"group/tn rounded-md px-1.5 py-1",
|
|
309
|
-
(
|
|
308
|
+
(Z || !N) && "cursor-pointer hover:bg-slate-50 dark:hover:bg-muted/40"
|
|
310
309
|
),
|
|
311
310
|
onClick: () => {
|
|
312
|
-
|
|
311
|
+
N ? Z && (s != null && s.drill) && a({
|
|
313
312
|
collection: s.drill.collection,
|
|
314
313
|
itemId: String(m.drillId),
|
|
315
314
|
title: m.label
|
|
316
|
-
}) : g((
|
|
317
|
-
const
|
|
318
|
-
return
|
|
315
|
+
}) : g((E) => {
|
|
316
|
+
const me = new Set(E);
|
|
317
|
+
return me.has(m.key) ? me.delete(m.key) : me.add(m.key), me;
|
|
319
318
|
});
|
|
320
319
|
},
|
|
321
|
-
onKeyDown: (
|
|
322
|
-
(
|
|
320
|
+
onKeyDown: (E) => {
|
|
321
|
+
(E.key === "Enter" || E.key === " ") && E.currentTarget.click();
|
|
323
322
|
},
|
|
324
323
|
children: [
|
|
325
324
|
/* @__PURE__ */ o("div", { className: "flex items-center gap-1.5", children: [
|
|
326
|
-
|
|
325
|
+
N ? /* @__PURE__ */ e("span", { className: "w-3 shrink-0" }) : /* @__PURE__ */ e(
|
|
327
326
|
It,
|
|
328
327
|
{
|
|
329
328
|
className: P(
|
|
330
329
|
"h-3 w-3 shrink-0 text-slate-400 transition-transform",
|
|
331
|
-
|
|
330
|
+
H && "rotate-180"
|
|
332
331
|
)
|
|
333
332
|
}
|
|
334
333
|
),
|
|
335
|
-
|
|
334
|
+
N && m.badge && /* @__PURE__ */ e("span", { className: "shrink-0 rounded bg-slate-100 px-1 py-px text-[9.5px] tabular-nums text-slate-500 dark:bg-muted dark:text-slate-400", children: m.badge }),
|
|
336
335
|
/* @__PURE__ */ e(
|
|
337
336
|
"span",
|
|
338
337
|
{
|
|
@@ -340,7 +339,7 @@ function _l({
|
|
|
340
339
|
"min-w-0 flex-1 truncate",
|
|
341
340
|
m.depth === 0 ? "text-[12px] font-semibold text-slate-800 dark:text-slate-100" : m.depth === 1 ? "text-[11.5px] font-medium text-slate-700 dark:text-slate-200" : P(
|
|
342
341
|
"text-[11px] text-slate-600 dark:text-slate-300",
|
|
343
|
-
|
|
342
|
+
Z && "group-hover/tn:underline"
|
|
344
343
|
)
|
|
345
344
|
),
|
|
346
345
|
children: m.label
|
|
@@ -350,7 +349,7 @@ function _l({
|
|
|
350
349
|
"span",
|
|
351
350
|
{
|
|
352
351
|
className: "shrink-0 text-[10.5px] font-semibold tabular-nums",
|
|
353
|
-
style: { color:
|
|
352
|
+
style: { color: q },
|
|
354
353
|
children: [
|
|
355
354
|
m.pct.toFixed(1),
|
|
356
355
|
"%"
|
|
@@ -369,27 +368,27 @@ function _l({
|
|
|
369
368
|
"div",
|
|
370
369
|
{
|
|
371
370
|
className: "h-full rounded-full transition-[width] duration-300",
|
|
372
|
-
style: { width: `${Math.min(Math.max(m.pct, 0), 100)}%`, background:
|
|
371
|
+
style: { width: `${Math.min(Math.max(m.pct, 0), 100)}%`, background: q }
|
|
373
372
|
}
|
|
374
373
|
)
|
|
375
374
|
}
|
|
376
375
|
),
|
|
377
|
-
/* @__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((
|
|
378
|
-
|
|
376
|
+
/* @__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((E) => /* @__PURE__ */ o("span", { children: [
|
|
377
|
+
E.label ?? E.field,
|
|
379
378
|
" ",
|
|
380
|
-
/* @__PURE__ */ e("span", { className: "font-medium text-slate-500 dark:text-slate-300", children: m.sums[
|
|
381
|
-
] },
|
|
379
|
+
/* @__PURE__ */ e("span", { className: "font-medium text-slate-500 dark:text-slate-300", children: m.sums[E.field] == null ? E.empty_label ?? "—" : n.value_format === "currency" ? wl(m.sums[E.field]) : m.sums[E.field].toLocaleString() })
|
|
380
|
+
] }, E.field)) })
|
|
382
381
|
]
|
|
383
382
|
}
|
|
384
383
|
),
|
|
385
|
-
|
|
384
|
+
H && m.children.map(Q)
|
|
386
385
|
] }, m.key);
|
|
387
386
|
};
|
|
388
387
|
return !s || u.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: u.map(Q) });
|
|
389
388
|
}
|
|
390
389
|
function Cl(t) {
|
|
391
|
-
const [n, a] =
|
|
392
|
-
return
|
|
390
|
+
const [n, a] = S(() => typeof IntersectionObserver > "u");
|
|
391
|
+
return tt(() => {
|
|
393
392
|
if (n) return;
|
|
394
393
|
const s = t.current;
|
|
395
394
|
if (!s) {
|
|
@@ -410,12 +409,12 @@ function Cl(t) {
|
|
|
410
409
|
}, [n, t]), n;
|
|
411
410
|
}
|
|
412
411
|
function $l(t) {
|
|
413
|
-
const n =
|
|
412
|
+
const n = Te(), a = at(!1);
|
|
414
413
|
return async (s) => {
|
|
415
414
|
if (!(!t || a.current)) {
|
|
416
415
|
a.current = !0;
|
|
417
416
|
try {
|
|
418
|
-
const u = (await n.request(
|
|
417
|
+
const u = (await n.request(rt("/report-studio/drill-row", { values: s }))).data;
|
|
419
418
|
u != null && u.collection && u.item_id && t({ collection: u.collection, itemId: u.item_id });
|
|
420
419
|
} catch {
|
|
421
420
|
} finally {
|
|
@@ -424,7 +423,7 @@ function $l(t) {
|
|
|
424
423
|
}
|
|
425
424
|
};
|
|
426
425
|
}
|
|
427
|
-
function
|
|
426
|
+
function fa(t, n) {
|
|
428
427
|
let a = n;
|
|
429
428
|
if (t.group_rows && t.x_field) {
|
|
430
429
|
const s = /* @__PURE__ */ new Map(), c = new Set(
|
|
@@ -443,40 +442,41 @@ function ha(t, n) {
|
|
|
443
442
|
if (t.sort) {
|
|
444
443
|
const s = t.sort.startsWith("-"), c = s ? t.sort.slice(1) : t.sort;
|
|
445
444
|
a = [...a].sort((u, h) => {
|
|
446
|
-
const g = u[c], p = h[c],
|
|
447
|
-
return s ? -
|
|
445
|
+
const g = u[c], p = h[c], K = typeof g == "number" && typeof p == "number" ? g - p : String(g ?? "").localeCompare(String(p ?? ""));
|
|
446
|
+
return s ? -K : K;
|
|
448
447
|
});
|
|
449
448
|
}
|
|
450
449
|
return t.limit && t.limit > 0 && (a = a.slice(0, t.limit)), a;
|
|
451
450
|
}
|
|
452
|
-
function
|
|
453
|
-
const c =
|
|
454
|
-
return t.request(s ? { ...c, _signal: s } : c).then((u) => (
|
|
451
|
+
function xa(t, n, a, s) {
|
|
452
|
+
const c = Sa(n, a);
|
|
453
|
+
return t.request(s ? { ...c, _signal: s } : c).then((u) => (ga(n, a, u), u.data ?? []));
|
|
455
454
|
}
|
|
456
|
-
const qt = /* @__PURE__ */ new Map(),
|
|
457
|
-
function
|
|
455
|
+
const qt = /* @__PURE__ */ new Map(), ba = (t, n) => `${t}\0${JSON.stringify(n)}`;
|
|
456
|
+
function ga(t, n, a) {
|
|
458
457
|
const s = a;
|
|
459
|
-
!s || typeof s != "object" || (qt.size > 200 && qt.clear(), qt.set(
|
|
458
|
+
!s || typeof s != "object" || (qt.size > 200 && qt.clear(), qt.set(ba(t, n), {
|
|
460
459
|
cached_at: s.cached_at ?? null,
|
|
461
460
|
executed_at: s.executed_at ?? null,
|
|
462
461
|
freshness_sources: s.freshness_sources ?? null
|
|
463
462
|
}));
|
|
464
463
|
}
|
|
465
|
-
const
|
|
464
|
+
const va = za(void 0);
|
|
466
465
|
function ql({
|
|
467
466
|
slug: t,
|
|
468
467
|
params: n,
|
|
469
468
|
scope: a
|
|
470
469
|
}) {
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
470
|
+
var N;
|
|
471
|
+
const s = Te(), c = nt(), u = Ba(va), h = ["nivaro-report-query", t, n], g = ((N = Ia(h)) == null ? void 0 : N.dataUpdatedAt) ?? 0, [p, K] = S(!1), L = JSON.stringify(h), y = lt(
|
|
472
|
+
() => qt.get(ba(t, n)),
|
|
473
|
+
[t, L, g]
|
|
474
474
|
), Q = gt(() => {
|
|
475
|
-
|
|
476
|
-
|
|
475
|
+
K(!0), s.request(rt(`/custom-queries/${t}/execute`, { params: n, refresh: !0 })).then((H) => {
|
|
476
|
+
ga(t, n, H), c.setQueryData(h, H.data ?? []);
|
|
477
477
|
}).catch(() => {
|
|
478
|
-
}).finally(() =>
|
|
479
|
-
}, [s, c, t,
|
|
478
|
+
}).finally(() => K(!1));
|
|
479
|
+
}, [s, c, t, L]);
|
|
480
480
|
return Ha({ envelope: y, scope: a, refresh: Q, autoOverride: u }).changed ? /* @__PURE__ */ o(
|
|
481
481
|
"div",
|
|
482
482
|
{
|
|
@@ -517,20 +517,20 @@ function Al({
|
|
|
517
517
|
onDrill: u,
|
|
518
518
|
deferred: h = !1
|
|
519
519
|
}) {
|
|
520
|
-
var
|
|
521
|
-
const g =
|
|
522
|
-
queryKey: ["nivaro-report-query", t.slug,
|
|
523
|
-
queryFn: ({ signal:
|
|
520
|
+
var se, re;
|
|
521
|
+
const g = Te(), p = $l(u), [K, L] = S(""), [y, Q] = S(0), [m, N] = S(null), H = Kt(t, n, a), { data: q, isLoading: Z, error: E, isFetching: me, refetch: J } = _e({
|
|
522
|
+
queryKey: ["nivaro-report-query", t.slug, H],
|
|
523
|
+
queryFn: ({ signal: k }) => xa(g, t.slug, H, k),
|
|
524
524
|
enabled: !h,
|
|
525
525
|
staleTime: 6e4,
|
|
526
526
|
refetchInterval: s,
|
|
527
527
|
retry: !1
|
|
528
528
|
});
|
|
529
|
-
if (
|
|
530
|
-
c == null || c({ isFetching:
|
|
531
|
-
}, [
|
|
529
|
+
if (tt(() => {
|
|
530
|
+
c == null || c({ isFetching: me, refetch: () => void J() });
|
|
531
|
+
}, [me]), h && q === void 0)
|
|
532
532
|
return /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-300", children: "Loading…" });
|
|
533
|
-
if (
|
|
533
|
+
if (Z)
|
|
534
534
|
return /* @__PURE__ */ o("div", { className: "flex flex-col gap-2 px-1", children: [
|
|
535
535
|
/* @__PURE__ */ e("p", { className: "text-[12px] text-slate-300", children: "Loading…" }),
|
|
536
536
|
/* @__PURE__ */ e(
|
|
@@ -540,105 +540,105 @@ function Al({
|
|
|
540
540
|
request: {
|
|
541
541
|
method: "POST",
|
|
542
542
|
url: `/custom-queries/${t.slug}/execute`,
|
|
543
|
-
body: { params:
|
|
543
|
+
body: { params: H }
|
|
544
544
|
},
|
|
545
545
|
label: `Query ${t.slug}`,
|
|
546
|
-
queryKey: ["nivaro-report-query", t.slug,
|
|
547
|
-
select: (
|
|
546
|
+
queryKey: ["nivaro-report-query", t.slug, H],
|
|
547
|
+
select: (k) => (k == null ? void 0 : k.data) ?? []
|
|
548
548
|
}
|
|
549
549
|
)
|
|
550
550
|
] });
|
|
551
|
-
if (
|
|
551
|
+
if (E)
|
|
552
552
|
return /* @__PURE__ */ e(
|
|
553
|
-
|
|
553
|
+
da,
|
|
554
554
|
{
|
|
555
555
|
className: "px-1",
|
|
556
|
-
message: ra(
|
|
556
|
+
message: ra(E) ?? Ot(E, "this query"),
|
|
557
557
|
onRetry: () => void J()
|
|
558
558
|
}
|
|
559
559
|
);
|
|
560
|
-
const W =
|
|
560
|
+
const W = fa(t, q ?? []);
|
|
561
561
|
if (W.length === 0) return /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No data." });
|
|
562
|
-
const
|
|
562
|
+
const ie = t.columns && t.columns.length > 0 ? t.columns : Object.keys(W[0] ?? {}).map((k) => ({ field: k }));
|
|
563
563
|
if (t.display === "kpis") {
|
|
564
|
-
const
|
|
565
|
-
var
|
|
564
|
+
const k = t.x_field ? W.map((F, Y) => {
|
|
565
|
+
var j, de, pe, ke, w;
|
|
566
566
|
return {
|
|
567
|
-
label: String(
|
|
568
|
-
value:
|
|
569
|
-
color: ((
|
|
567
|
+
label: String(F[t.x_field] ?? ""),
|
|
568
|
+
value: F[((de = (j = t.series) == null ? void 0 : j[0]) == null ? void 0 : de.field) ?? ((pe = ie.find((I) => I.field !== t.x_field)) == null ? void 0 : pe.field) ?? ""],
|
|
569
|
+
color: ((w = (ke = t.series) == null ? void 0 : ke[0]) == null ? void 0 : w.color) ?? ue[Y % ue.length],
|
|
570
570
|
format: t.value_format
|
|
571
571
|
};
|
|
572
|
-
}) :
|
|
573
|
-
var
|
|
572
|
+
}) : ie.map((F, Y) => {
|
|
573
|
+
var j;
|
|
574
574
|
return {
|
|
575
|
-
label:
|
|
576
|
-
value: (
|
|
577
|
-
color:
|
|
578
|
-
format:
|
|
575
|
+
label: F.label ?? F.field,
|
|
576
|
+
value: (j = W[0]) == null ? void 0 : j[F.field],
|
|
577
|
+
color: ue[Y % ue.length],
|
|
578
|
+
format: F.format ?? t.value_format
|
|
579
579
|
};
|
|
580
580
|
});
|
|
581
581
|
return /* @__PURE__ */ e(
|
|
582
582
|
"div",
|
|
583
583
|
{
|
|
584
584
|
className: "grid gap-2",
|
|
585
|
-
style: { gridTemplateColumns: `repeat(${Math.min(6, Math.max(1,
|
|
586
|
-
children:
|
|
585
|
+
style: { gridTemplateColumns: `repeat(${Math.min(6, Math.max(1, k.length))}, 1fr)` },
|
|
586
|
+
children: k.map((F) => /* @__PURE__ */ o(
|
|
587
587
|
"div",
|
|
588
588
|
{
|
|
589
589
|
className: "flex flex-col justify-center rounded-md border border-slate-100 px-3 py-2 dark:border-border/60",
|
|
590
|
-
style: { borderTopColor:
|
|
590
|
+
style: { borderTopColor: F.color, borderTopWidth: 2 },
|
|
591
591
|
children: [
|
|
592
|
-
/* @__PURE__ */ e("p", { className: "truncate text-[10.5px] uppercase tracking-wide text-slate-400", children:
|
|
593
|
-
/* @__PURE__ */ e("p", { className: "text-[19px] font-semibold leading-tight text-slate-900 dark:text-foreground", children: ze(
|
|
592
|
+
/* @__PURE__ */ e("p", { className: "truncate text-[10.5px] uppercase tracking-wide text-slate-400", children: F.label }),
|
|
593
|
+
/* @__PURE__ */ e("p", { className: "text-[19px] font-semibold leading-tight text-slate-900 dark:text-foreground", children: ze(F.value, F.format ?? "integer") })
|
|
594
594
|
]
|
|
595
595
|
},
|
|
596
|
-
|
|
596
|
+
F.label
|
|
597
597
|
))
|
|
598
598
|
}
|
|
599
599
|
);
|
|
600
600
|
}
|
|
601
601
|
if (t.display === "tree")
|
|
602
|
-
return /* @__PURE__ */ e(_l, { rows: W, cfg: t, onDrill: (
|
|
602
|
+
return /* @__PURE__ */ e(_l, { rows: W, cfg: t, onDrill: (k) => u == null ? void 0 : u(k) });
|
|
603
603
|
if (t.display === "table") {
|
|
604
|
-
const
|
|
605
|
-
(
|
|
606
|
-
(
|
|
604
|
+
const k = ie.filter((w) => je.has(w.format ?? "")), F = K.trim().toLowerCase(), Y = F ? W.filter(
|
|
605
|
+
(w) => Object.values(w).some(
|
|
606
|
+
(I) => String(I ?? "").toLowerCase().includes(F)
|
|
607
607
|
)
|
|
608
|
-
) : W,
|
|
608
|
+
) : W, j = 12, de = Math.max(1, Math.ceil(Y.length / j)), pe = Math.min(y, de - 1), ke = Y.length > j ? Y.slice(pe * j, pe * j + j) : Y;
|
|
609
609
|
return /* @__PURE__ */ o("div", { className: "flex min-h-0 flex-1 flex-col", children: [
|
|
610
|
-
W.length >
|
|
610
|
+
W.length > j && /* @__PURE__ */ o("div", { className: "mb-1 flex items-center gap-2", children: [
|
|
611
611
|
/* @__PURE__ */ e(
|
|
612
612
|
"input",
|
|
613
613
|
{
|
|
614
|
-
value:
|
|
615
|
-
onChange: (
|
|
616
|
-
|
|
614
|
+
value: K,
|
|
615
|
+
onChange: (w) => {
|
|
616
|
+
L(w.target.value), Q(0);
|
|
617
617
|
},
|
|
618
618
|
placeholder: "Search rows…",
|
|
619
619
|
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"
|
|
620
620
|
}
|
|
621
621
|
),
|
|
622
|
-
|
|
622
|
+
de > 1 && /* @__PURE__ */ o("span", { className: "ml-auto flex items-center gap-1 text-[10.5px] text-slate-400", children: [
|
|
623
623
|
/* @__PURE__ */ e(
|
|
624
624
|
"button",
|
|
625
625
|
{
|
|
626
626
|
type: "button",
|
|
627
|
-
disabled:
|
|
628
|
-
onClick: () => Q(
|
|
627
|
+
disabled: pe <= 0,
|
|
628
|
+
onClick: () => Q(pe - 1),
|
|
629
629
|
className: "rounded px-1 disabled:opacity-30",
|
|
630
630
|
children: "←"
|
|
631
631
|
}
|
|
632
632
|
),
|
|
633
|
-
|
|
633
|
+
pe + 1,
|
|
634
634
|
"/",
|
|
635
|
-
|
|
635
|
+
de,
|
|
636
636
|
/* @__PURE__ */ e(
|
|
637
637
|
"button",
|
|
638
638
|
{
|
|
639
639
|
type: "button",
|
|
640
|
-
disabled:
|
|
641
|
-
onClick: () => Q(
|
|
640
|
+
disabled: pe >= de - 1,
|
|
641
|
+
onClick: () => Q(pe + 1),
|
|
642
642
|
className: "rounded px-1 disabled:opacity-30",
|
|
643
643
|
children: "→"
|
|
644
644
|
}
|
|
@@ -646,76 +646,76 @@ function Al({
|
|
|
646
646
|
] })
|
|
647
647
|
] }),
|
|
648
648
|
/* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ o("table", { className: "w-full text-[11.5px]", children: [
|
|
649
|
-
/* @__PURE__ */ e("thead", { className: "sticky top-0 z-[1] bg-white dark:bg-card", children: /* @__PURE__ */ e("tr", { children:
|
|
649
|
+
/* @__PURE__ */ e("thead", { className: "sticky top-0 z-[1] bg-white dark:bg-card", children: /* @__PURE__ */ e("tr", { children: ie.map((w) => /* @__PURE__ */ e(
|
|
650
650
|
"th",
|
|
651
651
|
{
|
|
652
652
|
className: P(
|
|
653
653
|
"whitespace-nowrap border-b border-slate-100 px-1.5 py-1 text-left font-medium text-slate-400 dark:border-border",
|
|
654
|
-
|
|
654
|
+
je.has(w.format ?? "") && "text-right"
|
|
655
655
|
),
|
|
656
|
-
children:
|
|
656
|
+
children: w.label ?? w.field
|
|
657
657
|
},
|
|
658
|
-
|
|
658
|
+
w.field
|
|
659
659
|
)) }) }),
|
|
660
|
-
/* @__PURE__ */ e("tbody", { children:
|
|
660
|
+
/* @__PURE__ */ e("tbody", { children: ke.map((w, I) => /* @__PURE__ */ e(
|
|
661
661
|
"tr",
|
|
662
662
|
{
|
|
663
663
|
className: u ? "cursor-pointer hover:bg-slate-50 dark:hover:bg-muted/60" : void 0,
|
|
664
|
-
onClick: () => void p(
|
|
664
|
+
onClick: () => void p(w),
|
|
665
665
|
title: u ? "Open the record behind this row" : void 0,
|
|
666
|
-
children:
|
|
666
|
+
children: ie.map((ae) => /* @__PURE__ */ e(
|
|
667
667
|
"td",
|
|
668
668
|
{
|
|
669
669
|
className: P(
|
|
670
670
|
"max-w-[220px] truncate border-b border-slate-50 px-1.5 py-1 text-slate-700 dark:border-border/40 dark:text-slate-300",
|
|
671
|
-
|
|
671
|
+
je.has(ae.format ?? "") && "text-right tabular-nums"
|
|
672
672
|
),
|
|
673
|
-
children: ze(
|
|
673
|
+
children: ze(w[ae.field], ae.format, ae.decimals)
|
|
674
674
|
},
|
|
675
|
-
|
|
675
|
+
ae.field
|
|
676
676
|
))
|
|
677
677
|
},
|
|
678
|
-
|
|
678
|
+
I
|
|
679
679
|
)) }),
|
|
680
|
-
t.totals &&
|
|
680
|
+
t.totals && k.length > 0 && /* @__PURE__ */ e("tfoot", { className: "sticky bottom-0 bg-white dark:bg-card", children: /* @__PURE__ */ e("tr", { children: ie.map((w, I) => /* @__PURE__ */ e(
|
|
681
681
|
"td",
|
|
682
682
|
{
|
|
683
683
|
className: P(
|
|
684
684
|
"border-t border-slate-200 px-1.5 py-1 font-semibold text-slate-800 dark:border-border dark:text-slate-200",
|
|
685
|
-
|
|
685
|
+
je.has(w.format ?? "") && "text-right tabular-nums"
|
|
686
686
|
),
|
|
687
|
-
children:
|
|
688
|
-
W.reduce((
|
|
689
|
-
|
|
690
|
-
|
|
687
|
+
children: I === 0 && !je.has(w.format ?? "") ? "Total" : je.has(w.format ?? "") ? ze(
|
|
688
|
+
W.reduce((ae, we) => ae + (Number(we[w.field]) || 0), 0),
|
|
689
|
+
w.format,
|
|
690
|
+
w.decimals
|
|
691
691
|
) : ""
|
|
692
692
|
},
|
|
693
|
-
|
|
693
|
+
w.field
|
|
694
694
|
)) }) })
|
|
695
695
|
] }) })
|
|
696
696
|
] });
|
|
697
697
|
}
|
|
698
|
-
const
|
|
699
|
-
var
|
|
700
|
-
return
|
|
701
|
-
}).slice(0, 3).map((
|
|
702
|
-
const
|
|
703
|
-
for (const Y of Ne)
|
|
704
|
-
return
|
|
705
|
-
}),
|
|
698
|
+
const be = t.x_field ?? ((se = ie[0]) == null ? void 0 : se.field) ?? "", Ne = t.series && t.series.length > 0 ? t.series : ie.filter((k) => {
|
|
699
|
+
var F;
|
|
700
|
+
return k.field !== be && typeof ((F = W[0]) == null ? void 0 : F[k.field]) == "number";
|
|
701
|
+
}).slice(0, 3).map((k) => ({ field: k.field, label: k.label ?? k.field })), ye = W.map((k) => {
|
|
702
|
+
const F = { [be]: k[be] };
|
|
703
|
+
for (const Y of Ne) F[Y.field] = Number(k[Y.field]) || 0;
|
|
704
|
+
return F;
|
|
705
|
+
}), qe = (k) => t.value_format === "currency" ? `$${$e(k)}` : $e(k), f = (k) => ze(k, t.value_format ?? "number"), X = t.display === "hbar" || t.display === "stacked_bar" && t.horizontal, le = (k) => {
|
|
706
706
|
if (!u) return;
|
|
707
|
-
const
|
|
708
|
-
|
|
709
|
-
},
|
|
707
|
+
const F = (q ?? []).filter((Y) => String(Y[be] ?? "") === k);
|
|
708
|
+
F.length > 0 && N({ label: k, rows: F });
|
|
709
|
+
}, V = m ? /* @__PURE__ */ e(
|
|
710
710
|
"div",
|
|
711
711
|
{
|
|
712
712
|
className: "fixed inset-0 z-[126] flex items-center justify-center bg-black/30 p-6",
|
|
713
|
-
onClick: () =>
|
|
713
|
+
onClick: () => N(null),
|
|
714
714
|
children: /* @__PURE__ */ o(
|
|
715
715
|
"div",
|
|
716
716
|
{
|
|
717
717
|
className: "flex max-h-[70vh] w-full max-w-2xl flex-col overflow-hidden rounded-xl border border-slate-200 bg-white shadow-2xl dark:border-border dark:bg-card",
|
|
718
|
-
onClick: (
|
|
718
|
+
onClick: (k) => k.stopPropagation(),
|
|
719
719
|
children: [
|
|
720
720
|
/* @__PURE__ */ o("div", { className: "flex items-center gap-2 border-b border-slate-100 px-4 py-2.5 dark:border-border", children: [
|
|
721
721
|
/* @__PURE__ */ e("p", { className: "min-w-0 flex-1 truncate text-[13px] font-semibold text-slate-800 dark:text-slate-100", children: m.label }),
|
|
@@ -727,38 +727,38 @@ function Al({
|
|
|
727
727
|
"button",
|
|
728
728
|
{
|
|
729
729
|
type: "button",
|
|
730
|
-
onClick: () =>
|
|
730
|
+
onClick: () => N(null),
|
|
731
731
|
className: "rounded p-1 text-slate-400 hover:text-slate-600",
|
|
732
|
-
children: /* @__PURE__ */ e(
|
|
732
|
+
children: /* @__PURE__ */ e(Re, { className: "h-4 w-4" })
|
|
733
733
|
}
|
|
734
734
|
)
|
|
735
735
|
] }),
|
|
736
736
|
/* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-auto p-2", children: /* @__PURE__ */ o("table", { className: "w-full text-[11px]", children: [
|
|
737
|
-
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { children: Object.keys(m.rows[0] ?? {}).slice(0, 7).map((
|
|
737
|
+
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { children: Object.keys(m.rows[0] ?? {}).slice(0, 7).map((k) => /* @__PURE__ */ e(
|
|
738
738
|
"th",
|
|
739
739
|
{
|
|
740
740
|
className: "border-b border-slate-100 px-1.5 py-1 text-left font-medium text-slate-400 dark:border-border",
|
|
741
|
-
children:
|
|
741
|
+
children: k
|
|
742
742
|
},
|
|
743
|
-
|
|
743
|
+
k
|
|
744
744
|
)) }) }),
|
|
745
|
-
/* @__PURE__ */ e("tbody", { children: m.rows.slice(0, 100).map((
|
|
745
|
+
/* @__PURE__ */ e("tbody", { children: m.rows.slice(0, 100).map((k, F) => /* @__PURE__ */ e(
|
|
746
746
|
"tr",
|
|
747
747
|
{
|
|
748
748
|
className: "cursor-pointer hover:bg-slate-50 dark:hover:bg-muted/60",
|
|
749
749
|
onClick: () => {
|
|
750
|
-
|
|
750
|
+
N(null), p(k);
|
|
751
751
|
},
|
|
752
752
|
children: Object.keys(m.rows[0] ?? {}).slice(0, 7).map((Y) => /* @__PURE__ */ e(
|
|
753
753
|
"td",
|
|
754
754
|
{
|
|
755
755
|
className: "max-w-[160px] truncate border-b border-slate-50 px-1.5 py-1 text-slate-600 dark:border-border/40 dark:text-slate-300",
|
|
756
|
-
children: String(
|
|
756
|
+
children: String(k[Y] ?? "")
|
|
757
757
|
},
|
|
758
758
|
Y
|
|
759
759
|
))
|
|
760
760
|
},
|
|
761
|
-
|
|
761
|
+
F
|
|
762
762
|
)) })
|
|
763
763
|
] }) })
|
|
764
764
|
]
|
|
@@ -767,14 +767,14 @@ function Al({
|
|
|
767
767
|
}
|
|
768
768
|
) : null;
|
|
769
769
|
if (t.display === "donut") {
|
|
770
|
-
const
|
|
770
|
+
const k = ((re = Ne[0]) == null ? void 0 : re.field) ?? "", F = ye.map((j) => ({ dim: String(j[be]), value: Number(j[k]) || 0 })), Y = F.reduce((j, de) => j + de.value, 0);
|
|
771
771
|
return /* @__PURE__ */ o("div", { className: "flex min-h-0 flex-1 items-stretch gap-3", children: [
|
|
772
772
|
/* @__PURE__ */ o("div", { className: "relative min-h-[110px] min-w-0 flex-1", children: [
|
|
773
|
-
/* @__PURE__ */ e(
|
|
773
|
+
/* @__PURE__ */ e(Pe, { fallback: /* @__PURE__ */ e(Ee, { className: "h-full w-full", "aria-busy": "true" }), children: ({ Cell: j, Pie: de, PieChart: pe, ResponsiveContainer: ke, Tooltip: w }) => /* @__PURE__ */ e(ke, { width: "100%", height: "100%", children: /* @__PURE__ */ o(pe, { children: [
|
|
774
774
|
/* @__PURE__ */ e(
|
|
775
|
-
|
|
775
|
+
de,
|
|
776
776
|
{
|
|
777
|
-
data:
|
|
777
|
+
data: F,
|
|
778
778
|
dataKey: "value",
|
|
779
779
|
nameKey: "dim",
|
|
780
780
|
innerRadius: "58%",
|
|
@@ -782,16 +782,16 @@ function Al({
|
|
|
782
782
|
paddingAngle: 2,
|
|
783
783
|
strokeWidth: 0,
|
|
784
784
|
className: u ? "cursor-pointer" : void 0,
|
|
785
|
-
onClick: (
|
|
786
|
-
var
|
|
787
|
-
const
|
|
788
|
-
|
|
785
|
+
onClick: (I) => {
|
|
786
|
+
var we;
|
|
787
|
+
const ae = (we = I == null ? void 0 : I.payload) == null ? void 0 : we.dim;
|
|
788
|
+
ae && le(String(ae));
|
|
789
789
|
},
|
|
790
|
-
children:
|
|
790
|
+
children: F.map((I, ae) => /* @__PURE__ */ e(j, { fill: ue[ae % ue.length] }, I.dim))
|
|
791
791
|
}
|
|
792
792
|
),
|
|
793
793
|
/* @__PURE__ */ e(
|
|
794
|
-
|
|
794
|
+
w,
|
|
795
795
|
{
|
|
796
796
|
contentStyle: {
|
|
797
797
|
fontSize: 12,
|
|
@@ -802,7 +802,7 @@ function Al({
|
|
|
802
802
|
},
|
|
803
803
|
labelStyle: { color: "#f1f5f9" },
|
|
804
804
|
itemStyle: { color: "#e2e8f0" },
|
|
805
|
-
formatter: (
|
|
805
|
+
formatter: (I) => f(I)
|
|
806
806
|
}
|
|
807
807
|
)
|
|
808
808
|
] }) }) }),
|
|
@@ -811,35 +811,35 @@ function Al({
|
|
|
811
811
|
/* @__PURE__ */ e("span", { className: "text-[9.5px] text-slate-400", children: "total" })
|
|
812
812
|
] })
|
|
813
813
|
] }),
|
|
814
|
-
/* @__PURE__ */ e("div", { className: "max-h-full w-[40%] shrink-0 space-y-0.5 self-center overflow-y-auto pr-1", children:
|
|
814
|
+
/* @__PURE__ */ e("div", { className: "max-h-full w-[40%] shrink-0 space-y-0.5 self-center overflow-y-auto pr-1", children: F.slice(0, 12).map((j, de) => /* @__PURE__ */ o("div", { className: "flex items-center gap-1.5 text-[10.5px]", children: [
|
|
815
815
|
/* @__PURE__ */ e(
|
|
816
816
|
"span",
|
|
817
817
|
{
|
|
818
818
|
className: "h-2 w-2 shrink-0 rounded-sm",
|
|
819
|
-
style: { background:
|
|
819
|
+
style: { background: ue[de % ue.length] }
|
|
820
820
|
}
|
|
821
821
|
),
|
|
822
|
-
/* @__PURE__ */ e("span", { className: "truncate text-slate-600 dark:text-slate-300", children:
|
|
823
|
-
/* @__PURE__ */ e("span", { className: "ml-auto tabular-nums text-slate-400", children: f(
|
|
824
|
-
] },
|
|
825
|
-
|
|
822
|
+
/* @__PURE__ */ e("span", { className: "truncate text-slate-600 dark:text-slate-300", children: j.dim }),
|
|
823
|
+
/* @__PURE__ */ e("span", { className: "ml-auto tabular-nums text-slate-400", children: f(j.value) })
|
|
824
|
+
] }, j.dim)) }),
|
|
825
|
+
V
|
|
826
826
|
] });
|
|
827
827
|
}
|
|
828
828
|
if (t.display === "line" || t.display === "area")
|
|
829
829
|
return /* @__PURE__ */ o("div", { className: "min-h-[110px] min-w-0 flex-1", children: [
|
|
830
|
-
/* @__PURE__ */ e(
|
|
830
|
+
/* @__PURE__ */ e(Pe, { fallback: /* @__PURE__ */ e(Ee, { className: "h-full w-full", "aria-busy": "true" }), children: ({ Area: k, AreaChart: F, Legend: Y, ResponsiveContainer: j, Tooltip: de, XAxis: pe, YAxis: ke }) => /* @__PURE__ */ e(j, { width: "100%", height: "100%", children: /* @__PURE__ */ o(F, { data: ye, margin: { top: 6, right: 8, left: -6, bottom: 0 }, children: [
|
|
831
831
|
/* @__PURE__ */ e(
|
|
832
|
-
|
|
832
|
+
pe,
|
|
833
833
|
{
|
|
834
|
-
dataKey:
|
|
834
|
+
dataKey: be,
|
|
835
835
|
tick: { fontSize: 10 },
|
|
836
836
|
stroke: "#94a3b8",
|
|
837
|
-
...
|
|
837
|
+
...Mt(ye.length)
|
|
838
838
|
}
|
|
839
839
|
),
|
|
840
|
-
/* @__PURE__ */ e(
|
|
840
|
+
/* @__PURE__ */ e(ke, { tick: { fontSize: 10 }, stroke: "#94a3b8", tickFormatter: qe, width: 48 }),
|
|
841
841
|
/* @__PURE__ */ e(
|
|
842
|
-
|
|
842
|
+
de,
|
|
843
843
|
{
|
|
844
844
|
contentStyle: {
|
|
845
845
|
fontSize: 12,
|
|
@@ -850,111 +850,115 @@ function Al({
|
|
|
850
850
|
},
|
|
851
851
|
labelStyle: { color: "#f1f5f9" },
|
|
852
852
|
itemStyle: { color: "#e2e8f0" },
|
|
853
|
-
formatter: (
|
|
853
|
+
formatter: (w) => f(w)
|
|
854
854
|
}
|
|
855
855
|
),
|
|
856
|
-
Ne.length > 1 && /* @__PURE__ */ e(Y, { wrapperStyle: { fontSize: 11 } }),
|
|
857
|
-
Ne.map((
|
|
858
|
-
|
|
856
|
+
Ne.length > 1 && /* @__PURE__ */ e(Y, { wrapperStyle: { fontSize: 11 }, itemSorter: null }),
|
|
857
|
+
Ne.map((w, I) => /* @__PURE__ */ e(
|
|
858
|
+
k,
|
|
859
859
|
{
|
|
860
860
|
type: "monotone",
|
|
861
|
-
dataKey:
|
|
862
|
-
name:
|
|
863
|
-
stroke:
|
|
861
|
+
dataKey: w.field,
|
|
862
|
+
name: w.label ?? w.field,
|
|
863
|
+
stroke: w.color ?? ue[I % ue.length],
|
|
864
864
|
strokeWidth: 2,
|
|
865
|
-
strokeDasharray:
|
|
866
|
-
fill:
|
|
867
|
-
fillOpacity: t.display === "area" && !
|
|
865
|
+
strokeDasharray: w.dash ? "4 3" : void 0,
|
|
866
|
+
fill: w.color ?? ue[I % ue.length],
|
|
867
|
+
fillOpacity: t.display === "area" && !w.dash ? 0.12 : 0
|
|
868
868
|
},
|
|
869
|
-
|
|
869
|
+
w.field
|
|
870
870
|
))
|
|
871
871
|
] }) }) }),
|
|
872
|
-
|
|
872
|
+
V
|
|
873
873
|
] });
|
|
874
|
-
const
|
|
875
|
-
return /* @__PURE__ */
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
874
|
+
const xe = t.display === "stacked_bar";
|
|
875
|
+
return /* @__PURE__ */ e(
|
|
876
|
+
ia,
|
|
877
|
+
{
|
|
878
|
+
labels: X ? ye.map((k) => k[be]) : [],
|
|
879
|
+
className: "min-h-[110px] min-w-0 flex-1 text-slate-500 dark:text-slate-400",
|
|
880
|
+
children: (k) => /* @__PURE__ */ o(We, { children: [
|
|
881
|
+
/* @__PURE__ */ e(Pe, { fallback: /* @__PURE__ */ e(Ee, { className: "h-full w-full", "aria-busy": "true" }), children: ({ Bar: F, BarChart: Y, Cell: j, Legend: de, ResponsiveContainer: pe, Tooltip: ke, XAxis: w, YAxis: I }) => /* @__PURE__ */ e(pe, { width: "100%", height: "100%", children: /* @__PURE__ */ o(
|
|
882
|
+
Y,
|
|
883
|
+
{
|
|
884
|
+
data: ye,
|
|
885
|
+
layout: X ? "vertical" : "horizontal",
|
|
886
|
+
margin: { top: 6, right: 8, left: X ? 0 : -6, bottom: 0 },
|
|
887
|
+
children: [
|
|
888
|
+
X ? /* @__PURE__ */ o(We, { children: [
|
|
889
|
+
/* @__PURE__ */ e(
|
|
890
|
+
w,
|
|
891
|
+
{
|
|
892
|
+
type: "number",
|
|
893
|
+
tick: { fontSize: 10 },
|
|
894
|
+
stroke: "#94a3b8",
|
|
895
|
+
tickFormatter: qe
|
|
896
|
+
}
|
|
897
|
+
),
|
|
898
|
+
/* @__PURE__ */ e(I, { type: "category", dataKey: be, stroke: "#94a3b8", ...k })
|
|
899
|
+
] }) : /* @__PURE__ */ o(We, { children: [
|
|
900
|
+
/* @__PURE__ */ e(
|
|
901
|
+
w,
|
|
902
|
+
{
|
|
903
|
+
dataKey: be,
|
|
904
|
+
tick: { fontSize: 10 },
|
|
905
|
+
stroke: "#94a3b8",
|
|
906
|
+
...Mt(ye.length)
|
|
907
|
+
}
|
|
908
|
+
),
|
|
909
|
+
/* @__PURE__ */ e(
|
|
910
|
+
I,
|
|
911
|
+
{
|
|
912
|
+
tick: { fontSize: 10 },
|
|
913
|
+
stroke: "#94a3b8",
|
|
914
|
+
tickFormatter: qe,
|
|
915
|
+
width: 48
|
|
916
|
+
}
|
|
917
|
+
)
|
|
918
|
+
] }),
|
|
919
|
+
/* @__PURE__ */ e(
|
|
920
|
+
ke,
|
|
921
|
+
{
|
|
922
|
+
contentStyle: {
|
|
923
|
+
fontSize: 12,
|
|
924
|
+
backgroundColor: "#0f172a",
|
|
925
|
+
border: "1px solid #334155",
|
|
926
|
+
borderRadius: 8,
|
|
927
|
+
color: "#f1f5f9"
|
|
928
|
+
},
|
|
929
|
+
labelStyle: { color: "#f1f5f9" },
|
|
930
|
+
itemStyle: { color: "#e2e8f0" },
|
|
931
|
+
formatter: (ae) => f(ae)
|
|
932
|
+
}
|
|
933
|
+
),
|
|
934
|
+
Ne.length > 1 && /* @__PURE__ */ e(de, { wrapperStyle: { fontSize: 11 }, itemSorter: null }),
|
|
935
|
+
Ne.map((ae, we) => /* @__PURE__ */ e(
|
|
936
|
+
F,
|
|
937
|
+
{
|
|
938
|
+
className: u ? "cursor-pointer" : void 0,
|
|
939
|
+
onClick: (Le) => {
|
|
940
|
+
var Oe;
|
|
941
|
+
const Ce = (Oe = Le == null ? void 0 : Le.payload) == null ? void 0 : Oe[be];
|
|
942
|
+
Ce != null && le(String(Ce));
|
|
943
|
+
},
|
|
944
|
+
dataKey: ae.field,
|
|
945
|
+
name: ae.label ?? ae.field,
|
|
946
|
+
stackId: xe ? "stack" : void 0,
|
|
947
|
+
fill: ae.color ?? ue[we % ue.length],
|
|
948
|
+
radius: xe ? 0 : X ? [0, 3, 3, 0] : [3, 3, 0, 0],
|
|
949
|
+
children: Ne.length === 1 && !ae.color && ye.map((Le, Ce) => /* @__PURE__ */ e(j, { fill: ue[Ce % ue.length] }, Ce))
|
|
950
|
+
},
|
|
951
|
+
ae.field
|
|
952
|
+
))
|
|
953
|
+
]
|
|
954
|
+
}
|
|
955
|
+
) }) }),
|
|
956
|
+
V
|
|
957
|
+
] })
|
|
958
|
+
}
|
|
959
|
+
);
|
|
956
960
|
}
|
|
957
|
-
const
|
|
961
|
+
const Ml = ["gt", "gte", "lt", "lte", "eq"], ya = { gt: ">", gte: "≥", lt: "<", lte: "≤", eq: "=" }, Fl = ["sum", "avg", "max", "min"];
|
|
958
962
|
function Rl(t) {
|
|
959
963
|
var s, c, u;
|
|
960
964
|
const n = [
|
|
@@ -983,18 +987,18 @@ function Rl(t) {
|
|
|
983
987
|
}
|
|
984
988
|
return n;
|
|
985
989
|
}
|
|
986
|
-
function
|
|
990
|
+
function Ut(t, n) {
|
|
987
991
|
var h;
|
|
988
992
|
const a = /^(sum|avg|max|min|tile):(.+)$/.exec(t.field), s = a ? a[2] : t.field, c = ((h = n.find((g) => g.value === t.field || g.value === s)) == null ? void 0 : h.label) ?? s;
|
|
989
|
-
return `${a && a[1] !== "sum" && a[1] !== "tile" ? `${a[1]} ` : ""}${c} ${
|
|
993
|
+
return `${a && a[1] !== "sum" && a[1] !== "tile" ? `${a[1]} ` : ""}${c} ${ya[t.op] ?? t.op} ${t.value.toLocaleString()}`;
|
|
990
994
|
}
|
|
991
995
|
function Tl({ reportId: t, alert: n }) {
|
|
992
|
-
const a =
|
|
996
|
+
const a = Te(), s = nt(), { data: c = [] } = _e({
|
|
993
997
|
queryKey: ["nivaro-report-alert-log", t, n.id],
|
|
994
|
-
queryFn: () => a.request(
|
|
998
|
+
queryFn: () => a.request(Ra(t, n.id)).then((h) => h.data),
|
|
995
999
|
staleTime: 3e4
|
|
996
|
-
}), u =
|
|
997
|
-
mutationFn: () => a.request(
|
|
1000
|
+
}), u = Me({
|
|
1001
|
+
mutationFn: () => a.request(Ta(t, n.id)),
|
|
998
1002
|
onSuccess: () => {
|
|
999
1003
|
s.invalidateQueries({ queryKey: ["nivaro-report-alert-log", t, n.id] }), s.invalidateQueries({ queryKey: ["nivaro-report-alerts", t] });
|
|
1000
1004
|
}
|
|
@@ -1030,59 +1034,59 @@ function Ll({
|
|
|
1030
1034
|
widget: n,
|
|
1031
1035
|
filterBar: a
|
|
1032
1036
|
}) {
|
|
1033
|
-
const s =
|
|
1037
|
+
const s = Te(), c = nt(), [u, h] = S(!1), [g, p] = S(""), [K, L] = S([
|
|
1034
1038
|
{ field: "value", agg: "sum", op: "gt", value: "" }
|
|
1035
|
-
]), [y, Q] =
|
|
1039
|
+
]), [y, Q] = S([]), [m, N] = S(!1), [H, q] = S(null), Z = Rl(n), { data: E = [] } = _e({
|
|
1036
1040
|
queryKey: ["nivaro-report-alerts", t],
|
|
1037
|
-
queryFn: () => s.request(
|
|
1041
|
+
queryFn: () => s.request(qa(t)).then((f) => f.data),
|
|
1038
1042
|
enabled: u,
|
|
1039
1043
|
staleTime: 3e4
|
|
1040
|
-
}),
|
|
1041
|
-
const X =
|
|
1044
|
+
}), me = E.filter((f) => f.widget === n.id), J = () => void c.invalidateQueries({ queryKey: ["nivaro-report-alerts", t] }), W = () => K.filter((f) => f.value.trim() !== "" && !Number.isNaN(Number(f.value))).map((f) => {
|
|
1045
|
+
const X = Z.find((V) => V.value === f.field);
|
|
1042
1046
|
return { field: X != null && X.aggregatable && f.agg !== "sum" ? `${f.agg}:${f.field}` : f.field, op: f.op, value: Number(f.value) };
|
|
1043
|
-
}),
|
|
1047
|
+
}), ie = Me({
|
|
1044
1048
|
mutationFn: () => {
|
|
1045
|
-
const f = W(), X = f.map((
|
|
1049
|
+
const f = W(), X = f.map((le) => Ut(le, Z)).join(" & ");
|
|
1046
1050
|
return s.request(
|
|
1047
|
-
|
|
1051
|
+
Aa(t, {
|
|
1048
1052
|
widget: n.id,
|
|
1049
1053
|
name: g.trim() || X.slice(0, 120),
|
|
1050
1054
|
conditions: f,
|
|
1051
|
-
filters: y.filter((
|
|
1055
|
+
filters: y.filter((le) => le.values.length > 0),
|
|
1052
1056
|
delivery_email: m,
|
|
1053
1057
|
delivery_inapp: !0
|
|
1054
1058
|
})
|
|
1055
1059
|
);
|
|
1056
1060
|
},
|
|
1057
1061
|
onSuccess: () => {
|
|
1058
|
-
p(""),
|
|
1062
|
+
p(""), L([{ field: "value", agg: "sum", op: "gt", value: "" }]), Q([]), J();
|
|
1059
1063
|
}
|
|
1060
|
-
}),
|
|
1061
|
-
mutationFn: (f) => s.request(
|
|
1064
|
+
}), be = Me({
|
|
1065
|
+
mutationFn: (f) => s.request(Ma(t, f.id, !f.is_active)),
|
|
1062
1066
|
onSuccess: J
|
|
1063
|
-
}), Ne =
|
|
1067
|
+
}), Ne = Me({
|
|
1064
1068
|
mutationFn: (f) => s.request(Fa(t, f.id)),
|
|
1065
1069
|
onSuccess: J
|
|
1066
|
-
}),
|
|
1067
|
-
return /* @__PURE__ */ o(
|
|
1068
|
-
/* @__PURE__ */ e(
|
|
1070
|
+
}), ye = W().length > 0, qe = me.some((f) => f.firing);
|
|
1071
|
+
return /* @__PURE__ */ o(ca, { open: u, onOpenChange: h, children: [
|
|
1072
|
+
/* @__PURE__ */ e(ua, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1069
1073
|
"button",
|
|
1070
1074
|
{
|
|
1071
1075
|
type: "button",
|
|
1072
1076
|
title: "Alerts on this widget",
|
|
1073
1077
|
className: P(
|
|
1074
1078
|
"rounded p-0.5",
|
|
1075
|
-
|
|
1079
|
+
qe ? "text-amber-500" : "text-slate-300 hover:text-amber-500 dark:text-slate-600"
|
|
1076
1080
|
),
|
|
1077
1081
|
children: /* @__PURE__ */ e(Zt, { className: "h-3 w-3" })
|
|
1078
1082
|
}
|
|
1079
1083
|
) }),
|
|
1080
|
-
/* @__PURE__ */ o(
|
|
1084
|
+
/* @__PURE__ */ o(ma, { className: "w-[380px] p-3", align: "end", children: [
|
|
1081
1085
|
/* @__PURE__ */ o("p", { className: "mb-2 text-[12px] font-semibold text-slate-700 dark:text-slate-200", children: [
|
|
1082
1086
|
"Alerts · ",
|
|
1083
1087
|
n.title
|
|
1084
1088
|
] }),
|
|
1085
|
-
|
|
1089
|
+
me.length > 0 && /* @__PURE__ */ e("div", { className: "mb-2 space-y-1.5", children: me.map((f) => /* @__PURE__ */ o(
|
|
1086
1090
|
"div",
|
|
1087
1091
|
{
|
|
1088
1092
|
className: "rounded-md border border-slate-100 px-2 py-1.5 dark:border-border/60",
|
|
@@ -1103,7 +1107,7 @@ function Ll({
|
|
|
1103
1107
|
{
|
|
1104
1108
|
type: "button",
|
|
1105
1109
|
className: "text-[10.5px] text-slate-400 hover:text-slate-600",
|
|
1106
|
-
onClick: () =>
|
|
1110
|
+
onClick: () => q(H === f.id ? null : f.id),
|
|
1107
1111
|
children: "History"
|
|
1108
1112
|
}
|
|
1109
1113
|
),
|
|
@@ -1112,7 +1116,7 @@ function Ll({
|
|
|
1112
1116
|
{
|
|
1113
1117
|
type: "button",
|
|
1114
1118
|
className: "text-[10.5px] text-slate-400 hover:text-slate-600",
|
|
1115
|
-
onClick: () =>
|
|
1119
|
+
onClick: () => be.mutate(f),
|
|
1116
1120
|
children: f.is_active ? "Pause" : "Resume"
|
|
1117
1121
|
}
|
|
1118
1122
|
),
|
|
@@ -1122,19 +1126,19 @@ function Ll({
|
|
|
1122
1126
|
type: "button",
|
|
1123
1127
|
className: "text-slate-300 hover:text-red-500",
|
|
1124
1128
|
onClick: () => Ne.mutate(f),
|
|
1125
|
-
children: /* @__PURE__ */ e(
|
|
1129
|
+
children: /* @__PURE__ */ e(ja, { className: "h-3 w-3" })
|
|
1126
1130
|
}
|
|
1127
1131
|
)
|
|
1128
1132
|
] }),
|
|
1129
1133
|
/* @__PURE__ */ o("p", { className: "mt-0.5 truncate pl-3 text-[10.5px] text-slate-400", children: [
|
|
1130
|
-
(f.conditions ?? []).map((X) =>
|
|
1134
|
+
(f.conditions ?? []).map((X) => Ut(X, Z)).join(" & "),
|
|
1131
1135
|
f.filters && f.filters.length > 0 && ` · scoped: ${f.filters.map((X) => (X.labels ?? X.values).join("/")).join(", ")}`,
|
|
1132
1136
|
" · ",
|
|
1133
1137
|
f.delivery_email ? "In-app + Email" : "In-app",
|
|
1134
1138
|
" · Last fired: ",
|
|
1135
1139
|
f.last_fired ? new Date(f.last_fired).toLocaleString() : "Never"
|
|
1136
1140
|
] }),
|
|
1137
|
-
|
|
1141
|
+
H === f.id && /* @__PURE__ */ e(Tl, { reportId: t, alert: f })
|
|
1138
1142
|
]
|
|
1139
1143
|
},
|
|
1140
1144
|
f.id
|
|
@@ -1149,27 +1153,27 @@ function Ll({
|
|
|
1149
1153
|
className: "h-7 w-full rounded-md border border-slate-200 bg-white px-2 text-[11.5px] dark:border-border dark:bg-card"
|
|
1150
1154
|
}
|
|
1151
1155
|
),
|
|
1152
|
-
|
|
1153
|
-
const
|
|
1156
|
+
K.map((f, X) => {
|
|
1157
|
+
const le = Z.find((V) => V.value === f.field);
|
|
1154
1158
|
return /* @__PURE__ */ o("div", { className: "flex items-center gap-1", children: [
|
|
1155
1159
|
/* @__PURE__ */ e(
|
|
1156
1160
|
$t,
|
|
1157
1161
|
{
|
|
1158
1162
|
value: f.field,
|
|
1159
|
-
onChange: (
|
|
1160
|
-
options:
|
|
1163
|
+
onChange: (V) => L((xe) => xe.map((se, re) => re === X ? { ...se, field: V } : se)),
|
|
1164
|
+
options: Z.map((V) => ({ value: V.value, label: V.label })),
|
|
1161
1165
|
ariaLabel: "Alert metric field",
|
|
1162
1166
|
className: "h-7 min-w-0 flex-1 rounded-md px-1.5 py-0 text-[11.5px] dark:border-border dark:bg-card"
|
|
1163
1167
|
}
|
|
1164
1168
|
),
|
|
1165
|
-
(
|
|
1169
|
+
(le == null ? void 0 : le.aggregatable) && /* @__PURE__ */ e(
|
|
1166
1170
|
$t,
|
|
1167
1171
|
{
|
|
1168
1172
|
value: f.agg,
|
|
1169
|
-
onChange: (
|
|
1170
|
-
(
|
|
1173
|
+
onChange: (V) => L(
|
|
1174
|
+
(xe) => xe.map((se, re) => re === X ? { ...se, agg: V } : se)
|
|
1171
1175
|
),
|
|
1172
|
-
options:
|
|
1176
|
+
options: Fl.map((V) => ({ value: V, label: V })),
|
|
1173
1177
|
ariaLabel: "Aggregate",
|
|
1174
1178
|
className: "h-7 w-[62px] rounded-md px-1.5 py-0 text-[11.5px] dark:border-border dark:bg-card"
|
|
1175
1179
|
}
|
|
@@ -1178,10 +1182,10 @@ function Ll({
|
|
|
1178
1182
|
$t,
|
|
1179
1183
|
{
|
|
1180
1184
|
value: f.op,
|
|
1181
|
-
onChange: (
|
|
1182
|
-
(
|
|
1185
|
+
onChange: (V) => L(
|
|
1186
|
+
(xe) => xe.map((se, re) => re === X ? { ...se, op: V } : se)
|
|
1183
1187
|
),
|
|
1184
|
-
options:
|
|
1188
|
+
options: Ml.map((V) => ({ value: V, label: ya[V] })),
|
|
1185
1189
|
ariaLabel: "Operator",
|
|
1186
1190
|
className: "h-7 w-[52px] rounded-md px-1.5 py-0 text-[11.5px] dark:border-border dark:bg-card"
|
|
1187
1191
|
}
|
|
@@ -1190,21 +1194,21 @@ function Ll({
|
|
|
1190
1194
|
"input",
|
|
1191
1195
|
{
|
|
1192
1196
|
value: f.value,
|
|
1193
|
-
onChange: (
|
|
1194
|
-
(
|
|
1197
|
+
onChange: (V) => L(
|
|
1198
|
+
(xe) => xe.map((se, re) => re === X ? { ...se, value: V.target.value } : se)
|
|
1195
1199
|
),
|
|
1196
1200
|
placeholder: "0",
|
|
1197
1201
|
inputMode: "decimal",
|
|
1198
1202
|
className: "h-7 w-[64px] rounded-md border border-slate-200 bg-white px-2 text-right text-[11.5px] tabular-nums dark:border-border dark:bg-card"
|
|
1199
1203
|
}
|
|
1200
1204
|
),
|
|
1201
|
-
|
|
1205
|
+
K.length > 1 && /* @__PURE__ */ e(
|
|
1202
1206
|
"button",
|
|
1203
1207
|
{
|
|
1204
1208
|
type: "button",
|
|
1205
1209
|
className: "text-slate-300 hover:text-red-500",
|
|
1206
|
-
onClick: () =>
|
|
1207
|
-
children: /* @__PURE__ */ e(
|
|
1210
|
+
onClick: () => L((V) => V.filter((xe, se) => se !== X)),
|
|
1211
|
+
children: /* @__PURE__ */ e(Re, { className: "h-3 w-3" })
|
|
1208
1212
|
}
|
|
1209
1213
|
)
|
|
1210
1214
|
] }, X);
|
|
@@ -1214,7 +1218,7 @@ function Ll({
|
|
|
1214
1218
|
{
|
|
1215
1219
|
type: "button",
|
|
1216
1220
|
className: "text-[10.5px] text-slate-400 hover:text-nvr-navy dark:hover:text-nvr-cyan",
|
|
1217
|
-
onClick: () =>
|
|
1221
|
+
onClick: () => L((f) => [...f, { field: "value", agg: "sum", op: "gt", value: "" }]),
|
|
1218
1222
|
children: "+ condition (all must match)"
|
|
1219
1223
|
}
|
|
1220
1224
|
),
|
|
@@ -1223,16 +1227,16 @@ function Ll({
|
|
|
1223
1227
|
/* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1", children: a.map((f) => {
|
|
1224
1228
|
var X;
|
|
1225
1229
|
return /* @__PURE__ */ e(
|
|
1226
|
-
|
|
1230
|
+
pa,
|
|
1227
1231
|
{
|
|
1228
1232
|
reportId: t,
|
|
1229
1233
|
field: f.field,
|
|
1230
1234
|
label: f.label,
|
|
1231
1235
|
optionSource: f.options,
|
|
1232
|
-
selected: ((X = y.find((
|
|
1233
|
-
onChange: (
|
|
1234
|
-
...
|
|
1235
|
-
...
|
|
1236
|
+
selected: ((X = y.find((le) => le.field === f.field)) == null ? void 0 : X.values) ?? [],
|
|
1237
|
+
onChange: (le, V) => Q((xe) => [
|
|
1238
|
+
...xe.filter((se) => se.field !== f.field),
|
|
1239
|
+
...le.length > 0 ? [{ field: f.field, values: le, labels: V }] : []
|
|
1236
1240
|
])
|
|
1237
1241
|
},
|
|
1238
1242
|
f.field
|
|
@@ -1246,7 +1250,7 @@ function Ll({
|
|
|
1246
1250
|
{
|
|
1247
1251
|
type: "checkbox",
|
|
1248
1252
|
checked: m,
|
|
1249
|
-
onChange: (f) =>
|
|
1253
|
+
onChange: (f) => N(f.target.checked),
|
|
1250
1254
|
className: "h-3 w-3 accent-nvr-cyan"
|
|
1251
1255
|
}
|
|
1252
1256
|
),
|
|
@@ -1256,8 +1260,8 @@ function Ll({
|
|
|
1256
1260
|
"button",
|
|
1257
1261
|
{
|
|
1258
1262
|
type: "button",
|
|
1259
|
-
disabled: !
|
|
1260
|
-
onClick: () =>
|
|
1263
|
+
disabled: !ye || ie.isPending,
|
|
1264
|
+
onClick: () => ie.mutate(),
|
|
1261
1265
|
className: "inline-flex h-7 items-center gap-1 rounded-md bg-nvr-cyan px-2 text-[11.5px] font-semibold text-white disabled:opacity-50",
|
|
1262
1266
|
children: [
|
|
1263
1267
|
/* @__PURE__ */ e(Xt, { className: "h-3 w-3" }),
|
|
@@ -1284,17 +1288,17 @@ const Ol = {
|
|
|
1284
1288
|
nnull: "_nnull"
|
|
1285
1289
|
};
|
|
1286
1290
|
function Tt(t, n, a, s) {
|
|
1287
|
-
var
|
|
1291
|
+
var K, L;
|
|
1288
1292
|
const c = t.config ?? {}, u = [];
|
|
1289
1293
|
for (const y of c.filters ?? []) {
|
|
1290
1294
|
const Q = Ol[y.op];
|
|
1291
1295
|
if (!Q) continue;
|
|
1292
1296
|
let m = y.value;
|
|
1293
|
-
y.op === "in" && typeof m == "string" && (m = m.split(",").map((
|
|
1297
|
+
y.op === "in" && typeof m == "string" && (m = m.split(",").map((N) => N.trim())), u.push({ path: [y.field], op: Q, value: m });
|
|
1294
1298
|
}
|
|
1295
1299
|
for (const y of n)
|
|
1296
|
-
(
|
|
1297
|
-
const h = c.date_field || ((
|
|
1300
|
+
(K = y.values) != null && K.length && u.push({ path: [y.field], op: "_in", value: y.values });
|
|
1301
|
+
const h = c.date_field || ((L = c.dimension) != null && L.bucket ? c.dimension.field : null), g = ha(a);
|
|
1298
1302
|
g && h && (u.push({ path: [h], op: "_gte", value: g.start }), u.push({ path: [h], op: "_lte", value: `${g.end}T23:59:59` }));
|
|
1299
1303
|
const p = c.dimension;
|
|
1300
1304
|
if (s !== void 0 && (p != null && p.field))
|
|
@@ -1303,17 +1307,17 @@ function Tt(t, n, a, s) {
|
|
|
1303
1307
|
if (/^\d{4}-\d{2}-\d{2}$/.test(y))
|
|
1304
1308
|
u.push({ path: [p.field], op: "_gte", value: y }), u.push({ path: [p.field], op: "_lte", value: `${y}T23:59:59` });
|
|
1305
1309
|
else if (/^\d{4}-\d{2}$/.test(y)) {
|
|
1306
|
-
const [Q, m] = y.split("-").map(Number),
|
|
1310
|
+
const [Q, m] = y.split("-").map(Number), N = new Date(Q, m, 0).getDate();
|
|
1307
1311
|
u.push({ path: [p.field], op: "_gte", value: `${y}-01` }), u.push({
|
|
1308
1312
|
path: [p.field],
|
|
1309
1313
|
op: "_lte",
|
|
1310
|
-
value: `${y}-${String(
|
|
1314
|
+
value: `${y}-${String(N).padStart(2, "0")}T23:59:59`
|
|
1311
1315
|
});
|
|
1312
1316
|
}
|
|
1313
1317
|
} else s === null ? u.push({ path: [p.field], op: "_null", value: !0 }) : u.push({ path: [p.field], op: "_eq", value: s });
|
|
1314
1318
|
return u;
|
|
1315
1319
|
}
|
|
1316
|
-
function
|
|
1320
|
+
function Jt(t) {
|
|
1317
1321
|
const n = t.config ?? {}, a = [], s = n.query;
|
|
1318
1322
|
if (t.type === "query" && (s != null && s.slug))
|
|
1319
1323
|
a.push(`Custom query: ${s.slug}`);
|
|
@@ -1334,10 +1338,10 @@ function Kl(t) {
|
|
|
1334
1338
|
var n, a;
|
|
1335
1339
|
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;
|
|
1336
1340
|
}
|
|
1337
|
-
function
|
|
1338
|
-
var
|
|
1341
|
+
function Vt(t, n, a) {
|
|
1342
|
+
var L, y, Q;
|
|
1339
1343
|
const s = a ? [...a] : [];
|
|
1340
|
-
if (s.length === 0 && ((
|
|
1344
|
+
if (s.length === 0 && ((L = n == null ? void 0 : n.rows) != null && L.length) && s.push(...n.rows), s.length === 0 && ((y = n == null ? void 0 : n.series) != null && y.length))
|
|
1341
1345
|
for (const m of n.series)
|
|
1342
1346
|
s.push({
|
|
1343
1347
|
dim: m.dim,
|
|
@@ -1354,15 +1358,15 @@ function Yt(t, n, a) {
|
|
|
1354
1358
|
return;
|
|
1355
1359
|
}
|
|
1356
1360
|
const c = [...new Set(s.flatMap((m) => Object.keys(m)))], u = (m) => {
|
|
1357
|
-
const
|
|
1358
|
-
return /[",\n]/.test(
|
|
1359
|
-
}, h = [c.join(","), ...s.map((m) => c.map((
|
|
1361
|
+
const N = String(m ?? "");
|
|
1362
|
+
return /[",\n]/.test(N) ? `"${N.replace(/"/g, '""')}"` : N;
|
|
1363
|
+
}, h = [c.join(","), ...s.map((m) => c.map((N) => u(m[N])).join(","))].join(
|
|
1360
1364
|
`
|
|
1361
1365
|
`
|
|
1362
1366
|
), g = new Blob([h], { type: "text/csv;charset=utf-8" }), p = document.createElement("a");
|
|
1363
1367
|
p.href = URL.createObjectURL(g), p.download = `${(t.title || "widget").replace(/[^\w-]+/g, "_")}.csv`, p.click();
|
|
1364
|
-
const
|
|
1365
|
-
setTimeout(() => URL.revokeObjectURL(
|
|
1368
|
+
const K = p.href;
|
|
1369
|
+
setTimeout(() => URL.revokeObjectURL(K), 1e4);
|
|
1366
1370
|
}
|
|
1367
1371
|
function Dl({
|
|
1368
1372
|
collection: t,
|
|
@@ -1372,14 +1376,14 @@ function Dl({
|
|
|
1372
1376
|
onOpen: c,
|
|
1373
1377
|
crossFilter: u
|
|
1374
1378
|
}) {
|
|
1375
|
-
const h =
|
|
1379
|
+
const h = Te(), { data: g, isLoading: p } = _e({
|
|
1376
1380
|
queryKey: ["nvr-report-drill", t, JSON.stringify(n)],
|
|
1377
1381
|
queryFn: () => h.request(
|
|
1378
1382
|
bt(`/items/${t}`, { limit: 50, conditions: JSON.stringify(n) })
|
|
1379
1383
|
),
|
|
1380
1384
|
staleTime: 3e4,
|
|
1381
1385
|
retry: !1
|
|
1382
|
-
}),
|
|
1386
|
+
}), K = (g == null ? void 0 : g.data) ?? [], L = (y) => {
|
|
1383
1387
|
for (const m of [
|
|
1384
1388
|
"title",
|
|
1385
1389
|
"name",
|
|
@@ -1389,11 +1393,11 @@ function Dl({
|
|
|
1389
1393
|
"project_id",
|
|
1390
1394
|
"description"
|
|
1391
1395
|
]) {
|
|
1392
|
-
const
|
|
1393
|
-
if (typeof
|
|
1396
|
+
const N = y[m];
|
|
1397
|
+
if (typeof N == "string" && N.trim()) return N.slice(0, 90);
|
|
1394
1398
|
}
|
|
1395
1399
|
const Q = Object.entries(y).find(
|
|
1396
|
-
([m,
|
|
1400
|
+
([m, N]) => m !== "id" && typeof N == "string" && N.trim()
|
|
1397
1401
|
);
|
|
1398
1402
|
return Q ? String(Q[1]).slice(0, 90) : `#${y.id}`;
|
|
1399
1403
|
};
|
|
@@ -1410,7 +1414,7 @@ function Dl({
|
|
|
1410
1414
|
children: [
|
|
1411
1415
|
/* @__PURE__ */ o("div", { className: "flex items-center gap-2 border-b border-slate-100 px-4 py-2.5 dark:border-border", children: [
|
|
1412
1416
|
/* @__PURE__ */ e("p", { className: "min-w-0 flex-1 truncate text-[13px] font-semibold text-slate-800 dark:text-slate-100", children: a }),
|
|
1413
|
-
/* @__PURE__ */ e("span", { className: "text-[11.5px] tabular-nums text-slate-400", children: g ? `${
|
|
1417
|
+
/* @__PURE__ */ e("span", { className: "text-[11.5px] tabular-nums text-slate-400", children: g ? `${K.length}${(g.total ?? 0) > K.length ? ` of ${g.total.toLocaleString()}` : ""} records` : "" }),
|
|
1414
1418
|
u && /* @__PURE__ */ e(
|
|
1415
1419
|
"button",
|
|
1416
1420
|
{
|
|
@@ -1427,20 +1431,20 @@ function Dl({
|
|
|
1427
1431
|
type: "button",
|
|
1428
1432
|
onClick: s,
|
|
1429
1433
|
className: "rounded p-1 text-slate-400 hover:text-slate-600",
|
|
1430
|
-
children: /* @__PURE__ */ e(
|
|
1434
|
+
children: /* @__PURE__ */ e(Re, { className: "h-4 w-4" })
|
|
1431
1435
|
}
|
|
1432
1436
|
)
|
|
1433
1437
|
] }),
|
|
1434
1438
|
/* @__PURE__ */ o("div", { className: "min-h-0 flex-1 overflow-y-auto p-1.5", children: [
|
|
1435
1439
|
p && /* @__PURE__ */ e("p", { className: "px-2.5 py-3 text-[12px] text-slate-400", children: "Loading…" }),
|
|
1436
|
-
!p &&
|
|
1437
|
-
|
|
1440
|
+
!p && K.length === 0 && /* @__PURE__ */ e("p", { className: "px-2.5 py-3 text-[12px] text-slate-400", children: "No records match." }),
|
|
1441
|
+
K.map((y) => /* @__PURE__ */ e(
|
|
1438
1442
|
"button",
|
|
1439
1443
|
{
|
|
1440
1444
|
type: "button",
|
|
1441
1445
|
onClick: () => c({ collection: t, itemId: String(y.id) }),
|
|
1442
1446
|
className: "block w-full truncate rounded-md px-2.5 py-1.5 text-left text-[12.5px] text-slate-700 hover:bg-slate-50 dark:text-slate-200 dark:hover:bg-muted",
|
|
1443
|
-
children:
|
|
1447
|
+
children: L(y)
|
|
1444
1448
|
},
|
|
1445
1449
|
String(y.id)
|
|
1446
1450
|
))
|
|
@@ -1451,7 +1455,7 @@ function Dl({
|
|
|
1451
1455
|
}
|
|
1452
1456
|
);
|
|
1453
1457
|
}
|
|
1454
|
-
const
|
|
1458
|
+
const Yt = {
|
|
1455
1459
|
red: {
|
|
1456
1460
|
cell: "bg-red-50 text-red-700 dark:bg-red-500/15 dark:text-red-300",
|
|
1457
1461
|
row: "bg-red-50/70 dark:bg-red-500/10"
|
|
@@ -1482,56 +1486,56 @@ const Dt = Wa(function({
|
|
|
1482
1486
|
filterBar: h = [],
|
|
1483
1487
|
onDrill: g,
|
|
1484
1488
|
snapshot: p,
|
|
1485
|
-
asOf:
|
|
1486
|
-
annotations:
|
|
1489
|
+
asOf: K,
|
|
1490
|
+
annotations: L,
|
|
1487
1491
|
onAddAnnotation: y,
|
|
1488
1492
|
onDeleteAnnotation: Q,
|
|
1489
1493
|
onCrossFilter: m,
|
|
1490
|
-
reportUrl:
|
|
1491
|
-
currentFilters:
|
|
1494
|
+
reportUrl: N,
|
|
1495
|
+
currentFilters: H
|
|
1492
1496
|
}) {
|
|
1493
|
-
var yt,
|
|
1494
|
-
const
|
|
1495
|
-
|
|
1497
|
+
var yt, Ye, kt, Ge, Nt, wt, ct, St, He, ut, Xe, mt, pt, ht, oe, _t, Ze, Ie, ft, xt;
|
|
1498
|
+
const q = Te(), [Z, E] = S(""), [me, J] = S(0), [W, ie] = S(null), [be, Ne] = S(!1), [ye, qe] = S(""), [f, X] = S(""), [le, V] = S(!1), [xe, se] = S(!1), [re, k] = S([]), F = at(null), Y = at(null), j = Cl(F), [de, pe] = S(!1), [ke, w] = S(null), [I, ae] = S(!1), [we, Le] = S(null), Ce = ["bar", "line", "donut", "pareto", "area"].includes(a.type) || a.type === "kpi" && !!((yt = a.config) != null && yt.compare || (Ye = a.config) != null && Ye.sparkline), Oe = nt(), [ge, Be] = S(!1), Se = async () => {
|
|
1499
|
+
Be(!0);
|
|
1496
1500
|
try {
|
|
1497
|
-
const l = await
|
|
1501
|
+
const l = await q.request(
|
|
1498
1502
|
Ct(n, a.id, {
|
|
1499
1503
|
date_range: s,
|
|
1500
1504
|
entity_filters: c,
|
|
1501
1505
|
fresh: 1
|
|
1502
1506
|
})
|
|
1503
1507
|
);
|
|
1504
|
-
|
|
1508
|
+
Oe.setQueryData(
|
|
1505
1509
|
["nivaro-report-widget", n, a.id, s, c],
|
|
1506
1510
|
l.data
|
|
1507
1511
|
);
|
|
1508
1512
|
} catch {
|
|
1509
1513
|
}
|
|
1510
|
-
|
|
1511
|
-
},
|
|
1514
|
+
Be(!1);
|
|
1515
|
+
}, Fe = lt(
|
|
1512
1516
|
() => ({ date_range: s ?? null, entity_filters: c }),
|
|
1513
1517
|
[s, c]
|
|
1514
|
-
),
|
|
1518
|
+
), st = Xa({
|
|
1515
1519
|
kind: "report",
|
|
1516
1520
|
widget: a.id,
|
|
1517
1521
|
report: n,
|
|
1518
|
-
params:
|
|
1519
|
-
enabled:
|
|
1520
|
-
onData: (l) =>
|
|
1522
|
+
params: Fe,
|
|
1523
|
+
enabled: j && a.type !== "divider" && a.type !== "query",
|
|
1524
|
+
onData: (l) => Oe.setQueryData(
|
|
1521
1525
|
["nivaro-report-widget", n, a.id, s, c],
|
|
1522
1526
|
l
|
|
1523
1527
|
),
|
|
1524
|
-
onStale: () => void
|
|
1528
|
+
onStale: () => void it()
|
|
1525
1529
|
}), {
|
|
1526
|
-
data:
|
|
1527
|
-
isLoading:
|
|
1528
|
-
error:
|
|
1529
|
-
refetch:
|
|
1530
|
-
isFetching:
|
|
1531
|
-
dataUpdatedAt:
|
|
1532
|
-
} =
|
|
1530
|
+
data: Qe,
|
|
1531
|
+
isLoading: ot,
|
|
1532
|
+
error: Ue,
|
|
1533
|
+
refetch: it,
|
|
1534
|
+
isFetching: Ft,
|
|
1535
|
+
dataUpdatedAt: Ke
|
|
1536
|
+
} = _e({
|
|
1533
1537
|
queryKey: ["nivaro-report-widget", n, a.id, s, c],
|
|
1534
|
-
queryFn: () =>
|
|
1538
|
+
queryFn: () => q.request(
|
|
1535
1539
|
Ct(n, a.id, {
|
|
1536
1540
|
date_range: s,
|
|
1537
1541
|
entity_filters: c
|
|
@@ -1540,60 +1544,60 @@ const Dt = Wa(function({
|
|
|
1540
1544
|
// Query widgets resolve client-side in QueryWidgetBody — but when a
|
|
1541
1545
|
// snapshot comparison is active, the server-resolved value (the same
|
|
1542
1546
|
// number the snapshot stored) is fetched so the delta badge can render.
|
|
1543
|
-
enabled:
|
|
1547
|
+
enabled: j && a.type !== "divider" && (a.type !== "query" || !!p),
|
|
1544
1548
|
staleTime: 6e4,
|
|
1545
1549
|
// Per-widget auto-refresh (#168) overrides the report-level interval.
|
|
1546
1550
|
refetchInterval: Za(
|
|
1547
|
-
|
|
1551
|
+
st,
|
|
1548
1552
|
Number((kt = a.config) == null ? void 0 : kt.refresh_secs) >= 10 ? Number(a.config.refresh_secs) * 1e3 : u
|
|
1549
1553
|
),
|
|
1550
1554
|
retry: !1
|
|
1551
|
-
}),
|
|
1555
|
+
}), Je = (((Ge = a.config) == null ? void 0 : Ge.drill_levels) ?? []).filter(
|
|
1552
1556
|
(l) => typeof l == "string" && l
|
|
1553
|
-
), { data: vt } =
|
|
1554
|
-
queryKey: ["nvr-report-drill", n, a.id,
|
|
1555
|
-
queryFn: () =>
|
|
1557
|
+
), { data: vt } = _e({
|
|
1558
|
+
queryKey: ["nvr-report-drill", n, a.id, re, s, c],
|
|
1559
|
+
queryFn: () => q.request(
|
|
1556
1560
|
Ct(n, a.id, {
|
|
1557
1561
|
date_range: s,
|
|
1558
1562
|
entity_filters: [
|
|
1559
1563
|
...c,
|
|
1560
|
-
...
|
|
1564
|
+
...re.map((l) => ({ field: l.field, values: [l.value] }))
|
|
1561
1565
|
],
|
|
1562
|
-
dimension_override:
|
|
1566
|
+
dimension_override: Je[re.length - 1]
|
|
1563
1567
|
})
|
|
1564
1568
|
).then((l) => l.data),
|
|
1565
|
-
enabled:
|
|
1569
|
+
enabled: re.length > 0 && Je.length > 0,
|
|
1566
1570
|
staleTime: 6e4,
|
|
1567
1571
|
retry: !1
|
|
1568
|
-
}),
|
|
1572
|
+
}), R = re.length > 0 && vt ? vt : Qe, ce = (Nt = a.config) == null ? void 0 : Nt.format, dt = {
|
|
1569
1573
|
gridColumn: `${Math.max(1, (a.x ?? 0) + 1)} / span ${Math.min(12, Math.max(2, a.w || 4))}`,
|
|
1570
1574
|
gridRow: `span ${Math.max(1, a.h || 3)}`
|
|
1571
1575
|
};
|
|
1572
1576
|
if (a.type === "divider")
|
|
1573
|
-
return /* @__PURE__ */ e("div", { style:
|
|
1574
|
-
const
|
|
1575
|
-
...
|
|
1576
|
-
slug:
|
|
1577
|
+
return /* @__PURE__ */ e("div", { style: dt, className: "self-end border-b border-slate-200 pb-1 dark:border-border", children: /* @__PURE__ */ e("h3", { className: "text-[13px] font-semibold text-slate-700 dark:text-slate-200", children: a.title }) });
|
|
1578
|
+
const Ve = a.type === "query" ? (wt = a.config) == null ? void 0 : wt.query : null, ve = Ve ? {
|
|
1579
|
+
...Ve,
|
|
1580
|
+
slug: Ve.slug || Ve.query_slug || ""
|
|
1577
1581
|
} : null;
|
|
1578
|
-
let
|
|
1579
|
-
if (
|
|
1580
|
-
|
|
1582
|
+
let G = null;
|
|
1583
|
+
if (ve != null && ve.slug)
|
|
1584
|
+
G = /* @__PURE__ */ e(
|
|
1581
1585
|
Al,
|
|
1582
1586
|
{
|
|
1583
|
-
cfg:
|
|
1587
|
+
cfg: ve,
|
|
1584
1588
|
dateRange: s,
|
|
1585
1589
|
entityFilters: c,
|
|
1586
1590
|
refetchInterval: u,
|
|
1587
1591
|
onDrill: g,
|
|
1588
|
-
deferred: !
|
|
1592
|
+
deferred: !j
|
|
1589
1593
|
}
|
|
1590
1594
|
);
|
|
1591
1595
|
else if (a.type === "query")
|
|
1592
|
-
|
|
1593
|
-
else if (!
|
|
1594
|
-
|
|
1595
|
-
else if (
|
|
1596
|
-
|
|
1596
|
+
G = /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No query configured." });
|
|
1597
|
+
else if (!j && R === void 0)
|
|
1598
|
+
G = /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-300", children: "Loading…" });
|
|
1599
|
+
else if (ot)
|
|
1600
|
+
G = /* @__PURE__ */ o("div", { className: "flex flex-col gap-2 px-1", children: [
|
|
1597
1601
|
/* @__PURE__ */ e("p", { className: "text-[12px] text-slate-300", children: "Loading…" }),
|
|
1598
1602
|
/* @__PURE__ */ e(
|
|
1599
1603
|
oa,
|
|
@@ -1610,39 +1614,39 @@ const Dt = Wa(function({
|
|
|
1610
1614
|
}
|
|
1611
1615
|
)
|
|
1612
1616
|
] });
|
|
1613
|
-
else if (
|
|
1614
|
-
|
|
1615
|
-
|
|
1617
|
+
else if (Ue)
|
|
1618
|
+
G = /* @__PURE__ */ e(
|
|
1619
|
+
da,
|
|
1616
1620
|
{
|
|
1617
1621
|
className: "px-1",
|
|
1618
|
-
message: ra(
|
|
1619
|
-
onRetry: () => void
|
|
1622
|
+
message: ra(Ue) ?? Ot(Ue, "this widget"),
|
|
1623
|
+
onRetry: () => void it()
|
|
1620
1624
|
}
|
|
1621
1625
|
);
|
|
1622
|
-
else if (
|
|
1626
|
+
else if (R)
|
|
1623
1627
|
if (a.type === "queue") {
|
|
1624
|
-
const l =
|
|
1625
|
-
(
|
|
1628
|
+
const l = R.series ?? [], i = Math.max(...l.map((T) => T.value), 1), b = Math.min(...l.map((T) => T.value), 0), _ = Math.max(i - b, 1), $ = l.map(
|
|
1629
|
+
(T, ne) => `${ne / Math.max(1, l.length - 1) * 100},${28 - (T.value - b) / _ * 26}`
|
|
1626
1630
|
).join(" ");
|
|
1627
|
-
|
|
1628
|
-
/* @__PURE__ */ e("p", { className: "text-[28px] font-semibold leading-none tracking-tight tabular-nums text-slate-900 dark:text-foreground", children:
|
|
1631
|
+
G = /* @__PURE__ */ o("div", { className: "flex min-h-0 flex-1 flex-col justify-center", children: [
|
|
1632
|
+
/* @__PURE__ */ e("p", { className: "text-[28px] font-semibold leading-none tracking-tight tabular-nums text-slate-900 dark:text-foreground", children: R.value == null ? "—" : Number(R.value).toLocaleString() }),
|
|
1629
1633
|
l.length >= 3 && /* @__PURE__ */ e("svg", { viewBox: "0 0 100 30", preserveAspectRatio: "none", className: "mt-1.5 h-7 w-full", children: /* @__PURE__ */ e(
|
|
1630
1634
|
"polyline",
|
|
1631
1635
|
{
|
|
1632
1636
|
points: $,
|
|
1633
1637
|
fill: "none",
|
|
1634
|
-
stroke:
|
|
1638
|
+
stroke: et,
|
|
1635
1639
|
strokeWidth: "2",
|
|
1636
1640
|
vectorEffect: "non-scaling-stroke"
|
|
1637
1641
|
}
|
|
1638
1642
|
) }),
|
|
1639
1643
|
/* @__PURE__ */ o("p", { className: "mt-0.5 text-[10.5px] text-slate-400", children: [
|
|
1640
|
-
((
|
|
1644
|
+
((ct = a.config) == null ? void 0 : ct.metric) ?? "total",
|
|
1641
1645
|
" · daily snapshots"
|
|
1642
1646
|
] })
|
|
1643
1647
|
] });
|
|
1644
1648
|
} else if (a.type === "kpi" || a.type === "calc") {
|
|
1645
|
-
if (
|
|
1649
|
+
if (G = /* @__PURE__ */ o("div", { className: "flex items-baseline gap-2", children: [
|
|
1646
1650
|
/* @__PURE__ */ e(
|
|
1647
1651
|
"p",
|
|
1648
1652
|
{
|
|
@@ -1653,32 +1657,32 @@ const Dt = Wa(function({
|
|
|
1653
1657
|
(() => {
|
|
1654
1658
|
var b;
|
|
1655
1659
|
const l = (b = a.config) == null ? void 0 : b.thresholds;
|
|
1656
|
-
if (!(l != null && l.length) ||
|
|
1657
|
-
const i = [...l].filter((
|
|
1660
|
+
if (!(l != null && l.length) || R.value == null) return null;
|
|
1661
|
+
const i = [...l].filter((_) => Number.isFinite(_.gte)).sort((_, $) => $.gte - _.gte).find((_) => R.value >= _.gte);
|
|
1658
1662
|
return (i == null ? void 0 : i.color) === "red" ? "!text-red-600 dark:!text-red-400" : (i == null ? void 0 : i.color) === "amber" ? "!text-amber-600 dark:!text-amber-400" : (i == null ? void 0 : i.color) === "green" ? "!text-emerald-600 dark:!text-emerald-400" : null;
|
|
1659
1663
|
})()
|
|
1660
1664
|
),
|
|
1661
1665
|
title: a.collection ? "See the records behind this number" : void 0,
|
|
1662
1666
|
onClick: () => {
|
|
1663
|
-
a.collection &&
|
|
1667
|
+
a.collection && ie({
|
|
1664
1668
|
conditions: Tt(a, c, s),
|
|
1665
1669
|
title: a.title || a.collection
|
|
1666
1670
|
});
|
|
1667
1671
|
},
|
|
1668
|
-
children:
|
|
1672
|
+
children: Ae(R.value, ce)
|
|
1669
1673
|
}
|
|
1670
1674
|
),
|
|
1671
|
-
/* @__PURE__ */ e(Qt, { pct:
|
|
1672
|
-
] }),
|
|
1673
|
-
const l =
|
|
1674
|
-
|
|
1675
|
-
|
|
1675
|
+
/* @__PURE__ */ e(Qt, { pct: R.change_pct })
|
|
1676
|
+
] }), R.spark && R.spark.length >= 3) {
|
|
1677
|
+
const l = R.spark, i = Math.max(...l.map((T) => T.value), 1), b = Math.min(...l.map((T) => T.value), 0), _ = Math.max(i - b, 1), $ = l.map((T, ne) => `${ne / (l.length - 1) * 100},${28 - (T.value - b) / _ * 26}`).join(" ");
|
|
1678
|
+
G = /* @__PURE__ */ o("div", { className: "flex min-h-0 flex-1 flex-col justify-center", children: [
|
|
1679
|
+
G,
|
|
1676
1680
|
/* @__PURE__ */ e("svg", { viewBox: "0 0 100 30", preserveAspectRatio: "none", className: "mt-1.5 h-7 w-full", children: /* @__PURE__ */ e(
|
|
1677
1681
|
"polyline",
|
|
1678
1682
|
{
|
|
1679
1683
|
points: $,
|
|
1680
1684
|
fill: "none",
|
|
1681
|
-
stroke:
|
|
1685
|
+
stroke: et,
|
|
1682
1686
|
strokeWidth: "2",
|
|
1683
1687
|
vectorEffect: "non-scaling-stroke"
|
|
1684
1688
|
}
|
|
@@ -1686,8 +1690,8 @@ const Dt = Wa(function({
|
|
|
1686
1690
|
] });
|
|
1687
1691
|
}
|
|
1688
1692
|
} else if (a.type === "kpi_group") {
|
|
1689
|
-
const l =
|
|
1690
|
-
|
|
1693
|
+
const l = R.tiles ?? [];
|
|
1694
|
+
G = /* @__PURE__ */ e(
|
|
1691
1695
|
"div",
|
|
1692
1696
|
{
|
|
1693
1697
|
className: "grid gap-2",
|
|
@@ -1697,13 +1701,13 @@ const Dt = Wa(function({
|
|
|
1697
1701
|
{
|
|
1698
1702
|
className: "flex flex-col justify-center rounded-md border border-slate-100 px-3 py-2 dark:border-border/60",
|
|
1699
1703
|
style: {
|
|
1700
|
-
borderTopColor: i.color ??
|
|
1704
|
+
borderTopColor: i.color ?? ue[b % ue.length],
|
|
1701
1705
|
borderTopWidth: 2
|
|
1702
1706
|
},
|
|
1703
1707
|
children: [
|
|
1704
1708
|
/* @__PURE__ */ e("p", { className: "truncate text-[10.5px] uppercase tracking-wide text-slate-400", children: i.label }),
|
|
1705
1709
|
/* @__PURE__ */ o("div", { className: "flex items-baseline gap-1.5", children: [
|
|
1706
|
-
/* @__PURE__ */ e("p", { className: "text-[19px] font-semibold leading-tight text-slate-900 dark:text-foreground", children:
|
|
1710
|
+
/* @__PURE__ */ e("p", { className: "text-[19px] font-semibold leading-tight text-slate-900 dark:text-foreground", children: Ae(i.value, i.format) }),
|
|
1707
1711
|
/* @__PURE__ */ e(Qt, { pct: i.change_pct })
|
|
1708
1712
|
] })
|
|
1709
1713
|
]
|
|
@@ -1713,46 +1717,46 @@ const Dt = Wa(function({
|
|
|
1713
1717
|
}
|
|
1714
1718
|
);
|
|
1715
1719
|
} else if (a.type === "narrative")
|
|
1716
|
-
|
|
1720
|
+
G = /* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-y-auto whitespace-pre-wrap text-[12.5px] leading-relaxed text-slate-700 dark:text-slate-300", children: (R.narrative ?? "").split(/(\*\*[^*]+\*\*)/g).map(
|
|
1717
1721
|
(l, i) => l.startsWith("**") && l.endsWith("**") ? /* @__PURE__ */ e("strong", { className: "font-semibold text-slate-900 dark:text-foreground", children: l.slice(2, -2) }, i) : /* @__PURE__ */ e("span", { children: l }, i)
|
|
1718
1722
|
) });
|
|
1719
1723
|
else if (a.type === "heatmap") {
|
|
1720
|
-
const l =
|
|
1721
|
-
|
|
1724
|
+
const l = R.cells ?? [], i = [...new Set(l.map((T) => T.dim))], b = [...new Set(l.map((T) => T.dim2))], _ = Math.max(1, ...l.map((T) => T.value)), $ = (T, ne) => l.find((ee) => ee.dim === T && ee.dim2 === ne);
|
|
1725
|
+
G = l.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 overflow-auto", children: /* @__PURE__ */ o("table", { className: "w-full text-[10.5px]", children: [
|
|
1722
1726
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ o("tr", { children: [
|
|
1723
1727
|
/* @__PURE__ */ e("th", {}),
|
|
1724
|
-
b.map((
|
|
1728
|
+
b.map((T) => /* @__PURE__ */ e(
|
|
1725
1729
|
"th",
|
|
1726
1730
|
{
|
|
1727
1731
|
className: "max-w-[80px] truncate px-1 pb-1 text-left font-medium text-slate-400",
|
|
1728
|
-
children:
|
|
1732
|
+
children: T
|
|
1729
1733
|
},
|
|
1730
|
-
|
|
1734
|
+
T
|
|
1731
1735
|
))
|
|
1732
1736
|
] }) }),
|
|
1733
|
-
/* @__PURE__ */ e("tbody", { children: i.map((
|
|
1734
|
-
/* @__PURE__ */ e("td", { className: "max-w-[110px] truncate pr-1.5 text-slate-500 dark:text-slate-400", children:
|
|
1735
|
-
b.map((
|
|
1736
|
-
const
|
|
1737
|
+
/* @__PURE__ */ e("tbody", { children: i.map((T) => /* @__PURE__ */ o("tr", { children: [
|
|
1738
|
+
/* @__PURE__ */ e("td", { className: "max-w-[110px] truncate pr-1.5 text-slate-500 dark:text-slate-400", children: T }),
|
|
1739
|
+
b.map((ne) => {
|
|
1740
|
+
const ee = $(T, ne), A = ee ? ee.value / _ : 0;
|
|
1737
1741
|
return /* @__PURE__ */ e("td", { className: "p-0.5", children: /* @__PURE__ */ e(
|
|
1738
1742
|
"div",
|
|
1739
1743
|
{
|
|
1740
|
-
"data-tip":
|
|
1744
|
+
"data-tip": ee ? `${T} × ${ne}: ${ee.value.toLocaleString()}` : void 0,
|
|
1741
1745
|
className: "flex h-6 items-center justify-center rounded text-[9.5px] tabular-nums",
|
|
1742
1746
|
style: {
|
|
1743
|
-
backgroundColor:
|
|
1744
|
-
color:
|
|
1745
|
-
border:
|
|
1747
|
+
backgroundColor: ee ? `rgba(0, 165, 204, ${0.08 + A * 0.85})` : "transparent",
|
|
1748
|
+
color: A > 0.55 ? "#fff" : void 0,
|
|
1749
|
+
border: ee ? void 0 : "1px dashed rgba(148,163,184,0.25)"
|
|
1746
1750
|
},
|
|
1747
|
-
children:
|
|
1751
|
+
children: ee ? $e(Math.round(ee.value)) : ""
|
|
1748
1752
|
}
|
|
1749
|
-
) },
|
|
1753
|
+
) }, ne);
|
|
1750
1754
|
})
|
|
1751
|
-
] },
|
|
1755
|
+
] }, T)) })
|
|
1752
1756
|
] }) });
|
|
1753
1757
|
} else if (a.type === "ai_insight") {
|
|
1754
|
-
const l =
|
|
1755
|
-
|
|
1758
|
+
const l = R.narrative ?? "";
|
|
1759
|
+
G = /* @__PURE__ */ o("div", { className: "flex min-h-0 flex-1 flex-col", children: [
|
|
1756
1760
|
/* @__PURE__ */ o("div", { className: "mb-1 flex items-center gap-1.5", children: [
|
|
1757
1761
|
/* @__PURE__ */ e(Wt, { className: "h-3.5 w-3.5 text-[#00a5cc]" }),
|
|
1758
1762
|
/* @__PURE__ */ e("span", { className: "text-[10px] uppercase tracking-wide text-slate-400", children: "AI-generated" }),
|
|
@@ -1761,18 +1765,18 @@ const Dt = Wa(function({
|
|
|
1761
1765
|
{
|
|
1762
1766
|
type: "button",
|
|
1763
1767
|
title: "Regenerate this summary",
|
|
1764
|
-
disabled:
|
|
1765
|
-
onClick: () => void
|
|
1768
|
+
disabled: ge,
|
|
1769
|
+
onClick: () => void Se(),
|
|
1766
1770
|
className: "ml-auto rounded p-0.5 text-slate-300 hover:text-[#00a5cc] disabled:opacity-50",
|
|
1767
|
-
children: /* @__PURE__ */ e(At, { className: P("h-3 w-3",
|
|
1771
|
+
children: /* @__PURE__ */ e(At, { className: P("h-3 w-3", ge && "animate-spin") })
|
|
1768
1772
|
}
|
|
1769
1773
|
)
|
|
1770
1774
|
] }),
|
|
1771
|
-
/* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-y-auto whitespace-pre-wrap text-[12.5px] leading-relaxed text-slate-700 dark:text-slate-300", children:
|
|
1775
|
+
/* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-y-auto whitespace-pre-wrap text-[12.5px] leading-relaxed text-slate-700 dark:text-slate-300", children: ge ? "Regenerating…" : l })
|
|
1772
1776
|
] });
|
|
1773
1777
|
} else if (a.type === "pivot") {
|
|
1774
|
-
const l =
|
|
1775
|
-
|
|
1778
|
+
const l = R.pivot;
|
|
1779
|
+
G = !l || l.rows.length === 0 ? /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No data." }) : /* @__PURE__ */ o("div", { className: "flex min-h-0 flex-1 flex-col", children: [
|
|
1776
1780
|
/* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ o("table", { className: "w-full border-collapse text-[10.5px]", children: [
|
|
1777
1781
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ o("tr", { children: [
|
|
1778
1782
|
/* @__PURE__ */ e("th", { className: "sticky left-0 top-0 z-[2] bg-white dark:bg-card" }),
|
|
@@ -1790,17 +1794,17 @@ const Dt = Wa(function({
|
|
|
1790
1794
|
/* @__PURE__ */ e("td", { className: "sticky left-0 z-[1] max-w-[150px] truncate bg-white pr-1.5 text-slate-500 dark:bg-card dark:text-slate-400", children: i }),
|
|
1791
1795
|
l.cols.map((b) => {
|
|
1792
1796
|
var $;
|
|
1793
|
-
const
|
|
1797
|
+
const _ = ($ = l.cells[i]) == null ? void 0 : $[b];
|
|
1794
1798
|
return /* @__PURE__ */ e(
|
|
1795
1799
|
"td",
|
|
1796
1800
|
{
|
|
1797
1801
|
className: "px-1.5 py-0.5 text-right tabular-nums text-slate-700 dark:text-slate-300",
|
|
1798
|
-
children:
|
|
1802
|
+
children: _ == null ? "" : Ae(_, ce)
|
|
1799
1803
|
},
|
|
1800
1804
|
b
|
|
1801
1805
|
);
|
|
1802
1806
|
}),
|
|
1803
|
-
/* @__PURE__ */ e("td", { className: "px-1.5 py-0.5 text-right font-semibold tabular-nums text-slate-800 dark:text-slate-200", children:
|
|
1807
|
+
/* @__PURE__ */ e("td", { className: "px-1.5 py-0.5 text-right font-semibold tabular-nums text-slate-800 dark:text-slate-200", children: Ae(l.row_totals[i] ?? 0, ce) })
|
|
1804
1808
|
] }, i)) }),
|
|
1805
1809
|
/* @__PURE__ */ e("tfoot", { children: /* @__PURE__ */ o("tr", { className: "border-t border-slate-200 dark:border-border", children: [
|
|
1806
1810
|
/* @__PURE__ */ e("td", { className: "sticky left-0 z-[1] bg-white pr-1.5 font-semibold text-slate-600 dark:bg-card dark:text-slate-300", children: "Total" }),
|
|
@@ -1808,11 +1812,11 @@ const Dt = Wa(function({
|
|
|
1808
1812
|
"td",
|
|
1809
1813
|
{
|
|
1810
1814
|
className: "px-1.5 py-0.5 text-right font-semibold tabular-nums text-slate-800 dark:text-slate-200",
|
|
1811
|
-
children:
|
|
1815
|
+
children: Ae(l.col_totals[i] ?? 0, ce)
|
|
1812
1816
|
},
|
|
1813
1817
|
i
|
|
1814
1818
|
)),
|
|
1815
|
-
/* @__PURE__ */ e("td", { className: "px-1.5 py-0.5 text-right font-semibold tabular-nums text-slate-900 dark:text-foreground", children:
|
|
1819
|
+
/* @__PURE__ */ e("td", { className: "px-1.5 py-0.5 text-right font-semibold tabular-nums text-slate-900 dark:text-foreground", children: Ae(l.grand_total, ce) })
|
|
1816
1820
|
] }) })
|
|
1817
1821
|
] }) }),
|
|
1818
1822
|
(l.truncated_rows > 0 || l.truncated_cols > 0) && /* @__PURE__ */ o("p", { className: "mt-1 shrink-0 px-1 text-[10px] text-amber-600 dark:text-amber-400", children: [
|
|
@@ -1831,8 +1835,8 @@ const Dt = Wa(function({
|
|
|
1831
1835
|
] })
|
|
1832
1836
|
] });
|
|
1833
1837
|
} else if (a.type === "waterfall") {
|
|
1834
|
-
const l =
|
|
1835
|
-
|
|
1838
|
+
const l = R.waterfall;
|
|
1839
|
+
G = l ? (() => {
|
|
1836
1840
|
const i = [];
|
|
1837
1841
|
i.push({ label: "Previous", from: 0, to: l.start, kind: "total" });
|
|
1838
1842
|
let b = l.start;
|
|
@@ -1844,21 +1848,21 @@ const Dt = Wa(function({
|
|
|
1844
1848
|
kind: $.delta >= 0 ? "up" : "down"
|
|
1845
1849
|
}), b += $.delta;
|
|
1846
1850
|
i.push({ label: "Current", from: 0, to: l.end, kind: "total" });
|
|
1847
|
-
const
|
|
1848
|
-
return /* @__PURE__ */ e("div", { className: "flex min-h-0 flex-1 items-end gap-1 overflow-x-auto px-1 pb-4", children: i.map(($,
|
|
1849
|
-
const
|
|
1851
|
+
const _ = Math.max(1, ...i.map(($) => Math.max($.from, $.to)));
|
|
1852
|
+
return /* @__PURE__ */ e("div", { className: "flex min-h-0 flex-1 items-end gap-1 overflow-x-auto px-1 pb-4", children: i.map(($, T) => {
|
|
1853
|
+
const ne = Math.max($.from, $.to) / _ * 100, ee = Math.abs($.to - $.from) / _ * 100;
|
|
1850
1854
|
return /* @__PURE__ */ o(
|
|
1851
1855
|
"div",
|
|
1852
1856
|
{
|
|
1853
1857
|
className: "relative flex h-full min-w-[46px] flex-1 flex-col justify-end",
|
|
1854
1858
|
children: [
|
|
1855
|
-
/* @__PURE__ */ e("div", { style: { height: `${Math.max(
|
|
1859
|
+
/* @__PURE__ */ e("div", { style: { height: `${Math.max(ne, 0.5)}%` }, className: "relative w-full", children: /* @__PURE__ */ e(
|
|
1856
1860
|
"div",
|
|
1857
1861
|
{
|
|
1858
1862
|
"data-tip": `${$.label}: ${($.to - $.from).toLocaleString()}`,
|
|
1859
1863
|
className: "absolute inset-x-0 top-0 rounded-sm",
|
|
1860
1864
|
style: {
|
|
1861
|
-
height: `${Math.max(
|
|
1865
|
+
height: `${Math.max(ee / Math.max(ne, 1e-3) * 100, 2)}%`,
|
|
1862
1866
|
backgroundColor: $.kind === "total" ? "#172940" : $.kind === "up" ? "#10b981" : "#ef4444"
|
|
1863
1867
|
}
|
|
1864
1868
|
}
|
|
@@ -1866,26 +1870,26 @@ const Dt = Wa(function({
|
|
|
1866
1870
|
/* @__PURE__ */ e("p", { className: "absolute -bottom-4 left-0 right-0 truncate text-center text-[9px] text-slate-400", children: $.label })
|
|
1867
1871
|
]
|
|
1868
1872
|
},
|
|
1869
|
-
|
|
1873
|
+
T
|
|
1870
1874
|
);
|
|
1871
1875
|
}) });
|
|
1872
1876
|
})() : /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No data." });
|
|
1873
1877
|
} else if (a.type === "stats") {
|
|
1874
|
-
const l =
|
|
1875
|
-
|
|
1878
|
+
const l = R.rows ?? [];
|
|
1879
|
+
G = l.length === 0 ? /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No data." }) : /* @__PURE__ */ e("div", { className: "grid min-h-0 flex-1 grid-cols-2 content-start gap-x-4 gap-y-1.5 overflow-auto px-1", children: l.map((i) => /* @__PURE__ */ o(
|
|
1876
1880
|
"div",
|
|
1877
1881
|
{
|
|
1878
1882
|
className: "flex items-baseline justify-between border-b border-slate-100 pb-1 dark:border-border/50",
|
|
1879
1883
|
children: [
|
|
1880
1884
|
/* @__PURE__ */ e("span", { className: "text-[11px] text-slate-500", children: i.stat }),
|
|
1881
|
-
/* @__PURE__ */ e("span", { className: "text-[13px] font-semibold tabular-nums text-slate-800 dark:text-slate-100", children: i.value == null ? "—" :
|
|
1885
|
+
/* @__PURE__ */ e("span", { className: "text-[13px] font-semibold tabular-nums text-slate-800 dark:text-slate-100", children: i.value == null ? "—" : Ae(i.value, ce) })
|
|
1882
1886
|
]
|
|
1883
1887
|
},
|
|
1884
1888
|
i.stat
|
|
1885
1889
|
)) });
|
|
1886
1890
|
} else if (a.type === "hot_records") {
|
|
1887
|
-
const l =
|
|
1888
|
-
|
|
1891
|
+
const l = R.rows ?? [], i = Math.max(1, ...l.map((b) => b.views));
|
|
1892
|
+
G = l.length === 0 ? /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No views recorded in the window." }) : /* @__PURE__ */ e("div", { className: "min-h-0 flex-1 space-y-1 overflow-auto px-1", children: l.map((b) => /* @__PURE__ */ o(
|
|
1889
1893
|
"button",
|
|
1890
1894
|
{
|
|
1891
1895
|
type: "button",
|
|
@@ -1906,32 +1910,32 @@ const Dt = Wa(function({
|
|
|
1906
1910
|
b.id
|
|
1907
1911
|
)) });
|
|
1908
1912
|
} else if (a.type === "scatter") {
|
|
1909
|
-
const l =
|
|
1910
|
-
|
|
1911
|
-
const i = l.length, b = l.reduce((
|
|
1912
|
-
{ x:
|
|
1913
|
-
{ x:
|
|
1913
|
+
const l = R.rows ?? [];
|
|
1914
|
+
G = l.length === 0 ? /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No data." }) : (() => {
|
|
1915
|
+
const i = l.length, b = l.reduce((te, r) => te + r.x, 0), _ = l.reduce((te, r) => te + r.y, 0), $ = l.reduce((te, r) => te + r.x * r.x, 0), T = l.reduce((te, r) => te + r.x * r.y, 0), ne = i * $ - b * b, ee = ne !== 0 ? (i * T - b * _) / ne : 0, A = i > 0 ? (_ - ee * b) / i : 0, U = l.map((te) => te.x), z = Math.min(...U), O = Math.max(...U), he = [
|
|
1916
|
+
{ x: z, y: A + ee * z },
|
|
1917
|
+
{ x: O, y: A + ee * O }
|
|
1914
1918
|
];
|
|
1915
|
-
return /* @__PURE__ */ e("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ e(
|
|
1916
|
-
ComposedChart:
|
|
1919
|
+
return /* @__PURE__ */ e("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ e(Pe, { fallback: /* @__PURE__ */ e(Ee, { className: "h-full w-full", "aria-busy": "true" }), children: ({
|
|
1920
|
+
ComposedChart: te,
|
|
1917
1921
|
Line: r,
|
|
1918
1922
|
ResponsiveContainer: d,
|
|
1919
1923
|
Scatter: x,
|
|
1920
1924
|
Tooltip: v,
|
|
1921
|
-
XAxis:
|
|
1922
|
-
YAxis:
|
|
1923
|
-
}) => /* @__PURE__ */ e(d, { width: "100%", height: "100%", children: /* @__PURE__ */ o(
|
|
1925
|
+
XAxis: C,
|
|
1926
|
+
YAxis: M
|
|
1927
|
+
}) => /* @__PURE__ */ e(d, { width: "100%", height: "100%", children: /* @__PURE__ */ o(te, { data: l, margin: { top: 6, right: 8, left: -6, bottom: 0 }, children: [
|
|
1924
1928
|
/* @__PURE__ */ e(
|
|
1925
|
-
|
|
1929
|
+
C,
|
|
1926
1930
|
{
|
|
1927
1931
|
dataKey: "x",
|
|
1928
1932
|
type: "number",
|
|
1929
1933
|
tick: { fontSize: 10 },
|
|
1930
|
-
tickFormatter:
|
|
1934
|
+
tickFormatter: $e,
|
|
1931
1935
|
domain: ["dataMin", "dataMax"]
|
|
1932
1936
|
}
|
|
1933
1937
|
),
|
|
1934
|
-
/* @__PURE__ */ e(
|
|
1938
|
+
/* @__PURE__ */ e(M, { tick: { fontSize: 10 }, tickFormatter: $e }),
|
|
1935
1939
|
/* @__PURE__ */ e(
|
|
1936
1940
|
v,
|
|
1937
1941
|
{
|
|
@@ -1948,7 +1952,7 @@ const Dt = Wa(function({
|
|
|
1948
1952
|
/* @__PURE__ */ e(
|
|
1949
1953
|
r,
|
|
1950
1954
|
{
|
|
1951
|
-
data:
|
|
1955
|
+
data: he,
|
|
1952
1956
|
dataKey: "y",
|
|
1953
1957
|
stroke: "#f59e0b",
|
|
1954
1958
|
strokeWidth: 2,
|
|
@@ -1959,10 +1963,10 @@ const Dt = Wa(function({
|
|
|
1959
1963
|
] }) }) }) });
|
|
1960
1964
|
})();
|
|
1961
1965
|
} else if (a.type === "pareto") {
|
|
1962
|
-
const l =
|
|
1963
|
-
|
|
1966
|
+
const l = R.series ?? [];
|
|
1967
|
+
G = l.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", children: /* @__PURE__ */ e(Pe, { fallback: /* @__PURE__ */ e(Ee, { className: "h-full w-full", "aria-busy": "true" }), children: ({ Bar: i, ComposedChart: b, Line: _, ResponsiveContainer: $, Tooltip: T, XAxis: ne, YAxis: ee }) => /* @__PURE__ */ e($, { width: "100%", height: "100%", children: /* @__PURE__ */ o(b, { data: l, margin: { top: 6, right: 4, left: -10, bottom: 0 }, children: [
|
|
1964
1968
|
/* @__PURE__ */ e(
|
|
1965
|
-
|
|
1969
|
+
ne,
|
|
1966
1970
|
{
|
|
1967
1971
|
dataKey: "dim",
|
|
1968
1972
|
tick: { fontSize: 10 },
|
|
@@ -1972,19 +1976,19 @@ const Dt = Wa(function({
|
|
|
1972
1976
|
height: 42
|
|
1973
1977
|
}
|
|
1974
1978
|
),
|
|
1975
|
-
/* @__PURE__ */ e(
|
|
1979
|
+
/* @__PURE__ */ e(ee, { yAxisId: "v", tick: { fontSize: 10 }, tickFormatter: $e }),
|
|
1976
1980
|
/* @__PURE__ */ e(
|
|
1977
|
-
|
|
1981
|
+
ee,
|
|
1978
1982
|
{
|
|
1979
1983
|
yAxisId: "pct",
|
|
1980
1984
|
orientation: "right",
|
|
1981
1985
|
domain: [0, 100],
|
|
1982
1986
|
tick: { fontSize: 10 },
|
|
1983
|
-
tickFormatter: (
|
|
1987
|
+
tickFormatter: (A) => `${A}%`
|
|
1984
1988
|
}
|
|
1985
1989
|
),
|
|
1986
1990
|
/* @__PURE__ */ e(
|
|
1987
|
-
|
|
1991
|
+
T,
|
|
1988
1992
|
{
|
|
1989
1993
|
contentStyle: {
|
|
1990
1994
|
fontSize: 12,
|
|
@@ -2006,7 +2010,7 @@ const Dt = Wa(function({
|
|
|
2006
2010
|
}
|
|
2007
2011
|
),
|
|
2008
2012
|
/* @__PURE__ */ e(
|
|
2009
|
-
|
|
2013
|
+
_,
|
|
2010
2014
|
{
|
|
2011
2015
|
yAxisId: "pct",
|
|
2012
2016
|
dataKey: "cum_pct",
|
|
@@ -2018,13 +2022,13 @@ const Dt = Wa(function({
|
|
|
2018
2022
|
)
|
|
2019
2023
|
] }) }) }) });
|
|
2020
2024
|
} else if (a.type === "metric")
|
|
2021
|
-
|
|
2022
|
-
/* @__PURE__ */ e("p", { className: "text-[26px] font-bold tabular-nums text-slate-900 dark:text-slate-50", children:
|
|
2025
|
+
G = /* @__PURE__ */ o("div", { className: "flex min-h-0 flex-1 flex-col justify-center px-1", children: [
|
|
2026
|
+
/* @__PURE__ */ e("p", { className: "text-[26px] font-bold tabular-nums text-slate-900 dark:text-slate-50", children: R.value == null ? "—" : Ae(R.value, ce) }),
|
|
2023
2027
|
/* @__PURE__ */ e("p", { className: "text-[11px] text-slate-400", children: String(((St = a.config) == null ? void 0 : St.metric_key) ?? "") })
|
|
2024
2028
|
] });
|
|
2025
2029
|
else if (a.type === "movers") {
|
|
2026
|
-
const l =
|
|
2027
|
-
|
|
2030
|
+
const l = R.rows ?? [];
|
|
2031
|
+
G = l.length === 0 ? /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No movement in this window." }) : /* @__PURE__ */ e("div", { className: "min-h-0 flex-1 space-y-0.5 overflow-y-auto", children: l.map((i) => /* @__PURE__ */ o("div", { className: "flex items-center gap-2 text-[11.5px]", children: [
|
|
2028
2032
|
/* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-slate-600 dark:text-slate-300", children: i.dim }),
|
|
2029
2033
|
/* @__PURE__ */ o("span", { className: "tabular-nums text-slate-400", children: [
|
|
2030
2034
|
i.previous.toLocaleString(),
|
|
@@ -2051,61 +2055,61 @@ const Dt = Wa(function({
|
|
|
2051
2055
|
)
|
|
2052
2056
|
] }, i.dim)) });
|
|
2053
2057
|
} else if (a.type === "table") {
|
|
2054
|
-
const l =
|
|
2058
|
+
const l = R.rows ?? [], i = (He = a.config) != null && He.columns && a.config.columns.length > 0 ? a.config.columns.map((d) => typeof d == "string" ? { field: d } : d) : l[0] ? Object.keys(l[0]).filter((d) => d !== "id").map((d) => ({ field: d })) : [], b = i.map((d) => d.field), _ = (d) => i.find((x) => x.field === d), $ = ((ut = a.config) == null ? void 0 : ut.format_rules) ?? [], T = (d) => {
|
|
2055
2059
|
var x;
|
|
2056
2060
|
for (const v of $)
|
|
2057
2061
|
if ((v.scope ?? "cell") === "row" && Gt(v, d[v.field]))
|
|
2058
|
-
return ((x =
|
|
2062
|
+
return ((x = Yt[v.color]) == null ? void 0 : x.row) ?? null;
|
|
2059
2063
|
return null;
|
|
2060
|
-
},
|
|
2064
|
+
}, ne = (d, x) => {
|
|
2061
2065
|
var v;
|
|
2062
|
-
for (const
|
|
2063
|
-
if ((
|
|
2064
|
-
return ((v =
|
|
2066
|
+
for (const C of $)
|
|
2067
|
+
if ((C.scope ?? "cell") === "cell" && C.field === x && Gt(C, d[x]))
|
|
2068
|
+
return ((v = Yt[C.color]) == null ? void 0 : v.cell) ?? null;
|
|
2065
2069
|
return null;
|
|
2066
|
-
},
|
|
2070
|
+
}, ee = Z.trim().toLowerCase(), A = a.config, U = A != null && A.suppress_zero ? l.filter(
|
|
2067
2071
|
(d) => b.some((x) => {
|
|
2068
2072
|
const v = Number(d[x]);
|
|
2069
2073
|
return Number.isFinite(v) && v !== 0;
|
|
2070
2074
|
})
|
|
2071
|
-
) : l,
|
|
2075
|
+
) : l, z = ee ? U.filter(
|
|
2072
2076
|
(d) => Object.values(d).some(
|
|
2073
|
-
(x) => String(x ?? "").toLowerCase().includes(
|
|
2077
|
+
(x) => String(x ?? "").toLowerCase().includes(ee)
|
|
2074
2078
|
)
|
|
2075
|
-
) :
|
|
2076
|
-
|
|
2077
|
-
l.length >
|
|
2079
|
+
) : U, O = 12, he = Math.max(1, Math.ceil(z.length / O)), te = Math.min(me, he - 1), r = z.length > O ? z.slice(te * O, te * O + O) : z;
|
|
2080
|
+
G = 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: [
|
|
2081
|
+
l.length > O && /* @__PURE__ */ o("div", { className: "mb-1 flex items-center gap-2", children: [
|
|
2078
2082
|
/* @__PURE__ */ e(
|
|
2079
2083
|
"input",
|
|
2080
2084
|
{
|
|
2081
|
-
value:
|
|
2085
|
+
value: Z,
|
|
2082
2086
|
onChange: (d) => {
|
|
2083
|
-
|
|
2087
|
+
E(d.target.value), J(0);
|
|
2084
2088
|
},
|
|
2085
2089
|
placeholder: "Search rows…",
|
|
2086
2090
|
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"
|
|
2087
2091
|
}
|
|
2088
2092
|
),
|
|
2089
|
-
|
|
2093
|
+
he > 1 && /* @__PURE__ */ o("span", { className: "ml-auto flex items-center gap-1 text-[10.5px] text-slate-400", children: [
|
|
2090
2094
|
/* @__PURE__ */ e(
|
|
2091
2095
|
"button",
|
|
2092
2096
|
{
|
|
2093
2097
|
type: "button",
|
|
2094
|
-
disabled:
|
|
2095
|
-
onClick: () => J(
|
|
2098
|
+
disabled: te <= 0,
|
|
2099
|
+
onClick: () => J(te - 1),
|
|
2096
2100
|
className: "rounded px-1 disabled:opacity-30",
|
|
2097
2101
|
children: "←"
|
|
2098
2102
|
}
|
|
2099
2103
|
),
|
|
2100
|
-
|
|
2104
|
+
te + 1,
|
|
2101
2105
|
"/",
|
|
2102
|
-
|
|
2106
|
+
he,
|
|
2103
2107
|
/* @__PURE__ */ e(
|
|
2104
2108
|
"button",
|
|
2105
2109
|
{
|
|
2106
2110
|
type: "button",
|
|
2107
|
-
disabled:
|
|
2108
|
-
onClick: () => J(
|
|
2111
|
+
disabled: te >= he - 1,
|
|
2112
|
+
onClick: () => J(te + 1),
|
|
2109
2113
|
className: "rounded px-1 disabled:opacity-30",
|
|
2110
2114
|
children: "→"
|
|
2111
2115
|
}
|
|
@@ -2119,7 +2123,7 @@ const Dt = Wa(function({
|
|
|
2119
2123
|
"th",
|
|
2120
2124
|
{
|
|
2121
2125
|
className: "border-b border-slate-100 px-1.5 py-1 text-left font-medium text-slate-400 dark:border-border",
|
|
2122
|
-
children: ((x =
|
|
2126
|
+
children: ((x = _(d)) == null ? void 0 : x.label) ?? d
|
|
2123
2127
|
},
|
|
2124
2128
|
d
|
|
2125
2129
|
);
|
|
@@ -2128,23 +2132,23 @@ const Dt = Wa(function({
|
|
|
2128
2132
|
"tr",
|
|
2129
2133
|
{
|
|
2130
2134
|
className: P(
|
|
2131
|
-
|
|
2135
|
+
T(d),
|
|
2132
2136
|
a.collection && d.id != null && "cursor-pointer hover:bg-slate-50 dark:hover:bg-muted/60"
|
|
2133
2137
|
),
|
|
2134
2138
|
onClick: () => {
|
|
2135
2139
|
a.collection && d.id != null && (g == null || g({ collection: a.collection, itemId: String(d.id) }));
|
|
2136
2140
|
},
|
|
2137
2141
|
children: b.map((x) => {
|
|
2138
|
-
var v,
|
|
2142
|
+
var v, C, M, B;
|
|
2139
2143
|
return /* @__PURE__ */ e(
|
|
2140
2144
|
"td",
|
|
2141
2145
|
{
|
|
2142
2146
|
className: P(
|
|
2143
2147
|
"max-w-[180px] truncate border-b border-slate-50 px-1.5 py-1 text-slate-700 dark:border-border/40 dark:text-slate-300",
|
|
2144
|
-
(typeof d[x] == "number" ||
|
|
2145
|
-
|
|
2148
|
+
(typeof d[x] == "number" || je.has(((v = _(x)) == null ? void 0 : v.format) ?? "")) && "text-right tabular-nums",
|
|
2149
|
+
ne(d, x)
|
|
2146
2150
|
),
|
|
2147
|
-
children: (
|
|
2151
|
+
children: (C = _(x)) != null && C.format ? ze(d[x], (M = _(x)) == null ? void 0 : M.format, (B = _(x)) == null ? void 0 : B.decimals) : String(d[x] ?? "")
|
|
2148
2152
|
},
|
|
2149
2153
|
x
|
|
2150
2154
|
);
|
|
@@ -2152,17 +2156,17 @@ const Dt = Wa(function({
|
|
|
2152
2156
|
},
|
|
2153
2157
|
String(d.id)
|
|
2154
2158
|
)) }),
|
|
2155
|
-
(
|
|
2156
|
-
var
|
|
2157
|
-
const v =
|
|
2159
|
+
(A == null ? void 0 : A.grand_total) && z.length > 1 && /* @__PURE__ */ e("tfoot", { children: /* @__PURE__ */ e("tr", { className: "border-t border-slate-200 font-semibold dark:border-border", children: b.map((d, x) => {
|
|
2160
|
+
var B, D, fe;
|
|
2161
|
+
const v = z.map((De) => Number(De[d])).filter((De) => Number.isFinite(De)), C = v.length > z.length / 2, M = v.reduce((De, ka) => De + ka, 0);
|
|
2158
2162
|
return /* @__PURE__ */ e(
|
|
2159
2163
|
"td",
|
|
2160
2164
|
{
|
|
2161
2165
|
className: P(
|
|
2162
2166
|
"px-1.5 py-1 text-slate-800 dark:text-slate-100",
|
|
2163
|
-
|
|
2167
|
+
C && "text-right tabular-nums"
|
|
2164
2168
|
),
|
|
2165
|
-
children: x === 0 && !
|
|
2169
|
+
children: x === 0 && !C ? "Total" : C ? (B = _(d)) != null && B.format ? ze(M, (D = _(d)) == null ? void 0 : D.format, (fe = _(d)) == null ? void 0 : fe.decimals) : M.toLocaleString() : ""
|
|
2166
2170
|
},
|
|
2167
2171
|
d
|
|
2168
2172
|
);
|
|
@@ -2170,38 +2174,38 @@ const Dt = Wa(function({
|
|
|
2170
2174
|
] }) })
|
|
2171
2175
|
] });
|
|
2172
2176
|
} else {
|
|
2173
|
-
let l =
|
|
2174
|
-
const i = !!((
|
|
2175
|
-
if (b >= 2 && i && !
|
|
2176
|
-
if (
|
|
2177
|
-
const
|
|
2178
|
-
return { ...
|
|
2179
|
-
})),
|
|
2180
|
-
let
|
|
2181
|
-
l = l.map((
|
|
2182
|
-
...
|
|
2183
|
-
value:
|
|
2184
|
-
...
|
|
2185
|
-
...
|
|
2177
|
+
let l = R.series ?? [];
|
|
2178
|
+
const i = !!((mt = (Xe = a.config) == null ? void 0 : Xe.dimension) != null && mt.bucket), b = Number((pt = a.config) == null ? void 0 : pt.rolling_avg) || 0;
|
|
2179
|
+
if (b >= 2 && i && !le && l.length >= b && (l = l.map((A, U) => {
|
|
2180
|
+
if (U < b - 1) return A;
|
|
2181
|
+
const z = l.slice(U - b + 1, U + 1);
|
|
2182
|
+
return { ...A, ma: z.reduce((O, he) => O + he.value, 0) / b };
|
|
2183
|
+
})), le && i) {
|
|
2184
|
+
let A = 0, U = 0, z = 0;
|
|
2185
|
+
l = l.map((O) => (A += O.value, U += O.prev ?? 0, z += O.value2 ?? 0, {
|
|
2186
|
+
...O,
|
|
2187
|
+
value: A,
|
|
2188
|
+
...O.prev != null ? { prev: U } : {},
|
|
2189
|
+
...O.value2 != null ? { value2: z } : {}
|
|
2186
2190
|
}));
|
|
2187
2191
|
}
|
|
2188
|
-
const
|
|
2189
|
-
if (!i ||
|
|
2190
|
-
const
|
|
2191
|
-
return
|
|
2192
|
-
l.filter((
|
|
2192
|
+
const _ = l.some((A) => A.value2 != null), $ = ((oe = (ht = a.config) == null ? void 0 : ht.metric2) == null ? void 0 : oe.label) ?? "secondary", T = l.some((A) => A.band != null), ne = (() => {
|
|
2193
|
+
if (!i || le || l.length < 8) return /* @__PURE__ */ new Set();
|
|
2194
|
+
const A = l.map((O) => O.value), U = A.reduce((O, he) => O + he, 0) / A.length, z = Math.sqrt(A.reduce((O, he) => O + (he - U) ** 2, 0) / A.length);
|
|
2195
|
+
return z === 0 ? /* @__PURE__ */ new Set() : new Set(
|
|
2196
|
+
l.filter((O) => Math.abs(O.value - U) > 2 * z).map((O) => O.dim)
|
|
2193
2197
|
);
|
|
2194
|
-
})(),
|
|
2195
|
-
(
|
|
2198
|
+
})(), ee = (L ?? []).filter(
|
|
2199
|
+
(A) => A.anchor_date && l.some((U) => U.dim === A.anchor_date)
|
|
2196
2200
|
);
|
|
2197
|
-
if (l.length === 0)
|
|
2201
|
+
if (l.length === 0) G = /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No data." });
|
|
2198
2202
|
else if (a.type === "donut") {
|
|
2199
|
-
const
|
|
2200
|
-
|
|
2203
|
+
const A = l.reduce((U, z) => U + z.value, 0);
|
|
2204
|
+
G = /* @__PURE__ */ o("div", { className: "flex min-h-0 flex-1 items-stretch gap-3", children: [
|
|
2201
2205
|
/* @__PURE__ */ o("div", { className: "relative min-h-[110px] min-w-0 flex-1", children: [
|
|
2202
|
-
/* @__PURE__ */ e(
|
|
2206
|
+
/* @__PURE__ */ e(Pe, { fallback: /* @__PURE__ */ e(Ee, { className: "h-full w-full", "aria-busy": "true" }), children: ({ Cell: U, Pie: z, PieChart: O, ResponsiveContainer: he, Tooltip: te }) => /* @__PURE__ */ e(he, { width: "100%", height: "100%", children: /* @__PURE__ */ o(O, { children: [
|
|
2203
2207
|
/* @__PURE__ */ e(
|
|
2204
|
-
|
|
2208
|
+
z,
|
|
2205
2209
|
{
|
|
2206
2210
|
data: l,
|
|
2207
2211
|
dataKey: "value",
|
|
@@ -2212,22 +2216,22 @@ const Dt = Wa(function({
|
|
|
2212
2216
|
strokeWidth: 0,
|
|
2213
2217
|
className: a.collection ? "cursor-pointer" : void 0,
|
|
2214
2218
|
onClick: (r) => {
|
|
2215
|
-
var v,
|
|
2219
|
+
var v, C, M, B;
|
|
2216
2220
|
if (!a.collection) return;
|
|
2217
2221
|
const d = r == null ? void 0 : r.payload;
|
|
2218
2222
|
if (d != null && d.other) return;
|
|
2219
|
-
if (
|
|
2220
|
-
const
|
|
2221
|
-
if (
|
|
2222
|
-
|
|
2223
|
-
...
|
|
2224
|
-
{ field:
|
|
2223
|
+
if (Je.length > re.length) {
|
|
2224
|
+
const D = re.length === 0 ? (C = (v = a.config) == null ? void 0 : v.dimension) == null ? void 0 : C.field : Je[re.length - 1];
|
|
2225
|
+
if (D) {
|
|
2226
|
+
k((fe) => [
|
|
2227
|
+
...fe,
|
|
2228
|
+
{ field: D, value: String((d == null ? void 0 : d.raw) ?? (d == null ? void 0 : d.dim) ?? "") }
|
|
2225
2229
|
]);
|
|
2226
2230
|
return;
|
|
2227
2231
|
}
|
|
2228
2232
|
}
|
|
2229
|
-
const x = (
|
|
2230
|
-
|
|
2233
|
+
const x = (B = (M = a.config) == null ? void 0 : M.dimension) == null ? void 0 : B.field;
|
|
2234
|
+
ie({
|
|
2231
2235
|
conditions: Tt(
|
|
2232
2236
|
a,
|
|
2233
2237
|
c,
|
|
@@ -2241,16 +2245,16 @@ const Dt = Wa(function({
|
|
|
2241
2245
|
});
|
|
2242
2246
|
},
|
|
2243
2247
|
children: l.map((r, d) => /* @__PURE__ */ e(
|
|
2244
|
-
|
|
2248
|
+
U,
|
|
2245
2249
|
{
|
|
2246
|
-
fill: r.other ? "#94a3b8" :
|
|
2250
|
+
fill: r.other ? "#94a3b8" : ue[d % ue.length]
|
|
2247
2251
|
},
|
|
2248
2252
|
r.dim
|
|
2249
2253
|
))
|
|
2250
2254
|
}
|
|
2251
2255
|
),
|
|
2252
2256
|
/* @__PURE__ */ e(
|
|
2253
|
-
|
|
2257
|
+
te,
|
|
2254
2258
|
{
|
|
2255
2259
|
contentStyle: {
|
|
2256
2260
|
fontSize: 12,
|
|
@@ -2265,39 +2269,39 @@ const Dt = Wa(function({
|
|
|
2265
2269
|
)
|
|
2266
2270
|
] }) }) }),
|
|
2267
2271
|
/* @__PURE__ */ o("div", { className: "pointer-events-none absolute inset-0 flex flex-col items-center justify-center", children: [
|
|
2268
|
-
/* @__PURE__ */ e("span", { className: "text-[17px] font-semibold leading-none text-slate-900 dark:text-foreground", children:
|
|
2272
|
+
/* @__PURE__ */ e("span", { className: "text-[17px] font-semibold leading-none text-slate-900 dark:text-foreground", children: A.toLocaleString() }),
|
|
2269
2273
|
/* @__PURE__ */ e("span", { className: "text-[9.5px] text-slate-400", children: "total" })
|
|
2270
2274
|
] })
|
|
2271
2275
|
] }),
|
|
2272
|
-
/* @__PURE__ */ e("div", { className: "max-h-full w-[40%] shrink-0 space-y-0.5 self-center overflow-y-auto pr-1", children: l.slice(0, 10).map((
|
|
2276
|
+
/* @__PURE__ */ e("div", { className: "max-h-full w-[40%] shrink-0 space-y-0.5 self-center overflow-y-auto pr-1", children: l.slice(0, 10).map((U, z) => /* @__PURE__ */ o("div", { className: "flex items-center gap-1.5 text-[10.5px]", children: [
|
|
2273
2277
|
/* @__PURE__ */ e(
|
|
2274
2278
|
"span",
|
|
2275
2279
|
{
|
|
2276
2280
|
className: "h-2 w-2 shrink-0 rounded-sm",
|
|
2277
|
-
style: { background:
|
|
2281
|
+
style: { background: ue[z % ue.length] }
|
|
2278
2282
|
}
|
|
2279
2283
|
),
|
|
2280
|
-
/* @__PURE__ */ e("span", { className: "truncate text-slate-600 dark:text-slate-300", children:
|
|
2281
|
-
/* @__PURE__ */ e("span", { className: "ml-auto tabular-nums text-slate-400", children:
|
|
2282
|
-
] },
|
|
2284
|
+
/* @__PURE__ */ e("span", { className: "truncate text-slate-600 dark:text-slate-300", children: U.dim }),
|
|
2285
|
+
/* @__PURE__ */ e("span", { className: "ml-auto tabular-nums text-slate-400", children: U.value.toLocaleString() })
|
|
2286
|
+
] }, U.dim)) })
|
|
2283
2287
|
] });
|
|
2284
2288
|
} else if (a.type === "line")
|
|
2285
|
-
|
|
2286
|
-
Area:
|
|
2287
|
-
ComposedChart:
|
|
2288
|
-
Line:
|
|
2289
|
-
ReferenceLine:
|
|
2290
|
-
ResponsiveContainer:
|
|
2291
|
-
Tooltip:
|
|
2289
|
+
G = /* @__PURE__ */ e("div", { className: "min-h-[110px] flex-1", children: /* @__PURE__ */ e(Pe, { fallback: /* @__PURE__ */ e(Ee, { className: "h-full w-full", "aria-busy": "true" }), children: ({
|
|
2290
|
+
Area: A,
|
|
2291
|
+
ComposedChart: U,
|
|
2292
|
+
Line: z,
|
|
2293
|
+
ReferenceLine: O,
|
|
2294
|
+
ResponsiveContainer: he,
|
|
2295
|
+
Tooltip: te,
|
|
2292
2296
|
XAxis: r,
|
|
2293
2297
|
YAxis: d
|
|
2294
2298
|
}) => {
|
|
2295
2299
|
var x;
|
|
2296
|
-
return /* @__PURE__ */ e(
|
|
2297
|
-
|
|
2300
|
+
return /* @__PURE__ */ e(he, { width: "100%", height: "100%", children: /* @__PURE__ */ o(
|
|
2301
|
+
U,
|
|
2298
2302
|
{
|
|
2299
2303
|
data: l,
|
|
2300
|
-
margin: { top: 6, right:
|
|
2304
|
+
margin: { top: 6, right: _ ? 4 : 8, left: -10, bottom: 0 },
|
|
2301
2305
|
children: [
|
|
2302
2306
|
/* @__PURE__ */ e(
|
|
2303
2307
|
r,
|
|
@@ -2305,7 +2309,7 @@ const Dt = Wa(function({
|
|
|
2305
2309
|
dataKey: "dim",
|
|
2306
2310
|
tick: { fontSize: 10 },
|
|
2307
2311
|
stroke: "#94a3b8",
|
|
2308
|
-
...
|
|
2312
|
+
...Mt(l.length)
|
|
2309
2313
|
}
|
|
2310
2314
|
),
|
|
2311
2315
|
/* @__PURE__ */ e(
|
|
@@ -2313,23 +2317,23 @@ const Dt = Wa(function({
|
|
|
2313
2317
|
{
|
|
2314
2318
|
tick: { fontSize: 10 },
|
|
2315
2319
|
stroke: "#94a3b8",
|
|
2316
|
-
tickFormatter:
|
|
2320
|
+
tickFormatter: $e,
|
|
2317
2321
|
width: 44
|
|
2318
2322
|
}
|
|
2319
2323
|
),
|
|
2320
|
-
|
|
2324
|
+
_ && /* @__PURE__ */ e(
|
|
2321
2325
|
d,
|
|
2322
2326
|
{
|
|
2323
2327
|
yAxisId: "right",
|
|
2324
2328
|
orientation: "right",
|
|
2325
2329
|
tick: { fontSize: 10 },
|
|
2326
2330
|
stroke: "#94a3b8",
|
|
2327
|
-
tickFormatter:
|
|
2331
|
+
tickFormatter: $e,
|
|
2328
2332
|
width: 44
|
|
2329
2333
|
}
|
|
2330
2334
|
),
|
|
2331
|
-
|
|
2332
|
-
|
|
2335
|
+
ee.map((v) => /* @__PURE__ */ e(
|
|
2336
|
+
O,
|
|
2333
2337
|
{
|
|
2334
2338
|
x: v.anchor_date,
|
|
2335
2339
|
stroke: "#f59e0b",
|
|
@@ -2339,7 +2343,7 @@ const Dt = Wa(function({
|
|
|
2339
2343
|
v.id
|
|
2340
2344
|
)),
|
|
2341
2345
|
/* @__PURE__ */ e(
|
|
2342
|
-
|
|
2346
|
+
te,
|
|
2343
2347
|
{
|
|
2344
2348
|
contentStyle: {
|
|
2345
2349
|
fontSize: 12,
|
|
@@ -2352,8 +2356,8 @@ const Dt = Wa(function({
|
|
|
2352
2356
|
itemStyle: { color: "#e2e8f0" }
|
|
2353
2357
|
}
|
|
2354
2358
|
),
|
|
2355
|
-
|
|
2356
|
-
|
|
2359
|
+
T && /* @__PURE__ */ e(
|
|
2360
|
+
A,
|
|
2357
2361
|
{
|
|
2358
2362
|
type: "monotone",
|
|
2359
2363
|
dataKey: "band",
|
|
@@ -2365,7 +2369,7 @@ const Dt = Wa(function({
|
|
|
2365
2369
|
}
|
|
2366
2370
|
),
|
|
2367
2371
|
((x = a.config) == null ? void 0 : x.compare) && /* @__PURE__ */ e(
|
|
2368
|
-
|
|
2372
|
+
z,
|
|
2369
2373
|
{
|
|
2370
2374
|
type: "monotone",
|
|
2371
2375
|
dataKey: "prev",
|
|
@@ -2377,15 +2381,15 @@ const Dt = Wa(function({
|
|
|
2377
2381
|
}
|
|
2378
2382
|
),
|
|
2379
2383
|
/* @__PURE__ */ e(
|
|
2380
|
-
|
|
2384
|
+
z,
|
|
2381
2385
|
{
|
|
2382
2386
|
type: "monotone",
|
|
2383
2387
|
dataKey: "value",
|
|
2384
|
-
stroke:
|
|
2388
|
+
stroke: et,
|
|
2385
2389
|
strokeWidth: 2,
|
|
2386
2390
|
dot: (v) => {
|
|
2387
|
-
var
|
|
2388
|
-
return
|
|
2391
|
+
var C, M, B;
|
|
2392
|
+
return ne.has(((C = v.payload) == null ? void 0 : C.dim) ?? "") ? /* @__PURE__ */ e(
|
|
2389
2393
|
"circle",
|
|
2390
2394
|
{
|
|
2391
2395
|
cx: v.cx,
|
|
@@ -2395,13 +2399,13 @@ const Dt = Wa(function({
|
|
|
2395
2399
|
stroke: "#fff",
|
|
2396
2400
|
strokeWidth: 1
|
|
2397
2401
|
},
|
|
2398
|
-
(
|
|
2399
|
-
) : /* @__PURE__ */ e("g", {}, (
|
|
2402
|
+
(M = v.payload) == null ? void 0 : M.dim
|
|
2403
|
+
) : /* @__PURE__ */ e("g", {}, (B = v.payload) == null ? void 0 : B.dim);
|
|
2400
2404
|
}
|
|
2401
2405
|
}
|
|
2402
2406
|
),
|
|
2403
|
-
|
|
2404
|
-
|
|
2407
|
+
_ && /* @__PURE__ */ e(
|
|
2408
|
+
z,
|
|
2405
2409
|
{
|
|
2406
2410
|
yAxisId: "right",
|
|
2407
2411
|
type: "monotone",
|
|
@@ -2413,7 +2417,7 @@ const Dt = Wa(function({
|
|
|
2413
2417
|
}
|
|
2414
2418
|
),
|
|
2415
2419
|
b >= 2 && /* @__PURE__ */ e(
|
|
2416
|
-
|
|
2420
|
+
z,
|
|
2417
2421
|
{
|
|
2418
2422
|
type: "monotone",
|
|
2419
2423
|
dataKey: "ma",
|
|
@@ -2430,145 +2434,141 @@ const Dt = Wa(function({
|
|
|
2430
2434
|
) });
|
|
2431
2435
|
} }) });
|
|
2432
2436
|
else {
|
|
2433
|
-
const
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
]
|
|
2565
|
-
}
|
|
2566
|
-
) });
|
|
2567
|
-
} }) });
|
|
2437
|
+
const A = ((_t = a.config) == null ? void 0 : _t.orientation) === "horizontal";
|
|
2438
|
+
G = /* @__PURE__ */ e(
|
|
2439
|
+
ia,
|
|
2440
|
+
{
|
|
2441
|
+
labels: A ? l.map((U) => U.dim) : [],
|
|
2442
|
+
className: "min-h-[110px] flex-1 text-slate-500 dark:text-slate-400",
|
|
2443
|
+
children: (U) => /* @__PURE__ */ e(Pe, { fallback: /* @__PURE__ */ e(Ee, { className: "h-full w-full", "aria-busy": "true" }), children: ({
|
|
2444
|
+
Bar: z,
|
|
2445
|
+
Cell: O,
|
|
2446
|
+
ComposedChart: he,
|
|
2447
|
+
Line: te,
|
|
2448
|
+
ReferenceLine: r,
|
|
2449
|
+
ResponsiveContainer: d,
|
|
2450
|
+
Tooltip: x,
|
|
2451
|
+
XAxis: v,
|
|
2452
|
+
YAxis: C
|
|
2453
|
+
}) => {
|
|
2454
|
+
var M;
|
|
2455
|
+
return /* @__PURE__ */ e(d, { width: "100%", height: "100%", children: /* @__PURE__ */ o(
|
|
2456
|
+
he,
|
|
2457
|
+
{
|
|
2458
|
+
data: l,
|
|
2459
|
+
layout: A ? "vertical" : "horizontal",
|
|
2460
|
+
margin: { top: 6, right: 8, left: A ? 0 : -10, bottom: 0 },
|
|
2461
|
+
children: [
|
|
2462
|
+
A ? /* @__PURE__ */ o(We, { children: [
|
|
2463
|
+
/* @__PURE__ */ e(v, { type: "number", tick: { fontSize: 10 }, stroke: "#94a3b8" }),
|
|
2464
|
+
/* @__PURE__ */ e(C, { type: "category", dataKey: "dim", stroke: "#94a3b8", ...U })
|
|
2465
|
+
] }) : /* @__PURE__ */ o(We, { children: [
|
|
2466
|
+
/* @__PURE__ */ e(
|
|
2467
|
+
v,
|
|
2468
|
+
{
|
|
2469
|
+
dataKey: "dim",
|
|
2470
|
+
tick: { fontSize: 10 },
|
|
2471
|
+
stroke: "#94a3b8",
|
|
2472
|
+
...Mt(l.length)
|
|
2473
|
+
}
|
|
2474
|
+
),
|
|
2475
|
+
/* @__PURE__ */ e(
|
|
2476
|
+
C,
|
|
2477
|
+
{
|
|
2478
|
+
tick: { fontSize: 10 },
|
|
2479
|
+
stroke: "#94a3b8",
|
|
2480
|
+
tickFormatter: $e,
|
|
2481
|
+
width: 44
|
|
2482
|
+
}
|
|
2483
|
+
),
|
|
2484
|
+
_ && /* @__PURE__ */ e(
|
|
2485
|
+
C,
|
|
2486
|
+
{
|
|
2487
|
+
yAxisId: "right",
|
|
2488
|
+
orientation: "right",
|
|
2489
|
+
tick: { fontSize: 10 },
|
|
2490
|
+
stroke: "#94a3b8",
|
|
2491
|
+
tickFormatter: $e,
|
|
2492
|
+
width: 44
|
|
2493
|
+
}
|
|
2494
|
+
)
|
|
2495
|
+
] }),
|
|
2496
|
+
!A && ee.map((B) => /* @__PURE__ */ e(
|
|
2497
|
+
r,
|
|
2498
|
+
{
|
|
2499
|
+
x: B.anchor_date,
|
|
2500
|
+
stroke: "#f59e0b",
|
|
2501
|
+
strokeDasharray: "4 3",
|
|
2502
|
+
label: { value: "✎", position: "top", fontSize: 11, fill: "#f59e0b" }
|
|
2503
|
+
},
|
|
2504
|
+
B.id
|
|
2505
|
+
)),
|
|
2506
|
+
/* @__PURE__ */ e(
|
|
2507
|
+
x,
|
|
2508
|
+
{
|
|
2509
|
+
contentStyle: {
|
|
2510
|
+
fontSize: 12,
|
|
2511
|
+
backgroundColor: "#0f172a",
|
|
2512
|
+
border: "1px solid #334155",
|
|
2513
|
+
borderRadius: 8,
|
|
2514
|
+
color: "#f1f5f9"
|
|
2515
|
+
},
|
|
2516
|
+
labelStyle: { color: "#f1f5f9" },
|
|
2517
|
+
itemStyle: { color: "#e2e8f0" }
|
|
2518
|
+
}
|
|
2519
|
+
),
|
|
2520
|
+
((M = a.config) == null ? void 0 : M.compare) && /* @__PURE__ */ e(z, { dataKey: "prev", fill: "#cbd5e1", radius: [3, 3, 0, 0], name: "previous" }),
|
|
2521
|
+
/* @__PURE__ */ e(
|
|
2522
|
+
z,
|
|
2523
|
+
{
|
|
2524
|
+
dataKey: "value",
|
|
2525
|
+
fill: et,
|
|
2526
|
+
radius: [3, 3, 0, 0],
|
|
2527
|
+
className: a.collection ? "cursor-pointer" : void 0,
|
|
2528
|
+
onClick: (B) => {
|
|
2529
|
+
var De;
|
|
2530
|
+
if (!a.collection) return;
|
|
2531
|
+
const D = B == null ? void 0 : B.payload;
|
|
2532
|
+
if (D != null && D.other) return;
|
|
2533
|
+
const fe = (De = a.config) == null ? void 0 : De.dimension;
|
|
2534
|
+
ie({
|
|
2535
|
+
conditions: Tt(
|
|
2536
|
+
a,
|
|
2537
|
+
c,
|
|
2538
|
+
s,
|
|
2539
|
+
(D == null ? void 0 : D.raw) ?? (D == null ? void 0 : D.dim)
|
|
2540
|
+
),
|
|
2541
|
+
title: `${a.title || a.collection} — ${(D == null ? void 0 : D.dim) ?? ""}`,
|
|
2542
|
+
dimField: fe != null && fe.bucket || fe == null ? void 0 : fe.field,
|
|
2543
|
+
dimRaw: (D == null ? void 0 : D.raw) ?? (D == null ? void 0 : D.dim),
|
|
2544
|
+
dimLabel: D == null ? void 0 : D.dim
|
|
2545
|
+
});
|
|
2546
|
+
},
|
|
2547
|
+
children: l.map((B) => /* @__PURE__ */ e(O, { fill: B.other ? "#94a3b8" : et }, B.dim))
|
|
2548
|
+
}
|
|
2549
|
+
),
|
|
2550
|
+
_ && /* @__PURE__ */ e(
|
|
2551
|
+
te,
|
|
2552
|
+
{
|
|
2553
|
+
yAxisId: A ? void 0 : "right",
|
|
2554
|
+
type: "monotone",
|
|
2555
|
+
dataKey: "value2",
|
|
2556
|
+
stroke: "#8b5cf6",
|
|
2557
|
+
strokeWidth: 1.5,
|
|
2558
|
+
dot: !1,
|
|
2559
|
+
name: $
|
|
2560
|
+
}
|
|
2561
|
+
)
|
|
2562
|
+
]
|
|
2563
|
+
}
|
|
2564
|
+
) });
|
|
2565
|
+
} })
|
|
2566
|
+
}
|
|
2567
|
+
);
|
|
2568
2568
|
}
|
|
2569
2569
|
}
|
|
2570
|
-
return
|
|
2571
|
-
/* @__PURE__ */ e("p", { className: "text-[26px] font-bold tabular-nums text-amber-700 dark:text-amber-400", children: p.value == null ? "—" :
|
|
2570
|
+
return K && p && (G = /* @__PURE__ */ o("div", { className: "flex min-h-0 flex-1 flex-col justify-center px-1", children: [
|
|
2571
|
+
/* @__PURE__ */ e("p", { className: "text-[26px] font-bold tabular-nums text-amber-700 dark:text-amber-400", children: p.value == null ? "—" : Ae(p.value, ce) }),
|
|
2572
2572
|
/* @__PURE__ */ o("p", { className: "text-[10.5px] text-slate-400", children: [
|
|
2573
2573
|
"As of ",
|
|
2574
2574
|
p.name,
|
|
@@ -2579,21 +2579,21 @@ const Dt = Wa(function({
|
|
|
2579
2579
|
{
|
|
2580
2580
|
ref: Y,
|
|
2581
2581
|
className: "flex min-h-0 flex-col overflow-hidden rounded-lg border border-slate-200 bg-white p-3 dark:border-border dark:bg-card",
|
|
2582
|
-
style:
|
|
2582
|
+
style: dt,
|
|
2583
2583
|
children: [
|
|
2584
2584
|
/* @__PURE__ */ o("div", { className: "mb-1.5 flex items-center gap-1.5", "data-widget-image-ignore": "", children: [
|
|
2585
2585
|
(() => {
|
|
2586
2586
|
var i;
|
|
2587
2587
|
const l = (i = a.config) == null ? void 0 : i.link_report;
|
|
2588
|
-
return l != null && l.report_id &&
|
|
2588
|
+
return l != null && l.report_id && N ? /* @__PURE__ */ o(
|
|
2589
2589
|
"a",
|
|
2590
2590
|
{
|
|
2591
|
-
href:
|
|
2591
|
+
href: N(l.report_id),
|
|
2592
2592
|
onClick: () => {
|
|
2593
2593
|
try {
|
|
2594
2594
|
sessionStorage.setItem(
|
|
2595
2595
|
`nvr-report-xf:${l.report_id}`,
|
|
2596
|
-
JSON.stringify(
|
|
2596
|
+
JSON.stringify(H ?? [])
|
|
2597
2597
|
);
|
|
2598
2598
|
} catch {
|
|
2599
2599
|
}
|
|
@@ -2610,21 +2610,21 @@ const Dt = Wa(function({
|
|
|
2610
2610
|
/* @__PURE__ */ e(
|
|
2611
2611
|
"span",
|
|
2612
2612
|
{
|
|
2613
|
-
"data-tip":
|
|
2613
|
+
"data-tip": Jt(a),
|
|
2614
2614
|
className: "shrink-0 cursor-help text-slate-300 hover:text-slate-500",
|
|
2615
2615
|
children: /* @__PURE__ */ e(Oa, { className: "h-3 w-3" })
|
|
2616
2616
|
}
|
|
2617
2617
|
),
|
|
2618
2618
|
/* @__PURE__ */ o("span", { className: "ml-auto flex items-center gap-0.5", children: [
|
|
2619
2619
|
/* @__PURE__ */ e(
|
|
2620
|
-
|
|
2620
|
+
hl,
|
|
2621
2621
|
{
|
|
2622
2622
|
getTarget: () => Y.current,
|
|
2623
2623
|
label: () => {
|
|
2624
2624
|
var l;
|
|
2625
2625
|
return {
|
|
2626
2626
|
title: a.title || a.collection || "Report widget",
|
|
2627
|
-
asOf:
|
|
2627
|
+
asOf: Ke || Date.now(),
|
|
2628
2628
|
dateRange: s,
|
|
2629
2629
|
entityFilters: c,
|
|
2630
2630
|
widgetRules: (l = a.config) == null ? void 0 : l.filters
|
|
@@ -2637,12 +2637,12 @@ const Dt = Wa(function({
|
|
|
2637
2637
|
"button",
|
|
2638
2638
|
{
|
|
2639
2639
|
type: "button",
|
|
2640
|
-
title:
|
|
2640
|
+
title: xe ? "Back to the chart" : "View as table (#383)",
|
|
2641
2641
|
className: P(
|
|
2642
2642
|
"rounded p-0.5",
|
|
2643
|
-
|
|
2643
|
+
xe ? "text-[#00a5cc]" : "text-slate-300 hover:text-[#00a5cc]"
|
|
2644
2644
|
),
|
|
2645
|
-
onClick: () =>
|
|
2645
|
+
onClick: () => se((l) => !l),
|
|
2646
2646
|
children: /* @__PURE__ */ e(Ka, { className: "h-3 w-3" })
|
|
2647
2647
|
}
|
|
2648
2648
|
),
|
|
@@ -2650,31 +2650,31 @@ const Dt = Wa(function({
|
|
|
2650
2650
|
"button",
|
|
2651
2651
|
{
|
|
2652
2652
|
type: "button",
|
|
2653
|
-
title:
|
|
2654
|
-
"data-explain-trend":
|
|
2653
|
+
title: Ce ? "Explain the trend" : "Explain this number",
|
|
2654
|
+
"data-explain-trend": Ce ? "1" : void 0,
|
|
2655
2655
|
className: "rounded p-0.5 text-slate-300 hover:text-[#00a5cc]",
|
|
2656
2656
|
onClick: () => {
|
|
2657
|
-
if (
|
|
2658
|
-
|
|
2657
|
+
if (de) {
|
|
2658
|
+
pe(!1);
|
|
2659
2659
|
return;
|
|
2660
2660
|
}
|
|
2661
|
-
if (
|
|
2662
|
-
if (
|
|
2663
|
-
|
|
2664
|
-
|
|
2661
|
+
if (pe(!0), ke || I) return;
|
|
2662
|
+
if (ae(!0), Ce) {
|
|
2663
|
+
q.request(
|
|
2664
|
+
rt(`/report-studio/${n}/widgets/${a.id}/explain-trend`, {
|
|
2665
2665
|
date_range: s,
|
|
2666
2666
|
entity_filters: c
|
|
2667
2667
|
})
|
|
2668
2668
|
).then((i) => {
|
|
2669
|
-
|
|
2669
|
+
w(i.data.explanation || "No explanation available."), Le(i.data.movers ?? null);
|
|
2670
2670
|
}).catch(
|
|
2671
|
-
(i) =>
|
|
2671
|
+
(i) => w(
|
|
2672
2672
|
(i == null ? void 0 : i.status) === 503 ? "AI is not configured on this instance." : (i == null ? void 0 : i.status) === 400 ? i.message ?? "Not enough data to describe a trend." : "AI is not configured or unavailable."
|
|
2673
2673
|
)
|
|
2674
|
-
).finally(() =>
|
|
2674
|
+
).finally(() => ae(!1));
|
|
2675
2675
|
return;
|
|
2676
2676
|
}
|
|
2677
|
-
(
|
|
2677
|
+
(R ? Promise.resolve(R) : q.request(
|
|
2678
2678
|
Ct(n, a.id, {
|
|
2679
2679
|
date_range: s,
|
|
2680
2680
|
entity_filters: c
|
|
@@ -2683,7 +2683,7 @@ const Dt = Wa(function({
|
|
|
2683
2683
|
})).then((i) => {
|
|
2684
2684
|
const b = {
|
|
2685
2685
|
widget: a.title,
|
|
2686
|
-
how_computed:
|
|
2686
|
+
how_computed: Jt(a),
|
|
2687
2687
|
value: (i == null ? void 0 : i.value) ?? null,
|
|
2688
2688
|
previous_value: (i == null ? void 0 : i.prev_value) ?? null,
|
|
2689
2689
|
change_pct: (i == null ? void 0 : i.change_pct) ?? null,
|
|
@@ -2691,35 +2691,35 @@ const Dt = Wa(function({
|
|
|
2691
2691
|
series: ((i == null ? void 0 : i.series) ?? []).slice(0, 15),
|
|
2692
2692
|
rows: ((i == null ? void 0 : i.rows) ?? []).slice(0, 10),
|
|
2693
2693
|
tiles: (i == null ? void 0 : i.tiles) ?? null
|
|
2694
|
-
},
|
|
2695
|
-
return
|
|
2696
|
-
|
|
2694
|
+
}, _ = (i == null ? void 0 : i.prev_value) != null || ((i == null ? void 0 : i.series) ?? []).some(($) => $.prev != null);
|
|
2695
|
+
return q.request(
|
|
2696
|
+
rt("/ai/brief", {
|
|
2697
2697
|
context: JSON.stringify(b),
|
|
2698
2698
|
// `template` picks the server's prompt; `instructions` (the same
|
|
2699
2699
|
// text) keeps an older API answering the same way.
|
|
2700
|
-
template:
|
|
2701
|
-
instructions:
|
|
2700
|
+
template: _ ? "report-compare" : "report-explain",
|
|
2701
|
+
instructions: _ ? "Compare the current period against the previous one in 2-4 plain sentences: overall direction, the biggest movers up and down, and anything anomalous. No preamble." : "In 2-3 plain sentences, explain what this report metric shows and what stands out (biggest contributor, direction of change). No preamble."
|
|
2702
2702
|
})
|
|
2703
2703
|
);
|
|
2704
2704
|
}).then((i) => {
|
|
2705
|
-
var
|
|
2706
|
-
const b = ((
|
|
2707
|
-
|
|
2708
|
-
}).catch(() =>
|
|
2705
|
+
var _, $;
|
|
2706
|
+
const b = ((_ = i.data) == null ? void 0 : _.brief) ?? (($ = i.data) == null ? void 0 : $.text) ?? null;
|
|
2707
|
+
w(b || "No explanation available.");
|
|
2708
|
+
}).catch(() => w("AI is not configured or unavailable.")).finally(() => ae(!1));
|
|
2709
2709
|
},
|
|
2710
2710
|
children: /* @__PURE__ */ e(Wt, { className: "h-3 w-3" })
|
|
2711
2711
|
}
|
|
2712
2712
|
),
|
|
2713
|
-
((
|
|
2713
|
+
((Ie = (Ze = a.config) == null ? void 0 : Ze.dimension) == null ? void 0 : Ie.bucket) && /* @__PURE__ */ e(
|
|
2714
2714
|
"button",
|
|
2715
2715
|
{
|
|
2716
2716
|
type: "button",
|
|
2717
|
-
title:
|
|
2717
|
+
title: le ? "Show per-period values" : "Show running total",
|
|
2718
2718
|
className: P(
|
|
2719
2719
|
"rounded p-0.5",
|
|
2720
|
-
|
|
2720
|
+
le ? "text-[#00a5cc]" : "text-slate-300 hover:text-slate-500"
|
|
2721
2721
|
),
|
|
2722
|
-
onClick: () =>
|
|
2722
|
+
onClick: () => V((l) => !l),
|
|
2723
2723
|
children: /* @__PURE__ */ e(Da, { className: "h-3 w-3" })
|
|
2724
2724
|
}
|
|
2725
2725
|
),
|
|
@@ -2730,7 +2730,7 @@ const Dt = Wa(function({
|
|
|
2730
2730
|
title: "Notes on this widget",
|
|
2731
2731
|
className: P(
|
|
2732
2732
|
"relative rounded p-0.5",
|
|
2733
|
-
((
|
|
2733
|
+
((L == null ? void 0 : L.length) ?? 0) > 0 ? "text-amber-500" : "text-slate-300 hover:text-slate-500"
|
|
2734
2734
|
),
|
|
2735
2735
|
onClick: () => Ne((l) => !l),
|
|
2736
2736
|
children: /* @__PURE__ */ e(Pa, { className: "h-3 w-3" })
|
|
@@ -2743,20 +2743,20 @@ const Dt = Wa(function({
|
|
|
2743
2743
|
title: "Download as CSV",
|
|
2744
2744
|
className: "rounded p-0.5 text-slate-300 hover:text-slate-500",
|
|
2745
2745
|
onClick: () => {
|
|
2746
|
-
if (!(
|
|
2747
|
-
|
|
2746
|
+
if (!(ve != null && ve.slug)) {
|
|
2747
|
+
Vt(a, R);
|
|
2748
2748
|
return;
|
|
2749
2749
|
}
|
|
2750
|
-
const l =
|
|
2751
|
-
|
|
2750
|
+
const l = ve, i = Kt(l, s, c);
|
|
2751
|
+
Oe.fetchQuery({
|
|
2752
2752
|
queryKey: ["nivaro-report-query", l.slug, i],
|
|
2753
|
-
queryFn: () =>
|
|
2753
|
+
queryFn: () => xa(q, l.slug, i),
|
|
2754
2754
|
staleTime: 6e4
|
|
2755
|
-
}).then((b) =>
|
|
2756
|
-
|
|
2755
|
+
}).then((b) => Vt(a, void 0, fa(l, b))).catch((b) => {
|
|
2756
|
+
La(b) || aa.error(Ot(b, "this widget"));
|
|
2757
2757
|
});
|
|
2758
2758
|
},
|
|
2759
|
-
children: /* @__PURE__ */ e(
|
|
2759
|
+
children: /* @__PURE__ */ e(Ea, { className: "h-3 w-3" })
|
|
2760
2760
|
}
|
|
2761
2761
|
),
|
|
2762
2762
|
/* @__PURE__ */ e(Ll, { reportId: n, widget: a, filterBar: h }),
|
|
@@ -2766,14 +2766,14 @@ const Dt = Wa(function({
|
|
|
2766
2766
|
type: "button",
|
|
2767
2767
|
title: "Refresh",
|
|
2768
2768
|
className: "rounded p-0.5 text-slate-300 hover:text-slate-500",
|
|
2769
|
-
onClick: () =>
|
|
2770
|
-
children: /* @__PURE__ */ e(At, { className: P("h-3 w-3",
|
|
2769
|
+
onClick: () => it(),
|
|
2770
|
+
children: /* @__PURE__ */ e(At, { className: P("h-3 w-3", Ft && "animate-spin") })
|
|
2771
2771
|
}
|
|
2772
2772
|
)
|
|
2773
2773
|
] })
|
|
2774
2774
|
] }),
|
|
2775
|
-
|
|
2776
|
-
(
|
|
2775
|
+
be && /* @__PURE__ */ o("div", { className: "mb-1.5 space-y-1 rounded-md border border-amber-200 bg-amber-50/60 p-2 dark:border-amber-500/30 dark:bg-amber-500/10", children: [
|
|
2776
|
+
(L ?? []).map((l) => /* @__PURE__ */ o(
|
|
2777
2777
|
"div",
|
|
2778
2778
|
{
|
|
2779
2779
|
className: "group/note flex items-start gap-1.5 text-[11px] text-slate-600 dark:text-slate-300",
|
|
@@ -2793,20 +2793,20 @@ const Dt = Wa(function({
|
|
|
2793
2793
|
type: "button",
|
|
2794
2794
|
onClick: () => Q(l.id),
|
|
2795
2795
|
className: "shrink-0 rounded p-0.5 text-slate-300 opacity-0 hover:text-red-500 group-hover/note:opacity-100",
|
|
2796
|
-
children: /* @__PURE__ */ e(
|
|
2796
|
+
children: /* @__PURE__ */ e(Re, { className: "h-2.5 w-2.5" })
|
|
2797
2797
|
}
|
|
2798
2798
|
)
|
|
2799
2799
|
]
|
|
2800
2800
|
},
|
|
2801
2801
|
l.id
|
|
2802
2802
|
)),
|
|
2803
|
-
(
|
|
2803
|
+
(L ?? []).length === 0 && /* @__PURE__ */ e("p", { className: "text-[11px] text-slate-400", children: "No notes yet — record why a number moved." }),
|
|
2804
2804
|
y && /* @__PURE__ */ o("div", { className: "flex items-center gap-1 pt-0.5", children: [
|
|
2805
2805
|
/* @__PURE__ */ e(
|
|
2806
2806
|
"input",
|
|
2807
2807
|
{
|
|
2808
|
-
value:
|
|
2809
|
-
onChange: (l) =>
|
|
2808
|
+
value: ye,
|
|
2809
|
+
onChange: (l) => qe(l.target.value),
|
|
2810
2810
|
placeholder: "Add a note…",
|
|
2811
2811
|
className: "h-6 min-w-0 flex-1 rounded border border-amber-200 bg-white px-1.5 text-[11px] dark:border-amber-500/30 dark:bg-card dark:text-slate-200"
|
|
2812
2812
|
}
|
|
@@ -2825,9 +2825,9 @@ const Dt = Wa(function({
|
|
|
2825
2825
|
"button",
|
|
2826
2826
|
{
|
|
2827
2827
|
type: "button",
|
|
2828
|
-
disabled: !
|
|
2828
|
+
disabled: !ye.trim(),
|
|
2829
2829
|
onClick: () => {
|
|
2830
|
-
y(a.id,
|
|
2830
|
+
y(a.id, ye.trim(), f.trim() || null), qe(""), X("");
|
|
2831
2831
|
},
|
|
2832
2832
|
className: "h-6 rounded bg-amber-500 px-2 text-[11px] font-medium text-white hover:brightness-105 disabled:opacity-40",
|
|
2833
2833
|
children: "Add"
|
|
@@ -2836,7 +2836,7 @@ const Dt = Wa(function({
|
|
|
2836
2836
|
] })
|
|
2837
2837
|
] }),
|
|
2838
2838
|
p && (() => {
|
|
2839
|
-
const l = Kl(
|
|
2839
|
+
const l = Kl(R), i = p.value;
|
|
2840
2840
|
if (l == null || i == null) return null;
|
|
2841
2841
|
const b = i === 0 ? null : (l - i) / Math.abs(i) * 100;
|
|
2842
2842
|
return /* @__PURE__ */ o("p", { className: "mb-1 flex items-center gap-1 text-[10.5px] text-slate-400", children: [
|
|
@@ -2860,14 +2860,14 @@ const Dt = Wa(function({
|
|
|
2860
2860
|
)
|
|
2861
2861
|
] });
|
|
2862
2862
|
})(),
|
|
2863
|
-
|
|
2863
|
+
de && /* @__PURE__ */ o(
|
|
2864
2864
|
"div",
|
|
2865
2865
|
{
|
|
2866
2866
|
className: "mb-1.5 rounded-md border border-nvr-cyan/25 bg-nvr-cyan/5 px-2.5 py-1.5 text-[11.5px] leading-snug text-slate-600 dark:text-slate-300",
|
|
2867
|
-
"data-explain-panel":
|
|
2867
|
+
"data-explain-panel": Ce ? "trend" : "number",
|
|
2868
2868
|
children: [
|
|
2869
|
-
|
|
2870
|
-
!
|
|
2869
|
+
I ? "Thinking…" : ke,
|
|
2870
|
+
!I && we && we.length > 0 && /* @__PURE__ */ e("div", { className: "mt-1.5 flex flex-wrap gap-1", "data-explain-movers": !0, children: we.slice(0, 4).map((l) => /* @__PURE__ */ o(
|
|
2871
2871
|
"span",
|
|
2872
2872
|
{
|
|
2873
2873
|
className: P(
|
|
@@ -2893,64 +2893,64 @@ const Dt = Wa(function({
|
|
|
2893
2893
|
]
|
|
2894
2894
|
}
|
|
2895
2895
|
),
|
|
2896
|
-
|
|
2896
|
+
re.length > 0 && /* @__PURE__ */ o("div", { className: "mb-1 flex flex-wrap items-center gap-1 text-[10.5px] text-slate-500", children: [
|
|
2897
2897
|
/* @__PURE__ */ e(
|
|
2898
2898
|
"button",
|
|
2899
2899
|
{
|
|
2900
2900
|
type: "button",
|
|
2901
|
-
onClick: () =>
|
|
2901
|
+
onClick: () => k([]),
|
|
2902
2902
|
className: "rounded px-1 hover:bg-muted",
|
|
2903
2903
|
children: "⌂ All"
|
|
2904
2904
|
}
|
|
2905
2905
|
),
|
|
2906
|
-
|
|
2906
|
+
re.map((l, i) => /* @__PURE__ */ o("span", { className: "flex items-center gap-1", children: [
|
|
2907
2907
|
/* @__PURE__ */ e("span", { className: "text-slate-300", children: "›" }),
|
|
2908
2908
|
/* @__PURE__ */ e(
|
|
2909
2909
|
"button",
|
|
2910
2910
|
{
|
|
2911
2911
|
type: "button",
|
|
2912
|
-
onClick: () =>
|
|
2912
|
+
onClick: () => k(re.slice(0, i + 1)),
|
|
2913
2913
|
className: "rounded bg-nvr-cyan/[0.08] px-1.5 py-0.5 font-medium text-[#007a99] dark:text-nvr-cyan",
|
|
2914
2914
|
children: l.value
|
|
2915
2915
|
}
|
|
2916
2916
|
)
|
|
2917
2917
|
] }, `${l.field}-${i}`))
|
|
2918
2918
|
] }),
|
|
2919
|
-
/* @__PURE__ */ e("div", { ref:
|
|
2919
|
+
/* @__PURE__ */ e("div", { ref: F, className: "flex min-h-0 flex-1 flex-col", children: xe && ((ft = R == null ? void 0 : R.series) != null && ft.length) ? /* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ o("table", { className: "w-full text-[11.5px]", children: [
|
|
2920
2920
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ o("tr", { className: "text-left text-[10px] uppercase tracking-wide text-slate-400", children: [
|
|
2921
2921
|
/* @__PURE__ */ e("th", { className: "px-1.5 pb-1", children: "Dimension" }),
|
|
2922
2922
|
/* @__PURE__ */ e("th", { className: "px-1.5 pb-1 text-right", children: "Value" })
|
|
2923
2923
|
] }) }),
|
|
2924
|
-
/* @__PURE__ */ e("tbody", { children: (
|
|
2924
|
+
/* @__PURE__ */ e("tbody", { children: (R.series ?? []).map((l) => /* @__PURE__ */ o("tr", { className: "border-b border-slate-50 dark:border-border/40", children: [
|
|
2925
2925
|
/* @__PURE__ */ e("td", { className: "max-w-[220px] truncate px-1.5 py-1 text-slate-700 dark:text-slate-300", children: l.dim }),
|
|
2926
|
-
/* @__PURE__ */ e("td", { className: "px-1.5 py-1 text-right tabular-nums text-slate-800 dark:text-slate-100", children:
|
|
2926
|
+
/* @__PURE__ */ e("td", { className: "px-1.5 py-1 text-right tabular-nums text-slate-800 dark:text-slate-100", children: Ae(l.value, ce) })
|
|
2927
2927
|
] }, l.dim)) })
|
|
2928
|
-
] }) }) :
|
|
2929
|
-
(
|
|
2928
|
+
] }) }) : G }),
|
|
2929
|
+
(ve == null ? void 0 : ve.slug) && j && /* @__PURE__ */ e(
|
|
2930
2930
|
ql,
|
|
2931
2931
|
{
|
|
2932
|
-
slug:
|
|
2933
|
-
params: Kt(
|
|
2932
|
+
slug: ve.slug,
|
|
2933
|
+
params: Kt(ve, s, c),
|
|
2934
2934
|
scope: `report:${n}`
|
|
2935
2935
|
}
|
|
2936
2936
|
),
|
|
2937
|
-
((
|
|
2937
|
+
((xt = a.config) == null ? void 0 : xt.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 }),
|
|
2938
2938
|
W && /* @__PURE__ */ e(
|
|
2939
2939
|
Dl,
|
|
2940
2940
|
{
|
|
2941
2941
|
collection: a.collection ?? "",
|
|
2942
2942
|
conditions: W.conditions,
|
|
2943
2943
|
title: W.title,
|
|
2944
|
-
onClose: () =>
|
|
2944
|
+
onClose: () => ie(null),
|
|
2945
2945
|
onOpen: (l) => {
|
|
2946
|
-
|
|
2946
|
+
ie(null), g == null || g(l);
|
|
2947
2947
|
},
|
|
2948
2948
|
crossFilter: m && W.dimField && W.dimRaw != null ? () => {
|
|
2949
2949
|
m(
|
|
2950
2950
|
W.dimField,
|
|
2951
2951
|
W.dimRaw,
|
|
2952
2952
|
W.dimLabel ?? String(W.dimRaw)
|
|
2953
|
-
),
|
|
2953
|
+
), ie(null);
|
|
2954
2954
|
} : void 0
|
|
2955
2955
|
}
|
|
2956
2956
|
)
|
|
@@ -2958,7 +2958,7 @@ const Dt = Wa(function({
|
|
|
2958
2958
|
}
|
|
2959
2959
|
);
|
|
2960
2960
|
});
|
|
2961
|
-
function
|
|
2961
|
+
function hr({
|
|
2962
2962
|
reportId: t,
|
|
2963
2963
|
widget: n,
|
|
2964
2964
|
dateRange: a = null,
|
|
@@ -2967,7 +2967,7 @@ function pr({
|
|
|
2967
2967
|
const c = la(), u = gt(
|
|
2968
2968
|
(g) => c == null ? void 0 : c.open(g),
|
|
2969
2969
|
[c]
|
|
2970
|
-
), h =
|
|
2970
|
+
), h = lt(() => ({ ...n, x: 0 }), [n]);
|
|
2971
2971
|
return /* @__PURE__ */ e(
|
|
2972
2972
|
Dt,
|
|
2973
2973
|
{
|
|
@@ -2980,14 +2980,10 @@ function pr({
|
|
|
2980
2980
|
);
|
|
2981
2981
|
}
|
|
2982
2982
|
function Pl(t) {
|
|
2983
|
-
const n = t == null ? "" : String(t);
|
|
2984
|
-
return n.length > 24 ? `${n.slice(0, 23)}…` : n;
|
|
2985
|
-
}
|
|
2986
|
-
function zl(t) {
|
|
2987
2983
|
const n = t;
|
|
2988
2984
|
return !(n != null && n.admin) || !n.access_scope_label ? null : `(your access scope: ${n.access_scope_label})`;
|
|
2989
2985
|
}
|
|
2990
|
-
function
|
|
2986
|
+
function fr({
|
|
2991
2987
|
reportId: t,
|
|
2992
2988
|
showFilterBar: n = !0,
|
|
2993
2989
|
dateRange: a,
|
|
@@ -2997,11 +2993,11 @@ function hr({
|
|
|
2997
2993
|
emptyState: h,
|
|
2998
2994
|
reportUrl: g
|
|
2999
2995
|
}) {
|
|
3000
|
-
var
|
|
3001
|
-
const p =
|
|
3002
|
-
(r) =>
|
|
3003
|
-
[
|
|
3004
|
-
), [m,
|
|
2996
|
+
var he, te;
|
|
2997
|
+
const p = Te(), K = la(), L = Qa("drill.report"), y = L.value, Q = gt(
|
|
2998
|
+
(r) => K ? K.open(r) : L.push([r]),
|
|
2999
|
+
[K, L.push]
|
|
3000
|
+
), [m, N] = S(void 0), [H, q] = S(s), [Z, E] = S(void 0), [me, J] = S(s), { scopes: W, ready: ie } = na(), [be, Ne] = S(!1), [ye, qe] = S({}), f = nt(), { data: X = [] } = _e({
|
|
3005
3001
|
queryKey: ["nivaro-report-presets", t],
|
|
3006
3002
|
queryFn: async () => {
|
|
3007
3003
|
try {
|
|
@@ -3009,7 +3005,7 @@ function hr({
|
|
|
3009
3005
|
if (Array.isArray(r) && r.length > 0) {
|
|
3010
3006
|
for (const d of r)
|
|
3011
3007
|
d != null && d.name && await p.request(
|
|
3012
|
-
|
|
3008
|
+
jt(t, {
|
|
3013
3009
|
name: String(d.name),
|
|
3014
3010
|
date_range: d.date_range ?? null,
|
|
3015
3011
|
entity_filters: d.entity_filters ?? []
|
|
@@ -3020,29 +3016,29 @@ function hr({
|
|
|
3020
3016
|
}
|
|
3021
3017
|
} catch {
|
|
3022
3018
|
}
|
|
3023
|
-
return p.request(
|
|
3019
|
+
return p.request(Na(t)).then((r) => r.data);
|
|
3024
3020
|
},
|
|
3025
3021
|
staleTime: 6e4
|
|
3026
|
-
}),
|
|
3022
|
+
}), le = () => void f.invalidateQueries({ queryKey: ["nivaro-report-presets", t] }), V = Me({
|
|
3027
3023
|
mutationFn: (r) => p.request(
|
|
3028
|
-
|
|
3024
|
+
jt(t, {
|
|
3029
3025
|
name: r,
|
|
3030
|
-
date_range:
|
|
3031
|
-
entity_filters:
|
|
3026
|
+
date_range: ft.current ?? null,
|
|
3027
|
+
entity_filters: xt.current
|
|
3032
3028
|
})
|
|
3033
3029
|
),
|
|
3034
|
-
onSuccess:
|
|
3035
|
-
}),
|
|
3036
|
-
mutationFn: (r) => p.request(
|
|
3037
|
-
onSuccess:
|
|
3038
|
-
}), [
|
|
3030
|
+
onSuccess: le
|
|
3031
|
+
}), xe = Me({
|
|
3032
|
+
mutationFn: (r) => p.request(wa(t, r)),
|
|
3033
|
+
onSuccess: le
|
|
3034
|
+
}), [se, re] = S(""), [k, F] = S(!1), [Y, j] = S(null), [de, pe] = S(!1), { data: ke = [] } = _e({
|
|
3039
3035
|
queryKey: ["nvr-report-snaps", t],
|
|
3040
3036
|
queryFn: () => p.request(
|
|
3041
3037
|
bt(`/report-studio/${t}/snapshots`)
|
|
3042
3038
|
).then((r) => r.data ?? []),
|
|
3043
3039
|
staleTime: 6e4,
|
|
3044
3040
|
retry: !1
|
|
3045
|
-
}), { data:
|
|
3041
|
+
}), { data: w } = _e({
|
|
3046
3042
|
queryKey: ["nvr-report-snap", t, Y],
|
|
3047
3043
|
queryFn: () => p.request(
|
|
3048
3044
|
bt(`/report-studio/${t}/snapshots/${Y}`)
|
|
@@ -3050,99 +3046,99 @@ function hr({
|
|
|
3050
3046
|
enabled: Y != null,
|
|
3051
3047
|
staleTime: 5 * 6e4,
|
|
3052
3048
|
retry: !1
|
|
3053
|
-
}),
|
|
3054
|
-
mutationFn: () => p.request(
|
|
3049
|
+
}), I = Me({
|
|
3050
|
+
mutationFn: () => p.request(rt(`/report-studio/${t}/snapshots`, {})),
|
|
3055
3051
|
onSuccess: () => void f.invalidateQueries({ queryKey: ["nvr-report-snaps", t] })
|
|
3056
|
-
}), { data:
|
|
3052
|
+
}), { data: ae = [] } = _e({
|
|
3057
3053
|
queryKey: ["nvr-report-notes", t],
|
|
3058
3054
|
queryFn: () => p.request(bt(`/report-studio/${t}/annotations`)).then((r) => r.data ?? []),
|
|
3059
3055
|
staleTime: 6e4,
|
|
3060
3056
|
retry: !1
|
|
3061
|
-
}),
|
|
3062
|
-
mutationFn: (r) => p.request(
|
|
3063
|
-
onSuccess:
|
|
3064
|
-
}),
|
|
3065
|
-
mutationFn: (r) => p.request(
|
|
3066
|
-
onSuccess:
|
|
3067
|
-
}),
|
|
3057
|
+
}), we = () => void f.invalidateQueries({ queryKey: ["nvr-report-notes", t] }), Le = Me({
|
|
3058
|
+
mutationFn: (r) => p.request(rt(`/report-studio/${t}/annotations`, r)),
|
|
3059
|
+
onSuccess: we
|
|
3060
|
+
}), Ce = Me({
|
|
3061
|
+
mutationFn: (r) => p.request(Ua(`/report-studio/${t}/annotations/${r}`)),
|
|
3062
|
+
onSuccess: we
|
|
3063
|
+
}), Oe = gt((r, d, x) => {
|
|
3068
3064
|
const v = {
|
|
3069
3065
|
field: r,
|
|
3070
3066
|
values: [d],
|
|
3071
3067
|
labels: [x]
|
|
3072
3068
|
};
|
|
3073
|
-
|
|
3074
|
-
}, []), [
|
|
3069
|
+
q((C) => [...C.filter((M) => M.field !== r), v]), J((C) => [...C.filter((M) => M.field !== r), v]);
|
|
3070
|
+
}, []), [ge, Be] = S(!1), [Se, Fe] = S(null), [st, Qe] = S(null), ot = Me({
|
|
3075
3071
|
mutationFn: (r) => p.request(
|
|
3076
|
-
|
|
3072
|
+
Ja(`/report-studio/${t}/widgets`, {
|
|
3077
3073
|
widgets: r.map((d, x) => ({ ...d, sort: x }))
|
|
3078
3074
|
})
|
|
3079
3075
|
),
|
|
3080
3076
|
onSuccess: () => {
|
|
3081
|
-
|
|
3077
|
+
Be(!1), Fe(null), Qe(null), f.invalidateQueries({ queryKey: ["nivaro-report", t] }), f.invalidateQueries({ queryKey: ["nivaro-report-widget"] });
|
|
3082
3078
|
}
|
|
3083
|
-
}),
|
|
3084
|
-
f.invalidateQueries({ queryKey: ["nivaro-report-widget", t] }), f.invalidateQueries({ queryKey: ["nivaro-report-query"] }),
|
|
3085
|
-
}, { data:
|
|
3079
|
+
}), Ue = (r) => [...r].sort((d, x) => (d.y ?? 0) - (x.y ?? 0) || (d.x ?? 0) - (x.x ?? 0)), [it, Ft] = S(() => /* @__PURE__ */ new Date()), [Ke, Je] = Ga(`report:${t}`), vt = () => {
|
|
3080
|
+
f.invalidateQueries({ queryKey: ["nivaro-report-widget", t] }), f.invalidateQueries({ queryKey: ["nivaro-report-query"] }), Ft(/* @__PURE__ */ new Date());
|
|
3081
|
+
}, { data: R = [] } = _e({
|
|
3086
3082
|
queryKey: ["nvr-report-firing", t],
|
|
3087
3083
|
queryFn: () => p.request(bt(`/report-studio/${t}/firing`)).then((r) => r.data ?? []).catch(() => []),
|
|
3088
3084
|
staleTime: 6e4,
|
|
3089
3085
|
refetchInterval: 5 * 6e4,
|
|
3090
3086
|
retry: !1
|
|
3091
|
-
}), [
|
|
3092
|
-
|
|
3087
|
+
}), [ce, dt] = S(null), [Ve, ve] = S(!1), [G, yt] = S(""), [Ye, kt] = S(""), [Ge, Nt] = S("");
|
|
3088
|
+
tt(() => {
|
|
3093
3089
|
try {
|
|
3094
3090
|
const r = sessionStorage.getItem(`nvr-report-xf:${t}`);
|
|
3095
3091
|
if (r) {
|
|
3096
3092
|
sessionStorage.removeItem(`nvr-report-xf:${t}`);
|
|
3097
3093
|
const d = JSON.parse(r);
|
|
3098
|
-
Array.isArray(d) && d.length > 0 && (
|
|
3094
|
+
Array.isArray(d) && d.length > 0 && (q(d), J(d));
|
|
3099
3095
|
}
|
|
3100
3096
|
} catch {
|
|
3101
3097
|
}
|
|
3102
3098
|
}, [t]);
|
|
3103
3099
|
const wt = () => {
|
|
3104
|
-
|
|
3105
|
-
},
|
|
3106
|
-
const v = [...x ?? []],
|
|
3107
|
-
if (
|
|
3108
|
-
const
|
|
3109
|
-
return v[
|
|
3110
|
-
}), [
|
|
3100
|
+
Fe(Ue((oe == null ? void 0 : oe.widgets) ?? [])), Be(!0), window.__nvrReportId = t;
|
|
3101
|
+
}, ct = (r) => Fe((d) => (d ?? []).map((x) => x.id === r.id ? r : x)), St = (r, d) => Fe((x) => {
|
|
3102
|
+
const v = [...x ?? []], C = v.findIndex((fe) => fe.id === r), M = C + d;
|
|
3103
|
+
if (C < 0 || M < 0 || M >= v.length) return v;
|
|
3104
|
+
const B = v[C], D = v[M];
|
|
3105
|
+
return v[C] = { ...D, x: B.x, y: B.y }, v[M] = { ...B, x: D.x, y: D.y }, v;
|
|
3106
|
+
}), [He, ut] = S(""), [Xe, mt] = S(!1), [pt, ht] = S(null), { data: oe, isLoading: _t } = _e({
|
|
3111
3107
|
queryKey: ["nivaro-report", t],
|
|
3112
|
-
queryFn: () => p.request(
|
|
3108
|
+
queryFn: () => p.request(zt(t)).then((r) => r.data),
|
|
3113
3109
|
staleTime: 3e4
|
|
3114
|
-
}),
|
|
3110
|
+
}), Ze = at(!1), Ie = gt(async () => {
|
|
3115
3111
|
var x;
|
|
3116
3112
|
const r = (x = f.getQueryData(["nivaro-report", t])) == null ? void 0 : x.widgets, d = await f.fetchQuery({
|
|
3117
3113
|
queryKey: ["nivaro-report", t],
|
|
3118
|
-
queryFn: () => p.request(
|
|
3114
|
+
queryFn: () => p.request(zt(t)).then((v) => v.data),
|
|
3119
3115
|
staleTime: 0
|
|
3120
3116
|
}).catch(() => null);
|
|
3121
3117
|
if (d)
|
|
3122
|
-
for (const v of
|
|
3118
|
+
for (const v of Va(
|
|
3123
3119
|
r,
|
|
3124
3120
|
d.widgets
|
|
3125
3121
|
))
|
|
3126
3122
|
f.invalidateQueries({ queryKey: ["nivaro-report-widget", t, v] });
|
|
3127
3123
|
}, [f, p, t]);
|
|
3128
|
-
|
|
3124
|
+
Ya("report", t, {
|
|
3129
3125
|
onChange: () => {
|
|
3130
|
-
|
|
3126
|
+
ge ? Ze.current = !0 : Ie();
|
|
3131
3127
|
}
|
|
3132
|
-
}),
|
|
3133
|
-
!
|
|
3134
|
-
}, [
|
|
3135
|
-
const
|
|
3136
|
-
|
|
3137
|
-
const b =
|
|
3128
|
+
}), tt(() => {
|
|
3129
|
+
!ge && Ze.current && (Ze.current = !1, Ie());
|
|
3130
|
+
}, [ge, Ie]);
|
|
3131
|
+
const ft = at(null), xt = at([]), l = ((he = oe == null ? void 0 : oe.global_filters) == null ? void 0 : he.date_range) ?? null, i = lt(() => m !== void 0 ? m : a !== void 0 ? a : l, [m, a, l]);
|
|
3132
|
+
ft.current = i ?? null, xt.current = H;
|
|
3133
|
+
const b = lt(
|
|
3138
3134
|
() => {
|
|
3139
3135
|
var r;
|
|
3140
|
-
return ((r =
|
|
3136
|
+
return ((r = oe == null ? void 0 : oe.global_filters) == null ? void 0 : r.filter_bar) ?? [];
|
|
3141
3137
|
},
|
|
3142
|
-
[(
|
|
3138
|
+
[(te = oe == null ? void 0 : oe.global_filters) == null ? void 0 : te.filter_bar]
|
|
3143
3139
|
);
|
|
3144
|
-
|
|
3145
|
-
if (!
|
|
3140
|
+
tt(() => {
|
|
3141
|
+
if (!be && !(!ie || !oe)) {
|
|
3146
3142
|
if (!W || b.length === 0) {
|
|
3147
3143
|
Ne(!0);
|
|
3148
3144
|
return;
|
|
@@ -3151,92 +3147,92 @@ function hr({
|
|
|
3151
3147
|
var x;
|
|
3152
3148
|
const r = [], d = {};
|
|
3153
3149
|
for (const v of b) {
|
|
3154
|
-
const
|
|
3150
|
+
const C = nl(W, {
|
|
3155
3151
|
key: v.field,
|
|
3156
3152
|
collection: (x = v.options) == null ? void 0 : x.collection
|
|
3157
3153
|
});
|
|
3158
|
-
if (!
|
|
3159
|
-
const
|
|
3160
|
-
if (
|
|
3161
|
-
const
|
|
3154
|
+
if (!C) continue;
|
|
3155
|
+
const M = v.options ? v.options.value_field ?? "id" : "id", B = W.restricted[C.name] ?? [];
|
|
3156
|
+
if (B.length > 0) {
|
|
3157
|
+
const fe = await Bt(p, C, B, M).catch(
|
|
3162
3158
|
() => []
|
|
3163
3159
|
);
|
|
3164
|
-
|
|
3160
|
+
fe.length > 0 && (d[v.field] = fe);
|
|
3165
3161
|
}
|
|
3166
|
-
const
|
|
3167
|
-
if (
|
|
3168
|
-
const
|
|
3162
|
+
const D = sl(W, C.name);
|
|
3163
|
+
if (D.length > 0) {
|
|
3164
|
+
const fe = await Bt(p, C, D, M).catch(
|
|
3169
3165
|
() => []
|
|
3170
3166
|
);
|
|
3171
|
-
|
|
3167
|
+
fe.length > 0 && r.push({ field: v.field, values: fe, labels: fe.map(String) });
|
|
3172
3168
|
}
|
|
3173
3169
|
}
|
|
3174
|
-
if (Object.keys(d).length > 0 &&
|
|
3175
|
-
const v = (
|
|
3176
|
-
const
|
|
3177
|
-
for (const
|
|
3178
|
-
return
|
|
3170
|
+
if (Object.keys(d).length > 0 && qe(d), r.length > 0) {
|
|
3171
|
+
const v = (C) => {
|
|
3172
|
+
const M = [...C];
|
|
3173
|
+
for (const B of r) M.some((D) => D.field === B.field) || M.push(B);
|
|
3174
|
+
return M;
|
|
3179
3175
|
};
|
|
3180
|
-
J(v),
|
|
3176
|
+
J(v), q(v);
|
|
3181
3177
|
}
|
|
3182
3178
|
Ne(!0);
|
|
3183
3179
|
})();
|
|
3184
3180
|
}
|
|
3185
|
-
}, [
|
|
3186
|
-
const
|
|
3187
|
-
|
|
3188
|
-
},
|
|
3189
|
-
J([]),
|
|
3190
|
-
},
|
|
3191
|
-
J(r.entity_filters),
|
|
3192
|
-
},
|
|
3181
|
+
}, [be, ie, oe, W, b]);
|
|
3182
|
+
const _ = (oe == null ? void 0 : oe.widgets) ?? [], $ = Z !== void 0 ? Z : i, T = H.filter((r) => r.values.length > 0).length + (i ? 1 : 0), ne = JSON.stringify(me) !== JSON.stringify(H) || Z !== void 0, ee = () => {
|
|
3183
|
+
q(me), Z !== void 0 && (N(Z), E(void 0));
|
|
3184
|
+
}, A = () => {
|
|
3185
|
+
J([]), q([]), N(null), E(void 0);
|
|
3186
|
+
}, U = (r) => {
|
|
3187
|
+
J(r.entity_filters), q(r.entity_filters), N(r.date_range), E(void 0);
|
|
3188
|
+
}, z = async () => {
|
|
3193
3189
|
var d, x;
|
|
3194
|
-
const r =
|
|
3195
|
-
if (!(!r ||
|
|
3196
|
-
|
|
3190
|
+
const r = He.trim();
|
|
3191
|
+
if (!(!r || Xe)) {
|
|
3192
|
+
mt(!0), ht(null);
|
|
3197
3193
|
try {
|
|
3198
3194
|
const v = await p.request(
|
|
3199
|
-
|
|
3195
|
+
$a(
|
|
3200
3196
|
t,
|
|
3201
3197
|
r,
|
|
3202
|
-
b.map((
|
|
3198
|
+
b.map((M) => ({ field: M.field, label: M.label }))
|
|
3203
3199
|
)
|
|
3204
|
-
),
|
|
3205
|
-
var
|
|
3206
|
-
return b.some((
|
|
3207
|
-
}).map((
|
|
3208
|
-
J(
|
|
3200
|
+
), C = (v.data.entity_filters ?? []).filter((M) => {
|
|
3201
|
+
var B;
|
|
3202
|
+
return b.some((D) => D.field === M.field) && ((B = M.values) == null ? void 0 : B.length) > 0;
|
|
3203
|
+
}).map((M) => ({ field: M.field, values: M.values, labels: M.values.map(String) }));
|
|
3204
|
+
J(C), q(C), N(v.data.date_range ?? null), E(void 0), ut("");
|
|
3209
3205
|
} catch (v) {
|
|
3210
|
-
|
|
3206
|
+
ht(
|
|
3211
3207
|
((x = (d = v.response) == null ? void 0 : d.data) == null ? void 0 : x.error) ?? "Could not parse that"
|
|
3212
3208
|
);
|
|
3213
3209
|
} finally {
|
|
3214
|
-
|
|
3210
|
+
mt(!1);
|
|
3215
3211
|
}
|
|
3216
3212
|
}
|
|
3217
3213
|
};
|
|
3218
|
-
if (_t || !
|
|
3214
|
+
if (_t || !be)
|
|
3219
3215
|
return /* @__PURE__ */ e("div", { className: P("p-6 text-[13px] text-slate-400", u), children: "Loading report…" });
|
|
3220
|
-
if (!
|
|
3216
|
+
if (!oe)
|
|
3221
3217
|
return /* @__PURE__ */ e("div", { className: P("p-6 text-[13px] text-slate-400", u), children: "Report not found." });
|
|
3222
|
-
const
|
|
3223
|
-
return /* @__PURE__ */ e(
|
|
3224
|
-
|
|
3225
|
-
n && (
|
|
3218
|
+
const O = Pl(W);
|
|
3219
|
+
return /* @__PURE__ */ e(va.Provider, { value: Ke, children: /* @__PURE__ */ o("div", { className: P("flex flex-col gap-3", u), children: [
|
|
3220
|
+
O && (!n || _.length === 0 && b.length === 0) && /* @__PURE__ */ e("p", { className: "text-[11.5px] text-amber-700 dark:text-amber-300", children: O }),
|
|
3221
|
+
n && (_.length > 0 || b.length > 0) && /* @__PURE__ */ o("div", { className: "space-y-1.5", children: [
|
|
3226
3222
|
/* @__PURE__ */ o("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
3227
3223
|
/* @__PURE__ */ o("span", { className: "flex items-center gap-1.5 text-[11.5px] font-semibold text-slate-500 dark:text-slate-300", children: [
|
|
3228
3224
|
"Filters",
|
|
3229
|
-
|
|
3230
|
-
|
|
3225
|
+
O && /* @__PURE__ */ e("span", { className: "font-normal text-amber-700 dark:text-amber-300", children: O }),
|
|
3226
|
+
T > 0 && /* @__PURE__ */ o("span", { className: "rounded-full bg-emerald-50 px-1.5 py-px text-[10px] font-semibold text-emerald-600 dark:bg-emerald-500/10 dark:text-emerald-400", children: [
|
|
3231
3227
|
"Active · ",
|
|
3232
|
-
|
|
3228
|
+
T
|
|
3233
3229
|
] })
|
|
3234
3230
|
] }),
|
|
3235
3231
|
/* @__PURE__ */ e(
|
|
3236
3232
|
$t,
|
|
3237
3233
|
{
|
|
3238
3234
|
value: ($ == null ? void 0 : $.preset) ?? "",
|
|
3239
|
-
onChange: (r) =>
|
|
3235
|
+
onChange: (r) => E(r ? { preset: r } : null),
|
|
3240
3236
|
options: yl.map((r) => ({ value: r.id, label: r.label })),
|
|
3241
3237
|
ariaLabel: "Date range",
|
|
3242
3238
|
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"
|
|
@@ -3245,16 +3241,16 @@ function hr({
|
|
|
3245
3241
|
b.map((r) => {
|
|
3246
3242
|
var d;
|
|
3247
3243
|
return /* @__PURE__ */ e(
|
|
3248
|
-
|
|
3244
|
+
pa,
|
|
3249
3245
|
{
|
|
3250
3246
|
reportId: t,
|
|
3251
3247
|
field: r.field,
|
|
3252
3248
|
label: r.label,
|
|
3253
3249
|
optionSource: r.options,
|
|
3254
|
-
allowedValues:
|
|
3255
|
-
selected: ((d =
|
|
3256
|
-
onChange: (x, v) => J((
|
|
3257
|
-
...
|
|
3250
|
+
allowedValues: ye[r.field],
|
|
3251
|
+
selected: ((d = me.find((x) => x.field === r.field)) == null ? void 0 : d.values) ?? [],
|
|
3252
|
+
onChange: (x, v) => J((C) => [
|
|
3253
|
+
...C.filter((M) => M.field !== r.field),
|
|
3258
3254
|
...x.length > 0 ? [{ field: r.field, values: x, labels: v }] : []
|
|
3259
3255
|
])
|
|
3260
3256
|
},
|
|
@@ -3265,11 +3261,11 @@ function hr({
|
|
|
3265
3261
|
"button",
|
|
3266
3262
|
{
|
|
3267
3263
|
type: "button",
|
|
3268
|
-
disabled: !
|
|
3269
|
-
onClick:
|
|
3264
|
+
disabled: !ne,
|
|
3265
|
+
onClick: ee,
|
|
3270
3266
|
className: P(
|
|
3271
3267
|
"inline-flex h-7 items-center gap-1 rounded-md px-2.5 text-[11.5px] font-semibold",
|
|
3272
|
-
|
|
3268
|
+
ne ? "bg-nvr-cyan text-white" : "bg-slate-100 text-slate-400 dark:bg-muted dark:text-slate-500"
|
|
3273
3269
|
),
|
|
3274
3270
|
children: [
|
|
3275
3271
|
/* @__PURE__ */ e(Ht, { className: "h-3 w-3" }),
|
|
@@ -3277,14 +3273,14 @@ function hr({
|
|
|
3277
3273
|
]
|
|
3278
3274
|
}
|
|
3279
3275
|
),
|
|
3280
|
-
(
|
|
3276
|
+
(T > 0 || ne) && /* @__PURE__ */ o(
|
|
3281
3277
|
"button",
|
|
3282
3278
|
{
|
|
3283
3279
|
type: "button",
|
|
3284
3280
|
className: "flex items-center gap-1 text-[11.5px] text-slate-400 hover:text-red-500",
|
|
3285
|
-
onClick:
|
|
3281
|
+
onClick: A,
|
|
3286
3282
|
children: [
|
|
3287
|
-
/* @__PURE__ */ e(
|
|
3283
|
+
/* @__PURE__ */ e(Re, { className: "h-3 w-3" }),
|
|
3288
3284
|
" Clear"
|
|
3289
3285
|
]
|
|
3290
3286
|
}
|
|
@@ -3296,30 +3292,30 @@ function hr({
|
|
|
3296
3292
|
{
|
|
3297
3293
|
className: "group/preset inline-flex h-6 items-center gap-1 rounded-full border border-slate-200 pl-2 pr-1 text-[11px] text-slate-500 hover:border-nvr-cyan hover:text-nvr-navy dark:border-border dark:hover:text-nvr-cyan",
|
|
3298
3294
|
children: [
|
|
3299
|
-
/* @__PURE__ */ e("button", { type: "button", onClick: () =>
|
|
3295
|
+
/* @__PURE__ */ e("button", { type: "button", onClick: () => U(r), children: r.name }),
|
|
3300
3296
|
/* @__PURE__ */ e(
|
|
3301
3297
|
"button",
|
|
3302
3298
|
{
|
|
3303
3299
|
type: "button",
|
|
3304
3300
|
title: "Delete preset",
|
|
3305
3301
|
className: "rounded-full p-0.5 text-slate-300 opacity-0 hover:text-red-500 group-hover/preset:opacity-100",
|
|
3306
|
-
onClick: () =>
|
|
3307
|
-
children: /* @__PURE__ */ e(
|
|
3302
|
+
onClick: () => xe.mutate(r.id),
|
|
3303
|
+
children: /* @__PURE__ */ e(Re, { className: "h-2.5 w-2.5" })
|
|
3308
3304
|
}
|
|
3309
3305
|
)
|
|
3310
3306
|
]
|
|
3311
3307
|
},
|
|
3312
3308
|
r.name
|
|
3313
3309
|
)),
|
|
3314
|
-
|
|
3310
|
+
k ? /* @__PURE__ */ e("span", { className: "inline-flex items-center gap-1", children: /* @__PURE__ */ e(
|
|
3315
3311
|
"input",
|
|
3316
3312
|
{
|
|
3317
|
-
value:
|
|
3318
|
-
onChange: (r) =>
|
|
3313
|
+
value: se,
|
|
3314
|
+
onChange: (r) => re(r.target.value),
|
|
3319
3315
|
placeholder: "Preset name",
|
|
3320
3316
|
autoFocus: !0,
|
|
3321
3317
|
onKeyDown: (r) => {
|
|
3322
|
-
r.key === "Enter" &&
|
|
3318
|
+
r.key === "Enter" && se.trim() && (V.mutate(se.trim()), re(""), F(!1)), r.key === "Escape" && F(!1);
|
|
3323
3319
|
},
|
|
3324
3320
|
className: "h-6 w-[130px] rounded-md border border-slate-200 bg-white px-2 text-[11px] dark:border-border dark:bg-card"
|
|
3325
3321
|
}
|
|
@@ -3328,7 +3324,7 @@ function hr({
|
|
|
3328
3324
|
{
|
|
3329
3325
|
type: "button",
|
|
3330
3326
|
className: "inline-flex h-6 items-center gap-1 rounded-full border border-dashed border-slate-200 px-2 text-[11px] text-slate-400 hover:border-slate-300 hover:text-slate-600 dark:border-border",
|
|
3331
|
-
onClick: () =>
|
|
3327
|
+
onClick: () => F(!0),
|
|
3332
3328
|
children: [
|
|
3333
3329
|
/* @__PURE__ */ e(Xt, { className: "h-2.5 w-2.5" }),
|
|
3334
3330
|
" Save preset"
|
|
@@ -3341,22 +3337,22 @@ function hr({
|
|
|
3341
3337
|
{
|
|
3342
3338
|
type: "button",
|
|
3343
3339
|
title: "Save the current numbers as a snapshot to compare against later",
|
|
3344
|
-
disabled:
|
|
3345
|
-
onClick: () =>
|
|
3340
|
+
disabled: I.isPending,
|
|
3341
|
+
onClick: () => I.mutate(),
|
|
3346
3342
|
className: "inline-flex h-6 items-center gap-1 rounded-full border border-dashed border-slate-200 px-2 text-[11px] text-slate-400 hover:border-slate-300 hover:text-slate-600 disabled:opacity-40 dark:border-border",
|
|
3347
3343
|
children: [
|
|
3348
3344
|
/* @__PURE__ */ e(Lt, { className: "h-2.5 w-2.5" }),
|
|
3349
3345
|
" ",
|
|
3350
|
-
|
|
3346
|
+
I.isPending ? "Saving…" : "Snapshot"
|
|
3351
3347
|
]
|
|
3352
3348
|
}
|
|
3353
3349
|
),
|
|
3354
|
-
|
|
3350
|
+
ke.map((r) => /* @__PURE__ */ o(
|
|
3355
3351
|
"button",
|
|
3356
3352
|
{
|
|
3357
3353
|
type: "button",
|
|
3358
3354
|
title: `Compare against ${r.name} (${sa(r.taken_at)})`,
|
|
3359
|
-
onClick: () =>
|
|
3355
|
+
onClick: () => j((d) => d === r.id ? null : r.id),
|
|
3360
3356
|
className: P(
|
|
3361
3357
|
"inline-flex h-6 items-center gap-1 rounded-full border px-2 text-[11px]",
|
|
3362
3358
|
Y === r.id ? "border-nvr-cyan/40 bg-nvr-cyan/[0.08] font-medium text-[#007a99] dark:text-nvr-cyan" : "border-slate-200 text-slate-400 hover:text-slate-600 dark:border-border"
|
|
@@ -3365,7 +3361,7 @@ function hr({
|
|
|
3365
3361
|
/* @__PURE__ */ e(Lt, { className: "h-2.5 w-2.5" }),
|
|
3366
3362
|
" ",
|
|
3367
3363
|
r.name,
|
|
3368
|
-
Y === r.id && /* @__PURE__ */ e(
|
|
3364
|
+
Y === r.id && /* @__PURE__ */ e(Re, { className: "h-2.5 w-2.5" })
|
|
3369
3365
|
]
|
|
3370
3366
|
},
|
|
3371
3367
|
r.id
|
|
@@ -3375,10 +3371,10 @@ function hr({
|
|
|
3375
3371
|
{
|
|
3376
3372
|
type: "button",
|
|
3377
3373
|
title: "Time machine (#404): show the snapshot values AS the numbers, not as delta badges",
|
|
3378
|
-
onClick: () =>
|
|
3374
|
+
onClick: () => pe((r) => !r),
|
|
3379
3375
|
className: P(
|
|
3380
3376
|
"inline-flex h-6 items-center gap-1 rounded-full border px-2 text-[11px]",
|
|
3381
|
-
|
|
3377
|
+
de ? "border-amber-400 bg-amber-50 font-medium text-amber-700 dark:bg-amber-400/10 dark:text-amber-400" : "border-dashed border-slate-200 text-slate-400 hover:text-slate-600 dark:border-border"
|
|
3382
3378
|
),
|
|
3383
3379
|
children: "As of"
|
|
3384
3380
|
}
|
|
@@ -3389,10 +3385,10 @@ function hr({
|
|
|
3389
3385
|
/* @__PURE__ */ e(
|
|
3390
3386
|
"input",
|
|
3391
3387
|
{
|
|
3392
|
-
value:
|
|
3393
|
-
onChange: (r) =>
|
|
3388
|
+
value: He,
|
|
3389
|
+
onChange: (r) => ut(r.target.value),
|
|
3394
3390
|
onKeyDown: (r) => {
|
|
3395
|
-
r.key === "Enter" &&
|
|
3391
|
+
r.key === "Enter" && z();
|
|
3396
3392
|
},
|
|
3397
3393
|
placeholder: 'Describe filters… e.g. "Zone 1 CRAN this year"',
|
|
3398
3394
|
className: "h-full min-w-0 flex-1 bg-transparent text-[11.5px] outline-none placeholder:text-slate-300 dark:text-slate-200"
|
|
@@ -3402,24 +3398,24 @@ function hr({
|
|
|
3402
3398
|
"button",
|
|
3403
3399
|
{
|
|
3404
3400
|
type: "button",
|
|
3405
|
-
disabled:
|
|
3406
|
-
onClick: () => void
|
|
3401
|
+
disabled: Xe || !He.trim(),
|
|
3402
|
+
onClick: () => void z(),
|
|
3407
3403
|
className: "text-[11px] font-semibold text-nvr-navy disabled:opacity-40 dark:text-nvr-cyan",
|
|
3408
|
-
children:
|
|
3404
|
+
children: Xe ? "…" : "Set"
|
|
3409
3405
|
}
|
|
3410
3406
|
)
|
|
3411
3407
|
] }),
|
|
3412
|
-
|
|
3408
|
+
pt && /* @__PURE__ */ e("span", { className: "text-[10.5px] text-red-400", children: pt })
|
|
3413
3409
|
] })
|
|
3414
3410
|
] }),
|
|
3415
|
-
|
|
3411
|
+
R.length > 0 && /* @__PURE__ */ o("div", { className: "mb-2 flex items-center gap-2 rounded-lg border border-red-300 bg-red-50 px-3 py-2 dark:border-red-500/40 dark:bg-red-500/10", children: [
|
|
3416
3412
|
/* @__PURE__ */ e(Zt, { className: "h-3.5 w-3.5 shrink-0 text-red-500" }),
|
|
3417
|
-
/* @__PURE__ */ e("p", { className: "min-w-0 flex-1 truncate text-[12px] text-red-700 dark:text-red-300", children:
|
|
3413
|
+
/* @__PURE__ */ e("p", { className: "min-w-0 flex-1 truncate text-[12px] text-red-700 dark:text-red-300", children: R.length === 1 ? `Alert firing: ${R[0].name}` : `${R.length} alerts firing: ${R.map((r) => r.name).join(" · ")}` })
|
|
3418
3414
|
] }),
|
|
3419
3415
|
/* @__PURE__ */ o("div", { className: "mb-2 flex flex-wrap items-center gap-2", children: [
|
|
3420
3416
|
/* @__PURE__ */ o("span", { className: "text-[10.5px] text-slate-400", children: [
|
|
3421
3417
|
"Data as of ",
|
|
3422
|
-
|
|
3418
|
+
it.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })
|
|
3423
3419
|
] }),
|
|
3424
3420
|
/* @__PURE__ */ o(
|
|
3425
3421
|
"button",
|
|
@@ -3433,21 +3429,21 @@ function hr({
|
|
|
3433
3429
|
]
|
|
3434
3430
|
}
|
|
3435
3431
|
),
|
|
3436
|
-
|
|
3432
|
+
_.some((r) => r.type === "query") && /* @__PURE__ */ o(
|
|
3437
3433
|
"button",
|
|
3438
3434
|
{
|
|
3439
3435
|
type: "button",
|
|
3440
|
-
onClick: () =>
|
|
3441
|
-
"aria-pressed":
|
|
3436
|
+
onClick: () => Je(!Ke),
|
|
3437
|
+
"aria-pressed": Ke,
|
|
3442
3438
|
"data-report-auto-refresh": !0,
|
|
3443
|
-
"data-tip":
|
|
3439
|
+
"data-tip": Ke ? "Query widgets re-run on their own when the data they read changes. Click to stop." : "Re-run query widgets on their own when the data they read changes",
|
|
3444
3440
|
className: P(
|
|
3445
3441
|
"inline-flex items-center gap-1 rounded-md border px-2 py-0.5 text-[11px]",
|
|
3446
|
-
|
|
3442
|
+
Ke ? "border-nvr-cyan/40 bg-nvr-cyan/[0.08] font-medium text-[#007a99] dark:text-nvr-cyan" : "border-slate-200 text-slate-500 hover:text-slate-700 dark:border-border dark:text-slate-400"
|
|
3447
3443
|
),
|
|
3448
3444
|
children: [
|
|
3449
3445
|
"Auto-refresh",
|
|
3450
|
-
|
|
3446
|
+
Ke ? " on" : ""
|
|
3451
3447
|
]
|
|
3452
3448
|
}
|
|
3453
3449
|
),
|
|
@@ -3456,30 +3452,30 @@ function hr({
|
|
|
3456
3452
|
"button",
|
|
3457
3453
|
{
|
|
3458
3454
|
type: "button",
|
|
3459
|
-
onClick: () =>
|
|
3455
|
+
onClick: () => ve((r) => !r),
|
|
3460
3456
|
className: P(
|
|
3461
3457
|
"inline-flex items-center gap-1 rounded-md border px-2 py-0.5 text-[11px]",
|
|
3462
|
-
|
|
3458
|
+
ce ? "border-nvr-cyan/40 bg-nvr-cyan/[0.08] font-medium text-[#007a99] dark:text-nvr-cyan" : "border-slate-200 text-slate-500 hover:text-slate-700 dark:border-border dark:text-slate-400"
|
|
3463
3459
|
),
|
|
3464
3460
|
children: [
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3461
|
+
ce ? `Comparing ${ce.a} vs ${ce.b}` : "Compare A/B",
|
|
3462
|
+
ce && /* @__PURE__ */ e(
|
|
3463
|
+
Re,
|
|
3468
3464
|
{
|
|
3469
3465
|
className: "h-2.5 w-2.5",
|
|
3470
3466
|
onClick: (r) => {
|
|
3471
|
-
r.stopPropagation(),
|
|
3467
|
+
r.stopPropagation(), dt(null);
|
|
3472
3468
|
}
|
|
3473
3469
|
}
|
|
3474
3470
|
)
|
|
3475
3471
|
]
|
|
3476
3472
|
}
|
|
3477
3473
|
),
|
|
3478
|
-
|
|
3474
|
+
Ve && /* @__PURE__ */ o("span", { className: "absolute left-0 top-full z-50 mt-1 flex w-72 flex-col gap-1.5 rounded-xl border border-slate-200 bg-white p-2.5 shadow-lg dark:border-border dark:bg-card", children: [
|
|
3479
3475
|
/* @__PURE__ */ e(
|
|
3480
3476
|
"input",
|
|
3481
3477
|
{
|
|
3482
|
-
value:
|
|
3478
|
+
value: G,
|
|
3483
3479
|
onChange: (r) => yt(r.target.value),
|
|
3484
3480
|
placeholder: "Filter field (e.g. division)",
|
|
3485
3481
|
className: "h-7 rounded-md border border-slate-200 bg-white px-2 text-[12px] dark:border-border dark:bg-card dark:text-slate-200"
|
|
@@ -3489,7 +3485,7 @@ function hr({
|
|
|
3489
3485
|
/* @__PURE__ */ e(
|
|
3490
3486
|
"input",
|
|
3491
3487
|
{
|
|
3492
|
-
value:
|
|
3488
|
+
value: Ye,
|
|
3493
3489
|
onChange: (r) => kt(r.target.value),
|
|
3494
3490
|
placeholder: "Value A",
|
|
3495
3491
|
className: "h-7 min-w-0 flex-1 rounded-md border border-slate-200 bg-white px-2 text-[12px] dark:border-border dark:bg-card dark:text-slate-200"
|
|
@@ -3498,7 +3494,7 @@ function hr({
|
|
|
3498
3494
|
/* @__PURE__ */ e(
|
|
3499
3495
|
"input",
|
|
3500
3496
|
{
|
|
3501
|
-
value:
|
|
3497
|
+
value: Ge,
|
|
3502
3498
|
onChange: (r) => Nt(r.target.value),
|
|
3503
3499
|
placeholder: "Value B",
|
|
3504
3500
|
className: "h-7 min-w-0 flex-1 rounded-md border border-slate-200 bg-white px-2 text-[12px] dark:border-border dark:bg-card dark:text-slate-200"
|
|
@@ -3509,9 +3505,9 @@ function hr({
|
|
|
3509
3505
|
"button",
|
|
3510
3506
|
{
|
|
3511
3507
|
type: "button",
|
|
3512
|
-
disabled: !
|
|
3508
|
+
disabled: !G.trim() || !Ye.trim() || !Ge.trim(),
|
|
3513
3509
|
onClick: () => {
|
|
3514
|
-
|
|
3510
|
+
dt({ field: G.trim(), a: Ye.trim(), b: Ge.trim() }), ve(!1);
|
|
3515
3511
|
},
|
|
3516
3512
|
className: "h-7 rounded-md bg-nvr-cyan text-[11.5px] font-semibold text-white hover:brightness-110 disabled:opacity-40",
|
|
3517
3513
|
children: "Compare"
|
|
@@ -3520,7 +3516,7 @@ function hr({
|
|
|
3520
3516
|
] })
|
|
3521
3517
|
] })
|
|
3522
3518
|
] }),
|
|
3523
|
-
|
|
3519
|
+
H.filter((r) => !b.some((d) => d.field === r.field)).length > 0 && /* @__PURE__ */ e("div", { className: "flex flex-wrap items-center gap-1.5 px-1 pb-2", children: H.filter((r) => !b.some((d) => d.field === r.field)).map((r) => /* @__PURE__ */ o(
|
|
3524
3520
|
"span",
|
|
3525
3521
|
{
|
|
3526
3522
|
className: "inline-flex items-center gap-1.5 rounded-full border border-nvr-cyan/40 bg-nvr-cyan/[0.08] py-0.5 pl-2.5 pr-1 text-[11.5px] text-[#007a99] dark:text-nvr-cyan",
|
|
@@ -3534,25 +3530,25 @@ function hr({
|
|
|
3534
3530
|
type: "button",
|
|
3535
3531
|
"aria-label": "Remove filter",
|
|
3536
3532
|
onClick: () => {
|
|
3537
|
-
|
|
3533
|
+
q((d) => d.filter((x) => x.field !== r.field)), J((d) => d.filter((x) => x.field !== r.field));
|
|
3538
3534
|
},
|
|
3539
3535
|
className: "rounded-full p-0.5 hover:bg-nvr-cyan/[0.16]",
|
|
3540
|
-
children: /* @__PURE__ */ e(
|
|
3536
|
+
children: /* @__PURE__ */ e(Re, { className: "h-2.5 w-2.5" })
|
|
3541
3537
|
}
|
|
3542
3538
|
)
|
|
3543
3539
|
]
|
|
3544
3540
|
},
|
|
3545
3541
|
r.field
|
|
3546
3542
|
)) }),
|
|
3547
|
-
(
|
|
3543
|
+
(oe == null ? void 0 : oe.editable) && /* @__PURE__ */ e("div", { className: "mb-2 flex items-center gap-1.5", children: ge ? /* @__PURE__ */ o(We, { children: [
|
|
3548
3544
|
/* @__PURE__ */ e(
|
|
3549
3545
|
"button",
|
|
3550
3546
|
{
|
|
3551
3547
|
type: "button",
|
|
3552
|
-
disabled:
|
|
3553
|
-
onClick: () =>
|
|
3548
|
+
disabled: ot.isPending,
|
|
3549
|
+
onClick: () => Se && ot.mutate(Se),
|
|
3554
3550
|
className: "rounded-md bg-nvr-cyan px-3 py-1 text-[12px] font-semibold text-white hover:brightness-110 disabled:opacity-40",
|
|
3555
|
-
children:
|
|
3551
|
+
children: ot.isPending ? "Saving…" : "Save layout"
|
|
3556
3552
|
}
|
|
3557
3553
|
),
|
|
3558
3554
|
/* @__PURE__ */ e(
|
|
@@ -3560,7 +3556,7 @@ function hr({
|
|
|
3560
3556
|
{
|
|
3561
3557
|
type: "button",
|
|
3562
3558
|
onClick: () => {
|
|
3563
|
-
|
|
3559
|
+
Be(!1), Fe(null), Qe(null);
|
|
3564
3560
|
},
|
|
3565
3561
|
className: "rounded-md border border-slate-200 px-3 py-1 text-[12px] text-slate-500 dark:border-border",
|
|
3566
3562
|
children: "Cancel"
|
|
@@ -3576,34 +3572,34 @@ function hr({
|
|
|
3576
3572
|
children: "Edit report"
|
|
3577
3573
|
}
|
|
3578
3574
|
) }),
|
|
3579
|
-
|
|
3575
|
+
ge && Se && /* @__PURE__ */ e("div", { className: "mb-3", children: /* @__PURE__ */ e(Rt, { fallback: null, children: /* @__PURE__ */ e(
|
|
3580
3576
|
bl,
|
|
3581
3577
|
{
|
|
3582
|
-
maxY: Math.max(0, ...
|
|
3583
|
-
onAdd: (r) =>
|
|
3578
|
+
maxY: Math.max(0, ...Se.map((r) => (r.y ?? 0) + (r.h ?? 1))),
|
|
3579
|
+
onAdd: (r) => Fe((d) => [...d ?? [], r])
|
|
3584
3580
|
}
|
|
3585
3581
|
) }) }),
|
|
3586
|
-
|
|
3582
|
+
_.length === 0 && !ge ? /* @__PURE__ */ e("div", { className: "p-6 text-[13px] text-slate-400", children: h ?? "This report has no widgets yet." }) : /* @__PURE__ */ e(
|
|
3587
3583
|
"div",
|
|
3588
3584
|
{
|
|
3589
3585
|
className: "grid gap-3",
|
|
3590
3586
|
style: {
|
|
3591
3587
|
gridTemplateColumns: "repeat(12, minmax(0, 1fr))",
|
|
3592
|
-
gridAutoRows:
|
|
3588
|
+
gridAutoRows: ge ? void 0 : "72px"
|
|
3593
3589
|
},
|
|
3594
|
-
children:
|
|
3590
|
+
children: Ue(ge && Se ? Se : _).map((r) => {
|
|
3595
3591
|
var d;
|
|
3596
3592
|
return /* @__PURE__ */ e(
|
|
3597
3593
|
"div",
|
|
3598
3594
|
{
|
|
3599
3595
|
style: {
|
|
3600
|
-
gridColumn:
|
|
3596
|
+
gridColumn: ce ? "1 / -1" : `${Math.max(1, (r.x ?? 0) + 1)} / span ${Math.min(12, Math.max(2, r.w || 4))}`,
|
|
3601
3597
|
gridRow: void 0
|
|
3602
3598
|
},
|
|
3603
|
-
className:
|
|
3604
|
-
children:
|
|
3599
|
+
className: ge || ce ? "" : "contents",
|
|
3600
|
+
children: ce && !ge && r.type !== "divider" ? /* @__PURE__ */ e("div", { className: "grid grid-cols-2 gap-3", children: [ce.a, ce.b].map((x, v) => /* @__PURE__ */ o("div", { className: "flex min-h-[160px] flex-col", children: [
|
|
3605
3601
|
/* @__PURE__ */ o("p", { className: "mb-1 text-[10.5px] font-semibold uppercase tracking-wide text-[#007a99] dark:text-nvr-cyan", children: [
|
|
3606
|
-
|
|
3602
|
+
ce.field.replace(/_/g, " "),
|
|
3607
3603
|
": ",
|
|
3608
3604
|
x
|
|
3609
3605
|
] }),
|
|
@@ -3614,22 +3610,22 @@ function hr({
|
|
|
3614
3610
|
widget: r,
|
|
3615
3611
|
dateRange: i,
|
|
3616
3612
|
entityFilters: [
|
|
3617
|
-
...
|
|
3618
|
-
{ field:
|
|
3613
|
+
...H.filter((C) => C.field !== ce.field),
|
|
3614
|
+
{ field: ce.field, values: [x], labels: [x] }
|
|
3619
3615
|
],
|
|
3620
3616
|
refetchInterval: c,
|
|
3621
3617
|
filterBar: b,
|
|
3622
3618
|
onDrill: Q
|
|
3623
3619
|
}
|
|
3624
3620
|
)
|
|
3625
|
-
] }, v)) }) : /* @__PURE__ */ o(
|
|
3626
|
-
|
|
3621
|
+
] }, v)) }) : /* @__PURE__ */ o(We, { children: [
|
|
3622
|
+
ge && /* @__PURE__ */ e(Rt, { fallback: null, children: /* @__PURE__ */ e(
|
|
3627
3623
|
vl,
|
|
3628
3624
|
{
|
|
3629
3625
|
widget: r,
|
|
3630
|
-
onConfigure: () =>
|
|
3631
|
-
onDelete: () =>
|
|
3632
|
-
onResize: (x, v) =>
|
|
3626
|
+
onConfigure: () => Qe(r.id),
|
|
3627
|
+
onDelete: () => Fe((x) => (x ?? []).filter((v) => v.id !== r.id)),
|
|
3628
|
+
onResize: (x, v) => ct({
|
|
3633
3629
|
...r,
|
|
3634
3630
|
w: Math.min(12, Math.max(2, (r.w || 4) + x)),
|
|
3635
3631
|
h: Math.min(8, Math.max(1, (r.h || 2) + v))
|
|
@@ -3643,18 +3639,18 @@ function hr({
|
|
|
3643
3639
|
reportId: t,
|
|
3644
3640
|
widget: r,
|
|
3645
3641
|
dateRange: i,
|
|
3646
|
-
entityFilters:
|
|
3642
|
+
entityFilters: H,
|
|
3647
3643
|
refetchInterval: c,
|
|
3648
3644
|
filterBar: b,
|
|
3649
3645
|
onDrill: Q,
|
|
3650
|
-
snapshot:
|
|
3651
|
-
asOf:
|
|
3652
|
-
annotations:
|
|
3653
|
-
onAddAnnotation: (x, v,
|
|
3654
|
-
onDeleteAnnotation: (x) =>
|
|
3655
|
-
onCrossFilter:
|
|
3646
|
+
snapshot: w && w.data[r.id] !== void 0 ? { name: w.name, value: ((d = w.data[r.id]) == null ? void 0 : d.value) ?? null } : null,
|
|
3647
|
+
asOf: de,
|
|
3648
|
+
annotations: ae.filter((x) => x.widget === r.id),
|
|
3649
|
+
onAddAnnotation: (x, v, C) => Le.mutate({ widget: x, note: v, anchor_date: C }),
|
|
3650
|
+
onDeleteAnnotation: (x) => Ce.mutate(x),
|
|
3651
|
+
onCrossFilter: Oe,
|
|
3656
3652
|
reportUrl: g,
|
|
3657
|
-
currentFilters:
|
|
3653
|
+
currentFilters: H
|
|
3658
3654
|
}
|
|
3659
3655
|
)
|
|
3660
3656
|
] })
|
|
@@ -3664,40 +3660,39 @@ function hr({
|
|
|
3664
3660
|
})
|
|
3665
3661
|
}
|
|
3666
3662
|
),
|
|
3667
|
-
|
|
3663
|
+
ge && st && (Se == null ? void 0 : Se.some((r) => r.id === st)) && /* @__PURE__ */ e(Rt, { fallback: null, children: /* @__PURE__ */ e(
|
|
3668
3664
|
gl,
|
|
3669
3665
|
{
|
|
3670
|
-
widget:
|
|
3671
|
-
allWidgets:
|
|
3672
|
-
onChange:
|
|
3673
|
-
onClose: () =>
|
|
3666
|
+
widget: Se.find((r) => r.id === st),
|
|
3667
|
+
allWidgets: Se,
|
|
3668
|
+
onChange: ct,
|
|
3669
|
+
onClose: () => Qe(null)
|
|
3674
3670
|
}
|
|
3675
3671
|
) }),
|
|
3676
|
-
/* @__PURE__ */ e(
|
|
3677
|
-
!
|
|
3678
|
-
|
|
3672
|
+
/* @__PURE__ */ e(il, {}),
|
|
3673
|
+
!K && (y != null && y.length) ? /* @__PURE__ */ e(
|
|
3674
|
+
ol,
|
|
3679
3675
|
{
|
|
3680
3676
|
collection: y[0].collection,
|
|
3681
3677
|
itemId: y[0].itemId,
|
|
3682
3678
|
title: y[0].title,
|
|
3683
3679
|
width: "72%",
|
|
3684
3680
|
stack: y,
|
|
3685
|
-
onPush: (r) =>
|
|
3686
|
-
onPop: () =>
|
|
3687
|
-
onClose: () =>
|
|
3681
|
+
onPush: (r) => L.push([...y, r]),
|
|
3682
|
+
onPop: () => L.back(),
|
|
3683
|
+
onClose: () => L.back(y.length)
|
|
3688
3684
|
}
|
|
3689
3685
|
) : null
|
|
3690
3686
|
] }) });
|
|
3691
3687
|
}
|
|
3692
3688
|
export {
|
|
3693
3689
|
Ll as AlertBell,
|
|
3694
|
-
|
|
3690
|
+
ue as CHART_COLORS,
|
|
3695
3691
|
kl as NO_WORKFLOW_NUMBER,
|
|
3696
3692
|
Al as QueryWidgetBody,
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3693
|
+
fr as ReportView,
|
|
3694
|
+
hr as ReportWidgetCard,
|
|
3695
|
+
Pl as adminAccessScopeNote,
|
|
3700
3696
|
ze as fmtCell,
|
|
3701
|
-
|
|
3702
|
-
Pl as shortCategoryLabel
|
|
3697
|
+
fa as shapeQueryRows
|
|
3703
3698
|
};
|