adonisjs-server-stats 1.11.7 → 1.12.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 (69) hide show
  1. package/dist/core/explain-utils.d.ts +77 -0
  2. package/dist/core/index.d.ts +8 -2
  3. package/dist/core/index.js +1089 -877
  4. package/dist/core/queries-columns.d.ts +42 -0
  5. package/dist/core/queries-controller.d.ts +94 -0
  6. package/dist/core/query-utils.d.ts +49 -0
  7. package/dist/react/{CacheSection-DOUnyUrw.js → CacheSection-DZFOiOYH.js} +1 -1
  8. package/dist/react/{CacheTab-D9o6bsPc.js → CacheTab-D8js5o69.js} +1 -1
  9. package/dist/react/{ConfigSection-DzNC7pOJ.js → ConfigSection-DoJmvNkF.js} +1 -1
  10. package/dist/react/{ConfigTab-CT-Tu-ct.js → ConfigTab-CDvljuBF.js} +1 -1
  11. package/dist/react/{CustomPaneTab-CvIPe7NP.js → CustomPaneTab-Db9eIQ-9.js} +1 -1
  12. package/dist/react/{EmailsSection-B1LT7Nx3.js → EmailsSection-D7oxvAjA.js} +1 -1
  13. package/dist/react/{EmailsTab-DKxK322z.js → EmailsTab-BITuGTQm.js} +1 -1
  14. package/dist/react/{EventsSection-D3AK0mhw.js → EventsSection-7mDZv70I.js} +1 -1
  15. package/dist/react/{EventsTab-BRRSW6RI.js → EventsTab-DF13BChE.js} +1 -1
  16. package/dist/react/{JobsSection-BMvj5886.js → JobsSection-B_VJFWy6.js} +1 -1
  17. package/dist/react/{JobsTab-CQXWCrl8.js → JobsTab-DK8Fl9nz.js} +1 -1
  18. package/dist/react/{LogEntryRow-DFI52ZEw.js → LogEntryRow-Bdie9SFe.js} +1 -1
  19. package/dist/react/{LogsSection-CW2hQ976.js → LogsSection-CrWqxWRr.js} +2 -2
  20. package/dist/react/{LogsTab-CV4Gf_yb.js → LogsTab-DYSpL637.js} +2 -2
  21. package/dist/react/{OverviewSection-CxF9cabq.js → OverviewSection-CuaccMZt.js} +1 -1
  22. package/dist/react/QueriesContent-BDIx8zFn.js +288 -0
  23. package/dist/react/QueriesSection-CvGGh5Ij.js +117 -0
  24. package/dist/react/QueriesTab-C7CCwhVc.js +87 -0
  25. package/dist/react/{RequestsSection-Cb5YeqvI.js → RequestsSection-mENyeNsk.js} +2 -2
  26. package/dist/react/{RoutesSection-B43olD9v.js → RoutesSection-DjovlaNS.js} +1 -1
  27. package/dist/react/{RoutesTab-RfhCUbkx.js → RoutesTab-CbQECiUc.js} +1 -1
  28. package/dist/react/{SplitPaneWrapper-B05Mg6Sg.js → SplitPaneWrapper-DyRyH5Re.js} +1 -1
  29. package/dist/react/{TimelineTab-Dx4686Ti.js → TimelineTab-BKTFbsPe.js} +2 -2
  30. package/dist/react/components/shared/QueriesContent.d.ts +33 -0
  31. package/dist/react/{index-C4EMJrkH.js → index-CAUHa8QX.js} +2 -2
  32. package/dist/react/index.js +1 -1
  33. package/dist/react/style.css +1 -1
  34. package/dist/src/dashboard/query_explain_handler.d.ts +11 -0
  35. package/dist/src/dashboard/query_explain_handler.js +64 -11
  36. package/dist/src/debug/query_collector.d.ts +1 -0
  37. package/dist/src/debug/query_collector.js +3 -0
  38. package/dist/src/edge/client/dashboard.js +2 -2
  39. package/dist/src/edge/client/debug-panel-deferred.js +1 -1
  40. package/dist/src/edge/client-vue/dashboard.js +4 -4
  41. package/dist/src/edge/client-vue/debug-panel-deferred.js +2 -2
  42. package/dist/src/provider/server_stats_provider.js +2 -0
  43. package/dist/src/routes/debug_routes.d.ts +4 -0
  44. package/dist/src/routes/debug_routes.js +45 -0
  45. package/dist/src/routes/register_routes.d.ts +4 -0
  46. package/dist/src/routes/register_routes.js +2 -0
  47. package/dist/src/styles/components.css +238 -0
  48. package/dist/src/styles/dashboard.css +6 -173
  49. package/dist/src/styles/debug-panel.css +2 -24
  50. package/dist/vue/{CacheSection-BAotiuQq.js → CacheSection-Bx41lpfK.js} +1 -1
  51. package/dist/vue/{ConfigSection-JZjK5E5F.js → ConfigSection-fkfUdCmx.js} +1 -1
  52. package/dist/vue/{EmailsSection-BLwyQO7B.js → EmailsSection-CbcDKF9Q.js} +1 -1
  53. package/dist/vue/{EventsSection-BUEwO-0A.js → EventsSection-CWbTYOBi.js} +1 -1
  54. package/dist/vue/{JobsSection-21A0yQMq.js → JobsSection-CGGO6rtS.js} +1 -1
  55. package/dist/vue/{LogsSection-BmOx8SNa.js → LogsSection-BPB-C-XA.js} +1 -1
  56. package/dist/vue/{OverviewSection-BRDK3Ony.js → OverviewSection-BTcnPeoM.js} +1 -1
  57. package/dist/vue/QueriesSection-2SE3igQJ.js +411 -0
  58. package/dist/vue/QueriesTab-DO5XwJ--.js +112 -0
  59. package/dist/vue/{RequestsSection-DLrjCfcE.js → RequestsSection-DXcG5Zok.js} +1 -1
  60. package/dist/vue/{RoutesSection-CPr9w42B.js → RoutesSection-BkNGWdoP.js} +1 -1
  61. package/dist/vue/components/Dashboard/sections/QueriesSection.vue.d.ts +1 -41
  62. package/dist/vue/{index-CYaqRGIT.js → index-CptF6Qbp.js} +2 -2
  63. package/dist/vue/index.js +1 -1
  64. package/dist/vue/style.css +1 -1
  65. package/package.json +1 -1
  66. package/dist/react/QueriesSection-CZJ-imAb.js +0 -474
  67. package/dist/react/QueriesTab-CQHa1ck3.js +0 -97
  68. package/dist/vue/QueriesSection-D2WGsuR4.js +0 -444
  69. package/dist/vue/QueriesTab-6D_xfi7Q.js +0 -114
@@ -1,6 +1,6 @@
1
1
  import { defineComponent as ws, openBlock as o, createElementBlock as n, Fragment as _, renderList as k, createElementVNode as s, normalizeClass as b, toDisplayString as r, inject as P, ref as D, watch as fs, computed as d, onUnmounted as Ws, unref as x, createVNode as N, createCommentVNode as v, normalizeStyle as ts, createTextVNode as gs } from "vue";
2
2
  import { formatDuration as F, formatTime as Os, timeAgo as Hs, durationClassName as Ks } from "adonisjs-server-stats/core";
3
- import { u as xs, _ as U } from "./index-CYaqRGIT.js";
3
+ import { u as xs, _ as U } from "./index-CptF6Qbp.js";
4
4
  const Gs = { class: "ss-dash-btn-group" }, Xs = ["onClick"], Ys = /* @__PURE__ */ ws({
5
5
  __name: "TimeRangeSelector",
6
6
  props: {
@@ -0,0 +1,411 @@
1
+ import { defineComponent as he, inject as z, ref as T, computed as c, openBlock as a, createElementBlock as l, createVNode as me, withCtx as ve, createElementVNode as s, normalizeClass as v, unref as d, Fragment as u, renderList as _, createTextVNode as h, toDisplayString as o, createCommentVNode as p, withKeys as G, withModifiers as F, normalizeStyle as H, createBlock as ye } from "vue";
2
+ import { QueriesController as fe, getDashboardListColumns as _e, getDashboardGroupedColumns as xe, resolveField as g, normalizeDashboardQuery as ge, buildSqlCounts as ke, computeDashboardQuerySummary as be, formatTime as we, timeAgo as Ce, formatCellValue as De, flattenPlanTree as Ee, getExplainColumns as $e, hasNestedPlan as Se, durationClassName as ze } from "adonisjs-server-stats/core";
3
+ import { u as Ne } from "./index-CptF6Qbp.js";
4
+ import { u as Pe } from "./useResizableTable-BoivAevK.js";
5
+ import { _ as Te } from "./FilterBar.vue_vue_type_script_setup_true_lang-ClJ37hhT.js";
6
+ import { _ as Fe } from "./PaginationControls.vue_vue_type_script_setup_true_lang-CuN7g_8Z.js";
7
+ const Le = { class: "ss-dash-btn-group" }, Qe = {
8
+ key: 0,
9
+ class: "ss-dash-empty"
10
+ }, Ve = {
11
+ key: 1,
12
+ class: "ss-dash-table-wrap"
13
+ }, Re = ["onClick"], je = {
14
+ key: 0,
15
+ class: "ss-dash-sort-arrow"
16
+ }, Ke = ["onClick", "onKeydown"], Me = {
17
+ key: 0,
18
+ class: "ss-dash-dup"
19
+ }, Oe = { style: { color: "var(--ss-muted)", "text-align": "center", display: "block" } }, Ae = { class: "ss-dash-duration" }, Be = { class: "ss-dash-duration" }, Ue = { style: { color: "var(--ss-muted)", "text-align": "center", display: "block" } }, Ge = {
20
+ key: 1,
21
+ class: "ss-dash-empty"
22
+ }, He = { class: "ss-dash-table-wrap" }, Xe = ["onClick"], Je = {
23
+ key: 0,
24
+ class: "ss-dash-sort-arrow"
25
+ }, We = { key: 1 }, Ye = { style: { color: "var(--ss-dim)" } }, Ze = ["onClick", "onKeydown"], Ie = {
26
+ key: 0,
27
+ class: "ss-dash-dup"
28
+ }, qe = ["title"], et = { style: { color: "var(--ss-dim)", overflow: "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" } }, tt = ["title"], st = ["disabled", "onClick"], nt = {
29
+ key: 0,
30
+ class: "ss-dash-explain-row"
31
+ }, at = {
32
+ colspan: "8",
33
+ class: "ss-dash-explain"
34
+ }, lt = { style: { display: "flex", "justify-content": "space-between", "align-items": "start" } }, ot = { style: { flex: "1" } }, rt = {
35
+ key: 0,
36
+ class: "ss-dash-explain-result ss-dash-explain-error"
37
+ }, it = { key: 0 }, ut = {
38
+ key: 1,
39
+ class: "ss-dash-explain-result"
40
+ }, dt = { class: "ss-dash-explain-node-header" }, ct = { class: "ss-dash-explain-node-type" }, pt = {
41
+ key: 0,
42
+ class: "ss-dash-explain-metrics"
43
+ }, ht = {
44
+ key: 2,
45
+ class: "ss-dash-explain-result"
46
+ }, mt = {
47
+ key: 3,
48
+ class: "ss-dash-explain-result"
49
+ }, vt = ["onClick"], yt = {
50
+ key: 1,
51
+ class: "ss-dash-empty"
52
+ }, Ct = /* @__PURE__ */ he({
53
+ __name: "QueriesSection",
54
+ setup(ft) {
55
+ const X = z("ss-refresh-key", T(0)), J = z("ss-dashboard-endpoint", "/__stats/api"), W = z("ss-auth-token", void 0), Y = z("ss-base-url", ""), i = new fe("list"), x = T(0);
56
+ function k() {
57
+ x.value++;
58
+ }
59
+ const y = c(() => (x.value, i.state.viewMode));
60
+ c(() => (x.value, i.state.expandedIds)), c(() => (x.value, i.state.explainData));
61
+ const L = c(() => _e()), Z = c(() => xe()), I = c(() => y.value === "grouped" ? "queries/grouped" : "queries"), { data: w, loading: q, pagination: C, sort: E, goToPage: ee, setSearch: te, setSort: se, explainQuery: ne } = Ne(() => I.value, {
62
+ baseUrl: Y,
63
+ dashboardEndpoint: J,
64
+ authToken: W,
65
+ refreshKey: X
66
+ }), Q = T(""), D = c(() => w.value ? y.value === "grouped" ? w.value.groups || [] : w.value.data || w.value || [] : []), $ = c(() => y.value !== "grouped" ? D.value : D.value.map((n) => {
67
+ const t = { ...n };
68
+ return (t.sqlNormalized === null || t.sqlNormalized === void 0) && (t.sqlNormalized = g(n, "sql_normalized", "pattern") ?? ""), (t.count === null || t.count === void 0) && (t.count = g(n, "total_count") ?? void 0), (t.avgDuration === null || t.avgDuration === void 0) && (t.avgDuration = g(n, "avg_duration") ?? void 0), (t.maxDuration === null || t.maxDuration === void 0) && (t.maxDuration = g(n, "max_duration") ?? void 0), (t.minDuration === null || t.minDuration === void 0) && (t.minDuration = g(n, "min_duration") ?? void 0), (t.totalDuration === null || t.totalDuration === void 0) && (t.totalDuration = g(n, "total_duration") ?? void 0), (t.percentOfTotal === null || t.percentOfTotal === void 0) && (t.percentOfTotal = g(n, "pct_time") ?? void 0), t;
69
+ })), V = c(() => y.value !== "list" ? [] : D.value.map((n) => ge(n))), R = c(() => ke(D.value)), b = c(() => be(D.value, {
70
+ total: C.total
71
+ })), ae = c(() => {
72
+ if (y.value === "grouped") return `${$.value.length} query patterns`;
73
+ const n = [`${b.value.totalCount} queries`];
74
+ return b.value.slowCount > 0 && n.push(`${b.value.slowCount} slow`), b.value.dupCount > 0 && n.push(`${b.value.dupCount} dup`), n.push(`avg ${(b.value.avgDuration || 0).toFixed(1)}ms`), n.join(", ");
75
+ });
76
+ function le(n) {
77
+ Q.value = n, te(n);
78
+ }
79
+ function j(n) {
80
+ n !== y.value && (i.setViewMode(n), k());
81
+ }
82
+ function K(n) {
83
+ se(n);
84
+ }
85
+ function M(n) {
86
+ return x.value, i.isExpanded(n);
87
+ }
88
+ function S(n) {
89
+ i.toggleExpand(n), k();
90
+ }
91
+ async function oe(n) {
92
+ const t = i.getExplainState(n);
93
+ if (t && !t.loading) {
94
+ i.state.explainData.delete(n), k();
95
+ return;
96
+ }
97
+ i.startExplain(n), k();
98
+ try {
99
+ const e = await ne(n);
100
+ e && e.error ? i.completeExplain(n, { rows: [], error: e.error, message: e.message }) : i.completeExplain(n, {
101
+ plan: e?.plan,
102
+ rows: e?.rows
103
+ });
104
+ } catch (e) {
105
+ i.failExplain(n, e instanceof Error ? e.message : String(e));
106
+ }
107
+ k();
108
+ }
109
+ function m(n) {
110
+ return x.value, i.getExplainState(n);
111
+ }
112
+ function O(n) {
113
+ return x.value, i.getExplainState(n)?.loading ?? !1;
114
+ }
115
+ function re(n) {
116
+ x.value;
117
+ const t = i.getExplainState(n);
118
+ return !!t && !t.loading && !t.error && !!t.result;
119
+ }
120
+ function ie(n) {
121
+ i.state.explainData.delete(n), k();
122
+ }
123
+ function ue(n) {
124
+ const t = m(n);
125
+ if (!t?.result) return [];
126
+ const e = t.result.plan || t.result.rows;
127
+ if (!e || e.length === 0) return [];
128
+ const f = e[0];
129
+ return !f || typeof f != "object" ? [] : "Plan" in f ? Ee(f.Plan) : [];
130
+ }
131
+ function A(n) {
132
+ const t = m(n);
133
+ if (!t?.result) return [];
134
+ const e = t.result.plan || t.result.rows;
135
+ return !e || e.length === 0 ? [] : $e(e);
136
+ }
137
+ function de(n) {
138
+ const t = m(n);
139
+ return t?.result ? t.result.plan || t.result.rows || [] : [];
140
+ }
141
+ function ce(n) {
142
+ const t = m(n);
143
+ if (!t?.result) return !1;
144
+ const e = t.result.plan || t.result.rows;
145
+ return !e || e.length === 0 ? !1 : Se(e[0]);
146
+ }
147
+ function pe(n) {
148
+ const t = m(n);
149
+ if (!t?.result) return !1;
150
+ const e = t.result.plan || t.result.rows;
151
+ return !!e && e.length > 0 && typeof e[0] == "object";
152
+ }
153
+ function N(n) {
154
+ return ze(n, "ss-dash");
155
+ }
156
+ const { tableRef: B } = Pe(() => $.value);
157
+ return (n, t) => (a(), l("div", null, [
158
+ me(Te, {
159
+ "model-value": Q.value,
160
+ placeholder: "Filter queries...",
161
+ summary: ae.value,
162
+ "onUpdate:modelValue": le
163
+ }, {
164
+ default: ve(() => [
165
+ s("div", Le, [
166
+ s("button", {
167
+ type: "button",
168
+ class: v(`ss-dash-btn ${y.value === "list" ? "ss-dash-active" : ""}`),
169
+ onClick: t[0] || (t[0] = (e) => j("list"))
170
+ }, " List ", 2),
171
+ s("button", {
172
+ type: "button",
173
+ class: v(`ss-dash-btn ${y.value === "grouped" ? "ss-dash-active" : ""}`),
174
+ onClick: t[1] || (t[1] = (e) => j("grouped"))
175
+ }, " Grouped ", 2)
176
+ ])
177
+ ]),
178
+ _: 1
179
+ }, 8, ["model-value", "summary"]),
180
+ d(q) && !d(w) ? (a(), l("div", Qe, "Loading queries...")) : y.value === "grouped" ? (a(), l("div", Ve, [
181
+ $.value.length > 0 ? (a(), l("table", {
182
+ key: 0,
183
+ ref_key: "tableRef",
184
+ ref: B,
185
+ class: "ss-dash-table"
186
+ }, [
187
+ s("thead", null, [
188
+ s("tr", null, [
189
+ (a(!0), l(u, null, _(Z.value, (e) => (a(), l("th", {
190
+ key: e.key,
191
+ class: v(e.sortable ? "ss-dash-sortable" : ""),
192
+ onClick: (f) => e.sortable ? K(e.key) : void 0
193
+ }, [
194
+ h(o(e.label) + " ", 1),
195
+ e.sortable && d(E).column === e.key ? (a(), l("span", je, o(d(E).direction === "asc" ? " ▲" : " ▼"), 1)) : p("", !0)
196
+ ], 10, Re))), 128))
197
+ ])
198
+ ]),
199
+ s("tbody", null, [
200
+ (a(!0), l(u, null, _($.value, (e, f) => (a(), l("tr", { key: f }, [
201
+ s("td", null, [
202
+ s("span", {
203
+ class: v(`ss-dash-sql ${M(e.sqlNormalized) ? "ss-dash-expanded" : ""}`),
204
+ title: "Click to expand",
205
+ role: "button",
206
+ tabindex: "0",
207
+ onClick: F((r) => S(e.sqlNormalized), ["stop"]),
208
+ onKeydown: G((r) => S(e.sqlNormalized), ["enter"])
209
+ }, o(e.sqlNormalized), 43, Ke),
210
+ (e.count || 0) >= 3 ? (a(), l("span", Me, "DUP")) : p("", !0)
211
+ ]),
212
+ s("td", null, [
213
+ s("span", Oe, o(e.count || 0), 1)
214
+ ]),
215
+ s("td", null, [
216
+ s("span", {
217
+ class: v(`ss-dash-duration ${N(e.avgDuration || 0)}`)
218
+ }, o((e.avgDuration || 0).toFixed(2)) + "ms ", 3)
219
+ ]),
220
+ s("td", null, [
221
+ s("span", Ae, o((e.minDuration || 0).toFixed(2)) + "ms", 1)
222
+ ]),
223
+ s("td", null, [
224
+ s("span", {
225
+ class: v(`ss-dash-duration ${N(e.maxDuration || 0)}`)
226
+ }, o((e.maxDuration || 0).toFixed(2)) + "ms ", 3)
227
+ ]),
228
+ s("td", null, [
229
+ s("span", Be, o((e.totalDuration || 0).toFixed(1)) + "ms", 1)
230
+ ]),
231
+ s("td", null, [
232
+ s("span", Ue, o((e.percentOfTotal || 0).toFixed(1)) + "%", 1)
233
+ ])
234
+ ]))), 128))
235
+ ])
236
+ ], 512)) : (a(), l("div", Ge, [...t[2] || (t[2] = [
237
+ s("span", null, "No queries recorded", -1),
238
+ s("span", { class: "ss-empty-hint" }, [
239
+ h(" Queries require "),
240
+ s("code", null, "debug: true"),
241
+ h(" on your Lucid connections in "),
242
+ s("code", null, "config/database.ts")
243
+ ], -1)
244
+ ])]))
245
+ ])) : (a(), l(u, { key: 2 }, [
246
+ s("div", He, [
247
+ V.value.length > 0 ? (a(), l("table", {
248
+ key: 0,
249
+ ref_key: "tableRef",
250
+ ref: B,
251
+ class: "ss-dash-table"
252
+ }, [
253
+ s("colgroup", null, [
254
+ (a(!0), l(u, null, _(L.value, (e) => (a(), l("col", {
255
+ key: e.key + e.type,
256
+ style: H(e.width ? { width: e.width } : {})
257
+ }, null, 4))), 128))
258
+ ]),
259
+ s("thead", null, [
260
+ s("tr", null, [
261
+ (a(!0), l(u, null, _(L.value, (e) => (a(), l(u, {
262
+ key: e.key + e.type
263
+ }, [
264
+ e.sortable ? (a(), l("th", {
265
+ key: 0,
266
+ class: "ss-dash-sortable",
267
+ onClick: (f) => K(e.key)
268
+ }, [
269
+ h(o(e.label) + " ", 1),
270
+ d(E).column === e.key ? (a(), l("span", Je, o(d(E).direction === "asc" ? " ▲" : " ▼"), 1)) : p("", !0)
271
+ ], 8, Xe)) : (a(), l("th", We, o(e.label), 1))
272
+ ], 64))), 128))
273
+ ])
274
+ ]),
275
+ s("tbody", null, [
276
+ (a(!0), l(u, null, _(V.value, (e, f) => (a(), l(u, {
277
+ key: e.id
278
+ }, [
279
+ s("tr", null, [
280
+ s("td", null, [
281
+ s("span", Ye, o(e.id), 1)
282
+ ]),
283
+ s("td", null, [
284
+ s("div", null, [
285
+ s("span", {
286
+ class: v(`ss-dash-sql ${M(e.id) ? "ss-dash-expanded" : ""}`),
287
+ title: "Click to expand",
288
+ role: "button",
289
+ tabindex: "0",
290
+ onClick: F((r) => S(e.id), ["stop"]),
291
+ onKeydown: G((r) => S(e.id), ["enter"])
292
+ }, o(e.sql), 43, Ze),
293
+ (R.value.get(e.sqlNormalized) ?? 0) > 1 ? (a(), l("span", Ie, " ×" + o(R.value.get(e.sqlNormalized)), 1)) : p("", !0)
294
+ ])
295
+ ]),
296
+ s("td", null, [
297
+ s("span", {
298
+ class: v(`ss-dash-duration ${N(e.duration)}`)
299
+ }, o(e.duration.toFixed(2)) + "ms ", 3)
300
+ ]),
301
+ s("td", null, [
302
+ s("span", {
303
+ class: v(`ss-dash-method ss-dash-method-${e.method.toLowerCase()}`)
304
+ }, o(e.method), 3)
305
+ ]),
306
+ s("td", null, [
307
+ s("span", {
308
+ style: { color: "var(--ss-muted)", overflow: "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" },
309
+ title: e.model
310
+ }, o(e.model || "-"), 9, qe)
311
+ ]),
312
+ s("td", null, [
313
+ s("span", et, o(e.connection || "-"), 1)
314
+ ]),
315
+ s("td", null, [
316
+ s("span", {
317
+ class: "ss-dash-event-time",
318
+ title: d(we)(String(e.timestamp))
319
+ }, o(d(Ce)(String(e.timestamp))), 9, tt)
320
+ ]),
321
+ s("td", null, [
322
+ e.method === "select" ? (a(), l("button", {
323
+ key: 0,
324
+ type: "button",
325
+ class: v(`ss-dash-explain-btn${re(e.id) ? " ss-dash-explain-btn-active" : ""}`),
326
+ disabled: O(e.id),
327
+ onClick: F((r) => oe(e.id), ["stop"])
328
+ }, o(O(e.id) ? "..." : "EXPLAIN"), 11, st)) : p("", !0)
329
+ ])
330
+ ]),
331
+ m(e.id) ? (a(), l("tr", nt, [
332
+ s("td", at, [
333
+ s("div", lt, [
334
+ s("div", ot, [
335
+ m(e.id)?.error ? (a(), l("div", rt, [
336
+ t[3] || (t[3] = s("strong", null, "Error:", -1)),
337
+ h(" " + o(m(e.id)?.error) + " ", 1),
338
+ m(e.id)?.result?.message ? (a(), l("br", it)) : p("", !0),
339
+ h(" " + o(m(e.id)?.result?.message), 1)
340
+ ])) : ce(e.id) ? (a(), l("div", ut, [
341
+ (a(!0), l(u, null, _(ue(e.id), (r, P) => (a(), l("div", {
342
+ key: P,
343
+ class: "ss-dash-explain-node",
344
+ style: H({ marginLeft: `${r.depth * 20}px` })
345
+ }, [
346
+ s("div", dt, [
347
+ s("span", ct, o(r.nodeType), 1),
348
+ r.relationName ? (a(), l(u, { key: 0 }, [
349
+ t[4] || (t[4] = h(o(" on "), -1)),
350
+ s("strong", null, o(r.relationName), 1)
351
+ ], 64)) : p("", !0),
352
+ r.alias ? (a(), l(u, { key: 1 }, [
353
+ h(o(` (${r.alias})`), 1)
354
+ ], 64)) : p("", !0),
355
+ r.indexName ? (a(), l(u, { key: 2 }, [
356
+ t[5] || (t[5] = h(o(" using "), -1)),
357
+ s("em", null, o(r.indexName), 1)
358
+ ], 64)) : p("", !0)
359
+ ]),
360
+ r.metrics.length > 0 ? (a(), l("div", pt, o(r.metrics.join(" · ")), 1)) : p("", !0)
361
+ ], 4))), 128))
362
+ ])) : pe(e.id) ? (a(), l("div", ht, [
363
+ s("table", null, [
364
+ s("thead", null, [
365
+ s("tr", null, [
366
+ (a(!0), l(u, null, _(A(e.id), (r) => (a(), l("th", { key: r }, o(r), 1))), 128))
367
+ ])
368
+ ]),
369
+ s("tbody", null, [
370
+ (a(!0), l(u, null, _(de(e.id), (r, P) => (a(), l("tr", { key: P }, [
371
+ (a(!0), l(u, null, _(A(e.id), (U) => (a(), l("td", { key: U }, o(d(De)(r[U])), 1))), 128))
372
+ ]))), 128))
373
+ ])
374
+ ])
375
+ ])) : (a(), l("div", mt, "No plan data returned"))
376
+ ]),
377
+ s("button", {
378
+ type: "button",
379
+ class: "ss-dash-explain-btn",
380
+ style: { "margin-left": "8px", "flex-shrink": "0" },
381
+ onClick: (r) => ie(e.id)
382
+ }, " Close ", 8, vt)
383
+ ])
384
+ ])
385
+ ])) : p("", !0)
386
+ ], 64))), 128))
387
+ ])
388
+ ], 512)) : (a(), l("div", yt, [...t[6] || (t[6] = [
389
+ s("span", null, "No queries recorded", -1),
390
+ s("span", { class: "ss-empty-hint" }, [
391
+ h(" Queries require "),
392
+ s("code", null, "debug: true"),
393
+ h(" on your Lucid connections in "),
394
+ s("code", null, "config/database.ts")
395
+ ], -1)
396
+ ])]))
397
+ ]),
398
+ d(C).totalPages > 1 ? (a(), ye(Fe, {
399
+ key: 0,
400
+ page: d(C).page,
401
+ "last-page": d(C).totalPages,
402
+ total: d(C).total,
403
+ onPageChange: d(ee)
404
+ }, null, 8, ["page", "last-page", "total", "onPageChange"])) : p("", !0)
405
+ ], 64))
406
+ ]));
407
+ }
408
+ });
409
+ export {
410
+ Ct as default
411
+ };
@@ -0,0 +1,112 @@
1
+ import { defineComponent as A, ref as f, computed as o, openBlock as n, createElementBlock as a, createElementVNode as t, withDirectives as K, vModelText as L, toDisplayString as l, createTextVNode as _, Fragment as C, renderList as k, withKeys as R, normalizeClass as p, createCommentVNode as x, unref as v } from "vue";
2
+ import { QueriesController as S, getDebugPaneColumns as z, filterQueries as B, countDuplicateQueries as F, computeQuerySummary as P, formatDuration as w, formatTime as M, timeAgo as U, durationClassName as X } from "adonisjs-server-stats/core";
3
+ import { u as j } from "./useResizableTable-BoivAevK.js";
4
+ const G = { class: "ss-dbg-search-bar" }, H = { class: "ss-dbg-summary" }, I = {
5
+ key: 0,
6
+ class: "ss-dbg-empty"
7
+ }, J = {
8
+ class: "ss-dbg-c-dim",
9
+ style: { "white-space": "nowrap" }
10
+ }, O = ["onClick", "onKeydown"], W = {
11
+ key: 0,
12
+ class: "ss-dbg-dup"
13
+ }, Y = {
14
+ key: 1,
15
+ class: "ss-dbg-dup"
16
+ }, Z = { class: "ss-dbg-c-muted" }, q = ["title"], ne = /* @__PURE__ */ A({
17
+ __name: "QueriesTab",
18
+ props: {
19
+ data: {},
20
+ dashboardPath: {}
21
+ },
22
+ setup(Q) {
23
+ const b = Q, i = f(""), g = new S(), y = f(0);
24
+ function h(s) {
25
+ g.toggleExpand(s), y.value++;
26
+ }
27
+ function T(s) {
28
+ return y.value, g.isExpanded(s);
29
+ }
30
+ const $ = o(() => z()), c = o(() => {
31
+ if (!b.data) return [];
32
+ const s = b.data;
33
+ return (Array.isArray(s) ? s : s.queries) || [];
34
+ }), u = o(() => B(c.value, i.value)), m = o(() => F(c.value)), r = o(() => P(c.value, m.value)), D = o(() => {
35
+ let s = `${u.value.length} queries`;
36
+ return r.value.slowCount > 0 && (s += ` | ${r.value.slowCount} slow`), r.value.dupCount > 0 && (s += ` | ${r.value.dupCount} dup`), u.value.length > 0 && (s += ` | avg ${w(r.value.avgDuration)}`), s;
37
+ });
38
+ function E(s) {
39
+ return X(s, "ss-dbg");
40
+ }
41
+ const { tableRef: N } = j(() => u.value);
42
+ return (s, d) => (n(), a("div", null, [
43
+ t("div", G, [
44
+ K(t("input", {
45
+ "onUpdate:modelValue": d[0] || (d[0] = (e) => i.value = e),
46
+ class: "ss-dbg-search",
47
+ placeholder: "Filter queries...",
48
+ type: "text"
49
+ }, null, 512), [
50
+ [L, i.value]
51
+ ]),
52
+ t("span", H, l(D.value), 1)
53
+ ]),
54
+ u.value.length === 0 ? (n(), a("div", I, [...d[1] || (d[1] = [
55
+ t("span", null, "No queries captured", -1),
56
+ t("span", { class: "ss-empty-hint" }, [
57
+ _(" Queries require "),
58
+ t("code", null, "debug: true"),
59
+ _(" on your Lucid connections in "),
60
+ t("code", null, "config/database.ts")
61
+ ], -1)
62
+ ])])) : (n(), a("table", {
63
+ key: 1,
64
+ ref_key: "tableRef",
65
+ ref: N,
66
+ class: "ss-dbg-table"
67
+ }, [
68
+ t("thead", null, [
69
+ t("tr", null, [
70
+ (n(!0), a(C, null, k($.value, (e) => (n(), a("th", {
71
+ key: e.key + e.type
72
+ }, l(e.label), 1))), 128))
73
+ ])
74
+ ]),
75
+ t("tbody", null, [
76
+ (n(!0), a(C, null, k(u.value, (e) => (n(), a("tr", {
77
+ key: e.id
78
+ }, [
79
+ t("td", J, l(e.id), 1),
80
+ t("td", null, [
81
+ t("span", {
82
+ class: p(["ss-dbg-sql", { "ss-dbg-expanded": T(e.id) }]),
83
+ role: "button",
84
+ tabindex: "0",
85
+ onClick: (V) => h(e.id),
86
+ onKeydown: R((V) => h(e.id), ["enter"])
87
+ }, l(e.sql), 43, O),
88
+ m.value[e.sql] > 1 ? (n(), a("span", W, " x" + l(m.value[e.sql]), 1)) : x("", !0),
89
+ e.inTransaction ? (n(), a("span", Y, " TXN")) : x("", !0)
90
+ ]),
91
+ t("td", {
92
+ class: p(["ss-dbg-duration", E(e.duration)])
93
+ }, l(v(w)(e.duration)), 3),
94
+ t("td", null, [
95
+ t("span", {
96
+ class: p(`ss-dbg-method ss-dbg-method-${e.method.toLowerCase()}`)
97
+ }, l(e.method), 3)
98
+ ]),
99
+ t("td", Z, l(e.model || "-"), 1),
100
+ t("td", {
101
+ class: "ss-dbg-event-time",
102
+ title: v(M)(e.timestamp)
103
+ }, l(v(U)(e.timestamp)), 9, q)
104
+ ]))), 128))
105
+ ])
106
+ ], 512))
107
+ ]));
108
+ }
109
+ });
110
+ export {
111
+ ne as default
112
+ };
@@ -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-CYaqRGIT.js";
4
+ import { u as ct } from "./index-CptF6Qbp.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-CYaqRGIT.js";
2
+ import { u as z } from "./index-CptF6Qbp.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 = {
@@ -1,44 +1,4 @@
1
- import { PropType, VNode } from 'vue';
2
- interface PlanNode {
3
- 'Node Type'?: string;
4
- 'Relation Name'?: string;
5
- Alias?: string;
6
- 'Index Name'?: string;
7
- 'Startup Cost'?: number | null;
8
- 'Total Cost'?: number | null;
9
- 'Plan Rows'?: number | null;
10
- 'Plan Width'?: number | null;
11
- Filter?: string;
12
- 'Index Cond'?: string;
13
- 'Hash Cond'?: string;
14
- 'Join Type'?: string;
15
- 'Sort Key'?: string | string[];
16
- Plans?: PlanNode[];
17
- [key: string]: unknown;
18
- }
19
- declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {
20
- ExplainPlanNode: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
21
- node: {
22
- type: PropType<PlanNode>;
23
- required: true;
24
- };
25
- depth: {
26
- type: NumberConstructor;
27
- default: number;
28
- };
29
- }>, () => VNode | null, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
30
- node: {
31
- type: PropType<PlanNode>;
32
- required: true;
33
- };
34
- depth: {
35
- type: NumberConstructor;
36
- default: number;
37
- };
38
- }>> & Readonly<{}>, {
39
- depth: number;
40
- }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
41
- }, {}, string, import('vue').ComponentProvideOptions, true, {
1
+ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
42
2
  tableRef: HTMLTableElement;
43
3
  }, HTMLDivElement>;
44
4
  export default _default;
@@ -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-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({
620
+ const t = E(() => import("./QueriesTab-DO5XwJ--.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-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 = [
979
+ const s = E(() => import("./OverviewSection-BTcnPeoM.js")), t = E(() => import("./RequestsSection-DXcG5Zok.js")), r = E(() => import("./QueriesSection-2SE3igQJ.js")), o = E(() => import("./EventsSection-CWbTYOBi.js")), c = E(() => import("./RoutesSection-BkNGWdoP.js")), y = E(() => import("./LogsSection-BPB-C-XA.js")), v = E(() => import("./EmailsSection-CbcDKF9Q.js")), f = E(() => import("./CacheSection-Bx41lpfK.js")), S = E(() => import("./JobsSection-CGGO6rtS.js")), R = E(() => import("./ConfigSection-fkfUdCmx.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-CYaqRGIT.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-CptF6Qbp.js";
2
2
  export {
3
3
  s as DashboardPage,
4
4
  r as DebugPanel,