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,135 @@
|
|
|
1
|
+
import { jsxs as o, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useState as c, useCallback as k } from "react";
|
|
3
|
+
import { formatCacheSize as x, formatTtl as D } from "adonisjs-server-stats/core";
|
|
4
|
+
import { a as N, J as V } from "./index-DwDK-4oX.js";
|
|
5
|
+
import { C as L } from "./CacheStatsBar-CRodCOeP.js";
|
|
6
|
+
import { D as F } from "./DataTable-YyShr5B-.js";
|
|
7
|
+
import { F as T } from "./FilterBar-CQ7bD669.js";
|
|
8
|
+
function _({ options: v = {} }) {
|
|
9
|
+
const [d, b] = c(""), [l, i] = c(null), [w, n] = c(null), [C, h] = c(!1), [y, r] = c(null), { data: u, isLoading: g, mutate: m, getApi: p } = N("cache", {
|
|
10
|
+
...v,
|
|
11
|
+
search: d
|
|
12
|
+
}), a = u, K = k(
|
|
13
|
+
async (e) => {
|
|
14
|
+
if (confirm(`Delete cache key "${e}"?`))
|
|
15
|
+
try {
|
|
16
|
+
await m(`cache/${encodeURIComponent(e)}`, "delete"), l === e && (i(null), n(null), r(null));
|
|
17
|
+
} catch {
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
[m, l]
|
|
21
|
+
), S = k(
|
|
22
|
+
async (e) => {
|
|
23
|
+
if (l === e) {
|
|
24
|
+
i(null), n(null), r(null);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
i(e), n(null), r(null), h(!0);
|
|
28
|
+
try {
|
|
29
|
+
const s = await p().fetchCacheKey(e);
|
|
30
|
+
n(
|
|
31
|
+
s.value !== void 0 ? s.value : s.data !== void 0 ? s.data : s
|
|
32
|
+
), r(null);
|
|
33
|
+
} catch {
|
|
34
|
+
n(null), r("Failed to fetch key value");
|
|
35
|
+
} finally {
|
|
36
|
+
h(!1);
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
[l, p]
|
|
40
|
+
);
|
|
41
|
+
return /* @__PURE__ */ o("div", { children: [
|
|
42
|
+
a?.available && a?.stats && /* @__PURE__ */ t(
|
|
43
|
+
L,
|
|
44
|
+
{
|
|
45
|
+
hitRate: a.stats.hitRate ?? 0,
|
|
46
|
+
hits: a.stats.hits ?? 0,
|
|
47
|
+
misses: a.stats.misses ?? 0,
|
|
48
|
+
keys: a.stats.totalKeys || a.stats.keyCount || a.keys?.length || 0
|
|
49
|
+
}
|
|
50
|
+
),
|
|
51
|
+
/* @__PURE__ */ t(
|
|
52
|
+
T,
|
|
53
|
+
{
|
|
54
|
+
search: d,
|
|
55
|
+
onSearchChange: b,
|
|
56
|
+
placeholder: "Filter cache keys...",
|
|
57
|
+
summary: `${(a?.keys || a?.data || []).length} keys`
|
|
58
|
+
}
|
|
59
|
+
),
|
|
60
|
+
g && !u ? /* @__PURE__ */ t("div", { className: "ss-dash-empty", children: "Loading cache..." }) : !a || !a.available ? /* @__PURE__ */ t("div", { className: "ss-dash-empty", children: "Cache inspector not available" }) : /* @__PURE__ */ t("div", { className: "ss-dash-table-wrap", children: /* @__PURE__ */ t(
|
|
61
|
+
F,
|
|
62
|
+
{
|
|
63
|
+
columns: [
|
|
64
|
+
{
|
|
65
|
+
key: "key",
|
|
66
|
+
label: "Key",
|
|
67
|
+
render: (e) => /* @__PURE__ */ t(
|
|
68
|
+
"span",
|
|
69
|
+
{
|
|
70
|
+
title: e,
|
|
71
|
+
style: {
|
|
72
|
+
color: "var(--ss-sql-color)",
|
|
73
|
+
overflow: "hidden",
|
|
74
|
+
textOverflow: "ellipsis",
|
|
75
|
+
whiteSpace: "nowrap",
|
|
76
|
+
display: "block"
|
|
77
|
+
},
|
|
78
|
+
children: e
|
|
79
|
+
}
|
|
80
|
+
)
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
key: "type",
|
|
84
|
+
label: "Type",
|
|
85
|
+
width: "70px",
|
|
86
|
+
render: (e) => /* @__PURE__ */ t("span", { style: { color: "var(--ss-muted)" }, children: e })
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
key: "size",
|
|
90
|
+
label: "Size",
|
|
91
|
+
width: "60px",
|
|
92
|
+
render: (e) => e != null && e > 0 ? x(e) : "-"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
key: "ttl",
|
|
96
|
+
label: "TTL",
|
|
97
|
+
width: "70px",
|
|
98
|
+
render: (e) => e > 0 ? D(e) : "-"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
key: "_actions",
|
|
102
|
+
label: "",
|
|
103
|
+
width: "60px",
|
|
104
|
+
render: (e, f) => /* @__PURE__ */ t(
|
|
105
|
+
"button",
|
|
106
|
+
{
|
|
107
|
+
type: "button",
|
|
108
|
+
className: "ss-dash-retry-btn",
|
|
109
|
+
onClick: (s) => {
|
|
110
|
+
s.stopPropagation(), K(f.key);
|
|
111
|
+
},
|
|
112
|
+
children: "Delete"
|
|
113
|
+
}
|
|
114
|
+
)
|
|
115
|
+
}
|
|
116
|
+
],
|
|
117
|
+
data: a.keys || a.data || [],
|
|
118
|
+
keyField: "key",
|
|
119
|
+
onRowClick: (e) => S(e.key),
|
|
120
|
+
emptyMessage: "No cache keys found"
|
|
121
|
+
}
|
|
122
|
+
) }),
|
|
123
|
+
l && /* @__PURE__ */ o("div", { className: "ss-dash-cache-detail", children: [
|
|
124
|
+
/* @__PURE__ */ o("h4", { children: [
|
|
125
|
+
"Key: ",
|
|
126
|
+
l
|
|
127
|
+
] }),
|
|
128
|
+
C ? /* @__PURE__ */ t("div", { className: "ss-dash-empty", children: "Loading value..." }) : y ? /* @__PURE__ */ t("div", { className: "ss-dash-empty", style: { color: "var(--ss-red-fg)" }, children: y }) : /* @__PURE__ */ t(V, { data: w })
|
|
129
|
+
] })
|
|
130
|
+
] });
|
|
131
|
+
}
|
|
132
|
+
export {
|
|
133
|
+
_ as CacheSection,
|
|
134
|
+
_ as default
|
|
135
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsxs as a, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
function i({ hitRate: c, hits: e, misses: l, keys: t }) {
|
|
3
|
+
return /* @__PURE__ */ a("div", { className: "ss-cache-stats", children: [
|
|
4
|
+
/* @__PURE__ */ a("div", { className: "ss-cache-stat", children: [
|
|
5
|
+
/* @__PURE__ */ s("span", { className: "ss-cache-stat-label", children: "Hit Rate:" }),
|
|
6
|
+
/* @__PURE__ */ a("span", { className: "ss-cache-stat-value", children: [
|
|
7
|
+
c.toFixed(1),
|
|
8
|
+
"%"
|
|
9
|
+
] })
|
|
10
|
+
] }),
|
|
11
|
+
/* @__PURE__ */ a("div", { className: "ss-cache-stat", children: [
|
|
12
|
+
/* @__PURE__ */ s("span", { className: "ss-cache-stat-label", children: "Hits:" }),
|
|
13
|
+
/* @__PURE__ */ s("span", { className: "ss-cache-stat-value", children: e })
|
|
14
|
+
] }),
|
|
15
|
+
/* @__PURE__ */ a("div", { className: "ss-cache-stat", children: [
|
|
16
|
+
/* @__PURE__ */ s("span", { className: "ss-cache-stat-label", children: "Misses:" }),
|
|
17
|
+
/* @__PURE__ */ s("span", { className: "ss-cache-stat-value", children: l })
|
|
18
|
+
] }),
|
|
19
|
+
/* @__PURE__ */ a("div", { className: "ss-cache-stat", children: [
|
|
20
|
+
/* @__PURE__ */ s("span", { className: "ss-cache-stat-label", children: "Keys:" }),
|
|
21
|
+
/* @__PURE__ */ s("span", { className: "ss-cache-stat-value", children: t })
|
|
22
|
+
] })
|
|
23
|
+
] });
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
i as C
|
|
27
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
import { useState as u, useMemo as T, useCallback as z } from "react";
|
|
3
|
+
import { formatTtl as K, formatCacheSize as L } from "adonisjs-server-stats/core";
|
|
4
|
+
import { u as R } from "./useDashboardApiBase-Bi36pJ2L.js";
|
|
5
|
+
import { u as $, J as j } from "./index-DwDK-4oX.js";
|
|
6
|
+
import { u as A } from "./useResizableTable-CNJmACdt.js";
|
|
7
|
+
import { C as F } from "./CacheStatsBar-CRodCOeP.js";
|
|
8
|
+
import { F as D } from "./FilterBar-CQ7bD669.js";
|
|
9
|
+
function G({ options: l, dashboardPath: y }) {
|
|
10
|
+
const { dashApiBase: p, resolvedOptions: k } = R(y, l), { data: a, isLoading: C, error: b } = $("cache", k), [r, N] = u(""), [i, n] = u(null), [f, h] = u(null), o = T(() => {
|
|
11
|
+
const s = a?.keys || [];
|
|
12
|
+
if (!r) return s;
|
|
13
|
+
const m = r.toLowerCase();
|
|
14
|
+
return s.filter((c) => c.key.toLowerCase().includes(m));
|
|
15
|
+
}, [a, r]), v = z(
|
|
16
|
+
async (s) => {
|
|
17
|
+
if (i === s) {
|
|
18
|
+
n(null), h(null);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
n(s);
|
|
22
|
+
try {
|
|
23
|
+
const { baseUrl: m = "", authToken: c } = l || {}, x = p || l?.debugEndpoint || "/admin/api/debug", B = `${m}${x}/cache/${encodeURIComponent(s)}`, g = { Accept: "application/json" };
|
|
24
|
+
c && (g.Authorization = `Bearer ${c}`);
|
|
25
|
+
const S = await (await fetch(B, {
|
|
26
|
+
headers: g,
|
|
27
|
+
credentials: c ? "omit" : "same-origin"
|
|
28
|
+
})).json();
|
|
29
|
+
h(S);
|
|
30
|
+
} catch {
|
|
31
|
+
h({ error: "Failed to fetch key value" });
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
[i, l, p]
|
|
35
|
+
), w = A([o]);
|
|
36
|
+
if (C && !a)
|
|
37
|
+
return /* @__PURE__ */ e("div", { className: "ss-dbg-empty", children: "Loading cache data..." });
|
|
38
|
+
if (b)
|
|
39
|
+
return /* @__PURE__ */ t("div", { className: "ss-dbg-empty", children: [
|
|
40
|
+
"Error: ",
|
|
41
|
+
b.message
|
|
42
|
+
] });
|
|
43
|
+
if (!a)
|
|
44
|
+
return /* @__PURE__ */ e("div", { className: "ss-dbg-empty", children: "Cache inspector not available" });
|
|
45
|
+
const d = a.stats || a;
|
|
46
|
+
return /* @__PURE__ */ t("div", { children: [
|
|
47
|
+
/* @__PURE__ */ e(
|
|
48
|
+
F,
|
|
49
|
+
{
|
|
50
|
+
hitRate: d.hitRate ?? 0,
|
|
51
|
+
hits: d.totalHits ?? 0,
|
|
52
|
+
misses: d.totalMisses ?? 0,
|
|
53
|
+
keys: d.keyCount ?? 0
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
/* @__PURE__ */ e(
|
|
57
|
+
D,
|
|
58
|
+
{
|
|
59
|
+
search: r,
|
|
60
|
+
onSearchChange: N,
|
|
61
|
+
placeholder: "Filter keys...",
|
|
62
|
+
summary: `${o.length} keys`
|
|
63
|
+
}
|
|
64
|
+
),
|
|
65
|
+
i && !!f && /* @__PURE__ */ t("div", { className: "ss-dbg-cache-detail", children: [
|
|
66
|
+
/* @__PURE__ */ e("strong", { children: i }),
|
|
67
|
+
/* @__PURE__ */ t("button", { type: "button", className: "ss-dbg-btn-clear", onClick: () => n(null), children: [
|
|
68
|
+
"←",
|
|
69
|
+
" Back"
|
|
70
|
+
] }),
|
|
71
|
+
/* @__PURE__ */ e(j, { data: f, classPrefix: "ss-dbg" })
|
|
72
|
+
] }),
|
|
73
|
+
o.length === 0 ? /* @__PURE__ */ e("div", { className: "ss-dbg-empty", children: "No cache keys found" }) : /* @__PURE__ */ t("table", { ref: w, className: "ss-dbg-table", children: [
|
|
74
|
+
/* @__PURE__ */ t("colgroup", { children: [
|
|
75
|
+
/* @__PURE__ */ e("col", {}),
|
|
76
|
+
/* @__PURE__ */ e("col", { style: { width: "80px" } }),
|
|
77
|
+
/* @__PURE__ */ e("col", { style: { width: "80px" } }),
|
|
78
|
+
/* @__PURE__ */ e("col", { style: { width: "80px" } })
|
|
79
|
+
] }),
|
|
80
|
+
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ t("tr", { children: [
|
|
81
|
+
/* @__PURE__ */ e("th", { children: "Key" }),
|
|
82
|
+
/* @__PURE__ */ e("th", { children: "Type" }),
|
|
83
|
+
/* @__PURE__ */ e("th", { children: "TTL" }),
|
|
84
|
+
/* @__PURE__ */ e("th", { children: "Size" })
|
|
85
|
+
] }) }),
|
|
86
|
+
/* @__PURE__ */ e("tbody", { children: o.map((s) => /* @__PURE__ */ t(
|
|
87
|
+
"tr",
|
|
88
|
+
{
|
|
89
|
+
className: "ss-dbg-email-row",
|
|
90
|
+
onClick: () => v(s.key),
|
|
91
|
+
children: [
|
|
92
|
+
/* @__PURE__ */ e("td", { className: "ss-dbg-c-sql", children: s.key }),
|
|
93
|
+
/* @__PURE__ */ e("td", { className: "ss-dbg-c-muted", children: s.type }),
|
|
94
|
+
/* @__PURE__ */ e("td", { className: "ss-dbg-c-muted", children: s.ttl > 0 ? K(s.ttl) : "-" }),
|
|
95
|
+
/* @__PURE__ */ e("td", { className: "ss-dbg-c-dim", children: s.size > 0 ? L(s.size) : "-" })
|
|
96
|
+
]
|
|
97
|
+
},
|
|
98
|
+
s.key
|
|
99
|
+
)) })
|
|
100
|
+
] })
|
|
101
|
+
] });
|
|
102
|
+
}
|
|
103
|
+
export {
|
|
104
|
+
G as CacheTab,
|
|
105
|
+
G as default
|
|
106
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { a as i } from "./index-
|
|
2
|
+
import { a as i } from "./index-DwDK-4oX.js";
|
|
3
3
|
import { C as n } from "./ConfigContent-CnsEI4j3.js";
|
|
4
4
|
function m({ options: o = {} }) {
|
|
5
5
|
const { data: a, isLoading: s } = i("config", o);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as i, jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import { u as f } from "./useDashboardApiBase-Bi36pJ2L.js";
|
|
3
|
-
import { u as m } from "./index-
|
|
3
|
+
import { u as m } from "./index-DwDK-4oX.js";
|
|
4
4
|
import { C as d } from "./ConfigContent-CnsEI4j3.js";
|
|
5
5
|
function b({ options: r, dashboardPath: o }) {
|
|
6
6
|
const { resolvedOptions: a } = f(o, r), { data: e, isLoading: t, error: s } = m("config", a);
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { jsxs as l, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useState as w, useMemo as f } from "react";
|
|
3
|
+
import { compactPreview as k, formatDuration as x, durationClassName as M } from "adonisjs-server-stats/core";
|
|
4
|
+
import { u as L, B as A, M as B } from "./index-DwDK-4oX.js";
|
|
5
|
+
import { T as b } from "./TimeAgoCell-o3KigGfM.js";
|
|
6
|
+
import { u as D } from "./useResizableTable-CNJmACdt.js";
|
|
7
|
+
import { F as P } from "./FilterBar-CQ7bD669.js";
|
|
8
|
+
function z({ pane: t, options: g }) {
|
|
9
|
+
({
|
|
10
|
+
...g
|
|
11
|
+
});
|
|
12
|
+
const { data: o, isLoading: u, error: h, clearData: p } = L(
|
|
13
|
+
t.endpoint.replace(/^\//, ""),
|
|
14
|
+
{
|
|
15
|
+
...g,
|
|
16
|
+
debugEndpoint: ""
|
|
17
|
+
// Use endpoint directly
|
|
18
|
+
}
|
|
19
|
+
), [i, y] = w(""), c = f(() => {
|
|
20
|
+
if (!o) return [];
|
|
21
|
+
const e = t.dataKey || t.id;
|
|
22
|
+
let s = o;
|
|
23
|
+
for (const a of e.split("."))
|
|
24
|
+
s = s?.[a];
|
|
25
|
+
return Array.isArray(s) ? s : [];
|
|
26
|
+
}, [o, t.dataKey, t.id]), d = f(() => {
|
|
27
|
+
if (!i) return c;
|
|
28
|
+
const e = i.toLowerCase(), s = t.columns.filter((a) => a.searchable).map((a) => a.key);
|
|
29
|
+
return s.length === 0 ? c : c.filter(
|
|
30
|
+
(a) => s.some((n) => {
|
|
31
|
+
const m = a[n];
|
|
32
|
+
return m !== null && String(m).toLowerCase().includes(e);
|
|
33
|
+
})
|
|
34
|
+
);
|
|
35
|
+
}, [c, i, t.columns]), N = (e, s) => {
|
|
36
|
+
if (e == null)
|
|
37
|
+
return /* @__PURE__ */ r("span", { className: "ss-dbg-c-dim", children: "-" });
|
|
38
|
+
switch (s.format || "text") {
|
|
39
|
+
case "time":
|
|
40
|
+
return typeof e == "number" ? /* @__PURE__ */ r(b, { ts: e, className: "ss-dbg-event-time" }) : /* @__PURE__ */ r("span", { className: "ss-dbg-event-time", children: String(e) });
|
|
41
|
+
case "timeAgo":
|
|
42
|
+
return /* @__PURE__ */ r(b, { ts: e, className: "ss-dbg-event-time" });
|
|
43
|
+
case "duration": {
|
|
44
|
+
const n = typeof e == "number" ? e : parseFloat(String(e));
|
|
45
|
+
return isNaN(n) ? String(e) : /* @__PURE__ */ r(
|
|
46
|
+
"span",
|
|
47
|
+
{
|
|
48
|
+
className: `ss-dbg-duration ${M(n, "ss-dbg")}`,
|
|
49
|
+
children: x(n)
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
case "method":
|
|
54
|
+
return /* @__PURE__ */ r(B, { method: String(e), classPrefix: "ss-dbg" });
|
|
55
|
+
case "json": {
|
|
56
|
+
let n = e;
|
|
57
|
+
if (typeof e == "string")
|
|
58
|
+
try {
|
|
59
|
+
n = JSON.parse(e);
|
|
60
|
+
} catch {
|
|
61
|
+
}
|
|
62
|
+
return k(n, 80);
|
|
63
|
+
}
|
|
64
|
+
case "badge": {
|
|
65
|
+
const n = String(e).toLowerCase(), C = (s.badgeColorMap || {})[n] || "muted";
|
|
66
|
+
return /* @__PURE__ */ r(A, { color: C, classPrefix: "ss-dbg", children: String(e) });
|
|
67
|
+
}
|
|
68
|
+
default:
|
|
69
|
+
return String(e);
|
|
70
|
+
}
|
|
71
|
+
}, S = D([d]);
|
|
72
|
+
return u && !o ? /* @__PURE__ */ l("div", { className: "ss-dbg-empty", children: [
|
|
73
|
+
"Loading ",
|
|
74
|
+
t.label,
|
|
75
|
+
"..."
|
|
76
|
+
] }) : h ? /* @__PURE__ */ l("div", { className: "ss-dbg-empty", children: [
|
|
77
|
+
"Error: ",
|
|
78
|
+
h.message
|
|
79
|
+
] }) : /* @__PURE__ */ l("div", { children: [
|
|
80
|
+
t.search && /* @__PURE__ */ r(
|
|
81
|
+
P,
|
|
82
|
+
{
|
|
83
|
+
search: i,
|
|
84
|
+
onSearchChange: y,
|
|
85
|
+
placeholder: t.search.placeholder,
|
|
86
|
+
summary: `${d.length} items`,
|
|
87
|
+
children: t.clearable && /* @__PURE__ */ r("button", { type: "button", className: "ss-dbg-btn-clear", onClick: p, children: "Clear" })
|
|
88
|
+
}
|
|
89
|
+
),
|
|
90
|
+
d.length === 0 ? /* @__PURE__ */ r("div", { className: "ss-dbg-empty", children: "No data" }) : /* @__PURE__ */ l("table", { ref: S, className: "ss-dbg-table", children: [
|
|
91
|
+
/* @__PURE__ */ r("thead", { children: /* @__PURE__ */ r("tr", { children: t.columns.map((e) => /* @__PURE__ */ r("th", { children: e.label }, e.key)) }) }),
|
|
92
|
+
/* @__PURE__ */ r("tbody", { children: d.map((e, s) => /* @__PURE__ */ r("tr", { children: t.columns.map((a) => /* @__PURE__ */ r("td", { children: N(e[a.key], a) }, a.key)) }, e.id ?? s)) })
|
|
93
|
+
] })
|
|
94
|
+
] });
|
|
95
|
+
}
|
|
96
|
+
export {
|
|
97
|
+
z as CustomPaneTab,
|
|
98
|
+
z as default
|
|
99
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsxs as r, jsx as e, Fragment as d } from "react/jsx-runtime";
|
|
2
|
+
function a({
|
|
3
|
+
email: s,
|
|
4
|
+
previewHtml: n,
|
|
5
|
+
isLoading: t = !1,
|
|
6
|
+
onClose: i,
|
|
7
|
+
className: c
|
|
8
|
+
}) {
|
|
9
|
+
return /* @__PURE__ */ r("div", { className: c || "ss-email-preview", children: [
|
|
10
|
+
/* @__PURE__ */ r("div", { className: "ss-email-preview-header", children: [
|
|
11
|
+
/* @__PURE__ */ e("div", { className: "ss-email-preview-meta", children: s && /* @__PURE__ */ r(d, { children: [
|
|
12
|
+
s.subject != null && /* @__PURE__ */ r("div", { children: [
|
|
13
|
+
/* @__PURE__ */ e("strong", { children: "Subject:" }),
|
|
14
|
+
" ",
|
|
15
|
+
s.subject
|
|
16
|
+
] }),
|
|
17
|
+
s.from != null && /* @__PURE__ */ r("div", { children: [
|
|
18
|
+
/* @__PURE__ */ e("strong", { children: "From:" }),
|
|
19
|
+
" ",
|
|
20
|
+
s.from
|
|
21
|
+
] }),
|
|
22
|
+
s.to != null && /* @__PURE__ */ r("div", { children: [
|
|
23
|
+
/* @__PURE__ */ e("strong", { children: "To:" }),
|
|
24
|
+
" ",
|
|
25
|
+
s.to
|
|
26
|
+
] }),
|
|
27
|
+
s.cc && /* @__PURE__ */ r("div", { children: [
|
|
28
|
+
/* @__PURE__ */ e("strong", { children: "CC:" }),
|
|
29
|
+
" ",
|
|
30
|
+
s.cc
|
|
31
|
+
] }),
|
|
32
|
+
s.status && /* @__PURE__ */ r("div", { children: [
|
|
33
|
+
/* @__PURE__ */ e("strong", { children: "Status:" }),
|
|
34
|
+
" ",
|
|
35
|
+
/* @__PURE__ */ e("span", { className: `ss-email-status ss-email-status-${s.status}`, children: s.status })
|
|
36
|
+
] }),
|
|
37
|
+
s.mailer && /* @__PURE__ */ r("div", { children: [
|
|
38
|
+
/* @__PURE__ */ e("strong", { children: "Mailer:" }),
|
|
39
|
+
" ",
|
|
40
|
+
s.mailer
|
|
41
|
+
] })
|
|
42
|
+
] }) }),
|
|
43
|
+
/* @__PURE__ */ e("button", { className: "ss-dbg-btn-clear", onClick: i, type: "button", children: "×" })
|
|
44
|
+
] }),
|
|
45
|
+
t ? /* @__PURE__ */ e("div", { className: "ss-empty", children: "Loading preview..." }) : n ? /* @__PURE__ */ e(
|
|
46
|
+
"iframe",
|
|
47
|
+
{
|
|
48
|
+
className: "ss-email-iframe",
|
|
49
|
+
srcDoc: n,
|
|
50
|
+
title: "Email preview",
|
|
51
|
+
sandbox: ""
|
|
52
|
+
}
|
|
53
|
+
) : /* @__PURE__ */ e("div", { style: { padding: "12px", whiteSpace: "pre-wrap" }, children: s?.text || "No content" })
|
|
54
|
+
] });
|
|
55
|
+
}
|
|
56
|
+
export {
|
|
57
|
+
a as E
|
|
58
|
+
};
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { jsx as s, jsxs as y, Fragment as P } from "react/jsx-runtime";
|
|
2
|
+
import { useState as l, useEffect as T, useCallback as j } from "react";
|
|
3
|
+
import { resolveCcAddr as N, resolveToAddr as f, resolveFromAddr as b, resolveAttachmentCount as F, resolveTimestamp as _ } from "adonisjs-server-stats/core";
|
|
4
|
+
import { T as $ } from "./TimeAgoCell-o3KigGfM.js";
|
|
5
|
+
import { a as D } from "./index-DwDK-4oX.js";
|
|
6
|
+
import { D as E } from "./DataTable-YyShr5B-.js";
|
|
7
|
+
import { F as O } from "./FilterBar-CQ7bD669.js";
|
|
8
|
+
import { E as B } from "./EmailPreviewOverlay-BmXOAvqG.js";
|
|
9
|
+
import { P as H } from "./Pagination-BkmzUDY8.js";
|
|
10
|
+
function Q({ options: o = {} }) {
|
|
11
|
+
const [x, d] = l(1), [i, g] = l(""), [m, n] = l(null), [p, c] = l(null), { data: h, meta: r, isLoading: k } = D("emails", { ...o, page: x, search: i }), u = h || [];
|
|
12
|
+
T(() => d(1), [i]);
|
|
13
|
+
const A = j(
|
|
14
|
+
async (e) => {
|
|
15
|
+
if (e.html) {
|
|
16
|
+
n(e.id), c(e.html);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
const { baseUrl: t = "", dashboardEndpoint: a = "/__stats/api", authToken: w } = o, S = `${t}${a}/emails/${e.id}/preview`, v = { Accept: "text/html" };
|
|
21
|
+
w && (v.Authorization = `Bearer ${w}`);
|
|
22
|
+
const C = await (await fetch(S, { headers: v, credentials: "same-origin" })).text();
|
|
23
|
+
n(e.id), c(C);
|
|
24
|
+
} catch {
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
[o]
|
|
28
|
+
);
|
|
29
|
+
if (m && p) {
|
|
30
|
+
const e = u.find((a) => a.id === m), t = e ? {
|
|
31
|
+
subject: e.subject,
|
|
32
|
+
from: b(e),
|
|
33
|
+
to: f(e),
|
|
34
|
+
cc: N(e) || null,
|
|
35
|
+
status: e.status,
|
|
36
|
+
mailer: e.mailer
|
|
37
|
+
} : null;
|
|
38
|
+
return /* @__PURE__ */ s(
|
|
39
|
+
B,
|
|
40
|
+
{
|
|
41
|
+
email: t,
|
|
42
|
+
previewHtml: p,
|
|
43
|
+
onClose: () => {
|
|
44
|
+
n(null), c(null);
|
|
45
|
+
},
|
|
46
|
+
className: "ss-dash-email-preview"
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
return /* @__PURE__ */ y("div", { children: [
|
|
51
|
+
/* @__PURE__ */ s(
|
|
52
|
+
O,
|
|
53
|
+
{
|
|
54
|
+
search: i,
|
|
55
|
+
onSearchChange: g,
|
|
56
|
+
placeholder: "Filter emails...",
|
|
57
|
+
summary: `${r?.total ?? 0} emails`
|
|
58
|
+
}
|
|
59
|
+
),
|
|
60
|
+
k && !h ? /* @__PURE__ */ s("div", { className: "ss-dash-empty", children: "Loading emails..." }) : /* @__PURE__ */ y(P, { children: [
|
|
61
|
+
/* @__PURE__ */ s("div", { className: "ss-dash-table-wrap", children: /* @__PURE__ */ s(
|
|
62
|
+
E,
|
|
63
|
+
{
|
|
64
|
+
columns: [
|
|
65
|
+
{
|
|
66
|
+
key: "id",
|
|
67
|
+
label: "#",
|
|
68
|
+
width: "40px",
|
|
69
|
+
render: (e) => /* @__PURE__ */ s("span", { style: { color: "var(--ss-dim)" }, children: e })
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
key: "from",
|
|
73
|
+
label: "From",
|
|
74
|
+
width: "150px",
|
|
75
|
+
render: (e, t) => {
|
|
76
|
+
const a = b(t);
|
|
77
|
+
return /* @__PURE__ */ s(
|
|
78
|
+
"span",
|
|
79
|
+
{
|
|
80
|
+
title: a,
|
|
81
|
+
style: {
|
|
82
|
+
color: "var(--ss-text-secondary)",
|
|
83
|
+
overflow: "hidden",
|
|
84
|
+
textOverflow: "ellipsis",
|
|
85
|
+
whiteSpace: "nowrap",
|
|
86
|
+
display: "block"
|
|
87
|
+
},
|
|
88
|
+
children: a
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
key: "to",
|
|
95
|
+
label: "To",
|
|
96
|
+
width: "150px",
|
|
97
|
+
render: (e, t) => {
|
|
98
|
+
const a = f(t);
|
|
99
|
+
return /* @__PURE__ */ s(
|
|
100
|
+
"span",
|
|
101
|
+
{
|
|
102
|
+
title: a,
|
|
103
|
+
style: {
|
|
104
|
+
color: "var(--ss-text-secondary)",
|
|
105
|
+
overflow: "hidden",
|
|
106
|
+
textOverflow: "ellipsis",
|
|
107
|
+
whiteSpace: "nowrap",
|
|
108
|
+
display: "block"
|
|
109
|
+
},
|
|
110
|
+
children: a
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
key: "subject",
|
|
117
|
+
label: "Subject",
|
|
118
|
+
render: (e) => {
|
|
119
|
+
const t = e || "";
|
|
120
|
+
return /* @__PURE__ */ s(
|
|
121
|
+
"span",
|
|
122
|
+
{
|
|
123
|
+
title: t,
|
|
124
|
+
style: {
|
|
125
|
+
color: "var(--ss-sql-color)",
|
|
126
|
+
overflow: "hidden",
|
|
127
|
+
textOverflow: "ellipsis",
|
|
128
|
+
whiteSpace: "nowrap",
|
|
129
|
+
display: "block"
|
|
130
|
+
},
|
|
131
|
+
children: t
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
key: "status",
|
|
138
|
+
label: "Status",
|
|
139
|
+
width: "80px",
|
|
140
|
+
render: (e) => {
|
|
141
|
+
const t = e || "";
|
|
142
|
+
return /* @__PURE__ */ s("span", { className: `ss-dash-badge ss-dash-email-status-${t}`, children: t });
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
key: "attachmentCount",
|
|
147
|
+
label: "ATT",
|
|
148
|
+
width: "40px",
|
|
149
|
+
render: (e, t) => {
|
|
150
|
+
const a = F(t);
|
|
151
|
+
return a > 0 ? /* @__PURE__ */ s(
|
|
152
|
+
"span",
|
|
153
|
+
{
|
|
154
|
+
style: { color: "var(--ss-dim)", textAlign: "center", display: "block" },
|
|
155
|
+
children: a
|
|
156
|
+
}
|
|
157
|
+
) : /* @__PURE__ */ s(
|
|
158
|
+
"span",
|
|
159
|
+
{
|
|
160
|
+
style: { color: "var(--ss-dim)", textAlign: "center", display: "block" },
|
|
161
|
+
children: "-"
|
|
162
|
+
}
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
key: "mailer",
|
|
168
|
+
label: "Mailer",
|
|
169
|
+
width: "70px",
|
|
170
|
+
render: (e) => {
|
|
171
|
+
const t = e || "";
|
|
172
|
+
return /* @__PURE__ */ s(
|
|
173
|
+
"span",
|
|
174
|
+
{
|
|
175
|
+
title: t,
|
|
176
|
+
style: {
|
|
177
|
+
color: "var(--ss-muted)",
|
|
178
|
+
overflow: "hidden",
|
|
179
|
+
textOverflow: "ellipsis",
|
|
180
|
+
whiteSpace: "nowrap",
|
|
181
|
+
display: "block"
|
|
182
|
+
},
|
|
183
|
+
children: t
|
|
184
|
+
}
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
key: "createdAt",
|
|
190
|
+
label: "Time",
|
|
191
|
+
width: "80px",
|
|
192
|
+
render: (e, t) => {
|
|
193
|
+
const a = _(t);
|
|
194
|
+
return /* @__PURE__ */ s(
|
|
195
|
+
$,
|
|
196
|
+
{
|
|
197
|
+
ts: a,
|
|
198
|
+
className: "ss-dash-event-time",
|
|
199
|
+
style: { whiteSpace: "nowrap" }
|
|
200
|
+
}
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
],
|
|
205
|
+
data: u,
|
|
206
|
+
onRowClick: A,
|
|
207
|
+
rowClassName: "ss-dash-email-row",
|
|
208
|
+
emptyMessage: "No emails captured yet"
|
|
209
|
+
}
|
|
210
|
+
) }),
|
|
211
|
+
r && /* @__PURE__ */ s(
|
|
212
|
+
H,
|
|
213
|
+
{
|
|
214
|
+
page: r.page,
|
|
215
|
+
lastPage: r.lastPage,
|
|
216
|
+
total: r.total,
|
|
217
|
+
onPageChange: d
|
|
218
|
+
}
|
|
219
|
+
)
|
|
220
|
+
] })
|
|
221
|
+
] });
|
|
222
|
+
}
|
|
223
|
+
export {
|
|
224
|
+
Q as EmailsSection,
|
|
225
|
+
Q as default
|
|
226
|
+
};
|