@debugkit/dashboard 0.7.0 → 0.8.0
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/client/assets/_authed-CNObwuZh.js +7 -0
- package/dist/client/assets/_authed-CuP-He8G.js +1 -0
- package/dist/client/assets/{charts-XyOWJI9T.js → charts-CUvev8lV.js} +7 -7
- package/dist/client/assets/copy-button-ORgLIh59.js +1 -0
- package/dist/client/assets/customers-DTMEprFQ.js +1 -0
- package/dist/client/assets/endpoints-lMSO2CdM.js +1 -0
- package/dist/client/assets/events._eventId-bWag-i8J.js +3 -0
- package/dist/client/assets/index-BNpacHyi.js +10 -0
- package/dist/client/assets/invite._token-CxXek2SP.js +1 -0
- package/dist/client/assets/issues._fingerprint-BQr85TVY.js +1 -0
- package/dist/client/assets/login-Dlk3GyyC.js +1 -0
- package/dist/client/assets/sessions._sessionId-3wNImMqM.js +1 -0
- package/dist/client/assets/settings-CzbEYB7k.js +1 -0
- package/dist/client/assets/src-Dq5mIUf0.js +3 -0
- package/dist/client/assets/styles-DPsgRH7g.css +2 -0
- package/dist/client/assets/team-Bud2-07A.js +1 -0
- package/dist/client/assets/timeline-BSDhQPpY.js +1 -0
- package/dist/client/assets/ui-CEv2y56s.js +1 -0
- package/dist/server/assets/{_authed-CrjuC0O3.js → _authed-DkkRwdZl.js} +19 -5
- package/dist/server/assets/{_authed-C-sIPXSO.js → _authed-DsB8kjZB.js} +318 -126
- package/dist/server/assets/_tanstack-start-manifest_v-D1_ErrJK.js +97 -0
- package/dist/server/assets/copy-button-D3RddzTw.js +52 -0
- package/dist/server/assets/customers-CvSLt_xV.js +163 -0
- package/dist/server/assets/{demo-BsMMDk_F.js → demo-BRTkdmQJ.js} +25 -4
- package/dist/server/assets/{dynamodb-Zkk1-mgz.js → dynamodb-B0V3ZO20.js} +45 -17
- package/dist/server/assets/endpoints-mPQXpH8C.js +371 -0
- package/dist/server/assets/{queries-BJxX3Kjp.js → errors-C2KEDL7l.js} +842 -62
- package/dist/server/assets/events._eventId-pkQBQ9sL.js +765 -0
- package/dist/server/assets/{firestore-C52q_vwM.js → firestore-Jd-LeWZI.js} +15 -6
- package/dist/server/assets/fns-B3PHbFwV.js +1295 -0
- package/dist/server/assets/{fns-DwGaMi8S.js → fns-Di0vMpkQ.js} +25 -3
- package/dist/server/assets/{invite._token-xnpnkdRv.js → invite._token-LwWF5YxP.js} +3 -3
- package/dist/server/assets/{issues._fingerprint-e7ubdJf0.js → issues._fingerprint-DAA0QCuA.js} +89 -11
- package/dist/server/assets/{login-EopnOJXA.js → login-DqjCU4DJ.js} +3 -3
- package/dist/server/assets/{memory-BssaqdZm.js → memory-aqsrtEUn.js} +377 -26
- package/dist/server/assets/router-C0Dauj2C.js +510 -0
- package/dist/server/assets/sessions._sessionId-D7JPV0M4.js +264 -0
- package/dist/server/assets/{settings-CaJN69N6.js → settings-Drjd64d7.js} +165 -5
- package/dist/server/assets/{src-D83GYTrp.js → src-C4fNgijW.js} +1 -1
- package/dist/server/assets/{team-B1UcM1jA.js → team-D7iXYnSE.js} +3 -3
- package/dist/server/assets/timeline-MDRNDhiA.js +132 -0
- package/dist/server/assets/{ui-BJokJdYa.js → ui-B_XHlLUQ.js} +53 -13
- package/dist/server/server.js +37 -21
- package/package.json +4 -4
- package/dist/client/assets/_authed-BN39b-7H.js +0 -1
- package/dist/client/assets/_authed-CspAf0jN.js +0 -7
- package/dist/client/assets/index-Bfb2UOzB.js +0 -10
- package/dist/client/assets/invite._token-B4HN51-h.js +0 -1
- package/dist/client/assets/issues._fingerprint-BV1QrETY.js +0 -1
- package/dist/client/assets/login-COlvJ5Je.js +0 -1
- package/dist/client/assets/preload-helper-Dscj_TcA.js +0 -3
- package/dist/client/assets/settings-Dl4EWeWC.js +0 -1
- package/dist/client/assets/styles-DztngwT9.css +0 -2
- package/dist/client/assets/team-7Zekz_Er.js +0 -1
- package/dist/client/assets/ui-C0HGOza2.js +0 -1
- package/dist/server/assets/_tanstack-start-manifest_v-CqaE4wze.js +0 -61
- package/dist/server/assets/fns-mbUIXXep.js +0 -529
- package/dist/server/assets/router-G99085_Q.js +0 -315
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import { t as CopyButton } from "./copy-button-D3RddzTw.js";
|
|
2
|
+
import { a as joined, i as clock, n as ICON, r as OutcomeBadge, s as roundedSpan, t as CrumbBody } from "./timeline-MDRNDhiA.js";
|
|
3
|
+
import { t as Card } from "./ui-B_XHlLUQ.js";
|
|
4
|
+
import { n as Route } from "./router-C0Dauj2C.js";
|
|
5
|
+
import { Link } from "@tanstack/react-router";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
// src/routes/_authed/sessions.$sessionId.tsx?tsr-split=component
|
|
8
|
+
function SessionPage() {
|
|
9
|
+
const { session: s, missingIndex } = Route.useLoaderData();
|
|
10
|
+
if (!s) return /* @__PURE__ */ jsxs("main", {
|
|
11
|
+
className: "mx-auto max-w-3xl px-4 py-10 sm:px-6",
|
|
12
|
+
children: [/* @__PURE__ */ jsx("h1", {
|
|
13
|
+
className: "text-xl font-semibold",
|
|
14
|
+
children: "This session can't be read yet"
|
|
15
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
16
|
+
className: "mt-2 text-sm text-muted",
|
|
17
|
+
children: missingIndex && "Firestore needs deBug's new index on events (sessionId, ts). Deploy it with: firebase deploy --only firestore:indexes, using deBug's firestore.indexes.json. It takes a few minutes to build."
|
|
18
|
+
})]
|
|
19
|
+
});
|
|
20
|
+
const customer = s.user.id;
|
|
21
|
+
return /* @__PURE__ */ jsxs("main", {
|
|
22
|
+
className: "mx-auto max-w-5xl space-y-5 px-4 py-6 sm:px-6",
|
|
23
|
+
children: [
|
|
24
|
+
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("p", {
|
|
25
|
+
className: "text-xs uppercase tracking-wide text-muted",
|
|
26
|
+
title: "From the earliest step recorded to the last stored event. The session may have started earlier and gone on after.",
|
|
27
|
+
children: [
|
|
28
|
+
"Session · recorded ",
|
|
29
|
+
clock(s.start),
|
|
30
|
+
" to ",
|
|
31
|
+
clock(s.end),
|
|
32
|
+
" · ",
|
|
33
|
+
duration(s.start, s.end)
|
|
34
|
+
]
|
|
35
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
36
|
+
className: "mt-1 flex flex-wrap items-center gap-3",
|
|
37
|
+
children: [
|
|
38
|
+
/* @__PURE__ */ jsx("h1", {
|
|
39
|
+
className: "text-xl font-semibold tracking-tight",
|
|
40
|
+
children: customer ? /* @__PURE__ */ jsx("span", {
|
|
41
|
+
className: "break-all font-mono",
|
|
42
|
+
children: customer
|
|
43
|
+
}) : "Not signed in"
|
|
44
|
+
}),
|
|
45
|
+
/* @__PURE__ */ jsx(OutcomeBadge, { outcome: s.outcome }),
|
|
46
|
+
(customer || s.user.anonymousId) && /* @__PURE__ */ jsx(Link, {
|
|
47
|
+
to: "/customers",
|
|
48
|
+
search: {
|
|
49
|
+
app: s.app,
|
|
50
|
+
q: customer ?? s.user.anonymousId
|
|
51
|
+
},
|
|
52
|
+
className: "text-sm text-accent hover:underline",
|
|
53
|
+
children: "All their sessions →"
|
|
54
|
+
})
|
|
55
|
+
]
|
|
56
|
+
})] }),
|
|
57
|
+
/* @__PURE__ */ jsxs("section", {
|
|
58
|
+
"aria-label": "Device and app",
|
|
59
|
+
className: "flex flex-wrap items-center gap-x-6 gap-y-2 rounded-xl border border-line bg-panel px-4 py-3 text-sm",
|
|
60
|
+
children: [
|
|
61
|
+
/* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsx("span", {
|
|
62
|
+
className: "text-muted",
|
|
63
|
+
children: "Device "
|
|
64
|
+
}), joined([s.context.device.brand, s.context.device.model]) ?? "—"] }),
|
|
65
|
+
/* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsx("span", {
|
|
66
|
+
className: "text-muted",
|
|
67
|
+
children: "OS "
|
|
68
|
+
}), joined([s.context.os.name, s.context.os.version]) ?? "—"] }),
|
|
69
|
+
/* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsx("span", {
|
|
70
|
+
className: "text-muted",
|
|
71
|
+
children: "App "
|
|
72
|
+
}), joined([s.context.app.version, s.context.app.build && `(${s.context.app.build})`]) ?? "—"] }),
|
|
73
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
74
|
+
/* @__PURE__ */ jsx("span", {
|
|
75
|
+
className: "text-muted",
|
|
76
|
+
children: "Errors "
|
|
77
|
+
}),
|
|
78
|
+
s.counts.errors,
|
|
79
|
+
s.counts.handled > 0 && /* @__PURE__ */ jsxs("span", {
|
|
80
|
+
className: "text-muted",
|
|
81
|
+
children: [
|
|
82
|
+
" (",
|
|
83
|
+
s.counts.handled,
|
|
84
|
+
" caught by the app)"
|
|
85
|
+
]
|
|
86
|
+
})
|
|
87
|
+
] }),
|
|
88
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
89
|
+
/* @__PURE__ */ jsx("span", {
|
|
90
|
+
className: "text-muted",
|
|
91
|
+
children: "Session "
|
|
92
|
+
}),
|
|
93
|
+
/* @__PURE__ */ jsx("span", {
|
|
94
|
+
className: "break-all font-mono text-xs",
|
|
95
|
+
children: s.sessionId
|
|
96
|
+
}),
|
|
97
|
+
/* @__PURE__ */ jsx("span", {
|
|
98
|
+
className: "ml-2",
|
|
99
|
+
children: /* @__PURE__ */ jsx(CopyButton, {
|
|
100
|
+
text: s.sessionId,
|
|
101
|
+
label: "Copy",
|
|
102
|
+
ariaLabel: "Copy session id"
|
|
103
|
+
})
|
|
104
|
+
})
|
|
105
|
+
] }),
|
|
106
|
+
s.user.anonymousId && /* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsx("span", {
|
|
107
|
+
className: "text-muted",
|
|
108
|
+
children: "Install "
|
|
109
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
110
|
+
className: "break-all font-mono text-xs",
|
|
111
|
+
children: s.user.anonymousId
|
|
112
|
+
})] }),
|
|
113
|
+
customer && /* @__PURE__ */ jsx("span", {
|
|
114
|
+
className: "ml-auto",
|
|
115
|
+
children: /* @__PURE__ */ jsx(CopyButton, {
|
|
116
|
+
text: customer,
|
|
117
|
+
label: "Copy customer",
|
|
118
|
+
ariaLabel: "Copy customer id"
|
|
119
|
+
})
|
|
120
|
+
})
|
|
121
|
+
]
|
|
122
|
+
}),
|
|
123
|
+
/* @__PURE__ */ jsxs(Card, {
|
|
124
|
+
title: "Timeline",
|
|
125
|
+
subtitle: "Screens, taps, API calls, flow steps and errors in this session, in order. Times are from the device, from the session's start.",
|
|
126
|
+
children: [
|
|
127
|
+
/* @__PURE__ */ jsx("ol", {
|
|
128
|
+
className: "space-y-1.5",
|
|
129
|
+
children: s.rows.map((r, i) => /* @__PURE__ */ jsx(Row, {
|
|
130
|
+
row: r,
|
|
131
|
+
app: s.app,
|
|
132
|
+
start: s.start
|
|
133
|
+
}, r.kind === "crumb" ? `c${i}` : r.eventId))
|
|
134
|
+
}),
|
|
135
|
+
s.truncated && /* @__PURE__ */ jsxs("p", {
|
|
136
|
+
className: "mt-3 text-xs text-muted",
|
|
137
|
+
children: [
|
|
138
|
+
"Showing the newest ",
|
|
139
|
+
s.read,
|
|
140
|
+
" events of this session; older ones are left out."
|
|
141
|
+
]
|
|
142
|
+
}),
|
|
143
|
+
/* @__PURE__ */ jsx("p", {
|
|
144
|
+
className: "mt-3 text-xs text-muted",
|
|
145
|
+
children: "Screens, taps and API calls come from the trail each error carries, so what happened after the last error isn't shown, and the trail before an error goes back as far as the SDK's breadcrumb limit."
|
|
146
|
+
})
|
|
147
|
+
]
|
|
148
|
+
})
|
|
149
|
+
]
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
function Row({ row, app, start }) {
|
|
153
|
+
const at = /* @__PURE__ */ jsx("span", {
|
|
154
|
+
className: "tabular pt-0.5 text-right text-xs text-muted",
|
|
155
|
+
title: row.ts,
|
|
156
|
+
children: since(row.ts, start)
|
|
157
|
+
});
|
|
158
|
+
const cls = "grid grid-cols-[4.5rem_1.25rem_1fr] gap-2 rounded-md px-2 py-1.5 text-sm";
|
|
159
|
+
if (row.kind === "crumb") {
|
|
160
|
+
const t = row.item;
|
|
161
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
162
|
+
className: `${cls} ${t.failed ? "bg-sev-critical/10" : t.level === "warning" ? "bg-sev-medium/10" : ""}`,
|
|
163
|
+
children: [
|
|
164
|
+
at,
|
|
165
|
+
/* @__PURE__ */ jsx("span", {
|
|
166
|
+
"aria-hidden": true,
|
|
167
|
+
className: `pt-0.5 text-center ${t.failed ? "text-sev-critical" : "text-muted"}`,
|
|
168
|
+
children: ICON[t.category]
|
|
169
|
+
}),
|
|
170
|
+
/* @__PURE__ */ jsxs("div", {
|
|
171
|
+
className: "min-w-0",
|
|
172
|
+
children: [/* @__PURE__ */ jsx(CrumbBody, { item: t }), /* @__PURE__ */ jsx(SourceLink, {
|
|
173
|
+
source: row.source,
|
|
174
|
+
app
|
|
175
|
+
})]
|
|
176
|
+
})
|
|
177
|
+
]
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
if (row.kind === "event") return /* @__PURE__ */ jsxs("li", {
|
|
181
|
+
className: `${cls} ${row.failed ? "bg-sev-medium/10" : ""}`,
|
|
182
|
+
children: [
|
|
183
|
+
at,
|
|
184
|
+
/* @__PURE__ */ jsx("span", {
|
|
185
|
+
"aria-hidden": true,
|
|
186
|
+
className: `pt-0.5 text-center ${row.failed ? "text-sev-high" : "text-muted"}`,
|
|
187
|
+
children: "◆"
|
|
188
|
+
}),
|
|
189
|
+
/* @__PURE__ */ jsxs("div", {
|
|
190
|
+
className: "min-w-0",
|
|
191
|
+
children: [
|
|
192
|
+
/* @__PURE__ */ jsx("span", {
|
|
193
|
+
className: "mr-2 rounded bg-panel-2 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-muted",
|
|
194
|
+
children: "flow"
|
|
195
|
+
}),
|
|
196
|
+
/* @__PURE__ */ jsx("span", {
|
|
197
|
+
className: `break-words ${row.failed ? "font-medium" : ""}`,
|
|
198
|
+
children: row.detail
|
|
199
|
+
}),
|
|
200
|
+
/* @__PURE__ */ jsx(SourceLink, {
|
|
201
|
+
source: row.source,
|
|
202
|
+
app
|
|
203
|
+
})
|
|
204
|
+
]
|
|
205
|
+
})
|
|
206
|
+
]
|
|
207
|
+
});
|
|
208
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
209
|
+
className: `${cls} ${row.handled ? "bg-sev-critical/10" : "bg-sev-critical/20"} font-medium text-sev-critical`,
|
|
210
|
+
children: [
|
|
211
|
+
at,
|
|
212
|
+
/* @__PURE__ */ jsx("span", {
|
|
213
|
+
"aria-hidden": true,
|
|
214
|
+
className: "pt-0.5 text-center",
|
|
215
|
+
children: "✕"
|
|
216
|
+
}),
|
|
217
|
+
/* @__PURE__ */ jsxs("div", {
|
|
218
|
+
className: "min-w-0",
|
|
219
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
220
|
+
className: "mr-2 rounded bg-sev-critical px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-white",
|
|
221
|
+
children: row.crash ? "crash" : row.handled ? "error" : "uncaught"
|
|
222
|
+
}), row.fingerprint ? /* @__PURE__ */ jsx(Link, {
|
|
223
|
+
to: "/events/$eventId",
|
|
224
|
+
params: { eventId: row.eventId },
|
|
225
|
+
search: {
|
|
226
|
+
app,
|
|
227
|
+
issue: row.fingerprint
|
|
228
|
+
},
|
|
229
|
+
className: "break-words hover:underline",
|
|
230
|
+
children: row.title
|
|
231
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
232
|
+
className: "break-words",
|
|
233
|
+
children: row.title
|
|
234
|
+
})]
|
|
235
|
+
})
|
|
236
|
+
]
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
/** Opens the error whose trail holds this row, where the steps around it are shown. */
|
|
240
|
+
function SourceLink({ source, app }) {
|
|
241
|
+
if (!source) return null;
|
|
242
|
+
return /* @__PURE__ */ jsx(Link, {
|
|
243
|
+
to: "/events/$eventId",
|
|
244
|
+
params: { eventId: source.eventId },
|
|
245
|
+
search: {
|
|
246
|
+
app,
|
|
247
|
+
issue: source.fingerprint
|
|
248
|
+
},
|
|
249
|
+
className: "ml-2 whitespace-nowrap text-xs text-muted hover:text-ink hover:underline",
|
|
250
|
+
title: "Open the error this step led to",
|
|
251
|
+
children: "in error →"
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
/** "+1:05" from the session's start; the first row is "+0:00". */
|
|
255
|
+
function since(ts, start) {
|
|
256
|
+
const s = Math.max(0, Math.round((Date.parse(ts) - Date.parse(start)) / 1e3));
|
|
257
|
+
return s >= 3600 ? `+${Math.floor(s / 3600)}:${pad(Math.floor(s / 60) % 60)}:${pad(s % 60)}` : `+${Math.floor(s / 60)}:${pad(s % 60)}`;
|
|
258
|
+
}
|
|
259
|
+
function duration(start, end) {
|
|
260
|
+
const s = Math.max(0, (Date.parse(end) - Date.parse(start)) / 1e3);
|
|
261
|
+
return s < .05 ? "0 s" : roundedSpan(s);
|
|
262
|
+
}
|
|
263
|
+
var pad = (n) => String(n).padStart(2, "0");
|
|
264
|
+
export { SessionPage as component };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { S as OWNER_INFO, g as normaliseHostMatch, x as OWNERS } from "./memory-aqsrtEUn.js";
|
|
2
|
+
import { t as Card } from "./ui-B_XHlLUQ.js";
|
|
3
|
+
import { b as saveRetention, v as restampExisting, x as sendTestAlert, y as saveAppSettings } from "./fns-Di0vMpkQ.js";
|
|
4
|
+
import { s as Route } from "./router-C0Dauj2C.js";
|
|
4
5
|
import { useState } from "react";
|
|
5
6
|
import { useNavigate, useRouter } from "@tanstack/react-router";
|
|
6
7
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -13,7 +14,7 @@ var CHOICES = [
|
|
|
13
14
|
365
|
|
14
15
|
];
|
|
15
16
|
function SettingsPage() {
|
|
16
|
-
const { apps, settings } = Route.useLoaderData();
|
|
17
|
+
const { apps, settings, seenHosts } = Route.useLoaderData();
|
|
17
18
|
const navigate = useNavigate({ from: Route.fullPath });
|
|
18
19
|
const router = useRouter();
|
|
19
20
|
const [days, setDays] = useState(String(settings?.retentionDays ?? 60));
|
|
@@ -211,7 +212,13 @@ function SettingsPage() {
|
|
|
211
212
|
canEdit && /* @__PURE__ */ jsx(FlowsAndAlerts, {
|
|
212
213
|
settings,
|
|
213
214
|
onStatus: setStatus
|
|
214
|
-
}, settings.app + (settings.
|
|
215
|
+
}, settings.app + JSON.stringify([settings.criticalFlows, settings.alerts])),
|
|
216
|
+
canEdit && /* @__PURE__ */ jsx(HostNames, {
|
|
217
|
+
app: settings.app,
|
|
218
|
+
hosts: settings.hosts,
|
|
219
|
+
seen: seenHosts,
|
|
220
|
+
onStatus: setStatus
|
|
221
|
+
}, settings.app + JSON.stringify(settings.hosts)),
|
|
215
222
|
status && /* @__PURE__ */ jsx("p", {
|
|
216
223
|
role: "status",
|
|
217
224
|
className: `rounded-lg border px-3 py-2 text-sm ${status.tone === "error" ? "border-sev-critical text-sev-critical" : status.tone === "ok" ? "border-line bg-panel-2" : "border-line text-muted"}`,
|
|
@@ -368,4 +375,157 @@ function FlowsAndAlerts({ settings, onStatus }) {
|
|
|
368
375
|
})
|
|
369
376
|
] });
|
|
370
377
|
}
|
|
378
|
+
/** Owners a host can be given; leaving it unset lets the classifier decide. */
|
|
379
|
+
var HOST_OWNERS = OWNERS.filter((o) => o !== "unknown");
|
|
380
|
+
function HostNames({ app, hosts, seen, onStatus }) {
|
|
381
|
+
const router = useRouter();
|
|
382
|
+
const [nextId, setNextId] = useState(hosts.length + 1);
|
|
383
|
+
const [rows, setRows] = useState(() => hosts.length ? hosts.map((h, i) => ({
|
|
384
|
+
id: i,
|
|
385
|
+
match: h.match,
|
|
386
|
+
name: h.name,
|
|
387
|
+
owner: h.owner ?? ""
|
|
388
|
+
})) : [{
|
|
389
|
+
id: 0,
|
|
390
|
+
match: "",
|
|
391
|
+
name: "",
|
|
392
|
+
owner: ""
|
|
393
|
+
}]);
|
|
394
|
+
const [busy, setBusy] = useState(false);
|
|
395
|
+
const named = new Set(rows.map((r) => normaliseHostMatch(r.match)));
|
|
396
|
+
const unnamed = seen.filter((h) => !named.has(h));
|
|
397
|
+
const update = (id, patch) => setRows((rs) => rs.map((r) => r.id === id ? {
|
|
398
|
+
...r,
|
|
399
|
+
...patch
|
|
400
|
+
} : r));
|
|
401
|
+
const add = (match = "") => {
|
|
402
|
+
setRows((rs) => [...rs.filter((r) => r.match || r.name), {
|
|
403
|
+
id: nextId,
|
|
404
|
+
match,
|
|
405
|
+
name: "",
|
|
406
|
+
owner: ""
|
|
407
|
+
}]);
|
|
408
|
+
setNextId((n) => n + 1);
|
|
409
|
+
};
|
|
410
|
+
const save = async () => {
|
|
411
|
+
setBusy(true);
|
|
412
|
+
onStatus(null);
|
|
413
|
+
const out = await saveAppSettings({ data: {
|
|
414
|
+
app,
|
|
415
|
+
hosts: rows.map((r) => ({
|
|
416
|
+
match: r.match,
|
|
417
|
+
name: r.name,
|
|
418
|
+
...r.owner ? { owner: r.owner } : {}
|
|
419
|
+
}))
|
|
420
|
+
} }).catch((e) => ({
|
|
421
|
+
ok: false,
|
|
422
|
+
error: e.message
|
|
423
|
+
}));
|
|
424
|
+
setBusy(false);
|
|
425
|
+
if (!out.ok) return onStatus({
|
|
426
|
+
tone: "error",
|
|
427
|
+
text: out.error
|
|
428
|
+
});
|
|
429
|
+
onStatus({
|
|
430
|
+
tone: "ok",
|
|
431
|
+
text: "Saved. Names show straight away; owners apply to new errors within about a minute, and to existing issues now."
|
|
432
|
+
});
|
|
433
|
+
await router.invalidate();
|
|
434
|
+
};
|
|
435
|
+
const box = "rounded-md border border-line bg-panel px-2 py-1.5 text-sm";
|
|
436
|
+
return /* @__PURE__ */ jsx(Card, {
|
|
437
|
+
title: "Host names",
|
|
438
|
+
subtitle: "Give the servers your app calls a name people recognise, and say who looks after each one.",
|
|
439
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
440
|
+
className: "space-y-3",
|
|
441
|
+
children: [
|
|
442
|
+
rows.map((r, i) => /* @__PURE__ */ jsxs("div", {
|
|
443
|
+
role: "group",
|
|
444
|
+
"aria-label": `Host ${i + 1}`,
|
|
445
|
+
className: "grid gap-2 rounded-lg border border-line p-3 sm:grid-cols-[minmax(0,1.4fr)_minmax(0,1fr)_auto_auto] sm:items-end sm:border-0 sm:p-0",
|
|
446
|
+
children: [
|
|
447
|
+
/* @__PURE__ */ jsxs("label", {
|
|
448
|
+
className: "min-w-0 text-xs text-muted",
|
|
449
|
+
children: ["Host, or host and path", /* @__PURE__ */ jsx("input", {
|
|
450
|
+
value: r.match,
|
|
451
|
+
onChange: (e) => update(r.id, { match: e.target.value }),
|
|
452
|
+
list: "seen-hosts",
|
|
453
|
+
placeholder: "api.example.com/payments",
|
|
454
|
+
className: `mt-1 w-full font-mono text-xs text-ink ${box}`
|
|
455
|
+
})]
|
|
456
|
+
}),
|
|
457
|
+
/* @__PURE__ */ jsxs("label", {
|
|
458
|
+
className: "min-w-0 text-xs text-muted",
|
|
459
|
+
children: ["Name", /* @__PURE__ */ jsx("input", {
|
|
460
|
+
value: r.name,
|
|
461
|
+
onChange: (e) => update(r.id, { name: e.target.value }),
|
|
462
|
+
placeholder: "Balance service",
|
|
463
|
+
maxLength: 60,
|
|
464
|
+
className: `mt-1 w-full text-ink ${box}`
|
|
465
|
+
})]
|
|
466
|
+
}),
|
|
467
|
+
/* @__PURE__ */ jsxs("label", {
|
|
468
|
+
className: "text-xs text-muted",
|
|
469
|
+
children: ["Looked after by", /* @__PURE__ */ jsxs("select", {
|
|
470
|
+
value: r.owner,
|
|
471
|
+
onChange: (e) => update(r.id, { owner: e.target.value }),
|
|
472
|
+
className: `mt-1 w-full text-ink ${box}`,
|
|
473
|
+
children: [/* @__PURE__ */ jsx("option", {
|
|
474
|
+
value: "",
|
|
475
|
+
children: "Work it out"
|
|
476
|
+
}), HOST_OWNERS.map((o) => /* @__PURE__ */ jsx("option", {
|
|
477
|
+
value: o,
|
|
478
|
+
children: OWNER_INFO[o].name
|
|
479
|
+
}, o))]
|
|
480
|
+
})]
|
|
481
|
+
}),
|
|
482
|
+
/* @__PURE__ */ jsx("button", {
|
|
483
|
+
type: "button",
|
|
484
|
+
onClick: () => setRows((rs) => rs.filter((x) => x.id !== r.id)),
|
|
485
|
+
"aria-label": `Remove ${r.match || "this host"}`,
|
|
486
|
+
className: "justify-self-start rounded-md border border-line px-2.5 py-1.5 text-sm hover:bg-panel-2",
|
|
487
|
+
children: "Remove"
|
|
488
|
+
})
|
|
489
|
+
]
|
|
490
|
+
}, r.id)),
|
|
491
|
+
/* @__PURE__ */ jsx("datalist", {
|
|
492
|
+
id: "seen-hosts",
|
|
493
|
+
children: unnamed.map((h) => /* @__PURE__ */ jsx("option", { value: h }, h))
|
|
494
|
+
}),
|
|
495
|
+
unnamed.length > 0 && /* @__PURE__ */ jsxs("div", {
|
|
496
|
+
className: "text-xs text-muted",
|
|
497
|
+
children: [/* @__PURE__ */ jsx("p", { children: "Called in the last 30 days and not named yet:" }), /* @__PURE__ */ jsx("div", {
|
|
498
|
+
className: "mt-1 flex flex-wrap gap-1.5",
|
|
499
|
+
children: unnamed.slice(0, 8).map((h) => /* @__PURE__ */ jsxs("button", {
|
|
500
|
+
type: "button",
|
|
501
|
+
onClick: () => add(h),
|
|
502
|
+
className: "max-w-full truncate rounded-md border border-line px-2 py-0.5 font-mono hover:bg-panel-2",
|
|
503
|
+
title: `Name ${h}`,
|
|
504
|
+
children: ["+ ", h]
|
|
505
|
+
}, h))
|
|
506
|
+
})]
|
|
507
|
+
}),
|
|
508
|
+
/* @__PURE__ */ jsx("p", {
|
|
509
|
+
className: "text-xs text-muted",
|
|
510
|
+
children: "A path names part of a host: api.example.com/payments covers /payments/… only; the longest match wins. The owner decides who server errors from that host are passed to."
|
|
511
|
+
}),
|
|
512
|
+
/* @__PURE__ */ jsxs("div", {
|
|
513
|
+
className: "flex flex-wrap gap-2",
|
|
514
|
+
children: [/* @__PURE__ */ jsx("button", {
|
|
515
|
+
type: "button",
|
|
516
|
+
onClick: () => add(),
|
|
517
|
+
className: "rounded-md border border-line px-3 py-1.5 text-sm hover:bg-panel-2",
|
|
518
|
+
children: "Add a host"
|
|
519
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
520
|
+
type: "button",
|
|
521
|
+
onClick: () => void save(),
|
|
522
|
+
disabled: busy,
|
|
523
|
+
className: "rounded-md bg-accent px-3 py-1.5 text-sm font-medium text-white disabled:opacity-40",
|
|
524
|
+
children: "Save host names"
|
|
525
|
+
})]
|
|
526
|
+
})
|
|
527
|
+
]
|
|
528
|
+
})
|
|
529
|
+
});
|
|
530
|
+
}
|
|
371
531
|
export { SettingsPage as component };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { l as timeAgo, t as Card } from "./ui-B_XHlLUQ.js";
|
|
2
|
+
import { S as setMemberRole, _ as removeFromTeam, p as inviteToTeam, t as cancelInvite } from "./fns-Di0vMpkQ.js";
|
|
3
|
+
import { o as Route } from "./router-C0Dauj2C.js";
|
|
4
4
|
import { useState } from "react";
|
|
5
5
|
import { useRouter } from "@tanstack/react-router";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
// src/components/timeline.tsx
|
|
3
|
+
var OUTCOME = {
|
|
4
|
+
crashed: {
|
|
5
|
+
label: "Crashed",
|
|
6
|
+
title: "A fatal error ended the app.",
|
|
7
|
+
className: "bg-sev-critical text-white"
|
|
8
|
+
},
|
|
9
|
+
errored: {
|
|
10
|
+
label: "Errored",
|
|
11
|
+
title: "An error the app didn't catch, but no crash.",
|
|
12
|
+
className: "bg-sev-high text-white"
|
|
13
|
+
},
|
|
14
|
+
clean: {
|
|
15
|
+
label: "Clean",
|
|
16
|
+
title: "No crash and no uncaught errors. Errors the app caught are counted apart.",
|
|
17
|
+
className: "border border-line text-muted"
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
/** A session's outcome: crashed, errored or clean. */
|
|
21
|
+
function OutcomeBadge({ outcome }) {
|
|
22
|
+
const o = OUTCOME[outcome];
|
|
23
|
+
return /* @__PURE__ */ jsx("span", {
|
|
24
|
+
title: o.title,
|
|
25
|
+
className: `whitespace-nowrap rounded px-1.5 py-0.5 text-[11px] font-semibold uppercase tracking-wide ${o.className}`,
|
|
26
|
+
children: o.label
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
/** One glyph per breadcrumb category, next to its label. */
|
|
30
|
+
var ICON = {
|
|
31
|
+
navigation: "→",
|
|
32
|
+
network: "⇅",
|
|
33
|
+
ui: "◉",
|
|
34
|
+
log: "≡",
|
|
35
|
+
event: "◆",
|
|
36
|
+
custom: "✱"
|
|
37
|
+
};
|
|
38
|
+
/** A breadcrumb's text: the API call it describes, or its message, plus a repeat count and extra data. */
|
|
39
|
+
function CrumbBody({ item }) {
|
|
40
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
41
|
+
/* @__PURE__ */ jsx("span", {
|
|
42
|
+
className: "mr-2 rounded bg-panel-2 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-muted",
|
|
43
|
+
children: item.category
|
|
44
|
+
}),
|
|
45
|
+
item.api ? /* @__PURE__ */ jsx(ApiLine, { call: item.api }) : /* @__PURE__ */ jsx("span", {
|
|
46
|
+
className: "break-words",
|
|
47
|
+
children: item.message
|
|
48
|
+
}),
|
|
49
|
+
item.repeated && /* @__PURE__ */ jsxs("span", {
|
|
50
|
+
className: "ml-2 text-xs text-muted",
|
|
51
|
+
children: ["×", item.repeated]
|
|
52
|
+
}),
|
|
53
|
+
item.data && /* @__PURE__ */ jsx("div", {
|
|
54
|
+
className: "mt-0.5 break-words font-mono text-[11px] text-muted",
|
|
55
|
+
children: Object.entries(item.data).map(([k, v]) => `${k}=${String(v)}`).join(" · ")
|
|
56
|
+
})
|
|
57
|
+
] });
|
|
58
|
+
}
|
|
59
|
+
function ApiLine({ call }) {
|
|
60
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
61
|
+
className: "break-words",
|
|
62
|
+
children: [
|
|
63
|
+
call.service && /* @__PURE__ */ jsxs("span", {
|
|
64
|
+
className: "font-medium",
|
|
65
|
+
children: [call.service, " "]
|
|
66
|
+
}),
|
|
67
|
+
/* @__PURE__ */ jsx("span", {
|
|
68
|
+
className: "font-mono text-xs",
|
|
69
|
+
children: joined([call.method, call.path])
|
|
70
|
+
}),
|
|
71
|
+
" → ",
|
|
72
|
+
/* @__PURE__ */ jsx("span", {
|
|
73
|
+
className: call.failed ? "font-semibold text-sev-critical" : "",
|
|
74
|
+
children: call.status ?? call.outcome ?? "failed"
|
|
75
|
+
}),
|
|
76
|
+
call.status !== void 0 && call.outcome && call.outcome !== "answered" && /* @__PURE__ */ jsxs("span", {
|
|
77
|
+
className: "text-muted",
|
|
78
|
+
children: [
|
|
79
|
+
" (",
|
|
80
|
+
call.outcome,
|
|
81
|
+
")"
|
|
82
|
+
]
|
|
83
|
+
}),
|
|
84
|
+
call.durationMs !== void 0 && /* @__PURE__ */ jsxs("span", {
|
|
85
|
+
className: "text-muted",
|
|
86
|
+
children: [
|
|
87
|
+
" · ",
|
|
88
|
+
call.durationMs,
|
|
89
|
+
" ms"
|
|
90
|
+
]
|
|
91
|
+
}),
|
|
92
|
+
call.errorKind && /* @__PURE__ */ jsxs("span", {
|
|
93
|
+
className: "text-muted",
|
|
94
|
+
children: [" · ", call.errorKind]
|
|
95
|
+
}),
|
|
96
|
+
call.backendCode && /* @__PURE__ */ jsxs("span", {
|
|
97
|
+
className: "text-muted",
|
|
98
|
+
children: [" · ", call.backendCode]
|
|
99
|
+
})
|
|
100
|
+
]
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
/** The parts that are set, joined; undefined when none are. */
|
|
104
|
+
function joined(parts, sep = " ") {
|
|
105
|
+
return parts.filter(Boolean).join(sep) || void 0;
|
|
106
|
+
}
|
|
107
|
+
/** "14 Nov, 12:59:55" in the viewer's time zone. */
|
|
108
|
+
function clock(iso) {
|
|
109
|
+
return new Date(iso).toLocaleString(void 0, {
|
|
110
|
+
day: "numeric",
|
|
111
|
+
month: "short",
|
|
112
|
+
hour: "2-digit",
|
|
113
|
+
minute: "2-digit",
|
|
114
|
+
second: "2-digit"
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
/** How long before the error: "−5.9 s", "−2 min". */
|
|
118
|
+
function offset(ts, errorTs) {
|
|
119
|
+
const s = (Date.parse(ts) - Date.parse(errorTs)) / 1e3;
|
|
120
|
+
if (!Number.isFinite(s)) return "";
|
|
121
|
+
const a = Math.abs(s);
|
|
122
|
+
if (a < .05) return "0 s";
|
|
123
|
+
return `${s < 0 ? "−" : "+"}${roundedSpan(a)}`;
|
|
124
|
+
}
|
|
125
|
+
/** A span of seconds in one unit: "5.9 s", "42 s", "2 min", "3 h". */
|
|
126
|
+
function roundedSpan(a) {
|
|
127
|
+
if (a < 9.95) return `${a.toFixed(1)} s`;
|
|
128
|
+
if (Math.round(a) < 60) return `${Math.round(a)} s`;
|
|
129
|
+
if (Math.round(a / 60) < 60) return `${Math.round(a / 60)} min`;
|
|
130
|
+
return `${Math.round(a / 3600)} h`;
|
|
131
|
+
}
|
|
132
|
+
export { joined as a, clock as i, ICON as n, offset as o, OutcomeBadge as r, roundedSpan as s, CrumbBody as t };
|