@nivaro/react 0.3.57 → 0.3.59
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/fields/RelationField.js +110 -80
- package/dist/full.css +1 -1
- package/dist/hooks/useRelationOptions.js +1 -0
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +37 -2
- package/dist/index.js +523 -520
- package/dist/shared/components/CollectionBrowserView.js +2693 -2619
- package/dist/shared/components/DataTable.js +538 -495
- package/dist/shared/components/ItemEditForm.js +4559 -4386
- package/dist/shared/components/PageRenderer.js +537 -508
- package/dist/shared/components/ProfileView.js +716 -715
- package/dist/shared/components/QueryTable.js +74 -74
- package/dist/shared/components/RecordReadView.js +367 -364
- package/dist/shared/components/ReportView.js +64 -39
- package/dist/shared/components/WidgetSlot.js +543 -520
- package/dist/shared/components/alerts/AlertManagerView.js +324 -317
- package/dist/shared/components/alerts/types.js +37 -14
- package/dist/shared/components/cbv/row-focus.js +19 -0
- package/dist/shared/components/help-videos/HelpVideoPlayer.js +152 -147
- package/dist/shared/components/integrations/console/SignalCard.js +59 -59
- package/dist/shared/components/integrations/console/tone.js +52 -30
- package/dist/shared/components/item-edit/CatalogPickerField.js +525 -505
- package/dist/shared/components/item-edit/FieldRenderer.js +22 -20
- package/dist/shared/components/item-edit/FieldRow.js +175 -173
- package/dist/shared/components/item-edit/GridBulkEditDialog.js +55 -54
- package/dist/shared/components/item-edit/InlineTableField.js +2487 -2442
- package/dist/shared/components/item-edit/M2MCombobox.js +321 -295
- package/dist/shared/components/item-edit/MidairCollisionDialog.js +1 -1
- package/dist/shared/components/item-edit/PlanGrid.js +973 -894
- package/dist/shared/components/item-edit/QuickCreateButton.js +335 -106
- package/dist/shared/components/item-edit/RecordLiveSync.js +77 -75
- package/dist/shared/components/item-edit/RelationCombobox.js +452 -335
- package/dist/shared/components/item-edit/RelationGroupedCombobox.js +262 -141
- package/dist/shared/components/item-edit/SummaryPanel.js +385 -358
- package/dist/shared/components/item-edit/duplicate-rehearsal.js +47 -0
- package/dist/shared/components/item-edit/line-midair.js +82 -75
- package/dist/shared/components/item-edit/option-disambiguate.js +44 -32
- package/dist/shared/components/item-edit/related-missing.js +45 -0
- package/dist/shared/components/item-edit/save-outcome.js +9 -7
- package/dist/shared/components/notifications/NotificationRulesEditor.js +130 -123
- package/dist/shared/components/panels/AccessDeniedPanel.js +52 -48
- package/dist/shared/components/panels/ItemLockBanner.js +213 -211
- package/dist/shared/components/panels/PipelinePanel.js +1140 -1053
- package/dist/shared/components/panels/RecordIntegrityBanner.js +114 -86
- package/dist/shared/components/panels/RevisionsPanel.js +316 -299
- package/dist/shared/components/panels/TaskPanel.js +265 -249
- package/dist/shared/components/panels/landing-state.js +27 -0
- package/dist/shared/components/pipeline/PipelineEditorView.js +110 -92
- package/dist/shared/components/profile/AiMemoryCard.js +12 -10
- package/dist/shared/components/queue/OwnerAvatars.js +80 -41
- package/dist/shared/components/queue/QueueQuickFilters.js +52 -52
- package/dist/shared/components/queue/QueueWorklist.js +1050 -1026
- package/dist/shared/components/queue/group-sums.js +27 -0
- package/dist/shared/components/queue/live-state-aspect.js +9 -5
- package/dist/shared/components/widgets/ReviewListWidget.js +175 -154
- package/dist/shared/lib/back-closes.js +25 -0
- package/dist/shared/lib/display-prefs.js +60 -52
- package/dist/shared/lib/draft-store.js +71 -48
- package/dist/shared/lib/expression.js +53 -53
- package/dist/shared/lib/form-usage-beacon.js +7 -7
- package/dist/shared/lib/list-page-memory.js +63 -0
- package/dist/shared/lib/live.js +44 -44
- package/dist/shared/lib/money-input.js +45 -0
- package/dist/shared/lib/own-writes.js +76 -28
- package/dist/shared/lib/request-gate.js +110 -109
- package/dist/shared/lib/sanitize-html.js +10 -6
- package/dist/shared/lib/staged-row-labels.js +18 -0
- package/dist/shared/lib/validation-rules.js +34 -19
- package/package.json +1 -1
|
@@ -1,44 +1,45 @@
|
|
|
1
|
-
import { jsx as t, jsxs as l, Fragment as
|
|
2
|
-
import { listNotificationSubscriptions as ut, deleteNotificationSubscription as
|
|
3
|
-
import { useQueryClient as
|
|
4
|
-
import { LayoutGrid as Te, Bell as $e, BellRing as
|
|
5
|
-
import { useState as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
1
|
+
import { jsx as t, jsxs as l, Fragment as mt } from "react/jsx-runtime";
|
|
2
|
+
import { listNotificationSubscriptions as ut, deleteNotificationSubscription as ht } from "@nivaro/sdk";
|
|
3
|
+
import { useQueryClient as pt, useQuery as y, useMutation as oe } from "@tanstack/react-query";
|
|
4
|
+
import { LayoutGrid as Te, Bell as $e, BellRing as ce, Clock as xt, ChartColumn as bt, History as Re, FlaskConical as qe, Activity as gt, Plus as me, Gauge as ft, Users as vt, Lock as yt, Pencil as ue, Trash2 as L, Siren as De } from "lucide-react";
|
|
5
|
+
import { useState as _, useMemo as z } from "react";
|
|
6
|
+
import { toast as Fe } from "sonner";
|
|
7
|
+
import { useNivaroClient as kt } from "../../context.js";
|
|
8
|
+
import { useMyScopes as Nt, matchScopeDimension as wt, effectiveScopeSeedIds as _t, translateScopeValues as At } from "../../lib/use-my-scopes.js";
|
|
8
9
|
import { cn as i } from "../../lib/utils.js";
|
|
9
|
-
import { ToggleSwitch as
|
|
10
|
-
import { OPERATOR_LABELS as
|
|
11
|
-
function
|
|
10
|
+
import { ToggleSwitch as S, SelectInput as Le, AlertRuleDrawer as Ct, AnomalyRuleDrawer as St, NotifSubEditDrawer as Et } from "./drawers.js";
|
|
11
|
+
import { categoryLabel as Tt, OPERATOR_LABELS as be, fmtMetric as A, fmtDateTime as O, reportConditionText as $t } from "./types.js";
|
|
12
|
+
function Rt(s, d) {
|
|
12
13
|
const n = (d ?? []).find(
|
|
13
|
-
(
|
|
14
|
-
var
|
|
15
|
-
return
|
|
14
|
+
(m) => {
|
|
15
|
+
var T;
|
|
16
|
+
return m && (m.field === s || ((T = m.options) == null ? void 0 : T.collection) === s) && m.label;
|
|
16
17
|
}
|
|
17
18
|
);
|
|
18
19
|
if (n != null && n.label) return n.label;
|
|
19
|
-
const
|
|
20
|
-
return
|
|
20
|
+
const h = String(s ?? "").replace(/_/g, " ").trim();
|
|
21
|
+
return h ? h.charAt(0).toUpperCase() + h.slice(1) : "Filter";
|
|
21
22
|
}
|
|
22
|
-
function
|
|
23
|
-
return s != null && s.length ? s.map((n) => `${
|
|
23
|
+
function qt(s, d) {
|
|
24
|
+
return s != null && s.length ? s.map((n) => `${Rt(n.field, d)}: ${(n.labels ?? n.values).join(", ")}`).join(" · ") : "All data";
|
|
24
25
|
}
|
|
25
|
-
const
|
|
26
|
+
const Dt = {
|
|
26
27
|
budget: "bg-orange-50 text-orange-600 dark:bg-orange-500/10 dark:text-orange-400",
|
|
27
28
|
workflows: "bg-sky-50 text-sky-600 dark:bg-sky-500/10 dark:text-sky-400",
|
|
28
29
|
inventory: "bg-emerald-50 text-emerald-600 dark:bg-emerald-500/10 dark:text-emerald-400",
|
|
29
30
|
sla: "bg-pink-50 text-pink-600 dark:bg-pink-500/10 dark:text-pink-400",
|
|
30
31
|
compliance: "bg-violet-50 text-violet-600 dark:bg-violet-500/10 dark:text-violet-400",
|
|
31
32
|
spend: "bg-amber-50 text-amber-600 dark:bg-amber-500/10 dark:text-amber-400"
|
|
32
|
-
},
|
|
33
|
-
"inline-flex rounded-full px-2 py-px text-[10.5px] font-semibold
|
|
34
|
-
|
|
33
|
+
}, Ft = (s) => i(
|
|
34
|
+
"inline-flex rounded-full px-2 py-px text-[10.5px] font-semibold",
|
|
35
|
+
Dt[s] ?? "bg-slate-100 text-slate-600 dark:bg-muted dark:text-slate-300"
|
|
35
36
|
);
|
|
36
|
-
function
|
|
37
|
+
function j({ status: s }) {
|
|
37
38
|
return /* @__PURE__ */ t(
|
|
38
39
|
"span",
|
|
39
40
|
{
|
|
40
41
|
className: i(
|
|
41
|
-
"inline-flex rounded-full px-2 py-px text-[10.5px] font-semibold
|
|
42
|
+
"inline-flex rounded-full px-2 py-px text-[10.5px] font-semibold",
|
|
42
43
|
{
|
|
43
44
|
active: "bg-emerald-50 text-emerald-600 dark:bg-emerald-500/10 dark:text-emerald-400",
|
|
44
45
|
resolved: "bg-emerald-50 text-emerald-600 dark:bg-emerald-500/10 dark:text-emerald-400",
|
|
@@ -53,13 +54,13 @@ function M({ status: s }) {
|
|
|
53
54
|
}
|
|
54
55
|
);
|
|
55
56
|
}
|
|
56
|
-
function
|
|
57
|
+
function Y(s) {
|
|
57
58
|
return s.created_by ?? null;
|
|
58
59
|
}
|
|
59
|
-
function
|
|
60
|
+
function he({ on: s }) {
|
|
60
61
|
return /* @__PURE__ */ t("span", { className: "text-[11.5px] text-slate-500 dark:text-slate-400", children: s ? "On" : "Off" });
|
|
61
62
|
}
|
|
62
|
-
function
|
|
63
|
+
function D({ n: s, tone: d }) {
|
|
63
64
|
return s ? /* @__PURE__ */ t(
|
|
64
65
|
"span",
|
|
65
66
|
{
|
|
@@ -76,41 +77,41 @@ function F({ n: s, tone: d }) {
|
|
|
76
77
|
}
|
|
77
78
|
) : null;
|
|
78
79
|
}
|
|
79
|
-
const
|
|
80
|
-
function
|
|
80
|
+
const Lt = "px-3 py-2 text-left text-[10px] font-semibold uppercase tracking-wider text-slate-400 dark:text-slate-500", r = "px-3 py-2.5 align-middle text-[12px] text-slate-600 dark:text-slate-300", jt = i(r, "font-mono tabular-nums text-slate-800 dark:text-slate-100"), w = "inline-flex h-7 w-7 items-center justify-center rounded-md border border-slate-200 text-slate-400 transition-colors hover:border-slate-300 hover:bg-slate-50 hover:text-slate-700 dark:border-border dark:hover:bg-muted/50 dark:hover:text-slate-200";
|
|
81
|
+
function J(s) {
|
|
81
82
|
const d = Date.now() - new Date(s).getTime();
|
|
82
83
|
if (!Number.isFinite(d)) return null;
|
|
83
84
|
const n = Math.floor(d / 6e4);
|
|
84
85
|
if (n < 0) return null;
|
|
85
86
|
if (n < 1) return "just now";
|
|
86
87
|
if (n < 60) return `${n}m ago`;
|
|
87
|
-
const
|
|
88
|
-
if (
|
|
89
|
-
const
|
|
90
|
-
return
|
|
88
|
+
const h = Math.floor(n / 60);
|
|
89
|
+
if (h < 24) return `${h}h ago`;
|
|
90
|
+
const m = Math.floor(h / 24);
|
|
91
|
+
return m < 30 ? `${m}d ago` : null;
|
|
91
92
|
}
|
|
92
|
-
function
|
|
93
|
+
function je(s, d) {
|
|
93
94
|
const n = new Date(d).getTime() - new Date(s).getTime();
|
|
94
95
|
if (!Number.isFinite(n) || n <= 0) return null;
|
|
95
|
-
const
|
|
96
|
-
if (
|
|
97
|
-
const
|
|
98
|
-
return
|
|
96
|
+
const h = Math.round(n / 6e4);
|
|
97
|
+
if (h < 60) return `${h}m`;
|
|
98
|
+
const m = Math.round(h / 60);
|
|
99
|
+
return m < 48 ? `${m}h` : `${Math.round(m / 24)}d`;
|
|
99
100
|
}
|
|
100
|
-
function
|
|
101
|
+
function pe({ value: s, className: d }) {
|
|
101
102
|
if (!s) return /* @__PURE__ */ t("span", { className: "text-slate-300 dark:text-slate-600", children: "—" });
|
|
102
|
-
const n =
|
|
103
|
+
const n = J(s);
|
|
103
104
|
return /* @__PURE__ */ l("span", { className: i("block leading-tight", d), children: [
|
|
104
|
-
/* @__PURE__ */ t("span", { className: "block whitespace-nowrap text-[11.5px] text-slate-600 dark:text-slate-300", children:
|
|
105
|
+
/* @__PURE__ */ t("span", { className: "block whitespace-nowrap text-[11.5px] text-slate-600 dark:text-slate-300", children: O(s) }),
|
|
105
106
|
n && /* @__PURE__ */ t("span", { className: "block text-[10.5px] text-slate-500 dark:text-slate-400", children: n })
|
|
106
107
|
] });
|
|
107
108
|
}
|
|
108
|
-
function
|
|
109
|
+
function Ot({
|
|
109
110
|
value: s,
|
|
110
111
|
threshold: d,
|
|
111
112
|
unit: n,
|
|
112
|
-
operator:
|
|
113
|
-
breaching:
|
|
113
|
+
operator: h,
|
|
114
|
+
breaching: m
|
|
114
115
|
}) {
|
|
115
116
|
return /* @__PURE__ */ l("span", { className: "flex items-baseline gap-1.5 font-mono tabular-nums", children: [
|
|
116
117
|
/* @__PURE__ */ t(
|
|
@@ -118,31 +119,31 @@ function jt({
|
|
|
118
119
|
{
|
|
119
120
|
className: i(
|
|
120
121
|
"text-[12.5px] font-semibold",
|
|
121
|
-
|
|
122
|
+
m ? "text-red-600 dark:text-red-400" : "text-slate-800 dark:text-slate-100"
|
|
122
123
|
),
|
|
123
|
-
children:
|
|
124
|
+
children: A(s, n ?? void 0)
|
|
124
125
|
}
|
|
125
126
|
),
|
|
126
127
|
/* @__PURE__ */ l("span", { className: "text-[10.5px] text-slate-400 dark:text-slate-500", children: [
|
|
127
|
-
|
|
128
|
-
|
|
128
|
+
h ? `${be[h] ?? h} ` : "/ ",
|
|
129
|
+
A(d, n ?? void 0)
|
|
129
130
|
] })
|
|
130
131
|
] });
|
|
131
132
|
}
|
|
132
|
-
function
|
|
133
|
+
function Mt({
|
|
133
134
|
operator: s,
|
|
134
135
|
threshold: d,
|
|
135
136
|
unit: n
|
|
136
137
|
}) {
|
|
137
138
|
return /* @__PURE__ */ l("span", { className: "inline-flex items-center gap-1 rounded-md border border-slate-200 bg-slate-50 px-1.5 py-0.5 font-mono text-[11.5px] tabular-nums text-slate-700 dark:border-border dark:bg-muted/40 dark:text-slate-200", children: [
|
|
138
|
-
/* @__PURE__ */ t("span", { className: "text-slate-400 dark:text-slate-500", children:
|
|
139
|
-
|
|
139
|
+
/* @__PURE__ */ t("span", { className: "text-slate-400 dark:text-slate-500", children: be[s] ?? s }),
|
|
140
|
+
A(d, n ?? void 0)
|
|
140
141
|
] });
|
|
141
142
|
}
|
|
142
|
-
function
|
|
143
|
-
const [d, n] =
|
|
143
|
+
function Pt({ text: s }) {
|
|
144
|
+
const [d, n] = _(!1);
|
|
144
145
|
if (!s) return /* @__PURE__ */ t("span", { className: "text-slate-300 dark:text-slate-600", children: "—" });
|
|
145
|
-
const
|
|
146
|
+
const h = s.length > 120;
|
|
146
147
|
return /* @__PURE__ */ l("span", { className: "block", children: [
|
|
147
148
|
/* @__PURE__ */ t(
|
|
148
149
|
"span",
|
|
@@ -154,23 +155,23 @@ function Mt({ text: s }) {
|
|
|
154
155
|
children: s
|
|
155
156
|
}
|
|
156
157
|
),
|
|
157
|
-
|
|
158
|
+
h && /* @__PURE__ */ t(
|
|
158
159
|
"button",
|
|
159
160
|
{
|
|
160
161
|
type: "button",
|
|
161
|
-
onClick: () => n((
|
|
162
|
+
onClick: () => n((m) => !m),
|
|
162
163
|
className: "mt-0.5 text-[11px] font-medium text-slate-400 underline decoration-slate-300 underline-offset-2 transition-colors hover:text-slate-600 dark:hover:text-slate-200",
|
|
163
164
|
children: d ? "Show less" : "Show more"
|
|
164
165
|
}
|
|
165
166
|
)
|
|
166
167
|
] });
|
|
167
168
|
}
|
|
168
|
-
function
|
|
169
|
+
function xe({
|
|
169
170
|
title: s,
|
|
170
171
|
hint: d,
|
|
171
172
|
action: n,
|
|
172
|
-
wide:
|
|
173
|
-
children:
|
|
173
|
+
wide: h,
|
|
174
|
+
children: m
|
|
174
175
|
}) {
|
|
175
176
|
return (
|
|
176
177
|
// Capped and LEFT-aligned, never centred: six columns of short data on a
|
|
@@ -179,7 +180,7 @@ function be({
|
|
|
179
180
|
/* @__PURE__ */ l(
|
|
180
181
|
"section",
|
|
181
182
|
{
|
|
182
|
-
className: i("flex min-h-0 flex-col gap-2",
|
|
183
|
+
className: i("flex min-h-0 flex-col gap-2", h ? "max-w-[1560px]" : "max-w-[1180px]"),
|
|
183
184
|
children: [
|
|
184
185
|
/* @__PURE__ */ l("header", { className: "flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1", children: [
|
|
185
186
|
/* @__PURE__ */ l("div", { className: "flex items-baseline gap-2.5", children: [
|
|
@@ -188,131 +189,131 @@ function be({
|
|
|
188
189
|
] }),
|
|
189
190
|
n
|
|
190
191
|
] }),
|
|
191
|
-
|
|
192
|
+
m
|
|
192
193
|
]
|
|
193
194
|
}
|
|
194
195
|
)
|
|
195
196
|
);
|
|
196
197
|
}
|
|
197
|
-
function
|
|
198
|
+
function E({
|
|
198
199
|
headers: s,
|
|
199
200
|
children: d,
|
|
200
201
|
empty: n,
|
|
201
|
-
emptyHint:
|
|
202
|
-
emptyIcon:
|
|
203
|
-
emptyAction:
|
|
204
|
-
loading:
|
|
202
|
+
emptyHint: h,
|
|
203
|
+
emptyIcon: m,
|
|
204
|
+
emptyAction: T,
|
|
205
|
+
loading: C
|
|
205
206
|
}) {
|
|
206
|
-
const g = !
|
|
207
|
+
const g = !C && (!d || Array.isArray(d) && d.length === 0);
|
|
207
208
|
return /* @__PURE__ */ t("div", { className: "overflow-hidden rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: /* @__PURE__ */ t("div", { className: "overflow-x-auto", children: /* @__PURE__ */ l("table", { className: "w-full border-collapse", children: [
|
|
208
|
-
/* @__PURE__ */ t("thead", { className: "border-b border-slate-200 bg-slate-50/80 dark:border-border dark:bg-muted/30", children: /* @__PURE__ */ t("tr", { children: s.map((f,
|
|
209
|
-
const
|
|
209
|
+
/* @__PURE__ */ t("thead", { className: "border-b border-slate-200 bg-slate-50/80 dark:border-border dark:bg-muted/30", children: /* @__PURE__ */ t("tr", { children: s.map((f, p) => {
|
|
210
|
+
const o = typeof f == "string" ? f : f.label, k = typeof f == "string" ? void 0 : f.width, X = typeof f == "string" ? void 0 : f.align;
|
|
210
211
|
return /* @__PURE__ */ t(
|
|
211
212
|
"th",
|
|
212
213
|
{
|
|
213
|
-
className: i(
|
|
214
|
-
style:
|
|
215
|
-
children:
|
|
214
|
+
className: i(Lt, X === "right" && "text-right"),
|
|
215
|
+
style: k ? { width: k } : void 0,
|
|
216
|
+
children: o
|
|
216
217
|
},
|
|
217
|
-
`${
|
|
218
|
+
`${o}-${p}`
|
|
218
219
|
);
|
|
219
220
|
}) }) }),
|
|
220
|
-
/* @__PURE__ */ t("tbody", { className: "divide-y divide-slate-100 dark:divide-border/50", children:
|
|
221
|
+
/* @__PURE__ */ t("tbody", { className: "divide-y divide-slate-100 dark:divide-border/50", children: C ? Array.from({ length: 5 }, (f, p) => /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t("td", { className: "px-3 py-3", colSpan: s.length, children: /* @__PURE__ */ t(
|
|
221
222
|
"span",
|
|
222
223
|
{
|
|
223
224
|
className: "block h-3 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]",
|
|
224
|
-
style: { width: `${45 +
|
|
225
|
+
style: { width: `${45 + p * 19 % 45}%` }
|
|
225
226
|
}
|
|
226
|
-
) }) },
|
|
227
|
-
|
|
227
|
+
) }) }, p)) : g ? /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t("td", { className: "px-3 py-14", colSpan: s.length, children: /* @__PURE__ */ l("div", { className: "mx-auto flex max-w-sm flex-col items-center gap-2 text-center", children: [
|
|
228
|
+
m && /* @__PURE__ */ t("span", { className: "text-slate-300 dark:text-slate-600", children: m }),
|
|
228
229
|
/* @__PURE__ */ t("p", { className: "text-[13px] font-medium text-slate-600 dark:text-slate-300", children: n }),
|
|
229
|
-
|
|
230
|
-
|
|
230
|
+
h && /* @__PURE__ */ t("p", { className: "text-[12px] leading-relaxed text-slate-400 dark:text-slate-500", children: h }),
|
|
231
|
+
T && /* @__PURE__ */ t("div", { className: "mt-1", children: T })
|
|
231
232
|
] }) }) }) : d })
|
|
232
233
|
] }) }) });
|
|
233
234
|
}
|
|
234
|
-
function
|
|
235
|
+
function Xt({
|
|
235
236
|
defaultTab: s = "catalog",
|
|
236
237
|
hiddenTabs: d = [],
|
|
237
238
|
onOpenReport: n,
|
|
238
|
-
className:
|
|
239
|
+
className: h
|
|
239
240
|
}) {
|
|
240
|
-
const
|
|
241
|
-
|
|
242
|
-
}, o = (e, a,
|
|
241
|
+
const m = kt(), T = pt(), { scopes: C } = Nt(), [g, f] = _(s), p = (e) => {
|
|
242
|
+
/^Failed\b/.test(e) ? Fe.error(e) : Fe.success(e);
|
|
243
|
+
}, o = (e, a, u) => m.request({ _method: e, _path: a, _body: u }), { data: k } = y({
|
|
243
244
|
queryKey: ["nvr-ma-me"],
|
|
244
245
|
queryFn: () => o("GET", "/auth/me").then((e) => e.data)
|
|
245
|
-
}),
|
|
246
|
-
for (const a of e)
|
|
247
|
-
}, { data:
|
|
246
|
+
}), X = String((k == null ? void 0 : k.id) ?? "").toLowerCase(), Oe = !!(k != null && k.is_admin), b = (...e) => {
|
|
247
|
+
for (const a of e) T.invalidateQueries({ queryKey: [a] });
|
|
248
|
+
}, { data: R = [], isLoading: Z } = y({
|
|
248
249
|
queryKey: ["nvr-ma-definitions"],
|
|
249
250
|
queryFn: () => o("GET", "/metric-alerts/definitions").then((e) => e.data)
|
|
250
|
-
}), { data:
|
|
251
|
+
}), { data: M = [], isLoading: Me } = y({
|
|
251
252
|
queryKey: ["nvr-ma-rules"],
|
|
252
253
|
queryFn: () => o("GET", "/metric-alerts/rules").then((e) => e.data)
|
|
253
|
-
}), { data:
|
|
254
|
+
}), { data: P = [], isLoading: Pe } = y({
|
|
254
255
|
queryKey: ["nvr-ma-subs"],
|
|
255
256
|
queryFn: () => o("GET", "/metric-alerts/subscriptions").then(
|
|
256
257
|
(e) => e.data
|
|
257
258
|
)
|
|
258
|
-
}), { data:
|
|
259
|
+
}), { data: I = [], isLoading: Ie } = y({
|
|
259
260
|
queryKey: ["nvr-ma-log"],
|
|
260
261
|
queryFn: () => o("GET", "/metric-alerts/log?limit=100").then(
|
|
261
262
|
(e) => e.data
|
|
262
263
|
)
|
|
263
|
-
}), { data: ge = [], isLoading: Ge } =
|
|
264
|
+
}), { data: ge = [], isLoading: Ge } = y({
|
|
264
265
|
queryKey: ["nvr-ma-notif-subs"],
|
|
265
|
-
queryFn: () =>
|
|
266
|
-
}),
|
|
266
|
+
queryFn: () => m.request(ut()).then((e) => e.data)
|
|
267
|
+
}), G = oe({
|
|
267
268
|
// Raw PATCH — the route accepts label/filter_field/filter_value/filters/
|
|
268
269
|
// digest_frequency/is_active; the typed SDK command covers a subset.
|
|
269
270
|
mutationFn: ({ id: e, patch: a }) => o("PATCH", `/notification-subscriptions/${e}`, a),
|
|
270
271
|
onSuccess: () => b("nvr-ma-notif-subs")
|
|
271
|
-
}), He =
|
|
272
|
-
mutationFn: (e) =>
|
|
272
|
+
}), He = oe({
|
|
273
|
+
mutationFn: (e) => m.request(ht(e)),
|
|
273
274
|
onSuccess: () => b("nvr-ma-notif-subs")
|
|
274
|
-
}), fe = d.includes("widget_alerts"), { data:
|
|
275
|
+
}), fe = d.includes("widget_alerts"), { data: ee = [], isLoading: Ke } = y({
|
|
275
276
|
queryKey: ["nvr-ma-report-alerts"],
|
|
276
277
|
enabled: !fe,
|
|
277
278
|
queryFn: () => o("GET", "/metric-alerts/report-alerts").then((e) => e.data)
|
|
278
|
-
}), Be =
|
|
279
|
+
}), Be = ee.some((e) => (e.filters ?? []).length > 0), { data: te } = y({
|
|
279
280
|
queryKey: ["nvr-ma-report-filter-bars"],
|
|
280
281
|
enabled: !fe && Be,
|
|
281
282
|
staleTime: 3e5,
|
|
282
283
|
queryFn: () => o("GET", "/report-studio").then(
|
|
283
284
|
(e) => new Map((e.data ?? []).map((a) => {
|
|
284
|
-
var
|
|
285
|
-
return [String(a.id), ((
|
|
285
|
+
var u;
|
|
286
|
+
return [String(a.id), ((u = a.global_filters) == null ? void 0 : u.filter_bar) ?? []];
|
|
286
287
|
}))
|
|
287
288
|
).catch(() => /* @__PURE__ */ new Map())
|
|
288
|
-
}), { data:
|
|
289
|
+
}), { data: ve = [], isLoading: We } = y({
|
|
289
290
|
queryKey: ["nvr-ma-report-alerts-log"],
|
|
290
291
|
enabled: !d.includes("widget_alert_history"),
|
|
291
292
|
queryFn: () => o("GET", "/metric-alerts/report-alerts-log").then(
|
|
292
293
|
(e) => e.data
|
|
293
294
|
)
|
|
294
|
-
}), { data:
|
|
295
|
+
}), { data: Ue = [] } = y({
|
|
295
296
|
queryKey: ["nvr-ma-anomaly-defs"],
|
|
296
297
|
queryFn: () => o("GET", "/metric-alerts/anomaly-definitions").then(
|
|
297
298
|
(e) => e.data
|
|
298
299
|
)
|
|
299
|
-
}), { data:
|
|
300
|
+
}), { data: ye = [], isLoading: Ve } = y({
|
|
300
301
|
queryKey: ["nvr-ma-anomaly-rules"],
|
|
301
302
|
queryFn: () => o("GET", "/metric-alerts/anomaly-rules").then((e) => e.data)
|
|
302
|
-
}), { data:
|
|
303
|
+
}), { data: H = [], isLoading: Qe } = y({
|
|
303
304
|
queryKey: ["nvr-ma-anomaly-log"],
|
|
304
305
|
queryFn: () => o("GET", "/metric-alerts/anomaly-log").then((e) => e.data)
|
|
305
|
-
}), [
|
|
306
|
-
() => Object.fromEntries(
|
|
307
|
-
[
|
|
308
|
-
), Xe =
|
|
306
|
+
}), [ze, K] = _(!1), [ae, ke] = _(null), [Ye, Ne] = _(null), [Je, B] = _(!1), [le, W] = _(null), [U, re] = _(null), [we, V] = _(!1), _e = z(
|
|
307
|
+
() => Object.fromEntries(P.map((e) => [e.rule_id, e])),
|
|
308
|
+
[P]
|
|
309
|
+
), Xe = z(() => {
|
|
309
310
|
const e = {};
|
|
310
|
-
for (const a of
|
|
311
|
+
for (const a of I)
|
|
311
312
|
a.status === "firing" && !a.resolved_at && (e[a.rule_id] = a);
|
|
312
313
|
return e;
|
|
313
|
-
}, [
|
|
314
|
-
() =>
|
|
315
|
-
[
|
|
314
|
+
}, [I]), Ae = z(
|
|
315
|
+
() => H.filter((e) => e.status !== "resolved").length,
|
|
316
|
+
[H]
|
|
316
317
|
), Ze = async (e) => {
|
|
317
318
|
const a = _e[e.id];
|
|
318
319
|
try {
|
|
@@ -320,41 +321,41 @@ function Yt({
|
|
|
320
321
|
} catch {
|
|
321
322
|
p("Failed to update subscription");
|
|
322
323
|
}
|
|
323
|
-
},
|
|
324
|
+
}, se = async (e, a) => {
|
|
324
325
|
try {
|
|
325
326
|
await o("PATCH", `/metric-alerts/subscriptions/${e}`, a), b("nvr-ma-subs");
|
|
326
327
|
} catch {
|
|
327
328
|
p("Failed to update subscription");
|
|
328
329
|
}
|
|
329
330
|
}, et = async (e) => {
|
|
330
|
-
var a,
|
|
331
|
-
|
|
331
|
+
var a, u;
|
|
332
|
+
V(!0);
|
|
332
333
|
try {
|
|
333
|
-
if (
|
|
334
|
-
await o("PATCH", `/metric-alerts/rules/${
|
|
334
|
+
if (ae)
|
|
335
|
+
await o("PATCH", `/metric-alerts/rules/${ae.id}`, e), p("Alert rule updated");
|
|
335
336
|
else {
|
|
336
|
-
const
|
|
337
|
-
for (const x of (
|
|
338
|
-
if ((a =
|
|
339
|
-
const N =
|
|
337
|
+
const c = R.find((x) => x.id === e.definition_id), v = { ...e.filters ?? {} };
|
|
338
|
+
for (const x of (c == null ? void 0 : c.supported_filters) ?? []) {
|
|
339
|
+
if ((a = v[x.key]) != null && a.length) continue;
|
|
340
|
+
const N = wt(C, { key: x.key, collection: x.collection });
|
|
340
341
|
if (!N) continue;
|
|
341
|
-
const
|
|
342
|
-
if (!(
|
|
343
|
-
const
|
|
344
|
-
|
|
345
|
-
|
|
342
|
+
const $ = (u = C == null ? void 0 : C.restricted) == null ? void 0 : u[N.name];
|
|
343
|
+
if (!($ != null && $.length)) continue;
|
|
344
|
+
const F = _t(C, N.name), Q = F.length ? F : $;
|
|
345
|
+
v[x.key] = await At(
|
|
346
|
+
m,
|
|
346
347
|
N,
|
|
347
|
-
|
|
348
|
+
Q,
|
|
348
349
|
x.value_field
|
|
349
350
|
);
|
|
350
351
|
}
|
|
351
|
-
await o("POST", "/metric-alerts/rules", { ...e, filters:
|
|
352
|
+
await o("POST", "/metric-alerts/rules", { ...e, filters: v }), p("Alert rule created");
|
|
352
353
|
}
|
|
353
|
-
|
|
354
|
+
K(!1), b("nvr-ma-rules", "nvr-ma-subs");
|
|
354
355
|
} catch {
|
|
355
356
|
p("Failed to save rule");
|
|
356
357
|
} finally {
|
|
357
|
-
|
|
358
|
+
V(!1);
|
|
358
359
|
}
|
|
359
360
|
}, tt = async (e) => {
|
|
360
361
|
if (window.confirm(`Delete rule "${e.name}"? This removes the rule and all subscriptions.`))
|
|
@@ -364,13 +365,13 @@ function Yt({
|
|
|
364
365
|
p("Failed to delete rule");
|
|
365
366
|
}
|
|
366
367
|
}, at = async (e) => {
|
|
367
|
-
|
|
368
|
+
V(!0);
|
|
368
369
|
try {
|
|
369
|
-
|
|
370
|
+
le ? (await o("PATCH", `/metric-alerts/anomaly-rules/${le.id}`, e), p("Anomaly rule updated")) : (await o("POST", "/metric-alerts/anomaly-rules", e), p("Anomaly rule created")), B(!1), W(null), b("nvr-ma-anomaly-rules");
|
|
370
371
|
} catch {
|
|
371
372
|
p("Failed to save anomaly rule");
|
|
372
373
|
} finally {
|
|
373
|
-
|
|
374
|
+
V(!1);
|
|
374
375
|
}
|
|
375
376
|
}, lt = async (e) => {
|
|
376
377
|
if (window.confirm(`Delete anomaly rule "${e.name}"? Its log entries are also removed.`))
|
|
@@ -379,19 +380,19 @@ function Yt({
|
|
|
379
380
|
} catch {
|
|
380
381
|
p("Failed to delete anomaly rule");
|
|
381
382
|
}
|
|
382
|
-
},
|
|
383
|
+
}, Ce = async (e, a) => {
|
|
383
384
|
try {
|
|
384
385
|
await o("PATCH", `/metric-alerts/anomaly-rules/${e}`, a), b("nvr-ma-anomaly-rules");
|
|
385
386
|
} catch {
|
|
386
387
|
p("Failed to update anomaly rule");
|
|
387
388
|
}
|
|
388
|
-
},
|
|
389
|
+
}, Se = async (e, a) => {
|
|
389
390
|
try {
|
|
390
391
|
await o("PATCH", `/metric-alerts/anomaly-log/${e}`, { status: a }), b("nvr-ma-anomaly-log");
|
|
391
392
|
} catch {
|
|
392
393
|
p("Failed to update anomaly");
|
|
393
394
|
}
|
|
394
|
-
},
|
|
395
|
+
}, ne = async (e, a) => {
|
|
395
396
|
try {
|
|
396
397
|
await o("PATCH", `/report-studio/${e.report}/alerts/${e.id}`, a), b("nvr-ma-report-alerts");
|
|
397
398
|
} catch {
|
|
@@ -404,58 +405,57 @@ function Yt({
|
|
|
404
405
|
} catch {
|
|
405
406
|
p("Failed to delete widget alert");
|
|
406
407
|
}
|
|
407
|
-
}, st =
|
|
408
|
+
}, st = oe({
|
|
408
409
|
mutationFn: (e) => o("POST", `/report-studio/${e.report_id}/alerts/${e.alert}/resolve`),
|
|
409
410
|
onSuccess: () => b("nvr-ma-report-alerts-log", "nvr-ma-report-alerts")
|
|
410
|
-
}), nt =
|
|
411
|
+
}), nt = z(() => {
|
|
411
412
|
const e = /* @__PURE__ */ new Map();
|
|
412
|
-
for (const a of
|
|
413
|
+
for (const a of R)
|
|
413
414
|
e.has(a.category) || e.set(a.category, []), e.get(a.category).push(a);
|
|
414
415
|
return e;
|
|
415
|
-
}, [
|
|
416
|
+
}, [R]), ie = I.filter((e) => e.status === "firing").length, it = ve.filter((e) => e.status === "firing").length, dt = ye.filter((e) => e.status === "active").length, ot = H.filter((e) => e.status === "new").length, ct = [
|
|
416
417
|
{ key: "catalog", label: "Alert Catalog", icon: /* @__PURE__ */ t(Te, { className: "h-3.5 w-3.5" }) },
|
|
417
418
|
{ key: "rules", label: "Alert Rules", icon: /* @__PURE__ */ t($e, { className: "h-3.5 w-3.5" }) },
|
|
418
419
|
{
|
|
419
420
|
key: "subscriptions",
|
|
420
421
|
label: "My Subscriptions",
|
|
421
|
-
icon: /* @__PURE__ */ t(
|
|
422
|
-
badge: /* @__PURE__ */ t(
|
|
422
|
+
icon: /* @__PURE__ */ t(ce, { className: "h-3.5 w-3.5" }),
|
|
423
|
+
badge: /* @__PURE__ */ t(D, { n: P.length + ge.length, tone: "cyan" })
|
|
423
424
|
},
|
|
424
425
|
{
|
|
425
426
|
key: "history",
|
|
426
427
|
label: "Alert History",
|
|
427
|
-
icon: /* @__PURE__ */ t(
|
|
428
|
-
badge: /* @__PURE__ */ t(
|
|
428
|
+
icon: /* @__PURE__ */ t(xt, { className: "h-3.5 w-3.5" }),
|
|
429
|
+
badge: /* @__PURE__ */ t(D, { n: ie, tone: "red" })
|
|
429
430
|
},
|
|
430
431
|
{
|
|
431
432
|
key: "widget_alerts",
|
|
432
433
|
label: "Widget Alerts",
|
|
433
|
-
icon: /* @__PURE__ */ t(
|
|
434
|
-
badge: /* @__PURE__ */ t(
|
|
434
|
+
icon: /* @__PURE__ */ t(bt, { className: "h-3.5 w-3.5" }),
|
|
435
|
+
badge: /* @__PURE__ */ t(D, { n: ee.length, tone: "violet" })
|
|
435
436
|
},
|
|
436
437
|
{
|
|
437
438
|
key: "widget_alert_history",
|
|
438
439
|
label: "Widget Alert History",
|
|
439
440
|
icon: /* @__PURE__ */ t(Re, { className: "h-3.5 w-3.5" }),
|
|
440
|
-
badge: /* @__PURE__ */ t(
|
|
441
|
+
badge: /* @__PURE__ */ t(D, { n: it, tone: "red" })
|
|
441
442
|
},
|
|
442
443
|
{
|
|
443
444
|
key: "anomaly_rules",
|
|
444
445
|
label: "Anomaly Rules",
|
|
445
446
|
icon: /* @__PURE__ */ t(qe, { className: "h-3.5 w-3.5" }),
|
|
446
|
-
badge: /* @__PURE__ */ t(
|
|
447
|
+
badge: /* @__PURE__ */ t(D, { n: dt, tone: "teal" })
|
|
447
448
|
},
|
|
448
449
|
{
|
|
449
450
|
key: "anomaly_history",
|
|
450
451
|
label: "Anomaly History",
|
|
451
|
-
icon: /* @__PURE__ */ t(
|
|
452
|
-
badge: /* @__PURE__ */ t(
|
|
452
|
+
icon: /* @__PURE__ */ t(gt, { className: "h-3.5 w-3.5" }),
|
|
453
|
+
badge: /* @__PURE__ */ t(D, { n: ot, tone: "red" })
|
|
453
454
|
}
|
|
454
455
|
].filter((e) => !d.includes(e.key)), Ee = (e) => {
|
|
455
|
-
ke(null), Ne(e ?? null),
|
|
456
|
-
},
|
|
457
|
-
return /* @__PURE__ */ l("div", { className: i("flex flex-col gap-3",
|
|
458
|
-
E && /* @__PURE__ */ t("div", { className: "fixed right-4 top-4 z-[60] rounded-md bg-[#0f172a] px-3 py-2 text-[12.5px] text-white shadow-lg dark:bg-slate-100 dark:text-slate-900", children: E }),
|
|
456
|
+
ke(null), Ne(e ?? null), K(!0);
|
|
457
|
+
}, q = (e) => Oe || e != null && String(e).toLowerCase() === X, de = "inline-flex h-7 items-center gap-1.5 rounded-md bg-nvr-cyan px-2.5 text-[12px] font-semibold text-white hover:opacity-90";
|
|
458
|
+
return /* @__PURE__ */ l("div", { className: i("flex flex-col gap-3", h), "data-alert-manager": "", children: [
|
|
459
459
|
/* @__PURE__ */ t(
|
|
460
460
|
"div",
|
|
461
461
|
{
|
|
@@ -480,7 +480,7 @@ function Yt({
|
|
|
480
480
|
))
|
|
481
481
|
}
|
|
482
482
|
),
|
|
483
|
-
g === "catalog" &&
|
|
483
|
+
g === "catalog" && Z && /* @__PURE__ */ t("div", { className: "grid gap-3 sm:grid-cols-2 lg:grid-cols-3", children: Array.from({ length: 6 }, (e, a) => /* @__PURE__ */ l(
|
|
484
484
|
"div",
|
|
485
485
|
{
|
|
486
486
|
className: "rounded-lg border border-slate-200 bg-white p-3 dark:border-border dark:bg-card",
|
|
@@ -492,21 +492,21 @@ function Yt({
|
|
|
492
492
|
},
|
|
493
493
|
a
|
|
494
494
|
)) }),
|
|
495
|
-
g === "catalog" && !
|
|
495
|
+
g === "catalog" && !Z && R.length > 0 && // One continuous list, not a card grid: the old layout repeated an
|
|
496
496
|
// identical box (and an identical saturated button) fourteen times,
|
|
497
497
|
// and its per-category grids left orphan holes on odd counts. Rows
|
|
498
498
|
// also make room for the fact that actually matters here — whether
|
|
499
499
|
// this metric is already being watched.
|
|
500
|
-
/* @__PURE__ */ t("section", { className: "max-w-[1180px] overflow-hidden rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: [...nt.entries()].map(([e, a],
|
|
500
|
+
/* @__PURE__ */ t("section", { className: "max-w-[1180px] overflow-hidden rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: [...nt.entries()].map(([e, a], u) => /* @__PURE__ */ l("div", { children: [
|
|
501
501
|
/* @__PURE__ */ l(
|
|
502
502
|
"div",
|
|
503
503
|
{
|
|
504
504
|
className: i(
|
|
505
505
|
"flex items-center gap-2 bg-slate-50/80 px-3 py-1.5 dark:bg-muted/30",
|
|
506
|
-
|
|
506
|
+
u > 0 && "border-t border-slate-200 dark:border-border"
|
|
507
507
|
),
|
|
508
508
|
children: [
|
|
509
|
-
/* @__PURE__ */ t("span", { className:
|
|
509
|
+
/* @__PURE__ */ t("span", { className: Ft(e), children: Tt(e) }),
|
|
510
510
|
/* @__PURE__ */ l("span", { className: "text-[11px] text-slate-400 dark:text-slate-500", children: [
|
|
511
511
|
a.length,
|
|
512
512
|
" metric",
|
|
@@ -515,8 +515,8 @@ function Yt({
|
|
|
515
515
|
]
|
|
516
516
|
}
|
|
517
517
|
),
|
|
518
|
-
/* @__PURE__ */ t("ul", { className: "divide-y divide-slate-100 dark:divide-border/50", children: a.map((
|
|
519
|
-
const
|
|
518
|
+
/* @__PURE__ */ t("ul", { className: "divide-y divide-slate-100 dark:divide-border/50", children: a.map((c) => {
|
|
519
|
+
const v = M.filter((x) => x.definition_id === c.id).length;
|
|
520
520
|
return /* @__PURE__ */ l(
|
|
521
521
|
"li",
|
|
522
522
|
{
|
|
@@ -524,21 +524,21 @@ function Yt({
|
|
|
524
524
|
children: [
|
|
525
525
|
/* @__PURE__ */ l("div", { className: "min-w-0 flex-1", children: [
|
|
526
526
|
/* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
527
|
-
/* @__PURE__ */ t("p", { className: "truncate text-[13px] font-medium text-slate-800 dark:text-slate-100", children:
|
|
528
|
-
|
|
529
|
-
/* @__PURE__ */ t(
|
|
530
|
-
|
|
527
|
+
/* @__PURE__ */ t("p", { className: "truncate text-[13px] font-medium text-slate-800 dark:text-slate-100", children: c.name }),
|
|
528
|
+
v > 0 && /* @__PURE__ */ l("span", { className: "inline-flex shrink-0 items-center gap-1 rounded-full bg-nvr-cyan/10 px-1.5 py-px text-[10px] font-semibold text-nvr-navy dark:text-nvr-cyan", children: [
|
|
529
|
+
/* @__PURE__ */ t(ce, { className: "h-2.5 w-2.5" }),
|
|
530
|
+
v
|
|
531
531
|
] })
|
|
532
532
|
] }),
|
|
533
|
-
|
|
533
|
+
c.description && /* @__PURE__ */ t("p", { className: "truncate text-[11.5px] text-slate-500 dark:text-slate-400", children: c.description })
|
|
534
534
|
] }),
|
|
535
535
|
/* @__PURE__ */ l("div", { className: "hidden shrink-0 items-baseline gap-1.5 font-mono text-[11.5px] tabular-nums text-slate-500 dark:text-slate-400 sm:flex", children: [
|
|
536
|
-
/* @__PURE__ */ t("span", { className: "text-[10px] uppercase tracking-wide text-slate-400 dark:text-slate-500", children:
|
|
536
|
+
/* @__PURE__ */ t("span", { className: "text-[10px] uppercase tracking-wide text-slate-400 dark:text-slate-500", children: c.unit }),
|
|
537
537
|
/* @__PURE__ */ t("span", { className: "text-slate-300 dark:text-slate-600", children: "·" }),
|
|
538
538
|
/* @__PURE__ */ l("span", { children: [
|
|
539
|
-
|
|
539
|
+
be[c.default_operator] ?? c.default_operator,
|
|
540
540
|
" ",
|
|
541
|
-
|
|
541
|
+
c.default_threshold != null ? A(c.default_threshold, c.unit) : "—"
|
|
542
542
|
] })
|
|
543
543
|
] }),
|
|
544
544
|
/* @__PURE__ */ l(
|
|
@@ -547,36 +547,36 @@ function Yt({
|
|
|
547
547
|
type: "button",
|
|
548
548
|
className: "inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-slate-200 px-2.5 text-[12px] font-medium text-slate-600 transition-colors hover:border-nvr-cyan hover:bg-nvr-cyan/[0.08] hover:text-nvr-navy dark:border-border dark:text-slate-300 dark:hover:text-nvr-cyan",
|
|
549
549
|
onClick: () => {
|
|
550
|
-
Ee(
|
|
550
|
+
Ee(c.id), f("rules");
|
|
551
551
|
},
|
|
552
552
|
children: [
|
|
553
|
-
/* @__PURE__ */ t(
|
|
553
|
+
/* @__PURE__ */ t(me, { className: "h-3 w-3" }),
|
|
554
554
|
" Rule"
|
|
555
555
|
]
|
|
556
556
|
}
|
|
557
557
|
)
|
|
558
558
|
]
|
|
559
559
|
},
|
|
560
|
-
|
|
560
|
+
c.id
|
|
561
561
|
);
|
|
562
562
|
}) })
|
|
563
563
|
] }, e)) }),
|
|
564
|
-
g === "catalog" && !
|
|
565
|
-
/* @__PURE__ */ t(
|
|
564
|
+
g === "catalog" && !Z && R.length === 0 && /* @__PURE__ */ t("div", { className: "rounded-lg border border-slate-200 bg-white py-16 dark:border-border dark:bg-card", children: /* @__PURE__ */ l("div", { className: "mx-auto flex max-w-sm flex-col items-center gap-2 text-center", children: [
|
|
565
|
+
/* @__PURE__ */ t(ft, { className: "h-5 w-5 text-slate-300 dark:text-slate-600" }),
|
|
566
566
|
/* @__PURE__ */ t("p", { className: "text-[13px] font-medium text-slate-600 dark:text-slate-300", children: "No metrics in the catalog yet" }),
|
|
567
567
|
/* @__PURE__ */ t("p", { className: "text-[12px] leading-relaxed text-slate-400 dark:text-slate-500", children: "Metric definitions describe what can be measured — once an admin adds them, you can build alert rules on top." })
|
|
568
568
|
] }) }),
|
|
569
569
|
g === "rules" && /* @__PURE__ */ t(
|
|
570
|
-
|
|
570
|
+
xe,
|
|
571
571
|
{
|
|
572
572
|
title: "Alert rules",
|
|
573
|
-
hint: `${
|
|
574
|
-
action: /* @__PURE__ */ l("button", { type: "button", className:
|
|
575
|
-
/* @__PURE__ */ t(
|
|
573
|
+
hint: `${M.length} rule${M.length === 1 ? "" : "s"} · shared and personal`,
|
|
574
|
+
action: /* @__PURE__ */ l("button", { type: "button", className: de, onClick: () => Ee(), children: [
|
|
575
|
+
/* @__PURE__ */ t(me, { className: "h-3 w-3" }),
|
|
576
576
|
" New rule"
|
|
577
577
|
] }),
|
|
578
578
|
children: /* @__PURE__ */ t(
|
|
579
|
-
|
|
579
|
+
E,
|
|
580
580
|
{
|
|
581
581
|
headers: [
|
|
582
582
|
"Rule",
|
|
@@ -589,20 +589,20 @@ function Yt({
|
|
|
589
589
|
empty: "No alert rules yet",
|
|
590
590
|
emptyHint: "Pick a metric from the catalog and set the threshold that should page you.",
|
|
591
591
|
emptyIcon: /* @__PURE__ */ t(De, { className: "h-5 w-5" }),
|
|
592
|
-
emptyAction: /* @__PURE__ */ l("button", { type: "button", className:
|
|
592
|
+
emptyAction: /* @__PURE__ */ l("button", { type: "button", className: de, onClick: () => f("catalog"), children: [
|
|
593
593
|
/* @__PURE__ */ t(Te, { className: "h-3 w-3" }),
|
|
594
594
|
" Browse catalog"
|
|
595
595
|
] }),
|
|
596
596
|
loading: Me,
|
|
597
|
-
children:
|
|
598
|
-
var
|
|
599
|
-
const a = !!_e[e.id],
|
|
597
|
+
children: M.map((e) => {
|
|
598
|
+
var $, F, Q;
|
|
599
|
+
const a = !!_e[e.id], u = q(e.created_by), c = Xe[e.id], v = e.status !== "active", x = e.last_checked_at, N = x ? J(x) : null;
|
|
600
600
|
return /* @__PURE__ */ l(
|
|
601
601
|
"tr",
|
|
602
602
|
{
|
|
603
603
|
className: i(
|
|
604
604
|
"transition-colors hover:bg-slate-50/70 dark:hover:bg-muted/25",
|
|
605
|
-
|
|
605
|
+
v && "opacity-60"
|
|
606
606
|
),
|
|
607
607
|
children: [
|
|
608
608
|
/* @__PURE__ */ l("td", { className: r, children: [
|
|
@@ -610,14 +610,14 @@ function Yt({
|
|
|
610
610
|
e.definition && /* @__PURE__ */ t("p", { className: "text-[11px] text-slate-500 dark:text-slate-400", children: e.definition.name })
|
|
611
611
|
] }),
|
|
612
612
|
/* @__PURE__ */ t("td", { className: r, children: /* @__PURE__ */ t(
|
|
613
|
-
|
|
613
|
+
Mt,
|
|
614
614
|
{
|
|
615
615
|
operator: e.operator,
|
|
616
616
|
threshold: e.threshold_value,
|
|
617
|
-
unit: (
|
|
617
|
+
unit: ($ = e.definition) == null ? void 0 : $.unit
|
|
618
618
|
}
|
|
619
619
|
) }),
|
|
620
|
-
/* @__PURE__ */ t("td", { className: r, children:
|
|
620
|
+
/* @__PURE__ */ t("td", { className: r, children: v ? /* @__PURE__ */ t(j, { status: e.status }) : c ? /* @__PURE__ */ l("span", { className: "flex flex-col gap-0.5", children: [
|
|
621
621
|
/* @__PURE__ */ l("span", { className: "inline-flex w-fit items-center gap-1.5 rounded-full bg-red-50 px-2 py-px text-[10.5px] font-semibold text-red-600 dark:bg-red-500/10 dark:text-red-400", children: [
|
|
622
622
|
/* @__PURE__ */ t(
|
|
623
623
|
"span",
|
|
@@ -629,8 +629,8 @@ function Yt({
|
|
|
629
629
|
"Firing"
|
|
630
630
|
] }),
|
|
631
631
|
/* @__PURE__ */ l("span", { className: "font-mono text-[10.5px] tabular-nums text-slate-500 dark:text-slate-400", children: [
|
|
632
|
-
|
|
633
|
-
|
|
632
|
+
c.current_value != null ? `${A(c.current_value, (F = e.definition) == null ? void 0 : F.unit)} now` : A(c.metric_value, (Q = e.definition) == null ? void 0 : Q.unit),
|
|
633
|
+
J(c.fired_at) ? ` · fired ${J(c.fired_at)}` : ""
|
|
634
634
|
] })
|
|
635
635
|
] }) : x ? /* @__PURE__ */ l(
|
|
636
636
|
"span",
|
|
@@ -661,7 +661,7 @@ function Yt({
|
|
|
661
661
|
/* @__PURE__ */ t(vt, { className: "h-3 w-3" }),
|
|
662
662
|
" Team"
|
|
663
663
|
] }) : /* @__PURE__ */ l("span", { className: "inline-flex items-center gap-1 text-[11.5px] text-slate-400 dark:text-slate-500", children: [
|
|
664
|
-
/* @__PURE__ */ t(
|
|
664
|
+
/* @__PURE__ */ t(yt, { className: "h-3 w-3" }),
|
|
665
665
|
" Private"
|
|
666
666
|
] }) }),
|
|
667
667
|
/* @__PURE__ */ t("td", { className: r, children: /* @__PURE__ */ l("div", { className: "flex items-center justify-end gap-1", children: [
|
|
@@ -676,10 +676,10 @@ function Yt({
|
|
|
676
676
|
w,
|
|
677
677
|
a && "border-nvr-cyan bg-nvr-cyan/10 text-nvr-navy hover:bg-nvr-cyan/15 dark:text-nvr-cyan"
|
|
678
678
|
),
|
|
679
|
-
children: a ? /* @__PURE__ */ t(
|
|
679
|
+
children: a ? /* @__PURE__ */ t(ce, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ t($e, { className: "h-3.5 w-3.5" })
|
|
680
680
|
}
|
|
681
681
|
),
|
|
682
|
-
|
|
682
|
+
u && /* @__PURE__ */ l(mt, { children: [
|
|
683
683
|
/* @__PURE__ */ t(
|
|
684
684
|
"button",
|
|
685
685
|
{
|
|
@@ -687,7 +687,7 @@ function Yt({
|
|
|
687
687
|
title: "Edit rule",
|
|
688
688
|
className: w,
|
|
689
689
|
onClick: () => {
|
|
690
|
-
ke(e), Ne(null),
|
|
690
|
+
ke(e), Ne(null), K(!0);
|
|
691
691
|
},
|
|
692
692
|
children: /* @__PURE__ */ t(ue, { className: "h-3.5 w-3.5" })
|
|
693
693
|
}
|
|
@@ -702,7 +702,7 @@ function Yt({
|
|
|
702
702
|
"hover:border-red-300 hover:bg-red-50 hover:text-red-600 dark:hover:bg-red-500/10 dark:hover:text-red-400"
|
|
703
703
|
),
|
|
704
704
|
onClick: () => tt(e),
|
|
705
|
-
children: /* @__PURE__ */ t(
|
|
705
|
+
children: /* @__PURE__ */ t(L, { className: "h-3.5 w-3.5" })
|
|
706
706
|
}
|
|
707
707
|
)
|
|
708
708
|
] })
|
|
@@ -719,7 +719,7 @@ function Yt({
|
|
|
719
719
|
g === "subscriptions" && /* @__PURE__ */ l("div", { className: "space-y-2", children: [
|
|
720
720
|
/* @__PURE__ */ t("p", { className: "text-[12px] text-slate-400", children: "Manage how you receive alert notifications" }),
|
|
721
721
|
/* @__PURE__ */ t(
|
|
722
|
-
|
|
722
|
+
E,
|
|
723
723
|
{
|
|
724
724
|
headers: [
|
|
725
725
|
"Alert Rule",
|
|
@@ -732,30 +732,30 @@ function Yt({
|
|
|
732
732
|
],
|
|
733
733
|
empty: "No subscriptions yet — browse the Alert Catalog or Rules tab to subscribe",
|
|
734
734
|
loading: Pe,
|
|
735
|
-
children:
|
|
735
|
+
children: P.map((e) => /* @__PURE__ */ l("tr", { className: "hover:bg-slate-50/60 dark:hover:bg-muted/30", children: [
|
|
736
736
|
/* @__PURE__ */ l("td", { className: r, children: [
|
|
737
737
|
/* @__PURE__ */ t("p", { className: "font-medium text-slate-800 dark:text-slate-100", children: e.rule_name ?? `Rule #${e.rule_id}` }),
|
|
738
738
|
e.definition_name && /* @__PURE__ */ t("p", { className: "text-[11px] text-slate-400", children: e.definition_name })
|
|
739
739
|
] }),
|
|
740
740
|
/* @__PURE__ */ t("td", { className: r, children: /* @__PURE__ */ t(
|
|
741
|
-
|
|
741
|
+
S,
|
|
742
742
|
{
|
|
743
743
|
checked: !!e.delivery_in_app,
|
|
744
|
-
onChange: (a) =>
|
|
744
|
+
onChange: (a) => se(e.id, { delivery_in_app: a })
|
|
745
745
|
}
|
|
746
746
|
) }),
|
|
747
747
|
/* @__PURE__ */ t("td", { className: r, children: /* @__PURE__ */ t(
|
|
748
|
-
|
|
748
|
+
S,
|
|
749
749
|
{
|
|
750
750
|
checked: !!e.delivery_email,
|
|
751
|
-
onChange: (a) =>
|
|
751
|
+
onChange: (a) => se(e.id, { delivery_email: a })
|
|
752
752
|
}
|
|
753
753
|
) }),
|
|
754
754
|
/* @__PURE__ */ t("td", { className: r, children: /* @__PURE__ */ t(
|
|
755
|
-
|
|
755
|
+
Le,
|
|
756
756
|
{
|
|
757
757
|
value: String(e.digest_frequency),
|
|
758
|
-
onChange: (a) =>
|
|
758
|
+
onChange: (a) => se(e.id, { digest_frequency: a }),
|
|
759
759
|
options: [
|
|
760
760
|
{ label: "Immediate", value: "immediate" },
|
|
761
761
|
{ label: "Daily", value: "daily" },
|
|
@@ -764,8 +764,8 @@ function Yt({
|
|
|
764
764
|
className: "h-7 w-[105px] text-[11.5px]"
|
|
765
765
|
}
|
|
766
766
|
) }),
|
|
767
|
-
/* @__PURE__ */ t("td", { className: i(r, "text-[11.5px] text-slate-400"), children:
|
|
768
|
-
/* @__PURE__ */ t("td", { className: r, children: /* @__PURE__ */ t(
|
|
767
|
+
/* @__PURE__ */ t("td", { className: i(r, "text-[11.5px] text-slate-400"), children: O(e.last_notified) }),
|
|
768
|
+
/* @__PURE__ */ t("td", { className: r, children: /* @__PURE__ */ t(j, { status: e.status }) }),
|
|
769
769
|
/* @__PURE__ */ t("td", { className: r, children: /* @__PURE__ */ t(
|
|
770
770
|
"button",
|
|
771
771
|
{
|
|
@@ -775,7 +775,7 @@ function Yt({
|
|
|
775
775
|
onClick: async () => {
|
|
776
776
|
window.confirm("Unsubscribe from this alert?") && (await o("DELETE", `/metric-alerts/subscriptions/${e.id}`), b("nvr-ma-subs"));
|
|
777
777
|
},
|
|
778
|
-
children: /* @__PURE__ */ t(
|
|
778
|
+
children: /* @__PURE__ */ t(L, { className: "h-3.5 w-3.5" })
|
|
779
779
|
}
|
|
780
780
|
) })
|
|
781
781
|
] }, e.id))
|
|
@@ -784,7 +784,7 @@ function Yt({
|
|
|
784
784
|
/* @__PURE__ */ t("p", { className: "pt-3 text-[11px] font-semibold uppercase tracking-wider text-slate-400", children: "Record & workflow notifications" }),
|
|
785
785
|
/* @__PURE__ */ t("p", { className: "text-[12px] text-slate-400", children: "Subscriptions to record events and workflow state changes (created from records, queues, or notification settings)" }),
|
|
786
786
|
/* @__PURE__ */ t(
|
|
787
|
-
|
|
787
|
+
E,
|
|
788
788
|
{
|
|
789
789
|
headers: [
|
|
790
790
|
"Subscription",
|
|
@@ -807,7 +807,7 @@ function Yt({
|
|
|
807
807
|
" ",
|
|
808
808
|
e.filter_value ?? "any"
|
|
809
809
|
] }),
|
|
810
|
-
(e.filters ?? []).map((a,
|
|
810
|
+
(e.filters ?? []).map((a, u) => /* @__PURE__ */ l(
|
|
811
811
|
"span",
|
|
812
812
|
{
|
|
813
813
|
className: "inline-flex rounded bg-nvr-cyan/10 px-1.5 py-px text-[10.5px] text-slate-600 dark:text-slate-300",
|
|
@@ -819,16 +819,16 @@ function Yt({
|
|
|
819
819
|
Array.isArray(a.value) ? a.value.join(", ") : String(a.value ?? "")
|
|
820
820
|
]
|
|
821
821
|
},
|
|
822
|
-
`${a.field}-${
|
|
822
|
+
`${a.field}-${u}`
|
|
823
823
|
))
|
|
824
824
|
] })
|
|
825
825
|
] }),
|
|
826
826
|
/* @__PURE__ */ t("td", { className: i(r, "capitalize"), children: String(e.event_type).replace(/_/g, " ") }),
|
|
827
827
|
/* @__PURE__ */ t("td", { className: r, children: /* @__PURE__ */ t(
|
|
828
|
-
|
|
828
|
+
Le,
|
|
829
829
|
{
|
|
830
830
|
value: String(e.digest_frequency ?? "instant"),
|
|
831
|
-
onChange: (a) =>
|
|
831
|
+
onChange: (a) => G.mutate({ id: e.id, patch: { digest_frequency: a } }),
|
|
832
832
|
options: [
|
|
833
833
|
{ label: "Instant", value: "instant" },
|
|
834
834
|
{ label: "Daily", value: "daily" },
|
|
@@ -838,10 +838,10 @@ function Yt({
|
|
|
838
838
|
}
|
|
839
839
|
) }),
|
|
840
840
|
/* @__PURE__ */ t("td", { className: r, children: /* @__PURE__ */ t(
|
|
841
|
-
|
|
841
|
+
S,
|
|
842
842
|
{
|
|
843
843
|
checked: !!e.is_active,
|
|
844
|
-
onChange: (a) =>
|
|
844
|
+
onChange: (a) => G.mutate({ id: e.id, patch: { is_active: a } })
|
|
845
845
|
}
|
|
846
846
|
) }),
|
|
847
847
|
/* @__PURE__ */ t("td", { className: r, children: /* @__PURE__ */ l("div", { className: "flex items-center gap-1", children: [
|
|
@@ -851,7 +851,7 @@ function Yt({
|
|
|
851
851
|
type: "button",
|
|
852
852
|
title: "Edit",
|
|
853
853
|
className: w,
|
|
854
|
-
onClick: () =>
|
|
854
|
+
onClick: () => re(e),
|
|
855
855
|
children: /* @__PURE__ */ t(ue, { className: "h-3.5 w-3.5" })
|
|
856
856
|
}
|
|
857
857
|
),
|
|
@@ -864,7 +864,7 @@ function Yt({
|
|
|
864
864
|
onClick: () => {
|
|
865
865
|
window.confirm("Remove this notification subscription?") && He.mutate(e.id);
|
|
866
866
|
},
|
|
867
|
-
children: /* @__PURE__ */ t(
|
|
867
|
+
children: /* @__PURE__ */ t(L, { className: "h-3.5 w-3.5" })
|
|
868
868
|
}
|
|
869
869
|
)
|
|
870
870
|
] }) })
|
|
@@ -873,16 +873,16 @@ function Yt({
|
|
|
873
873
|
)
|
|
874
874
|
] }),
|
|
875
875
|
g === "history" && /* @__PURE__ */ t(
|
|
876
|
-
|
|
876
|
+
xe,
|
|
877
877
|
{
|
|
878
878
|
title: "Alert history",
|
|
879
|
-
hint:
|
|
879
|
+
hint: ie > 0 ? `${ie} open · last 100 events` : "Last 100 events — none open",
|
|
880
880
|
children: /* @__PURE__ */ t(
|
|
881
|
-
|
|
881
|
+
E,
|
|
882
882
|
{
|
|
883
883
|
headers: [
|
|
884
884
|
"Alert rule",
|
|
885
|
-
{ label: "Reading", width: 168 },
|
|
885
|
+
{ label: "Reading when fired", width: 168 },
|
|
886
886
|
{ label: "Fired", width: 150 },
|
|
887
887
|
{ label: "Resolved", width: 150 },
|
|
888
888
|
{ label: "Open for", width: 92, align: "right" }
|
|
@@ -891,8 +891,8 @@ function Yt({
|
|
|
891
891
|
emptyHint: "Events appear here the first time a rule crosses its threshold.",
|
|
892
892
|
emptyIcon: /* @__PURE__ */ t(Re, { className: "h-5 w-5" }),
|
|
893
893
|
loading: Ie,
|
|
894
|
-
children:
|
|
895
|
-
const a = e.status === "firing" && !e.resolved_at,
|
|
894
|
+
children: I.map((e) => {
|
|
895
|
+
const a = e.status === "firing" && !e.resolved_at, u = e.resolved_at ? je(e.fired_at, e.resolved_at) : je(e.fired_at, (/* @__PURE__ */ new Date()).toISOString());
|
|
896
896
|
return /* @__PURE__ */ l(
|
|
897
897
|
"tr",
|
|
898
898
|
{
|
|
@@ -917,18 +917,31 @@ function Yt({
|
|
|
917
917
|
}
|
|
918
918
|
)
|
|
919
919
|
] }) }),
|
|
920
|
-
/* @__PURE__ */
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
920
|
+
/* @__PURE__ */ l("td", { className: r, children: [
|
|
921
|
+
/* @__PURE__ */ t(
|
|
922
|
+
Ot,
|
|
923
|
+
{
|
|
924
|
+
value: e.metric_value,
|
|
925
|
+
threshold: e.threshold_value,
|
|
926
|
+
unit: e.definition_unit,
|
|
927
|
+
breaching: a
|
|
928
|
+
}
|
|
929
|
+
),
|
|
930
|
+
a && e.current_value != null && /* @__PURE__ */ l(
|
|
931
|
+
"span",
|
|
932
|
+
{
|
|
933
|
+
"data-alert-current": !0,
|
|
934
|
+
className: "mt-0.5 block font-mono text-[10.5px] tabular-nums text-slate-500 dark:text-slate-400",
|
|
935
|
+
children: [
|
|
936
|
+
A(e.current_value, e.definition_unit ?? void 0),
|
|
937
|
+
" now, as you see it"
|
|
938
|
+
]
|
|
939
|
+
}
|
|
940
|
+
)
|
|
941
|
+
] }),
|
|
942
|
+
/* @__PURE__ */ t("td", { className: r, children: /* @__PURE__ */ t(pe, { value: e.fired_at }) }),
|
|
943
|
+
/* @__PURE__ */ t("td", { className: r, children: e.resolved_at ? /* @__PURE__ */ t(pe, { value: e.resolved_at }) : /* @__PURE__ */ t("span", { className: "inline-flex items-center gap-1.5 rounded-full bg-red-50 px-2 py-px text-[10.5px] font-semibold text-red-600 dark:bg-red-500/10 dark:text-red-400", children: "Still open" }) }),
|
|
944
|
+
/* @__PURE__ */ t("td", { className: i(jt, "text-right"), children: /* @__PURE__ */ t("span", { className: i(a && "text-red-600 dark:text-red-400"), children: u ?? "—" }) })
|
|
932
945
|
]
|
|
933
946
|
},
|
|
934
947
|
e.id
|
|
@@ -941,7 +954,7 @@ function Yt({
|
|
|
941
954
|
g === "widget_alerts" && /* @__PURE__ */ l("div", { className: "space-y-2", children: [
|
|
942
955
|
/* @__PURE__ */ t("p", { className: "text-[12px] text-slate-400", children: "Alerts set up directly on report widgets" }),
|
|
943
956
|
/* @__PURE__ */ t(
|
|
944
|
-
|
|
957
|
+
E,
|
|
945
958
|
{
|
|
946
959
|
headers: [
|
|
947
960
|
"Alert",
|
|
@@ -955,7 +968,7 @@ function Yt({
|
|
|
955
968
|
],
|
|
956
969
|
empty: "No widget alerts yet — open any report widget and click the bell icon",
|
|
957
970
|
loading: Ke,
|
|
958
|
-
children:
|
|
971
|
+
children: ee.map((e) => /* @__PURE__ */ l("tr", { className: "hover:bg-slate-50/60 dark:hover:bg-muted/30", children: [
|
|
959
972
|
/* @__PURE__ */ l("td", { className: r, children: [
|
|
960
973
|
/* @__PURE__ */ t("p", { className: "font-medium text-slate-800 dark:text-slate-100", children: e.name }),
|
|
961
974
|
e.report_name && /* @__PURE__ */ t(
|
|
@@ -971,51 +984,45 @@ function Yt({
|
|
|
971
984
|
}
|
|
972
985
|
)
|
|
973
986
|
] }),
|
|
974
|
-
/* @__PURE__ */ t("td", { className: i(r, "text-[11.5px] text-slate-400"), children:
|
|
975
|
-
/* @__PURE__ */ t("td", { className: r, children: /* @__PURE__ */ t("div", { className: "flex flex-wrap gap-1", children: (e.conditions ?? []).map((a,
|
|
987
|
+
/* @__PURE__ */ t("td", { className: i(r, "text-[11.5px] text-slate-400"), children: qt(e.filters, te == null ? void 0 : te.get(String(e.report))) }),
|
|
988
|
+
/* @__PURE__ */ t("td", { className: r, children: /* @__PURE__ */ t("div", { className: "flex flex-wrap gap-1", children: (e.conditions ?? []).map((a, u) => /* @__PURE__ */ t(
|
|
976
989
|
"span",
|
|
977
990
|
{
|
|
978
991
|
className: "inline-flex rounded bg-slate-100 px-1.5 py-px text-[11px] text-slate-600 dark:bg-muted dark:text-slate-300",
|
|
979
|
-
children:
|
|
980
|
-
a.field,
|
|
981
|
-
" ",
|
|
982
|
-
Z[a.op] ?? a.op,
|
|
983
|
-
" ",
|
|
984
|
-
a.value
|
|
985
|
-
]
|
|
992
|
+
children: $t(a)
|
|
986
993
|
},
|
|
987
|
-
`${a.field}-${
|
|
994
|
+
`${a.field}-${u}`
|
|
988
995
|
)) }) }),
|
|
989
|
-
/* @__PURE__ */ t("td", { className: r, children:
|
|
990
|
-
|
|
996
|
+
/* @__PURE__ */ t("td", { className: r, children: q(Y(e)) ? /* @__PURE__ */ t(
|
|
997
|
+
S,
|
|
991
998
|
{
|
|
992
999
|
checked: !!e.delivery_inapp,
|
|
993
|
-
onChange: (a) =>
|
|
1000
|
+
onChange: (a) => ne(e, { delivery_inapp: a })
|
|
994
1001
|
}
|
|
995
|
-
) : /* @__PURE__ */ t(
|
|
996
|
-
/* @__PURE__ */ t("td", { className: r, children:
|
|
997
|
-
|
|
1002
|
+
) : /* @__PURE__ */ t(he, { on: !!e.delivery_inapp }) }),
|
|
1003
|
+
/* @__PURE__ */ t("td", { className: r, children: q(Y(e)) ? /* @__PURE__ */ t(
|
|
1004
|
+
S,
|
|
998
1005
|
{
|
|
999
1006
|
checked: !!e.delivery_email,
|
|
1000
|
-
onChange: (a) =>
|
|
1007
|
+
onChange: (a) => ne(e, { delivery_email: a })
|
|
1001
1008
|
}
|
|
1002
|
-
) : /* @__PURE__ */ t(
|
|
1003
|
-
/* @__PURE__ */ t("td", { className: i(r, "text-[11.5px] text-slate-400"), children:
|
|
1004
|
-
/* @__PURE__ */ t("td", { className: r, children:
|
|
1005
|
-
|
|
1009
|
+
) : /* @__PURE__ */ t(he, { on: !!e.delivery_email }) }),
|
|
1010
|
+
/* @__PURE__ */ t("td", { className: i(r, "text-[11.5px] text-slate-400"), children: O(e.last_fired) }),
|
|
1011
|
+
/* @__PURE__ */ t("td", { className: r, children: q(Y(e)) ? /* @__PURE__ */ t(
|
|
1012
|
+
S,
|
|
1006
1013
|
{
|
|
1007
1014
|
checked: !!e.is_active,
|
|
1008
|
-
onChange: (a) =>
|
|
1015
|
+
onChange: (a) => ne(e, { is_active: a })
|
|
1009
1016
|
}
|
|
1010
|
-
) : /* @__PURE__ */ t(
|
|
1011
|
-
/* @__PURE__ */ t("td", { className: r, children:
|
|
1017
|
+
) : /* @__PURE__ */ t(he, { on: !!e.is_active }) }),
|
|
1018
|
+
/* @__PURE__ */ t("td", { className: r, children: q(Y(e)) && /* @__PURE__ */ t(
|
|
1012
1019
|
"button",
|
|
1013
1020
|
{
|
|
1014
1021
|
type: "button",
|
|
1015
1022
|
title: "Delete",
|
|
1016
1023
|
className: i(w, "hover:border-red-300 hover:text-red-500"),
|
|
1017
1024
|
onClick: () => rt(e),
|
|
1018
|
-
children: /* @__PURE__ */ t(
|
|
1025
|
+
children: /* @__PURE__ */ t(L, { className: "h-3.5 w-3.5" })
|
|
1019
1026
|
}
|
|
1020
1027
|
) })
|
|
1021
1028
|
] }, e.id))
|
|
@@ -1025,7 +1032,7 @@ function Yt({
|
|
|
1025
1032
|
g === "widget_alert_history" && /* @__PURE__ */ l("div", { className: "space-y-2", children: [
|
|
1026
1033
|
/* @__PURE__ */ t("p", { className: "text-[12px] text-slate-400", children: "Last 200 widget alert events" }),
|
|
1027
1034
|
/* @__PURE__ */ t(
|
|
1028
|
-
|
|
1035
|
+
E,
|
|
1029
1036
|
{
|
|
1030
1037
|
headers: [
|
|
1031
1038
|
"Alert",
|
|
@@ -1036,27 +1043,27 @@ function Yt({
|
|
|
1036
1043
|
{ label: "", width: 90 }
|
|
1037
1044
|
],
|
|
1038
1045
|
empty: "No widget alert history yet",
|
|
1039
|
-
loading:
|
|
1040
|
-
children:
|
|
1046
|
+
loading: We,
|
|
1047
|
+
children: ve.map((e) => /* @__PURE__ */ l("tr", { className: "hover:bg-slate-50/60 dark:hover:bg-muted/30", children: [
|
|
1041
1048
|
/* @__PURE__ */ l("td", { className: r, children: [
|
|
1042
1049
|
/* @__PURE__ */ t("p", { className: "font-medium text-slate-800 dark:text-slate-100", children: e.alert_name }),
|
|
1043
1050
|
e.report_name && /* @__PURE__ */ t("p", { className: "text-[11px] text-slate-400", children: e.report_name })
|
|
1044
1051
|
] }),
|
|
1045
|
-
/* @__PURE__ */ t("td", { className: r, children: /* @__PURE__ */ t("div", { className: "flex flex-wrap gap-1", children: Object.entries(e.metric_snapshot ?? {}).map(([a,
|
|
1052
|
+
/* @__PURE__ */ t("td", { className: r, children: /* @__PURE__ */ t("div", { className: "flex flex-wrap gap-1", children: Object.entries(e.metric_snapshot ?? {}).map(([a, u]) => /* @__PURE__ */ l(
|
|
1046
1053
|
"span",
|
|
1047
1054
|
{
|
|
1048
1055
|
className: "inline-flex rounded bg-orange-50 px-1.5 py-px text-[11px] text-orange-600 dark:bg-orange-500/10 dark:text-orange-400",
|
|
1049
1056
|
children: [
|
|
1050
1057
|
a,
|
|
1051
1058
|
": ",
|
|
1052
|
-
String(
|
|
1059
|
+
String(u)
|
|
1053
1060
|
]
|
|
1054
1061
|
},
|
|
1055
1062
|
a
|
|
1056
1063
|
)) }) }),
|
|
1057
|
-
/* @__PURE__ */ t("td", { className: i(r, "text-[11.5px]"), children:
|
|
1058
|
-
/* @__PURE__ */ t("td", { className: i(r, "text-[11.5px] text-slate-400"), children:
|
|
1059
|
-
/* @__PURE__ */ t("td", { className: r, children: /* @__PURE__ */ t(
|
|
1064
|
+
/* @__PURE__ */ t("td", { className: i(r, "text-[11.5px]"), children: O(e.fired_at) }),
|
|
1065
|
+
/* @__PURE__ */ t("td", { className: i(r, "text-[11.5px] text-slate-400"), children: O(e.resolved_at) }),
|
|
1066
|
+
/* @__PURE__ */ t("td", { className: r, children: /* @__PURE__ */ t(j, { status: e.status }) }),
|
|
1060
1067
|
/* @__PURE__ */ t("td", { className: r, children: e.status === "firing" && /* @__PURE__ */ t(
|
|
1061
1068
|
"button",
|
|
1062
1069
|
{
|
|
@@ -1077,19 +1084,19 @@ function Yt({
|
|
|
1077
1084
|
"button",
|
|
1078
1085
|
{
|
|
1079
1086
|
type: "button",
|
|
1080
|
-
className:
|
|
1087
|
+
className: de,
|
|
1081
1088
|
onClick: () => {
|
|
1082
|
-
|
|
1089
|
+
W(null), B(!0);
|
|
1083
1090
|
},
|
|
1084
1091
|
children: [
|
|
1085
|
-
/* @__PURE__ */ t(
|
|
1092
|
+
/* @__PURE__ */ t(me, { className: "h-3 w-3" }),
|
|
1086
1093
|
" New Rule"
|
|
1087
1094
|
]
|
|
1088
1095
|
}
|
|
1089
1096
|
)
|
|
1090
1097
|
] }),
|
|
1091
1098
|
/* @__PURE__ */ t(
|
|
1092
|
-
|
|
1099
|
+
E,
|
|
1093
1100
|
{
|
|
1094
1101
|
headers: [
|
|
1095
1102
|
"Rule",
|
|
@@ -1101,9 +1108,9 @@ function Yt({
|
|
|
1101
1108
|
{ label: "", width: 80 }
|
|
1102
1109
|
],
|
|
1103
1110
|
empty: "No anomaly rules yet — create one to start detecting unusual patterns",
|
|
1104
|
-
loading:
|
|
1105
|
-
children:
|
|
1106
|
-
const a =
|
|
1111
|
+
loading: Ve,
|
|
1112
|
+
children: ye.map((e) => {
|
|
1113
|
+
const a = q(e.created_by);
|
|
1107
1114
|
return /* @__PURE__ */ l("tr", { className: "hover:bg-slate-50/60 dark:hover:bg-muted/30", children: [
|
|
1108
1115
|
/* @__PURE__ */ l("td", { className: r, children: [
|
|
1109
1116
|
/* @__PURE__ */ t("p", { className: "font-medium text-slate-800 dark:text-slate-100", children: e.name }),
|
|
@@ -1113,7 +1120,7 @@ function Yt({
|
|
|
1113
1120
|
"span",
|
|
1114
1121
|
{
|
|
1115
1122
|
className: i(
|
|
1116
|
-
"inline-flex rounded-full px-2 py-px text-[10.5px] font-semibold
|
|
1123
|
+
"inline-flex rounded-full px-2 py-px text-[10.5px] font-semibold",
|
|
1117
1124
|
e.sensitivity === "high" ? "bg-orange-50 text-orange-600 dark:bg-orange-500/10 dark:text-orange-400" : e.sensitivity === "low" ? "bg-slate-100 text-slate-500 dark:bg-muted dark:text-slate-400" : "bg-sky-50 text-sky-600 dark:bg-sky-500/10 dark:text-sky-400"
|
|
1118
1125
|
),
|
|
1119
1126
|
children: e.sensitivity ?? "medium"
|
|
@@ -1121,22 +1128,22 @@ function Yt({
|
|
|
1121
1128
|
) }),
|
|
1122
1129
|
/* @__PURE__ */ t("td", { className: i(r, "capitalize"), children: e.check_frequency }),
|
|
1123
1130
|
/* @__PURE__ */ t("td", { className: r, children: /* @__PURE__ */ t(
|
|
1124
|
-
|
|
1131
|
+
S,
|
|
1125
1132
|
{
|
|
1126
1133
|
checked: !!e.delivery_in_app,
|
|
1127
1134
|
disabled: !a,
|
|
1128
|
-
onChange: (
|
|
1135
|
+
onChange: (u) => Ce(e.id, { delivery_in_app: u })
|
|
1129
1136
|
}
|
|
1130
1137
|
) }),
|
|
1131
1138
|
/* @__PURE__ */ t("td", { className: r, children: /* @__PURE__ */ t(
|
|
1132
|
-
|
|
1139
|
+
S,
|
|
1133
1140
|
{
|
|
1134
1141
|
checked: !!e.delivery_email,
|
|
1135
1142
|
disabled: !a,
|
|
1136
|
-
onChange: (
|
|
1143
|
+
onChange: (u) => Ce(e.id, { delivery_email: u })
|
|
1137
1144
|
}
|
|
1138
1145
|
) }),
|
|
1139
|
-
/* @__PURE__ */ t("td", { className: r, children: /* @__PURE__ */ t(
|
|
1146
|
+
/* @__PURE__ */ t("td", { className: r, children: /* @__PURE__ */ t(j, { status: e.status }) }),
|
|
1140
1147
|
/* @__PURE__ */ t("td", { className: r, children: a && /* @__PURE__ */ l("div", { className: "flex items-center gap-1", children: [
|
|
1141
1148
|
/* @__PURE__ */ t(
|
|
1142
1149
|
"button",
|
|
@@ -1145,7 +1152,7 @@ function Yt({
|
|
|
1145
1152
|
title: "Edit",
|
|
1146
1153
|
className: w,
|
|
1147
1154
|
onClick: () => {
|
|
1148
|
-
|
|
1155
|
+
W(e), B(!0);
|
|
1149
1156
|
},
|
|
1150
1157
|
children: /* @__PURE__ */ t(ue, { className: "h-3.5 w-3.5" })
|
|
1151
1158
|
}
|
|
@@ -1157,7 +1164,7 @@ function Yt({
|
|
|
1157
1164
|
title: "Delete",
|
|
1158
1165
|
className: i(w, "hover:border-red-300 hover:text-red-500"),
|
|
1159
1166
|
onClick: () => lt(e),
|
|
1160
|
-
children: /* @__PURE__ */ t(
|
|
1167
|
+
children: /* @__PURE__ */ t(L, { className: "h-3.5 w-3.5" })
|
|
1161
1168
|
}
|
|
1162
1169
|
)
|
|
1163
1170
|
] }) })
|
|
@@ -1167,13 +1174,13 @@ function Yt({
|
|
|
1167
1174
|
)
|
|
1168
1175
|
] }),
|
|
1169
1176
|
g === "anomaly_history" && /* @__PURE__ */ t(
|
|
1170
|
-
|
|
1177
|
+
xe,
|
|
1171
1178
|
{
|
|
1172
1179
|
wide: !0,
|
|
1173
1180
|
title: "Detected anomalies",
|
|
1174
1181
|
hint: `Last 200 detections${Ae ? ` · ${Ae} needing review` : ""}`,
|
|
1175
1182
|
children: /* @__PURE__ */ t(
|
|
1176
|
-
|
|
1183
|
+
E,
|
|
1177
1184
|
{
|
|
1178
1185
|
headers: [
|
|
1179
1186
|
"Subject",
|
|
@@ -1185,11 +1192,11 @@ function Yt({
|
|
|
1185
1192
|
empty: "No anomalies detected",
|
|
1186
1193
|
emptyHint: "Detections appear here when a subject deviates from its own recent pattern.",
|
|
1187
1194
|
emptyIcon: /* @__PURE__ */ t(qe, { className: "h-5 w-5" }),
|
|
1188
|
-
loading:
|
|
1189
|
-
children:
|
|
1190
|
-
const a = e.stats_snapshot ?? {},
|
|
1195
|
+
loading: Qe,
|
|
1196
|
+
children: H.map((e) => {
|
|
1197
|
+
const a = e.stats_snapshot ?? {}, u = Object.values(
|
|
1191
1198
|
a.group ?? {}
|
|
1192
|
-
).filter(Boolean),
|
|
1199
|
+
).filter(Boolean), c = typeof a.multiplier == "number" ? a.multiplier : null, v = typeof a.value == "number" ? a.value : null, x = typeof a.mean == "number" ? a.mean : null, N = e.status !== "resolved";
|
|
1193
1200
|
return /* @__PURE__ */ l(
|
|
1194
1201
|
"tr",
|
|
1195
1202
|
{
|
|
@@ -1205,33 +1212,33 @@ function Yt({
|
|
|
1205
1212
|
),
|
|
1206
1213
|
/* @__PURE__ */ l("div", { className: "min-w-0", children: [
|
|
1207
1214
|
/* @__PURE__ */ t("p", { className: "font-medium text-slate-800 dark:text-slate-100", children: String(a.subject_label ?? e.subject_id) }),
|
|
1208
|
-
/* @__PURE__ */ t("p", { className: "truncate text-[11px] text-slate-500 dark:text-slate-400", children: [e.rule_name ?? `Rule #${e.rule_id}`, ...
|
|
1215
|
+
/* @__PURE__ */ t("p", { className: "truncate text-[11px] text-slate-500 dark:text-slate-400", children: [e.rule_name ?? `Rule #${e.rule_id}`, ...u].join(" · ") })
|
|
1209
1216
|
] })
|
|
1210
1217
|
] }) }),
|
|
1211
|
-
/* @__PURE__ */ t("td", { className: r, children:
|
|
1218
|
+
/* @__PURE__ */ t("td", { className: r, children: c != null ? /* @__PURE__ */ l("span", { className: "flex flex-col gap-0.5", children: [
|
|
1212
1219
|
/* @__PURE__ */ l(
|
|
1213
1220
|
"span",
|
|
1214
1221
|
{
|
|
1215
1222
|
className: i(
|
|
1216
1223
|
"font-mono text-[13px] font-semibold tabular-nums",
|
|
1217
|
-
|
|
1224
|
+
c >= 3 ? "text-red-600 dark:text-red-400" : "text-amber-600 dark:text-amber-400"
|
|
1218
1225
|
),
|
|
1219
1226
|
children: [
|
|
1220
|
-
|
|
1227
|
+
c.toFixed(1),
|
|
1221
1228
|
"×"
|
|
1222
1229
|
]
|
|
1223
1230
|
}
|
|
1224
1231
|
),
|
|
1225
|
-
|
|
1226
|
-
|
|
1232
|
+
v != null && x != null && /* @__PURE__ */ l("span", { className: "font-mono text-[10.5px] tabular-nums text-slate-400 dark:text-slate-500", children: [
|
|
1233
|
+
A(v, "dollar"),
|
|
1227
1234
|
" vs ",
|
|
1228
|
-
|
|
1235
|
+
A(x, "dollar")
|
|
1229
1236
|
] })
|
|
1230
1237
|
] }) : /* @__PURE__ */ t("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }) }),
|
|
1231
|
-
/* @__PURE__ */ t("td", { className: i(r, "max-w-0"), children: /* @__PURE__ */ t(
|
|
1238
|
+
/* @__PURE__ */ t("td", { className: i(r, "max-w-0"), children: /* @__PURE__ */ t(Pt, { text: e.ai_explanation }) }),
|
|
1232
1239
|
/* @__PURE__ */ l("td", { className: r, children: [
|
|
1233
|
-
/* @__PURE__ */ t(
|
|
1234
|
-
e.status !== "new" && /* @__PURE__ */ t("span", { className: "mt-1 block", children: /* @__PURE__ */ t(
|
|
1240
|
+
/* @__PURE__ */ t(pe, { value: e.detected_at }),
|
|
1241
|
+
e.status !== "new" && /* @__PURE__ */ t("span", { className: "mt-1 block", children: /* @__PURE__ */ t(j, { status: e.status }) })
|
|
1235
1242
|
] }),
|
|
1236
1243
|
/* @__PURE__ */ t("td", { className: r, children: /* @__PURE__ */ l("div", { className: "flex items-center justify-end gap-1", children: [
|
|
1237
1244
|
e.status === "new" && /* @__PURE__ */ t(
|
|
@@ -1239,7 +1246,7 @@ function Yt({
|
|
|
1239
1246
|
{
|
|
1240
1247
|
type: "button",
|
|
1241
1248
|
className: "inline-flex h-7 items-center rounded-md border border-slate-200 px-2.5 text-[11.5px] font-medium text-slate-600 transition-colors hover:bg-slate-50 dark:border-border dark:text-slate-300 dark:hover:bg-muted",
|
|
1242
|
-
onClick: () =>
|
|
1249
|
+
onClick: () => Se(e.id, "acknowledged"),
|
|
1243
1250
|
children: "Acknowledge"
|
|
1244
1251
|
}
|
|
1245
1252
|
),
|
|
@@ -1248,7 +1255,7 @@ function Yt({
|
|
|
1248
1255
|
{
|
|
1249
1256
|
type: "button",
|
|
1250
1257
|
className: "inline-flex h-7 items-center rounded-md border border-nvr-cyan px-2.5 text-[11.5px] font-medium text-nvr-navy transition-colors hover:bg-nvr-cyan/10 dark:text-nvr-cyan",
|
|
1251
|
-
onClick: () =>
|
|
1258
|
+
onClick: () => Se(e.id, "resolved"),
|
|
1252
1259
|
children: "Resolve"
|
|
1253
1260
|
}
|
|
1254
1261
|
)
|
|
@@ -1266,39 +1273,39 @@ function Yt({
|
|
|
1266
1273
|
/* @__PURE__ */ t(
|
|
1267
1274
|
Ct,
|
|
1268
1275
|
{
|
|
1269
|
-
open:
|
|
1270
|
-
definitions:
|
|
1271
|
-
editRule:
|
|
1276
|
+
open: ze,
|
|
1277
|
+
definitions: R,
|
|
1278
|
+
editRule: ae,
|
|
1272
1279
|
preselectedDefinitionId: Ye,
|
|
1273
|
-
onClose: () =>
|
|
1280
|
+
onClose: () => K(!1),
|
|
1274
1281
|
onSave: et,
|
|
1275
1282
|
saving: we
|
|
1276
1283
|
}
|
|
1277
1284
|
),
|
|
1278
1285
|
/* @__PURE__ */ t(
|
|
1279
|
-
|
|
1286
|
+
St,
|
|
1280
1287
|
{
|
|
1281
1288
|
open: Je,
|
|
1282
|
-
definitions:
|
|
1283
|
-
editRule:
|
|
1289
|
+
definitions: Ue,
|
|
1290
|
+
editRule: le,
|
|
1284
1291
|
onClose: () => {
|
|
1285
|
-
|
|
1292
|
+
B(!1), W(null);
|
|
1286
1293
|
},
|
|
1287
1294
|
onSave: at,
|
|
1288
1295
|
saving: we
|
|
1289
1296
|
}
|
|
1290
1297
|
),
|
|
1291
1298
|
/* @__PURE__ */ t(
|
|
1292
|
-
|
|
1299
|
+
Et,
|
|
1293
1300
|
{
|
|
1294
|
-
open:
|
|
1295
|
-
sub:
|
|
1296
|
-
onClose: () =>
|
|
1297
|
-
saving:
|
|
1301
|
+
open: U != null,
|
|
1302
|
+
sub: U,
|
|
1303
|
+
onClose: () => re(null),
|
|
1304
|
+
saving: G.isPending,
|
|
1298
1305
|
onSave: (e) => {
|
|
1299
|
-
|
|
1300
|
-
{ id:
|
|
1301
|
-
{ onSuccess: () =>
|
|
1306
|
+
U && G.mutate(
|
|
1307
|
+
{ id: U.id, patch: e },
|
|
1308
|
+
{ onSuccess: () => re(null) }
|
|
1302
1309
|
);
|
|
1303
1310
|
}
|
|
1304
1311
|
}
|
|
@@ -1306,7 +1313,7 @@ function Yt({
|
|
|
1306
1313
|
] });
|
|
1307
1314
|
}
|
|
1308
1315
|
export {
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1316
|
+
Xt as AlertManagerView,
|
|
1317
|
+
Rt as alertFilterLabel,
|
|
1318
|
+
qt as alertScopeText
|
|
1312
1319
|
};
|