adonisjs-server-stats 1.11.5 → 1.11.7

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 (64) hide show
  1. package/README.md +19 -6
  2. package/dist/core/index.d.ts +2 -1
  3. package/dist/core/index.js +550 -468
  4. package/dist/core/types-diagnostics.d.ts +2 -0
  5. package/dist/react/{CacheSection-BYN53kYO.js → CacheSection-DOUnyUrw.js} +1 -1
  6. package/dist/react/{CacheTab-DOhuK05d.js → CacheTab-D9o6bsPc.js} +1 -1
  7. package/dist/react/{ConfigSection-B9EHh4Rp.js → ConfigSection-DzNC7pOJ.js} +1 -1
  8. package/dist/react/{ConfigTab-C8kriE2b.js → ConfigTab-CT-Tu-ct.js} +1 -1
  9. package/dist/react/{CustomPaneTab-CvzQS_Wh.js → CustomPaneTab-CvIPe7NP.js} +1 -1
  10. package/dist/react/{EmailsSection-BJyFJf7A.js → EmailsSection-B1LT7Nx3.js} +1 -1
  11. package/dist/react/{EmailsTab-Ch8jp10B.js → EmailsTab-DKxK322z.js} +1 -1
  12. package/dist/react/{EventsSection-DJPwHeT8.js → EventsSection-D3AK0mhw.js} +1 -1
  13. package/dist/react/{EventsTab-B-FoehXC.js → EventsTab-BRRSW6RI.js} +1 -1
  14. package/dist/react/InternalsContent-BNOnSoi9.js +393 -0
  15. package/dist/react/{InternalsSection-B6VlVx5f.js → InternalsSection-BwrTfpjA.js} +1 -1
  16. package/dist/react/{InternalsTab-CkEKpRMU.js → InternalsTab--RD-L1dX.js} +1 -1
  17. package/dist/react/{JobsSection-DWF4i1t_.js → JobsSection-BMvj5886.js} +1 -1
  18. package/dist/react/{JobsTab-DqnifQXV.js → JobsTab-CQXWCrl8.js} +1 -1
  19. package/dist/react/{LogEntryRow-CMMkqA9M.js → LogEntryRow-DFI52ZEw.js} +1 -1
  20. package/dist/react/{LogsSection-C1xC5aP4.js → LogsSection-CW2hQ976.js} +2 -2
  21. package/dist/react/{LogsTab-CS4sLfLw.js → LogsTab-CV4Gf_yb.js} +2 -2
  22. package/dist/react/{OverviewSection-CxvfOR0v.js → OverviewSection-CxF9cabq.js} +1 -1
  23. package/dist/react/{QueriesSection-CrMdU5Ax.js → QueriesSection-CZJ-imAb.js} +117 -101
  24. package/dist/react/{QueriesTab-x85PjkyS.js → QueriesTab-CQHa1ck3.js} +23 -14
  25. package/dist/react/{RequestsSection-DETN9oZb.js → RequestsSection-Cb5YeqvI.js} +2 -2
  26. package/dist/react/{RoutesSection-CmorkJeC.js → RoutesSection-B43olD9v.js} +1 -1
  27. package/dist/react/{RoutesTab-CbzBOzpc.js → RoutesTab-RfhCUbkx.js} +1 -1
  28. package/dist/react/{SplitPaneWrapper-BiIgT4ND.js → SplitPaneWrapper-B05Mg6Sg.js} +1 -1
  29. package/dist/react/{TimelineTab-Ue9tUD_n.js → TimelineTab-Dx4686Ti.js} +2 -2
  30. package/dist/react/components/Dashboard/shared/DataTable.d.ts +1 -1
  31. package/dist/react/{index-DwDK-4oX.js → index-C4EMJrkH.js} +2 -2
  32. package/dist/react/index.js +1 -1
  33. package/dist/react/style.css +1 -1
  34. package/dist/src/collectors/db_pool_collector.js +17 -23
  35. package/dist/src/edge/client/dashboard.js +2 -2
  36. package/dist/src/edge/client/debug-panel-deferred.js +1 -1
  37. package/dist/src/edge/client-vue/dashboard.js +3 -3
  38. package/dist/src/edge/client-vue/debug-panel-deferred.js +2 -2
  39. package/dist/src/provider/diagnostics.d.ts +3 -0
  40. package/dist/src/provider/diagnostics.js +1 -0
  41. package/dist/src/provider/server_stats_provider.d.ts +7 -0
  42. package/dist/src/provider/server_stats_provider.js +36 -0
  43. package/dist/src/styles/components.css +16 -0
  44. package/dist/src/styles/dashboard.css +27 -18
  45. package/dist/vue/{CacheSection-DT2Mwf_s.js → CacheSection-BAotiuQq.js} +1 -1
  46. package/dist/vue/{ConfigSection-BwKwS9lh.js → ConfigSection-JZjK5E5F.js} +1 -1
  47. package/dist/vue/{EmailsSection-B65g0FVS.js → EmailsSection-BLwyQO7B.js} +1 -1
  48. package/dist/vue/{EventsSection-CxqtVF-o.js → EventsSection-BUEwO-0A.js} +1 -1
  49. package/dist/vue/{InternalsSection-BJUXE-5F.js → InternalsSection-jhTCuK3j.js} +149 -130
  50. package/dist/vue/{InternalsTab-DEMjqtlw.js → InternalsTab-521fxYYj.js} +152 -133
  51. package/dist/vue/{JobsSection-rMIyMb-g.js → JobsSection-21A0yQMq.js} +1 -1
  52. package/dist/vue/{LogsSection-DmmZVJ7D.js → LogsSection-BmOx8SNa.js} +1 -1
  53. package/dist/vue/{OverviewSection-BMabyqw-.js → OverviewSection-BRDK3Ony.js} +1 -1
  54. package/dist/vue/QueriesSection-D2WGsuR4.js +444 -0
  55. package/dist/vue/QueriesTab-6D_xfi7Q.js +114 -0
  56. package/dist/vue/{RequestsSection-CTu4jPZ_.js → RequestsSection-DLrjCfcE.js} +1 -1
  57. package/dist/vue/{RoutesSection-zQZDedL7.js → RoutesSection-CPr9w42B.js} +1 -1
  58. package/dist/vue/{index-CM3yNVUR.js → index-CYaqRGIT.js} +2 -2
  59. package/dist/vue/index.js +1 -1
  60. package/dist/vue/style.css +1 -1
  61. package/package.json +1 -1
  62. package/dist/react/InternalsContent-O8ino9oM.js +0 -370
  63. package/dist/vue/QueriesSection-BfDFwGqH.js +0 -428
  64. package/dist/vue/QueriesTab-DuTG7cpC.js +0 -106
@@ -0,0 +1,444 @@
1
+ import { defineComponent as H, inject as A, ref as C, computed as $, openBlock as o, createElementBlock as i, createVNode as W, withCtx as it, createElementVNode as s, normalizeClass as y, unref as r, createTextVNode as v, toDisplayString as u, createCommentVNode as h, Fragment as k, renderList as T, withKeys as B, withModifiers as E, createBlock as ut, h as D } from "vue";
2
+ import { formatTime as rt, timeAgo as dt, SLOW_DURATION_MS as pt, durationClassName as ct } from "adonisjs-server-stats/core";
3
+ import { u as vt } from "./index-CYaqRGIT.js";
4
+ import { u as ht } from "./useResizableTable-BoivAevK.js";
5
+ import { _ as mt } from "./FilterBar.vue_vue_type_script_setup_true_lang-ClJ37hhT.js";
6
+ import { _ as ft } from "./PaginationControls.vue_vue_type_script_setup_true_lang-CuN7g_8Z.js";
7
+ const yt = { class: "ss-dash-btn-group" }, xt = {
8
+ key: 0,
9
+ class: "ss-dash-empty"
10
+ }, _t = {
11
+ key: 1,
12
+ class: "ss-dash-table-wrap"
13
+ }, bt = {
14
+ key: 0,
15
+ class: "ss-dash-sort-arrow"
16
+ }, kt = {
17
+ key: 0,
18
+ class: "ss-dash-sort-arrow"
19
+ }, wt = {
20
+ key: 0,
21
+ class: "ss-dash-sort-arrow"
22
+ }, gt = ["onClick", "onKeydown"], Ct = {
23
+ key: 0,
24
+ class: "ss-dash-dup"
25
+ }, $t = { style: { color: "var(--ss-muted)", "text-align": "center", display: "block" } }, Dt = { class: "ss-dash-duration" }, Nt = { class: "ss-dash-duration" }, Pt = { style: { color: "var(--ss-muted)", "text-align": "center", display: "block" } }, St = {
26
+ key: 1,
27
+ class: "ss-dash-empty"
28
+ }, Tt = { class: "ss-dash-table-wrap" }, zt = {
29
+ key: 0,
30
+ class: "ss-dash-sort-arrow"
31
+ }, jt = {
32
+ key: 0,
33
+ class: "ss-dash-sort-arrow"
34
+ }, At = { style: { color: "var(--ss-dim)" } }, Ft = ["onClick", "onKeydown"], Kt = {
35
+ key: 0,
36
+ class: "ss-dash-dup"
37
+ }, Lt = ["title"], Rt = { style: { color: "var(--ss-dim)", overflow: "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" } }, Et = ["title"], Mt = ["disabled", "onClick"], Ot = {
38
+ key: 0,
39
+ class: "ss-dash-explain-row"
40
+ }, qt = {
41
+ colspan: "8",
42
+ class: "ss-dash-explain"
43
+ }, Vt = { style: { display: "flex", "justify-content": "space-between", "align-items": "start" } }, Qt = { style: { flex: "1" } }, Ut = {
44
+ key: 0,
45
+ class: "ss-dash-explain-result ss-dash-explain-error"
46
+ }, Wt = { key: 0 }, Bt = {
47
+ key: 1,
48
+ class: "ss-dash-explain-result"
49
+ }, Ht = {
50
+ key: 2,
51
+ class: "ss-dash-explain-result"
52
+ }, It = {
53
+ key: 3,
54
+ class: "ss-dash-explain-result"
55
+ }, Jt = {
56
+ key: 1,
57
+ class: "ss-dash-empty"
58
+ };
59
+ function I(n, z) {
60
+ if (!n) return null;
61
+ const F = z * 20, K = n["Node Type"] || "Unknown", j = n["Relation Name"] || "", c = n.Alias && n.Alias !== n["Relation Name"] ? ` (${n.Alias})` : "", d = n["Index Name"] || "", a = [];
62
+ if (n["Startup Cost"] !== null && n["Startup Cost"] !== void 0 && a.push(`cost=${n["Startup Cost"]}..${n["Total Cost"]}`), n["Plan Rows"] !== null && n["Plan Rows"] !== void 0 && a.push(`rows=${n["Plan Rows"]}`), n["Plan Width"] !== null && n["Plan Width"] !== void 0 && a.push(`width=${n["Plan Width"]}`), n.Filter && a.push(`filter: ${n.Filter}`), n["Index Cond"] && a.push(`cond: ${n["Index Cond"]}`), n["Hash Cond"] && a.push(`hash: ${n["Hash Cond"]}`), n["Join Type"] && a.push(`join: ${n["Join Type"]}`), n["Sort Key"]) {
63
+ const N = Array.isArray(n["Sort Key"]) ? n["Sort Key"].join(", ") : n["Sort Key"];
64
+ a.push(`sort: ${N}`);
65
+ }
66
+ const x = n.Plans || [];
67
+ return D("div", { class: "ss-dash-explain-node", style: { marginLeft: `${F}px` } }, [
68
+ D("div", { class: "ss-dash-explain-node-header" }, [
69
+ D("span", { class: "ss-dash-explain-node-type" }, K),
70
+ j ? [" on ", D("strong", null, j)] : null,
71
+ c || null,
72
+ d ? [" using ", D("em", null, d)] : null
73
+ ]),
74
+ a.length > 0 ? D("div", { class: "ss-dash-explain-metrics" }, a.join(" · ")) : null,
75
+ ...x.map((N, w) => I(N, z + 1))
76
+ ]);
77
+ }
78
+ const J = H({
79
+ name: "ExplainPlanNode",
80
+ props: {
81
+ node: { type: Object, required: !0 },
82
+ depth: { type: Number, default: 0 }
83
+ },
84
+ setup(n) {
85
+ return () => I(n.node, n.depth);
86
+ }
87
+ }), Gt = { components: { ExplainPlanNode: J } }, ls = /* @__PURE__ */ H({
88
+ ...Gt,
89
+ __name: "QueriesSection",
90
+ setup(n) {
91
+ const z = A("ss-refresh-key", C(0)), F = A("ss-dashboard-endpoint", "/__stats/api"), K = A("ss-auth-token", void 0), j = A("ss-base-url", ""), c = C("list"), d = C(null), a = C(null), x = C(null), N = $(() => c.value === "grouped" ? "queries/grouped" : "queries"), { data: w, loading: G, pagination: P, sort: m, goToPage: X, setSearch: Y, setSort: Z, explainQuery: tt } = vt(() => N.value, {
92
+ baseUrl: j,
93
+ dashboardEndpoint: F,
94
+ authToken: K,
95
+ refreshKey: z
96
+ }), M = C(""), O = $(() => w.value ? c.value === "grouped" ? w.value.groups || [] : w.value.data || w.value || [] : []), f = $(() => c.value !== "grouped" ? O.value : O.value.map((e) => {
97
+ const t = { ...e };
98
+ return (t.sqlNormalized === null || t.sqlNormalized === void 0 && (e.sql_normalized || e.pattern)) && (t.sqlNormalized = e.sql_normalized || e.pattern || ""), (t.count === null || t.count === void 0) && e.total_count !== null && e.total_count !== void 0 && (t.count = e.total_count), (t.avgDuration === null || t.avgDuration === void 0) && e.avg_duration !== null && e.avg_duration !== void 0 && (t.avgDuration = e.avg_duration), (t.maxDuration === null || t.maxDuration === void 0) && e.max_duration !== null && e.max_duration !== void 0 && (t.maxDuration = e.max_duration), (t.minDuration === null || t.minDuration === void 0) && e.min_duration !== null && e.min_duration !== void 0 && (t.minDuration = e.min_duration), (t.totalDuration === null || t.totalDuration === void 0) && e.total_duration !== null && e.total_duration !== void 0 && (t.totalDuration = e.total_duration), (t.percentOfTotal === null || t.percentOfTotal === void 0) && e.pct_time !== null && e.pct_time !== void 0 && (t.percentOfTotal = e.pct_time), t;
99
+ })), L = $(() => {
100
+ const e = /* @__PURE__ */ new Map();
101
+ for (const t of f.value) {
102
+ const l = t.sqlNormalized || t.sql || t.sql_text || "";
103
+ e.set(l, (e.get(l) || 0) + 1);
104
+ }
105
+ return e;
106
+ }), g = $(() => {
107
+ const e = P.total ?? f.value.length;
108
+ let t = 0, l = 0, p = 0, _ = 0;
109
+ for (const b of f.value) {
110
+ const U = b.duration || 0;
111
+ p += U, _++, U > pt && t++;
112
+ }
113
+ for (const b of L.value.values())
114
+ b > 1 && (l += b);
115
+ return { total: e, slow: t, duplicates: l, avgDuration: _ > 0 ? p / _ : 0 };
116
+ }), st = $(() => {
117
+ if (c.value === "grouped") return `${f.value.length} query patterns`;
118
+ const e = [`${g.value.total} queries`];
119
+ return g.value.slow > 0 && e.push(`${g.value.slow} slow`), g.value.duplicates > 0 && e.push(`${g.value.duplicates} dup`), e.push(`avg ${(g.value.avgDuration || 0).toFixed(1)}ms`), e.join(", ");
120
+ });
121
+ function et(e) {
122
+ M.value = e, Y(e);
123
+ }
124
+ function q(e) {
125
+ e !== c.value && (c.value = e, d.value = null, a.value = null, x.value = null);
126
+ }
127
+ function S(e) {
128
+ Z(e);
129
+ }
130
+ async function lt(e) {
131
+ if (a.value && a.value.queryId === e) {
132
+ a.value = null;
133
+ return;
134
+ }
135
+ x.value = e;
136
+ try {
137
+ const t = await tt(e);
138
+ t && t.error ? a.value = { queryId: e, plan: [], error: t.error, message: t.message } : a.value = { queryId: e, plan: t?.plan || t?.rows || [] };
139
+ } catch (t) {
140
+ a.value = {
141
+ queryId: e,
142
+ plan: [],
143
+ error: t instanceof Error ? t.message : String(t)
144
+ };
145
+ } finally {
146
+ x.value = null;
147
+ }
148
+ }
149
+ function R(e) {
150
+ return ct(e, "ss-dash");
151
+ }
152
+ function V() {
153
+ const e = a.value?.plan;
154
+ return !e || e.length === 0 || typeof e[0] != "object" || !e[0] ? [] : Object.keys(e[0]);
155
+ }
156
+ function nt(e, t) {
157
+ if (!e || typeof e != "object") return "-";
158
+ const l = e[t];
159
+ return l != null ? String(l) : "-";
160
+ }
161
+ function at() {
162
+ const e = a.value?.plan;
163
+ return !e || e.length === 0 || typeof e[0] != "object" || !e[0] ? !1 : "Plan" in e[0];
164
+ }
165
+ function ot() {
166
+ const e = a.value?.plan;
167
+ return !e || e.length === 0 || typeof e[0] != "object" || !e[0] ? {} : e[0].Plan;
168
+ }
169
+ const { tableRef: Q } = ht(() => f.value);
170
+ return (e, t) => (o(), i("div", null, [
171
+ W(mt, {
172
+ "model-value": M.value,
173
+ placeholder: "Filter queries...",
174
+ summary: st.value,
175
+ "onUpdate:modelValue": et
176
+ }, {
177
+ default: it(() => [
178
+ s("div", yt, [
179
+ s("button", {
180
+ type: "button",
181
+ class: y(`ss-dash-btn ${c.value === "list" ? "ss-dash-active" : ""}`),
182
+ onClick: t[0] || (t[0] = (l) => q("list"))
183
+ }, " List ", 2),
184
+ s("button", {
185
+ type: "button",
186
+ class: y(`ss-dash-btn ${c.value === "grouped" ? "ss-dash-active" : ""}`),
187
+ onClick: t[1] || (t[1] = (l) => q("grouped"))
188
+ }, " Grouped ", 2)
189
+ ])
190
+ ]),
191
+ _: 1
192
+ }, 8, ["model-value", "summary"]),
193
+ r(G) && !r(w) ? (o(), i("div", xt, "Loading queries...")) : c.value === "grouped" ? (o(), i("div", _t, [
194
+ f.value.length > 0 ? (o(), i("table", {
195
+ key: 0,
196
+ ref_key: "tableRef",
197
+ ref: Q,
198
+ class: "ss-dash-table"
199
+ }, [
200
+ s("thead", null, [
201
+ s("tr", null, [
202
+ t[11] || (t[11] = s("th", null, "Pattern", -1)),
203
+ s("th", {
204
+ class: "ss-dash-sortable",
205
+ onClick: t[2] || (t[2] = (l) => S("count"))
206
+ }, [
207
+ t[8] || (t[8] = v(" Count ", -1)),
208
+ r(m).column === "count" ? (o(), i("span", bt, u(r(m).direction === "asc" ? " ▲" : " ▼"), 1)) : h("", !0)
209
+ ]),
210
+ s("th", {
211
+ class: "ss-dash-sortable",
212
+ onClick: t[3] || (t[3] = (l) => S("avgDuration"))
213
+ }, [
214
+ t[9] || (t[9] = v(" Avg ", -1)),
215
+ r(m).column === "avgDuration" ? (o(), i("span", kt, u(r(m).direction === "asc" ? " ▲" : " ▼"), 1)) : h("", !0)
216
+ ]),
217
+ t[12] || (t[12] = s("th", null, "Min", -1)),
218
+ t[13] || (t[13] = s("th", null, "Max", -1)),
219
+ s("th", {
220
+ class: "ss-dash-sortable",
221
+ onClick: t[4] || (t[4] = (l) => S("totalDuration"))
222
+ }, [
223
+ t[10] || (t[10] = v(" Total ", -1)),
224
+ r(m).column === "totalDuration" ? (o(), i("span", wt, u(r(m).direction === "asc" ? " ▲" : " ▼"), 1)) : h("", !0)
225
+ ]),
226
+ t[14] || (t[14] = s("th", null, "% Time", -1))
227
+ ])
228
+ ]),
229
+ s("tbody", null, [
230
+ (o(!0), i(k, null, T(f.value, (l, p) => (o(), i("tr", { key: p }, [
231
+ s("td", null, [
232
+ s("span", {
233
+ class: y(`ss-dash-sql ${d.value === l.sqlNormalized ? "ss-dash-expanded" : ""}`),
234
+ title: "Click to expand",
235
+ role: "button",
236
+ tabindex: "0",
237
+ onClick: E((_) => d.value = d.value === l.sqlNormalized ? null : l.sqlNormalized, ["stop"]),
238
+ onKeydown: B((_) => d.value = d.value === l.sqlNormalized ? null : l.sqlNormalized, ["enter"])
239
+ }, u(l.sqlNormalized), 43, gt),
240
+ (l.count || 0) >= 3 ? (o(), i("span", Ct, "DUP")) : h("", !0)
241
+ ]),
242
+ s("td", null, [
243
+ s("span", $t, u(l.count || 0), 1)
244
+ ]),
245
+ s("td", null, [
246
+ s("span", {
247
+ class: y(`ss-dash-duration ${R(l.avgDuration || 0)}`)
248
+ }, u((l.avgDuration || 0).toFixed(2)) + "ms ", 3)
249
+ ]),
250
+ s("td", null, [
251
+ s("span", Dt, u((l.minDuration || 0).toFixed(2)) + "ms", 1)
252
+ ]),
253
+ s("td", null, [
254
+ s("span", {
255
+ class: y(`ss-dash-duration ${R(l.maxDuration || 0)}`)
256
+ }, u((l.maxDuration || 0).toFixed(2)) + "ms ", 3)
257
+ ]),
258
+ s("td", null, [
259
+ s("span", Nt, u((l.totalDuration || 0).toFixed(1)) + "ms", 1)
260
+ ]),
261
+ s("td", null, [
262
+ s("span", Pt, u((l.percentOfTotal || 0).toFixed(1)) + "%", 1)
263
+ ])
264
+ ]))), 128))
265
+ ])
266
+ ], 512)) : (o(), i("div", St, [...t[15] || (t[15] = [
267
+ s("span", null, "No queries recorded", -1),
268
+ s("span", { class: "ss-empty-hint" }, [
269
+ v(" Queries require "),
270
+ s("code", null, "debug: true"),
271
+ v(" on your Lucid connections in "),
272
+ s("code", null, "config/database.ts")
273
+ ], -1)
274
+ ])]))
275
+ ])) : (o(), i(k, { key: 2 }, [
276
+ s("div", Tt, [
277
+ f.value.length > 0 ? (o(), i("table", {
278
+ key: 0,
279
+ ref_key: "tableRef",
280
+ ref: Q,
281
+ class: "ss-dash-table"
282
+ }, [
283
+ t[25] || (t[25] = s("colgroup", null, [
284
+ s("col", { style: { width: "40px" } }),
285
+ s("col"),
286
+ s("col", { style: { width: "70px" } }),
287
+ s("col", { style: { width: "60px" } }),
288
+ s("col", { style: { width: "90px" } }),
289
+ s("col", { style: { width: "80px" } }),
290
+ s("col", { style: { width: "90px" } }),
291
+ s("col", { style: { width: "70px" } })
292
+ ], -1)),
293
+ s("thead", null, [
294
+ s("tr", null, [
295
+ t[18] || (t[18] = s("th", null, "#", -1)),
296
+ t[19] || (t[19] = s("th", null, "SQL", -1)),
297
+ s("th", {
298
+ class: "ss-dash-sortable",
299
+ onClick: t[5] || (t[5] = (l) => S("duration"))
300
+ }, [
301
+ t[16] || (t[16] = v(" Duration ", -1)),
302
+ r(m).column === "duration" ? (o(), i("span", zt, u(r(m).direction === "asc" ? " ▲" : " ▼"), 1)) : h("", !0)
303
+ ]),
304
+ t[20] || (t[20] = s("th", null, "Method", -1)),
305
+ t[21] || (t[21] = s("th", null, "Model", -1)),
306
+ t[22] || (t[22] = s("th", null, "Connection", -1)),
307
+ s("th", {
308
+ class: "ss-dash-sortable",
309
+ onClick: t[6] || (t[6] = (l) => S("createdAt"))
310
+ }, [
311
+ t[17] || (t[17] = v(" Time ", -1)),
312
+ r(m).column === "createdAt" ? (o(), i("span", jt, u(r(m).direction === "asc" ? " ▲" : " ▼"), 1)) : h("", !0)
313
+ ]),
314
+ t[23] || (t[23] = s("th", null, null, -1))
315
+ ])
316
+ ]),
317
+ s("tbody", null, [
318
+ (o(!0), i(k, null, T(f.value, (l) => (o(), i(k, {
319
+ key: l.id
320
+ }, [
321
+ s("tr", null, [
322
+ s("td", null, [
323
+ s("span", At, u(l.id), 1)
324
+ ]),
325
+ s("td", null, [
326
+ s("div", null, [
327
+ s("span", {
328
+ class: y(`ss-dash-sql ${d.value === l.id ? "ss-dash-expanded" : ""}`),
329
+ title: "Click to expand",
330
+ role: "button",
331
+ tabindex: "0",
332
+ onClick: E((p) => d.value = d.value === l.id ? null : l.id, ["stop"]),
333
+ onKeydown: B((p) => d.value = d.value === l.id ? null : l.id, ["enter"])
334
+ }, u(l.sql || l.sql_text || ""), 43, Ft),
335
+ (L.value.get(
336
+ (l.sqlNormalized || l.sql || l.sql_text) ?? ""
337
+ ) ?? 0) > 1 ? (o(), i("span", Kt, " ×" + u(L.value.get(
338
+ (l.sqlNormalized || l.sql || l.sql_text) ?? ""
339
+ )), 1)) : h("", !0)
340
+ ])
341
+ ]),
342
+ s("td", null, [
343
+ s("span", {
344
+ class: y(`ss-dash-duration ${R(l.duration || 0)}`)
345
+ }, u((l.duration || 0).toFixed(2)) + "ms ", 3)
346
+ ]),
347
+ s("td", null, [
348
+ s("span", {
349
+ class: y(`ss-dash-method ss-dash-method-${(l.method || l.sql_method || "").toLowerCase()}`)
350
+ }, u(l.method || l.sql_method || ""), 3)
351
+ ]),
352
+ s("td", null, [
353
+ s("span", {
354
+ style: { color: "var(--ss-muted)", overflow: "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" },
355
+ title: l.model
356
+ }, u(l.model || "-"), 9, Lt)
357
+ ]),
358
+ s("td", null, [
359
+ s("span", Rt, u(l.connection || "-"), 1)
360
+ ]),
361
+ s("td", null, [
362
+ s("span", {
363
+ class: "ss-dash-event-time",
364
+ title: r(rt)(
365
+ l.createdAt || l.created_at || l.timestamp || ""
366
+ )
367
+ }, u(r(dt)(
368
+ l.createdAt || l.created_at || l.timestamp || ""
369
+ )), 9, Et)
370
+ ]),
371
+ s("td", null, [
372
+ (l.method || l.sql_method || "") === "select" ? (o(), i("button", {
373
+ key: 0,
374
+ type: "button",
375
+ class: y(`ss-dash-explain-btn${a.value?.queryId === l.id && !a.value?.error ? " ss-dash-explain-btn-active" : ""}`),
376
+ disabled: x.value === l.id,
377
+ onClick: E((p) => lt(l.id), ["stop"])
378
+ }, u(x.value === l.id ? "..." : "EXPLAIN"), 11, Mt)) : h("", !0)
379
+ ])
380
+ ]),
381
+ a.value && a.value.queryId === l.id ? (o(), i("tr", Ot, [
382
+ s("td", qt, [
383
+ s("div", Vt, [
384
+ s("div", Qt, [
385
+ a.value.error ? (o(), i("div", Ut, [
386
+ t[24] || (t[24] = s("strong", null, "Error:", -1)),
387
+ v(" " + u(a.value.error) + " ", 1),
388
+ a.value.message ? (o(), i("br", Wt)) : h("", !0),
389
+ v(" " + u(a.value.message), 1)
390
+ ])) : at() ? (o(), i("div", Bt, [
391
+ W(r(J), {
392
+ node: ot(),
393
+ depth: 0
394
+ }, null, 8, ["node"])
395
+ ])) : a.value.plan && a.value.plan.length > 0 && typeof a.value.plan[0] == "object" ? (o(), i("div", Ht, [
396
+ s("table", null, [
397
+ s("thead", null, [
398
+ s("tr", null, [
399
+ (o(!0), i(k, null, T(V(), (p) => (o(), i("th", { key: p }, u(p), 1))), 128))
400
+ ])
401
+ ]),
402
+ s("tbody", null, [
403
+ (o(!0), i(k, null, T(a.value.plan, (p, _) => (o(), i("tr", { key: _ }, [
404
+ (o(!0), i(k, null, T(V(), (b) => (o(), i("td", { key: b }, u(nt(p, b)), 1))), 128))
405
+ ]))), 128))
406
+ ])
407
+ ])
408
+ ])) : (o(), i("div", It, "No plan data returned"))
409
+ ]),
410
+ s("button", {
411
+ type: "button",
412
+ class: "ss-dash-explain-btn",
413
+ style: { "margin-left": "8px", "flex-shrink": "0" },
414
+ onClick: t[7] || (t[7] = (p) => a.value = null)
415
+ }, " Close ")
416
+ ])
417
+ ])
418
+ ])) : h("", !0)
419
+ ], 64))), 128))
420
+ ])
421
+ ], 512)) : (o(), i("div", Jt, [...t[26] || (t[26] = [
422
+ s("span", null, "No queries recorded", -1),
423
+ s("span", { class: "ss-empty-hint" }, [
424
+ v(" Queries require "),
425
+ s("code", null, "debug: true"),
426
+ v(" on your Lucid connections in "),
427
+ s("code", null, "config/database.ts")
428
+ ], -1)
429
+ ])]))
430
+ ]),
431
+ r(P).totalPages > 1 ? (o(), ut(ft, {
432
+ key: 0,
433
+ page: r(P).page,
434
+ "last-page": r(P).totalPages,
435
+ total: r(P).total,
436
+ onPageChange: r(X)
437
+ }, null, 8, ["page", "last-page", "total", "onPageChange"])) : h("", !0)
438
+ ], 64))
439
+ ]));
440
+ }
441
+ });
442
+ export {
443
+ ls as default
444
+ };
@@ -0,0 +1,114 @@
1
+ import { defineComponent as $, ref as D, computed as r, openBlock as a, createElementBlock as l, createElementVNode as e, withDirectives as N, vModelText as S, toDisplayString as n, createTextVNode as f, Fragment as E, renderList as L, withKeys as V, normalizeClass as h, createCommentVNode as y, unref as b } from "vue";
2
+ import { filterQueries as A, countDuplicateQueries as K, computeQuerySummary as M, formatDuration as _, formatTime as R, timeAgo as z, durationClassName as B } from "adonisjs-server-stats/core";
3
+ import { u as F } from "./useResizableTable-BoivAevK.js";
4
+ const I = { class: "ss-dbg-search-bar" }, P = { class: "ss-dbg-summary" }, U = {
5
+ key: 0,
6
+ class: "ss-dbg-empty"
7
+ }, X = {
8
+ class: "ss-dbg-c-dim",
9
+ style: { "white-space": "nowrap" }
10
+ }, j = ["onClick", "onKeydown"], G = {
11
+ key: 0,
12
+ class: "ss-dbg-dup"
13
+ }, H = {
14
+ key: 1,
15
+ class: "ss-dbg-dup"
16
+ }, J = { class: "ss-dbg-c-muted" }, O = ["title"], q = /* @__PURE__ */ $({
17
+ __name: "QueriesTab",
18
+ props: {
19
+ data: {},
20
+ dashboardPath: {}
21
+ },
22
+ setup(C) {
23
+ const v = C, c = D(""), i = /* @__PURE__ */ new Set(), m = r(() => {
24
+ if (!v.data) return [];
25
+ const s = v.data;
26
+ return (Array.isArray(s) ? s : s.queries) || [];
27
+ }), u = r(() => A(m.value, c.value)), p = r(() => K(m.value)), d = r(() => M(m.value, p.value)), w = r(() => {
28
+ let s = `${u.value.length} queries`;
29
+ return d.value.slowCount > 0 && (s += ` | ${d.value.slowCount} slow`), d.value.dupCount > 0 && (s += ` | ${d.value.dupCount} dup`), u.value.length > 0 && (s += ` | avg ${_(d.value.avgDuration)}`), s;
30
+ });
31
+ function g(s) {
32
+ i.has(s) ? i.delete(s) : i.add(s);
33
+ }
34
+ function x(s) {
35
+ return i.has(s);
36
+ }
37
+ function k(s) {
38
+ return B(s, "ss-dbg");
39
+ }
40
+ const { tableRef: T } = F(() => u.value);
41
+ return (s, o) => (a(), l("div", null, [
42
+ e("div", I, [
43
+ N(e("input", {
44
+ "onUpdate:modelValue": o[0] || (o[0] = (t) => c.value = t),
45
+ class: "ss-dbg-search",
46
+ placeholder: "Filter queries...",
47
+ type: "text"
48
+ }, null, 512), [
49
+ [S, c.value]
50
+ ]),
51
+ e("span", P, n(w.value), 1)
52
+ ]),
53
+ u.value.length === 0 ? (a(), l("div", U, [...o[1] || (o[1] = [
54
+ e("span", null, "No queries captured", -1),
55
+ e("span", { class: "ss-empty-hint" }, [
56
+ f(" Queries require "),
57
+ e("code", null, "debug: true"),
58
+ f(" on your Lucid connections in "),
59
+ e("code", null, "config/database.ts")
60
+ ], -1)
61
+ ])])) : (a(), l("table", {
62
+ key: 1,
63
+ ref_key: "tableRef",
64
+ ref: T,
65
+ class: "ss-dbg-table"
66
+ }, [
67
+ o[2] || (o[2] = e("thead", null, [
68
+ e("tr", null, [
69
+ e("th", null, "#"),
70
+ e("th", null, "SQL"),
71
+ e("th", null, "Duration"),
72
+ e("th", null, "Method"),
73
+ e("th", null, "Model"),
74
+ e("th", null, "Time")
75
+ ])
76
+ ], -1)),
77
+ e("tbody", null, [
78
+ (a(!0), l(E, null, L(u.value, (t) => (a(), l("tr", {
79
+ key: t.id
80
+ }, [
81
+ e("td", X, n(t.id), 1),
82
+ e("td", null, [
83
+ e("span", {
84
+ class: h(["ss-dbg-sql", { "ss-dbg-expanded": x(t.id) }]),
85
+ role: "button",
86
+ tabindex: "0",
87
+ onClick: (Q) => g(t.id),
88
+ onKeydown: V((Q) => g(t.id), ["enter"])
89
+ }, n(t.sql), 43, j),
90
+ p.value[t.sql] > 1 ? (a(), l("span", G, " x" + n(p.value[t.sql]), 1)) : y("", !0),
91
+ t.inTransaction ? (a(), l("span", H, " TXN")) : y("", !0)
92
+ ]),
93
+ e("td", {
94
+ class: h(["ss-dbg-duration", k(t.duration)])
95
+ }, n(b(_)(t.duration)), 3),
96
+ e("td", null, [
97
+ e("span", {
98
+ class: h(`ss-dbg-method ss-dbg-method-${t.method.toLowerCase()}`)
99
+ }, n(t.method), 3)
100
+ ]),
101
+ e("td", J, n(t.model || "-"), 1),
102
+ e("td", {
103
+ class: "ss-dbg-event-time",
104
+ title: b(R)(t.timestamp)
105
+ }, n(b(z)(t.timestamp)), 9, O)
106
+ ]))), 128))
107
+ ])
108
+ ], 512))
109
+ ]));
110
+ }
111
+ });
112
+ export {
113
+ q as default
114
+ };
@@ -1,7 +1,7 @@
1
1
  import { defineComponent as I, computed as x, openBlock as l, createElementBlock as o, normalizeClass as v, createElementVNode as t, Fragment as f, renderList as B, normalizeStyle as U, toDisplayString as d, createTextVNode as k, createCommentVNode as p, inject as S, ref as m, watch as et, nextTick as at, onUnmounted as lt, createVNode as j, createBlock as G, unref as r } from "vue";
2
2
  import { initSplitPane as nt, formatTime as ot, timeAgo as it, normalizeTraceFields as dt, durationClassName as rt } from "adonisjs-server-stats/core";
3
3
  import { u as ut } from "./useApiClient-BQQ9CF-q.js";
4
- import { u as ct } from "./index-CM3yNVUR.js";
4
+ import { u as ct } from "./index-CYaqRGIT.js";
5
5
  import { u as ht } from "./useResizableTable-BoivAevK.js";
6
6
  import { _ as mt } from "./FilterBar.vue_vue_type_script_setup_true_lang-ClJ37hhT.js";
7
7
  import { _ as pt } from "./PaginationControls.vue_vue_type_script_setup_true_lang-CuN7g_8Z.js";
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as g, inject as d, ref as c, computed as A, openBlock as l, createElementBlock as o, createVNode as N, unref as u, createElementVNode as e, Fragment as R, renderList as S, normalizeClass as j, toDisplayString as a } from "vue";
2
- import { u as z } from "./index-CM3yNVUR.js";
2
+ import { u as z } from "./index-CYaqRGIT.js";
3
3
  import { u as C } from "./useResizableTable-BoivAevK.js";
4
4
  import { _ as D } from "./FilterBar.vue_vue_type_script_setup_true_lang-ClJ37hhT.js";
5
5
  const E = {
@@ -617,7 +617,7 @@ const wt = ["title", "aria-label"], Ct = ["viewBox", "innerHTML"], Tt = ["viewBo
617
617
  defaultOpen: { type: Boolean, default: !1 }
618
618
  },
619
619
  setup(e, { expose: s }) {
620
- const t = E(() => import("./QueriesTab-DuTG7cpC.js")), r = E(() => import("./EventsTab-BBM7olXF.js")), o = E(() => import("./EmailsTab-CNyEODVB.js")), c = E(() => import("./RoutesTab-Dz0MkZuF.js")), y = E(() => import("./LogsTab-47zEK7jL.js")), v = E(() => import("./TimelineTab-DHfXsX7t.js")), f = E(() => import("./CacheTab-BPisYYiQ.js")), S = E(() => import("./JobsTab-WFnxPdN7.js")), R = E(() => import("./ConfigTab-C8cafGUj.js")), P = E(() => import("./InternalsTab-DEMjqtlw.js")), b = E(() => import("./CustomPaneTab-Hr1IBHfz.js")), u = e, H = h(u.defaultOpen), g = h("queries"), { theme: I } = oe(), { features: x } = de({
620
+ const t = E(() => import("./QueriesTab-6D_xfi7Q.js")), r = E(() => import("./EventsTab-BBM7olXF.js")), o = E(() => import("./EmailsTab-CNyEODVB.js")), c = E(() => import("./RoutesTab-Dz0MkZuF.js")), y = E(() => import("./LogsTab-47zEK7jL.js")), v = E(() => import("./TimelineTab-DHfXsX7t.js")), f = E(() => import("./CacheTab-BPisYYiQ.js")), S = E(() => import("./JobsTab-WFnxPdN7.js")), R = E(() => import("./ConfigTab-C8cafGUj.js")), P = E(() => import("./InternalsTab-521fxYYj.js")), b = E(() => import("./CustomPaneTab-Hr1IBHfz.js")), u = e, H = h(u.defaultOpen), g = h("queries"), { theme: I } = oe(), { features: x } = de({
621
621
  baseUrl: u.baseUrl,
622
622
  debugEndpoint: u.debugEndpoint,
623
623
  authToken: u.authToken
@@ -976,7 +976,7 @@ const Qt = ["data-theme"], Jt = { class: "ss-dash-header" }, Wt = { class: "ss-d
976
976
  channelName: { default: "server-stats/dashboard" }
977
977
  },
978
978
  setup(e) {
979
- const s = E(() => import("./OverviewSection-BMabyqw-.js")), t = E(() => import("./RequestsSection-CTu4jPZ_.js")), r = E(() => import("./QueriesSection-BfDFwGqH.js")), o = E(() => import("./EventsSection-CxqtVF-o.js")), c = E(() => import("./RoutesSection-zQZDedL7.js")), y = E(() => import("./LogsSection-DmmZVJ7D.js")), v = E(() => import("./EmailsSection-B65g0FVS.js")), f = E(() => import("./CacheSection-DT2Mwf_s.js")), S = E(() => import("./JobsSection-rMIyMb-g.js")), R = E(() => import("./ConfigSection-BwKwS9lh.js")), P = E(() => import("./InternalsSection-BJUXE-5F.js")), b = [
979
+ const s = E(() => import("./OverviewSection-BRDK3Ony.js")), t = E(() => import("./RequestsSection-DLrjCfcE.js")), r = E(() => import("./QueriesSection-D2WGsuR4.js")), o = E(() => import("./EventsSection-BUEwO-0A.js")), c = E(() => import("./RoutesSection-CPr9w42B.js")), y = E(() => import("./LogsSection-BmOx8SNa.js")), v = E(() => import("./EmailsSection-BLwyQO7B.js")), f = E(() => import("./CacheSection-BAotiuQq.js")), S = E(() => import("./JobsSection-21A0yQMq.js")), R = E(() => import("./ConfigSection-JZjK5E5F.js")), P = E(() => import("./InternalsSection-jhTCuK3j.js")), b = [
980
980
  "overview",
981
981
  "requests",
982
982
  "queries",
package/dist/vue/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as s, b as r, c as u, u as t, d as D, e as b, f as g, g as o } from "./index-CM3yNVUR.js";
1
+ import { a as s, b as r, c as u, u as t, d as D, e as b, f as g, g as o } from "./index-CYaqRGIT.js";
2
2
  export {
3
3
  s as DashboardPage,
4
4
  r as DebugPanel,