adonisjs-server-stats 1.12.0 → 1.12.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/react/{CacheSection-DZFOiOYH.js → CacheSection-ewL3Ss82.js} +1 -1
- package/dist/react/{CacheTab-D8js5o69.js → CacheTab-B1wjTs64.js} +1 -1
- package/dist/react/{ConfigSection-DoJmvNkF.js → ConfigSection-DAHu9mfy.js} +1 -1
- package/dist/react/{ConfigTab-CDvljuBF.js → ConfigTab-B4E7Pitz.js} +1 -1
- package/dist/react/{CustomPaneTab-Db9eIQ-9.js → CustomPaneTab-iP7K6TLu.js} +1 -1
- package/dist/react/{EmailsSection-D7oxvAjA.js → EmailsSection-hUkyUnKo.js} +1 -1
- package/dist/react/{EmailsTab-BITuGTQm.js → EmailsTab-zZ4ucCv5.js} +1 -1
- package/dist/react/{EventsSection-7mDZv70I.js → EventsSection-CbGz-b_I.js} +1 -1
- package/dist/react/{EventsTab-DF13BChE.js → EventsTab-BUNTKy9p.js} +1 -1
- package/dist/react/{JobsSection-B_VJFWy6.js → JobsSection-D10TwmEZ.js} +1 -1
- package/dist/react/{JobsTab-DK8Fl9nz.js → JobsTab-CGrcuRPt.js} +1 -1
- package/dist/react/{LogEntryRow-Bdie9SFe.js → LogEntryRow-CkS9LMbl.js} +1 -1
- package/dist/react/{LogsSection-CrWqxWRr.js → LogsSection-BhS0Orbh.js} +2 -2
- package/dist/react/{LogsTab-DYSpL637.js → LogsTab-TChjBgV3.js} +2 -2
- package/dist/react/{OverviewSection-CuaccMZt.js → OverviewSection-DhU9kO4C.js} +1 -1
- package/dist/react/QueriesSection-Dz4Eird3.js +123 -0
- package/dist/react/QueriesTab-CGMtuFFF.js +87 -0
- package/dist/react/{RequestsSection-mENyeNsk.js → RequestsSection-CrwlbkXj.js} +2 -2
- package/dist/react/{RoutesSection-DjovlaNS.js → RoutesSection-DNmTM3w6.js} +1 -1
- package/dist/react/{RoutesTab-CbQECiUc.js → RoutesTab-BS4PNbRf.js} +1 -1
- package/dist/react/{SplitPaneWrapper-DyRyH5Re.js → SplitPaneWrapper-CIygm7YI.js} +1 -1
- package/dist/react/{TimelineTab-BKTFbsPe.js → TimelineTab-M3wrwrmF.js} +2 -2
- package/dist/react/{index-CAUHa8QX.js → index-LkZK--Bi.js} +2 -2
- package/dist/react/index.js +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/vue/{CacheSection-Bx41lpfK.js → CacheSection-PpnXregU.js} +1 -1
- package/dist/vue/{ConfigSection-fkfUdCmx.js → ConfigSection-CX5Vg95P.js} +1 -1
- package/dist/vue/{EmailsSection-CbcDKF9Q.js → EmailsSection-BGHPwUgY.js} +1 -1
- package/dist/vue/{EventsSection-CWbTYOBi.js → EventsSection-x1DFVMLb.js} +1 -1
- package/dist/vue/{JobsSection-CGGO6rtS.js → JobsSection-BEiYKfvI.js} +1 -1
- package/dist/vue/{LogsSection-BPB-C-XA.js → LogsSection-ChxccWDj.js} +1 -1
- package/dist/vue/{OverviewSection-BTcnPeoM.js → OverviewSection-OAWpIQZS.js} +1 -1
- package/dist/vue/{QueriesSection-2SE3igQJ.js → QueriesSection-gKNTbjZz.js} +127 -115
- package/dist/vue/{RequestsSection-DXcG5Zok.js → RequestsSection-CgLTYSVg.js} +1 -1
- package/dist/vue/{RoutesSection-BkNGWdoP.js → RoutesSection-Bhnj_f3a.js} +1 -1
- package/dist/vue/{index-CptF6Qbp.js → index-DQxTdRYT.js} +1 -1
- package/dist/vue/index.js +1 -1
- package/package.json +1 -1
- package/dist/react/QueriesSection-CvGGh5Ij.js +0 -117
- package/dist/react/QueriesTab-C7CCwhVc.js +0 -87
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { jsx as g, jsxs as j } from "react/jsx-runtime";
|
|
2
|
-
import { useState as E, useRef as z, useCallback as s, useEffect as L, useMemo as w } from "react";
|
|
3
|
-
import { QueriesController as T, resolveField as i, computeDashboardQuerySummary as V } from "adonisjs-server-stats/core";
|
|
4
|
-
import { a as q } from "./index-CAUHa8QX.js";
|
|
5
|
-
import { Q as F } from "./QueriesContent-BDIx8zFn.js";
|
|
6
|
-
function O({ options: v = {} }) {
|
|
7
|
-
const [S, u] = E(1), r = z(new T("list")), [h, b] = E(r.current.state), n = s(() => {
|
|
8
|
-
b({ ...r.current.state });
|
|
9
|
-
}, []), { viewMode: a, sort: f, search: x } = h, c = s(
|
|
10
|
-
(e) => {
|
|
11
|
-
e !== r.current.state.viewMode && (r.current.setViewMode(e), u(1), n());
|
|
12
|
-
},
|
|
13
|
-
[n]
|
|
14
|
-
), D = s(
|
|
15
|
-
(e) => {
|
|
16
|
-
r.current.setSearch(e), n();
|
|
17
|
-
},
|
|
18
|
-
[n]
|
|
19
|
-
);
|
|
20
|
-
L(() => u(1), [x]);
|
|
21
|
-
const Q = a === "grouped" ? "queries/grouped" : "queries", { data: d, meta: p, isLoading: y, getApi: C } = q(Q, {
|
|
22
|
-
...v,
|
|
23
|
-
page: S,
|
|
24
|
-
search: x,
|
|
25
|
-
sort: f.key,
|
|
26
|
-
sortDir: f.dir
|
|
27
|
-
}), _ = s(
|
|
28
|
-
(e) => {
|
|
29
|
-
r.current.toggleSort(e), n();
|
|
30
|
-
},
|
|
31
|
-
[n]
|
|
32
|
-
), $ = s(
|
|
33
|
-
(e) => {
|
|
34
|
-
r.current.toggleExpand(e), n();
|
|
35
|
-
},
|
|
36
|
-
[n]
|
|
37
|
-
), M = s(
|
|
38
|
-
async (e) => {
|
|
39
|
-
const t = r.current.getExplainState(e);
|
|
40
|
-
if (t && !t.loading) {
|
|
41
|
-
r.current.clearExplain(), n();
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
r.current.startExplain(e), n();
|
|
45
|
-
try {
|
|
46
|
-
const o = await C().explainQuery(e);
|
|
47
|
-
o && o.error ? r.current.completeExplain(e, {
|
|
48
|
-
rows: [],
|
|
49
|
-
error: o.error,
|
|
50
|
-
message: o.message
|
|
51
|
-
}) : r.current.completeExplain(e, {
|
|
52
|
-
plan: o?.plan || void 0,
|
|
53
|
-
rows: o?.rows || void 0
|
|
54
|
-
});
|
|
55
|
-
} catch (o) {
|
|
56
|
-
console.warn("[ss] Query explain failed:", o), r.current.failExplain(
|
|
57
|
-
e,
|
|
58
|
-
o instanceof Error ? o.message : String(o)
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
n();
|
|
62
|
-
},
|
|
63
|
-
[C, n]
|
|
64
|
-
), k = s(() => {
|
|
65
|
-
r.current.clearExplain(), n();
|
|
66
|
-
}, [n]), m = a === "grouped" ? d?.groups || [] : d || [], l = w(() => a !== "grouped" ? m : m.map((e) => {
|
|
67
|
-
const t = { ...e };
|
|
68
|
-
return t.sqlNormalized ??= i(e, "sql_normalized", "pattern") ?? void 0, t.count ??= i(e, "total_count"), t.avgDuration ??= i(e, "avg_duration"), t.maxDuration ??= i(e, "max_duration"), t.minDuration ??= i(e, "min_duration"), t.totalDuration ??= i(e, "total_duration"), t.percentOfTotal ??= i(e, "pct_time"), t;
|
|
69
|
-
}), [m, a]), N = w(() => {
|
|
70
|
-
if (a === "grouped")
|
|
71
|
-
return `${l.length} query patterns`;
|
|
72
|
-
const e = V(l, p ?? void 0), t = [`${e.totalCount} queries`];
|
|
73
|
-
return e.slowCount > 0 && t.push(`${e.slowCount} slow`), e.dupCount > 0 && t.push(`${e.dupCount} dup`), t.push(`avg ${(e.avgDuration || 0).toFixed(1)}ms`), t.join(", ");
|
|
74
|
-
}, [a, l, p]);
|
|
75
|
-
return /* @__PURE__ */ g(
|
|
76
|
-
F,
|
|
77
|
-
{
|
|
78
|
-
mode: "dashboard",
|
|
79
|
-
controllerState: h,
|
|
80
|
-
queries: l,
|
|
81
|
-
meta: p,
|
|
82
|
-
isLoading: y && !d,
|
|
83
|
-
onSearchChange: D,
|
|
84
|
-
onSort: _,
|
|
85
|
-
onToggleExpand: $,
|
|
86
|
-
onViewModeChange: c,
|
|
87
|
-
onPageChange: u,
|
|
88
|
-
onExplain: M,
|
|
89
|
-
onCloseExplain: k,
|
|
90
|
-
summary: N,
|
|
91
|
-
filterBarChildren: /* @__PURE__ */ j("div", { className: "ss-dash-btn-group", children: [
|
|
92
|
-
/* @__PURE__ */ g(
|
|
93
|
-
"button",
|
|
94
|
-
{
|
|
95
|
-
type: "button",
|
|
96
|
-
className: `ss-dash-btn ${a === "list" ? "ss-dash-active" : ""}`,
|
|
97
|
-
onClick: () => c("list"),
|
|
98
|
-
children: "List"
|
|
99
|
-
}
|
|
100
|
-
),
|
|
101
|
-
/* @__PURE__ */ g(
|
|
102
|
-
"button",
|
|
103
|
-
{
|
|
104
|
-
type: "button",
|
|
105
|
-
className: `ss-dash-btn ${a === "grouped" ? "ss-dash-active" : ""}`,
|
|
106
|
-
onClick: () => c("grouped"),
|
|
107
|
-
children: "Grouped"
|
|
108
|
-
}
|
|
109
|
-
)
|
|
110
|
-
] })
|
|
111
|
-
}
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
export {
|
|
115
|
-
O as QueriesSection,
|
|
116
|
-
O as default
|
|
117
|
-
};
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { jsx as S, jsxs as w, Fragment as N } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as L, useState as R, useCallback as o, useMemo as l } from "react";
|
|
3
|
-
import { QueriesController as q, filterQueries as z, countDuplicateQueries as A, computeQuerySummary as B, formatDuration as F } from "adonisjs-server-stats/core";
|
|
4
|
-
import { u as M } from "./index-CAUHa8QX.js";
|
|
5
|
-
import { Q as U } from "./QueriesContent-BDIx8zFn.js";
|
|
6
|
-
function P({ options: m }) {
|
|
7
|
-
const { baseUrl: d = "", debugEndpoint: g = "/admin/api/debug", authToken: c } = m || {}, { data: u, isLoading: Q, error: h } = M("queries", m), e = L(new q("list")), [f, b] = R(e.current.state), t = o(() => {
|
|
8
|
-
b({ ...e.current.state });
|
|
9
|
-
}, []), { search: x } = f, y = o(
|
|
10
|
-
(r) => {
|
|
11
|
-
e.current.setSearch(r), t();
|
|
12
|
-
},
|
|
13
|
-
[t]
|
|
14
|
-
), $ = o(
|
|
15
|
-
(r) => {
|
|
16
|
-
e.current.toggleExpand(r), t();
|
|
17
|
-
},
|
|
18
|
-
[t]
|
|
19
|
-
), v = o((r) => {
|
|
20
|
-
}, []), D = o(
|
|
21
|
-
async (r) => {
|
|
22
|
-
const C = e.current.getExplainState(r);
|
|
23
|
-
if (C && !C.loading) {
|
|
24
|
-
e.current.clearExplain(), t();
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
e.current.startExplain(r), t();
|
|
28
|
-
try {
|
|
29
|
-
const n = {};
|
|
30
|
-
c && (n.Authorization = `Bearer ${c}`);
|
|
31
|
-
const k = `${d}${g}/queries/${r}/explain`, a = await (await fetch(k, { headers: n })).json();
|
|
32
|
-
a && a.error ? e.current.completeExplain(r, {
|
|
33
|
-
rows: [],
|
|
34
|
-
error: a.error,
|
|
35
|
-
message: a.message
|
|
36
|
-
}) : e.current.completeExplain(r, {
|
|
37
|
-
plan: a?.plan || void 0,
|
|
38
|
-
rows: a?.rows || void 0
|
|
39
|
-
});
|
|
40
|
-
} catch (n) {
|
|
41
|
-
console.warn("[ss] Query explain failed:", n), e.current.failExplain(
|
|
42
|
-
r,
|
|
43
|
-
n instanceof Error ? n.message : String(n)
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
t();
|
|
47
|
-
},
|
|
48
|
-
[d, g, c, t]
|
|
49
|
-
), T = o(() => {
|
|
50
|
-
e.current.clearExplain(), t();
|
|
51
|
-
}, [t]), s = l(() => u?.queries || [], [u]), p = l(() => z(s, x), [s, x]), E = l(() => A(s), [s]), i = l(
|
|
52
|
-
() => B(s, E),
|
|
53
|
-
[s, E]
|
|
54
|
-
);
|
|
55
|
-
if (Q && !u)
|
|
56
|
-
return /* @__PURE__ */ S("div", { className: "ss-dash-empty", children: "Loading queries..." });
|
|
57
|
-
if (h)
|
|
58
|
-
return /* @__PURE__ */ w("div", { className: "ss-dash-empty", children: [
|
|
59
|
-
"Error: ",
|
|
60
|
-
h.message
|
|
61
|
-
] });
|
|
62
|
-
const j = /* @__PURE__ */ w(N, { children: [
|
|
63
|
-
p.length,
|
|
64
|
-
" queries",
|
|
65
|
-
i.slowCount > 0 && ` | ${i.slowCount} slow`,
|
|
66
|
-
i.dupCount > 0 && ` | ${i.dupCount} dup`,
|
|
67
|
-
p.length > 0 && ` | avg ${F(i.avgDuration)}`
|
|
68
|
-
] });
|
|
69
|
-
return /* @__PURE__ */ S(
|
|
70
|
-
U,
|
|
71
|
-
{
|
|
72
|
-
mode: "debug",
|
|
73
|
-
controllerState: f,
|
|
74
|
-
queries: p,
|
|
75
|
-
onSearchChange: y,
|
|
76
|
-
onSort: v,
|
|
77
|
-
onToggleExpand: $,
|
|
78
|
-
onExplain: D,
|
|
79
|
-
onCloseExplain: T,
|
|
80
|
-
summary: j
|
|
81
|
-
}
|
|
82
|
-
);
|
|
83
|
-
}
|
|
84
|
-
export {
|
|
85
|
-
P as QueriesTab,
|
|
86
|
-
P as default
|
|
87
|
-
};
|