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.
- package/dist/core/explain-utils.d.ts +77 -0
- package/dist/core/index.d.ts +8 -2
- package/dist/core/index.js +1089 -877
- package/dist/core/queries-columns.d.ts +42 -0
- package/dist/core/queries-controller.d.ts +94 -0
- package/dist/core/query-utils.d.ts +49 -0
- package/dist/react/{CacheSection-DOUnyUrw.js → CacheSection-DZFOiOYH.js} +1 -1
- package/dist/react/{CacheTab-D9o6bsPc.js → CacheTab-D8js5o69.js} +1 -1
- package/dist/react/{ConfigSection-DzNC7pOJ.js → ConfigSection-DoJmvNkF.js} +1 -1
- package/dist/react/{ConfigTab-CT-Tu-ct.js → ConfigTab-CDvljuBF.js} +1 -1
- package/dist/react/{CustomPaneTab-CvIPe7NP.js → CustomPaneTab-Db9eIQ-9.js} +1 -1
- package/dist/react/{EmailsSection-B1LT7Nx3.js → EmailsSection-D7oxvAjA.js} +1 -1
- package/dist/react/{EmailsTab-DKxK322z.js → EmailsTab-BITuGTQm.js} +1 -1
- package/dist/react/{EventsSection-D3AK0mhw.js → EventsSection-7mDZv70I.js} +1 -1
- package/dist/react/{EventsTab-BRRSW6RI.js → EventsTab-DF13BChE.js} +1 -1
- package/dist/react/{JobsSection-BMvj5886.js → JobsSection-B_VJFWy6.js} +1 -1
- package/dist/react/{JobsTab-CQXWCrl8.js → JobsTab-DK8Fl9nz.js} +1 -1
- package/dist/react/{LogEntryRow-DFI52ZEw.js → LogEntryRow-Bdie9SFe.js} +1 -1
- package/dist/react/{LogsSection-CW2hQ976.js → LogsSection-CrWqxWRr.js} +2 -2
- package/dist/react/{LogsTab-CV4Gf_yb.js → LogsTab-DYSpL637.js} +2 -2
- package/dist/react/{OverviewSection-CxF9cabq.js → OverviewSection-CuaccMZt.js} +1 -1
- package/dist/react/QueriesContent-BDIx8zFn.js +288 -0
- package/dist/react/QueriesSection-CvGGh5Ij.js +117 -0
- package/dist/react/QueriesTab-C7CCwhVc.js +87 -0
- package/dist/react/{RequestsSection-Cb5YeqvI.js → RequestsSection-mENyeNsk.js} +2 -2
- package/dist/react/{RoutesSection-B43olD9v.js → RoutesSection-DjovlaNS.js} +1 -1
- package/dist/react/{RoutesTab-RfhCUbkx.js → RoutesTab-CbQECiUc.js} +1 -1
- package/dist/react/{SplitPaneWrapper-B05Mg6Sg.js → SplitPaneWrapper-DyRyH5Re.js} +1 -1
- package/dist/react/{TimelineTab-Dx4686Ti.js → TimelineTab-BKTFbsPe.js} +2 -2
- package/dist/react/components/shared/QueriesContent.d.ts +33 -0
- package/dist/react/{index-C4EMJrkH.js → index-CAUHa8QX.js} +2 -2
- package/dist/react/index.js +1 -1
- package/dist/react/style.css +1 -1
- package/dist/src/dashboard/query_explain_handler.d.ts +11 -0
- package/dist/src/dashboard/query_explain_handler.js +64 -11
- package/dist/src/debug/query_collector.d.ts +1 -0
- package/dist/src/debug/query_collector.js +3 -0
- package/dist/src/edge/client/dashboard.js +2 -2
- package/dist/src/edge/client/debug-panel-deferred.js +1 -1
- package/dist/src/edge/client-vue/dashboard.js +4 -4
- package/dist/src/edge/client-vue/debug-panel-deferred.js +2 -2
- package/dist/src/provider/server_stats_provider.js +2 -0
- package/dist/src/routes/debug_routes.d.ts +4 -0
- package/dist/src/routes/debug_routes.js +45 -0
- package/dist/src/routes/register_routes.d.ts +4 -0
- package/dist/src/routes/register_routes.js +2 -0
- package/dist/src/styles/components.css +238 -0
- package/dist/src/styles/dashboard.css +6 -173
- package/dist/src/styles/debug-panel.css +2 -24
- package/dist/vue/{CacheSection-BAotiuQq.js → CacheSection-Bx41lpfK.js} +1 -1
- package/dist/vue/{ConfigSection-JZjK5E5F.js → ConfigSection-fkfUdCmx.js} +1 -1
- package/dist/vue/{EmailsSection-BLwyQO7B.js → EmailsSection-CbcDKF9Q.js} +1 -1
- package/dist/vue/{EventsSection-BUEwO-0A.js → EventsSection-CWbTYOBi.js} +1 -1
- package/dist/vue/{JobsSection-21A0yQMq.js → JobsSection-CGGO6rtS.js} +1 -1
- package/dist/vue/{LogsSection-BmOx8SNa.js → LogsSection-BPB-C-XA.js} +1 -1
- package/dist/vue/{OverviewSection-BRDK3Ony.js → OverviewSection-BTcnPeoM.js} +1 -1
- package/dist/vue/QueriesSection-2SE3igQJ.js +411 -0
- package/dist/vue/QueriesTab-DO5XwJ--.js +112 -0
- package/dist/vue/{RequestsSection-DLrjCfcE.js → RequestsSection-DXcG5Zok.js} +1 -1
- package/dist/vue/{RoutesSection-CPr9w42B.js → RoutesSection-BkNGWdoP.js} +1 -1
- package/dist/vue/components/Dashboard/sections/QueriesSection.vue.d.ts +1 -41
- package/dist/vue/{index-CYaqRGIT.js → index-CptF6Qbp.js} +2 -2
- package/dist/vue/index.js +1 -1
- package/dist/vue/style.css +1 -1
- package/package.json +1 -1
- package/dist/react/QueriesSection-CZJ-imAb.js +0 -474
- package/dist/react/QueriesTab-CQHa1ck3.js +0 -97
- package/dist/vue/QueriesSection-D2WGsuR4.js +0 -444
- package/dist/vue/QueriesTab-6D_xfi7Q.js +0 -114
|
@@ -1,474 +0,0 @@
|
|
|
1
|
-
import { jsx as t, jsxs as r, Fragment as y } from "react/jsx-runtime";
|
|
2
|
-
import { useState as g, useCallback as $, useEffect as X, useMemo as T } from "react";
|
|
3
|
-
import { resolveField as N, resolveNormalizedSql as A, durationClassName as R, resolveSqlMethod as z, resolveTimestamp as Y, SLOW_DURATION_MS as Z } from "adonisjs-server-stats/core";
|
|
4
|
-
import { a as ee } from "./index-C4EMJrkH.js";
|
|
5
|
-
import { D as U } from "./DataTable-YyShr5B-.js";
|
|
6
|
-
import { F as se } from "./FilterBar-CQ7bD669.js";
|
|
7
|
-
import { T as te } from "./TimeAgoCell-o3KigGfM.js";
|
|
8
|
-
import { P as ne } from "./Pagination-BkmzUDY8.js";
|
|
9
|
-
function W({ node: n, depth: d = 0 }) {
|
|
10
|
-
if (!n) return null;
|
|
11
|
-
const f = d * 20, u = n["Node Type"] || "Unknown", S = n["Relation Name"] ? /* @__PURE__ */ r(y, { children: [
|
|
12
|
-
" on ",
|
|
13
|
-
/* @__PURE__ */ t("strong", { children: n["Relation Name"] })
|
|
14
|
-
] }) : null, c = n.Alias && n.Alias !== n["Relation Name"] ? ` (${n.Alias})` : "", m = n["Index Name"] ? /* @__PURE__ */ r(y, { children: [
|
|
15
|
-
" using ",
|
|
16
|
-
/* @__PURE__ */ t("em", { children: n["Index Name"] })
|
|
17
|
-
] }) : null, i = [];
|
|
18
|
-
if (n["Startup Cost"] !== null && n["Startup Cost"] !== void 0 && i.push(`cost=${n["Startup Cost"]}..${n["Total Cost"]}`), n["Plan Rows"] !== null && n["Plan Rows"] !== void 0 && i.push(`rows=${n["Plan Rows"]}`), n["Plan Width"] !== null && n["Plan Width"] !== void 0 && i.push(`width=${n["Plan Width"]}`), n.Filter && i.push(`filter: ${n.Filter}`), n["Index Cond"] && i.push(`cond: ${n["Index Cond"]}`), n["Hash Cond"] && i.push(`hash: ${n["Hash Cond"]}`), n["Join Type"] && i.push(`join: ${n["Join Type"]}`), n["Sort Key"]) {
|
|
19
|
-
const l = Array.isArray(n["Sort Key"]) ? n["Sort Key"].join(", ") : n["Sort Key"];
|
|
20
|
-
i.push(`sort: ${l}`);
|
|
21
|
-
}
|
|
22
|
-
const C = n.Plans || [];
|
|
23
|
-
return /* @__PURE__ */ r("div", { className: "ss-dash-explain-node", style: { marginLeft: `${f}px` }, children: [
|
|
24
|
-
/* @__PURE__ */ r("div", { className: "ss-dash-explain-node-header", children: [
|
|
25
|
-
/* @__PURE__ */ t("span", { className: "ss-dash-explain-node-type", children: u }),
|
|
26
|
-
S,
|
|
27
|
-
c,
|
|
28
|
-
m
|
|
29
|
-
] }),
|
|
30
|
-
i.length > 0 && /* @__PURE__ */ t("div", { className: "ss-dash-explain-metrics", children: i.join(" · ") }),
|
|
31
|
-
C.map((l, F) => /* @__PURE__ */ t(W, { node: l, depth: d + 1 }, F))
|
|
32
|
-
] });
|
|
33
|
-
}
|
|
34
|
-
function ae({ plan: n }) {
|
|
35
|
-
if (!n || !Array.isArray(n) || n.length === 0)
|
|
36
|
-
return /* @__PURE__ */ t("div", { className: "ss-dash-explain-result", children: "No plan data returned" });
|
|
37
|
-
const d = n[0];
|
|
38
|
-
if (d && d.Plan)
|
|
39
|
-
return /* @__PURE__ */ t("div", { className: "ss-dash-explain-result", children: /* @__PURE__ */ t(W, { node: d.Plan, depth: 0 }) });
|
|
40
|
-
if (typeof d == "object" && d !== null) {
|
|
41
|
-
const f = Object.keys(d);
|
|
42
|
-
return /* @__PURE__ */ t("div", { className: "ss-dash-explain-result", children: /* @__PURE__ */ r("table", { children: [
|
|
43
|
-
/* @__PURE__ */ t("thead", { children: /* @__PURE__ */ t("tr", { children: f.map((u) => /* @__PURE__ */ t("th", { children: u }, u)) }) }),
|
|
44
|
-
/* @__PURE__ */ t("tbody", { children: n.map((u, S) => {
|
|
45
|
-
const c = u;
|
|
46
|
-
return /* @__PURE__ */ t("tr", { children: f.map((m) => /* @__PURE__ */ t("td", { children: c[m] !== null && c[m] !== void 0 ? String(c[m]) : "-" }, m)) }, S);
|
|
47
|
-
}) })
|
|
48
|
-
] }) });
|
|
49
|
-
}
|
|
50
|
-
return /* @__PURE__ */ t("div", { className: "ss-dash-explain-result", children: "No plan data returned" });
|
|
51
|
-
}
|
|
52
|
-
const re = 8;
|
|
53
|
-
function me({ options: n = {} }) {
|
|
54
|
-
const [d, f] = g(1), [u, S] = g(""), [c, m] = g("createdAt"), [i, C] = g("desc"), [l, F] = g("list"), [v, D] = g(null), [o, w] = g(null), [j, L] = g(null), I = $(
|
|
55
|
-
(e) => {
|
|
56
|
-
e !== l && (F(e), f(1), m(e === "list" ? "createdAt" : "count"), C("desc"), D(null), w(null), L(null));
|
|
57
|
-
},
|
|
58
|
-
[l]
|
|
59
|
-
);
|
|
60
|
-
X(() => f(1), [u]);
|
|
61
|
-
const H = l === "grouped" ? "queries/grouped" : "queries", { data: _, meta: k, isLoading: J, getApi: O } = ee(H, {
|
|
62
|
-
...n,
|
|
63
|
-
page: d,
|
|
64
|
-
search: u,
|
|
65
|
-
sort: c,
|
|
66
|
-
sortDir: i
|
|
67
|
-
}), K = $(
|
|
68
|
-
(e) => {
|
|
69
|
-
c === e ? C((s) => s === "asc" ? "desc" : "asc") : (m(e), C("desc"));
|
|
70
|
-
},
|
|
71
|
-
[c]
|
|
72
|
-
), V = $(
|
|
73
|
-
async (e) => {
|
|
74
|
-
if (o && o.queryId === e) {
|
|
75
|
-
w(null);
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
L(e);
|
|
79
|
-
try {
|
|
80
|
-
const s = await O().explainQuery(e);
|
|
81
|
-
s && s.error ? w({
|
|
82
|
-
queryId: e,
|
|
83
|
-
plan: [],
|
|
84
|
-
error: s.error,
|
|
85
|
-
message: s.message
|
|
86
|
-
}) : w({
|
|
87
|
-
queryId: e,
|
|
88
|
-
plan: s?.plan || s?.rows || []
|
|
89
|
-
});
|
|
90
|
-
} catch (s) {
|
|
91
|
-
console.warn("[ss] Query explain failed:", s), w({
|
|
92
|
-
queryId: e,
|
|
93
|
-
plan: [],
|
|
94
|
-
error: s instanceof Error ? s.message : String(s)
|
|
95
|
-
});
|
|
96
|
-
} finally {
|
|
97
|
-
L(null);
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
[O, o]
|
|
101
|
-
), B = $(
|
|
102
|
-
(e) => {
|
|
103
|
-
const s = e.id;
|
|
104
|
-
return !o || o.queryId !== s ? null : /* @__PURE__ */ t("tr", { className: "ss-dash-explain-row", children: /* @__PURE__ */ t("td", { colSpan: re, className: "ss-dash-explain", children: /* @__PURE__ */ r("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "start" }, children: [
|
|
105
|
-
/* @__PURE__ */ t("div", { style: { flex: 1 }, children: o.error ? /* @__PURE__ */ r("div", { className: "ss-dash-explain-result ss-dash-explain-error", children: [
|
|
106
|
-
/* @__PURE__ */ t("strong", { children: "Error:" }),
|
|
107
|
-
" ",
|
|
108
|
-
o.error,
|
|
109
|
-
o.message && /* @__PURE__ */ r(y, { children: [
|
|
110
|
-
/* @__PURE__ */ t("br", {}),
|
|
111
|
-
o.message
|
|
112
|
-
] })
|
|
113
|
-
] }) : /* @__PURE__ */ t(ae, { plan: o.plan }) }),
|
|
114
|
-
/* @__PURE__ */ t(
|
|
115
|
-
"button",
|
|
116
|
-
{
|
|
117
|
-
type: "button",
|
|
118
|
-
className: "ss-dash-explain-btn",
|
|
119
|
-
onClick: () => w(null),
|
|
120
|
-
style: { marginLeft: "8px", flexShrink: 0 },
|
|
121
|
-
children: "Close"
|
|
122
|
-
}
|
|
123
|
-
)
|
|
124
|
-
] }) }) });
|
|
125
|
-
},
|
|
126
|
-
[o]
|
|
127
|
-
), M = l === "grouped" ? _?.groups || [] : _ || [], h = T(() => l !== "grouped" ? M : M.map((e) => {
|
|
128
|
-
const s = { ...e };
|
|
129
|
-
return s.sqlNormalized ??= N(e, "sql_normalized", "pattern") ?? void 0, s.count ??= N(e, "total_count"), s.avgDuration ??= N(e, "avg_duration"), s.maxDuration ??= N(e, "max_duration"), s.minDuration ??= N(e, "min_duration"), s.totalDuration ??= N(e, "total_duration"), s.percentOfTotal ??= N(e, "pct_time"), s;
|
|
130
|
-
}), [M, l]), b = T(() => {
|
|
131
|
-
const e = k?.total ?? h.length;
|
|
132
|
-
let s = 0, a = 0, p = 0, x = 0;
|
|
133
|
-
for (const q of h) {
|
|
134
|
-
const P = q.duration || 0;
|
|
135
|
-
p += P, x++, P > Z && s++;
|
|
136
|
-
}
|
|
137
|
-
const E = /* @__PURE__ */ new Map();
|
|
138
|
-
for (const q of h) {
|
|
139
|
-
const P = A(q);
|
|
140
|
-
E.set(P, (E.get(P) || 0) + 1);
|
|
141
|
-
}
|
|
142
|
-
for (const q of E.values())
|
|
143
|
-
q > 1 && (a += q);
|
|
144
|
-
return {
|
|
145
|
-
total: e,
|
|
146
|
-
slow: s,
|
|
147
|
-
duplicates: a,
|
|
148
|
-
avgDuration: x > 0 ? p / x : 0
|
|
149
|
-
};
|
|
150
|
-
}, [h, k]), Q = T(() => {
|
|
151
|
-
const e = /* @__PURE__ */ new Map();
|
|
152
|
-
for (const s of h) {
|
|
153
|
-
const a = A(s);
|
|
154
|
-
e.set(a, (e.get(a) || 0) + 1);
|
|
155
|
-
}
|
|
156
|
-
return e;
|
|
157
|
-
}, [h]), G = T(() => {
|
|
158
|
-
if (l === "grouped")
|
|
159
|
-
return `${h.length} query patterns`;
|
|
160
|
-
const e = [`${b.total} queries`];
|
|
161
|
-
return b.slow > 0 && e.push(`${b.slow} slow`), b.duplicates > 0 && e.push(`${b.duplicates} dup`), e.push(`avg ${(b.avgDuration || 0).toFixed(1)}ms`), e.join(", ");
|
|
162
|
-
}, [l, h.length, b]);
|
|
163
|
-
return /* @__PURE__ */ r("div", { children: [
|
|
164
|
-
/* @__PURE__ */ t(
|
|
165
|
-
se,
|
|
166
|
-
{
|
|
167
|
-
search: u,
|
|
168
|
-
onSearchChange: S,
|
|
169
|
-
placeholder: "Filter queries...",
|
|
170
|
-
summary: G,
|
|
171
|
-
children: /* @__PURE__ */ r("div", { className: "ss-dash-btn-group", children: [
|
|
172
|
-
/* @__PURE__ */ t(
|
|
173
|
-
"button",
|
|
174
|
-
{
|
|
175
|
-
type: "button",
|
|
176
|
-
className: `ss-dash-btn ${l === "list" ? "ss-dash-active" : ""}`,
|
|
177
|
-
onClick: () => I("list"),
|
|
178
|
-
children: "List"
|
|
179
|
-
}
|
|
180
|
-
),
|
|
181
|
-
/* @__PURE__ */ t(
|
|
182
|
-
"button",
|
|
183
|
-
{
|
|
184
|
-
type: "button",
|
|
185
|
-
className: `ss-dash-btn ${l === "grouped" ? "ss-dash-active" : ""}`,
|
|
186
|
-
onClick: () => I("grouped"),
|
|
187
|
-
children: "Grouped"
|
|
188
|
-
}
|
|
189
|
-
)
|
|
190
|
-
] })
|
|
191
|
-
}
|
|
192
|
-
),
|
|
193
|
-
J && !_ ? /* @__PURE__ */ t("div", { className: "ss-dash-empty", children: "Loading queries..." }) : l === "grouped" ? /* @__PURE__ */ t(y, { children: /* @__PURE__ */ t("div", { className: "ss-dash-table-wrap", children: /* @__PURE__ */ t(
|
|
194
|
-
U,
|
|
195
|
-
{
|
|
196
|
-
columns: [
|
|
197
|
-
{
|
|
198
|
-
key: "sqlNormalized",
|
|
199
|
-
label: "Pattern",
|
|
200
|
-
render: (e, s) => {
|
|
201
|
-
const a = e || "", p = (s.count || 0) >= 3;
|
|
202
|
-
return /* @__PURE__ */ r(y, { children: [
|
|
203
|
-
/* @__PURE__ */ t(
|
|
204
|
-
"span",
|
|
205
|
-
{
|
|
206
|
-
className: `ss-dash-sql ${v === a ? "ss-dash-expanded" : ""}`,
|
|
207
|
-
title: "Click to expand",
|
|
208
|
-
onClick: (x) => {
|
|
209
|
-
x.stopPropagation(), D(v === a ? null : a);
|
|
210
|
-
},
|
|
211
|
-
role: "button",
|
|
212
|
-
tabIndex: 0,
|
|
213
|
-
onKeyDown: (x) => x.key === "Enter" && D(v === a ? null : a),
|
|
214
|
-
children: a
|
|
215
|
-
}
|
|
216
|
-
),
|
|
217
|
-
p && /* @__PURE__ */ r(y, { children: [
|
|
218
|
-
" ",
|
|
219
|
-
/* @__PURE__ */ t("span", { className: "ss-dash-dup", children: "DUP" })
|
|
220
|
-
] })
|
|
221
|
-
] });
|
|
222
|
-
}
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
key: "count",
|
|
226
|
-
label: "Count",
|
|
227
|
-
width: "60px",
|
|
228
|
-
sortable: !0,
|
|
229
|
-
render: (e) => /* @__PURE__ */ t(
|
|
230
|
-
"span",
|
|
231
|
-
{
|
|
232
|
-
style: { color: "var(--ss-muted)", textAlign: "center", display: "block" },
|
|
233
|
-
children: e || 0
|
|
234
|
-
}
|
|
235
|
-
)
|
|
236
|
-
},
|
|
237
|
-
{
|
|
238
|
-
key: "avgDuration",
|
|
239
|
-
label: "Avg",
|
|
240
|
-
width: "70px",
|
|
241
|
-
sortable: !0,
|
|
242
|
-
render: (e) => {
|
|
243
|
-
const s = e || 0;
|
|
244
|
-
return /* @__PURE__ */ t(
|
|
245
|
-
"span",
|
|
246
|
-
{
|
|
247
|
-
className: `ss-dash-duration ${R(s)}`,
|
|
248
|
-
children: s.toFixed(2) + "ms"
|
|
249
|
-
}
|
|
250
|
-
);
|
|
251
|
-
}
|
|
252
|
-
},
|
|
253
|
-
{
|
|
254
|
-
key: "minDuration",
|
|
255
|
-
label: "Min",
|
|
256
|
-
width: "70px",
|
|
257
|
-
render: (e) => /* @__PURE__ */ t("span", { className: "ss-dash-duration", children: (e || 0).toFixed(2) + "ms" })
|
|
258
|
-
},
|
|
259
|
-
{
|
|
260
|
-
key: "maxDuration",
|
|
261
|
-
label: "Max",
|
|
262
|
-
width: "70px",
|
|
263
|
-
render: (e) => {
|
|
264
|
-
const s = e || 0;
|
|
265
|
-
return /* @__PURE__ */ t(
|
|
266
|
-
"span",
|
|
267
|
-
{
|
|
268
|
-
className: `ss-dash-duration ${R(s)}`,
|
|
269
|
-
children: s.toFixed(2) + "ms"
|
|
270
|
-
}
|
|
271
|
-
);
|
|
272
|
-
}
|
|
273
|
-
},
|
|
274
|
-
{
|
|
275
|
-
key: "totalDuration",
|
|
276
|
-
label: "Total",
|
|
277
|
-
width: "70px",
|
|
278
|
-
sortable: !0,
|
|
279
|
-
render: (e) => /* @__PURE__ */ t("span", { className: "ss-dash-duration", children: (e || 0).toFixed(1) + "ms" })
|
|
280
|
-
},
|
|
281
|
-
{
|
|
282
|
-
key: "percentOfTotal",
|
|
283
|
-
label: "% Time",
|
|
284
|
-
width: "60px",
|
|
285
|
-
render: (e) => /* @__PURE__ */ t(
|
|
286
|
-
"span",
|
|
287
|
-
{
|
|
288
|
-
style: { color: "var(--ss-muted)", textAlign: "center", display: "block" },
|
|
289
|
-
children: (e || 0).toFixed(1) + "%"
|
|
290
|
-
}
|
|
291
|
-
)
|
|
292
|
-
}
|
|
293
|
-
],
|
|
294
|
-
data: h,
|
|
295
|
-
keyField: "sqlNormalized",
|
|
296
|
-
sort: c,
|
|
297
|
-
sortDir: i,
|
|
298
|
-
onSort: K,
|
|
299
|
-
emptyMessage: /* @__PURE__ */ r(y, { children: [
|
|
300
|
-
"No queries recorded",
|
|
301
|
-
/* @__PURE__ */ r("span", { className: "ss-empty-hint", children: [
|
|
302
|
-
"Queries require ",
|
|
303
|
-
/* @__PURE__ */ t("code", { children: "debug: true" }),
|
|
304
|
-
" on your Lucid connections in ",
|
|
305
|
-
/* @__PURE__ */ t("code", { children: "config/database.ts" })
|
|
306
|
-
] })
|
|
307
|
-
] })
|
|
308
|
-
}
|
|
309
|
-
) }) }) : /* @__PURE__ */ r(y, { children: [
|
|
310
|
-
/* @__PURE__ */ t("div", { className: "ss-dash-table-wrap", children: /* @__PURE__ */ t(
|
|
311
|
-
U,
|
|
312
|
-
{
|
|
313
|
-
columns: [
|
|
314
|
-
{
|
|
315
|
-
key: "id",
|
|
316
|
-
label: "#",
|
|
317
|
-
width: "40px",
|
|
318
|
-
render: (e) => /* @__PURE__ */ t("span", { style: { color: "var(--ss-dim)" }, children: e })
|
|
319
|
-
},
|
|
320
|
-
{
|
|
321
|
-
key: "sql",
|
|
322
|
-
label: "SQL",
|
|
323
|
-
render: (e, s) => {
|
|
324
|
-
const a = s.sql || s.sql_text || "";
|
|
325
|
-
return /* @__PURE__ */ r("div", { children: [
|
|
326
|
-
/* @__PURE__ */ t(
|
|
327
|
-
"span",
|
|
328
|
-
{
|
|
329
|
-
className: `ss-dash-sql ${v === s.id ? "ss-dash-expanded" : ""}`,
|
|
330
|
-
title: "Click to expand",
|
|
331
|
-
onClick: (p) => {
|
|
332
|
-
p.stopPropagation(), D(
|
|
333
|
-
v === s.id ? null : s.id
|
|
334
|
-
);
|
|
335
|
-
},
|
|
336
|
-
role: "button",
|
|
337
|
-
tabIndex: 0,
|
|
338
|
-
onKeyDown: (p) => p.key === "Enter" && D(
|
|
339
|
-
v === s.id ? null : s.id
|
|
340
|
-
),
|
|
341
|
-
children: a
|
|
342
|
-
}
|
|
343
|
-
),
|
|
344
|
-
(Q.get(A(s)) ?? 0) > 1 && /* @__PURE__ */ r("span", { className: "ss-dash-dup", children: [
|
|
345
|
-
"×",
|
|
346
|
-
Q.get(A(s))
|
|
347
|
-
] })
|
|
348
|
-
] });
|
|
349
|
-
}
|
|
350
|
-
},
|
|
351
|
-
{
|
|
352
|
-
key: "duration",
|
|
353
|
-
label: "Duration",
|
|
354
|
-
width: "70px",
|
|
355
|
-
sortable: !0,
|
|
356
|
-
render: (e) => {
|
|
357
|
-
const s = e || 0;
|
|
358
|
-
return /* @__PURE__ */ t(
|
|
359
|
-
"span",
|
|
360
|
-
{
|
|
361
|
-
className: `ss-dash-duration ${R(s)}`,
|
|
362
|
-
children: s.toFixed(2) + "ms"
|
|
363
|
-
}
|
|
364
|
-
);
|
|
365
|
-
}
|
|
366
|
-
},
|
|
367
|
-
{
|
|
368
|
-
key: "method",
|
|
369
|
-
label: "Method",
|
|
370
|
-
width: "60px",
|
|
371
|
-
render: (e, s) => {
|
|
372
|
-
const a = z(s);
|
|
373
|
-
return /* @__PURE__ */ t("span", { className: `ss-dash-method ss-dash-method-${a.toLowerCase()}`, children: a });
|
|
374
|
-
}
|
|
375
|
-
},
|
|
376
|
-
{
|
|
377
|
-
key: "model",
|
|
378
|
-
label: "Model",
|
|
379
|
-
width: "90px",
|
|
380
|
-
render: (e) => /* @__PURE__ */ t(
|
|
381
|
-
"span",
|
|
382
|
-
{
|
|
383
|
-
style: {
|
|
384
|
-
color: "var(--ss-muted)",
|
|
385
|
-
overflow: "hidden",
|
|
386
|
-
textOverflow: "ellipsis",
|
|
387
|
-
whiteSpace: "nowrap"
|
|
388
|
-
},
|
|
389
|
-
title: e,
|
|
390
|
-
children: e || "-"
|
|
391
|
-
}
|
|
392
|
-
)
|
|
393
|
-
},
|
|
394
|
-
{
|
|
395
|
-
key: "connection",
|
|
396
|
-
label: "Connection",
|
|
397
|
-
width: "80px",
|
|
398
|
-
render: (e) => /* @__PURE__ */ t(
|
|
399
|
-
"span",
|
|
400
|
-
{
|
|
401
|
-
style: {
|
|
402
|
-
color: "var(--ss-dim)",
|
|
403
|
-
overflow: "hidden",
|
|
404
|
-
textOverflow: "ellipsis",
|
|
405
|
-
whiteSpace: "nowrap"
|
|
406
|
-
},
|
|
407
|
-
children: e || "-"
|
|
408
|
-
}
|
|
409
|
-
)
|
|
410
|
-
},
|
|
411
|
-
{
|
|
412
|
-
key: "createdAt",
|
|
413
|
-
label: "Time",
|
|
414
|
-
width: "90px",
|
|
415
|
-
sortable: !0,
|
|
416
|
-
render: (e, s) => {
|
|
417
|
-
const a = e || (Y(s) ?? "");
|
|
418
|
-
return /* @__PURE__ */ t(te, { ts: a, className: "ss-dash-event-time" });
|
|
419
|
-
}
|
|
420
|
-
},
|
|
421
|
-
{
|
|
422
|
-
key: "id",
|
|
423
|
-
label: "",
|
|
424
|
-
width: "70px",
|
|
425
|
-
render: (e, s) => {
|
|
426
|
-
if (z(s) !== "select") return null;
|
|
427
|
-
const p = o?.queryId === s.id && !o?.error;
|
|
428
|
-
return /* @__PURE__ */ t(
|
|
429
|
-
"button",
|
|
430
|
-
{
|
|
431
|
-
type: "button",
|
|
432
|
-
className: `ss-dash-explain-btn${p ? " ss-dash-explain-btn-active" : ""}`,
|
|
433
|
-
onClick: (x) => {
|
|
434
|
-
x.stopPropagation(), V(s.id);
|
|
435
|
-
},
|
|
436
|
-
disabled: j === s.id,
|
|
437
|
-
children: j === s.id ? "..." : "EXPLAIN"
|
|
438
|
-
}
|
|
439
|
-
);
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
],
|
|
443
|
-
data: h,
|
|
444
|
-
sort: c,
|
|
445
|
-
sortDir: i,
|
|
446
|
-
onSort: K,
|
|
447
|
-
emptyMessage: /* @__PURE__ */ r(y, { children: [
|
|
448
|
-
"No queries recorded",
|
|
449
|
-
/* @__PURE__ */ r("span", { className: "ss-empty-hint", children: [
|
|
450
|
-
"Queries require ",
|
|
451
|
-
/* @__PURE__ */ t("code", { children: "debug: true" }),
|
|
452
|
-
" on your Lucid connections in ",
|
|
453
|
-
/* @__PURE__ */ t("code", { children: "config/database.ts" })
|
|
454
|
-
] })
|
|
455
|
-
] }),
|
|
456
|
-
renderAfterRow: B
|
|
457
|
-
}
|
|
458
|
-
) }),
|
|
459
|
-
k && /* @__PURE__ */ t(
|
|
460
|
-
ne,
|
|
461
|
-
{
|
|
462
|
-
page: k.page,
|
|
463
|
-
lastPage: k.lastPage,
|
|
464
|
-
total: k.total,
|
|
465
|
-
onPageChange: f
|
|
466
|
-
}
|
|
467
|
-
)
|
|
468
|
-
] })
|
|
469
|
-
] });
|
|
470
|
-
}
|
|
471
|
-
export {
|
|
472
|
-
me as QueriesSection,
|
|
473
|
-
me as default
|
|
474
|
-
};
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { jsx as e, jsxs as t, Fragment as w } from "react/jsx-runtime";
|
|
2
|
-
import { useState as m, useMemo as l, useCallback as C } from "react";
|
|
3
|
-
import { filterQueries as v, countDuplicateQueries as D, computeQuerySummary as Q, formatDuration as p, durationClassName as S } from "adonisjs-server-stats/core";
|
|
4
|
-
import { T } from "./TimeAgoCell-o3KigGfM.js";
|
|
5
|
-
import { u as M, M as $ } from "./index-C4EMJrkH.js";
|
|
6
|
-
import { u as E } from "./useResizableTable-CNJmACdt.js";
|
|
7
|
-
import { F } from "./FilterBar-CQ7bD669.js";
|
|
8
|
-
function A({ options: g }) {
|
|
9
|
-
const { data: n, isLoading: b, error: u } = M("queries", g), [o, y] = m(""), [f, x] = m(null), d = l(() => n?.queries || [], [n]), r = l(() => v(d, o), [d, o]), a = l(() => D(d), [d]), i = l(
|
|
10
|
-
() => Q(d, a),
|
|
11
|
-
[d, a]
|
|
12
|
-
), h = C((s) => {
|
|
13
|
-
x((c) => c === s ? null : s);
|
|
14
|
-
}, []), N = E([r]);
|
|
15
|
-
return b && !n ? /* @__PURE__ */ e("div", { className: "ss-dbg-empty", children: "Loading queries..." }) : u ? /* @__PURE__ */ t("div", { className: "ss-dbg-empty", children: [
|
|
16
|
-
"Error: ",
|
|
17
|
-
u.message
|
|
18
|
-
] }) : /* @__PURE__ */ t("div", { children: [
|
|
19
|
-
/* @__PURE__ */ e(
|
|
20
|
-
F,
|
|
21
|
-
{
|
|
22
|
-
search: o,
|
|
23
|
-
onSearchChange: y,
|
|
24
|
-
placeholder: "Filter queries...",
|
|
25
|
-
summary: /* @__PURE__ */ t(w, { children: [
|
|
26
|
-
r.length,
|
|
27
|
-
" queries",
|
|
28
|
-
i.slowCount > 0 && ` | ${i.slowCount} slow`,
|
|
29
|
-
i.dupCount > 0 && ` | ${i.dupCount} dup`,
|
|
30
|
-
r.length > 0 && ` | avg ${p(i.avgDuration)}`
|
|
31
|
-
] })
|
|
32
|
-
}
|
|
33
|
-
),
|
|
34
|
-
r.length === 0 ? /* @__PURE__ */ t("div", { className: "ss-dbg-empty", children: [
|
|
35
|
-
/* @__PURE__ */ e("span", { children: "No queries captured" }),
|
|
36
|
-
/* @__PURE__ */ t("span", { className: "ss-empty-hint", children: [
|
|
37
|
-
"Queries require ",
|
|
38
|
-
/* @__PURE__ */ e("code", { children: "debug: true" }),
|
|
39
|
-
" on your Lucid connections in",
|
|
40
|
-
" ",
|
|
41
|
-
/* @__PURE__ */ e("code", { children: "config/database.ts" })
|
|
42
|
-
] })
|
|
43
|
-
] }) : /* @__PURE__ */ t("table", { ref: N, className: "ss-dbg-table", children: [
|
|
44
|
-
/* @__PURE__ */ t("colgroup", { children: [
|
|
45
|
-
/* @__PURE__ */ e("col", { style: { width: "50px" } }),
|
|
46
|
-
/* @__PURE__ */ e("col", {}),
|
|
47
|
-
/* @__PURE__ */ e("col", { style: { width: "80px" } }),
|
|
48
|
-
/* @__PURE__ */ e("col", { style: { width: "70px" } }),
|
|
49
|
-
/* @__PURE__ */ e("col", { style: { width: "100px" } }),
|
|
50
|
-
/* @__PURE__ */ e("col", { style: { width: "80px" } })
|
|
51
|
-
] }),
|
|
52
|
-
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ t("tr", { children: [
|
|
53
|
-
/* @__PURE__ */ e("th", { children: "#" }),
|
|
54
|
-
/* @__PURE__ */ e("th", { children: "SQL" }),
|
|
55
|
-
/* @__PURE__ */ e("th", { children: "Duration" }),
|
|
56
|
-
/* @__PURE__ */ e("th", { children: "Method" }),
|
|
57
|
-
/* @__PURE__ */ e("th", { children: "Model" }),
|
|
58
|
-
/* @__PURE__ */ e("th", { children: "Time" })
|
|
59
|
-
] }) }),
|
|
60
|
-
/* @__PURE__ */ e("tbody", { children: r.map((s) => /* @__PURE__ */ t("tr", { children: [
|
|
61
|
-
/* @__PURE__ */ e("td", { className: "ss-dbg-c-dim", style: { whiteSpace: "nowrap" }, children: s.id }),
|
|
62
|
-
/* @__PURE__ */ t("td", { children: [
|
|
63
|
-
/* @__PURE__ */ e(
|
|
64
|
-
"span",
|
|
65
|
-
{
|
|
66
|
-
className: `ss-dbg-sql ${f === s.id ? "ss-dbg-expanded" : ""}`,
|
|
67
|
-
onClick: () => h(s.id),
|
|
68
|
-
role: "button",
|
|
69
|
-
tabIndex: 0,
|
|
70
|
-
onKeyDown: (c) => c.key === "Enter" && h(s.id),
|
|
71
|
-
children: s.sql
|
|
72
|
-
}
|
|
73
|
-
),
|
|
74
|
-
a[s.sql] > 1 && /* @__PURE__ */ t("span", { className: "ss-dbg-dup", children: [
|
|
75
|
-
" x",
|
|
76
|
-
a[s.sql]
|
|
77
|
-
] }),
|
|
78
|
-
s.inTransaction && /* @__PURE__ */ e("span", { className: "ss-dbg-dup", children: " TXN" })
|
|
79
|
-
] }),
|
|
80
|
-
/* @__PURE__ */ e(
|
|
81
|
-
"td",
|
|
82
|
-
{
|
|
83
|
-
className: `ss-dbg-duration ${S(s.duration, "ss-dbg")}`,
|
|
84
|
-
children: p(s.duration)
|
|
85
|
-
}
|
|
86
|
-
),
|
|
87
|
-
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e($, { method: s.method, classPrefix: "ss-dbg" }) }),
|
|
88
|
-
/* @__PURE__ */ e("td", { className: "ss-dbg-c-muted", children: s.model || "-" }),
|
|
89
|
-
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e(T, { ts: s.timestamp, className: "ss-dbg-event-time" }) })
|
|
90
|
-
] }, s.id)) })
|
|
91
|
-
] })
|
|
92
|
-
] });
|
|
93
|
-
}
|
|
94
|
-
export {
|
|
95
|
-
A as QueriesTab,
|
|
96
|
-
A as default
|
|
97
|
-
};
|