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,156 @@
|
|
|
1
|
+
import { defineComponent as L, inject as v, ref as h, onMounted as x, computed as g, openBlock as t, createElementBlock as n, createElementVNode as e, toDisplayString as c, createCommentVNode as w, createVNode as A, unref as y, Fragment as F, renderList as N, withModifiers as B, createBlock as M } from "vue";
|
|
2
|
+
import { u as U } from "./index-14x39RI_.js";
|
|
3
|
+
import { u as H } from "./useResizableTable-BoivAevK.js";
|
|
4
|
+
import { DashboardApi as I, formatCacheSize as j, formatTtl as q } from "adonisjs-server-stats/core";
|
|
5
|
+
import { u as P } from "./useApiClient-BQQ9CF-q.js";
|
|
6
|
+
import { _ as G } from "./JsonViewer.vue_vue_type_script_setup_true_lang-Bid05zpm.js";
|
|
7
|
+
import { _ as J } from "./FilterBar.vue_vue_type_script_setup_true_lang-ClJ37hhT.js";
|
|
8
|
+
const O = {
|
|
9
|
+
key: 0,
|
|
10
|
+
class: "ss-dash-cache-stats"
|
|
11
|
+
}, Q = { class: "ss-dash-cache-stat" }, W = { class: "ss-dash-cache-stat-value" }, X = { class: "ss-dash-cache-stat" }, Y = { class: "ss-dash-cache-stat-value" }, Z = { class: "ss-dash-cache-stat" }, ee = { class: "ss-dash-cache-stat-value" }, se = { class: "ss-dash-cache-stat" }, ae = { class: "ss-dash-cache-stat-value" }, te = {
|
|
12
|
+
key: 1,
|
|
13
|
+
class: "ss-dash-empty"
|
|
14
|
+
}, le = {
|
|
15
|
+
key: 2,
|
|
16
|
+
class: "ss-dash-empty"
|
|
17
|
+
}, ne = {
|
|
18
|
+
key: 3,
|
|
19
|
+
class: "ss-dash-table-wrap"
|
|
20
|
+
}, oe = ["onClick"], ce = ["title"], ue = { style: { color: "var(--ss-muted)" } }, ie = ["onClick"], de = {
|
|
21
|
+
key: 1,
|
|
22
|
+
class: "ss-dash-empty"
|
|
23
|
+
}, he = {
|
|
24
|
+
key: 4,
|
|
25
|
+
class: "ss-dash-cache-detail"
|
|
26
|
+
}, re = {
|
|
27
|
+
key: 0,
|
|
28
|
+
class: "ss-dash-empty"
|
|
29
|
+
}, ve = {
|
|
30
|
+
key: 1,
|
|
31
|
+
class: "ss-dash-empty",
|
|
32
|
+
style: { color: "var(--ss-red-fg)" }
|
|
33
|
+
}, ge = /* @__PURE__ */ L({
|
|
34
|
+
__name: "CacheSection",
|
|
35
|
+
setup(ye) {
|
|
36
|
+
const z = v("ss-refresh-key", h(0)), m = v("ss-dashboard-endpoint", "/__stats/api"), f = v("ss-auth-token", void 0), b = v("ss-base-url", ""), { data: k, loading: D, setSearch: K, mutate: V } = U(() => "cache", {
|
|
37
|
+
baseUrl: b,
|
|
38
|
+
dashboardEndpoint: m,
|
|
39
|
+
authToken: f,
|
|
40
|
+
refreshKey: z
|
|
41
|
+
});
|
|
42
|
+
let p = null;
|
|
43
|
+
x(() => {
|
|
44
|
+
const a = P(b || "", f);
|
|
45
|
+
p = new I(a(), m || "/__stats/api");
|
|
46
|
+
});
|
|
47
|
+
const C = h(""), u = h(null), d = h(null), _ = h(!1), i = h(null), o = g(() => k.value), r = g(() => o.value?.keys || o.value?.data || []);
|
|
48
|
+
function $(a) {
|
|
49
|
+
C.value = a, K(a);
|
|
50
|
+
}
|
|
51
|
+
async function R(a) {
|
|
52
|
+
if (confirm(`Delete cache key "${a}"?`))
|
|
53
|
+
try {
|
|
54
|
+
await V(`cache/${encodeURIComponent(a)}`, "delete"), u.value === a && (u.value = null, d.value = null, i.value = null);
|
|
55
|
+
} catch {
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const { tableRef: S } = H(() => r.value);
|
|
59
|
+
async function T(a) {
|
|
60
|
+
if (u.value === a) {
|
|
61
|
+
u.value = null, d.value = null, i.value = null;
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
u.value = a, d.value = null, i.value = null, _.value = !0;
|
|
65
|
+
try {
|
|
66
|
+
if (!p) throw new Error("Cache API not initialized");
|
|
67
|
+
const s = await p.fetchCacheKey(a);
|
|
68
|
+
d.value = s.value !== void 0 ? s.value : s.data !== void 0 ? s.data : s, i.value = null;
|
|
69
|
+
} catch {
|
|
70
|
+
d.value = null, i.value = "Failed to fetch key value";
|
|
71
|
+
} finally {
|
|
72
|
+
_.value = !1;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return (a, s) => (t(), n("div", null, [
|
|
76
|
+
o.value?.available && o.value?.stats ? (t(), n("div", O, [
|
|
77
|
+
e("div", Q, [
|
|
78
|
+
s[0] || (s[0] = e("span", { class: "ss-dash-cache-stat-label" }, "Hit Rate:", -1)),
|
|
79
|
+
e("span", W, c((o.value.stats.hitRate ?? 0).toFixed(1)) + "%", 1)
|
|
80
|
+
]),
|
|
81
|
+
e("div", X, [
|
|
82
|
+
s[1] || (s[1] = e("span", { class: "ss-dash-cache-stat-label" }, "Hits:", -1)),
|
|
83
|
+
e("span", Y, c(o.value.stats.hits ?? 0), 1)
|
|
84
|
+
]),
|
|
85
|
+
e("div", Z, [
|
|
86
|
+
s[2] || (s[2] = e("span", { class: "ss-dash-cache-stat-label" }, "Misses:", -1)),
|
|
87
|
+
e("span", ee, c(o.value.stats.misses ?? 0), 1)
|
|
88
|
+
]),
|
|
89
|
+
e("div", se, [
|
|
90
|
+
s[3] || (s[3] = e("span", { class: "ss-dash-cache-stat-label" }, "Keys:", -1)),
|
|
91
|
+
e("span", ae, c(o.value.stats.totalKeys || o.value.stats.keyCount || r.value.length || 0), 1)
|
|
92
|
+
])
|
|
93
|
+
])) : w("", !0),
|
|
94
|
+
A(J, {
|
|
95
|
+
"model-value": C.value,
|
|
96
|
+
placeholder: "Filter cache keys...",
|
|
97
|
+
summary: `${r.value.length} keys`,
|
|
98
|
+
"onUpdate:modelValue": $
|
|
99
|
+
}, null, 8, ["model-value", "summary"]),
|
|
100
|
+
y(D) && !y(k) ? (t(), n("div", te, "Loading cache...")) : !o.value || !o.value.available ? (t(), n("div", le, " Cache inspector not available ")) : (t(), n("div", ne, [
|
|
101
|
+
r.value.length > 0 ? (t(), n("table", {
|
|
102
|
+
key: 0,
|
|
103
|
+
ref_key: "tableRef",
|
|
104
|
+
ref: S,
|
|
105
|
+
class: "ss-dash-table"
|
|
106
|
+
}, [
|
|
107
|
+
s[4] || (s[4] = e("thead", null, [
|
|
108
|
+
e("tr", null, [
|
|
109
|
+
e("th", null, "Key"),
|
|
110
|
+
e("th", null, "Type"),
|
|
111
|
+
e("th", null, "Size"),
|
|
112
|
+
e("th", null, "TTL"),
|
|
113
|
+
e("th")
|
|
114
|
+
])
|
|
115
|
+
], -1)),
|
|
116
|
+
e("tbody", null, [
|
|
117
|
+
(t(!0), n(F, null, N(r.value, (l) => (t(), n("tr", {
|
|
118
|
+
key: l.key,
|
|
119
|
+
class: "ss-dash-clickable",
|
|
120
|
+
onClick: (E) => T(l.key)
|
|
121
|
+
}, [
|
|
122
|
+
e("td", null, [
|
|
123
|
+
e("span", {
|
|
124
|
+
title: l.key,
|
|
125
|
+
style: { color: "var(--ss-sql-color)", overflow: "hidden", "text-overflow": "ellipsis", "white-space": "nowrap", display: "block" }
|
|
126
|
+
}, c(l.key), 9, ce)
|
|
127
|
+
]),
|
|
128
|
+
e("td", null, [
|
|
129
|
+
e("span", ue, c(l.type), 1)
|
|
130
|
+
]),
|
|
131
|
+
e("td", null, c(l.size !== null && l.size !== void 0 && l.size > 0 ? y(j)(l.size) : "-"), 1),
|
|
132
|
+
e("td", null, c(l.ttl > 0 ? y(q)(l.ttl) : "-"), 1),
|
|
133
|
+
e("td", null, [
|
|
134
|
+
e("button", {
|
|
135
|
+
type: "button",
|
|
136
|
+
class: "ss-dash-retry-btn",
|
|
137
|
+
onClick: B((E) => R(l.key), ["stop"])
|
|
138
|
+
}, " Delete ", 8, ie)
|
|
139
|
+
])
|
|
140
|
+
], 8, oe))), 128))
|
|
141
|
+
])
|
|
142
|
+
], 512)) : (t(), n("div", de, "No cache keys found"))
|
|
143
|
+
])),
|
|
144
|
+
u.value ? (t(), n("div", he, [
|
|
145
|
+
e("h4", null, "Key: " + c(u.value), 1),
|
|
146
|
+
_.value ? (t(), n("div", re, "Loading value...")) : i.value ? (t(), n("div", ve, c(i.value), 1)) : (t(), M(G, {
|
|
147
|
+
key: 2,
|
|
148
|
+
value: d.value
|
|
149
|
+
}, null, 8, ["value"]))
|
|
150
|
+
])) : w("", !0)
|
|
151
|
+
]));
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
export {
|
|
155
|
+
ge as default
|
|
156
|
+
};
|
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
import { defineComponent as nt, inject as L, ref as h, computed as k, openBlock as r, createElementBlock as c, createElementVNode as n, normalizeClass as a, createCommentVNode as g, Fragment as x, toDisplayString as u, unref as d, renderList as E, normalizeStyle as j } from "vue";
|
|
2
|
+
import { u as lt } from "./index-14x39RI_.js";
|
|
3
|
+
import { isRedactedValue as p, flattenConfig as O, countLeaves as ot, collectTopLevelObjectKeys as st, copyWithFeedback as at, formatFlatValue as rt } from "adonisjs-server-stats/core";
|
|
4
|
+
const ct = { style: { position: "relative", flex: 1 } }, ut = ["value"], it = ["onClick"], pt = { key: 0 }, dt = ["onClick"], vt = { key: 0 }, ft = { style: { padding: "4px 16px", fontSize: "10px", color: "var(--ss-muted)" } }, yt = ["onClick"], gt = ["title"], bt = ["title"], ht = ["onClick"], $t = {
|
|
5
|
+
key: 1,
|
|
6
|
+
style: { color: "var(--ss-dim)" }
|
|
7
|
+
}, Ct = {
|
|
8
|
+
key: 3,
|
|
9
|
+
style: { color: "var(--ss-amber-fg)" }
|
|
10
|
+
}, xt = {
|
|
11
|
+
key: 4,
|
|
12
|
+
style: { color: "var(--ss-purple-fg)" }
|
|
13
|
+
}, kt = { key: 5 }, _t = ["onClick"], l = "ss-dash", Et = /* @__PURE__ */ nt({
|
|
14
|
+
__name: "ConfigSection",
|
|
15
|
+
setup(wt) {
|
|
16
|
+
const D = L("ss-refresh-key", h(0)), F = L("ss-base-url", ""), J = L("ss-dashboard-endpoint", "/__stats/api"), P = L("ss-auth-token", void 0), { data: N, loading: H } = lt(() => "config", {
|
|
17
|
+
baseUrl: F,
|
|
18
|
+
dashboardEndpoint: J,
|
|
19
|
+
authToken: P,
|
|
20
|
+
refreshKey: D
|
|
21
|
+
}), _ = h(""), $ = h(""), b = h("app"), C = h(/* @__PURE__ */ new Set()), V = h("Copy JSON"), B = h(/* @__PURE__ */ new Map());
|
|
22
|
+
let T = null;
|
|
23
|
+
function M(t) {
|
|
24
|
+
_.value = t, T && clearTimeout(T), T = setTimeout(() => {
|
|
25
|
+
$.value = t;
|
|
26
|
+
}, 200);
|
|
27
|
+
}
|
|
28
|
+
function U(t) {
|
|
29
|
+
return t.target.value;
|
|
30
|
+
}
|
|
31
|
+
const v = k(() => N.value ?? null), I = k(() => {
|
|
32
|
+
const t = v.value?.env ?? {}, o = $.value.toLowerCase();
|
|
33
|
+
return Object.entries(t).filter(([e, s]) => {
|
|
34
|
+
if (!o) return !0;
|
|
35
|
+
const f = p(s) ? s.display : s == null ? "" : String(s);
|
|
36
|
+
return e.toLowerCase().includes(o) || f.toLowerCase().includes(o);
|
|
37
|
+
});
|
|
38
|
+
}), m = k(() => {
|
|
39
|
+
const t = v.value?.app ?? {}, o = $.value.toLowerCase();
|
|
40
|
+
return O(t, "").filter((s) => {
|
|
41
|
+
const f = p(s.value) ? s.value.display : s.value === null || s.value === void 0 ? "" : String(s.value);
|
|
42
|
+
return s.path.toLowerCase().includes(o) || f.toLowerCase().includes(o);
|
|
43
|
+
});
|
|
44
|
+
}), W = k(() => {
|
|
45
|
+
const t = v.value?.app ?? {};
|
|
46
|
+
return O(t, "").length;
|
|
47
|
+
}), Y = k(() => {
|
|
48
|
+
const t = v.value?.app;
|
|
49
|
+
return !t || typeof t != "object" || Array.isArray(t) || p(t) ? [] : Object.keys(t);
|
|
50
|
+
});
|
|
51
|
+
function q(t) {
|
|
52
|
+
const o = new Set(C.value);
|
|
53
|
+
o.has(t) ? o.delete(t) : o.add(t), C.value = o;
|
|
54
|
+
}
|
|
55
|
+
function G() {
|
|
56
|
+
if (!v.value) return;
|
|
57
|
+
const t = b.value === "app" ? v.value.app : v.value.env;
|
|
58
|
+
if (!t) return;
|
|
59
|
+
const o = st(t);
|
|
60
|
+
C.value = new Set(o);
|
|
61
|
+
}
|
|
62
|
+
function Q() {
|
|
63
|
+
C.value = /* @__PURE__ */ new Set();
|
|
64
|
+
}
|
|
65
|
+
function X() {
|
|
66
|
+
if (!v.value) return;
|
|
67
|
+
const t = b.value === "app" ? v.value.app : v.value.env;
|
|
68
|
+
navigator.clipboard?.writeText(JSON.stringify(t, null, 2)).then(() => {
|
|
69
|
+
V.value = "Copied!", setTimeout(() => {
|
|
70
|
+
V.value = "Copy JSON";
|
|
71
|
+
}, 1500);
|
|
72
|
+
}).catch(() => {
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
function w(t, o) {
|
|
76
|
+
B.value.set(t, o);
|
|
77
|
+
}
|
|
78
|
+
function S(t, o, e) {
|
|
79
|
+
e.stopPropagation(), at(t, B.value.get(o) ?? null, l);
|
|
80
|
+
}
|
|
81
|
+
function Z(t) {
|
|
82
|
+
return t !== null && typeof t == "object" && !Array.isArray(t) && !p(t);
|
|
83
|
+
}
|
|
84
|
+
function tt(t, o) {
|
|
85
|
+
return O(t, o);
|
|
86
|
+
}
|
|
87
|
+
function K(t, o) {
|
|
88
|
+
return t.indexOf(o + ".") === 0 ? t.slice(o.length + 1) : t;
|
|
89
|
+
}
|
|
90
|
+
function y(t) {
|
|
91
|
+
return rt(t);
|
|
92
|
+
}
|
|
93
|
+
function R(t) {
|
|
94
|
+
return p(t) ? t.display : t == null ? "null" : String(t);
|
|
95
|
+
}
|
|
96
|
+
function i(t) {
|
|
97
|
+
const o = v.value?.app;
|
|
98
|
+
return !o || typeof o != "object" ? null : o[t] ?? null;
|
|
99
|
+
}
|
|
100
|
+
function A(t) {
|
|
101
|
+
return p(t) ? t.display : "";
|
|
102
|
+
}
|
|
103
|
+
function et() {
|
|
104
|
+
_.value = "", $.value = "";
|
|
105
|
+
}
|
|
106
|
+
function z(t) {
|
|
107
|
+
return p(t) ? t.display : "";
|
|
108
|
+
}
|
|
109
|
+
return (t, o) => (r(), c("div", null, [
|
|
110
|
+
n("div", {
|
|
111
|
+
class: a(`${l}-config-toolbar`),
|
|
112
|
+
style: { display: "flex", alignItems: "center", gap: "8px", padding: "8px 12px" }
|
|
113
|
+
}, [
|
|
114
|
+
n("button", {
|
|
115
|
+
type: "button",
|
|
116
|
+
class: a(`${l}-config-tab${b.value === "app" ? ` ${l}-active` : ""}`),
|
|
117
|
+
onClick: o[0] || (o[0] = (e) => b.value = "app")
|
|
118
|
+
}, " App Config ", 2),
|
|
119
|
+
n("button", {
|
|
120
|
+
type: "button",
|
|
121
|
+
class: a(`${l}-config-tab${b.value === "env" ? ` ${l}-active` : ""}`),
|
|
122
|
+
onClick: o[1] || (o[1] = (e) => b.value = "env")
|
|
123
|
+
}, " Env ", 2),
|
|
124
|
+
n("div", ct, [
|
|
125
|
+
n("input", {
|
|
126
|
+
type: "text",
|
|
127
|
+
class: a(`${l}-search`),
|
|
128
|
+
placeholder: "Search keys and values...",
|
|
129
|
+
value: _.value,
|
|
130
|
+
style: { width: "100%" },
|
|
131
|
+
onInput: o[2] || (o[2] = (e) => M(U(e)))
|
|
132
|
+
}, null, 42, ut),
|
|
133
|
+
_.value ? (r(), c("button", {
|
|
134
|
+
key: 0,
|
|
135
|
+
type: "button",
|
|
136
|
+
style: {
|
|
137
|
+
position: "absolute",
|
|
138
|
+
right: "6px",
|
|
139
|
+
top: "50%",
|
|
140
|
+
transform: "translateY(-50%)",
|
|
141
|
+
background: "none",
|
|
142
|
+
border: "none",
|
|
143
|
+
cursor: "pointer",
|
|
144
|
+
fontSize: "14px",
|
|
145
|
+
color: "var(--ss-dim)",
|
|
146
|
+
padding: "0 2px",
|
|
147
|
+
lineHeight: 1
|
|
148
|
+
},
|
|
149
|
+
onClick: et
|
|
150
|
+
}, " × ")) : g("", !0)
|
|
151
|
+
]),
|
|
152
|
+
b.value === "app" && !$.value ? (r(), c(x, { key: 0 }, [
|
|
153
|
+
n("button", {
|
|
154
|
+
type: "button",
|
|
155
|
+
class: a(`${l}-btn`),
|
|
156
|
+
onClick: G
|
|
157
|
+
}, "Expand All", 2),
|
|
158
|
+
n("button", {
|
|
159
|
+
type: "button",
|
|
160
|
+
class: a(`${l}-btn`),
|
|
161
|
+
onClick: Q
|
|
162
|
+
}, "Collapse All", 2)
|
|
163
|
+
], 64)) : g("", !0),
|
|
164
|
+
n("button", {
|
|
165
|
+
type: "button",
|
|
166
|
+
class: a(`${l}-btn`),
|
|
167
|
+
onClick: X
|
|
168
|
+
}, u(V.value), 3)
|
|
169
|
+
], 2),
|
|
170
|
+
d(H) && !d(N) ? (r(), c("div", {
|
|
171
|
+
key: 0,
|
|
172
|
+
class: a(`${l}-empty`)
|
|
173
|
+
}, "Loading config...", 2)) : v.value ? b.value === "env" ? (r(), c("div", {
|
|
174
|
+
key: 2,
|
|
175
|
+
class: a(`${l}-config-table-wrap`)
|
|
176
|
+
}, [
|
|
177
|
+
n("table", {
|
|
178
|
+
class: a(`${l}-table ${l}-config-env-table`)
|
|
179
|
+
}, [
|
|
180
|
+
o[4] || (o[4] = n("thead", null, [
|
|
181
|
+
n("tr", null, [
|
|
182
|
+
n("th", null, "Variable"),
|
|
183
|
+
n("th", null, "Value"),
|
|
184
|
+
n("th", { style: { width: "36px" } })
|
|
185
|
+
])
|
|
186
|
+
], -1)),
|
|
187
|
+
n("tbody", null, [
|
|
188
|
+
(r(!0), c(x, null, E(I.value, ([e, s]) => (r(), c("tr", { key: e }, [
|
|
189
|
+
n("td", {
|
|
190
|
+
class: a(`${l}-env-key`)
|
|
191
|
+
}, [
|
|
192
|
+
n("span", {
|
|
193
|
+
class: a(`${l}-config-key`)
|
|
194
|
+
}, u(e), 3)
|
|
195
|
+
], 2),
|
|
196
|
+
n("td", {
|
|
197
|
+
class: a(`${l}-env-val`)
|
|
198
|
+
}, [
|
|
199
|
+
d(p)(s) ? (r(), c("span", {
|
|
200
|
+
key: 0,
|
|
201
|
+
class: a(`${l}-config-redacted`)
|
|
202
|
+
}, u(A(s)), 3)) : (r(), c("span", {
|
|
203
|
+
key: 1,
|
|
204
|
+
class: a(`${l}-config-val`)
|
|
205
|
+
}, u(R(s)), 3))
|
|
206
|
+
], 2),
|
|
207
|
+
n("td", null, [
|
|
208
|
+
d(p)(s) ? g("", !0) : (r(), c("button", {
|
|
209
|
+
key: 0,
|
|
210
|
+
type: "button",
|
|
211
|
+
class: a(`${l}-copy-row-btn`),
|
|
212
|
+
title: "Copy",
|
|
213
|
+
ref_for: !0,
|
|
214
|
+
ref: (f) => w(`env-${e}`, f),
|
|
215
|
+
onClick: (f) => S(`${e}=${R(s)}`, `env-${e}`, f)
|
|
216
|
+
}, " ⎘ ", 10, it))
|
|
217
|
+
])
|
|
218
|
+
]))), 128)),
|
|
219
|
+
I.value.length === 0 ? (r(), c("tr", pt, [...o[3] || (o[3] = [
|
|
220
|
+
n("td", {
|
|
221
|
+
colspan: "3",
|
|
222
|
+
style: { textAlign: "center", color: "var(--ss-dim)" }
|
|
223
|
+
}, " No matching variables ", -1)
|
|
224
|
+
])])) : g("", !0)
|
|
225
|
+
])
|
|
226
|
+
], 2)
|
|
227
|
+
], 2)) : $.value ? (r(), c("div", {
|
|
228
|
+
key: 3,
|
|
229
|
+
class: a(`${l}-config-table-wrap`)
|
|
230
|
+
}, [
|
|
231
|
+
n("table", {
|
|
232
|
+
class: a(`${l}-table`)
|
|
233
|
+
}, [
|
|
234
|
+
o[6] || (o[6] = n("thead", null, [
|
|
235
|
+
n("tr", null, [
|
|
236
|
+
n("th", null, "Path"),
|
|
237
|
+
n("th", null, "Value"),
|
|
238
|
+
n("th", { style: { width: "36px" } })
|
|
239
|
+
])
|
|
240
|
+
], -1)),
|
|
241
|
+
n("tbody", null, [
|
|
242
|
+
(r(!0), c(x, null, E(m.value, (e) => (r(), c("tr", {
|
|
243
|
+
key: e.path
|
|
244
|
+
}, [
|
|
245
|
+
n("td", null, [
|
|
246
|
+
n("span", {
|
|
247
|
+
class: a(`${l}-config-key`),
|
|
248
|
+
style: { whiteSpace: "nowrap" }
|
|
249
|
+
}, u(e.path), 3)
|
|
250
|
+
]),
|
|
251
|
+
n("td", null, [
|
|
252
|
+
d(p)(e.value) ? (r(), c("span", {
|
|
253
|
+
key: 0,
|
|
254
|
+
class: a(`${l}-config-redacted`)
|
|
255
|
+
}, u(A(e.value)), 3)) : (r(), c("span", {
|
|
256
|
+
key: 1,
|
|
257
|
+
class: a(`${l}-config-val`),
|
|
258
|
+
style: j({ wordBreak: "break-all", color: y(e.value).color })
|
|
259
|
+
}, u(y(e.value).text), 7))
|
|
260
|
+
]),
|
|
261
|
+
n("td", null, [
|
|
262
|
+
d(p)(e.value) ? g("", !0) : (r(), c("button", {
|
|
263
|
+
key: 0,
|
|
264
|
+
type: "button",
|
|
265
|
+
class: a(`${l}-copy-row-btn`),
|
|
266
|
+
title: "Copy",
|
|
267
|
+
ref_for: !0,
|
|
268
|
+
ref: (s) => w(`search-${e.path}`, s),
|
|
269
|
+
onClick: (s) => S(
|
|
270
|
+
`${e.path}: ${d(p)(e.value) ? z(e.value) : y(e.value).text}`,
|
|
271
|
+
`search-${e.path}`,
|
|
272
|
+
s
|
|
273
|
+
)
|
|
274
|
+
}, " ⎘ ", 10, dt))
|
|
275
|
+
])
|
|
276
|
+
]))), 128)),
|
|
277
|
+
m.value.length === 0 ? (r(), c("tr", vt, [...o[5] || (o[5] = [
|
|
278
|
+
n("td", {
|
|
279
|
+
colspan: "3",
|
|
280
|
+
style: { textAlign: "center", color: "var(--ss-dim)" }
|
|
281
|
+
}, " No matching entries ", -1)
|
|
282
|
+
])])) : g("", !0)
|
|
283
|
+
])
|
|
284
|
+
], 2),
|
|
285
|
+
n("div", ft, u(m.value.length) + " of " + u(W.value) + " entries ", 1)
|
|
286
|
+
], 2)) : (r(), c("div", {
|
|
287
|
+
key: 4,
|
|
288
|
+
class: a(`${l}-config-table-wrap`)
|
|
289
|
+
}, [
|
|
290
|
+
n("div", {
|
|
291
|
+
class: a(`${l}-config-sections`)
|
|
292
|
+
}, [
|
|
293
|
+
(r(!0), c(x, null, E(Y.value, (e) => (r(), c("div", {
|
|
294
|
+
key: e,
|
|
295
|
+
class: a(`${l}-config-section`)
|
|
296
|
+
}, [
|
|
297
|
+
Z(i(e)) ? (r(), c(x, { key: 0 }, [
|
|
298
|
+
n("div", {
|
|
299
|
+
class: a(`${l}-config-section-header`),
|
|
300
|
+
style: { cursor: "pointer" },
|
|
301
|
+
onClick: (s) => q(e)
|
|
302
|
+
}, [
|
|
303
|
+
n("span", {
|
|
304
|
+
class: a(`${l}-config-toggle`)
|
|
305
|
+
}, u(C.value.has(e) ? "▼" : "▶"), 3),
|
|
306
|
+
n("span", {
|
|
307
|
+
class: a(`${l}-config-key`)
|
|
308
|
+
}, u(e), 3),
|
|
309
|
+
n("span", {
|
|
310
|
+
class: a(`${l}-config-count`)
|
|
311
|
+
}, u(d(ot)(i(e))) + " entries ", 3)
|
|
312
|
+
], 10, yt),
|
|
313
|
+
C.value.has(e) ? (r(), c("div", {
|
|
314
|
+
key: 0,
|
|
315
|
+
class: a(`${l}-config-section-body`)
|
|
316
|
+
}, [
|
|
317
|
+
n("table", {
|
|
318
|
+
class: a(`${l}-table ${l}-config-inner-table`)
|
|
319
|
+
}, [
|
|
320
|
+
o[7] || (o[7] = n("thead", null, [
|
|
321
|
+
n("tr", null, [
|
|
322
|
+
n("th", { style: { width: "35%" } }, "Key"),
|
|
323
|
+
n("th", null, "Value"),
|
|
324
|
+
n("th", { style: { width: "36px" } })
|
|
325
|
+
])
|
|
326
|
+
], -1)),
|
|
327
|
+
n("tbody", null, [
|
|
328
|
+
(r(!0), c(x, null, E(tt(i(e), e), (s) => (r(), c("tr", {
|
|
329
|
+
key: s.path
|
|
330
|
+
}, [
|
|
331
|
+
n("td", {
|
|
332
|
+
title: K(s.path, e)
|
|
333
|
+
}, [
|
|
334
|
+
n("span", {
|
|
335
|
+
class: a(`${l}-config-key`)
|
|
336
|
+
}, u(K(s.path, e)), 3)
|
|
337
|
+
], 8, gt),
|
|
338
|
+
n("td", {
|
|
339
|
+
title: d(p)(s.value) ? z(s.value) : y(s.value).text
|
|
340
|
+
}, [
|
|
341
|
+
d(p)(s.value) ? (r(), c("span", {
|
|
342
|
+
key: 0,
|
|
343
|
+
class: a(`${l}-config-redacted`)
|
|
344
|
+
}, u(A(s.value)), 3)) : (r(), c("span", {
|
|
345
|
+
key: 1,
|
|
346
|
+
class: a(`${l}-config-val`),
|
|
347
|
+
style: j({ color: y(s.value).color })
|
|
348
|
+
}, u(y(s.value).text), 7))
|
|
349
|
+
], 8, bt),
|
|
350
|
+
n("td", null, [
|
|
351
|
+
d(p)(s.value) ? g("", !0) : (r(), c("button", {
|
|
352
|
+
key: 0,
|
|
353
|
+
type: "button",
|
|
354
|
+
class: a(`${l}-copy-row-btn`),
|
|
355
|
+
title: "Copy",
|
|
356
|
+
ref_for: !0,
|
|
357
|
+
ref: (f) => w(`inner-${s.path}`, f),
|
|
358
|
+
onClick: (f) => S(
|
|
359
|
+
`${s.path}: ${y(s.value).text}`,
|
|
360
|
+
`inner-${s.path}`,
|
|
361
|
+
f
|
|
362
|
+
)
|
|
363
|
+
}, " ⎘ ", 10, ht))
|
|
364
|
+
])
|
|
365
|
+
]))), 128))
|
|
366
|
+
])
|
|
367
|
+
], 2)
|
|
368
|
+
], 2)) : g("", !0)
|
|
369
|
+
], 64)) : (r(), c("div", {
|
|
370
|
+
key: 1,
|
|
371
|
+
class: a(`${l}-config-section-header ${l}-config-leaf`),
|
|
372
|
+
style: { cursor: "default" }
|
|
373
|
+
}, [
|
|
374
|
+
n("span", {
|
|
375
|
+
class: a(`${l}-config-toggle`),
|
|
376
|
+
style: { visibility: "hidden" }
|
|
377
|
+
}, "•", 2),
|
|
378
|
+
n("span", {
|
|
379
|
+
class: a(`${l}-config-key`)
|
|
380
|
+
}, u(e), 3),
|
|
381
|
+
n("span", {
|
|
382
|
+
class: a(`${l}-config-val`),
|
|
383
|
+
style: { marginLeft: "8px" }
|
|
384
|
+
}, [
|
|
385
|
+
d(p)(i(e)) ? (r(), c("span", {
|
|
386
|
+
key: 0,
|
|
387
|
+
class: a(`${l}-config-redacted`)
|
|
388
|
+
}, u(A(i(e))), 3)) : i(e) === null || i(e) === void 0 ? (r(), c("span", $t, "null")) : typeof i(e) == "boolean" ? (r(), c("span", {
|
|
389
|
+
key: 2,
|
|
390
|
+
style: j({ color: i(e) ? "var(--ss-green-fg)" : "var(--ss-red-fg)" })
|
|
391
|
+
}, u(String(i(e))), 5)) : typeof i(e) == "number" ? (r(), c("span", Ct, u(String(i(e))), 1)) : Array.isArray(i(e)) ? (r(), c("span", xt, u(y(i(e)).text), 1)) : (r(), c("span", kt, u(String(i(e))), 1))
|
|
392
|
+
], 2),
|
|
393
|
+
d(p)(i(e)) ? g("", !0) : (r(), c("button", {
|
|
394
|
+
key: 0,
|
|
395
|
+
type: "button",
|
|
396
|
+
class: a(`${l}-copy-row-btn`),
|
|
397
|
+
style: { marginLeft: "4px" },
|
|
398
|
+
title: "Copy",
|
|
399
|
+
ref_for: !0,
|
|
400
|
+
ref: (s) => w(`leaf-${e}`, s),
|
|
401
|
+
onClick: (s) => S(`${e}: ${y(i(e)).text}`, `leaf-${e}`, s)
|
|
402
|
+
}, " ⎘ ", 10, _t))
|
|
403
|
+
], 2))
|
|
404
|
+
], 2))), 128))
|
|
405
|
+
], 2)
|
|
406
|
+
], 2)) : (r(), c("div", {
|
|
407
|
+
key: 1,
|
|
408
|
+
class: a(`${l}-empty`)
|
|
409
|
+
}, "Config not available", 2))
|
|
410
|
+
]));
|
|
411
|
+
}
|
|
412
|
+
});
|
|
413
|
+
export {
|
|
414
|
+
Et as default
|
|
415
|
+
};
|