adonisjs-server-stats 1.8.0 → 1.10.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.
Files changed (91) hide show
  1. package/dist/core/index.js +24 -22
  2. package/dist/core/log-utils.d.ts +14 -0
  3. package/dist/core/split-pane.d.ts +18 -0
  4. package/dist/core/trace-utils.d.ts +5 -0
  5. package/dist/core/types.d.ts +1 -1
  6. package/dist/react/{CacheSection-D5J5moz7.js → CacheSection-UCMptWyn.js} +1 -1
  7. package/dist/react/{CacheTab-F1MkWSZl.js → CacheTab-CA8LB1J5.js} +1 -1
  8. package/dist/react/{ConfigSection-DerLBu4o.js → ConfigSection-DfFd-WRq.js} +1 -1
  9. package/dist/react/{ConfigTab-Bsj7v9JW.js → ConfigTab-Bdg8YMer.js} +1 -1
  10. package/dist/react/{CustomPaneTab-gzdtDEvz.js → CustomPaneTab-Bxtv_8Rw.js} +1 -1
  11. package/dist/react/{EmailsSection-ndH3cvJk.js → EmailsSection-CM7stSyh.js} +1 -1
  12. package/dist/react/{EmailsTab-DVPHRx0L.js → EmailsTab-BDhEiomM.js} +1 -1
  13. package/dist/react/{EventsSection-ClIByDSk.js → EventsSection-ByQ-9blq.js} +1 -1
  14. package/dist/react/{EventsTab-CCzWEKrk.js → EventsTab-CMfY98Rl.js} +1 -1
  15. package/dist/react/{JobsSection-CVMyAs7O.js → JobsSection-DF3qEv9O.js} +1 -1
  16. package/dist/react/{JobsTab-CATUyb9V.js → JobsTab-BbrBWIOb.js} +1 -1
  17. package/dist/react/LogsSection-DcFTZY7b.js +227 -0
  18. package/dist/react/LogsTab-CicucmVk.js +103 -0
  19. package/dist/react/{OverviewSection-ae5AO2RG.js → OverviewSection-C4T1ur51.js} +1 -1
  20. package/dist/react/{QueriesSection-DFFr9Tbb.js → QueriesSection-PswteoF9.js} +1 -1
  21. package/dist/react/{QueriesTab-GrHRAREt.js → QueriesTab-osLUWd4L.js} +1 -1
  22. package/dist/react/RelatedLogs-DFDOyUMr.js +40 -0
  23. package/dist/react/RequestsSection-Nag30rEA.js +341 -0
  24. package/dist/react/{RoutesSection-F7nANhF0.js → RoutesSection-BUSkM6PY.js} +1 -1
  25. package/dist/react/{RoutesTab-rugjhCPH.js → RoutesTab-DgVzd2PZ.js} +1 -1
  26. package/dist/react/TimelineTab-Covg5weo.js +220 -0
  27. package/dist/react/{index-DDzo1bZk.js → index-Cflz9Ebj.js} +390 -395
  28. package/dist/react/index.js +1 -1
  29. package/dist/react/react/components/shared/JsonViewer.d.ts +2 -1
  30. package/dist/react/react/components/shared/RelatedLogs.d.ts +7 -0
  31. package/dist/react/style.css +1 -1
  32. package/dist/src/controller/debug_controller.js +1 -1
  33. package/dist/src/dashboard/dashboard_controller.js +13 -0
  34. package/dist/src/dashboard/dashboard_store.d.ts +1 -0
  35. package/dist/src/dashboard/dashboard_store.js +88 -41
  36. package/dist/src/dashboard/migrator.js +6 -0
  37. package/dist/src/data/data_access.d.ts +7 -0
  38. package/dist/src/data/data_access.js +32 -1
  39. package/dist/src/debug/trace_collector.d.ts +1 -1
  40. package/dist/src/debug/trace_collector.js +2 -1
  41. package/dist/src/debug/types.d.ts +4 -0
  42. package/dist/src/edge/client/dashboard.js +2 -2
  43. package/dist/src/edge/client/debug-panel-deferred.js +1 -1
  44. package/dist/src/edge/client-vue/dashboard.js +4 -4
  45. package/dist/src/edge/client-vue/debug-panel-deferred.js +3 -3
  46. package/dist/src/middleware/request_tracking_middleware.d.ts +1 -0
  47. package/dist/src/middleware/request_tracking_middleware.js +3 -1
  48. package/dist/src/provider/server_stats_provider.d.ts +3 -3
  49. package/dist/src/provider/server_stats_provider.js +29 -15
  50. package/dist/src/routes/register_routes.js +7 -2
  51. package/dist/src/styles/components.css +162 -0
  52. package/dist/src/styles/debug-panel.css +9 -0
  53. package/dist/src/types.d.ts +1 -1
  54. package/dist/vue/{CacheSection-DDvJ7bs2.js → CacheSection-oFAJL3mo.js} +2 -2
  55. package/dist/vue/{ConfigSection-GTCrvsPr.js → ConfigSection-BhfJ4KqL.js} +1 -1
  56. package/dist/vue/{EmailsSection-Ct5vsLCc.js → EmailsSection-BcNyhyHs.js} +1 -1
  57. package/dist/vue/{EventsSection-CRVhtagq.js → EventsSection-r60Q5Lmu.js} +2 -2
  58. package/dist/vue/{EventsTab-DQ4Nd6AK.js → EventsTab-BBM7olXF.js} +1 -1
  59. package/dist/vue/{JobsSection-B_wH2Co7.js → JobsSection-BHL-hkQw.js} +2 -2
  60. package/dist/vue/{JobsTab-BCvhOARO.js → JobsTab-WFnxPdN7.js} +1 -1
  61. package/dist/vue/{JsonViewer.vue_vue_type_script_setup_true_lang-Vsqar1zx.js → JsonViewer.vue_vue_type_script_setup_true_lang-Bid05zpm.js} +25 -23
  62. package/dist/vue/LogsSection-DRMGzJmg.js +252 -0
  63. package/dist/vue/LogsTab-Bg3o0Mm6.js +147 -0
  64. package/dist/vue/{OverviewSection-BqSwuMKH.js → OverviewSection-CXh6Ja1B.js} +1 -1
  65. package/dist/vue/{QueriesSection-D4Fs0YH6.js → QueriesSection-IodIsCJ-.js} +1 -1
  66. package/dist/vue/RelatedLogs.vue_vue_type_script_setup_true_lang-CB2_TzYW.js +84 -0
  67. package/dist/vue/RequestsSection-BPuMdmMc.js +401 -0
  68. package/dist/vue/{RoutesSection-Ys5dTzvF.js → RoutesSection-NKo3Rbq3.js} +1 -1
  69. package/dist/vue/TimelineTab-zj5Z5OdT.js +338 -0
  70. package/dist/vue/components/Dashboard/sections/RequestsSection.vue.d.ts +4 -0
  71. package/dist/vue/components/DebugPanel/tabs/TimelineTab.vue.d.ts +4 -0
  72. package/dist/vue/components/shared/JsonViewer.vue.d.ts +3 -0
  73. package/dist/vue/components/{Dashboard/sections/TimelineSection.vue.d.ts → shared/RelatedLogs.vue.d.ts} +5 -6
  74. package/dist/vue/index-Dtgysd26.js +1229 -0
  75. package/dist/vue/index.js +1 -1
  76. package/dist/vue/style.css +1 -1
  77. package/package.json +1 -1
  78. package/dist/react/LogsSection-hAsLaKOC.js +0 -212
  79. package/dist/react/LogsTab-QouH4NPQ.js +0 -88
  80. package/dist/react/RequestsSection-DtwnJOnM.js +0 -209
  81. package/dist/react/TimelineSection-F5ThmTdy.js +0 -158
  82. package/dist/react/TimelineTab-Dvpf-I5C.js +0 -193
  83. package/dist/react/WaterfallChart-Cj73WdfM.js +0 -100
  84. package/dist/react/react/components/Dashboard/sections/TimelineSection.d.ts +0 -8
  85. package/dist/vue/LogsSection-C4NRFOpA.js +0 -227
  86. package/dist/vue/LogsTab-DpEQ7euu.js +0 -122
  87. package/dist/vue/RequestsSection-B0A5SKcM.js +0 -243
  88. package/dist/vue/TimelineSection-D38iHB08.js +0 -186
  89. package/dist/vue/TimelineTab-Db6lKKsD.js +0 -250
  90. package/dist/vue/WaterfallChart.vue_vue_type_script_setup_true_lang-tZ13cNj1.js +0 -118
  91. package/dist/vue/index-Bj6pm5g3.js +0 -1235
@@ -0,0 +1,103 @@
1
+ import { jsx as s, jsxs as a } from "react/jsx-runtime";
2
+ import I, { useState as m, useMemo as E, useCallback as F } from "react";
3
+ import { filterLogsByLevel as D, resolveLogRequestId as y, resolveLogMessage as N, LOG_LEVELS as R, resolveLogLevel as S, resolveLogTimestamp as $, getStructuredData as A, getLogLevelCssClass as P, timeAgo as T, formatTime as j } from "adonisjs-server-stats/core";
4
+ import { u as J, J as M } from "./index-Cflz9Ebj.js";
5
+ function O({ options: x }) {
6
+ const { data: l, isLoading: C, error: h } = J("logs", x), [p, w] = m("all"), [d, k] = m(""), [n, f] = m(""), [u, q] = m(null), b = E(() => {
7
+ let e = Array.isArray(l) ? l : l?.logs || l?.entries || [];
8
+ if (e = D(e, p), n) {
9
+ const t = n.toLowerCase();
10
+ e = e.filter((r) => y(r).toLowerCase().includes(t));
11
+ }
12
+ if (d) {
13
+ const t = d.toLowerCase();
14
+ e = e.filter((r) => N(r).toLowerCase().includes(t));
15
+ }
16
+ return e;
17
+ }, [l, p, d, n]), v = F((e) => {
18
+ f((t) => t === e ? "" : e);
19
+ }, []);
20
+ return C && !l ? /* @__PURE__ */ s("div", { className: "ss-dbg-empty", children: "Loading logs..." }) : h ? /* @__PURE__ */ a("div", { className: "ss-dbg-empty", children: [
21
+ "Error: ",
22
+ h.message
23
+ ] }) : /* @__PURE__ */ a("div", { children: [
24
+ /* @__PURE__ */ a("div", { className: "ss-dbg-log-filters", children: [
25
+ R.map((e) => /* @__PURE__ */ s(
26
+ "button",
27
+ {
28
+ type: "button",
29
+ className: `ss-dbg-log-filter ${p === e ? "ss-dbg-active" : ""}`,
30
+ onClick: () => w(e),
31
+ children: e
32
+ },
33
+ e
34
+ )),
35
+ n && /* @__PURE__ */ a(
36
+ "button",
37
+ {
38
+ type: "button",
39
+ className: "ss-dbg-log-filter ss-dbg-active",
40
+ onClick: () => f(""),
41
+ children: [
42
+ "req: ",
43
+ n.slice(0, 8),
44
+ " x"
45
+ ]
46
+ }
47
+ ),
48
+ /* @__PURE__ */ a("span", { className: "ss-dbg-summary", style: { marginLeft: "auto" }, children: [
49
+ b.length,
50
+ " entries"
51
+ ] })
52
+ ] }),
53
+ /* @__PURE__ */ s("div", { className: "ss-dbg-search-bar", children: /* @__PURE__ */ s(
54
+ "input",
55
+ {
56
+ type: "text",
57
+ className: "ss-dbg-search",
58
+ placeholder: "Filter log messages...",
59
+ value: d,
60
+ onChange: (e) => k(e.target.value)
61
+ }
62
+ ) }),
63
+ /* @__PURE__ */ s("div", { style: { overflow: "auto", flex: 1 }, children: b.length === 0 ? /* @__PURE__ */ s("div", { className: "ss-dbg-empty", children: "No log entries" }) : b.slice(0, 200).map((e, t) => {
64
+ const r = S(e), L = N(e), c = $(e), o = y(e), i = A(e);
65
+ return /* @__PURE__ */ a(I.Fragment, { children: [
66
+ /* @__PURE__ */ a(
67
+ "div",
68
+ {
69
+ className: `ss-dbg-log-entry${i ? " ss-dbg-log-entry-expandable" : ""}`,
70
+ onClick: () => i && q(u === t ? null : t),
71
+ children: [
72
+ /* @__PURE__ */ s("span", { className: `ss-dbg-log-level ${P(r)}`, children: r.toUpperCase() }),
73
+ /* @__PURE__ */ s("span", { className: "ss-dbg-log-time", title: c ? j(c) : "", children: c ? T(c) : "-" }),
74
+ o ? /* @__PURE__ */ s(
75
+ "span",
76
+ {
77
+ className: "ss-dbg-log-reqid",
78
+ onClick: (g) => {
79
+ g.stopPropagation(), v(o);
80
+ },
81
+ role: "button",
82
+ tabIndex: 0,
83
+ title: o,
84
+ onKeyDown: (g) => {
85
+ g.key === "Enter" && (g.stopPropagation(), v(o));
86
+ },
87
+ children: o.slice(0, 8)
88
+ }
89
+ ) : /* @__PURE__ */ s("span", { className: "ss-dbg-log-reqid-empty", children: "-" }),
90
+ i ? /* @__PURE__ */ s("span", { className: `ss-dbg-log-expand-icon${u === t ? " ss-dbg-log-expand-icon-open" : ""}`, children: "▶" }) : /* @__PURE__ */ s("span", { style: { width: 14 } }),
91
+ /* @__PURE__ */ s("span", { className: "ss-dbg-log-msg", children: L })
92
+ ]
93
+ }
94
+ ),
95
+ u === t && i && /* @__PURE__ */ s("div", { className: "ss-dbg-log-detail", children: /* @__PURE__ */ s(M, { data: i, classPrefix: "ss-dbg", defaultExpanded: !0 }) })
96
+ ] }, t);
97
+ }) })
98
+ ] });
99
+ }
100
+ export {
101
+ O as LogsTab,
102
+ O as default
103
+ };
@@ -1,7 +1,7 @@
1
1
  import { jsx as s, jsxs as e } from "react/jsx-runtime";
2
2
  import { useState as E, useRef as X, useEffect as P, useCallback as z } from "react";
3
3
  import { formatDuration as $, timeAgo as ss, formatTime as es, durationSeverity as as } from "adonisjs-server-stats/core";
4
- import { a as B, S } from "./index-DDzo1bZk.js";
4
+ import { a as B, S } from "./index-Cflz9Ebj.js";
5
5
  const ls = [
6
6
  { value: "5m", label: "5m" },
7
7
  { value: "15m", label: "15m" },
@@ -1,7 +1,7 @@
1
1
  import { jsx as t, jsxs as r, Fragment as b } from "react/jsx-runtime";
2
2
  import { useState as y, useCallback as $, useEffect as V, useMemo as P } from "react";
3
3
  import { durationSeverity as _, timeAgo as B, formatTime as G, SLOW_DURATION_MS as X } from "adonisjs-server-stats/core";
4
- import { a as Y } from "./index-DDzo1bZk.js";
4
+ import { a as Y } from "./index-Cflz9Ebj.js";
5
5
  import { D as I } from "./DataTable-YyShr5B-.js";
6
6
  import { F as Z } from "./FilterBar-DQRXpWrb.js";
7
7
  import { P as ee } from "./Pagination-BkmzUDY8.js";
@@ -1,7 +1,7 @@
1
1
  import { jsx as e, jsxs as t } from "react/jsx-runtime";
2
2
  import { useState as m, useMemo as i, useCallback as v } from "react";
3
3
  import { filterQueries as C, countDuplicateQueries as D, computeQuerySummary as S, formatDuration as p, durationSeverity as g, timeAgo as Q, formatTime as T } from "adonisjs-server-stats/core";
4
- import { u as $ } from "./index-DDzo1bZk.js";
4
+ import { u as $ } from "./index-Cflz9Ebj.js";
5
5
  import { u as E } from "./useResizableTable-CNJmACdt.js";
6
6
  function R({ options: b }) {
7
7
  const { data: n, isLoading: y, error: u } = $("queries", b), [o, N] = m(""), [w, x] = m(null), d = i(() => n?.queries || [], [n]), a = i(() => C(d, o), [d, o]), l = i(() => D(d), [d]), r = i(
@@ -0,0 +1,40 @@
1
+ import { jsxs as o, jsx as t } from "react/jsx-runtime";
2
+ import g, { useState as h } from "react";
3
+ import { resolveLogLevel as u, resolveLogMessage as $, resolveLogRequestId as v, resolveLogTimestamp as N, getStructuredData as L, getLogLevelCssClass as y, timeAgo as R, formatTime as q } from "adonisjs-server-stats/core";
4
+ import { J as C } from "./index-Cflz9Ebj.js";
5
+ function J({ logs: s, classPrefix: e = "ss-dash" }) {
6
+ const [r, p] = h(null);
7
+ return s.length === 0 ? null : /* @__PURE__ */ o("div", { children: [
8
+ /* @__PURE__ */ o("div", { className: `${e}-related-logs-title`, children: [
9
+ "Related Logs",
10
+ /* @__PURE__ */ o("span", { className: `${e}-related-logs-count`, children: [
11
+ "(",
12
+ s.length,
13
+ ")"
14
+ ] })
15
+ ] }),
16
+ /* @__PURE__ */ t("div", { className: `${e}-log-entries`, style: { overflow: "auto" }, children: s.map((n, l) => {
17
+ const c = u(n), i = $(n), m = v(n), d = N(n), a = L(n);
18
+ return /* @__PURE__ */ o(g.Fragment, { children: [
19
+ /* @__PURE__ */ o(
20
+ "div",
21
+ {
22
+ className: `${e}-log-entry${a ? ` ${e}-log-entry-expandable` : ""}`,
23
+ onClick: () => a && p(r === l ? null : l),
24
+ children: [
25
+ /* @__PURE__ */ t("span", { className: `${e}-log-level ${y(c, `${e}-log-level`)}`, children: c.toUpperCase() }),
26
+ /* @__PURE__ */ t("span", { className: `${e}-log-time`, title: d ? q(d) : "", children: d ? R(d) : "-" }),
27
+ m ? /* @__PURE__ */ t("span", { className: `${e}-log-reqid`, title: m, children: m.slice(0, 8) }) : /* @__PURE__ */ t("span", { className: `${e}-log-reqid-empty`, children: "--" }),
28
+ a ? /* @__PURE__ */ t("span", { className: `${e}-log-expand-icon${r === l ? ` ${e}-log-expand-icon-open` : ""}`, children: "▶" }) : /* @__PURE__ */ t("span", { style: { width: 14 } }),
29
+ /* @__PURE__ */ t("span", { className: `${e}-log-msg`, children: i })
30
+ ]
31
+ }
32
+ ),
33
+ r === l && a && /* @__PURE__ */ t("div", { className: `${e}-log-detail`, children: /* @__PURE__ */ t(C, { data: a, classPrefix: e, defaultExpanded: !0 }) })
34
+ ] }, n.id || l);
35
+ }) })
36
+ ] });
37
+ }
38
+ export {
39
+ J as R
40
+ };
@@ -0,0 +1,341 @@
1
+ import { jsx as t, jsxs as r, Fragment as j } from "react/jsx-runtime";
2
+ import { useMemo as q, useState as f, useEffect as M, useCallback as L, useRef as C } from "react";
3
+ import { normalizeTraceFields as z, durationSeverity as _, timeAgo as W, formatTime as G, initSplitPane as I } from "adonisjs-server-stats/core";
4
+ import { u as U } from "./useApiClient-BVtNCmnL.js";
5
+ import { a as Y, M as D, b as A } from "./index-Cflz9Ebj.js";
6
+ import { R as V } from "./RelatedLogs-DFDOyUMr.js";
7
+ import { D as H } from "./DataTable-YyShr5B-.js";
8
+ import { F as J } from "./FilterBar-DQRXpWrb.js";
9
+ import { P as K } from "./Pagination-BkmzUDY8.js";
10
+ const F = {
11
+ request: "#1e3a5f",
12
+ middleware: "rgba(30, 58, 95, 0.7)",
13
+ db: "#6d28d9",
14
+ view: "#0e7490",
15
+ mail: "#059669",
16
+ event: "#b45309",
17
+ custom: "var(--ss-dim)"
18
+ }, Q = {
19
+ request: "Request",
20
+ middleware: "Middleware",
21
+ db: "DB",
22
+ mail: "Mail",
23
+ event: "Event",
24
+ view: "View",
25
+ custom: "Custom"
26
+ };
27
+ function O({
28
+ spans: c,
29
+ totalDuration: i,
30
+ className: m = "",
31
+ warnings: d
32
+ }) {
33
+ const h = c || [], o = q(
34
+ () => [...h].sort((e, n) => e.startOffset - n.startOffset),
35
+ [h]
36
+ ), p = q(() => {
37
+ const e = {};
38
+ for (const n of o)
39
+ e[n.id] = n.parentId ? (e[n.parentId] || 0) + 1 : 0;
40
+ return e;
41
+ }, [o]);
42
+ return h.length === 0 ? /* @__PURE__ */ t("div", { className: "ss-dash-empty", children: "No spans recorded" }) : /* @__PURE__ */ r("div", { className: `ss-dash-tl-waterfall ${m}`, children: [
43
+ /* @__PURE__ */ t("div", { className: "ss-dash-tl-legend", children: Object.entries(Q).map(([e, n]) => /* @__PURE__ */ r("div", { className: "ss-dash-tl-legend-item", children: [
44
+ /* @__PURE__ */ t(
45
+ "span",
46
+ {
47
+ className: "ss-dash-tl-legend-dot",
48
+ style: {
49
+ background: F[e] || F.custom
50
+ }
51
+ }
52
+ ),
53
+ /* @__PURE__ */ t("span", { children: n })
54
+ ] }, e)) }),
55
+ o.map((e) => {
56
+ const n = i > 0 ? e.startOffset / i * 100 : 0, y = i > 0 ? Math.max(e.duration / i * 100, 0.5) : 1, v = p[e.id] || 0, S = e.label.length > 50 ? e.label.slice(0, 50) + "..." : e.label, g = e.category === "db" ? "DB" : e.category, N = e.category === "db" ? "purple" : e.category === "mail" ? "green" : e.category === "event" ? "amber" : e.category === "view" ? "blue" : "muted", u = e.metadata ? Object.entries(e.metadata).filter(([, b]) => b != null).map(([b, x]) => `${b}=${x}`).join(", ") : "", w = u ? `${e.label} (${e.duration.toFixed(2)}ms)
57
+ ${u}` : `${e.label} (${e.duration.toFixed(2)}ms)`;
58
+ return /* @__PURE__ */ r("div", { className: "ss-dash-tl-row", children: [
59
+ /* @__PURE__ */ r(
60
+ "div",
61
+ {
62
+ className: "ss-dash-tl-label",
63
+ title: w,
64
+ style: { paddingLeft: 8 + v * 16 + "px" },
65
+ children: [
66
+ /* @__PURE__ */ t(
67
+ "span",
68
+ {
69
+ className: `ss-dash-badge ss-dash-badge-${N}`,
70
+ style: { fontSize: "9px", marginRight: "4px" },
71
+ children: g
72
+ }
73
+ ),
74
+ S
75
+ ]
76
+ }
77
+ ),
78
+ /* @__PURE__ */ t("div", { className: "ss-dash-tl-track", children: /* @__PURE__ */ t(
79
+ "div",
80
+ {
81
+ className: `ss-dash-tl-bar ss-dash-tl-bar-${e.category || "custom"}`,
82
+ style: {
83
+ left: `${n}%`,
84
+ width: `${y}%`
85
+ },
86
+ title: w
87
+ }
88
+ ) }),
89
+ /* @__PURE__ */ r("span", { className: "ss-dash-tl-dur", children: [
90
+ e.duration.toFixed(2),
91
+ "ms"
92
+ ] })
93
+ ] }, e.id);
94
+ }),
95
+ d && d.length > 0 && /* @__PURE__ */ r("div", { className: "ss-dash-tl-warnings", children: [
96
+ /* @__PURE__ */ r("div", { className: "ss-dash-tl-warnings-title", children: [
97
+ "Warnings (",
98
+ d.length,
99
+ ")"
100
+ ] }),
101
+ d.map((e, n) => /* @__PURE__ */ t("div", { className: "ss-dash-tl-warning", children: e }, n))
102
+ ] })
103
+ ] });
104
+ }
105
+ function X({
106
+ children: c,
107
+ classPrefix: i = "ss-dash",
108
+ storageKey: m
109
+ }) {
110
+ const d = C(null), h = C(null), o = C(null), p = C(null);
111
+ return M(() => {
112
+ if (d.current && h.current && o.current && p.current)
113
+ return I({
114
+ container: d.current,
115
+ handle: h.current,
116
+ topPane: o.current,
117
+ bottomPane: p.current,
118
+ storageKey: m
119
+ });
120
+ }, [m]), /* @__PURE__ */ r("div", { ref: d, className: `${i}-split-container`, children: [
121
+ /* @__PURE__ */ t("div", { ref: o, className: `${i}-split-top`, children: c[0] }),
122
+ /* @__PURE__ */ t("div", { ref: h, className: `${i}-split-handle` }),
123
+ /* @__PURE__ */ t("div", { ref: p, className: `${i}-split-bottom`, children: c[1] })
124
+ ] });
125
+ }
126
+ function oe({ options: c = {} }) {
127
+ const [i, m] = f(1), [d, h] = f(""), [o, p] = f("createdAt"), [e, n] = f("desc"), [y, v] = f(null), [S, g] = f(!1);
128
+ M(() => m(1), [d]);
129
+ const { data: N, meta: u, isLoading: w, error: b } = Y("requests", {
130
+ ...c,
131
+ page: i,
132
+ search: d,
133
+ sort: o,
134
+ sortDir: e
135
+ }), x = U(c.baseUrl || "", c.authToken), P = L(
136
+ (s) => {
137
+ const a = s.id;
138
+ g(!0);
139
+ const l = c.dashboardEndpoint || "/__stats/api";
140
+ x().fetch(`${l}/requests/${a}`).then((k) => {
141
+ const $ = k, R = $.trace;
142
+ if (R) {
143
+ const E = { ...$, ...R, logs: $.logs };
144
+ v(E);
145
+ } else
146
+ v(k);
147
+ g(!1);
148
+ }).catch(() => {
149
+ g(!1);
150
+ });
151
+ },
152
+ [x, c.dashboardEndpoint]
153
+ ), T = L(
154
+ (s) => {
155
+ o === s ? n((a) => a === "asc" ? "desc" : "asc") : (p(s), n("desc"));
156
+ },
157
+ [o]
158
+ ), B = N || [];
159
+ if (y) {
160
+ const s = z(y), a = s.logs.length > 0;
161
+ return /* @__PURE__ */ r("div", { children: [
162
+ /* @__PURE__ */ r("div", { className: "ss-dash-tl-detail-header", children: [
163
+ /* @__PURE__ */ t("button", { type: "button", className: "ss-dash-btn", onClick: () => v(null), children: "← Back to Requests" }),
164
+ /* @__PURE__ */ t(D, { method: s.method }),
165
+ /* @__PURE__ */ t("span", { style: { color: "var(--ss-text)" }, children: s.url }),
166
+ /* @__PURE__ */ t(A, { code: s.statusCode }),
167
+ /* @__PURE__ */ r("span", { className: "ss-dash-tl-meta", children: [
168
+ s.totalDuration.toFixed(1),
169
+ "ms · ",
170
+ s.spanCount,
171
+ " spans"
172
+ ] })
173
+ ] }),
174
+ a ? /* @__PURE__ */ r(X, { classPrefix: "ss-dash", storageKey: "ss-requests-split", children: [
175
+ /* @__PURE__ */ t(
176
+ O,
177
+ {
178
+ spans: s.spans,
179
+ totalDuration: s.totalDuration,
180
+ warnings: s.warnings
181
+ }
182
+ ),
183
+ /* @__PURE__ */ t(V, { logs: s.logs, classPrefix: "ss-dash" })
184
+ ] }) : /* @__PURE__ */ t(
185
+ O,
186
+ {
187
+ spans: s.spans,
188
+ totalDuration: s.totalDuration,
189
+ warnings: s.warnings
190
+ }
191
+ )
192
+ ] });
193
+ }
194
+ return S ? /* @__PURE__ */ r("div", { children: [
195
+ /* @__PURE__ */ t("div", { className: "ss-dash-tl-detail-header", children: /* @__PURE__ */ t("button", { type: "button", className: "ss-dash-btn", onClick: () => g(!1), children: "← Back to Requests" }) }),
196
+ /* @__PURE__ */ t("div", { className: "ss-dash-empty", children: "Loading request detail..." })
197
+ ] }) : /* @__PURE__ */ r("div", { children: [
198
+ /* @__PURE__ */ t(
199
+ J,
200
+ {
201
+ search: d,
202
+ onSearchChange: h,
203
+ placeholder: "Filter requests...",
204
+ summary: `${u?.total ?? 0} requests`
205
+ }
206
+ ),
207
+ b && /* @__PURE__ */ t("div", { className: "ss-dash-empty", children: "Failed to load requests" }),
208
+ w && !N ? /* @__PURE__ */ t("div", { className: "ss-dash-empty", children: "Loading requests..." }) : /* @__PURE__ */ r(j, { children: [
209
+ /* @__PURE__ */ t("div", { className: "ss-dash-table-wrap", children: /* @__PURE__ */ t(
210
+ H,
211
+ {
212
+ columns: [
213
+ {
214
+ key: "id",
215
+ label: "#",
216
+ width: "40px",
217
+ render: (s) => /* @__PURE__ */ t("span", { style: { color: "var(--ss-dim)" }, children: s })
218
+ },
219
+ {
220
+ key: "method",
221
+ label: "Method",
222
+ width: "70px",
223
+ sortable: !0,
224
+ render: (s) => /* @__PURE__ */ t(D, { method: s })
225
+ },
226
+ {
227
+ key: "url",
228
+ label: "URL",
229
+ sortable: !0,
230
+ render: (s) => /* @__PURE__ */ t(
231
+ "span",
232
+ {
233
+ style: {
234
+ color: "var(--ss-text)",
235
+ overflow: "hidden",
236
+ textOverflow: "ellipsis",
237
+ whiteSpace: "nowrap"
238
+ },
239
+ title: s,
240
+ children: s
241
+ }
242
+ )
243
+ },
244
+ {
245
+ key: "statusCode",
246
+ label: "Status",
247
+ width: "60px",
248
+ sortable: !0,
249
+ render: (s, a) => {
250
+ const l = a.status_code || a.statusCode || a.statusCode;
251
+ return /* @__PURE__ */ t(A, { code: l });
252
+ }
253
+ },
254
+ {
255
+ key: "duration",
256
+ label: "Duration",
257
+ width: "80px",
258
+ sortable: !0,
259
+ render: (s, a) => {
260
+ const l = a.total_duration || a.totalDuration || a.duration || 0;
261
+ return /* @__PURE__ */ r(
262
+ "span",
263
+ {
264
+ className: `ss-dash-duration ${_(l) === "very-slow" ? "ss-dash-very-slow" : _(l) === "slow" ? "ss-dash-slow" : ""}`,
265
+ children: [
266
+ l.toFixed(1),
267
+ "ms"
268
+ ]
269
+ }
270
+ );
271
+ }
272
+ },
273
+ {
274
+ key: "spanCount",
275
+ label: "Spans",
276
+ width: "50px",
277
+ render: (s, a) => {
278
+ const l = a.span_count || a.spanCount || 0;
279
+ return /* @__PURE__ */ t("span", { style: { color: "var(--ss-muted)", textAlign: "center" }, children: l });
280
+ }
281
+ },
282
+ {
283
+ key: "warningCount",
284
+ label: "⚠",
285
+ width: "40px",
286
+ render: (s, a) => {
287
+ const l = a.warning_count || a.warningCount || 0;
288
+ return l > 0 ? /* @__PURE__ */ t(
289
+ "span",
290
+ {
291
+ style: {
292
+ color: "var(--ss-amber-fg)",
293
+ textAlign: "center",
294
+ display: "block"
295
+ },
296
+ children: l
297
+ }
298
+ ) : /* @__PURE__ */ t(
299
+ "span",
300
+ {
301
+ style: { color: "var(--ss-dim)", textAlign: "center", display: "block" },
302
+ children: "-"
303
+ }
304
+ );
305
+ }
306
+ },
307
+ {
308
+ key: "createdAt",
309
+ label: "Time",
310
+ width: "80px",
311
+ sortable: !0,
312
+ render: (s, a) => {
313
+ const l = a.createdAt || a.created_at || a.timestamp || "";
314
+ return /* @__PURE__ */ t("span", { className: "ss-dash-event-time", title: G(l), children: W(l) });
315
+ }
316
+ }
317
+ ],
318
+ data: B,
319
+ sort: o,
320
+ sortDir: e,
321
+ onSort: T,
322
+ onRowClick: P,
323
+ emptyMessage: "No requests recorded yet"
324
+ }
325
+ ) }),
326
+ u && /* @__PURE__ */ t(
327
+ K,
328
+ {
329
+ page: u.page,
330
+ lastPage: u.lastPage,
331
+ total: u.total,
332
+ onPageChange: m
333
+ }
334
+ )
335
+ ] })
336
+ ] });
337
+ }
338
+ export {
339
+ oe as RequestsSection,
340
+ oe as default
341
+ };
@@ -1,6 +1,6 @@
1
1
  import { jsxs as m, jsx as r, Fragment as p } from "react/jsx-runtime";
2
2
  import { useState as y } from "react";
3
- import { a as u, M as f } from "./index-DDzo1bZk.js";
3
+ import { a as u, M as f } from "./index-Cflz9Ebj.js";
4
4
  import { D as w } from "./DataTable-YyShr5B-.js";
5
5
  import { F as b } from "./FilterBar-DQRXpWrb.js";
6
6
  function A({ options: n = {} }) {
@@ -1,6 +1,6 @@
1
1
  import { jsx as e, jsxs as t } from "react/jsx-runtime";
2
2
  import { useState as u, useMemo as p } from "react";
3
- import { u as b } from "./index-DDzo1bZk.js";
3
+ import { u as b } from "./index-Cflz9Ebj.js";
4
4
  import { u as w } from "./useResizableTable-CNJmACdt.js";
5
5
  function C({ options: o, currentPath: n }) {
6
6
  const { data: c, isLoading: h, error: i } = b("routes", o), [r, m] = u(""), l = p(() => {