@nivaro/react 0.3.87 → 0.3.89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +18 -0
- package/dist/index.js +518 -516
- package/dist/shared/components/ops-report/CompareTab.js +110 -0
- package/dist/shared/components/ops-report/DigestSections.js +1134 -0
- package/dist/shared/components/ops-report/OpsReportView.js +88 -0
- package/dist/shared/components/ops-report/ReportTab.js +527 -0
- package/dist/shared/components/ops-report/SettingsPanel.js +247 -0
- package/dist/shared/components/ops-report/TrendsTab.js +191 -0
- package/dist/shared/components/ops-report/chip.js +17 -0
- package/dist/shared/components/ops-report/drill.js +328 -0
- package/dist/shared/components/ops-report/format.js +163 -0
- package/dist/shared/components/ops-report/ui.js +208 -0
- package/dist/shared/components/panels/MoveToStatePanel.js +127 -0
- package/dist/shared/components/panels/PipelinePanel.js +1044 -1029
- package/dist/shared/lib/ops-report-types.js +141 -0
- package/package.json +1 -1
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
import { jsxs as d, jsx as e, Fragment as y } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery as A } from "@tanstack/react-query";
|
|
3
|
+
import { ArrowLeft as B, ChevronRight as j, ExternalLink as R } from "lucide-react";
|
|
4
|
+
import { useState as F, useCallback as q, useMemo as J, Suspense as K, createContext as Q, useEffect as z, lazy as M, useContext as G } from "react";
|
|
5
|
+
import { useNavigation as H, useNivaroClient as V } from "../../context.js";
|
|
6
|
+
import { get as W } from "../../lib/commands.js";
|
|
7
|
+
import { cn as w } from "../../lib/utils.js";
|
|
8
|
+
import { QueryErrorState as X } from "../QueryErrorState.js";
|
|
9
|
+
import { Sheet as Y, SheetContent as Z, SheetTitle as ee, SheetDescription as te } from "../ui/sheet.js";
|
|
10
|
+
import { Skeleton as E } from "../ui/skeleton.js";
|
|
11
|
+
import { Chip as re } from "./chip.js";
|
|
12
|
+
import { num as S, ms as ne } from "./format.js";
|
|
13
|
+
const le = M(
|
|
14
|
+
() => import("../RecordDrilldownSheet.js").then((i) => ({ default: i.RecordDrilldownSheet }))
|
|
15
|
+
), I = Q(null);
|
|
16
|
+
function ie() {
|
|
17
|
+
return G(I);
|
|
18
|
+
}
|
|
19
|
+
function ve({
|
|
20
|
+
target: i,
|
|
21
|
+
children: n,
|
|
22
|
+
className: m,
|
|
23
|
+
tip: p
|
|
24
|
+
}) {
|
|
25
|
+
const a = ie();
|
|
26
|
+
return !a || !i ? /* @__PURE__ */ e(y, { children: n }) : /* @__PURE__ */ e(
|
|
27
|
+
"button",
|
|
28
|
+
{
|
|
29
|
+
type: "button",
|
|
30
|
+
"data-ops-drill": i.metric,
|
|
31
|
+
"data-tip": p ?? "Show the rows behind this",
|
|
32
|
+
onClick: () => a.open(i),
|
|
33
|
+
className: w(
|
|
34
|
+
"cursor-pointer text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50",
|
|
35
|
+
m
|
|
36
|
+
),
|
|
37
|
+
children: n
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
const ae = [
|
|
42
|
+
[
|
|
43
|
+
/^(failed|error|bad|breached|open|refused|rejected|critical|high)/i,
|
|
44
|
+
"border-red-200 bg-red-50 text-red-800 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-300"
|
|
45
|
+
],
|
|
46
|
+
[
|
|
47
|
+
/^(pending|waiting|deferred|slow|medium|watch|running|queued)/i,
|
|
48
|
+
"border-amber-200 bg-amber-50 text-amber-800 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-300"
|
|
49
|
+
],
|
|
50
|
+
[
|
|
51
|
+
/^(ok|done|sent|accepted|ready|success|healthy|closed|fixed)/i,
|
|
52
|
+
"border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-500/30 dark:bg-emerald-500/10 dark:text-emerald-300"
|
|
53
|
+
]
|
|
54
|
+
];
|
|
55
|
+
function oe({ col: i, value: n }) {
|
|
56
|
+
var p;
|
|
57
|
+
if (n == null || n === "") return /* @__PURE__ */ e("span", { className: "text-slate-400", children: "–" });
|
|
58
|
+
const m = typeof n == "number" ? n : Number(n);
|
|
59
|
+
switch (i.type) {
|
|
60
|
+
case "number":
|
|
61
|
+
return /* @__PURE__ */ e(y, { children: Number.isFinite(m) ? S(m, Number.isInteger(m) ? 0 : 1) : String(n) });
|
|
62
|
+
case "ms":
|
|
63
|
+
return /* @__PURE__ */ e(y, { children: Number.isFinite(m) ? ne(m) : String(n) });
|
|
64
|
+
case "usd":
|
|
65
|
+
return /* @__PURE__ */ e(y, { children: Number.isFinite(m) ? `$${m.toLocaleString("en-US", { maximumFractionDigits: m < 10 ? 2 : 0 })}` : String(n) });
|
|
66
|
+
case "status": {
|
|
67
|
+
const a = String(n), h = (p = ae.find(([g]) => g.test(a))) == null ? void 0 : p[1];
|
|
68
|
+
return /* @__PURE__ */ e(
|
|
69
|
+
re,
|
|
70
|
+
{
|
|
71
|
+
className: h ?? "border-slate-200 bg-slate-50 text-slate-700 dark:border-border dark:bg-muted dark:text-muted-foreground",
|
|
72
|
+
children: a
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
default:
|
|
77
|
+
return /* @__PURE__ */ e(y, { children: String(n) });
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function de(i, n) {
|
|
81
|
+
if (n !== "json") return i;
|
|
82
|
+
try {
|
|
83
|
+
return JSON.stringify(JSON.parse(i), null, 2);
|
|
84
|
+
} catch {
|
|
85
|
+
return i;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
function se({
|
|
89
|
+
reportId: i,
|
|
90
|
+
target: n,
|
|
91
|
+
onTitle: m,
|
|
92
|
+
onDrill: p,
|
|
93
|
+
onLink: a,
|
|
94
|
+
onRecord: h
|
|
95
|
+
}) {
|
|
96
|
+
var l, c, N;
|
|
97
|
+
const g = V(), b = A({
|
|
98
|
+
queryKey: ["ops-drill", i, n.metric, n.key ?? null],
|
|
99
|
+
queryFn: () => g.request(
|
|
100
|
+
W(`/ops-reports/${i}/drill`, {
|
|
101
|
+
metric: n.metric,
|
|
102
|
+
...n.key ? { key: n.key } : {},
|
|
103
|
+
limit: 200
|
|
104
|
+
})
|
|
105
|
+
).then((t) => t.data),
|
|
106
|
+
staleTime: 6e4
|
|
107
|
+
}), f = (l = b.data) == null ? void 0 : l.title;
|
|
108
|
+
if (z(() => {
|
|
109
|
+
f && m(f);
|
|
110
|
+
}, [f]), b.isLoading)
|
|
111
|
+
return /* @__PURE__ */ d("div", { className: "space-y-2 p-5", "aria-busy": "true", children: [
|
|
112
|
+
/* @__PURE__ */ e(E, { className: "h-4 w-2/3" }),
|
|
113
|
+
/* @__PURE__ */ e(E, { className: "h-32 w-full" })
|
|
114
|
+
] });
|
|
115
|
+
if (b.error || !b.data)
|
|
116
|
+
return /* @__PURE__ */ e("div", { className: "p-5", children: /* @__PURE__ */ e(X, { error: b.error, what: "these rows", onRetry: () => void b.refetch() }) });
|
|
117
|
+
const o = b.data, s = o.columns ?? [], x = o.rows ?? [], r = x.some((t) => typeof t._link == "string" && t._link);
|
|
118
|
+
return /* @__PURE__ */ d("div", { className: "space-y-4 p-5", "data-ops-drill-level": o.metric, children: [
|
|
119
|
+
o.description && /* @__PURE__ */ e(te, { className: "text-[12.5px] leading-relaxed text-slate-600 dark:text-muted-foreground", children: o.description }),
|
|
120
|
+
o.detail && (((c = o.detail.fields) == null ? void 0 : c.length) ?? 0) > 0 && /* @__PURE__ */ e("dl", { className: "grid grid-cols-[130px_1fr] gap-x-3 gap-y-1 rounded-lg border border-slate-200 bg-slate-50 p-3 text-[12px] dark:border-border dark:bg-muted/40", children: o.detail.fields.map((t) => /* @__PURE__ */ d("div", { className: "contents", children: [
|
|
121
|
+
/* @__PURE__ */ e("dt", { className: "text-slate-500 dark:text-muted-foreground", children: t.label }),
|
|
122
|
+
/* @__PURE__ */ e("dd", { className: "min-w-0 break-words text-slate-900 dark:text-foreground", children: t.link ? /* @__PURE__ */ d(
|
|
123
|
+
"button",
|
|
124
|
+
{
|
|
125
|
+
type: "button",
|
|
126
|
+
onClick: () => a(t.link),
|
|
127
|
+
className: "inline-flex items-center gap-1 text-sky-700 hover:underline dark:text-nvr-cyan",
|
|
128
|
+
children: [
|
|
129
|
+
t.value ?? "Open",
|
|
130
|
+
/* @__PURE__ */ e(R, { className: "h-3 w-3", "aria-hidden": !0 })
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
) : t.value ?? "–" })
|
|
134
|
+
] }, t.label)) }),
|
|
135
|
+
(((N = o.detail) == null ? void 0 : N.blocks) ?? []).map((t) => /* @__PURE__ */ d("div", { children: [
|
|
136
|
+
/* @__PURE__ */ e("h4", { className: "mb-1 text-[10.5px] font-semibold uppercase tracking-wide text-slate-500 dark:text-muted-foreground", children: t.title }),
|
|
137
|
+
t.kind === "text" ? /* @__PURE__ */ e("p", { className: "whitespace-pre-wrap text-[12px] text-slate-800 dark:text-foreground", children: t.text }) : /* @__PURE__ */ e(
|
|
138
|
+
"pre",
|
|
139
|
+
{
|
|
140
|
+
"data-ops-block": t.kind ?? "code",
|
|
141
|
+
className: "max-h-72 overflow-auto rounded-md bg-[#0f172a] p-3 font-mono text-[11.5px] leading-relaxed text-slate-100",
|
|
142
|
+
children: de(t.text, t.kind)
|
|
143
|
+
}
|
|
144
|
+
)
|
|
145
|
+
] }, t.title)),
|
|
146
|
+
x.length > 0 && /* @__PURE__ */ d("div", { children: [
|
|
147
|
+
/* @__PURE__ */ e("div", { className: "overflow-x-auto rounded-lg border border-slate-200 dark:border-border", children: /* @__PURE__ */ d("table", { className: "w-full text-[12px]", children: [
|
|
148
|
+
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ d("tr", { className: "border-b border-slate-200 bg-slate-50 text-left text-[10.5px] uppercase tracking-wide text-slate-500 dark:border-border dark:bg-muted/40 dark:text-muted-foreground", children: [
|
|
149
|
+
s.map((t) => /* @__PURE__ */ e(
|
|
150
|
+
"th",
|
|
151
|
+
{
|
|
152
|
+
className: w(
|
|
153
|
+
"px-2.5 py-1.5 font-medium",
|
|
154
|
+
(t.type === "number" || t.type === "ms" || t.type === "usd") && "text-right"
|
|
155
|
+
),
|
|
156
|
+
children: t.label
|
|
157
|
+
},
|
|
158
|
+
t.key
|
|
159
|
+
)),
|
|
160
|
+
r && /* @__PURE__ */ e("th", { className: "w-8" })
|
|
161
|
+
] }) }),
|
|
162
|
+
/* @__PURE__ */ e("tbody", { children: x.map((t, T) => {
|
|
163
|
+
const C = t._drill_metric, D = t._drill_key, L = typeof t._link == "string" && t._link ? t._link : null, v = s[0] ? t[s[0].key] : null, _ = t._record_collection, $ = t._record_id, O = typeof _ == "string" && _ !== "" && $ != null && $ !== "", U = v == null ? void 0 : String(v), k = O ? () => h(_, String($), U) : C ? () => p({
|
|
164
|
+
metric: C,
|
|
165
|
+
key: D == null ? null : String(D),
|
|
166
|
+
label: v == null ? void 0 : String(v)
|
|
167
|
+
}) : void 0;
|
|
168
|
+
return /* @__PURE__ */ d(
|
|
169
|
+
"tr",
|
|
170
|
+
{
|
|
171
|
+
"data-ops-drill-row": O ? "record" : C ?? void 0,
|
|
172
|
+
tabIndex: k ? 0 : void 0,
|
|
173
|
+
onClick: k,
|
|
174
|
+
onKeyDown: k ? (u) => {
|
|
175
|
+
(u.key === "Enter" || u.key === " ") && (u.preventDefault(), k());
|
|
176
|
+
} : void 0,
|
|
177
|
+
className: w(
|
|
178
|
+
"border-b border-slate-100 last:border-0 dark:border-border/60",
|
|
179
|
+
k && "cursor-pointer hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-nvr-cyan/50"
|
|
180
|
+
),
|
|
181
|
+
children: [
|
|
182
|
+
s.map((u, P) => /* @__PURE__ */ e(
|
|
183
|
+
"td",
|
|
184
|
+
{
|
|
185
|
+
className: w(
|
|
186
|
+
"px-2.5 py-1.5 align-top text-slate-700 dark:text-foreground",
|
|
187
|
+
(u.type === "number" || u.type === "ms" || u.type === "usd") && "text-right tabular-nums"
|
|
188
|
+
),
|
|
189
|
+
children: /* @__PURE__ */ d("span", { className: "inline-flex items-center gap-1", children: [
|
|
190
|
+
/* @__PURE__ */ e(oe, { col: u, value: t[u.key] }),
|
|
191
|
+
k && P === 0 && /* @__PURE__ */ e(j, { className: "h-3 w-3 text-slate-400", "aria-hidden": !0 })
|
|
192
|
+
] })
|
|
193
|
+
},
|
|
194
|
+
u.key
|
|
195
|
+
)),
|
|
196
|
+
r && /* @__PURE__ */ e("td", { className: "px-1 text-right", children: L && /* @__PURE__ */ e(
|
|
197
|
+
"button",
|
|
198
|
+
{
|
|
199
|
+
type: "button",
|
|
200
|
+
"aria-label": "Open in the app",
|
|
201
|
+
"data-tip": "Open in the app",
|
|
202
|
+
onClick: (u) => {
|
|
203
|
+
u.stopPropagation(), a(L);
|
|
204
|
+
},
|
|
205
|
+
className: "rounded p-1 text-slate-400 hover:bg-muted hover:text-slate-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50",
|
|
206
|
+
children: /* @__PURE__ */ e(R, { className: "h-3.5 w-3.5" })
|
|
207
|
+
}
|
|
208
|
+
) })
|
|
209
|
+
]
|
|
210
|
+
},
|
|
211
|
+
T
|
|
212
|
+
);
|
|
213
|
+
}) })
|
|
214
|
+
] }) }),
|
|
215
|
+
/* @__PURE__ */ e(
|
|
216
|
+
"p",
|
|
217
|
+
{
|
|
218
|
+
className: "mt-1.5 text-[11px] text-slate-500 dark:text-muted-foreground",
|
|
219
|
+
"data-ops-drill-total": "",
|
|
220
|
+
children: o.truncated ? `Showing the first ${S(x.length)} of ${S(o.total)}` : `${S(o.total || x.length)} ${(o.total || x.length) === 1 ? "row" : "rows"}`
|
|
221
|
+
}
|
|
222
|
+
)
|
|
223
|
+
] }),
|
|
224
|
+
x.length === 0 && !o.detail && /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12.5px] text-slate-500 dark:text-muted-foreground", children: "Nothing behind this number." })
|
|
225
|
+
] });
|
|
226
|
+
}
|
|
227
|
+
function we({
|
|
228
|
+
reportId: i,
|
|
229
|
+
linkTo: n,
|
|
230
|
+
children: m
|
|
231
|
+
}) {
|
|
232
|
+
const p = H(), [a, h] = F([]), [g, b] = F(null), f = q((r) => h([r]), []), o = J(() => ({ open: f }), [f]), s = a[a.length - 1], x = q(
|
|
233
|
+
(r) => {
|
|
234
|
+
let l = r;
|
|
235
|
+
const c = r.match(/^\/collections\/([^/?#]+)\/([^/?#]+)/);
|
|
236
|
+
c && p.itemUrl && (l = p.itemUrl({ collection: c[1], itemId: c[2] })), n && (l = n(r) ?? (c ? l : null)), l && window.open(l, "_blank", "noopener");
|
|
237
|
+
},
|
|
238
|
+
[p, n]
|
|
239
|
+
);
|
|
240
|
+
return /* @__PURE__ */ d(I.Provider, { value: o, children: [
|
|
241
|
+
m,
|
|
242
|
+
/* @__PURE__ */ e(Y, { open: a.length > 0, onOpenChange: (r) => !r && h([]), children: /* @__PURE__ */ d(
|
|
243
|
+
Z,
|
|
244
|
+
{
|
|
245
|
+
side: "right",
|
|
246
|
+
"data-ops-drill-panel": "",
|
|
247
|
+
"aria-describedby": void 0,
|
|
248
|
+
className: "flex w-[94vw] flex-col gap-0 p-0 sm:max-w-[760px]",
|
|
249
|
+
children: [
|
|
250
|
+
/* @__PURE__ */ d("div", { className: "shrink-0 border-b border-slate-200 px-5 pb-3 pt-3 pr-12 dark:border-border", children: [
|
|
251
|
+
/* @__PURE__ */ d(
|
|
252
|
+
"nav",
|
|
253
|
+
{
|
|
254
|
+
"aria-label": "Drill path",
|
|
255
|
+
className: "mb-1 flex min-h-[20px] flex-wrap items-center gap-1 text-[11.5px] text-slate-500 dark:text-muted-foreground",
|
|
256
|
+
children: [
|
|
257
|
+
a.length > 1 && /* @__PURE__ */ d(
|
|
258
|
+
"button",
|
|
259
|
+
{
|
|
260
|
+
type: "button",
|
|
261
|
+
"data-ops-drill-back": "",
|
|
262
|
+
onClick: () => h((r) => r.slice(0, -1)),
|
|
263
|
+
className: "mr-1 inline-flex items-center gap-1 rounded px-1 py-0.5 font-medium text-sky-700 hover:bg-muted dark:text-nvr-cyan",
|
|
264
|
+
children: [
|
|
265
|
+
/* @__PURE__ */ e(B, { className: "h-3 w-3", "aria-hidden": !0 }),
|
|
266
|
+
"Back"
|
|
267
|
+
]
|
|
268
|
+
}
|
|
269
|
+
),
|
|
270
|
+
a.map((r, l) => /* @__PURE__ */ d(
|
|
271
|
+
"span",
|
|
272
|
+
{
|
|
273
|
+
className: "inline-flex items-center gap-1",
|
|
274
|
+
children: [
|
|
275
|
+
l > 0 && /* @__PURE__ */ e(j, { className: "h-3 w-3", "aria-hidden": !0 }),
|
|
276
|
+
l < a.length - 1 ? /* @__PURE__ */ e(
|
|
277
|
+
"button",
|
|
278
|
+
{
|
|
279
|
+
type: "button",
|
|
280
|
+
onClick: () => h((c) => c.slice(0, l + 1)),
|
|
281
|
+
className: "max-w-[160px] truncate hover:text-slate-800 hover:underline dark:hover:text-foreground",
|
|
282
|
+
children: r.title ?? r.label ?? r.metric
|
|
283
|
+
}
|
|
284
|
+
) : /* @__PURE__ */ e("span", { className: "max-w-[220px] truncate font-medium text-slate-700 dark:text-foreground", children: r.title ?? r.label ?? r.metric })
|
|
285
|
+
]
|
|
286
|
+
},
|
|
287
|
+
`${r.metric}:${r.key ?? ""}:${l}`
|
|
288
|
+
))
|
|
289
|
+
]
|
|
290
|
+
}
|
|
291
|
+
),
|
|
292
|
+
/* @__PURE__ */ e(ee, { className: "truncate text-[15px]", children: (s == null ? void 0 : s.title) ?? (s == null ? void 0 : s.label) ?? "Loading…" })
|
|
293
|
+
] }),
|
|
294
|
+
/* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-y-auto bg-white dark:bg-background", children: s && /* @__PURE__ */ e(
|
|
295
|
+
se,
|
|
296
|
+
{
|
|
297
|
+
reportId: i,
|
|
298
|
+
target: s,
|
|
299
|
+
onTitle: (r) => h(
|
|
300
|
+
(l) => l.map(
|
|
301
|
+
(c, N) => N === l.length - 1 && c.title !== r ? { ...c, title: r } : c
|
|
302
|
+
)
|
|
303
|
+
),
|
|
304
|
+
onDrill: (r) => h((l) => [...l, r]),
|
|
305
|
+
onLink: x,
|
|
306
|
+
onRecord: (r, l, c) => b({ collection: r, itemId: l, title: c })
|
|
307
|
+
},
|
|
308
|
+
`${s.metric}:${s.key ?? ""}:${a.length}`
|
|
309
|
+
) })
|
|
310
|
+
]
|
|
311
|
+
}
|
|
312
|
+
) }),
|
|
313
|
+
g && /* @__PURE__ */ e(K, { fallback: null, children: /* @__PURE__ */ e(
|
|
314
|
+
le,
|
|
315
|
+
{
|
|
316
|
+
collection: g.collection,
|
|
317
|
+
itemId: g.itemId,
|
|
318
|
+
title: g.title,
|
|
319
|
+
onClose: () => b(null)
|
|
320
|
+
}
|
|
321
|
+
) })
|
|
322
|
+
] });
|
|
323
|
+
}
|
|
324
|
+
export {
|
|
325
|
+
we as DrillProvider,
|
|
326
|
+
ve as Drillable,
|
|
327
|
+
ie as useDrill
|
|
328
|
+
};
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { OPS_KPI_META as i } from "../../lib/ops-report-types.js";
|
|
2
|
+
const b = [
|
|
3
|
+
{ key: "report", label: "Report" },
|
|
4
|
+
{ key: "trends", label: "Trends" },
|
|
5
|
+
{ key: "compare", label: "Compare" }
|
|
6
|
+
];
|
|
7
|
+
function p(e) {
|
|
8
|
+
return Array.isArray(e) ? e : [];
|
|
9
|
+
}
|
|
10
|
+
function o(e, r = 0) {
|
|
11
|
+
return e == null || Number.isNaN(e) ? "–" : e.toLocaleString("en-US", { maximumFractionDigits: r });
|
|
12
|
+
}
|
|
13
|
+
function u(e) {
|
|
14
|
+
return e == null || Number.isNaN(e) ? "–" : e >= 1e4 ? `${(e / 1e3).toFixed(0)} s` : e >= 1e3 ? `${(e / 1e3).toFixed(1)} s` : `${Math.round(e)} ms`;
|
|
15
|
+
}
|
|
16
|
+
function g(e, r) {
|
|
17
|
+
return e == null || Number.isNaN(e) ? "–" : r === "ms" ? u(e) : r === "usd" ? `$${Math.round(e).toLocaleString("en-US")}` : r === "pct" ? `${o(e, 1)}%` : o(e, Number.isInteger(e) ? 0 : 1);
|
|
18
|
+
}
|
|
19
|
+
function n(e, r) {
|
|
20
|
+
const t = (r == null ? void 0 : r.find((a) => a.key === e)) ?? i.find((a) => a.key === e);
|
|
21
|
+
if (t) return t.label;
|
|
22
|
+
const s = (e.split(".").pop() ?? e).replace(/_/g, " ");
|
|
23
|
+
return s[0].toUpperCase() + s.slice(1);
|
|
24
|
+
}
|
|
25
|
+
function m(e, r) {
|
|
26
|
+
return (r == null ? void 0 : r.find((t) => t.key === e)) ?? i.find((t) => t.key === e) ?? {
|
|
27
|
+
key: e,
|
|
28
|
+
label: n(e),
|
|
29
|
+
unit: e.endsWith("_usd") ? "usd" : e.endsWith("_ms") ? "ms" : "count",
|
|
30
|
+
better: null,
|
|
31
|
+
group: "business"
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function f(e) {
|
|
35
|
+
return e === !0 ? "text-emerald-700 dark:text-emerald-400" : e === !1 ? "text-red-600 dark:text-red-400" : "text-slate-500 dark:text-muted-foreground";
|
|
36
|
+
}
|
|
37
|
+
function h(e) {
|
|
38
|
+
if (e.prev == null) return "no earlier day";
|
|
39
|
+
if (e.today === e.prev) return "no change";
|
|
40
|
+
if (e.change_pct == null) return e.today > e.prev ? "up from 0" : "down";
|
|
41
|
+
const r = e.change_pct, t = Math.abs(r) >= 10 ? Math.round(Math.abs(r)) : Math.abs(r).toFixed(1);
|
|
42
|
+
return `${r > 0 ? "+" : "−"}${t}%`;
|
|
43
|
+
}
|
|
44
|
+
const k = {
|
|
45
|
+
healthy: {
|
|
46
|
+
label: "Healthy",
|
|
47
|
+
dot: "bg-emerald-500",
|
|
48
|
+
badge: "border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-500/30 dark:bg-emerald-500/10 dark:text-emerald-300"
|
|
49
|
+
},
|
|
50
|
+
watch: {
|
|
51
|
+
label: "Watch",
|
|
52
|
+
dot: "bg-amber-500",
|
|
53
|
+
badge: "border-amber-200 bg-amber-50 text-amber-800 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-300"
|
|
54
|
+
},
|
|
55
|
+
bad: {
|
|
56
|
+
label: "Bad day",
|
|
57
|
+
dot: "bg-red-500",
|
|
58
|
+
badge: "border-red-200 bg-red-50 text-red-800 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-300"
|
|
59
|
+
}
|
|
60
|
+
}, y = "bg-slate-300 dark:bg-slate-600";
|
|
61
|
+
function w(e) {
|
|
62
|
+
return e === "running" ? "Building" : e === "failed" ? "Failed" : e === "digest_only" ? "Numbers only" : "Ready";
|
|
63
|
+
}
|
|
64
|
+
function l(e) {
|
|
65
|
+
const r = e.match(/^(\d{4})-(\d{2})-(\d{2})/);
|
|
66
|
+
return r ? new Date(Number(r[1]), Number(r[2]) - 1, Number(r[3])) : null;
|
|
67
|
+
}
|
|
68
|
+
function x(e) {
|
|
69
|
+
const r = l(e);
|
|
70
|
+
return r ? r.toLocaleDateString("en-US", { month: "short", day: "numeric" }) : e;
|
|
71
|
+
}
|
|
72
|
+
function N(e) {
|
|
73
|
+
const r = l(e);
|
|
74
|
+
return r ? r.toLocaleDateString("en-US", { weekday: "short" }) : "";
|
|
75
|
+
}
|
|
76
|
+
function S(e) {
|
|
77
|
+
return e == null ? "–" : `$${e.toFixed(e < 1 ? 3 : 2)}`;
|
|
78
|
+
}
|
|
79
|
+
function $(e) {
|
|
80
|
+
return e.tokens_in == null && e.tokens_out == null ? null : (e.tokens_in ?? 0) + (e.tokens_out ?? 0);
|
|
81
|
+
}
|
|
82
|
+
const D = [
|
|
83
|
+
"requests",
|
|
84
|
+
"p95_ms",
|
|
85
|
+
"server_errors",
|
|
86
|
+
"deploys",
|
|
87
|
+
"deadlocks",
|
|
88
|
+
"integration_failures",
|
|
89
|
+
"job_failures",
|
|
90
|
+
"backlog_waiting",
|
|
91
|
+
"open_bugs"
|
|
92
|
+
], d = {
|
|
93
|
+
active_people: "active_people",
|
|
94
|
+
signed_in_today: "signed_in_today",
|
|
95
|
+
sign_ins: "signed_in_today",
|
|
96
|
+
carried_sessions: "carried_sessions",
|
|
97
|
+
new_accounts: "new_accounts",
|
|
98
|
+
view_as_sessions: "view_as_sessions",
|
|
99
|
+
trouble_people: "trouble_people",
|
|
100
|
+
requests: "requests",
|
|
101
|
+
page_views: "page_views",
|
|
102
|
+
pages_viewed: "page_views",
|
|
103
|
+
avg_ms: "latency",
|
|
104
|
+
p95_ms: "latency",
|
|
105
|
+
p99_ms: "latency",
|
|
106
|
+
over5s: "over5s",
|
|
107
|
+
server_errors: "server_errors",
|
|
108
|
+
client_errors: "client_errors",
|
|
109
|
+
deadlocks: "deadlocks",
|
|
110
|
+
deploys: "deploys",
|
|
111
|
+
job_failures: "job_failures",
|
|
112
|
+
integration_failures: "integration_failures",
|
|
113
|
+
integration_calls_failed: "integration_calls",
|
|
114
|
+
open_alarms: "open_alarms",
|
|
115
|
+
mail_sent: ["mail", "sent"],
|
|
116
|
+
mail_failed: ["mail", "failed"],
|
|
117
|
+
mail_deferred: ["mail", "deferred"],
|
|
118
|
+
moves: "moves",
|
|
119
|
+
creates: "creates",
|
|
120
|
+
searches: "searches",
|
|
121
|
+
search_zero: "search_zero",
|
|
122
|
+
backlog_waiting: "backlog",
|
|
123
|
+
new_places: "new_places",
|
|
124
|
+
failed_sign_ins: "failed_sign_ins",
|
|
125
|
+
open_bugs: ["bugs", "open"],
|
|
126
|
+
browser_errors: "browser_errors",
|
|
127
|
+
support_opened: "support",
|
|
128
|
+
support_open: ["support", "open"],
|
|
129
|
+
ai_calls: "ai_calls",
|
|
130
|
+
ai_cost_usd: "ai_calls",
|
|
131
|
+
data_violations: "data_quality",
|
|
132
|
+
health_score: "score"
|
|
133
|
+
};
|
|
134
|
+
function T(e) {
|
|
135
|
+
const r = d[e];
|
|
136
|
+
return Array.isArray(r) ? { metric: r[0], key: r[1], label: n(e) } : r ? { metric: r, label: n(e) } : e.includes(".") ? { metric: "section", key: e, label: n(e) } : null;
|
|
137
|
+
}
|
|
138
|
+
const L = (e, r, t) => ({
|
|
139
|
+
metric: e,
|
|
140
|
+
key: r == null ? null : String(r),
|
|
141
|
+
label: t
|
|
142
|
+
});
|
|
143
|
+
export {
|
|
144
|
+
y as NO_VERDICT_DOT,
|
|
145
|
+
b as OPS_TABS,
|
|
146
|
+
D as STRIP_KEYS,
|
|
147
|
+
k as VERDICT,
|
|
148
|
+
p as arr,
|
|
149
|
+
h as changeText,
|
|
150
|
+
S as cost,
|
|
151
|
+
L as dr,
|
|
152
|
+
T as drillForKpi,
|
|
153
|
+
g as formatKpi,
|
|
154
|
+
f as goodClass,
|
|
155
|
+
n as kpiLabel,
|
|
156
|
+
m as kpiMeta,
|
|
157
|
+
u as ms,
|
|
158
|
+
o as num,
|
|
159
|
+
$ as reportTokens,
|
|
160
|
+
x as shortDay,
|
|
161
|
+
w as statusLabel,
|
|
162
|
+
N as weekday
|
|
163
|
+
};
|