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.
- package/dist/core/field-resolvers.d.ts +64 -0
- package/dist/core/formatters.d.ts +15 -0
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +208 -203
- package/dist/react/CacheSection-BYN53kYO.js +135 -0
- package/dist/react/CacheStatsBar-CRodCOeP.js +27 -0
- package/dist/react/CacheTab-DOhuK05d.js +106 -0
- package/dist/react/{ConfigSection-DGgqjAal.js → ConfigSection-B9EHh4Rp.js} +1 -1
- package/dist/react/{ConfigTab-H3OnYqmK.js → ConfigTab-C8kriE2b.js} +1 -1
- package/dist/react/CustomPaneTab-CvzQS_Wh.js +99 -0
- package/dist/react/EmailPreviewOverlay-BmXOAvqG.js +58 -0
- package/dist/react/EmailsSection-BJyFJf7A.js +226 -0
- package/dist/react/EmailsTab-Ch8jp10B.js +110 -0
- package/dist/react/{EventsSection-C7RQW_LY.js → EventsSection-DJPwHeT8.js} +27 -26
- package/dist/react/EventsTab-B-FoehXC.js +58 -0
- package/dist/react/{InternalsContent-DBzsI0CG.js → InternalsContent-O8ino9oM.js} +133 -109
- package/dist/react/InternalsSection-B6VlVx5f.js +22 -0
- package/dist/react/InternalsTab-CkEKpRMU.js +17 -0
- package/dist/react/JobStatsBar-C7RslAFE.js +30 -0
- package/dist/react/JobsSection-DWF4i1t_.js +167 -0
- package/dist/react/JobsTab-DqnifQXV.js +129 -0
- package/dist/react/LogEntryRow-CMMkqA9M.js +43 -0
- package/dist/react/LogsSection-C1xC5aP4.js +198 -0
- package/dist/react/LogsTab-CS4sLfLw.js +79 -0
- package/dist/react/{OverviewSection-ABP9ueBo.js → OverviewSection-CxvfOR0v.js} +70 -80
- package/dist/react/QueriesSection-CrMdU5Ax.js +458 -0
- package/dist/react/{QueriesTab-BQzcxEiW.js → QueriesTab-x85PjkyS.js} +22 -21
- package/dist/react/RequestsSection-DETN9oZb.js +321 -0
- package/dist/react/{RoutesSection-BRhxrtjZ.js → RoutesSection-CmorkJeC.js} +1 -1
- package/dist/react/{RoutesTab-CpYH5lUw.js → RoutesTab-CbzBOzpc.js} +12 -12
- package/dist/react/SplitPaneWrapper-BiIgT4ND.js +49 -0
- package/dist/react/TimeAgoCell-o3KigGfM.js +8 -0
- package/dist/react/{TimelineTab-DjLR35Ce.js → TimelineTab-Ue9tUD_n.js} +71 -91
- package/dist/react/{index-CsImORX6.js → index-DwDK-4oX.js} +4 -4
- package/dist/react/index.js +6 -6
- package/dist/react/react/components/shared/CacheStatsBar.d.ts +13 -0
- package/dist/react/react/components/shared/EmailPreviewOverlay.d.ts +29 -0
- package/dist/react/react/components/shared/JobStatsBar.d.ts +12 -0
- package/dist/react/react/components/shared/LogEntryRow.d.ts +9 -0
- package/dist/react/react/components/shared/RelatedLogs.d.ts +2 -2
- package/dist/react/react/components/shared/SplitPaneWrapper.d.ts +7 -0
- package/dist/react/react/components/shared/TimeAgoCell.d.ts +17 -0
- package/dist/react/react/hooks/useDiagnosticsData.d.ts +14 -0
- package/dist/react/style.css +1 -1
- 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 +3 -3
- package/dist/src/edge/client-vue/debug-panel-deferred.js +4 -4
- package/dist/src/styles/components.css +67 -0
- package/dist/src/styles/dashboard.css +5 -15
- package/dist/src/styles/debug-panel.css +1 -22
- package/dist/src/styles/utilities.css +3 -1
- package/dist/vue/{CacheSection-ITqvpfH5.js → CacheSection-DT2Mwf_s.js} +1 -1
- package/dist/vue/{ConfigSection-DTn3GslE.js → ConfigSection-BwKwS9lh.js} +1 -1
- package/dist/vue/CustomPaneTab-Hr1IBHfz.js +172 -0
- package/dist/vue/{EmailsSection-DtLJ4XoS.js → EmailsSection-B65g0FVS.js} +1 -1
- package/dist/vue/{EventsSection-BOYYz0Ty.js → EventsSection-CxqtVF-o.js} +1 -1
- package/dist/vue/{JobsSection-BazTxcJL.js → JobsSection-rMIyMb-g.js} +1 -1
- package/dist/vue/{LogsSection-D55PjTKX.js → LogsSection-DmmZVJ7D.js} +1 -1
- package/dist/vue/{OverviewSection-1uBKo-Tu.js → OverviewSection-BMabyqw-.js} +49 -50
- package/dist/vue/{QueriesSection-rpoZ4ogd.js → QueriesSection-BfDFwGqH.js} +44 -45
- package/dist/vue/{QueriesTab-C8_7oprC.js → QueriesTab-DuTG7cpC.js} +30 -31
- package/dist/vue/RelatedLogs.vue_vue_type_script_setup_true_lang-Py1iu9GU.js +77 -0
- package/dist/vue/{RequestsSection-x7LvT0MC.js → RequestsSection-CTu4jPZ_.js} +143 -147
- package/dist/vue/{RoutesSection-CCD0zZqQ.js → RoutesSection-zQZDedL7.js} +1 -1
- package/dist/vue/TimelineTab-DHfXsX7t.js +334 -0
- package/dist/vue/components/shared/RelatedLogs.vue.d.ts +1 -4
- package/dist/vue/{index-C8MxnS7Q.js → index-CM3yNVUR.js} +2 -2
- package/dist/vue/index.js +1 -1
- package/dist/vue/style.css +1 -1
- package/package.json +7 -7
- package/dist/react/CacheSection-baMZotSn.js +0 -146
- package/dist/react/CacheTab-2cw_rMzj.js +0 -117
- package/dist/react/CustomPaneTab-B6r7ha0u.js +0 -98
- package/dist/react/EmailsSection-C-UZISG-.js +0 -262
- package/dist/react/EmailsTab-DbK4Eobn.js +0 -139
- package/dist/react/EventsTab-CfVr7AiM.js +0 -57
- package/dist/react/InternalsSection-t7ihcWO-.js +0 -32
- package/dist/react/InternalsTab-Oij0A2fN.js +0 -30
- package/dist/react/JobsSection-CQHNK_Ls.js +0 -187
- package/dist/react/JobsTab-znzf6jzk.js +0 -153
- package/dist/react/LogsSection-Dmm3rE2B.js +0 -233
- package/dist/react/LogsTab-D8unMV5P.js +0 -108
- package/dist/react/QueriesSection-CnmSkznA.js +0 -461
- package/dist/react/RelatedLogs-3A8RuGKH.js +0 -52
- package/dist/react/RequestsSection-kW79_M7k.js +0 -341
- package/dist/vue/CustomPaneTab-BJxT5Dp7.js +0 -172
- package/dist/vue/RelatedLogs.vue_vue_type_script_setup_true_lang-CB2_TzYW.js +0 -84
- package/dist/vue/TimelineTab-zj5Z5OdT.js +0 -338
|
@@ -0,0 +1,458 @@
|
|
|
1
|
+
import { jsx as t, jsxs as l, Fragment as v } from "react/jsx-runtime";
|
|
2
|
+
import { useState as y, useCallback as $, useEffect as X, useMemo as T } from "react";
|
|
3
|
+
import { resolveField as b, resolveNormalizedSql as A, durationClassName as R, resolveSqlMethod as Q, resolveTimestamp as Y, SLOW_DURATION_MS as Z } from "adonisjs-server-stats/core";
|
|
4
|
+
import { a as ee } from "./index-DwDK-4oX.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 ae } from "./Pagination-BkmzUDY8.js";
|
|
9
|
+
function W({ node: a, depth: d = 0 }) {
|
|
10
|
+
if (!a) return null;
|
|
11
|
+
const f = d * 20, u = a["Node Type"] || "Unknown", C = a["Relation Name"] ? /* @__PURE__ */ l(v, { children: [
|
|
12
|
+
" on ",
|
|
13
|
+
/* @__PURE__ */ t("strong", { children: a["Relation Name"] })
|
|
14
|
+
] }) : null, c = a.Alias && a.Alias !== a["Relation Name"] ? ` (${a.Alias})` : "", m = a["Index Name"] ? /* @__PURE__ */ l(v, { children: [
|
|
15
|
+
" using ",
|
|
16
|
+
/* @__PURE__ */ t("em", { children: a["Index Name"] })
|
|
17
|
+
] }) : null, i = [];
|
|
18
|
+
if (a["Startup Cost"] !== null && a["Startup Cost"] !== void 0 && i.push(`cost=${a["Startup Cost"]}..${a["Total Cost"]}`), a["Plan Rows"] !== null && a["Plan Rows"] !== void 0 && i.push(`rows=${a["Plan Rows"]}`), a["Plan Width"] !== null && a["Plan Width"] !== void 0 && i.push(`width=${a["Plan Width"]}`), a.Filter && i.push(`filter: ${a.Filter}`), a["Index Cond"] && i.push(`cond: ${a["Index Cond"]}`), a["Hash Cond"] && i.push(`hash: ${a["Hash Cond"]}`), a["Join Type"] && i.push(`join: ${a["Join Type"]}`), a["Sort Key"]) {
|
|
19
|
+
const r = Array.isArray(a["Sort Key"]) ? a["Sort Key"].join(", ") : a["Sort Key"];
|
|
20
|
+
i.push(`sort: ${r}`);
|
|
21
|
+
}
|
|
22
|
+
const q = a.Plans || [];
|
|
23
|
+
return /* @__PURE__ */ l("div", { className: "ss-dash-explain-node", style: { marginLeft: `${f}px` }, children: [
|
|
24
|
+
/* @__PURE__ */ l("div", { className: "ss-dash-explain-node-header", children: [
|
|
25
|
+
/* @__PURE__ */ t("span", { className: "ss-dash-explain-node-type", children: u }),
|
|
26
|
+
C,
|
|
27
|
+
c,
|
|
28
|
+
m
|
|
29
|
+
] }),
|
|
30
|
+
i.length > 0 && /* @__PURE__ */ t("div", { className: "ss-dash-explain-metrics", children: i.join(" · ") }),
|
|
31
|
+
q.map((r, F) => /* @__PURE__ */ t(W, { node: r, depth: d + 1 }, F))
|
|
32
|
+
] });
|
|
33
|
+
}
|
|
34
|
+
function ne({ plan: a }) {
|
|
35
|
+
if (!a || !Array.isArray(a) || a.length === 0)
|
|
36
|
+
return /* @__PURE__ */ t("div", { className: "ss-dash-explain-result", children: "No plan data returned" });
|
|
37
|
+
const d = a[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__ */ l("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: a.map((u, C) => {
|
|
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)) }, C);
|
|
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: a = {} }) {
|
|
54
|
+
const [d, f] = y(1), [u, C] = y(""), [c, m] = y("createdAt"), [i, q] = y("desc"), [r, F] = y("list"), [N, D] = y(null), [o, w] = y(null), [j, _] = y(null), I = $(
|
|
55
|
+
(e) => {
|
|
56
|
+
e !== r && (F(e), f(1), m(e === "list" ? "createdAt" : "count"), q("desc"), D(null), w(null), _(null));
|
|
57
|
+
},
|
|
58
|
+
[r]
|
|
59
|
+
);
|
|
60
|
+
X(() => f(1), [u]);
|
|
61
|
+
const H = r === "grouped" ? "queries/grouped" : "queries", { data: M, meta: k, isLoading: J, getApi: O } = ee(H, {
|
|
62
|
+
...a,
|
|
63
|
+
page: d,
|
|
64
|
+
search: u,
|
|
65
|
+
sort: c,
|
|
66
|
+
sortDir: i
|
|
67
|
+
}), K = $(
|
|
68
|
+
(e) => {
|
|
69
|
+
c === e ? q((s) => s === "asc" ? "desc" : "asc") : (m(e), q("desc"));
|
|
70
|
+
},
|
|
71
|
+
[c]
|
|
72
|
+
), V = $(
|
|
73
|
+
async (e) => {
|
|
74
|
+
if (o && o.queryId === e) {
|
|
75
|
+
w(null);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
_(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
|
+
_(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__ */ l("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "start" }, children: [
|
|
105
|
+
/* @__PURE__ */ t("div", { style: { flex: 1 }, children: o.error ? /* @__PURE__ */ l("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__ */ l(v, { children: [
|
|
110
|
+
/* @__PURE__ */ t("br", {}),
|
|
111
|
+
o.message
|
|
112
|
+
] })
|
|
113
|
+
] }) : /* @__PURE__ */ t(ne, { 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
|
+
), E = r === "grouped" ? M?.groups || [] : M || [], p = T(() => r !== "grouped" ? E : E.map((e) => {
|
|
128
|
+
const s = { ...e };
|
|
129
|
+
return s.sqlNormalized ??= b(e, "sql_normalized", "pattern") ?? void 0, s.count ??= b(e, "total_count"), s.avgDuration ??= b(e, "avg_duration"), s.maxDuration ??= b(e, "max_duration"), s.minDuration ??= b(e, "min_duration"), s.totalDuration ??= b(e, "total_duration"), s.percentOfTotal ??= b(e, "pct_time"), s;
|
|
130
|
+
}), [E, r]), g = T(() => {
|
|
131
|
+
const e = k?.total ?? p.length;
|
|
132
|
+
let s = 0, n = 0, h = 0, x = 0;
|
|
133
|
+
for (const S of p) {
|
|
134
|
+
const P = S.duration || 0;
|
|
135
|
+
h += P, x++, P > Z && s++;
|
|
136
|
+
}
|
|
137
|
+
const L = /* @__PURE__ */ new Map();
|
|
138
|
+
for (const S of p) {
|
|
139
|
+
const P = A(S);
|
|
140
|
+
L.set(P, (L.get(P) || 0) + 1);
|
|
141
|
+
}
|
|
142
|
+
for (const S of L.values())
|
|
143
|
+
S > 1 && (n += S);
|
|
144
|
+
return {
|
|
145
|
+
total: e,
|
|
146
|
+
slow: s,
|
|
147
|
+
duplicates: n,
|
|
148
|
+
avgDuration: x > 0 ? h / x : 0
|
|
149
|
+
};
|
|
150
|
+
}, [p, k]), z = T(() => {
|
|
151
|
+
const e = /* @__PURE__ */ new Map();
|
|
152
|
+
for (const s of p) {
|
|
153
|
+
const n = A(s);
|
|
154
|
+
e.set(n, (e.get(n) || 0) + 1);
|
|
155
|
+
}
|
|
156
|
+
return e;
|
|
157
|
+
}, [p]), G = T(() => {
|
|
158
|
+
if (r === "grouped")
|
|
159
|
+
return `${p.length} query patterns`;
|
|
160
|
+
const e = [`${g.total} queries`];
|
|
161
|
+
return g.slow > 0 && e.push(`${g.slow} slow`), g.duplicates > 0 && e.push(`${g.duplicates} dup`), e.push(`avg ${(g.avgDuration || 0).toFixed(1)}ms`), e.join(", ");
|
|
162
|
+
}, [r, p.length, g]);
|
|
163
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
164
|
+
/* @__PURE__ */ t(
|
|
165
|
+
se,
|
|
166
|
+
{
|
|
167
|
+
search: u,
|
|
168
|
+
onSearchChange: C,
|
|
169
|
+
placeholder: "Filter queries...",
|
|
170
|
+
summary: G,
|
|
171
|
+
children: /* @__PURE__ */ l("div", { className: "ss-dash-btn-group", children: [
|
|
172
|
+
/* @__PURE__ */ t(
|
|
173
|
+
"button",
|
|
174
|
+
{
|
|
175
|
+
type: "button",
|
|
176
|
+
className: `ss-dash-btn ${r === "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 ${r === "grouped" ? "ss-dash-active" : ""}`,
|
|
186
|
+
onClick: () => I("grouped"),
|
|
187
|
+
children: "Grouped"
|
|
188
|
+
}
|
|
189
|
+
)
|
|
190
|
+
] })
|
|
191
|
+
}
|
|
192
|
+
),
|
|
193
|
+
J && !M ? /* @__PURE__ */ t("div", { className: "ss-dash-empty", children: "Loading queries..." }) : r === "grouped" ? /* @__PURE__ */ t(v, { 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 n = e || "", h = (s.count || 0) >= 3;
|
|
202
|
+
return /* @__PURE__ */ l(v, { children: [
|
|
203
|
+
/* @__PURE__ */ t(
|
|
204
|
+
"span",
|
|
205
|
+
{
|
|
206
|
+
className: `ss-dash-sql ${N === n ? "ss-dash-expanded" : ""}`,
|
|
207
|
+
title: "Click to expand",
|
|
208
|
+
onClick: (x) => {
|
|
209
|
+
x.stopPropagation(), D(N === n ? null : n);
|
|
210
|
+
},
|
|
211
|
+
role: "button",
|
|
212
|
+
tabIndex: 0,
|
|
213
|
+
onKeyDown: (x) => x.key === "Enter" && D(N === n ? null : n),
|
|
214
|
+
children: n
|
|
215
|
+
}
|
|
216
|
+
),
|
|
217
|
+
h && /* @__PURE__ */ l(v, { 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: p,
|
|
295
|
+
keyField: "sqlNormalized",
|
|
296
|
+
sort: c,
|
|
297
|
+
sortDir: i,
|
|
298
|
+
onSort: K,
|
|
299
|
+
emptyMessage: "No queries recorded"
|
|
300
|
+
}
|
|
301
|
+
) }) }) : /* @__PURE__ */ l(v, { children: [
|
|
302
|
+
/* @__PURE__ */ t("div", { className: "ss-dash-table-wrap", children: /* @__PURE__ */ t(
|
|
303
|
+
U,
|
|
304
|
+
{
|
|
305
|
+
columns: [
|
|
306
|
+
{
|
|
307
|
+
key: "id",
|
|
308
|
+
label: "#",
|
|
309
|
+
width: "40px",
|
|
310
|
+
render: (e) => /* @__PURE__ */ t("span", { style: { color: "var(--ss-dim)" }, children: e })
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
key: "sql",
|
|
314
|
+
label: "SQL",
|
|
315
|
+
render: (e, s) => {
|
|
316
|
+
const n = s.sql || s.sql_text || "";
|
|
317
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
318
|
+
/* @__PURE__ */ t(
|
|
319
|
+
"span",
|
|
320
|
+
{
|
|
321
|
+
className: `ss-dash-sql ${N === s.id ? "ss-dash-expanded" : ""}`,
|
|
322
|
+
title: "Click to expand",
|
|
323
|
+
onClick: (h) => {
|
|
324
|
+
h.stopPropagation(), D(
|
|
325
|
+
N === s.id ? null : s.id
|
|
326
|
+
);
|
|
327
|
+
},
|
|
328
|
+
role: "button",
|
|
329
|
+
tabIndex: 0,
|
|
330
|
+
onKeyDown: (h) => h.key === "Enter" && D(
|
|
331
|
+
N === s.id ? null : s.id
|
|
332
|
+
),
|
|
333
|
+
children: n
|
|
334
|
+
}
|
|
335
|
+
),
|
|
336
|
+
(z.get(A(s)) ?? 0) > 1 && /* @__PURE__ */ l("span", { className: "ss-dash-dup", children: [
|
|
337
|
+
"×",
|
|
338
|
+
z.get(A(s))
|
|
339
|
+
] })
|
|
340
|
+
] });
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
key: "duration",
|
|
345
|
+
label: "Duration",
|
|
346
|
+
width: "70px",
|
|
347
|
+
sortable: !0,
|
|
348
|
+
render: (e) => {
|
|
349
|
+
const s = e || 0;
|
|
350
|
+
return /* @__PURE__ */ t(
|
|
351
|
+
"span",
|
|
352
|
+
{
|
|
353
|
+
className: `ss-dash-duration ${R(s)}`,
|
|
354
|
+
children: s.toFixed(2) + "ms"
|
|
355
|
+
}
|
|
356
|
+
);
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
key: "method",
|
|
361
|
+
label: "Method",
|
|
362
|
+
width: "60px",
|
|
363
|
+
render: (e, s) => {
|
|
364
|
+
const n = Q(s);
|
|
365
|
+
return /* @__PURE__ */ t("span", { className: `ss-dash-method ss-dash-method-${n.toLowerCase()}`, children: n });
|
|
366
|
+
}
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
key: "model",
|
|
370
|
+
label: "Model",
|
|
371
|
+
width: "90px",
|
|
372
|
+
render: (e) => /* @__PURE__ */ t(
|
|
373
|
+
"span",
|
|
374
|
+
{
|
|
375
|
+
style: {
|
|
376
|
+
color: "var(--ss-muted)",
|
|
377
|
+
overflow: "hidden",
|
|
378
|
+
textOverflow: "ellipsis",
|
|
379
|
+
whiteSpace: "nowrap"
|
|
380
|
+
},
|
|
381
|
+
title: e,
|
|
382
|
+
children: e || "-"
|
|
383
|
+
}
|
|
384
|
+
)
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
key: "connection",
|
|
388
|
+
label: "Connection",
|
|
389
|
+
width: "80px",
|
|
390
|
+
render: (e) => /* @__PURE__ */ t(
|
|
391
|
+
"span",
|
|
392
|
+
{
|
|
393
|
+
style: {
|
|
394
|
+
color: "var(--ss-dim)",
|
|
395
|
+
overflow: "hidden",
|
|
396
|
+
textOverflow: "ellipsis",
|
|
397
|
+
whiteSpace: "nowrap"
|
|
398
|
+
},
|
|
399
|
+
children: e || "-"
|
|
400
|
+
}
|
|
401
|
+
)
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
key: "createdAt",
|
|
405
|
+
label: "Time",
|
|
406
|
+
width: "90px",
|
|
407
|
+
sortable: !0,
|
|
408
|
+
render: (e, s) => {
|
|
409
|
+
const n = e || (Y(s) ?? "");
|
|
410
|
+
return /* @__PURE__ */ t(te, { ts: n, className: "ss-dash-event-time" });
|
|
411
|
+
}
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
key: "id",
|
|
415
|
+
label: "",
|
|
416
|
+
width: "70px",
|
|
417
|
+
render: (e, s) => {
|
|
418
|
+
if (Q(s) !== "select") return null;
|
|
419
|
+
const h = o?.queryId === s.id && !o?.error;
|
|
420
|
+
return /* @__PURE__ */ t(
|
|
421
|
+
"button",
|
|
422
|
+
{
|
|
423
|
+
type: "button",
|
|
424
|
+
className: `ss-dash-explain-btn${h ? " ss-dash-explain-btn-active" : ""}`,
|
|
425
|
+
onClick: (x) => {
|
|
426
|
+
x.stopPropagation(), V(s.id);
|
|
427
|
+
},
|
|
428
|
+
disabled: j === s.id,
|
|
429
|
+
children: j === s.id ? "..." : "EXPLAIN"
|
|
430
|
+
}
|
|
431
|
+
);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
],
|
|
435
|
+
data: p,
|
|
436
|
+
sort: c,
|
|
437
|
+
sortDir: i,
|
|
438
|
+
onSort: K,
|
|
439
|
+
emptyMessage: "No queries recorded",
|
|
440
|
+
renderAfterRow: B
|
|
441
|
+
}
|
|
442
|
+
) }),
|
|
443
|
+
k && /* @__PURE__ */ t(
|
|
444
|
+
ae,
|
|
445
|
+
{
|
|
446
|
+
page: k.page,
|
|
447
|
+
lastPage: k.lastPage,
|
|
448
|
+
total: k.total,
|
|
449
|
+
onPageChange: f
|
|
450
|
+
}
|
|
451
|
+
)
|
|
452
|
+
] })
|
|
453
|
+
] });
|
|
454
|
+
}
|
|
455
|
+
export {
|
|
456
|
+
me as QueriesSection,
|
|
457
|
+
me as default
|
|
458
|
+
};
|
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
import { jsx as e, jsxs as t, Fragment as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { filterQueries as
|
|
4
|
-
import {
|
|
5
|
-
import { u as
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { jsx as e, jsxs as t, Fragment as w } from "react/jsx-runtime";
|
|
2
|
+
import { useState as m, useMemo as i, useCallback as C } from "react";
|
|
3
|
+
import { filterQueries as v, countDuplicateQueries as D, computeQuerySummary as S, formatDuration as p, durationClassName as T } from "adonisjs-server-stats/core";
|
|
4
|
+
import { T as Q } from "./TimeAgoCell-o3KigGfM.js";
|
|
5
|
+
import { u as M, M as $ } from "./index-DwDK-4oX.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, f] = m(""), [y, x] = m(null), d = i(() => n?.queries || [], [n]), r = i(() => v(d, o), [d, o]), a = i(() => D(d), [d]), l = i(
|
|
10
|
+
() => S(d, a),
|
|
10
11
|
[d, a]
|
|
11
|
-
),
|
|
12
|
+
), h = C((s) => {
|
|
12
13
|
x((c) => c === s ? null : s);
|
|
13
|
-
}, []), N =
|
|
14
|
-
return
|
|
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: [
|
|
15
16
|
"Error: ",
|
|
16
17
|
u.message
|
|
17
18
|
] }) : /* @__PURE__ */ t("div", { children: [
|
|
18
19
|
/* @__PURE__ */ e(
|
|
19
|
-
|
|
20
|
+
F,
|
|
20
21
|
{
|
|
21
22
|
search: o,
|
|
22
|
-
onSearchChange:
|
|
23
|
+
onSearchChange: f,
|
|
23
24
|
placeholder: "Filter queries...",
|
|
24
|
-
summary: /* @__PURE__ */ t(
|
|
25
|
+
summary: /* @__PURE__ */ t(w, { children: [
|
|
25
26
|
r.length,
|
|
26
27
|
" queries",
|
|
27
28
|
l.slowCount > 0 && ` | ${l.slowCount} slow`,
|
|
@@ -53,11 +54,11 @@ function A({ options: b }) {
|
|
|
53
54
|
/* @__PURE__ */ e(
|
|
54
55
|
"span",
|
|
55
56
|
{
|
|
56
|
-
className: `ss-dbg-sql ${
|
|
57
|
-
onClick: () =>
|
|
57
|
+
className: `ss-dbg-sql ${y === s.id ? "ss-dbg-expanded" : ""}`,
|
|
58
|
+
onClick: () => h(s.id),
|
|
58
59
|
role: "button",
|
|
59
60
|
tabIndex: 0,
|
|
60
|
-
onKeyDown: (c) => c.key === "Enter" &&
|
|
61
|
+
onKeyDown: (c) => c.key === "Enter" && h(s.id),
|
|
61
62
|
children: s.sql
|
|
62
63
|
}
|
|
63
64
|
),
|
|
@@ -70,13 +71,13 @@ function A({ options: b }) {
|
|
|
70
71
|
/* @__PURE__ */ e(
|
|
71
72
|
"td",
|
|
72
73
|
{
|
|
73
|
-
className: `ss-dbg-duration ${
|
|
74
|
+
className: `ss-dbg-duration ${T(s.duration, "ss-dbg")}`,
|
|
74
75
|
children: p(s.duration)
|
|
75
76
|
}
|
|
76
77
|
),
|
|
77
|
-
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e(
|
|
78
|
+
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e($, { method: s.method, classPrefix: "ss-dbg" }) }),
|
|
78
79
|
/* @__PURE__ */ e("td", { className: "ss-dbg-c-muted", children: s.model || "-" }),
|
|
79
|
-
/* @__PURE__ */ e("td", { className: "ss-dbg-event-time"
|
|
80
|
+
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e(Q, { ts: s.timestamp, className: "ss-dbg-event-time" }) })
|
|
80
81
|
] }, s.id)) })
|
|
81
82
|
] })
|
|
82
83
|
] });
|