v0.38.1
This commit is contained in:
1 parent
faedd249b8
commit
758cfd6274
25 files changed
+973
-39
No files matched your search
@@ -1,6 +1,7 @@
|
||||
window.rustProxyDashboardLayout = (() => {
|
||||
const dialog = $("overview-presets-dialog");
|
||||
const list = $("overview-presets-list");
|
||||
const builtinList = $("overview-presets-builtin");
|
||||
const input = $("overview-presets-name");
|
||||
const message = $("overview-presets-message");
|
||||
const save = $("overview-presets-save");
|
||||
@@ -30,7 +31,7 @@ window.rustProxyDashboardLayout = (() => {
|
||||
}
|
||||
function lock(value) {
|
||||
busy = value;
|
||||
for (const control of [save, factory, close, input, ...list.querySelectorAll("button")])
|
||||
for (const control of [save, factory, close, input, ...list.querySelectorAll("button"), ...(builtinList?.querySelectorAll("button") || [])])
|
||||
if (control) control.disabled = value;
|
||||
}
|
||||
async function run(fn) {
|
||||
@@ -58,7 +59,49 @@ window.rustProxyDashboardLayout = (() => {
|
||||
button.addEventListener("click", () => void run(fn));
|
||||
return button;
|
||||
}
|
||||
function builtinLayout(preset) {
|
||||
const visible = preset.widgets.map(([id]) => id).filter(id => ADMIN_DASHBOARD_BY_ID.has(id));
|
||||
const sizes = {};
|
||||
for (const [id, span] of preset.widgets) if (ADMIN_DASHBOARD_BY_ID.has(id)) sizes[id] = span;
|
||||
return {
|
||||
dashboard_widgets: normalizeDashboardWidgets(visible),
|
||||
dashboard_hidden_widgets: ADMIN_DASHBOARD_WIDGETS.filter(id => !visible.includes(id)),
|
||||
dashboard_widget_sizes: sizes,
|
||||
dashboard_widget_heights: null,
|
||||
dashboard_widget_positions: null,
|
||||
dashboard_auto_fit: true,
|
||||
dashboard_density: preset.dashboard_density,
|
||||
overview_samples: preset.overview_samples,
|
||||
};
|
||||
}
|
||||
function renderBuiltin() {
|
||||
if (!builtinList) return;
|
||||
const groups = [["desktop", "dashboardBuiltinDesktop"], ["mobile", "dashboardBuiltinMobile"]].map(([form, key]) => {
|
||||
const items = ADMIN_DASHBOARD_BUILTIN_PRESETS.filter(preset => preset.form === form);
|
||||
if (!items.length) return null;
|
||||
const group = el("div", undefined, "overview-presets-builtin-group");
|
||||
group.append(el("h3", t(key)));
|
||||
for (const preset of items) {
|
||||
const row = el("div", undefined, "overview-presets-row overview-presets-builtin-row");
|
||||
row.setAttribute("role", "listitem");
|
||||
row.dataset.builtinPreset = preset.id;
|
||||
const text = el("div", undefined, "overview-presets-builtin-text");
|
||||
text.append(el("strong", t(preset.name_key)), el("span", t(preset.description_key), "fine"));
|
||||
const actions = el("div", undefined, "overview-presets-actions");
|
||||
actions.append(entryButton("dashboardPresetsLoad", "primary", async () => {
|
||||
await apply(builtinLayout(preset));
|
||||
dialog.close();
|
||||
toast(translateName("dashboardBuiltinLoaded", t(preset.name_key)));
|
||||
}, t(preset.name_key)));
|
||||
row.append(text, actions);
|
||||
group.append(row);
|
||||
}
|
||||
return group;
|
||||
}).filter(Boolean);
|
||||
builtinList.replaceChildren(...groups);
|
||||
}
|
||||
function render() {
|
||||
renderBuiltin();
|
||||
const elements = presets.map(preset => {
|
||||
const row = el("div", undefined, "overview-presets-row");
|
||||
row.setAttribute("role", "listitem");
|
||||
@@ -100,6 +143,8 @@ window.rustProxyDashboardLayout = (() => {
|
||||
dashboard_widget_sizes: layout.dashboard_widget_sizes === null ? null : { ...layout.dashboard_widget_sizes },
|
||||
dashboard_widget_heights: normalizeDashboardWidgetHeights(layout.dashboard_widget_heights),
|
||||
dashboard_density: layout.dashboard_density,
|
||||
...("dashboard_widget_positions" in layout ? { dashboard_widget_positions: layout.dashboard_widget_positions } : {}),
|
||||
...("dashboard_auto_fit" in layout ? { dashboard_auto_fit: layout.dashboard_auto_fit } : {}),
|
||||
});
|
||||
window.rustProxyOverviewSamples.setLimit(layout.overview_samples, true);
|
||||
}
|
||||
|
||||
@@ -2386,6 +2386,38 @@ html:is([data-corner-style=square], [data-corner-style=subtle], [data-corner-sty
|
||||
background: var(--panel);
|
||||
}
|
||||
|
||||
.overview-presets-builtin {
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.overview-presets-builtin h3,
|
||||
.overview-presets-own-title,
|
||||
.overview-presets-builtin-group h3 {
|
||||
margin: 0;
|
||||
font-size: 13px;
|
||||
font-weight: 650;
|
||||
}
|
||||
|
||||
.overview-presets-builtin-group {
|
||||
display: grid;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.overview-presets-builtin-group h3 {
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
}
|
||||
|
||||
.overview-presets-builtin-text {
|
||||
display: grid;
|
||||
gap: 2px;
|
||||
min-width: 0;
|
||||
flex: 1 1 260px;
|
||||
}
|
||||
|
||||
.overview-presets-row strong {
|
||||
font-size: 13px;
|
||||
overflow-wrap: anywhere;
|
||||
|
||||
@@ -0,0 +1,646 @@
|
||||
[
|
||||
{
|
||||
"id": "operations",
|
||||
"form": "desktop",
|
||||
"name_key": "dashboardBuiltinOperations",
|
||||
"description_key": "dashboardBuiltinOperationsHelp",
|
||||
"dashboard_density": "compact",
|
||||
"overview_samples": 300,
|
||||
"widgets": [
|
||||
[
|
||||
"requests",
|
||||
2
|
||||
],
|
||||
[
|
||||
"active",
|
||||
2
|
||||
],
|
||||
[
|
||||
"bandwidth",
|
||||
2
|
||||
],
|
||||
[
|
||||
"errors",
|
||||
2
|
||||
],
|
||||
[
|
||||
"memory",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_response_latency",
|
||||
2
|
||||
],
|
||||
[
|
||||
"traffic_chart",
|
||||
6
|
||||
],
|
||||
[
|
||||
"connection_chart",
|
||||
6
|
||||
],
|
||||
[
|
||||
"backend_health",
|
||||
3
|
||||
],
|
||||
[
|
||||
"backend_errors",
|
||||
3
|
||||
],
|
||||
[
|
||||
"backend_latency",
|
||||
3
|
||||
],
|
||||
[
|
||||
"extra_backend_unhealthy",
|
||||
3
|
||||
],
|
||||
[
|
||||
"backend_table",
|
||||
12
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "traffic",
|
||||
"form": "desktop",
|
||||
"name_key": "dashboardBuiltinTraffic",
|
||||
"description_key": "dashboardBuiltinTrafficHelp",
|
||||
"dashboard_density": "compact",
|
||||
"overview_samples": 300,
|
||||
"widgets": [
|
||||
[
|
||||
"requests",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_total_rps",
|
||||
2
|
||||
],
|
||||
[
|
||||
"bandwidth",
|
||||
2
|
||||
],
|
||||
[
|
||||
"http_protocol",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_h2_share",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_h3_share",
|
||||
2
|
||||
],
|
||||
[
|
||||
"wide_protocol_rates",
|
||||
6
|
||||
],
|
||||
[
|
||||
"traffic_chart",
|
||||
6
|
||||
],
|
||||
[
|
||||
"http2",
|
||||
3
|
||||
],
|
||||
[
|
||||
"http3",
|
||||
3
|
||||
],
|
||||
[
|
||||
"tls",
|
||||
3
|
||||
],
|
||||
[
|
||||
"websocket_protocol",
|
||||
3
|
||||
],
|
||||
[
|
||||
"wide_connections",
|
||||
6
|
||||
],
|
||||
[
|
||||
"connection_chart",
|
||||
6
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "cache",
|
||||
"form": "desktop",
|
||||
"name_key": "dashboardBuiltinCache",
|
||||
"description_key": "dashboardBuiltinCacheHelp",
|
||||
"dashboard_density": "compact",
|
||||
"overview_samples": 300,
|
||||
"widgets": [
|
||||
[
|
||||
"cache",
|
||||
2
|
||||
],
|
||||
[
|
||||
"cache_outcomes",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_cache_hit_rate",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_cache_miss_rate",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_cache_memory",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_cold_storage",
|
||||
2
|
||||
],
|
||||
[
|
||||
"wide_cache_activity",
|
||||
6
|
||||
],
|
||||
[
|
||||
"cache_diagnostics",
|
||||
6
|
||||
],
|
||||
[
|
||||
"wide_compression_activity",
|
||||
6
|
||||
],
|
||||
[
|
||||
"wide_transform_activity",
|
||||
6
|
||||
],
|
||||
[
|
||||
"extra_cold_queue_memory",
|
||||
4
|
||||
],
|
||||
[
|
||||
"bandwidth",
|
||||
4
|
||||
],
|
||||
[
|
||||
"extra_response_latency",
|
||||
4
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "backends",
|
||||
"form": "desktop",
|
||||
"name_key": "dashboardBuiltinBackends",
|
||||
"description_key": "dashboardBuiltinBackendsHelp",
|
||||
"dashboard_density": "compact",
|
||||
"overview_samples": 300,
|
||||
"widgets": [
|
||||
[
|
||||
"backend_health",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_backends_healthy",
|
||||
2
|
||||
],
|
||||
[
|
||||
"backend_capacity",
|
||||
2
|
||||
],
|
||||
[
|
||||
"backend_queue",
|
||||
2
|
||||
],
|
||||
[
|
||||
"backend_retries",
|
||||
2
|
||||
],
|
||||
[
|
||||
"backend_rotations",
|
||||
2
|
||||
],
|
||||
[
|
||||
"backend_requests",
|
||||
4
|
||||
],
|
||||
[
|
||||
"backend_latency",
|
||||
4
|
||||
],
|
||||
[
|
||||
"backend_errors",
|
||||
4
|
||||
],
|
||||
[
|
||||
"backend_traffic",
|
||||
4
|
||||
],
|
||||
[
|
||||
"backend_http5xx",
|
||||
4
|
||||
],
|
||||
[
|
||||
"backend_timeouts",
|
||||
4
|
||||
],
|
||||
[
|
||||
"wide_backend_health",
|
||||
6
|
||||
],
|
||||
[
|
||||
"wide_latency",
|
||||
6
|
||||
],
|
||||
[
|
||||
"backend_table",
|
||||
12
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "resources",
|
||||
"form": "desktop",
|
||||
"name_key": "dashboardBuiltinResources",
|
||||
"description_key": "dashboardBuiltinResourcesHelp",
|
||||
"dashboard_density": "compact",
|
||||
"overview_samples": 600,
|
||||
"widgets": [
|
||||
[
|
||||
"extra_process_cpu",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_process_rss",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_process_fds",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_open_connections",
|
||||
2
|
||||
],
|
||||
[
|
||||
"memory",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_active_exchanges",
|
||||
2
|
||||
],
|
||||
[
|
||||
"wide_cpu",
|
||||
6
|
||||
],
|
||||
[
|
||||
"wide_memory",
|
||||
6
|
||||
],
|
||||
[
|
||||
"system_chart",
|
||||
6
|
||||
],
|
||||
[
|
||||
"memory_breakdown",
|
||||
6
|
||||
],
|
||||
[
|
||||
"process_diagnostics",
|
||||
6
|
||||
],
|
||||
[
|
||||
"network_diagnostics",
|
||||
6
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "security",
|
||||
"form": "desktop",
|
||||
"name_key": "dashboardBuiltinSecurity",
|
||||
"description_key": "dashboardBuiltinSecurityHelp",
|
||||
"dashboard_density": "compact",
|
||||
"overview_samples": 300,
|
||||
"widgets": [
|
||||
[
|
||||
"errors",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_request_error_rate",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_error_share",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_rejected_rate",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_tls_error_rate",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_cert_expiry",
|
||||
2
|
||||
],
|
||||
[
|
||||
"backend_http5xx",
|
||||
4
|
||||
],
|
||||
[
|
||||
"backend_errors",
|
||||
4
|
||||
],
|
||||
[
|
||||
"backend_timeouts",
|
||||
4
|
||||
],
|
||||
[
|
||||
"traffic_chart",
|
||||
6
|
||||
],
|
||||
[
|
||||
"wide_latency",
|
||||
6
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "docker",
|
||||
"form": "desktop",
|
||||
"name_key": "dashboardBuiltinDocker",
|
||||
"description_key": "dashboardBuiltinDockerHelp",
|
||||
"dashboard_density": "compact",
|
||||
"overview_samples": 300,
|
||||
"widgets": [
|
||||
[
|
||||
"docker_agents",
|
||||
3
|
||||
],
|
||||
[
|
||||
"docker_apps",
|
||||
3
|
||||
],
|
||||
[
|
||||
"docker_host_load",
|
||||
3
|
||||
],
|
||||
[
|
||||
"docker_containers",
|
||||
3
|
||||
],
|
||||
[
|
||||
"docker_requests",
|
||||
6
|
||||
],
|
||||
[
|
||||
"docker_host_network",
|
||||
6
|
||||
],
|
||||
[
|
||||
"requests",
|
||||
3
|
||||
],
|
||||
[
|
||||
"errors",
|
||||
3
|
||||
],
|
||||
[
|
||||
"backend_health",
|
||||
3
|
||||
],
|
||||
[
|
||||
"extra_response_latency",
|
||||
3
|
||||
],
|
||||
[
|
||||
"backend_table",
|
||||
12
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "webserver",
|
||||
"form": "desktop",
|
||||
"name_key": "dashboardBuiltinWebServer",
|
||||
"description_key": "dashboardBuiltinWebServerHelp",
|
||||
"dashboard_density": "compact",
|
||||
"overview_samples": 300,
|
||||
"widgets": [
|
||||
[
|
||||
"www_status",
|
||||
2
|
||||
],
|
||||
[
|
||||
"www_kind",
|
||||
2
|
||||
],
|
||||
[
|
||||
"www_capacity",
|
||||
2
|
||||
],
|
||||
[
|
||||
"www_methods",
|
||||
2
|
||||
],
|
||||
[
|
||||
"www_error_rate",
|
||||
2
|
||||
],
|
||||
[
|
||||
"www_php_requests",
|
||||
2
|
||||
],
|
||||
[
|
||||
"www_requests",
|
||||
6
|
||||
],
|
||||
[
|
||||
"www_latency",
|
||||
6
|
||||
],
|
||||
[
|
||||
"www_traffic",
|
||||
6
|
||||
],
|
||||
[
|
||||
"www_failures",
|
||||
6
|
||||
],
|
||||
[
|
||||
"www_top_services",
|
||||
6
|
||||
],
|
||||
[
|
||||
"www_status_trend",
|
||||
6
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "streams",
|
||||
"form": "desktop",
|
||||
"name_key": "dashboardBuiltinStreams",
|
||||
"description_key": "dashboardBuiltinStreamsHelp",
|
||||
"dashboard_density": "compact",
|
||||
"overview_samples": 300,
|
||||
"widgets": [
|
||||
[
|
||||
"stream_overview",
|
||||
4
|
||||
],
|
||||
[
|
||||
"stream_sessions",
|
||||
4
|
||||
],
|
||||
[
|
||||
"stream_backend_health",
|
||||
4
|
||||
],
|
||||
[
|
||||
"stream_traffic",
|
||||
6
|
||||
],
|
||||
[
|
||||
"active",
|
||||
3
|
||||
],
|
||||
[
|
||||
"bandwidth",
|
||||
3
|
||||
],
|
||||
[
|
||||
"connection_chart",
|
||||
6
|
||||
],
|
||||
[
|
||||
"wide_connections",
|
||||
6
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "wall",
|
||||
"form": "desktop",
|
||||
"name_key": "dashboardBuiltinWall",
|
||||
"description_key": "dashboardBuiltinWallHelp",
|
||||
"dashboard_density": "normal",
|
||||
"overview_samples": 600,
|
||||
"widgets": [
|
||||
[
|
||||
"requests",
|
||||
3
|
||||
],
|
||||
[
|
||||
"active",
|
||||
3
|
||||
],
|
||||
[
|
||||
"bandwidth",
|
||||
3
|
||||
],
|
||||
[
|
||||
"errors",
|
||||
3
|
||||
],
|
||||
[
|
||||
"traffic_chart",
|
||||
12
|
||||
],
|
||||
[
|
||||
"backend_health",
|
||||
4
|
||||
],
|
||||
[
|
||||
"extra_response_latency",
|
||||
4
|
||||
],
|
||||
[
|
||||
"extra_cache_hit_rate",
|
||||
4
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "mobile_status",
|
||||
"form": "mobile",
|
||||
"name_key": "dashboardBuiltinMobileStatus",
|
||||
"description_key": "dashboardBuiltinMobileStatusHelp",
|
||||
"dashboard_density": "compact",
|
||||
"overview_samples": 60,
|
||||
"widgets": [
|
||||
[
|
||||
"requests",
|
||||
2
|
||||
],
|
||||
[
|
||||
"errors",
|
||||
2
|
||||
],
|
||||
[
|
||||
"active",
|
||||
2
|
||||
],
|
||||
[
|
||||
"bandwidth",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_response_latency",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_cache_hit_rate",
|
||||
2
|
||||
],
|
||||
[
|
||||
"backend_health",
|
||||
12
|
||||
],
|
||||
[
|
||||
"traffic_chart",
|
||||
12
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "mobile_oncall",
|
||||
"form": "mobile",
|
||||
"name_key": "dashboardBuiltinMobileOnCall",
|
||||
"description_key": "dashboardBuiltinMobileOnCallHelp",
|
||||
"dashboard_density": "compact",
|
||||
"overview_samples": 60,
|
||||
"widgets": [
|
||||
[
|
||||
"errors",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_request_error_rate",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_backend_unhealthy",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_cert_expiry",
|
||||
2
|
||||
],
|
||||
[
|
||||
"backend_errors",
|
||||
12
|
||||
],
|
||||
[
|
||||
"backend_tiny",
|
||||
12
|
||||
]
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -4212,6 +4212,12 @@
|
||||
<div class="overview-presets-content">
|
||||
<p class="fine" data-i18n="dashboardPresetsHelp">Save named arrangements and restore them from any browser.
|
||||
Use Unlock layout on Overview to move, resize or hide cards before saving a preset.</p>
|
||||
<section class="overview-presets-builtin" aria-labelledby="overview-presets-builtin-title">
|
||||
<h3 id="overview-presets-builtin-title" data-i18n="dashboardBuiltinTitle">Built-in presets</h3>
|
||||
<p class="fine" data-i18n="dashboardBuiltinHelp">Ready-made layouts for common tasks. Loading one replaces the current arrangement; save it under your own name to keep changes.</p>
|
||||
<div class="overview-presets-list" id="overview-presets-builtin" role="list"></div>
|
||||
</section>
|
||||
<h3 class="overview-presets-own-title" data-i18n="dashboardPresetsOwnTitle">My presets</h3>
|
||||
<div class="overview-presets-create">
|
||||
<label for="overview-presets-name" data-i18n="dashboardPresetsName">Preset name</label>
|
||||
<div class="overview-presets-create-controls">
|
||||
|
||||
Reference in new issue
Block a user