adonisjs-server-stats 1.10.3 → 1.11.1

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 (89) hide show
  1. package/dist/core/field-resolvers.d.ts +64 -0
  2. package/dist/core/formatters.d.ts +15 -0
  3. package/dist/core/index.d.ts +1 -1
  4. package/dist/core/index.js +208 -203
  5. package/dist/react/CacheSection-BYN53kYO.js +135 -0
  6. package/dist/react/CacheStatsBar-CRodCOeP.js +27 -0
  7. package/dist/react/CacheTab-DOhuK05d.js +106 -0
  8. package/dist/react/{ConfigSection-DGgqjAal.js → ConfigSection-B9EHh4Rp.js} +1 -1
  9. package/dist/react/{ConfigTab-H3OnYqmK.js → ConfigTab-C8kriE2b.js} +1 -1
  10. package/dist/react/CustomPaneTab-CvzQS_Wh.js +99 -0
  11. package/dist/react/EmailPreviewOverlay-BmXOAvqG.js +58 -0
  12. package/dist/react/EmailsSection-BJyFJf7A.js +226 -0
  13. package/dist/react/EmailsTab-Ch8jp10B.js +110 -0
  14. package/dist/react/{EventsSection-C7RQW_LY.js → EventsSection-DJPwHeT8.js} +27 -26
  15. package/dist/react/EventsTab-B-FoehXC.js +58 -0
  16. package/dist/react/{InternalsContent-DBzsI0CG.js → InternalsContent-O8ino9oM.js} +133 -109
  17. package/dist/react/InternalsSection-B6VlVx5f.js +22 -0
  18. package/dist/react/InternalsTab-CkEKpRMU.js +17 -0
  19. package/dist/react/JobStatsBar-C7RslAFE.js +30 -0
  20. package/dist/react/JobsSection-DWF4i1t_.js +167 -0
  21. package/dist/react/JobsTab-DqnifQXV.js +129 -0
  22. package/dist/react/LogEntryRow-CMMkqA9M.js +43 -0
  23. package/dist/react/LogsSection-C1xC5aP4.js +198 -0
  24. package/dist/react/LogsTab-CS4sLfLw.js +79 -0
  25. package/dist/react/{OverviewSection-ABP9ueBo.js → OverviewSection-CxvfOR0v.js} +70 -80
  26. package/dist/react/QueriesSection-CrMdU5Ax.js +458 -0
  27. package/dist/react/{QueriesTab-BQzcxEiW.js → QueriesTab-x85PjkyS.js} +22 -21
  28. package/dist/react/RequestsSection-DETN9oZb.js +321 -0
  29. package/dist/react/{RoutesSection-BRhxrtjZ.js → RoutesSection-CmorkJeC.js} +1 -1
  30. package/dist/react/{RoutesTab-CpYH5lUw.js → RoutesTab-CbzBOzpc.js} +12 -12
  31. package/dist/react/SplitPaneWrapper-BiIgT4ND.js +49 -0
  32. package/dist/react/TimeAgoCell-o3KigGfM.js +8 -0
  33. package/dist/react/{TimelineTab-DjLR35Ce.js → TimelineTab-Ue9tUD_n.js} +71 -91
  34. package/dist/react/{index-CsImORX6.js → index-DwDK-4oX.js} +4 -4
  35. package/dist/react/index.js +6 -6
  36. package/dist/react/react/components/shared/CacheStatsBar.d.ts +13 -0
  37. package/dist/react/react/components/shared/EmailPreviewOverlay.d.ts +29 -0
  38. package/dist/react/react/components/shared/JobStatsBar.d.ts +12 -0
  39. package/dist/react/react/components/shared/LogEntryRow.d.ts +9 -0
  40. package/dist/react/react/components/shared/RelatedLogs.d.ts +2 -2
  41. package/dist/react/react/components/shared/SplitPaneWrapper.d.ts +7 -0
  42. package/dist/react/react/components/shared/TimeAgoCell.d.ts +17 -0
  43. package/dist/react/react/hooks/useDiagnosticsData.d.ts +14 -0
  44. package/dist/react/style.css +1 -1
  45. package/dist/src/edge/client/dashboard.js +2 -2
  46. package/dist/src/edge/client/debug-panel-deferred.js +1 -1
  47. package/dist/src/edge/client-vue/dashboard.js +3 -3
  48. package/dist/src/edge/client-vue/debug-panel-deferred.js +4 -4
  49. package/dist/src/styles/components.css +67 -0
  50. package/dist/src/styles/dashboard.css +5 -15
  51. package/dist/src/styles/debug-panel.css +1 -22
  52. package/dist/src/styles/utilities.css +3 -1
  53. package/dist/vue/{CacheSection-ITqvpfH5.js → CacheSection-DT2Mwf_s.js} +1 -1
  54. package/dist/vue/{ConfigSection-DTn3GslE.js → ConfigSection-BwKwS9lh.js} +1 -1
  55. package/dist/vue/CustomPaneTab-Hr1IBHfz.js +172 -0
  56. package/dist/vue/{EmailsSection-DtLJ4XoS.js → EmailsSection-B65g0FVS.js} +1 -1
  57. package/dist/vue/{EventsSection-BOYYz0Ty.js → EventsSection-CxqtVF-o.js} +1 -1
  58. package/dist/vue/{JobsSection-BazTxcJL.js → JobsSection-rMIyMb-g.js} +1 -1
  59. package/dist/vue/{LogsSection-D55PjTKX.js → LogsSection-DmmZVJ7D.js} +1 -1
  60. package/dist/vue/{OverviewSection-1uBKo-Tu.js → OverviewSection-BMabyqw-.js} +49 -50
  61. package/dist/vue/{QueriesSection-rpoZ4ogd.js → QueriesSection-BfDFwGqH.js} +44 -45
  62. package/dist/vue/{QueriesTab-C8_7oprC.js → QueriesTab-DuTG7cpC.js} +30 -31
  63. package/dist/vue/RelatedLogs.vue_vue_type_script_setup_true_lang-Py1iu9GU.js +77 -0
  64. package/dist/vue/{RequestsSection-x7LvT0MC.js → RequestsSection-CTu4jPZ_.js} +143 -147
  65. package/dist/vue/{RoutesSection-CCD0zZqQ.js → RoutesSection-zQZDedL7.js} +1 -1
  66. package/dist/vue/TimelineTab-DHfXsX7t.js +334 -0
  67. package/dist/vue/components/shared/RelatedLogs.vue.d.ts +1 -4
  68. package/dist/vue/{index-C8MxnS7Q.js → index-CM3yNVUR.js} +2 -2
  69. package/dist/vue/index.js +1 -1
  70. package/dist/vue/style.css +1 -1
  71. package/package.json +7 -7
  72. package/dist/react/CacheSection-baMZotSn.js +0 -146
  73. package/dist/react/CacheTab-2cw_rMzj.js +0 -117
  74. package/dist/react/CustomPaneTab-B6r7ha0u.js +0 -98
  75. package/dist/react/EmailsSection-C-UZISG-.js +0 -262
  76. package/dist/react/EmailsTab-DbK4Eobn.js +0 -139
  77. package/dist/react/EventsTab-CfVr7AiM.js +0 -57
  78. package/dist/react/InternalsSection-t7ihcWO-.js +0 -32
  79. package/dist/react/InternalsTab-Oij0A2fN.js +0 -30
  80. package/dist/react/JobsSection-CQHNK_Ls.js +0 -187
  81. package/dist/react/JobsTab-znzf6jzk.js +0 -153
  82. package/dist/react/LogsSection-Dmm3rE2B.js +0 -233
  83. package/dist/react/LogsTab-D8unMV5P.js +0 -108
  84. package/dist/react/QueriesSection-CnmSkznA.js +0 -461
  85. package/dist/react/RelatedLogs-3A8RuGKH.js +0 -52
  86. package/dist/react/RequestsSection-kW79_M7k.js +0 -341
  87. package/dist/vue/CustomPaneTab-BJxT5Dp7.js +0 -172
  88. package/dist/vue/RelatedLogs.vue_vue_type_script_setup_true_lang-CB2_TzYW.js +0 -84
  89. package/dist/vue/TimelineTab-zj5Z5OdT.js +0 -338
@@ -1,341 +0,0 @@
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-CsImORX6.js";
6
- import { R as V } from "./RelatedLogs-3A8RuGKH.js";
7
- import { D as H } from "./DataTable-YyShr5B-.js";
8
- import { F as J } from "./FilterBar-CQ7bD669.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,172 +0,0 @@
1
- import { defineComponent as F, ref as h, computed as K, onMounted as R, openBlock as a, createElementBlock as r, withDirectives as U, createElementVNode as m, vModelText as $, toDisplayString as l, createCommentVNode as v, Fragment as b, renderList as k, normalizeClass as y, createTextVNode as z } from "vue";
2
- import { compactPreview as B, formatDuration as E, timeAgo as S, formatTime as O, durationSeverity as P } from "adonisjs-server-stats/core";
3
- import { u as j } from "./useApiClient-BQQ9CF-q.js";
4
- import { u as w } from "./useResizableTable-BoivAevK.js";
5
- const J = {
6
- key: 0,
7
- class: "ss-dbg-search-bar"
8
- }, q = ["placeholder"], G = { class: "ss-dbg-summary" }, H = {
9
- key: 1,
10
- class: "ss-dbg-empty"
11
- }, I = {
12
- key: 2,
13
- class: "ss-dbg-empty"
14
- }, Q = ["onClick"], W = {
15
- key: 0,
16
- class: "ss-dbg-c-dim"
17
- }, X = ["title"], ne = /* @__PURE__ */ F({
18
- __name: "CustomPaneTab",
19
- props: {
20
- pane: {},
21
- baseUrl: {},
22
- authToken: {}
23
- },
24
- setup(d) {
25
- const o = d, u = h([]), p = h(!1), c = h(""), _ = j(o.baseUrl || "", o.authToken);
26
- let C = !1;
27
- async function N() {
28
- if (!(o.pane.fetchOnce && C)) {
29
- p.value = !0;
30
- try {
31
- const e = await _().fetch(o.pane.endpoint), s = (o.pane.dataKey || o.pane.id).split(".");
32
- let i = e;
33
- for (const t of s)
34
- i = i?.[t];
35
- u.value = Array.isArray(i) ? i : [], C = !0;
36
- } catch {
37
- u.value = [];
38
- } finally {
39
- p.value = !1;
40
- }
41
- }
42
- }
43
- const g = K(() => {
44
- if (!c.value.trim()) return u.value;
45
- const e = c.value.toLowerCase(), n = o.pane.columns.filter((s) => s.searchable).map((s) => s.key);
46
- return n.length === 0 ? u.value : u.value.filter(
47
- (s) => n.some((i) => {
48
- const t = s[i];
49
- return t == null ? !1 : String(t).toLowerCase().includes(e);
50
- })
51
- );
52
- });
53
- function f(e, n) {
54
- if (e == null) return "-";
55
- switch (n.format || "text") {
56
- case "time":
57
- return typeof e == "number" ? S(e) : String(e);
58
- case "timeAgo":
59
- return S(e);
60
- case "duration":
61
- return E(typeof e == "number" ? e : parseFloat(String(e)));
62
- case "method":
63
- return String(e);
64
- case "json": {
65
- let i = e;
66
- if (typeof e == "string")
67
- try {
68
- i = JSON.parse(e);
69
- } catch {
70
- }
71
- return B(i, 80);
72
- }
73
- case "badge":
74
- return String(e);
75
- default:
76
- return String(e);
77
- }
78
- }
79
- function T(e, n) {
80
- if (n.format === "time" || n.format === "timeAgo")
81
- return O(e);
82
- }
83
- function x(e) {
84
- return e == null;
85
- }
86
- function A(e) {
87
- const n = typeof e == "number" ? e : parseFloat(String(e));
88
- if (isNaN(n)) return "ss-dbg-duration";
89
- const s = P(n);
90
- return s === "very-slow" ? "ss-dbg-duration ss-dbg-very-slow" : s === "slow" ? "ss-dbg-duration ss-dbg-slow" : "ss-dbg-duration";
91
- }
92
- function L(e, n) {
93
- if (n.format === "badge" && n.badgeColorMap) {
94
- const s = String(e).toLowerCase();
95
- return n.badgeColorMap[s] || "muted";
96
- }
97
- return "";
98
- }
99
- function D(e) {
100
- return `ss-dbg-method ss-dbg-method-${String(e).toLowerCase()}`;
101
- }
102
- function M() {
103
- u.value = [];
104
- }
105
- const { tableRef: V } = w(() => g.value);
106
- return R(() => {
107
- N();
108
- }), (e, n) => (a(), r("div", null, [
109
- d.pane.search ? (a(), r("div", J, [
110
- U(m("input", {
111
- "onUpdate:modelValue": n[0] || (n[0] = (s) => c.value = s),
112
- class: "ss-dbg-search",
113
- placeholder: d.pane.search.placeholder,
114
- type: "text"
115
- }, null, 8, q), [
116
- [$, c.value]
117
- ]),
118
- m("span", G, l(g.value.length) + " items", 1),
119
- d.pane.clearable ? (a(), r("button", {
120
- key: 0,
121
- class: "ss-dbg-btn-clear",
122
- onClick: M
123
- }, "Clear")) : v("", !0)
124
- ])) : v("", !0),
125
- p.value ? (a(), r("div", H, "Loading...")) : g.value.length === 0 ? (a(), r("div", I, "No data")) : (a(), r("table", {
126
- key: 3,
127
- ref_key: "tableRef",
128
- ref: V,
129
- class: "ss-dbg-table"
130
- }, [
131
- m("thead", null, [
132
- m("tr", null, [
133
- (a(!0), r(b, null, k(d.pane.columns, (s) => (a(), r("th", {
134
- key: s.key
135
- }, l(s.label), 1))), 128))
136
- ])
137
- ]),
138
- m("tbody", null, [
139
- (a(!0), r(b, null, k(g.value, (s, i) => (a(), r("tr", {
140
- key: String(s.id ?? i)
141
- }, [
142
- (a(!0), r(b, null, k(d.pane.columns, (t) => (a(), r("td", {
143
- key: t.key,
144
- class: y({ "ss-dbg-filterable": t.filterable }),
145
- onClick: (Y) => t.filterable ? c.value = String(s[t.key]) : void 0
146
- }, [
147
- x(s[t.key]) ? (a(), r("span", W, "-")) : t.format === "time" || t.format === "timeAgo" ? (a(), r("span", {
148
- key: 1,
149
- class: "ss-dbg-event-time",
150
- title: T(s[t.key], t)
151
- }, l(f(s[t.key], t)), 9, X)) : t.format === "duration" ? (a(), r("span", {
152
- key: 2,
153
- class: y(A(s[t.key]))
154
- }, l(f(s[t.key], t)), 3)) : t.format === "method" ? (a(), r("span", {
155
- key: 3,
156
- class: y(D(s[t.key]))
157
- }, l(f(s[t.key], t)), 3)) : t.format === "badge" ? (a(), r("span", {
158
- key: 4,
159
- class: y(`ss-dbg-badge ss-dbg-badge-${L(s[t.key], t)}`)
160
- }, l(f(s[t.key], t)), 3)) : (a(), r(b, { key: 5 }, [
161
- z(l(f(s[t.key], t)), 1)
162
- ], 64))
163
- ], 10, Q))), 128))
164
- ]))), 128))
165
- ])
166
- ], 512))
167
- ]));
168
- }
169
- });
170
- export {
171
- ne as default
172
- };
@@ -1,84 +0,0 @@
1
- import { defineComponent as y, ref as k, openBlock as a, createElementBlock as n, createElementVNode as i, normalizeClass as t, createTextVNode as L, toDisplayString as c, Fragment as v, renderList as h, unref as e, createVNode as C, createCommentVNode as g } from "vue";
2
- import { getStructuredData as r, getLogLevelCssClass as N, resolveLogLevel as P, resolveLogTimestamp as u, formatTime as V, timeAgo as q, resolveLogRequestId as m, resolveLogMessage as E } from "adonisjs-server-stats/core";
3
- import { _ as R } from "./JsonViewer.vue_vue_type_script_setup_true_lang-Bid05zpm.js";
4
- const T = { key: 0 }, w = { style: { overflow: "auto" } }, B = ["onClick"], D = ["title"], I = ["title"], S = {
5
- key: 3,
6
- style: { width: "14px" }
7
- }, M = /* @__PURE__ */ y({
8
- __name: "RelatedLogs",
9
- props: {
10
- logs: {},
11
- classPrefix: { default: "ss-dash" }
12
- },
13
- setup(s) {
14
- const o = k(null);
15
- function $(x, d) {
16
- d && (o.value = o.value === x ? null : x);
17
- }
18
- return (x, d) => s.logs.length > 0 ? (a(), n("div", T, [
19
- i("div", {
20
- class: t(`${s.classPrefix}-related-logs-title`)
21
- }, [
22
- d[0] || (d[0] = L(" Related Logs ", -1)),
23
- i("span", {
24
- class: t(`${s.classPrefix}-related-logs-count`)
25
- }, "(" + c(s.logs.length) + ")", 3)
26
- ], 2),
27
- i("div", w, [
28
- (a(!0), n(v, null, h(s.logs, (l, f) => (a(), n(v, {
29
- key: l.id || f
30
- }, [
31
- i("div", {
32
- class: t([
33
- `${s.classPrefix}-log-entry`,
34
- e(r)(l) ? `${s.classPrefix}-log-entry-expandable` : ""
35
- ]),
36
- onClick: (b) => $(f, !!e(r)(l))
37
- }, [
38
- i("span", {
39
- class: t([
40
- `${s.classPrefix}-log-level`,
41
- e(N)(e(P)(l), `${s.classPrefix}-log-level`)
42
- ])
43
- }, c(e(P)(l).toUpperCase()), 3),
44
- i("span", {
45
- class: t(`${s.classPrefix}-log-time`),
46
- title: e(u)(l) ? e(V)(e(u)(l)) : ""
47
- }, c(e(u)(l) ? e(q)(e(u)(l)) : "-"), 11, D),
48
- e(m)(l) ? (a(), n("span", {
49
- key: 0,
50
- class: t(`${s.classPrefix}-log-reqid`),
51
- title: e(m)(l)
52
- }, c(e(m)(l).slice(0, 8)), 11, I)) : (a(), n("span", {
53
- key: 1,
54
- class: t(`${s.classPrefix}-log-reqid-empty`)
55
- }, "--", 2)),
56
- e(r)(l) ? (a(), n("span", {
57
- key: 2,
58
- class: t([
59
- `${s.classPrefix}-log-expand-icon`,
60
- o.value === f ? `${s.classPrefix}-log-expand-icon-open` : ""
61
- ])
62
- }, "▶", 2)) : (a(), n("span", S)),
63
- i("span", {
64
- class: t(`${s.classPrefix}-log-msg`)
65
- }, c(e(E)(l)), 3)
66
- ], 10, B),
67
- o.value === f && e(r)(l) ? (a(), n("div", {
68
- key: 0,
69
- class: t(`${s.classPrefix}-log-detail`)
70
- }, [
71
- C(R, {
72
- value: e(r)(l),
73
- "class-prefix": s.classPrefix,
74
- "default-expanded": !0
75
- }, null, 8, ["value", "class-prefix"])
76
- ], 2)) : g("", !0)
77
- ], 64))), 128))
78
- ])
79
- ])) : g("", !0);
80
- }
81
- });
82
- export {
83
- M as _
84
- };