@nivaro/react 0.3.87 → 0.3.88
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/lib/ops-report-types.js +141 -0
- package/package.json +1 -1
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { jsxs as l, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as w, useQuery as S, useMutation as q } from "@tanstack/react-query";
|
|
3
|
+
import { useState as u } from "react";
|
|
4
|
+
import { useNivaroClient as O } from "../../context.js";
|
|
5
|
+
import { get as Q, post as R } from "../../lib/commands.js";
|
|
6
|
+
import { toastError as T } from "../../lib/error-toast.js";
|
|
7
|
+
import { cn as f } from "../../lib/utils.js";
|
|
8
|
+
import { QueryErrorState as D } from "../QueryErrorState.js";
|
|
9
|
+
import { Skeleton as y } from "../ui/skeleton.js";
|
|
10
|
+
import { CompareTab as E } from "./CompareTab.js";
|
|
11
|
+
import { OPS_TABS as K } from "./format.js";
|
|
12
|
+
import { ReportTab as j } from "./ReportTab.js";
|
|
13
|
+
import { OpsSettingsPopover as F } from "./SettingsPanel.js";
|
|
14
|
+
import { TrendsTab as P } from "./TrendsTab.js";
|
|
15
|
+
function X({
|
|
16
|
+
tab: b,
|
|
17
|
+
onTabChange: a,
|
|
18
|
+
linkTo: v,
|
|
19
|
+
className: h
|
|
20
|
+
}) {
|
|
21
|
+
const p = O(), m = w(), [x, k] = u("report"), o = b ?? x, i = (e) => {
|
|
22
|
+
k(e), a == null || a(e);
|
|
23
|
+
}, [g, n] = u(null), t = S({
|
|
24
|
+
queryKey: ["ops-reports"],
|
|
25
|
+
queryFn: () => p.request(Q("/ops-reports", { limit: 60 })).then((e) => e.data),
|
|
26
|
+
refetchInterval: (e) => {
|
|
27
|
+
var s;
|
|
28
|
+
return (s = e.state.data) != null && s.some((N) => N.status === "running") ? 4e3 : !1;
|
|
29
|
+
}
|
|
30
|
+
}), d = t.data ?? [], c = q({
|
|
31
|
+
mutationFn: (e) => p.request(R("/ops-reports/run", e ? { day: e } : {})).then((s) => s.data),
|
|
32
|
+
onSuccess: (e) => {
|
|
33
|
+
n(e.id), i("report"), m.invalidateQueries({ queryKey: ["ops-reports"] }), m.invalidateQueries({ queryKey: ["ops-report", e.id] });
|
|
34
|
+
},
|
|
35
|
+
onError: (e) => T(e, "Could not start the report", { retry: () => c.mutate(void 0) })
|
|
36
|
+
});
|
|
37
|
+
return /* @__PURE__ */ l("div", { className: f("flex flex-1 min-h-0 flex-col", h), "data-ops-report-view": "", children: [
|
|
38
|
+
/* @__PURE__ */ l("header", { className: "flex shrink-0 items-center gap-3 border-b border-slate-200 bg-white px-4 py-2 dark:border-border dark:bg-card", children: [
|
|
39
|
+
/* @__PURE__ */ r("div", { role: "tablist", "aria-label": "Daily report", className: "flex items-center gap-1", children: K.map((e) => /* @__PURE__ */ r(
|
|
40
|
+
"button",
|
|
41
|
+
{
|
|
42
|
+
type: "button",
|
|
43
|
+
role: "tab",
|
|
44
|
+
"aria-selected": o === e.key,
|
|
45
|
+
"data-ops-tab": e.key,
|
|
46
|
+
onClick: () => i(e.key),
|
|
47
|
+
className: f(
|
|
48
|
+
"rounded-md px-2.5 py-1 text-[12.5px] font-medium focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50",
|
|
49
|
+
o === e.key ? "bg-nvr-cyan/10 text-nvr-navy dark:bg-nvr-cyan/15 dark:text-nvr-cyan" : "text-slate-600 hover:bg-muted dark:text-muted-foreground"
|
|
50
|
+
),
|
|
51
|
+
children: e.label
|
|
52
|
+
},
|
|
53
|
+
e.key
|
|
54
|
+
)) }),
|
|
55
|
+
/* @__PURE__ */ r("div", { className: "ml-auto", children: /* @__PURE__ */ r(F, {}) })
|
|
56
|
+
] }),
|
|
57
|
+
t.isLoading ? /* @__PURE__ */ l("div", { className: "space-y-3 p-4", "aria-busy": "true", children: [
|
|
58
|
+
/* @__PURE__ */ r(y, { className: "h-16 w-full" }),
|
|
59
|
+
/* @__PURE__ */ r(y, { className: "h-64 w-full" })
|
|
60
|
+
] }) : t.error ? /* @__PURE__ */ r("div", { className: "p-4", children: /* @__PURE__ */ r(
|
|
61
|
+
D,
|
|
62
|
+
{
|
|
63
|
+
error: t.error,
|
|
64
|
+
what: "the daily reports",
|
|
65
|
+
onRetry: () => void t.refetch()
|
|
66
|
+
}
|
|
67
|
+
) }) : o === "report" ? /* @__PURE__ */ r(
|
|
68
|
+
j,
|
|
69
|
+
{
|
|
70
|
+
rows: d,
|
|
71
|
+
selected: g,
|
|
72
|
+
onSelect: n,
|
|
73
|
+
onRunDay: (e) => c.mutate(e),
|
|
74
|
+
linkTo: v
|
|
75
|
+
}
|
|
76
|
+
) : o === "trends" ? /* @__PURE__ */ r(
|
|
77
|
+
P,
|
|
78
|
+
{
|
|
79
|
+
onOpenDay: (e) => {
|
|
80
|
+
n(e), i("report");
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
) : /* @__PURE__ */ r(E, { rows: d })
|
|
84
|
+
] });
|
|
85
|
+
}
|
|
86
|
+
export {
|
|
87
|
+
X as OpsReportView
|
|
88
|
+
};
|
|
@@ -0,0 +1,527 @@
|
|
|
1
|
+
import { jsxs as d, jsx as e, Fragment as V } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery as H, useQueryClient as Q } from "@tanstack/react-query";
|
|
3
|
+
import { Play as I, Loader2 as P } from "lucide-react";
|
|
4
|
+
import { useEffect as z } from "react";
|
|
5
|
+
import { useNivaroClient as O } from "../../context.js";
|
|
6
|
+
import { get as U } from "../../lib/commands.js";
|
|
7
|
+
import { cn as g, formatDate as W } from "../../lib/utils.js";
|
|
8
|
+
import { AiMarkdown as Y } from "../ai/AiMarkdown.js";
|
|
9
|
+
import { ErrorNotice as G } from "../ErrorNotice.js";
|
|
10
|
+
import { QueryErrorState as J } from "../QueryErrorState.js";
|
|
11
|
+
import { Button as $ } from "../ui/button.js";
|
|
12
|
+
import { Skeleton as D } from "../ui/skeleton.js";
|
|
13
|
+
import { DigestSections as X } from "./DigestSections.js";
|
|
14
|
+
import { DrillProvider as Z, Drillable as _ } from "./drill.js";
|
|
15
|
+
import { weekday as q, shortDay as T, statusLabel as K, VERDICT as M, reportTokens as ee, num as x, cost as te, arr as c, NO_VERDICT_DOT as re, dr as m, STRIP_KEYS as C, formatKpi as v, changeText as j, goodClass as A, drillForKpi as F } from "./format.js";
|
|
16
|
+
import { SubTitle as L, MiniTable as w, Section as ae } from "./ui.js";
|
|
17
|
+
import { Chip as S } from "./chip.js";
|
|
18
|
+
function le({
|
|
19
|
+
verdict: r,
|
|
20
|
+
className: t
|
|
21
|
+
}) {
|
|
22
|
+
return /* @__PURE__ */ e(
|
|
23
|
+
"span",
|
|
24
|
+
{
|
|
25
|
+
"aria-hidden": !0,
|
|
26
|
+
className: g(
|
|
27
|
+
"inline-block h-2.5 w-2.5 shrink-0 rounded-full",
|
|
28
|
+
r ? M[r].dot : re,
|
|
29
|
+
t
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
function se({
|
|
35
|
+
rows: r,
|
|
36
|
+
selected: t,
|
|
37
|
+
onSelect: l
|
|
38
|
+
}) {
|
|
39
|
+
return /* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", "data-ops-list": "", children: r.map((a) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ d(
|
|
40
|
+
"button",
|
|
41
|
+
{
|
|
42
|
+
type: "button",
|
|
43
|
+
"data-ops-day": a.day,
|
|
44
|
+
"aria-current": a.id === t ? "true" : void 0,
|
|
45
|
+
onClick: () => l(a.id),
|
|
46
|
+
className: g(
|
|
47
|
+
"flex w-full flex-col gap-0.5 px-3 py-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-nvr-cyan/50",
|
|
48
|
+
a.id === t ? "bg-accent" : "hover:bg-muted"
|
|
49
|
+
),
|
|
50
|
+
children: [
|
|
51
|
+
/* @__PURE__ */ d("span", { className: "flex items-center gap-2", children: [
|
|
52
|
+
/* @__PURE__ */ e(le, { verdict: a.verdict }),
|
|
53
|
+
/* @__PURE__ */ d("span", { className: "text-[12.5px] font-medium text-slate-900 dark:text-foreground", children: [
|
|
54
|
+
q(a.day),
|
|
55
|
+
" · ",
|
|
56
|
+
T(a.day)
|
|
57
|
+
] }),
|
|
58
|
+
a.status !== "ready" && /* @__PURE__ */ e(
|
|
59
|
+
"span",
|
|
60
|
+
{
|
|
61
|
+
className: g(
|
|
62
|
+
"rounded px-1 text-[10px] font-medium",
|
|
63
|
+
a.status === "failed" ? "bg-red-50 text-red-700 dark:bg-red-500/10 dark:text-red-300" : "bg-slate-100 text-slate-600 dark:bg-muted dark:text-muted-foreground"
|
|
64
|
+
),
|
|
65
|
+
children: K(a.status)
|
|
66
|
+
}
|
|
67
|
+
),
|
|
68
|
+
a.status === "running" && /* @__PURE__ */ e(P, { className: "h-3 w-3 animate-spin text-slate-400", "aria-hidden": !0 }),
|
|
69
|
+
/* @__PURE__ */ e("span", { className: "ml-auto text-[12px] font-semibold tabular-nums text-slate-600 dark:text-muted-foreground", children: a.score ?? "" })
|
|
70
|
+
] }),
|
|
71
|
+
a.headline && /* @__PURE__ */ e("span", { className: "line-clamp-2 pl-[18px] text-[11.5px] leading-snug text-slate-500 dark:text-muted-foreground", children: a.headline })
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
) }, a.id)) });
|
|
75
|
+
}
|
|
76
|
+
const R = {
|
|
77
|
+
new: {
|
|
78
|
+
label: "New",
|
|
79
|
+
cls: "border-sky-200 bg-sky-50 text-sky-800 dark:border-sky-500/30 dark:bg-sky-500/10 dark:text-sky-300"
|
|
80
|
+
},
|
|
81
|
+
open: {
|
|
82
|
+
label: "Open",
|
|
83
|
+
cls: "border-amber-200 bg-amber-50 text-amber-800 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-300"
|
|
84
|
+
},
|
|
85
|
+
fixed: {
|
|
86
|
+
label: "Fixed",
|
|
87
|
+
cls: "border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-500/30 dark:bg-emerald-500/10 dark:text-emerald-300"
|
|
88
|
+
},
|
|
89
|
+
came_back: {
|
|
90
|
+
label: "Came back",
|
|
91
|
+
cls: "border-red-200 bg-red-50 text-red-800 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-300"
|
|
92
|
+
}
|
|
93
|
+
}, ne = {
|
|
94
|
+
needs_dev: "Needs a developer",
|
|
95
|
+
data_fix: "Data fix",
|
|
96
|
+
partner: "Partner",
|
|
97
|
+
config: "Config"
|
|
98
|
+
};
|
|
99
|
+
function p({ title: r, children: t, id: l }) {
|
|
100
|
+
return /* @__PURE__ */ d(
|
|
101
|
+
"section",
|
|
102
|
+
{
|
|
103
|
+
"data-ops-card": l,
|
|
104
|
+
className: "rounded-lg border border-slate-200 bg-white p-3 dark:border-border dark:bg-card",
|
|
105
|
+
children: [
|
|
106
|
+
r && /* @__PURE__ */ e("h3", { className: "mb-2 text-[12.5px] font-semibold text-slate-800 dark:text-foreground", children: r }),
|
|
107
|
+
t
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
function de({ report: r }) {
|
|
113
|
+
var h, u;
|
|
114
|
+
const t = c((h = r.comparison) == null ? void 0 : h.deltas), l = C.map((i) => t.find((o) => o.key === i)).filter(
|
|
115
|
+
(i) => !!i
|
|
116
|
+
), a = (u = r.comparison) == null ? void 0 : u.prev_day;
|
|
117
|
+
if (!l.length) {
|
|
118
|
+
const i = C.filter((o) => {
|
|
119
|
+
var s;
|
|
120
|
+
return ((s = r.kpis) == null ? void 0 : s[o]) != null;
|
|
121
|
+
});
|
|
122
|
+
return i.length ? /* @__PURE__ */ e("div", { className: "grid grid-cols-[repeat(auto-fill,minmax(140px,1fr))] gap-2", "data-ops-kpis": "", children: i.map((o) => /* @__PURE__ */ d(
|
|
123
|
+
"div",
|
|
124
|
+
{
|
|
125
|
+
className: "rounded-lg border border-slate-200 bg-white px-3 py-2 dark:border-border dark:bg-card",
|
|
126
|
+
children: [
|
|
127
|
+
/* @__PURE__ */ e("div", { className: "text-[11px] text-slate-500 dark:text-muted-foreground", children: o.replace(/_/g, " ") }),
|
|
128
|
+
/* @__PURE__ */ e("div", { className: "text-[18px] font-semibold tabular-nums", children: x(r.kpis[o]) })
|
|
129
|
+
]
|
|
130
|
+
},
|
|
131
|
+
o
|
|
132
|
+
)) }) : null;
|
|
133
|
+
}
|
|
134
|
+
return /* @__PURE__ */ e("div", { className: "grid grid-cols-[repeat(auto-fill,minmax(150px,1fr))] gap-2", "data-ops-kpis": "", children: l.map((i) => /* @__PURE__ */ e(_, { target: F(i.key), className: "block w-full", children: /* @__PURE__ */ d(
|
|
135
|
+
"div",
|
|
136
|
+
{
|
|
137
|
+
"data-ops-kpi": i.key,
|
|
138
|
+
className: "h-full rounded-lg border border-slate-200 bg-white px-3 py-2 hover:border-slate-300 dark:border-border dark:bg-card dark:hover:border-slate-600",
|
|
139
|
+
children: [
|
|
140
|
+
/* @__PURE__ */ e("div", { className: "truncate text-[11px] text-slate-500 dark:text-muted-foreground", children: i.label }),
|
|
141
|
+
/* @__PURE__ */ e("div", { className: "text-[18px] font-semibold leading-tight tabular-nums text-slate-900 dark:text-foreground", children: v(i.today, i.unit) }),
|
|
142
|
+
/* @__PURE__ */ d("div", { className: g("mt-0.5 text-[11px] tabular-nums", A(i.good)), children: [
|
|
143
|
+
j(i),
|
|
144
|
+
/* @__PURE__ */ e("span", { className: "text-slate-400 dark:text-muted-foreground", children: a ? ` vs ${T(a)}` : "" })
|
|
145
|
+
] }),
|
|
146
|
+
/* @__PURE__ */ e("div", { className: "text-[11px] tabular-nums text-slate-500 dark:text-muted-foreground", children: i.week_avg == null ? "no 7-day average" : `7-day avg ${v(i.week_avg, i.unit)}` })
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
) }, i.key)) });
|
|
150
|
+
}
|
|
151
|
+
function ie({ report: r }) {
|
|
152
|
+
var f;
|
|
153
|
+
const t = (f = r.digest) == null ? void 0 : f.people, l = r.kpis ?? {}, a = (t == null ? void 0 : t.active) ?? l.active_people, h = (t == null ? void 0 : t.signed_in_today) ?? l.signed_in_today, u = (t == null ? void 0 : t.carried_sessions) ?? l.carried_sessions;
|
|
154
|
+
if (a == null && h == null) return null;
|
|
155
|
+
const i = a != null && h != null && u != null && h + u === a, o = (n, b, k, N, y) => /* @__PURE__ */ e(_, { target: m(N, null, n), className: "min-w-0 flex-1", children: /* @__PURE__ */ d(
|
|
156
|
+
"div",
|
|
157
|
+
{
|
|
158
|
+
className: g(
|
|
159
|
+
"h-full rounded-md px-3 py-2",
|
|
160
|
+
y ? "bg-nvr-cyan/10 dark:bg-nvr-cyan/15" : "bg-slate-50 dark:bg-muted/40"
|
|
161
|
+
),
|
|
162
|
+
children: [
|
|
163
|
+
/* @__PURE__ */ e("div", { className: "text-[11px] font-medium text-slate-600 dark:text-muted-foreground", children: n }),
|
|
164
|
+
/* @__PURE__ */ e("div", { className: "text-[22px] font-semibold leading-tight tabular-nums text-slate-900 dark:text-foreground", children: x(b) }),
|
|
165
|
+
/* @__PURE__ */ e("div", { className: "text-[11px] text-slate-500 dark:text-muted-foreground", children: k })
|
|
166
|
+
]
|
|
167
|
+
}
|
|
168
|
+
) }), s = (n) => /* @__PURE__ */ e("span", { "aria-hidden": !0, className: "self-center text-[16px] text-slate-400", children: n });
|
|
169
|
+
return /* @__PURE__ */ d(p, { title: "People", id: "people", children: [
|
|
170
|
+
/* @__PURE__ */ d("div", { className: "flex flex-wrap items-stretch gap-2", children: [
|
|
171
|
+
o("Active people", a, "did anything today", "active_people", !0),
|
|
172
|
+
i && s("="),
|
|
173
|
+
o("Signed in today", h, "through Microsoft", "signed_in_today"),
|
|
174
|
+
i && s("+"),
|
|
175
|
+
o("Still signed in", u, "from an earlier day", "carried_sessions")
|
|
176
|
+
] }),
|
|
177
|
+
/* @__PURE__ */ e("div", { className: "mt-2 grid grid-cols-2 gap-2 sm:grid-cols-4", children: [
|
|
178
|
+
[
|
|
179
|
+
"Sign-ins",
|
|
180
|
+
(t == null ? void 0 : t.sign_ins) ?? l.sign_ins,
|
|
181
|
+
"one person can sign in twice",
|
|
182
|
+
"signed_in_today"
|
|
183
|
+
],
|
|
184
|
+
["New accounts", (t == null ? void 0 : t.first_time) ?? l.new_accounts, "first time today", "new_accounts"],
|
|
185
|
+
[
|
|
186
|
+
"View-as",
|
|
187
|
+
(t == null ? void 0 : t.view_as_sessions) ?? l.view_as_sessions,
|
|
188
|
+
"admin sessions as someone",
|
|
189
|
+
"view_as_sessions"
|
|
190
|
+
],
|
|
191
|
+
[
|
|
192
|
+
"Machine callers",
|
|
193
|
+
c(t == null ? void 0 : t.machine_callers).length,
|
|
194
|
+
"integrations and keys",
|
|
195
|
+
"machine_callers"
|
|
196
|
+
]
|
|
197
|
+
].map(([n, b, k, N]) => /* @__PURE__ */ e(
|
|
198
|
+
_,
|
|
199
|
+
{
|
|
200
|
+
target: m(N, null, n),
|
|
201
|
+
className: "block w-full",
|
|
202
|
+
children: /* @__PURE__ */ d("div", { className: "h-full rounded-md bg-slate-50 px-3 py-1.5 dark:bg-muted/40", children: [
|
|
203
|
+
/* @__PURE__ */ e("div", { className: "text-[11px] text-slate-600 dark:text-muted-foreground", children: n }),
|
|
204
|
+
/* @__PURE__ */ e("div", { className: "text-[15px] font-semibold tabular-nums", children: x(b) }),
|
|
205
|
+
/* @__PURE__ */ e("div", { className: "text-[10.5px] text-slate-500 dark:text-muted-foreground", children: k })
|
|
206
|
+
] })
|
|
207
|
+
},
|
|
208
|
+
n
|
|
209
|
+
)) }),
|
|
210
|
+
c(t == null ? void 0 : t.explain).length > 0 && /* @__PURE__ */ e("ul", { className: "mt-2.5 space-y-1 border-t border-slate-100 pt-2 text-[12px] leading-relaxed text-slate-700 dark:border-border dark:text-foreground", children: c(t == null ? void 0 : t.explain).map((n) => /* @__PURE__ */ e("li", { children: n }, n)) }),
|
|
211
|
+
(c(t == null ? void 0 : t.trouble).length > 0 || c(t == null ? void 0 : t.machine_callers).length > 0 || c(t == null ? void 0 : t.by_role).length > 0) && /* @__PURE__ */ d("div", { className: "mt-3 grid gap-3 lg:grid-cols-3", children: [
|
|
212
|
+
/* @__PURE__ */ e(
|
|
213
|
+
w,
|
|
214
|
+
{
|
|
215
|
+
title: "Hit trouble",
|
|
216
|
+
rows: c(t == null ? void 0 : t.trouble),
|
|
217
|
+
drill: (n) => m("person", n.person, n.person),
|
|
218
|
+
cols: [
|
|
219
|
+
{ h: "Person", cell: (n) => n.person },
|
|
220
|
+
{ h: "Errors", cell: (n) => x(n.errors), num: !0 },
|
|
221
|
+
{ h: "Slow", cell: (n) => x(n.slow), num: !0 },
|
|
222
|
+
{ h: "Blocked", cell: (n) => x(n.blocked), num: !0 }
|
|
223
|
+
]
|
|
224
|
+
}
|
|
225
|
+
),
|
|
226
|
+
/* @__PURE__ */ e(
|
|
227
|
+
w,
|
|
228
|
+
{
|
|
229
|
+
title: "Machine callers",
|
|
230
|
+
rows: c(t == null ? void 0 : t.machine_callers),
|
|
231
|
+
drill: (n) => m("machine_callers", n.name, n.name),
|
|
232
|
+
cols: [
|
|
233
|
+
{ h: "Name", cell: (n) => n.name },
|
|
234
|
+
{ h: "Requests", cell: (n) => x(n.requests), num: !0 },
|
|
235
|
+
{ h: "Errors", cell: (n) => x(n.errors), num: !0 }
|
|
236
|
+
]
|
|
237
|
+
}
|
|
238
|
+
),
|
|
239
|
+
/* @__PURE__ */ e(
|
|
240
|
+
w,
|
|
241
|
+
{
|
|
242
|
+
title: "By role",
|
|
243
|
+
rows: c(t == null ? void 0 : t.by_role),
|
|
244
|
+
drill: (n) => m("active_people", n.role, n.role),
|
|
245
|
+
cols: [
|
|
246
|
+
{ h: "Role", cell: (n) => n.role },
|
|
247
|
+
{ h: "People", cell: (n) => x(n.people), num: !0 }
|
|
248
|
+
]
|
|
249
|
+
}
|
|
250
|
+
)
|
|
251
|
+
] })
|
|
252
|
+
] });
|
|
253
|
+
}
|
|
254
|
+
const E = {
|
|
255
|
+
high: "border-red-200 bg-red-50 text-red-800 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-300",
|
|
256
|
+
medium: "border-amber-200 bg-amber-50 text-amber-800 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-300",
|
|
257
|
+
low: "border-slate-200 bg-slate-50 text-slate-700 dark:border-border dark:bg-muted dark:text-muted-foreground"
|
|
258
|
+
};
|
|
259
|
+
function oe(r) {
|
|
260
|
+
return /server errors/.test(r) ? m("server_errors", null, r) : /deadlocks/.test(r) ? m("deadlocks", null, r) : /over 5 s/.test(r) ? m("over5s", null, r) : /^p95/.test(r) ? m("latency", null, r) : /partner sends/.test(r) ? m("integration_failures", null, r) : /integration alarms/.test(r) ? m("open_alarms", null, r) : /failed jobs/.test(r) ? m("job_failures", null, r) : /freezes/.test(r) ? m("issues", null, r) : /hit trouble/.test(r) ? m("trouble_people", null, r) : /browser errors/.test(r) ? m("browser_errors", null, r) : m("score", null, r);
|
|
261
|
+
}
|
|
262
|
+
function ce({ report: r }) {
|
|
263
|
+
var u, i;
|
|
264
|
+
const t = (u = r.digest) == null ? void 0 : u.score, l = (t == null ? void 0 : t.value) ?? ((i = r.kpis) == null ? void 0 : i.health_score);
|
|
265
|
+
if (l == null) return null;
|
|
266
|
+
const a = c(t == null ? void 0 : t.parts).filter((o) => o.points !== 0), h = l >= 85 ? "bg-emerald-500" : l >= 65 ? "bg-amber-500" : "bg-red-500";
|
|
267
|
+
return /* @__PURE__ */ e(p, { id: "score", children: /* @__PURE__ */ d("div", { className: "flex flex-wrap items-start gap-x-6 gap-y-3", children: [
|
|
268
|
+
/* @__PURE__ */ d(_, { target: m("score", null, "Health score"), className: "min-w-[150px]", children: [
|
|
269
|
+
/* @__PURE__ */ e("div", { className: "text-[11px] font-medium text-slate-600 dark:text-muted-foreground", children: "Health score" }),
|
|
270
|
+
/* @__PURE__ */ d("div", { className: "flex items-baseline gap-1", children: [
|
|
271
|
+
/* @__PURE__ */ e("span", { className: "text-[32px] font-semibold leading-none tabular-nums text-slate-900 dark:text-foreground", children: l }),
|
|
272
|
+
/* @__PURE__ */ e("span", { className: "text-[12px] text-slate-400", children: "/ 100" })
|
|
273
|
+
] }),
|
|
274
|
+
/* @__PURE__ */ e(
|
|
275
|
+
"div",
|
|
276
|
+
{
|
|
277
|
+
className: "mt-2 h-1.5 w-full overflow-hidden rounded-full bg-slate-100 dark:bg-muted",
|
|
278
|
+
role: "img",
|
|
279
|
+
"aria-label": `Health score ${l} out of 100`,
|
|
280
|
+
children: /* @__PURE__ */ e(
|
|
281
|
+
"div",
|
|
282
|
+
{
|
|
283
|
+
className: g("h-full rounded-full", h),
|
|
284
|
+
style: { width: `${Math.max(2, Math.min(100, l))}%` }
|
|
285
|
+
}
|
|
286
|
+
)
|
|
287
|
+
}
|
|
288
|
+
),
|
|
289
|
+
/* @__PURE__ */ e("p", { className: "mt-1.5 text-[10.5px] text-slate-500 dark:text-muted-foreground", children: "Worked out from the numbers, no AI." })
|
|
290
|
+
] }),
|
|
291
|
+
/* @__PURE__ */ d("div", { className: "min-w-0 flex-1", children: [
|
|
292
|
+
/* @__PURE__ */ e(L, { children: "What took points off" }),
|
|
293
|
+
a.length ? /* @__PURE__ */ e(
|
|
294
|
+
"ul",
|
|
295
|
+
{
|
|
296
|
+
className: "grid grid-cols-1 gap-x-6 gap-y-0.5 text-[12px] sm:grid-cols-2",
|
|
297
|
+
"data-ops-score-parts": "",
|
|
298
|
+
children: a.map((o) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ d(
|
|
299
|
+
_,
|
|
300
|
+
{
|
|
301
|
+
target: oe(o.label),
|
|
302
|
+
className: "flex w-full items-baseline justify-between gap-3",
|
|
303
|
+
children: [
|
|
304
|
+
/* @__PURE__ */ e("span", { className: "truncate text-slate-700 dark:text-foreground", children: o.label }),
|
|
305
|
+
/* @__PURE__ */ d("span", { className: "tabular-nums text-red-600 dark:text-red-400", children: [
|
|
306
|
+
"−",
|
|
307
|
+
Math.abs(o.points)
|
|
308
|
+
] })
|
|
309
|
+
]
|
|
310
|
+
}
|
|
311
|
+
) }, o.label))
|
|
312
|
+
}
|
|
313
|
+
) : /* @__PURE__ */ e("p", { className: "text-[12px] text-slate-500 dark:text-muted-foreground", children: "Nothing took points off." })
|
|
314
|
+
] })
|
|
315
|
+
] }) });
|
|
316
|
+
}
|
|
317
|
+
function ue({ report: r }) {
|
|
318
|
+
const t = r.analysis;
|
|
319
|
+
return t ? /* @__PURE__ */ d(V, { children: [
|
|
320
|
+
/* @__PURE__ */ e(p, { title: "Summary", id: "summary", children: /* @__PURE__ */ e("div", { className: "text-[12.5px] leading-relaxed text-slate-800 dark:text-foreground", children: /* @__PURE__ */ e(Y, { content: t.summary_md ?? "", autolink: !1 }) }) }),
|
|
321
|
+
c(t.incidents).length > 0 && /* @__PURE__ */ e(p, { title: `Incidents (${c(t.incidents).length})`, id: "incidents", children: /* @__PURE__ */ e("ul", { className: "space-y-3", children: c(t.incidents).map((l) => /* @__PURE__ */ d("li", { "data-ops-incident": "", className: "text-[12px]", children: [
|
|
322
|
+
/* @__PURE__ */ d("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
323
|
+
/* @__PURE__ */ e(S, { className: E[l.severity] ?? E.low, children: l.severity }),
|
|
324
|
+
/* @__PURE__ */ e("span", { className: "font-semibold text-slate-900 dark:text-foreground", children: l.title }),
|
|
325
|
+
/* @__PURE__ */ e("span", { className: "text-slate-500 dark:text-muted-foreground", children: l.when })
|
|
326
|
+
] }),
|
|
327
|
+
/* @__PURE__ */ d("dl", { className: "mt-1 grid grid-cols-[72px_1fr] gap-x-2 gap-y-0.5 text-slate-700 dark:text-foreground", children: [
|
|
328
|
+
/* @__PURE__ */ e("dt", { className: "text-slate-500 dark:text-muted-foreground", children: "Impact" }),
|
|
329
|
+
/* @__PURE__ */ e("dd", { children: l.impact }),
|
|
330
|
+
/* @__PURE__ */ e("dt", { className: "text-slate-500 dark:text-muted-foreground", children: "Cause" }),
|
|
331
|
+
/* @__PURE__ */ e("dd", { children: l.cause }),
|
|
332
|
+
/* @__PURE__ */ e("dt", { className: "text-slate-500 dark:text-muted-foreground", children: "Evidence" }),
|
|
333
|
+
/* @__PURE__ */ e("dd", { children: l.evidence })
|
|
334
|
+
] })
|
|
335
|
+
] }, l.title)) }) }),
|
|
336
|
+
(c(t.people_to_contact).length > 0 || c(t.watch_tomorrow).length > 0) && /* @__PURE__ */ d("div", { className: "grid gap-3 lg:grid-cols-2", children: [
|
|
337
|
+
c(t.people_to_contact).length > 0 && /* @__PURE__ */ e(p, { title: "People to contact", id: "contact", children: /* @__PURE__ */ e("ul", { className: "space-y-1.5 text-[12px]", children: c(t.people_to_contact).map((l) => /* @__PURE__ */ d("li", { children: [
|
|
338
|
+
/* @__PURE__ */ e("span", { className: "font-medium text-slate-900 dark:text-foreground", children: l.person }),
|
|
339
|
+
/* @__PURE__ */ d("span", { className: "text-slate-600 dark:text-muted-foreground", children: [
|
|
340
|
+
" — ",
|
|
341
|
+
l.why
|
|
342
|
+
] })
|
|
343
|
+
] }, l.person)) }) }),
|
|
344
|
+
c(t.watch_tomorrow).length > 0 && /* @__PURE__ */ e(p, { title: "Watch tomorrow", id: "watch-tomorrow", children: /* @__PURE__ */ e("ul", { className: "list-disc space-y-1 pl-4 text-[12px] text-slate-700 dark:text-foreground", children: c(t.watch_tomorrow).map((l) => /* @__PURE__ */ e("li", { children: l }, l)) }) })
|
|
345
|
+
] })
|
|
346
|
+
] }) : null;
|
|
347
|
+
}
|
|
348
|
+
function me({ bugs: r }) {
|
|
349
|
+
return r.length ? /* @__PURE__ */ e(p, { title: `Bug tracker (${r.length})`, id: "tracker", children: /* @__PURE__ */ e(
|
|
350
|
+
w,
|
|
351
|
+
{
|
|
352
|
+
rows: r,
|
|
353
|
+
drill: (t) => m("issues", t.key, t.title),
|
|
354
|
+
cols: [
|
|
355
|
+
{
|
|
356
|
+
h: "Status",
|
|
357
|
+
cell: (t) => {
|
|
358
|
+
var l, a;
|
|
359
|
+
return /* @__PURE__ */ e(S, { className: (l = R[t.status]) == null ? void 0 : l.cls, children: ((a = R[t.status]) == null ? void 0 : a.label) ?? t.status });
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
h: "Bug",
|
|
364
|
+
cell: (t) => /* @__PURE__ */ d("div", { children: [
|
|
365
|
+
/* @__PURE__ */ e("div", { className: "font-medium text-slate-900 dark:text-foreground", children: t.title }),
|
|
366
|
+
t.impact && /* @__PURE__ */ e("div", { className: "text-[11px] text-slate-500 dark:text-muted-foreground", children: t.impact })
|
|
367
|
+
] })
|
|
368
|
+
},
|
|
369
|
+
{ h: "Kind", cell: (t) => ne[t.kind] ?? t.kind },
|
|
370
|
+
{ h: "First seen", cell: (t) => T(t.first_seen) },
|
|
371
|
+
{ h: "Last seen", cell: (t) => T(t.last_seen) },
|
|
372
|
+
{ h: "Days", cell: (t) => x(t.days_seen), num: !0 },
|
|
373
|
+
{ h: "Today", cell: (t) => x(t.today_count), num: !0 },
|
|
374
|
+
{ h: "Fixed in", cell: (t) => t.fixed_in ?? "", className: "font-mono text-[11.5px]" }
|
|
375
|
+
]
|
|
376
|
+
}
|
|
377
|
+
) }) : null;
|
|
378
|
+
}
|
|
379
|
+
function he({ report: r }) {
|
|
380
|
+
var l;
|
|
381
|
+
const t = c((l = r.comparison) == null ? void 0 : l.deltas);
|
|
382
|
+
return /* @__PURE__ */ e(
|
|
383
|
+
ae,
|
|
384
|
+
{
|
|
385
|
+
id: "all-numbers",
|
|
386
|
+
title: "Every number, against yesterday and the week",
|
|
387
|
+
empty: !t.length,
|
|
388
|
+
gist: `${t.length} numbers`,
|
|
389
|
+
children: /* @__PURE__ */ e(
|
|
390
|
+
w,
|
|
391
|
+
{
|
|
392
|
+
rows: t,
|
|
393
|
+
limit: 80,
|
|
394
|
+
drill: (a) => F(a.key),
|
|
395
|
+
cols: [
|
|
396
|
+
{ h: "Number", cell: (a) => a.label },
|
|
397
|
+
{ h: "Today", cell: (a) => v(a.today, a.unit), num: !0 },
|
|
398
|
+
{ h: "Yesterday", cell: (a) => v(a.prev, a.unit), num: !0 },
|
|
399
|
+
{
|
|
400
|
+
h: "Change",
|
|
401
|
+
num: !0,
|
|
402
|
+
cell: (a) => /* @__PURE__ */ e("span", { className: A(a.good), children: j(a) })
|
|
403
|
+
},
|
|
404
|
+
{ h: "7-day avg", cell: (a) => v(a.week_avg, a.unit), num: !0 }
|
|
405
|
+
]
|
|
406
|
+
}
|
|
407
|
+
)
|
|
408
|
+
}
|
|
409
|
+
);
|
|
410
|
+
}
|
|
411
|
+
function xe({
|
|
412
|
+
id: r,
|
|
413
|
+
onRun: t,
|
|
414
|
+
running: l,
|
|
415
|
+
linkTo: a
|
|
416
|
+
}) {
|
|
417
|
+
var k, N;
|
|
418
|
+
const h = O(), u = H({
|
|
419
|
+
queryKey: ["ops-report", r],
|
|
420
|
+
queryFn: () => h.request(U(`/ops-reports/${r}`)).then((y) => y.data),
|
|
421
|
+
refetchInterval: (y) => {
|
|
422
|
+
var B;
|
|
423
|
+
return ((B = y.state.data) == null ? void 0 : B.status) === "running" ? 3e3 : !1;
|
|
424
|
+
}
|
|
425
|
+
}), i = Q(), o = (k = u.data) == null ? void 0 : k.status;
|
|
426
|
+
if (z(() => {
|
|
427
|
+
o && o !== "running" && i.invalidateQueries({ queryKey: ["ops-reports"] });
|
|
428
|
+
}, [o, i]), u.isLoading)
|
|
429
|
+
return /* @__PURE__ */ d("div", { className: "space-y-3 p-4", "aria-busy": "true", children: [
|
|
430
|
+
/* @__PURE__ */ e(D, { className: "h-24 w-full" }),
|
|
431
|
+
/* @__PURE__ */ e(D, { className: "h-20 w-full" }),
|
|
432
|
+
/* @__PURE__ */ e(D, { className: "h-40 w-full" })
|
|
433
|
+
] });
|
|
434
|
+
if (u.error || !u.data)
|
|
435
|
+
return /* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(J, { error: u.error, what: "this report", onRetry: () => void u.refetch() }) });
|
|
436
|
+
const s = u.data, f = s.verdict ? M[s.verdict] : null, n = ee(s), b = s.error ? {
|
|
437
|
+
title: s.status === "failed" ? "This report could not be built" : "The AI write-up did not finish",
|
|
438
|
+
hint: s.status === "failed" ? "Run it again. If it keeps failing, ask for help." : "The numbers below are still complete. Run it again to get the write-up.",
|
|
439
|
+
technical: s.error,
|
|
440
|
+
kind: "bug"
|
|
441
|
+
} : null;
|
|
442
|
+
return /* @__PURE__ */ e(Z, { reportId: s.id, linkTo: a, children: /* @__PURE__ */ d("div", { className: "space-y-3 p-4", "data-ops-report": s.id, children: [
|
|
443
|
+
/* @__PURE__ */ d("header", { className: "rounded-lg border border-slate-200 bg-white p-4 dark:border-border dark:bg-card", children: [
|
|
444
|
+
/* @__PURE__ */ d("div", { className: "flex flex-wrap items-start gap-3", children: [
|
|
445
|
+
/* @__PURE__ */ d("div", { className: "min-w-0 flex-1", children: [
|
|
446
|
+
/* @__PURE__ */ d("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
447
|
+
/* @__PURE__ */ d("h2", { className: "text-[15px] font-semibold text-slate-900 dark:text-foreground", children: [
|
|
448
|
+
q(s.day),
|
|
449
|
+
" ",
|
|
450
|
+
W(s.day)
|
|
451
|
+
] }),
|
|
452
|
+
/* @__PURE__ */ e("span", { className: "text-[12px] text-slate-500 dark:text-muted-foreground", children: ((N = s.window) == null ? void 0 : N.label) ?? "" }),
|
|
453
|
+
f ? /* @__PURE__ */ e(S, { className: g("px-2.5 py-0.5 text-[11.5px]", f.badge), children: f.label }) : /* @__PURE__ */ e(S, { className: "border-slate-200 bg-slate-50 text-slate-600 dark:border-border dark:bg-muted dark:text-muted-foreground", children: K(s.status) }),
|
|
454
|
+
s.score != null && /* @__PURE__ */ d("span", { className: "text-[12px] text-slate-500 dark:text-muted-foreground", children: [
|
|
455
|
+
"score",
|
|
456
|
+
" ",
|
|
457
|
+
/* @__PURE__ */ e("span", { className: "text-[15px] font-semibold tabular-nums text-slate-900 dark:text-foreground", children: s.score }),
|
|
458
|
+
/* @__PURE__ */ e("span", { className: "text-slate-400", children: " / 100" })
|
|
459
|
+
] })
|
|
460
|
+
] }),
|
|
461
|
+
s.headline && /* @__PURE__ */ e("p", { className: "mt-1.5 text-[13.5px] font-medium leading-snug text-slate-800 dark:text-foreground", children: s.headline }),
|
|
462
|
+
(s.model || n != null || s.cost_usd != null) && /* @__PURE__ */ e("p", { className: "mt-1.5 text-[11px] text-slate-500 dark:text-muted-foreground", children: [
|
|
463
|
+
s.model,
|
|
464
|
+
n != null ? `${x(n)} tokens` : null,
|
|
465
|
+
s.cost_usd != null ? te(s.cost_usd) : null,
|
|
466
|
+
s.trigger === "manual" ? "run by hand" : null
|
|
467
|
+
].filter(Boolean).join(" · ") })
|
|
468
|
+
] }),
|
|
469
|
+
/* @__PURE__ */ d(
|
|
470
|
+
$,
|
|
471
|
+
{
|
|
472
|
+
size: "sm",
|
|
473
|
+
variant: "outline",
|
|
474
|
+
className: "h-8 gap-1.5 text-[12.5px]",
|
|
475
|
+
disabled: l || s.status === "running",
|
|
476
|
+
"data-tip": "Build this day's report again",
|
|
477
|
+
onClick: () => t(s.day),
|
|
478
|
+
children: [
|
|
479
|
+
l || s.status === "running" ? /* @__PURE__ */ e(P, { className: "h-3.5 w-3.5 animate-spin", "aria-hidden": !0 }) : /* @__PURE__ */ e(I, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
|
|
480
|
+
s.status === "running" ? "Building…" : "Run now"
|
|
481
|
+
]
|
|
482
|
+
}
|
|
483
|
+
)
|
|
484
|
+
] }),
|
|
485
|
+
b && /* @__PURE__ */ e(G, { description: b, className: "mt-3" }),
|
|
486
|
+
s.status === "running" && /* @__PURE__ */ e("p", { className: "mt-3 text-[12px] text-slate-500 dark:text-muted-foreground", role: "status", children: "The server is gathering the numbers and writing the summary. This page updates by itself." })
|
|
487
|
+
] }),
|
|
488
|
+
/* @__PURE__ */ e(ce, { report: s }),
|
|
489
|
+
/* @__PURE__ */ e(de, { report: s }),
|
|
490
|
+
/* @__PURE__ */ e(ie, { report: s }),
|
|
491
|
+
/* @__PURE__ */ e(ue, { report: s }),
|
|
492
|
+
/* @__PURE__ */ e(me, { bugs: c(s.tracker) }),
|
|
493
|
+
/* @__PURE__ */ d("div", { children: [
|
|
494
|
+
/* @__PURE__ */ e(L, { children: "The numbers behind it" }),
|
|
495
|
+
/* @__PURE__ */ e("div", { className: "space-y-1.5", children: /* @__PURE__ */ e(he, { report: s }) }),
|
|
496
|
+
/* @__PURE__ */ e("div", { className: "mt-1.5", children: /* @__PURE__ */ e(X, { report: s }) })
|
|
497
|
+
] })
|
|
498
|
+
] }) });
|
|
499
|
+
}
|
|
500
|
+
function Ie({
|
|
501
|
+
rows: r,
|
|
502
|
+
selected: t,
|
|
503
|
+
onSelect: l,
|
|
504
|
+
onRunDay: a,
|
|
505
|
+
linkTo: h
|
|
506
|
+
}) {
|
|
507
|
+
var o;
|
|
508
|
+
const u = r.some((s) => s.status === "running");
|
|
509
|
+
if (!r.length)
|
|
510
|
+
return /* @__PURE__ */ d("div", { className: "flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center", children: [
|
|
511
|
+
/* @__PURE__ */ e("p", { className: "text-[13px] font-medium text-slate-800 dark:text-foreground", children: "No daily reports yet" }),
|
|
512
|
+
/* @__PURE__ */ e("p", { className: "max-w-sm text-[12px] text-slate-500 dark:text-muted-foreground", children: "The report is built each night after the window closes. Build today's now to see what it looks like." }),
|
|
513
|
+
/* @__PURE__ */ d($, { size: "sm", className: "gap-1.5", onClick: () => a(), disabled: u, children: [
|
|
514
|
+
/* @__PURE__ */ e(I, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
|
|
515
|
+
"Run now"
|
|
516
|
+
] })
|
|
517
|
+
] });
|
|
518
|
+
const i = t ?? ((o = r[0]) == null ? void 0 : o.id) ?? null;
|
|
519
|
+
return /* @__PURE__ */ d("div", { className: "flex flex-1 min-h-0 overflow-hidden", children: [
|
|
520
|
+
/* @__PURE__ */ e("aside", { className: "w-[272px] shrink-0 overflow-y-auto border-r border-slate-200 bg-white dark:border-border dark:bg-card", children: /* @__PURE__ */ e(se, { rows: r, selected: i, onSelect: l }) }),
|
|
521
|
+
/* @__PURE__ */ e("div", { className: "min-w-0 flex-1 overflow-y-auto bg-slate-50 dark:bg-background", children: i != null && /* @__PURE__ */ e(xe, { id: i, onRun: a, running: u, linkTo: h }) })
|
|
522
|
+
] });
|
|
523
|
+
}
|
|
524
|
+
export {
|
|
525
|
+
Ie as ReportTab,
|
|
526
|
+
le as VerdictDot
|
|
527
|
+
};
|