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