adonisjs-server-stats 1.12.3 → 1.14.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/README.md +11 -6
- package/dist/configure.js +6 -1
- package/dist/core/collectors/collector.d.ts +83 -0
- package/dist/core/core/types.d.ts +186 -0
- package/dist/core/debug/types.d.ts +467 -0
- package/dist/core/index.js +184 -169
- package/dist/core/types.d.ts +855 -167
- package/dist/react/{CacheSection-CX2duJuc.js → CacheSection-DkLtukWz.js} +1 -1
- package/dist/react/{CacheTab-CgT4t0oZ.js → CacheTab-DWeXnEBI.js} +51 -46
- package/dist/react/ConfigContent-Bwvfl_G7.js +350 -0
- package/dist/react/{ConfigSection-Dt0FyeaW.js → ConfigSection-DaVbFPDg.js} +2 -2
- package/dist/react/{ConfigTab-KtiTtsrj.js → ConfigTab-D4640WJZ.js} +2 -2
- package/dist/react/{CustomPaneTab-15QoEplP.js → CustomPaneTab-DglmAVMC.js} +1 -1
- package/dist/react/{EmailsSection-YcJYR5eA.js → EmailsSection-vYx6ExTb.js} +1 -1
- package/dist/react/{EmailsTab-CUjubln_.js → EmailsTab-DKDrRmRH.js} +54 -49
- package/dist/react/{EventsSection-GGPoYSNv.js → EventsSection-CapH5xut.js} +1 -1
- package/dist/react/{EventsTab-Wdwr0_ny.js → EventsTab-BNVEySAm.js} +1 -1
- package/dist/react/{InternalsContent-BNOnSoi9.js → InternalsContent-C9lIA92C.js} +1 -1
- package/dist/react/{InternalsSection-BwrTfpjA.js → InternalsSection-lOv_UcSV.js} +1 -1
- package/dist/react/{InternalsTab--RD-L1dX.js → InternalsTab-BygoSorC.js} +1 -1
- package/dist/react/{JobsSection-BqqIh_DR.js → JobsSection-ZIQsJWid.js} +1 -1
- package/dist/react/{JobsTab-CBrU-ryL.js → JobsTab-DXQzXrDt.js} +1 -1
- package/dist/react/{LogEntryRow-BOrRkhRU.js → LogEntryRow-BWkHE51-.js} +1 -1
- package/dist/react/{LogsSection-Cm_lphM6.js → LogsSection-ConXdBkL.js} +2 -2
- package/dist/react/LogsTab-CJM47LPn.js +82 -0
- package/dist/react/{OverviewSection-XF7bakyM.js → OverviewSection-DOMu2qvl.js} +131 -131
- package/dist/react/{QueriesSection-DsQBKrNK.js → QueriesSection-DFsaOSJI.js} +1 -1
- package/dist/react/{QueriesTab-CxCC1GVq.js → QueriesTab-CY9CG_7L.js} +1 -1
- package/dist/react/RequestsSection-CC-eVHsl.js +326 -0
- package/dist/react/{RoutesSection-D0y5JQP4.js → RoutesSection-p1DMq41y.js} +1 -1
- package/dist/react/{RoutesTab-Y_alJVMV.js → RoutesTab-Cnqy8UcK.js} +1 -1
- package/dist/react/{SplitPaneWrapper-CZl1ouIT.js → SplitPaneWrapper-XgkA0QxE.js} +1 -1
- package/dist/react/{TimelineTab-HyqZpfbp.js → TimelineTab-1YOERxe5.js} +3 -3
- package/dist/react/index-DOSlCpZ9.js +1159 -0
- package/dist/react/index.js +1 -1
- package/dist/react/useApiClient-CtEG7rHs.js +11 -0
- package/dist/src/collectors/adonisjs_queue_collector.d.ts +21 -0
- package/dist/src/collectors/adonisjs_queue_collector.js +61 -0
- package/dist/src/collectors/auto_detect.js +8 -2
- package/dist/src/collectors/index.d.ts +2 -0
- package/dist/src/collectors/index.js +1 -0
- package/dist/src/collectors/queue_collector.js +22 -6
- package/dist/src/config/deprecation_migration.js +11 -0
- package/dist/src/dashboard/cache_handlers.js +22 -2
- package/dist/src/dashboard/flush_manager.d.ts +2 -0
- package/dist/src/dashboard/flush_manager.js +17 -0
- package/dist/src/dashboard/inspector_manager.d.ts +4 -4
- package/dist/src/dashboard/inspector_manager.js +20 -10
- package/dist/src/dashboard/integrations/adonisjs_queue_inspector.d.ts +42 -0
- package/dist/src/dashboard/integrations/adonisjs_queue_inspector.js +135 -0
- package/dist/src/dashboard/integrations/adonisjs_queue_store.d.ts +166 -0
- package/dist/src/dashboard/integrations/adonisjs_queue_store.js +629 -0
- package/dist/src/dashboard/integrations/config_inspector.d.ts +0 -1
- package/dist/src/dashboard/integrations/config_inspector.js +4 -2
- package/dist/src/dashboard/integrations/index.d.ts +4 -1
- package/dist/src/dashboard/integrations/index.js +2 -0
- package/dist/src/dashboard/integrations/queue_inspector.d.ts +5 -61
- package/dist/src/dashboard/integrations/queue_inspector.js +5 -1
- package/dist/src/dashboard/integrations/queue_inspector_contract.d.ts +73 -0
- package/dist/src/dashboard/integrations/queue_inspector_contract.js +15 -0
- package/dist/src/dashboard/paginate_helper.d.ts +5 -0
- package/dist/src/dashboard/paginate_helper.js +16 -4
- package/dist/src/dashboard/query_explain_handler.d.ts +6 -1
- package/dist/src/dashboard/query_explain_handler.js +12 -2
- package/dist/src/dashboard/write_queue.d.ts +13 -0
- package/dist/src/dashboard/write_queue.js +34 -2
- package/dist/src/debug/debug_store.js +8 -1
- package/dist/src/debug/event_collector.js +4 -0
- package/dist/src/debug/query_collector.js +2 -0
- package/dist/src/debug/ring_buffer.js +8 -1
- package/dist/src/debug/trace_collector.js +34 -10
- package/dist/src/debug/types.d.ts +2 -0
- package/dist/src/define_config.js +1 -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/stats-bar.js +1 -1
- package/dist/src/edge/client-vue/dashboard.js +5 -5
- package/dist/src/edge/client-vue/debug-panel-deferred.js +2 -2
- package/dist/src/engine/request_metrics.js +8 -10
- package/dist/src/log_stream/log_stream_service.d.ts +1 -0
- package/dist/src/log_stream/log_stream_service.js +7 -5
- package/dist/src/prometheus/prometheus_collector.d.ts +9 -0
- package/dist/src/prometheus/prometheus_collector.js +11 -0
- package/dist/src/provider/dashboard_init.js +15 -0
- package/dist/src/provider/dashboard_setup.js +9 -2
- package/dist/src/provider/email_bridge.d.ts +14 -3
- package/dist/src/provider/email_bridge.js +25 -3
- package/dist/src/provider/email_helpers.d.ts +9 -1
- package/dist/src/provider/email_helpers.js +32 -4
- package/dist/src/provider/pino_hook.d.ts +8 -0
- package/dist/src/provider/pino_hook.js +19 -1
- package/dist/src/provider/provider_helpers_extra.d.ts +2 -0
- package/dist/src/provider/provider_helpers_extra.js +17 -2
- package/dist/src/provider/server_stats_provider.js +19 -1
- package/dist/src/provider/shutdown_helpers.js +2 -0
- package/dist/src/provider/toolbar_setup.js +32 -17
- package/dist/src/routes/dashboard_routes.js +96 -62
- package/dist/src/routes/debug_routes.js +45 -35
- package/dist/src/routes/no_session_middleware.d.ts +6 -3
- package/dist/src/routes/no_session_middleware.js +7 -3
- package/dist/src/routes/register_routes.d.ts +8 -0
- package/dist/src/routes/register_routes.js +19 -0
- package/dist/src/types.d.ts +31 -0
- package/dist/src/utils/app_import.js +12 -4
- package/dist/vue/CacheSection-CxEBVVkF.js +156 -0
- package/dist/vue/ConfigSection-BiRAiaHj.js +415 -0
- package/dist/vue/EmailsSection-Dl44qyqY.js +208 -0
- package/dist/vue/{EmailsTab-CwIF1fik.js → EmailsTab-Diya54CP.js} +6 -5
- package/dist/vue/{EventsSection-BpgkWIwM.js → EventsSection-CWjeitjU.js} +1 -1
- package/dist/vue/{InternalsTab-521fxYYj.js → InternalsTab-Z3c82glB.js} +15 -15
- package/dist/vue/{JobsSection-DrghFEKL.js → JobsSection-DOBb4LjZ.js} +1 -1
- package/dist/vue/LogsSection-CXx-HOWJ.js +260 -0
- package/dist/vue/{OverviewSection-BAgZTPjY.js → OverviewSection-CyfNQ8uV.js} +318 -302
- package/dist/vue/{QueriesSection-CUpwhp7u.js → QueriesSection-CXBsFp-y.js} +1 -1
- package/dist/vue/{RequestsSection-D8P2xpF2.js → RequestsSection-YTIaZGZd.js} +151 -145
- package/dist/vue/{RoutesSection-0qB81hTT.js → RoutesSection-CDKMey49.js} +1 -1
- package/dist/vue/composables/useApiClient.d.ts +8 -1
- package/dist/vue/index-14x39RI_.js +1239 -0
- package/dist/vue/index.js +1 -1
- package/dist/vue/style.css +1 -1
- package/package.json +16 -3
- package/dist/react/ConfigContent-CnsEI4j3.js +0 -397
- package/dist/react/LogsTab-jKwv9G7Q.js +0 -79
- package/dist/react/RequestsSection-D8cMbZU0.js +0 -321
- package/dist/react/index-CsprmgzI.js +0 -1121
- package/dist/react/useApiClient-BVtNCmnL.js +0 -9
- package/dist/vue/CacheSection-DRqV3YX2.js +0 -149
- package/dist/vue/ConfigSection-C6pQCHAL.js +0 -576
- package/dist/vue/EmailsSection-BTNw3ZU2.js +0 -206
- package/dist/vue/LogsSection-BDxx9Bfi.js +0 -258
- package/dist/vue/index-30jLw-_w.js +0 -1232
- /package/dist/core/{api-client.d.ts → core/api-client.d.ts} +0 -0
- /package/dist/core/{config-utils.d.ts → core/config-utils.d.ts} +0 -0
- /package/dist/core/{constants.d.ts → core/constants.d.ts} +0 -0
- /package/dist/core/{dashboard-api.d.ts → core/dashboard-api.d.ts} +0 -0
- /package/dist/core/{dashboard-data-controller.d.ts → core/dashboard-data-controller.d.ts} +0 -0
- /package/dist/core/{dashboard-data-helpers.d.ts → core/dashboard-data-helpers.d.ts} +0 -0
- /package/dist/core/{debug-data-controller.d.ts → core/debug-data-controller.d.ts} +0 -0
- /package/dist/core/{define-config-helpers.d.ts → core/define-config-helpers.d.ts} +0 -0
- /package/dist/core/{explain-utils.d.ts → core/explain-utils.d.ts} +0 -0
- /package/dist/core/{feature-detect-helpers.d.ts → core/feature-detect-helpers.d.ts} +0 -0
- /package/dist/core/{feature-detect.d.ts → core/feature-detect.d.ts} +0 -0
- /package/dist/core/{field-resolvers.d.ts → core/field-resolvers.d.ts} +0 -0
- /package/dist/core/{formatters-helpers.d.ts → core/formatters-helpers.d.ts} +0 -0
- /package/dist/core/{formatters.d.ts → core/formatters.d.ts} +0 -0
- /package/dist/core/{history-buffer.d.ts → core/history-buffer.d.ts} +0 -0
- /package/dist/core/{icons.d.ts → core/icons.d.ts} +0 -0
- /package/dist/core/{index.d.ts → core/index.d.ts} +0 -0
- /package/dist/core/{internals-utils.d.ts → core/internals-utils.d.ts} +0 -0
- /package/dist/core/{job-utils.d.ts → core/job-utils.d.ts} +0 -0
- /package/dist/core/{log-utils-helpers.d.ts → core/log-utils-helpers.d.ts} +0 -0
- /package/dist/core/{log-utils.d.ts → core/log-utils.d.ts} +0 -0
- /package/dist/core/{metrics.d.ts → core/metrics.d.ts} +0 -0
- /package/dist/core/{pagination.d.ts → core/pagination.d.ts} +0 -0
- /package/dist/core/{queries-columns.d.ts → core/queries-columns.d.ts} +0 -0
- /package/dist/core/{queries-controller.d.ts → core/queries-controller.d.ts} +0 -0
- /package/dist/core/{query-utils.d.ts → core/query-utils.d.ts} +0 -0
- /package/dist/core/{resizable-columns.d.ts → core/resizable-columns.d.ts} +0 -0
- /package/dist/core/{routes.d.ts → core/routes.d.ts} +0 -0
- /package/dist/core/{server-stats-controller.d.ts → core/server-stats-controller.d.ts} +0 -0
- /package/dist/core/{sparkline.d.ts → core/sparkline.d.ts} +0 -0
- /package/dist/core/{split-pane.d.ts → core/split-pane.d.ts} +0 -0
- /package/dist/core/{theme.d.ts → core/theme.d.ts} +0 -0
- /package/dist/core/{trace-utils.d.ts → core/trace-utils.d.ts} +0 -0
- /package/dist/core/{transmit-adapter.d.ts → core/transmit-adapter.d.ts} +0 -0
- /package/dist/core/{transmit-helpers.d.ts → core/transmit-helpers.d.ts} +0 -0
- /package/dist/core/{types-dashboard.d.ts → core/types-dashboard.d.ts} +0 -0
- /package/dist/core/{types-diagnostics.d.ts → core/types-diagnostics.d.ts} +0 -0
|
@@ -0,0 +1,1239 @@
|
|
|
1
|
+
import { ref as c, reactive as oe, computed as p, onMounted as Q, onUnmounted as te, defineComponent as se, openBlock as a, createElementBlock as l, normalizeStyle as ke, Fragment as G, createElementVNode as i, watch as W, nextTick as we, onBeforeUnmount as he, normalizeClass as U, toDisplayString as C, createCommentVNode as k, createBlock as A, Teleport as Ce, withModifiers as Te, unref as n, createVNode as de, renderList as ae, defineAsyncComponent as T, createTextVNode as _e, provide as ee, Suspense as Ee, withCtx as ve, resolveDynamicComponent as Se } from "vue";
|
|
2
|
+
import { ServerStatsController as xe, DEFAULT_FEATURES as $e, detectFeatures as Le, getTheme as be, onThemeChange as Me, toggleTheme as Ue, buildSparklineData as Be, computeStats as Pe, formatStatNum as re, detectMetricGroupsFromStats as Re, getVisibleMetricGroups as De, getMetricsByGroup as He, TAB_ICONS as x, DebugDataController as ge, DashboardDataController as Ae, UnauthorizedError as je, subscribeToChannel as ze } from "adonisjs-server-stats/core";
|
|
3
|
+
function Ie(e) {
|
|
4
|
+
return {
|
|
5
|
+
onStatsUpdate: (s) => {
|
|
6
|
+
e.stats.value = s;
|
|
7
|
+
},
|
|
8
|
+
onConnectionChange: (s) => {
|
|
9
|
+
e.isConnected.value = s;
|
|
10
|
+
},
|
|
11
|
+
onStaleChange: (s) => {
|
|
12
|
+
e.isStale.value = s;
|
|
13
|
+
},
|
|
14
|
+
onError: (s) => {
|
|
15
|
+
e.error.value = s;
|
|
16
|
+
},
|
|
17
|
+
onUnauthorizedChange: (s) => {
|
|
18
|
+
e.isUnauthorized.value = s;
|
|
19
|
+
},
|
|
20
|
+
onHistoryChange: (s) => {
|
|
21
|
+
for (const t of Object.keys(s))
|
|
22
|
+
e.history[t] = s[t];
|
|
23
|
+
},
|
|
24
|
+
onSseActiveChange: (s) => {
|
|
25
|
+
e.sseActive.value = s;
|
|
26
|
+
},
|
|
27
|
+
onPollActiveChange: (s) => {
|
|
28
|
+
e.pollActive.value = s;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function qe(e, s) {
|
|
33
|
+
if (e.isUnauthorized.value) return null;
|
|
34
|
+
const t = Ie(e), r = new xe({ ...s, ...t });
|
|
35
|
+
return r.start(), r;
|
|
36
|
+
}
|
|
37
|
+
function Oe(e = {}) {
|
|
38
|
+
const {
|
|
39
|
+
baseUrl: s = "",
|
|
40
|
+
endpoint: t = "/admin/api/server-stats",
|
|
41
|
+
channelName: r = "admin/server-stats",
|
|
42
|
+
authToken: o,
|
|
43
|
+
pollInterval: d = 3e3
|
|
44
|
+
} = e, y = c(null), h = oe({}), f = c(!1), _ = c(!1), P = c(null), B = c(!1), v = c(!1), u = c(!1), D = {
|
|
45
|
+
stats: y,
|
|
46
|
+
history: h,
|
|
47
|
+
isConnected: f,
|
|
48
|
+
isStale: _,
|
|
49
|
+
error: P,
|
|
50
|
+
isUnauthorized: B,
|
|
51
|
+
sseActive: v,
|
|
52
|
+
pollActive: u
|
|
53
|
+
};
|
|
54
|
+
let b = null;
|
|
55
|
+
const I = p(() => B.value ? "disconnected" : v.value ? "live" : u.value ? "polling" : "disconnected");
|
|
56
|
+
return Q(() => {
|
|
57
|
+
b = qe(D, { baseUrl: s, endpoint: t, channelName: r, authToken: o, pollInterval: d });
|
|
58
|
+
}), te(() => {
|
|
59
|
+
b?.stop(), b = null;
|
|
60
|
+
}), { stats: y, history: h, isConnected: f, isStale: _, isUnauthorized: B, error: P, connectionMode: I };
|
|
61
|
+
}
|
|
62
|
+
function ce(e = {}) {
|
|
63
|
+
const { baseUrl: s = "", debugEndpoint: t = "/admin/api/debug", authToken: r } = e, o = c({ ...$e }), d = c(!0);
|
|
64
|
+
return Q(async () => {
|
|
65
|
+
o.value = await Le({ baseUrl: s, debugEndpoint: t, authToken: r }), d.value = !1;
|
|
66
|
+
}), {
|
|
67
|
+
features: o,
|
|
68
|
+
loading: d
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function le() {
|
|
72
|
+
const e = c(be());
|
|
73
|
+
let s = null;
|
|
74
|
+
function t(o) {
|
|
75
|
+
e.value = o;
|
|
76
|
+
}
|
|
77
|
+
function r() {
|
|
78
|
+
const o = Ue();
|
|
79
|
+
return e.value = o, o;
|
|
80
|
+
}
|
|
81
|
+
return Q(() => {
|
|
82
|
+
e.value = be(), s = Me(t);
|
|
83
|
+
}), te(() => {
|
|
84
|
+
s?.();
|
|
85
|
+
}), {
|
|
86
|
+
theme: e,
|
|
87
|
+
toggleTheme: r
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
const Ne = ["width", "height", "viewBox"], Fe = ["id"], Ve = ["stop-color"], Ge = ["stop-color"], Qe = ["d", "fill"], Je = ["d", "stroke"], We = ["x", "y"], Ke = /* @__PURE__ */ se({
|
|
91
|
+
__name: "Sparkline",
|
|
92
|
+
props: {
|
|
93
|
+
data: {},
|
|
94
|
+
color: { default: "#34d399" },
|
|
95
|
+
width: { default: 120 },
|
|
96
|
+
height: { default: 32 }
|
|
97
|
+
},
|
|
98
|
+
setup(e) {
|
|
99
|
+
const s = e, t = p(
|
|
100
|
+
() => Be(s.data, {
|
|
101
|
+
width: s.width,
|
|
102
|
+
height: s.height,
|
|
103
|
+
color: s.color
|
|
104
|
+
})
|
|
105
|
+
), r = p(() => t.value !== null), o = p(() => `sg-${s.color.replace("#", "")}`);
|
|
106
|
+
return (d, y) => (a(), l("div", {
|
|
107
|
+
class: "ss-dash-sparkline",
|
|
108
|
+
style: ke({ "--ss-accent": e.color })
|
|
109
|
+
}, [
|
|
110
|
+
(a(), l("svg", {
|
|
111
|
+
width: e.width,
|
|
112
|
+
height: e.height,
|
|
113
|
+
viewBox: `0 0 ${e.width} ${e.height}`,
|
|
114
|
+
style: { display: "block" }
|
|
115
|
+
}, [
|
|
116
|
+
r.value && t.value ? (a(), l(G, { key: 0 }, [
|
|
117
|
+
i("defs", null, [
|
|
118
|
+
i("linearGradient", {
|
|
119
|
+
id: o.value,
|
|
120
|
+
x1: "0",
|
|
121
|
+
y1: "0",
|
|
122
|
+
x2: "0",
|
|
123
|
+
y2: "1"
|
|
124
|
+
}, [
|
|
125
|
+
i("stop", {
|
|
126
|
+
offset: "0%",
|
|
127
|
+
"stop-color": e.color,
|
|
128
|
+
"stop-opacity": "0.25"
|
|
129
|
+
}, null, 8, Ve),
|
|
130
|
+
i("stop", {
|
|
131
|
+
offset: "100%",
|
|
132
|
+
"stop-color": e.color,
|
|
133
|
+
"stop-opacity": "0.02"
|
|
134
|
+
}, null, 8, Ge)
|
|
135
|
+
], 8, Fe)
|
|
136
|
+
]),
|
|
137
|
+
i("path", {
|
|
138
|
+
d: t.value.areaPath,
|
|
139
|
+
fill: `url(#${o.value})`
|
|
140
|
+
}, null, 8, Qe),
|
|
141
|
+
i("path", {
|
|
142
|
+
class: "ss-dash-sparkline-line",
|
|
143
|
+
d: "M" + t.value.points.replace(/ /g, " L"),
|
|
144
|
+
fill: "none",
|
|
145
|
+
stroke: e.color,
|
|
146
|
+
"stroke-width": "1.5",
|
|
147
|
+
"stroke-linejoin": "round",
|
|
148
|
+
"stroke-linecap": "round"
|
|
149
|
+
}, null, 8, Je)
|
|
150
|
+
], 64)) : (a(), l("text", {
|
|
151
|
+
key: 1,
|
|
152
|
+
x: e.width / 2,
|
|
153
|
+
y: e.height / 2 + 3,
|
|
154
|
+
"text-anchor": "middle",
|
|
155
|
+
fill: "#737373",
|
|
156
|
+
"font-size": "9"
|
|
157
|
+
}, " collecting... ", 8, We))
|
|
158
|
+
], 8, Ne))
|
|
159
|
+
], 4));
|
|
160
|
+
}
|
|
161
|
+
}), Xe = ["id"], Ye = { class: "ss-label" }, Ze = {
|
|
162
|
+
class: "ss-tooltip-inner",
|
|
163
|
+
style: { position: "relative" }
|
|
164
|
+
}, et = { class: "ss-tooltip-header" }, tt = { class: "ss-tooltip-title" }, st = {
|
|
165
|
+
key: 0,
|
|
166
|
+
class: "ss-tooltip-unit"
|
|
167
|
+
}, at = { class: "ss-tooltip-current" }, nt = { class: "ss-tooltip-current-value" }, ot = {
|
|
168
|
+
key: 1,
|
|
169
|
+
class: "ss-tooltip-stats"
|
|
170
|
+
}, lt = {
|
|
171
|
+
key: 2,
|
|
172
|
+
class: "ss-tooltip-details"
|
|
173
|
+
}, it = {
|
|
174
|
+
key: 3,
|
|
175
|
+
class: "ss-tooltip-sparkline"
|
|
176
|
+
}, rt = {
|
|
177
|
+
key: 4,
|
|
178
|
+
class: "ss-tooltip-samples"
|
|
179
|
+
}, ut = /* @__PURE__ */ se({
|
|
180
|
+
__name: "MetricCard",
|
|
181
|
+
props: {
|
|
182
|
+
metric: {},
|
|
183
|
+
stats: {},
|
|
184
|
+
history: {}
|
|
185
|
+
},
|
|
186
|
+
emits: ["pin"],
|
|
187
|
+
setup(e, { emit: s }) {
|
|
188
|
+
const t = e, r = s, o = c(!1), d = c(!1), y = c(null), h = c(null), f = c(null), _ = c({
|
|
189
|
+
position: "absolute",
|
|
190
|
+
bottom: "100%",
|
|
191
|
+
left: "0",
|
|
192
|
+
marginBottom: "10px",
|
|
193
|
+
zIndex: "180"
|
|
194
|
+
});
|
|
195
|
+
Q(() => {
|
|
196
|
+
y.value && (f.value = y.value.closest(".ss-bar"));
|
|
197
|
+
});
|
|
198
|
+
function P() {
|
|
199
|
+
const M = y.value, O = h.value, K = f.value;
|
|
200
|
+
if (!M || !O || !K) return;
|
|
201
|
+
const X = M.getBoundingClientRect(), V = K.getBoundingClientRect(), Y = X.left - V.left + X.width / 2;
|
|
202
|
+
_.value = {
|
|
203
|
+
position: "absolute",
|
|
204
|
+
bottom: "100%",
|
|
205
|
+
left: `${Y}px`,
|
|
206
|
+
transform: "translateX(-50%)",
|
|
207
|
+
marginBottom: "10px",
|
|
208
|
+
zIndex: "180"
|
|
209
|
+
}, requestAnimationFrame(() => {
|
|
210
|
+
if (!h.value) return;
|
|
211
|
+
const S = h.value.getBoundingClientRect();
|
|
212
|
+
let j = 0;
|
|
213
|
+
S.left < 8 ? j = 8 - S.left : S.right > window.innerWidth - 8 && (j = window.innerWidth - 8 - S.right), j && (_.value = {
|
|
214
|
+
..._.value,
|
|
215
|
+
transform: `translateX(calc(-50% + ${j}px))`
|
|
216
|
+
});
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
const B = p(() => o.value || d.value);
|
|
220
|
+
W(B, (M) => {
|
|
221
|
+
M && we(P);
|
|
222
|
+
});
|
|
223
|
+
let v = null;
|
|
224
|
+
function u() {
|
|
225
|
+
B.value && P();
|
|
226
|
+
}
|
|
227
|
+
function D() {
|
|
228
|
+
B.value && P();
|
|
229
|
+
}
|
|
230
|
+
Q(() => {
|
|
231
|
+
v = y.value?.closest(".ss-bar-scroll") ?? null, v?.addEventListener("scroll", u), window.addEventListener("resize", D);
|
|
232
|
+
}), he(() => {
|
|
233
|
+
v?.removeEventListener("scroll", u), window.removeEventListener("resize", D);
|
|
234
|
+
});
|
|
235
|
+
const b = p(() => t.stats ? (t.metric.value || t.metric.format)(t.stats) : "..."), I = p(() => !t.stats || !t.metric.color ? "green" : t.metric.color(t.stats)), E = p(() => !t.stats || !t.metric.show ? !0 : t.metric.show(t.stats)), H = p(() => t.metric.detail ? typeof t.metric.detail == "function" ? t.stats ? t.metric.detail(t.stats) : "" : t.metric.detail : ""), N = p(() => ({
|
|
236
|
+
green: "#34d399",
|
|
237
|
+
amber: "#fbbf24",
|
|
238
|
+
red: "#f87171",
|
|
239
|
+
muted: "#737373"
|
|
240
|
+
})[I.value] || "#34d399"), q = p(() => Pe(t.history));
|
|
241
|
+
function m() {
|
|
242
|
+
o.value = !0;
|
|
243
|
+
}
|
|
244
|
+
function $() {
|
|
245
|
+
o.value = !1;
|
|
246
|
+
}
|
|
247
|
+
function L() {
|
|
248
|
+
d.value = !d.value, d.value && r("pin", t.metric.id);
|
|
249
|
+
}
|
|
250
|
+
function R() {
|
|
251
|
+
d.value = !1;
|
|
252
|
+
}
|
|
253
|
+
function Z(M) {
|
|
254
|
+
M.key === "Enter" && L();
|
|
255
|
+
}
|
|
256
|
+
function F(M) {
|
|
257
|
+
const O = M.target;
|
|
258
|
+
y.value && !y.value.contains(O) && h.value && !h.value.contains(O) && (d.value = !1);
|
|
259
|
+
}
|
|
260
|
+
function J(M) {
|
|
261
|
+
M.key === "Escape" && (d.value = !1);
|
|
262
|
+
}
|
|
263
|
+
return W(d, (M) => {
|
|
264
|
+
M ? (document.addEventListener("click", F), document.addEventListener("keydown", J)) : (document.removeEventListener("click", F), document.removeEventListener("keydown", J));
|
|
265
|
+
}), he(() => {
|
|
266
|
+
document.removeEventListener("click", F), document.removeEventListener("keydown", J);
|
|
267
|
+
}), (M, O) => (a(), l(G, null, [
|
|
268
|
+
E.value ? (a(), l("div", {
|
|
269
|
+
key: 0,
|
|
270
|
+
ref_key: "badgeRef",
|
|
271
|
+
ref: y,
|
|
272
|
+
id: `ss-b-${e.metric.id}`,
|
|
273
|
+
class: U(["ss-badge", { "ss-pinned": d.value }]),
|
|
274
|
+
role: "button",
|
|
275
|
+
tabindex: 0,
|
|
276
|
+
onMouseenter: m,
|
|
277
|
+
onMouseleave: $,
|
|
278
|
+
onClick: L,
|
|
279
|
+
onKeydown: Z
|
|
280
|
+
}, [
|
|
281
|
+
i("span", Ye, C(e.metric.label), 1),
|
|
282
|
+
i("span", {
|
|
283
|
+
class: U(["ss-value", `ss-${I.value}`])
|
|
284
|
+
}, C(b.value), 3)
|
|
285
|
+
], 42, Xe)) : k("", !0),
|
|
286
|
+
B.value && f.value ? (a(), A(Ce, {
|
|
287
|
+
key: 1,
|
|
288
|
+
to: f.value
|
|
289
|
+
}, [
|
|
290
|
+
i("div", {
|
|
291
|
+
ref_key: "tooltipRef",
|
|
292
|
+
ref: h,
|
|
293
|
+
class: U(["ss-tooltip", { "ss-pinned": d.value }]),
|
|
294
|
+
style: ke(_.value)
|
|
295
|
+
}, [
|
|
296
|
+
i("div", Ze, [
|
|
297
|
+
d.value ? (a(), l("button", {
|
|
298
|
+
key: 0,
|
|
299
|
+
class: "ss-tooltip-close",
|
|
300
|
+
onClick: Te(R, ["stop"])
|
|
301
|
+
}, "×")) : k("", !0),
|
|
302
|
+
i("div", et, [
|
|
303
|
+
i("span", tt, C(e.metric.title), 1),
|
|
304
|
+
e.metric.unit ? (a(), l("span", st, C(e.metric.unit), 1)) : k("", !0)
|
|
305
|
+
]),
|
|
306
|
+
i("div", at, [
|
|
307
|
+
O[0] || (O[0] = i("span", { class: "ss-tooltip-current-label" }, "Current: ", -1)),
|
|
308
|
+
i("span", nt, C(b.value), 1)
|
|
309
|
+
]),
|
|
310
|
+
q.value ? (a(), l("div", ot, [
|
|
311
|
+
i("span", null, "Min: " + C(n(re)(q.value.min, e.metric.unit)), 1),
|
|
312
|
+
i("span", null, "Max: " + C(n(re)(q.value.max, e.metric.unit)), 1),
|
|
313
|
+
i("span", null, "Avg: " + C(n(re)(q.value.avg, e.metric.unit)), 1)
|
|
314
|
+
])) : k("", !0),
|
|
315
|
+
H.value ? (a(), l("div", lt, C(H.value), 1)) : k("", !0),
|
|
316
|
+
e.history.length > 0 ? (a(), l("div", it, [
|
|
317
|
+
de(Ke, {
|
|
318
|
+
data: e.history,
|
|
319
|
+
color: N.value
|
|
320
|
+
}, null, 8, ["data", "color"])
|
|
321
|
+
])) : k("", !0),
|
|
322
|
+
e.history.length > 0 ? (a(), l("div", rt, " Last " + C(Math.min(e.history.length, 60)) + " samples (~" + C(Math.round(Math.min(e.history.length, 60) * 3 / 60)) + " min) ", 1)) : k("", !0)
|
|
323
|
+
]),
|
|
324
|
+
O[1] || (O[1] = i("div", { class: "ss-tooltip-arrow" }, null, -1))
|
|
325
|
+
], 6)
|
|
326
|
+
], 8, ["to"])) : k("", !0)
|
|
327
|
+
], 64));
|
|
328
|
+
}
|
|
329
|
+
}), dt = ["data-ss-theme"], ct = { class: "ss-bar-left" }, ht = ["viewBox", "innerHTML"], vt = { class: "ss-group" }, bt = {
|
|
330
|
+
key: 0,
|
|
331
|
+
class: "ss-group-sep"
|
|
332
|
+
}, gt = ["data-ss-theme", "title"], pt = {
|
|
333
|
+
key: 0,
|
|
334
|
+
class: "ss-toggle-summary",
|
|
335
|
+
style: { display: "flex" }
|
|
336
|
+
}, ft = {
|
|
337
|
+
key: 1,
|
|
338
|
+
class: "ss-value ss-green"
|
|
339
|
+
}, mt = {
|
|
340
|
+
key: 1,
|
|
341
|
+
class: "ss-toggle-label",
|
|
342
|
+
style: { color: "#737373" }
|
|
343
|
+
}, kt = { class: "ss-toggle-arrow" }, pe = "admin:stats-bar", ks = /* @__PURE__ */ se({
|
|
344
|
+
__name: "StatsBar",
|
|
345
|
+
props: {
|
|
346
|
+
debugEndpoint: { default: "/admin/api/debug" },
|
|
347
|
+
baseUrl: { default: "" },
|
|
348
|
+
endpoint: { default: "/admin/api/server-stats" },
|
|
349
|
+
channelName: { default: "admin/server-stats" },
|
|
350
|
+
authToken: {},
|
|
351
|
+
pollInterval: { default: 3e3 },
|
|
352
|
+
className: {},
|
|
353
|
+
debugPanelOpen: { type: Boolean, default: !1 }
|
|
354
|
+
},
|
|
355
|
+
emits: ["openDebugPanel", "connectionChange"],
|
|
356
|
+
setup(e, { emit: s }) {
|
|
357
|
+
const t = e, r = s, { stats: o, history: d, isStale: y, isUnauthorized: h, isConnected: f, connectionMode: _ } = Oe({
|
|
358
|
+
baseUrl: t.baseUrl,
|
|
359
|
+
endpoint: t.endpoint,
|
|
360
|
+
channelName: t.channelName,
|
|
361
|
+
authToken: t.authToken,
|
|
362
|
+
pollInterval: t.pollInterval
|
|
363
|
+
});
|
|
364
|
+
W(f, ($) => {
|
|
365
|
+
r("connectionChange", $);
|
|
366
|
+
});
|
|
367
|
+
const { features: P } = ce({
|
|
368
|
+
baseUrl: t.baseUrl,
|
|
369
|
+
debugEndpoint: t.debugEndpoint,
|
|
370
|
+
authToken: t.authToken
|
|
371
|
+
}), { theme: B } = le(), v = c(!0), u = c(null);
|
|
372
|
+
Q(() => {
|
|
373
|
+
v.value = localStorage.getItem(pe) !== "hidden";
|
|
374
|
+
const $ = u.value;
|
|
375
|
+
if ($) {
|
|
376
|
+
const L = (R) => {
|
|
377
|
+
Math.abs(R.deltaX) > Math.abs(R.deltaY) || (R.preventDefault(), $.scrollLeft += R.deltaY);
|
|
378
|
+
};
|
|
379
|
+
$.addEventListener("wheel", L, { passive: !1 }), te(() => $.removeEventListener("wheel", L));
|
|
380
|
+
}
|
|
381
|
+
});
|
|
382
|
+
function D() {
|
|
383
|
+
v.value = !v.value, localStorage.setItem(pe, v.value ? "visible" : "hidden");
|
|
384
|
+
}
|
|
385
|
+
W(h, ($) => {
|
|
386
|
+
$ && (v.value = !1);
|
|
387
|
+
});
|
|
388
|
+
const b = p(() => o.value ? Re(o.value) : De(P.value)), I = p(() => {
|
|
389
|
+
const $ = He();
|
|
390
|
+
return Array.from($.entries()).filter(([L]) => b.value.has(L)).map(([L, R]) => ({
|
|
391
|
+
name: L,
|
|
392
|
+
metrics: R
|
|
393
|
+
}));
|
|
394
|
+
});
|
|
395
|
+
function E($) {
|
|
396
|
+
return $ ? d[$] || [] : [];
|
|
397
|
+
}
|
|
398
|
+
const H = p(() => o.value ? `${o.value.cpuPercent.toFixed(0)}%` : "..."), N = p(() => o.value ? o.value.memHeapUsed !== void 0 ? Math.round(o.value.memHeapUsed / (1024 * 1024)) + "M" : "-" : "..."), q = p(() => o.value ? o.value.redisOk ? "✓" : "✗" : "..."), m = p(() => B.value);
|
|
399
|
+
return ($, L) => (a(), l(G, null, [
|
|
400
|
+
n(h) ? k("", !0) : (a(), l("div", {
|
|
401
|
+
key: 0,
|
|
402
|
+
id: "ss-bar",
|
|
403
|
+
class: U(["ss-bar", { "ss-hidden": !v.value }]),
|
|
404
|
+
"data-ss-theme": m.value
|
|
405
|
+
}, [
|
|
406
|
+
i("div", ct, [
|
|
407
|
+
n(P).tracing || b.value.has("redis") || b.value.has("queue") ? (a(), l("button", {
|
|
408
|
+
key: 0,
|
|
409
|
+
type: "button",
|
|
410
|
+
class: U(["ss-dbg-btn", { "ss-dbg-active": e.debugPanelOpen }]),
|
|
411
|
+
title: "Toggle debug panel",
|
|
412
|
+
id: "ss-dbg-wrench",
|
|
413
|
+
onClick: L[0] || (L[0] = (R) => r("openDebugPanel"))
|
|
414
|
+
}, [
|
|
415
|
+
(a(), l("svg", {
|
|
416
|
+
width: "14",
|
|
417
|
+
height: "14",
|
|
418
|
+
viewBox: n(x).wrench.viewBox,
|
|
419
|
+
fill: "none",
|
|
420
|
+
stroke: "currentColor",
|
|
421
|
+
"stroke-width": "2",
|
|
422
|
+
"stroke-linecap": "round",
|
|
423
|
+
"stroke-linejoin": "round",
|
|
424
|
+
innerHTML: n(x).wrench.elements.join("")
|
|
425
|
+
}, null, 8, ht))
|
|
426
|
+
], 2)) : k("", !0),
|
|
427
|
+
i("div", {
|
|
428
|
+
class: U(["ss-dot", { "ss-stale": n(y) }])
|
|
429
|
+
}, null, 2)
|
|
430
|
+
]),
|
|
431
|
+
i("div", {
|
|
432
|
+
ref_key: "scrollRef",
|
|
433
|
+
ref: u,
|
|
434
|
+
id: "ss-bar-scroll",
|
|
435
|
+
class: "ss-bar-scroll"
|
|
436
|
+
}, [
|
|
437
|
+
(a(!0), l(G, null, ae(I.value, (R, Z) => (a(), l(G, {
|
|
438
|
+
key: R.name
|
|
439
|
+
}, [
|
|
440
|
+
i("div", vt, [
|
|
441
|
+
(a(!0), l(G, null, ae(R.metrics, (F) => (a(), A(ut, {
|
|
442
|
+
key: F.id,
|
|
443
|
+
metric: F,
|
|
444
|
+
stats: n(o),
|
|
445
|
+
history: E(F.historyKey)
|
|
446
|
+
}, null, 8, ["metric", "stats", "history"]))), 128))
|
|
447
|
+
]),
|
|
448
|
+
Z < I.value.length - 1 ? (a(), l("div", bt)) : k("", !0)
|
|
449
|
+
], 64))), 128))
|
|
450
|
+
], 512)
|
|
451
|
+
], 10, dt)),
|
|
452
|
+
n(h) ? k("", !0) : (a(), l("button", {
|
|
453
|
+
key: 1,
|
|
454
|
+
type: "button",
|
|
455
|
+
class: U(["ss-toggle", v.value ? "ss-visible" : "ss-collapsed"]),
|
|
456
|
+
"data-ss-theme": m.value,
|
|
457
|
+
title: v.value ? "Hide stats bar" : "Show stats bar",
|
|
458
|
+
onClick: D
|
|
459
|
+
}, [
|
|
460
|
+
!v.value && n(o) ? (a(), l("span", pt, [
|
|
461
|
+
b.value.has("process") ? (a(), l("span", {
|
|
462
|
+
key: 0,
|
|
463
|
+
class: U([
|
|
464
|
+
"ss-value",
|
|
465
|
+
n(o).cpuPercent > 80 ? "ss-red" : n(o).cpuPercent > 50 ? "ss-amber" : "ss-green"
|
|
466
|
+
])
|
|
467
|
+
}, C(H.value), 3)) : k("", !0),
|
|
468
|
+
b.value.has("process") ? (a(), l("span", ft, C(N.value), 1)) : k("", !0),
|
|
469
|
+
b.value.has("redis") && n(o)?.redisOk !== void 0 ? (a(), l("span", {
|
|
470
|
+
key: 2,
|
|
471
|
+
class: U(["ss-value", n(o)?.redisOk ? "ss-green" : "ss-red"])
|
|
472
|
+
}, C(q.value), 3)) : k("", !0)
|
|
473
|
+
])) : k("", !0),
|
|
474
|
+
v.value ? (a(), l("span", mt, "hide stats")) : k("", !0),
|
|
475
|
+
i("span", kt, C(v.value ? "▼" : "▲"), 1)
|
|
476
|
+
], 10, gt))
|
|
477
|
+
], 64));
|
|
478
|
+
}
|
|
479
|
+
}), fe = /* @__PURE__ */ new Set(["cache", "jobs", "config"]);
|
|
480
|
+
function me(e) {
|
|
481
|
+
return {
|
|
482
|
+
onData: (s) => {
|
|
483
|
+
e.data.value = s;
|
|
484
|
+
},
|
|
485
|
+
onLoading: (s) => {
|
|
486
|
+
e.loading.value = s;
|
|
487
|
+
},
|
|
488
|
+
onError: (s) => {
|
|
489
|
+
e.error.value = s;
|
|
490
|
+
},
|
|
491
|
+
onUnauthorized: () => {
|
|
492
|
+
e.isUnauthorized.value = !0;
|
|
493
|
+
}
|
|
494
|
+
};
|
|
495
|
+
}
|
|
496
|
+
class yt {
|
|
497
|
+
constructor(s, t, r, o) {
|
|
498
|
+
this.refs = s, this.config = t, this.dashboardEndpoint = o, this.controller = new ge({
|
|
499
|
+
...t,
|
|
500
|
+
endpoint: r,
|
|
501
|
+
...me(s)
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
controller;
|
|
505
|
+
dashboardController = null;
|
|
506
|
+
dashboardEndpoint;
|
|
507
|
+
getDashboardController() {
|
|
508
|
+
if (!this.dashboardController) {
|
|
509
|
+
if (!this.dashboardEndpoint)
|
|
510
|
+
throw new Error("Dashboard endpoint is not configured");
|
|
511
|
+
this.dashboardController = new ge({
|
|
512
|
+
...this.config,
|
|
513
|
+
endpoint: this.dashboardEndpoint,
|
|
514
|
+
...me(this.refs)
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
return this.dashboardController;
|
|
518
|
+
}
|
|
519
|
+
startForTab(s) {
|
|
520
|
+
const t = s();
|
|
521
|
+
!t || t.startsWith("custom-") || (fe.has(t) && this.dashboardEndpoint ? (this.controller.stop(), this.getDashboardController().start(t)) : (this.dashboardController?.stop(), this.controller.start(t)));
|
|
522
|
+
}
|
|
523
|
+
stopAll() {
|
|
524
|
+
this.controller.stop(), this.dashboardController?.stop();
|
|
525
|
+
}
|
|
526
|
+
refresh(s) {
|
|
527
|
+
const t = s();
|
|
528
|
+
fe.has(t) && this.dashboardEndpoint && this.dashboardController ? this.dashboardController.refresh() : this.controller.refresh();
|
|
529
|
+
}
|
|
530
|
+
fetchCustomPane(s, t = !1) {
|
|
531
|
+
return this.controller.fetchCustomPane(s, t);
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
function wt(e, s = {}) {
|
|
535
|
+
const {
|
|
536
|
+
baseUrl: t = "",
|
|
537
|
+
debugEndpoint: r = "/admin/api/debug",
|
|
538
|
+
dashboardEndpoint: o,
|
|
539
|
+
authToken: d,
|
|
540
|
+
refreshInterval: y
|
|
541
|
+
} = s, h = c(null), f = c(!1), _ = c(null), P = c(!1), B = { data: h, loading: f, error: _, isUnauthorized: P }, v = new yt(
|
|
542
|
+
B,
|
|
543
|
+
{ baseUrl: t, authToken: d, refreshInterval: y },
|
|
544
|
+
r,
|
|
545
|
+
o
|
|
546
|
+
);
|
|
547
|
+
return W(e, () => {
|
|
548
|
+
h.value = null, v.startForTab(e);
|
|
549
|
+
}), Q(() => v.startForTab(e)), te(() => v.stopAll()), {
|
|
550
|
+
data: h,
|
|
551
|
+
loading: f,
|
|
552
|
+
error: _,
|
|
553
|
+
isUnauthorized: P,
|
|
554
|
+
refresh: () => v.refresh(e),
|
|
555
|
+
clear: () => {
|
|
556
|
+
h.value = null;
|
|
557
|
+
},
|
|
558
|
+
fetchCustomPane: (u, D = !1) => v.fetchCustomPane(u, D),
|
|
559
|
+
startRefresh: () => v.startForTab(e),
|
|
560
|
+
stopRefresh: () => v.stopAll()
|
|
561
|
+
};
|
|
562
|
+
}
|
|
563
|
+
const Ct = ["title", "aria-label"], Tt = ["viewBox", "innerHTML"], _t = ["viewBox", "innerHTML"], ye = /* @__PURE__ */ se({
|
|
564
|
+
__name: "ThemeToggle",
|
|
565
|
+
props: {
|
|
566
|
+
classPrefix: { default: "ss-dbg" }
|
|
567
|
+
},
|
|
568
|
+
setup(e) {
|
|
569
|
+
const s = e, { theme: t, toggleTheme: r } = le(), o = p(() => t.value === "dark"), d = p(() => o.value ? "Switch to light theme" : "Switch to dark theme"), y = p(
|
|
570
|
+
() => s.classPrefix === "ss-dbg" ? "ss-dbg-theme-toggle" : "ss-dash-theme-btn"
|
|
571
|
+
);
|
|
572
|
+
return (h, f) => (a(), l("button", {
|
|
573
|
+
type: "button",
|
|
574
|
+
class: U(y.value),
|
|
575
|
+
title: d.value,
|
|
576
|
+
"aria-label": d.value,
|
|
577
|
+
onClick: f[0] || (f[0] = //@ts-ignore
|
|
578
|
+
(..._) => n(r) && n(r)(..._))
|
|
579
|
+
}, [
|
|
580
|
+
o.value ? (a(), l("svg", {
|
|
581
|
+
key: 0,
|
|
582
|
+
width: "16",
|
|
583
|
+
height: "16",
|
|
584
|
+
viewBox: n(x).sun.viewBox,
|
|
585
|
+
fill: "none",
|
|
586
|
+
stroke: "currentColor",
|
|
587
|
+
"stroke-width": "2",
|
|
588
|
+
"stroke-linecap": "round",
|
|
589
|
+
"stroke-linejoin": "round",
|
|
590
|
+
innerHTML: n(x).sun.elements.join("")
|
|
591
|
+
}, null, 8, Tt)) : (a(), l("svg", {
|
|
592
|
+
key: 1,
|
|
593
|
+
width: "16",
|
|
594
|
+
height: "16",
|
|
595
|
+
viewBox: n(x).moon.viewBox,
|
|
596
|
+
fill: "none",
|
|
597
|
+
stroke: "currentColor",
|
|
598
|
+
"stroke-width": "2",
|
|
599
|
+
"stroke-linecap": "round",
|
|
600
|
+
"stroke-linejoin": "round",
|
|
601
|
+
innerHTML: n(x).moon.elements.join("")
|
|
602
|
+
}, null, 8, _t))
|
|
603
|
+
], 10, Ct));
|
|
604
|
+
}
|
|
605
|
+
}), Et = ["data-ss-theme"], St = { class: "ss-dbg-tabs" }, xt = { class: "ss-dbg-tabs-scroll" }, $t = ["onClick"], Lt = ["viewBox", "innerHTML"], Mt = { class: "ss-dbg-tabs-right" }, Ut = ["title"], Bt = ["href"], Pt = ["viewBox", "innerHTML"], Rt = { class: "ss-dbg-content" }, Dt = {
|
|
606
|
+
key: 0,
|
|
607
|
+
class: "ss-dbg-empty"
|
|
608
|
+
}, Ht = {
|
|
609
|
+
key: 1,
|
|
610
|
+
class: "ss-dbg-empty",
|
|
611
|
+
style: { color: "var(--ss-red-fg)" }
|
|
612
|
+
}, ys = /* @__PURE__ */ se({
|
|
613
|
+
__name: "DebugPanel",
|
|
614
|
+
props: {
|
|
615
|
+
dashboardPath: { default: "/__stats" },
|
|
616
|
+
tracingEnabled: { type: Boolean, default: !1 },
|
|
617
|
+
isLive: { type: Boolean, default: !1 },
|
|
618
|
+
baseUrl: { default: "" },
|
|
619
|
+
debugEndpoint: { default: "/admin/api/debug" },
|
|
620
|
+
authToken: {},
|
|
621
|
+
className: {},
|
|
622
|
+
defaultOpen: { type: Boolean, default: !1 }
|
|
623
|
+
},
|
|
624
|
+
setup(e, { expose: s }) {
|
|
625
|
+
const t = T(() => import("./QueriesTab-DO5XwJ--.js")), r = T(() => import("./EventsTab-BBM7olXF.js")), o = T(() => import("./EmailsTab-Diya54CP.js")), d = T(() => import("./RoutesTab-Dz0MkZuF.js")), y = T(() => import("./LogsTab-47zEK7jL.js")), h = T(() => import("./TimelineTab-DHfXsX7t.js")), f = T(() => import("./CacheTab-BPisYYiQ.js")), _ = T(() => import("./JobsTab-WFnxPdN7.js")), P = T(() => import("./ConfigTab-C8cafGUj.js")), B = T(() => import("./InternalsTab-Z3c82glB.js")), v = T(() => import("./CustomPaneTab-Hr1IBHfz.js")), u = e, D = c(u.defaultOpen), b = c("queries"), { theme: I } = le(), { features: E } = ce({
|
|
626
|
+
baseUrl: u.baseUrl,
|
|
627
|
+
debugEndpoint: u.debugEndpoint,
|
|
628
|
+
authToken: u.authToken
|
|
629
|
+
}), H = u.dashboardPath ? u.dashboardPath.replace(/\/+$/, "") + "/api" : void 0, N = p(() => b.value.startsWith("custom-")), q = p(() => N.value || b.value === "internals"), { data: m, loading: $, error: L, isUnauthorized: R, refresh: Z, startRefresh: F, stopRefresh: J } = wt(
|
|
630
|
+
() => b.value,
|
|
631
|
+
{
|
|
632
|
+
baseUrl: u.baseUrl,
|
|
633
|
+
debugEndpoint: u.debugEndpoint,
|
|
634
|
+
dashboardEndpoint: H,
|
|
635
|
+
authToken: u.authToken
|
|
636
|
+
}
|
|
637
|
+
), M = p(() => {
|
|
638
|
+
const S = [
|
|
639
|
+
{ id: "queries", label: "Queries", icon: "Q" },
|
|
640
|
+
{ id: "events", label: "Events", icon: "E" },
|
|
641
|
+
{ id: "emails", label: "Emails", icon: "M" },
|
|
642
|
+
{ id: "routes", label: "Routes", icon: "R" },
|
|
643
|
+
{ id: "logs", label: "Logs", icon: "L" }
|
|
644
|
+
];
|
|
645
|
+
(E.value.tracing || u.tracingEnabled) && S.push({ id: "timeline", label: "Requests", icon: "R" }), E.value.cache && S.push({ id: "cache", label: "Cache", icon: "C" }), E.value.queues && S.push({ id: "jobs", label: "Jobs", icon: "J" }), S.push({ id: "config", label: "Config", icon: "G" }), S.push({ id: "internals", label: "Internals", icon: "I" });
|
|
646
|
+
for (const j of E.value.customPanes)
|
|
647
|
+
S.push({
|
|
648
|
+
id: `custom-${j.id}`,
|
|
649
|
+
label: j.label,
|
|
650
|
+
icon: j.label.charAt(0).toUpperCase()
|
|
651
|
+
});
|
|
652
|
+
return S;
|
|
653
|
+
});
|
|
654
|
+
function O(S) {
|
|
655
|
+
const j = S.replace("custom-", "");
|
|
656
|
+
return E.value.customPanes.find((g) => g.id === j);
|
|
657
|
+
}
|
|
658
|
+
function K() {
|
|
659
|
+
D.value = !0, F();
|
|
660
|
+
}
|
|
661
|
+
function X() {
|
|
662
|
+
D.value = !1, J();
|
|
663
|
+
}
|
|
664
|
+
function V() {
|
|
665
|
+
D.value ? X() : K();
|
|
666
|
+
}
|
|
667
|
+
function Y(S) {
|
|
668
|
+
b.value = S;
|
|
669
|
+
}
|
|
670
|
+
return W(D, (S) => {
|
|
671
|
+
S ? F() : J();
|
|
672
|
+
}), s({ toggle: V, open: K, close: X }), (S, j) => n(R) ? k("", !0) : (a(), l("div", {
|
|
673
|
+
key: 0,
|
|
674
|
+
class: U(["ss-dbg-panel", { "ss-dbg-open": D.value }]),
|
|
675
|
+
"data-ss-theme": n(I)
|
|
676
|
+
}, [
|
|
677
|
+
i("div", St, [
|
|
678
|
+
i("div", xt, [
|
|
679
|
+
(a(!0), l(G, null, ae(M.value, (g) => (a(), l("button", {
|
|
680
|
+
key: g.id,
|
|
681
|
+
type: "button",
|
|
682
|
+
class: U(["ss-dbg-tab", { "ss-dbg-active": b.value === g.id }]),
|
|
683
|
+
onClick: (z) => Y(g.id)
|
|
684
|
+
}, [
|
|
685
|
+
n(x)[g.id] ? (a(), l("svg", {
|
|
686
|
+
key: 0,
|
|
687
|
+
class: "ss-dbg-tab-icon",
|
|
688
|
+
viewBox: n(x)[g.id].viewBox,
|
|
689
|
+
innerHTML: n(x)[g.id].elements.join("")
|
|
690
|
+
}, null, 8, Lt)) : k("", !0),
|
|
691
|
+
_e(" " + C(g.label), 1)
|
|
692
|
+
], 10, $t))), 128))
|
|
693
|
+
]),
|
|
694
|
+
i("div", Mt, [
|
|
695
|
+
i("span", {
|
|
696
|
+
class: U(["ss-dbg-conn-mode", e.isLive ? "ss-dbg-conn-live" : "ss-dbg-conn-polling"]),
|
|
697
|
+
title: e.isLive ? "Connected via Transmit (SSE) — real-time updates" : "Polling every 3s"
|
|
698
|
+
}, C(e.isLive ? "live" : "polling"), 11, Ut),
|
|
699
|
+
e.dashboardPath && n(E).dashboard ? (a(), l("a", {
|
|
700
|
+
key: 0,
|
|
701
|
+
href: e.dashboardPath,
|
|
702
|
+
target: "_blank",
|
|
703
|
+
rel: "noopener noreferrer",
|
|
704
|
+
class: "ss-dbg-dashboard-link",
|
|
705
|
+
title: "Open dashboard"
|
|
706
|
+
}, [
|
|
707
|
+
(a(), l("svg", {
|
|
708
|
+
width: "14",
|
|
709
|
+
height: "14",
|
|
710
|
+
viewBox: n(x)["external-link"].viewBox,
|
|
711
|
+
fill: "none",
|
|
712
|
+
stroke: "currentColor",
|
|
713
|
+
"stroke-width": "2",
|
|
714
|
+
"stroke-linecap": "round",
|
|
715
|
+
"stroke-linejoin": "round",
|
|
716
|
+
innerHTML: n(x)["external-link"].elements.join("")
|
|
717
|
+
}, null, 8, Pt))
|
|
718
|
+
], 8, Bt)) : k("", !0),
|
|
719
|
+
de(ye),
|
|
720
|
+
i("button", {
|
|
721
|
+
type: "button",
|
|
722
|
+
class: "ss-dbg-close",
|
|
723
|
+
onClick: X,
|
|
724
|
+
title: "Close panel"
|
|
725
|
+
}, " × ")
|
|
726
|
+
])
|
|
727
|
+
]),
|
|
728
|
+
i("div", Rt, [
|
|
729
|
+
n($) && !n(m) && !q.value ? (a(), l("div", Dt, "Loading...")) : n(L) && !q.value ? (a(), l("div", Ht, " Error: " + C(n(L).message), 1)) : (a(), l(G, { key: 2 }, [
|
|
730
|
+
b.value === "queries" ? (a(), A(n(t), {
|
|
731
|
+
key: 0,
|
|
732
|
+
data: n(m),
|
|
733
|
+
"dashboard-path": e.dashboardPath
|
|
734
|
+
}, null, 8, ["data", "dashboard-path"])) : b.value === "events" ? (a(), A(n(r), {
|
|
735
|
+
key: 1,
|
|
736
|
+
data: n(m),
|
|
737
|
+
"dashboard-path": e.dashboardPath
|
|
738
|
+
}, null, 8, ["data", "dashboard-path"])) : b.value === "emails" ? (a(), A(n(o), {
|
|
739
|
+
key: 2,
|
|
740
|
+
data: n(m),
|
|
741
|
+
"dashboard-path": e.dashboardPath,
|
|
742
|
+
"debug-endpoint": e.debugEndpoint,
|
|
743
|
+
"auth-token": e.authToken
|
|
744
|
+
}, null, 8, ["data", "dashboard-path", "debug-endpoint", "auth-token"])) : b.value === "routes" ? (a(), A(n(d), {
|
|
745
|
+
key: 3,
|
|
746
|
+
data: n(m)
|
|
747
|
+
}, null, 8, ["data"])) : b.value === "logs" ? (a(), A(n(y), {
|
|
748
|
+
key: 4,
|
|
749
|
+
data: n(m),
|
|
750
|
+
"dashboard-path": e.dashboardPath
|
|
751
|
+
}, null, 8, ["data", "dashboard-path"])) : b.value === "timeline" ? (a(), A(n(h), {
|
|
752
|
+
key: 5,
|
|
753
|
+
data: n(m),
|
|
754
|
+
"dashboard-path": e.dashboardPath,
|
|
755
|
+
"base-url": e.baseUrl,
|
|
756
|
+
"debug-endpoint": e.debugEndpoint,
|
|
757
|
+
"auth-token": e.authToken
|
|
758
|
+
}, null, 8, ["data", "dashboard-path", "base-url", "debug-endpoint", "auth-token"])) : b.value === "cache" ? (a(), A(n(f), {
|
|
759
|
+
key: 6,
|
|
760
|
+
data: n(m)
|
|
761
|
+
}, null, 8, ["data"])) : b.value === "jobs" ? (a(), A(n(_), {
|
|
762
|
+
key: 7,
|
|
763
|
+
data: n(m)
|
|
764
|
+
}, null, 8, ["data"])) : b.value === "config" ? (a(), A(n(P), {
|
|
765
|
+
key: 8,
|
|
766
|
+
data: n(m)
|
|
767
|
+
}, null, 8, ["data"])) : b.value === "internals" ? (a(), A(n(B), {
|
|
768
|
+
key: 9,
|
|
769
|
+
data: n(m),
|
|
770
|
+
"base-url": e.baseUrl,
|
|
771
|
+
"debug-endpoint": e.debugEndpoint,
|
|
772
|
+
"auth-token": e.authToken
|
|
773
|
+
}, null, 8, ["data", "base-url", "debug-endpoint", "auth-token"])) : b.value.startsWith("custom-") ? (a(), A(n(v), {
|
|
774
|
+
key: 10,
|
|
775
|
+
pane: O(b.value),
|
|
776
|
+
"base-url": e.baseUrl,
|
|
777
|
+
"auth-token": e.authToken
|
|
778
|
+
}, null, 8, ["pane", "base-url", "auth-token"])) : k("", !0)
|
|
779
|
+
], 64))
|
|
780
|
+
])
|
|
781
|
+
], 10, Et));
|
|
782
|
+
}
|
|
783
|
+
});
|
|
784
|
+
function At(e) {
|
|
785
|
+
let s = null;
|
|
786
|
+
return {
|
|
787
|
+
onData: (t) => {
|
|
788
|
+
s = t;
|
|
789
|
+
},
|
|
790
|
+
onPagination: (t) => {
|
|
791
|
+
t ? (e.pagination.total = t.total, e.pagination.totalPages = t.lastPage ?? (Math.ceil(t.total / e.pagination.perPage) || 1), e.data.value = { data: s, meta: t }) : e.data.value = s;
|
|
792
|
+
},
|
|
793
|
+
onLoading: (t) => {
|
|
794
|
+
e.loading.value = t;
|
|
795
|
+
},
|
|
796
|
+
onError: (t) => {
|
|
797
|
+
e.error.value = t;
|
|
798
|
+
},
|
|
799
|
+
onUnauthorized: () => {
|
|
800
|
+
e.isUnauthorized.value = !0;
|
|
801
|
+
}
|
|
802
|
+
};
|
|
803
|
+
}
|
|
804
|
+
function jt(e) {
|
|
805
|
+
const s = {};
|
|
806
|
+
for (const [t, r] of Object.entries(e))
|
|
807
|
+
t !== "search" && r !== "" && r !== void 0 && r !== null && (s[t] = String(r));
|
|
808
|
+
return s;
|
|
809
|
+
}
|
|
810
|
+
async function ue(e) {
|
|
811
|
+
try {
|
|
812
|
+
return await e();
|
|
813
|
+
} catch {
|
|
814
|
+
return null;
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
function zt(e) {
|
|
818
|
+
return {
|
|
819
|
+
fetchGroupedQueries: () => ue(() => e.fetchGroupedQueries()),
|
|
820
|
+
explainQuery: (s) => ue(() => e.explainQuery(s)),
|
|
821
|
+
fetchEmailPreview: async (s) => (await ue(() => e.fetchEmailPreview(s)))?.html || null
|
|
822
|
+
};
|
|
823
|
+
}
|
|
824
|
+
function It(e) {
|
|
825
|
+
return {
|
|
826
|
+
retryJob: async (s) => {
|
|
827
|
+
try {
|
|
828
|
+
return await e.retryJob(s), !0;
|
|
829
|
+
} catch {
|
|
830
|
+
return !1;
|
|
831
|
+
}
|
|
832
|
+
},
|
|
833
|
+
deleteCacheKey: async (s) => {
|
|
834
|
+
try {
|
|
835
|
+
return await e.deleteCacheKey(s), !0;
|
|
836
|
+
} catch {
|
|
837
|
+
return !1;
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
};
|
|
841
|
+
}
|
|
842
|
+
function qt(e, s) {
|
|
843
|
+
return {
|
|
844
|
+
fetchChart: async (t) => {
|
|
845
|
+
try {
|
|
846
|
+
return await e.fetchChart(t);
|
|
847
|
+
} catch (r) {
|
|
848
|
+
return r instanceof je && (s.value = !0), null;
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
};
|
|
852
|
+
}
|
|
853
|
+
function ne(e, s, t) {
|
|
854
|
+
const r = s(), o = jt(t.filter);
|
|
855
|
+
e.configure({
|
|
856
|
+
page: t.pagination.page,
|
|
857
|
+
perPage: t.pagination.perPage,
|
|
858
|
+
search: t.filter.search || void 0,
|
|
859
|
+
sort: t.sort.column || void 0,
|
|
860
|
+
sortDir: t.sort.column ? t.sort.direction : void 0,
|
|
861
|
+
filters: Object.keys(o).length > 0 ? o : void 0,
|
|
862
|
+
timeRange: r.startsWith("overview") ? t.timeRange.value : void 0
|
|
863
|
+
});
|
|
864
|
+
}
|
|
865
|
+
function Ot(e, s) {
|
|
866
|
+
return {
|
|
867
|
+
goToPage(t) {
|
|
868
|
+
e.pagination.page = t, s();
|
|
869
|
+
},
|
|
870
|
+
setSearch(t) {
|
|
871
|
+
e.filter.search = t, e.pagination.page = 1, s();
|
|
872
|
+
},
|
|
873
|
+
setFilter(t, r) {
|
|
874
|
+
e.filter[t] = r, e.pagination.page = 1, s();
|
|
875
|
+
},
|
|
876
|
+
setSort(t, r) {
|
|
877
|
+
e.sort.column === t && !r ? e.sort.direction = e.sort.direction === "asc" ? "desc" : "asc" : (e.sort.column = t, e.sort.direction = r || "desc"), s();
|
|
878
|
+
},
|
|
879
|
+
setTimeRange(t) {
|
|
880
|
+
e.timeRange.value = t, s();
|
|
881
|
+
}
|
|
882
|
+
};
|
|
883
|
+
}
|
|
884
|
+
function Nt(e, s, t) {
|
|
885
|
+
return {
|
|
886
|
+
async mutate(r, o = "post", d) {
|
|
887
|
+
return e.mutate(r, o, d);
|
|
888
|
+
},
|
|
889
|
+
refresh() {
|
|
890
|
+
ne(e, s, t), e.fetch(!0);
|
|
891
|
+
},
|
|
892
|
+
startRefresh() {
|
|
893
|
+
e.start();
|
|
894
|
+
},
|
|
895
|
+
stopRefresh() {
|
|
896
|
+
e.stop();
|
|
897
|
+
}
|
|
898
|
+
};
|
|
899
|
+
}
|
|
900
|
+
function Ft(e, s, t, r) {
|
|
901
|
+
W(s, () => {
|
|
902
|
+
t.pagination.page = 1;
|
|
903
|
+
for (const o of Object.keys(t.filter))
|
|
904
|
+
o === "search" ? t.filter.search = "" : delete t.filter[o];
|
|
905
|
+
t.sort.column = "", t.data.value = null, e.setSection(s()), ne(e, s, t);
|
|
906
|
+
}), r && W(r, () => {
|
|
907
|
+
ne(e, s, t), e.handleRefreshSignal();
|
|
908
|
+
});
|
|
909
|
+
}
|
|
910
|
+
function Vt(e) {
|
|
911
|
+
return {
|
|
912
|
+
data: c(null),
|
|
913
|
+
loading: c(!1),
|
|
914
|
+
error: c(null),
|
|
915
|
+
isUnauthorized: c(!1),
|
|
916
|
+
timeRange: c("1h"),
|
|
917
|
+
pagination: oe({ page: 1, perPage: e, total: 0, totalPages: 1 }),
|
|
918
|
+
filter: oe({ search: "" }),
|
|
919
|
+
sort: oe({
|
|
920
|
+
column: "",
|
|
921
|
+
direction: "desc"
|
|
922
|
+
})
|
|
923
|
+
};
|
|
924
|
+
}
|
|
925
|
+
function Gt(e, s, t, r) {
|
|
926
|
+
return {
|
|
927
|
+
data: e.data,
|
|
928
|
+
loading: e.loading,
|
|
929
|
+
error: e.error,
|
|
930
|
+
isUnauthorized: e.isUnauthorized,
|
|
931
|
+
pagination: e.pagination,
|
|
932
|
+
filter: e.filter,
|
|
933
|
+
sort: e.sort,
|
|
934
|
+
timeRange: e.timeRange,
|
|
935
|
+
...s,
|
|
936
|
+
...t,
|
|
937
|
+
...r
|
|
938
|
+
};
|
|
939
|
+
}
|
|
940
|
+
function Qt(e, s = {}) {
|
|
941
|
+
const {
|
|
942
|
+
baseUrl: t = "",
|
|
943
|
+
dashboardEndpoint: r = "/__stats/api",
|
|
944
|
+
authToken: o,
|
|
945
|
+
perPage: d = 50,
|
|
946
|
+
refreshKey: y
|
|
947
|
+
} = s, h = Vt(d), f = new Ae({
|
|
948
|
+
baseUrl: t,
|
|
949
|
+
endpoint: r,
|
|
950
|
+
authToken: o,
|
|
951
|
+
section: e(),
|
|
952
|
+
perPage: d,
|
|
953
|
+
callbacks: At(h)
|
|
954
|
+
}), _ = f.getApi(), B = Ot(h, () => {
|
|
955
|
+
ne(f, e, h), f.fetch(!1);
|
|
956
|
+
}), v = Nt(f, e, h), u = {
|
|
957
|
+
...qt(_, h.isUnauthorized),
|
|
958
|
+
...zt(_),
|
|
959
|
+
...It(_)
|
|
960
|
+
};
|
|
961
|
+
return Ft(f, e, h, y), Q(() => {
|
|
962
|
+
ne(f, e, h), f.start();
|
|
963
|
+
}), te(() => {
|
|
964
|
+
f.stop();
|
|
965
|
+
}), Gt(h, B, v, u);
|
|
966
|
+
}
|
|
967
|
+
const Jt = ["data-theme"], Wt = { class: "ss-dash-header" }, Kt = { class: "ss-dash-header-center" }, Xt = { class: "ss-dash-header-right" }, Yt = ["href"], Zt = { class: "ss-dash-body" }, es = { class: "ss-dash-nav" }, ts = ["data-ss-section", "onClick", "title"], ss = { class: "ss-dash-nav-icon" }, as = ["viewBox", "innerHTML"], ns = { class: "ss-dash-nav-label" }, os = {
|
|
968
|
+
key: 0,
|
|
969
|
+
class: "ss-dash-nav-sep"
|
|
970
|
+
}, ls = ["onClick", "title"], is = { class: "ss-dash-nav-icon" }, rs = ["viewBox", "innerHTML"], us = { class: "ss-dash-nav-label" }, ds = ["title"], cs = ["viewBox", "innerHTML"], hs = ["viewBox", "innerHTML"], vs = { class: "ss-dash-main" }, bs = ["id"], gs = { class: "ss-dash-pane-inner" }, ps = {
|
|
971
|
+
key: 1,
|
|
972
|
+
class: "ss-dash-empty"
|
|
973
|
+
}, ws = /* @__PURE__ */ se({
|
|
974
|
+
__name: "DashboardPage",
|
|
975
|
+
props: {
|
|
976
|
+
baseUrl: { default: "" },
|
|
977
|
+
dashboardEndpoint: { default: "/__stats/api" },
|
|
978
|
+
debugEndpoint: { default: void 0 },
|
|
979
|
+
authToken: { default: void 0 },
|
|
980
|
+
backUrl: { default: "/" },
|
|
981
|
+
channelName: { default: "server-stats/dashboard" }
|
|
982
|
+
},
|
|
983
|
+
setup(e) {
|
|
984
|
+
const s = T(() => import("./OverviewSection-CyfNQ8uV.js")), t = T(() => import("./RequestsSection-YTIaZGZd.js")), r = T(() => import("./QueriesSection-CXBsFp-y.js")), o = T(() => import("./EventsSection-CWjeitjU.js")), d = T(() => import("./RoutesSection-CDKMey49.js")), y = T(() => import("./LogsSection-CXx-HOWJ.js")), h = T(() => import("./EmailsSection-Dl44qyqY.js")), f = T(() => import("./CacheSection-CxEBVVkF.js")), _ = T(() => import("./JobsSection-DOBb4LjZ.js")), P = T(() => import("./ConfigSection-BiRAiaHj.js")), B = T(() => import("./InternalsSection-jhTCuK3j.js")), v = [
|
|
985
|
+
"overview",
|
|
986
|
+
"requests",
|
|
987
|
+
"queries",
|
|
988
|
+
"events",
|
|
989
|
+
"routes",
|
|
990
|
+
"logs",
|
|
991
|
+
"emails",
|
|
992
|
+
"cache",
|
|
993
|
+
"jobs",
|
|
994
|
+
"config",
|
|
995
|
+
"internals"
|
|
996
|
+
], u = e, { theme: D, toggleTheme: b } = le(), { features: I } = ce({
|
|
997
|
+
baseUrl: u.baseUrl,
|
|
998
|
+
debugEndpoint: u.debugEndpoint,
|
|
999
|
+
authToken: u.authToken
|
|
1000
|
+
}), E = c("overview"), H = c(!1), N = c(!1), q = c(0);
|
|
1001
|
+
ee("ss-refresh-key", q), ee("ss-base-url", u.baseUrl), ee("ss-dashboard-endpoint", u.dashboardEndpoint), ee("ss-debug-endpoint", u.debugEndpoint), ee("ss-auth-token", u.authToken), typeof window < "u" && (H.value = localStorage.getItem("ss-dash-sidebar") === "collapsed");
|
|
1002
|
+
let m = null;
|
|
1003
|
+
function $() {
|
|
1004
|
+
if (m && (m(), m = null), !u.channelName) return;
|
|
1005
|
+
m = ze({
|
|
1006
|
+
baseUrl: u.baseUrl,
|
|
1007
|
+
channelName: u.channelName,
|
|
1008
|
+
authToken: u.authToken,
|
|
1009
|
+
onMessage: () => {
|
|
1010
|
+
q.value += 1;
|
|
1011
|
+
},
|
|
1012
|
+
onConnect: () => {
|
|
1013
|
+
N.value = !0;
|
|
1014
|
+
},
|
|
1015
|
+
onDisconnect: () => {
|
|
1016
|
+
N.value = !1;
|
|
1017
|
+
},
|
|
1018
|
+
onError: () => {
|
|
1019
|
+
N.value = !1;
|
|
1020
|
+
}
|
|
1021
|
+
}).unsubscribe;
|
|
1022
|
+
}
|
|
1023
|
+
Q(() => {
|
|
1024
|
+
$();
|
|
1025
|
+
}), te(() => {
|
|
1026
|
+
m && (m(), m = null);
|
|
1027
|
+
});
|
|
1028
|
+
const L = p(() => I.value.customPanes || []);
|
|
1029
|
+
function R(g) {
|
|
1030
|
+
const z = g.replace("#", "").split("?")[0];
|
|
1031
|
+
return z && [...v, ...L.value.map((ie) => ie.id)].includes(z) ? z : "overview";
|
|
1032
|
+
}
|
|
1033
|
+
function Z() {
|
|
1034
|
+
const g = R(window.location.hash);
|
|
1035
|
+
g !== E.value && (E.value = g);
|
|
1036
|
+
}
|
|
1037
|
+
Q(() => {
|
|
1038
|
+
if (typeof window > "u") return;
|
|
1039
|
+
const g = R(window.location.hash);
|
|
1040
|
+
(g !== "overview" || window.location.hash) && (E.value = g), window.addEventListener("hashchange", Z);
|
|
1041
|
+
}), te(() => {
|
|
1042
|
+
window.removeEventListener("hashchange", Z);
|
|
1043
|
+
}), W(E, (g) => {
|
|
1044
|
+
typeof window < "u" && (window.location.hash = g);
|
|
1045
|
+
});
|
|
1046
|
+
function F() {
|
|
1047
|
+
H.value = !H.value, localStorage.setItem("ss-dash-sidebar", H.value ? "collapsed" : "expanded");
|
|
1048
|
+
}
|
|
1049
|
+
function J(g) {
|
|
1050
|
+
g !== E.value && (E.value = g);
|
|
1051
|
+
}
|
|
1052
|
+
const M = p(() => [
|
|
1053
|
+
{ id: "overview", label: "Overview", visible: !0 },
|
|
1054
|
+
{ id: "requests", label: "Requests", visible: !0 },
|
|
1055
|
+
{ id: "queries", label: "Queries", visible: !0 },
|
|
1056
|
+
{ id: "events", label: "Events", visible: !0 },
|
|
1057
|
+
{ id: "routes", label: "Routes", visible: !0 },
|
|
1058
|
+
{ id: "logs", label: "Logs", visible: !0 },
|
|
1059
|
+
{ id: "emails", label: "Emails", visible: !0 },
|
|
1060
|
+
{ id: "cache", label: "Cache", visible: I.value.cache },
|
|
1061
|
+
{ id: "jobs", label: "Jobs", visible: I.value.queues },
|
|
1062
|
+
{ id: "config", label: "Config", visible: !0 },
|
|
1063
|
+
{ id: "internals", label: "Internals", visible: !0 }
|
|
1064
|
+
]), O = p(() => M.value.filter((g) => g.visible)), { data: K, loading: X } = Qt(() => "overview", {
|
|
1065
|
+
baseUrl: u.baseUrl,
|
|
1066
|
+
dashboardEndpoint: u.dashboardEndpoint,
|
|
1067
|
+
authToken: u.authToken,
|
|
1068
|
+
refreshKey: q
|
|
1069
|
+
}), V = p(() => K.value);
|
|
1070
|
+
ee("ss-overview-data", K), ee("ss-overview-loading", X);
|
|
1071
|
+
const Y = p(() => {
|
|
1072
|
+
const g = {};
|
|
1073
|
+
if (!V.value) return g;
|
|
1074
|
+
if (V.value.totalRequests > 0 && (g.requests = { count: V.value.totalRequests }), V.value.queryStats?.total > 0 && (g.queries = { count: V.value.queryStats.total }), V.value.logLevelBreakdown) {
|
|
1075
|
+
const z = V.value.logLevelBreakdown, w = z.error + z.warn + z.info + z.debug;
|
|
1076
|
+
w > 0 && (g.logs = { count: w });
|
|
1077
|
+
}
|
|
1078
|
+
return g;
|
|
1079
|
+
}), S = {
|
|
1080
|
+
overview: s,
|
|
1081
|
+
requests: t,
|
|
1082
|
+
queries: r,
|
|
1083
|
+
events: o,
|
|
1084
|
+
routes: d,
|
|
1085
|
+
logs: y,
|
|
1086
|
+
emails: h,
|
|
1087
|
+
cache: f,
|
|
1088
|
+
jobs: _,
|
|
1089
|
+
config: P,
|
|
1090
|
+
internals: B
|
|
1091
|
+
}, j = p(() => S[E.value] || null);
|
|
1092
|
+
return (g, z) => (a(), l("div", {
|
|
1093
|
+
class: "ss-dash",
|
|
1094
|
+
"data-theme": n(D),
|
|
1095
|
+
id: "ss-dash"
|
|
1096
|
+
}, [
|
|
1097
|
+
i("div", Wt, [
|
|
1098
|
+
z[0] || (z[0] = i("div", { class: "ss-dash-header-left" }, [
|
|
1099
|
+
i("span", { class: "ss-dash-logo" }, "Server Stats"),
|
|
1100
|
+
i("span", { class: "ss-dash-logo-sub" }, "Dashboard")
|
|
1101
|
+
], -1)),
|
|
1102
|
+
i("div", Kt, [
|
|
1103
|
+
i("span", {
|
|
1104
|
+
class: U(["ss-dash-live-dot", { "ss-dash-connected": N.value }]),
|
|
1105
|
+
id: "ss-dash-live-dot"
|
|
1106
|
+
}, null, 2),
|
|
1107
|
+
i("span", {
|
|
1108
|
+
class: U(["ss-dash-live-label", { "ss-dash-connected": N.value }]),
|
|
1109
|
+
id: "ss-dash-live-label"
|
|
1110
|
+
}, C(N.value ? "Live" : "Polling"), 3)
|
|
1111
|
+
]),
|
|
1112
|
+
i("div", Xt, [
|
|
1113
|
+
de(ye, { "class-prefix": "ss-dash" }),
|
|
1114
|
+
e.backUrl ? (a(), l("a", {
|
|
1115
|
+
key: 0,
|
|
1116
|
+
href: e.backUrl,
|
|
1117
|
+
class: "ss-dash-back-link",
|
|
1118
|
+
title: "Back to app"
|
|
1119
|
+
}, " ← App ", 8, Yt)) : k("", !0)
|
|
1120
|
+
])
|
|
1121
|
+
]),
|
|
1122
|
+
i("div", Zt, [
|
|
1123
|
+
i("div", {
|
|
1124
|
+
class: U(["ss-dash-sidebar", { "ss-dash-collapsed": H.value }]),
|
|
1125
|
+
id: "ss-dash-sidebar"
|
|
1126
|
+
}, [
|
|
1127
|
+
i("nav", es, [
|
|
1128
|
+
(a(!0), l(G, null, ae(O.value, (w) => (a(), l("button", {
|
|
1129
|
+
key: w.id,
|
|
1130
|
+
type: "button",
|
|
1131
|
+
class: U(["ss-dash-nav-item", { "ss-dash-active": E.value === w.id }]),
|
|
1132
|
+
"data-ss-section": w.id,
|
|
1133
|
+
onClick: (ie) => J(w.id),
|
|
1134
|
+
title: H.value ? w.label : void 0
|
|
1135
|
+
}, [
|
|
1136
|
+
i("span", ss, [
|
|
1137
|
+
(a(), l("svg", {
|
|
1138
|
+
width: "20",
|
|
1139
|
+
height: "20",
|
|
1140
|
+
viewBox: (n(x)[w.id] || n(x).config).viewBox,
|
|
1141
|
+
fill: "none",
|
|
1142
|
+
stroke: "currentColor",
|
|
1143
|
+
"stroke-width": "2",
|
|
1144
|
+
"stroke-linecap": "round",
|
|
1145
|
+
"stroke-linejoin": "round",
|
|
1146
|
+
innerHTML: (n(x)[w.id] || n(x).config).elements.join("")
|
|
1147
|
+
}, null, 8, as))
|
|
1148
|
+
]),
|
|
1149
|
+
i("span", ns, C(w.label), 1),
|
|
1150
|
+
Y.value[w.id] && Y.value[w.id].count > 0 ? (a(), l("span", {
|
|
1151
|
+
key: 0,
|
|
1152
|
+
class: U(["ss-dash-nav-badge", Y.value[w.id].variant || ""])
|
|
1153
|
+
}, C(Y.value[w.id].count), 3)) : k("", !0)
|
|
1154
|
+
], 10, ts))), 128)),
|
|
1155
|
+
L.value.length > 0 ? (a(), l("div", os)) : k("", !0),
|
|
1156
|
+
(a(!0), l(G, null, ae(L.value, (w) => (a(), l("button", {
|
|
1157
|
+
key: w.id,
|
|
1158
|
+
type: "button",
|
|
1159
|
+
class: U(["ss-dash-nav-item", { "ss-dash-active": E.value === w.id }]),
|
|
1160
|
+
onClick: (ie) => J(w.id),
|
|
1161
|
+
title: H.value ? w.label : void 0
|
|
1162
|
+
}, [
|
|
1163
|
+
i("span", is, [
|
|
1164
|
+
(a(), l("svg", {
|
|
1165
|
+
width: "20",
|
|
1166
|
+
height: "20",
|
|
1167
|
+
viewBox: n(x)["custom-pane"].viewBox,
|
|
1168
|
+
fill: "none",
|
|
1169
|
+
stroke: "currentColor",
|
|
1170
|
+
"stroke-width": "2",
|
|
1171
|
+
"stroke-linecap": "round",
|
|
1172
|
+
"stroke-linejoin": "round",
|
|
1173
|
+
innerHTML: n(x)["custom-pane"].elements.join("")
|
|
1174
|
+
}, null, 8, rs))
|
|
1175
|
+
]),
|
|
1176
|
+
i("span", us, C(w.label), 1)
|
|
1177
|
+
], 10, ls))), 128))
|
|
1178
|
+
]),
|
|
1179
|
+
i("button", {
|
|
1180
|
+
type: "button",
|
|
1181
|
+
class: "ss-dash-sidebar-toggle",
|
|
1182
|
+
id: "ss-dash-sidebar-toggle",
|
|
1183
|
+
onClick: F,
|
|
1184
|
+
title: H.value ? "Expand sidebar" : "Collapse sidebar"
|
|
1185
|
+
}, [
|
|
1186
|
+
H.value ? (a(), l("svg", {
|
|
1187
|
+
key: 0,
|
|
1188
|
+
width: "16",
|
|
1189
|
+
height: "16",
|
|
1190
|
+
viewBox: n(x)["chevron-right"].viewBox,
|
|
1191
|
+
fill: "none",
|
|
1192
|
+
stroke: "currentColor",
|
|
1193
|
+
"stroke-width": "1.5",
|
|
1194
|
+
innerHTML: n(x)["chevron-right"].elements.join("")
|
|
1195
|
+
}, null, 8, cs)) : (a(), l("svg", {
|
|
1196
|
+
key: 1,
|
|
1197
|
+
width: "16",
|
|
1198
|
+
height: "16",
|
|
1199
|
+
viewBox: n(x)["chevron-left"].viewBox,
|
|
1200
|
+
fill: "none",
|
|
1201
|
+
stroke: "currentColor",
|
|
1202
|
+
"stroke-width": "1.5",
|
|
1203
|
+
innerHTML: n(x)["chevron-left"].elements.join("")
|
|
1204
|
+
}, null, 8, hs))
|
|
1205
|
+
], 8, ds)
|
|
1206
|
+
], 2),
|
|
1207
|
+
i("div", vs, [
|
|
1208
|
+
i("div", {
|
|
1209
|
+
class: "ss-dash-pane ss-dash-active",
|
|
1210
|
+
id: `ss-dash-pane-${E.value}`
|
|
1211
|
+
}, [
|
|
1212
|
+
i("div", gs, [
|
|
1213
|
+
(a(), A(Ee, null, {
|
|
1214
|
+
fallback: ve(() => [...z[1] || (z[1] = [
|
|
1215
|
+
i("div", { class: "ss-dash-empty" }, "Loading...", -1)
|
|
1216
|
+
])]),
|
|
1217
|
+
default: ve(() => [
|
|
1218
|
+
j.value ? (a(), A(Se(j.value), { key: 0 })) : (a(), l("div", ps, "Unknown section"))
|
|
1219
|
+
]),
|
|
1220
|
+
_: 1
|
|
1221
|
+
}))
|
|
1222
|
+
])
|
|
1223
|
+
], 8, bs)
|
|
1224
|
+
])
|
|
1225
|
+
])
|
|
1226
|
+
], 8, Jt));
|
|
1227
|
+
}
|
|
1228
|
+
});
|
|
1229
|
+
export {
|
|
1230
|
+
Ke as _,
|
|
1231
|
+
ws as a,
|
|
1232
|
+
ys as b,
|
|
1233
|
+
ks as c,
|
|
1234
|
+
wt as d,
|
|
1235
|
+
ce as e,
|
|
1236
|
+
Oe as f,
|
|
1237
|
+
le as g,
|
|
1238
|
+
Qt as u
|
|
1239
|
+
};
|