This commit is contained in:
Mateusz Gruszczyński committed 2026-11-12 11:00:28 +01:00
1 parent 668c908abb
commit 76f42b5864
30 files changed
+191 -72

No files matched your search

+19 -5
View File
@@ -13,7 +13,7 @@ const ADMIN_DEFAULT_HIDDEN_WIDGETS = Object.freeze([...new Set([
])]);
const ADMIN_APPEARANCE_DEFAULTS = Object.freeze({
theme: "dark", language: "auto", ui_scale: 100, time_format: "24h", chart_style: "default",
chart_axes: false, interface_icons: false, logo_animation: false,
chart_axes: false, interface_icons: false, logo_animation: false, stable_dialog_position: true,
button_style: "normal", corner_style: "default", table_density: "normal", dashboard_density: ADMIN_DASHBOARD_DEFAULTS.dashboard_density, dashboard_widgets: [...ADMIN_DASHBOARD_WIDGETS], dashboard_hidden_widgets: [...ADMIN_DEFAULT_HIDDEN_WIDGETS], dashboard_widget_sizes: null, dashboard_widget_heights: null, dashboard_auto_fit: true, sidebar_collapsed: false,
});
const CHART_STYLE_KEYS = Object.freeze({ default: "chartStyleDefault", soft: "chartStyleSoft", technical: "chartStyleTechnical", high_contrast: "chartStyleHighContrast", neon: "chartStyleNeon", monochrome: "chartStyleMonochrome", warm: "chartStyleWarm", cool: "chartStyleCool", sunset: "chartStyleSunset", aurora: "chartStyleAurora", ocean: "chartStyleOcean", forest: "chartStyleForest", pastel: "chartStylePastel", terminal: "chartStyleTerminal", blueprint: "chartStyleBlueprint", colorblind: "chartStyleColorblind" });
@@ -134,6 +134,12 @@ function applyAdminChartAxes(value) {
}
function applyAdminInterfaceIcons(value) { return window.rustProxyIcons?.setEnabled?.(value === true) ?? false; }
function applyAdminLogoAnimation(value) { return window.rustProxyLogoAnimation?.setEnabled?.(value === true) ?? false; }
function applyAdminStableDialogPosition(value) {
const enabled = value !== false;
document.documentElement.dataset.stableDialogPosition = String(enabled);
const input = $("ui-stable-dialog-position"); if (input) input.checked = enabled;
return enabled;
}
function applyAdminButtonStyle(value) {
const style = normalizeAdminButtonStyle(value); document.documentElement.dataset.buttonStyle = style;
const select = $("ui-button-style"); if (select) select.value = style; return style;
@@ -303,7 +309,7 @@ function applyAdminPreferences(value, cache = true) {
...value,
refresh: normalizeRefreshPreferences(value.refresh),
theme: applyAdminTheme(value.theme, cache), language: applyAdminLanguage(value.language, cache, false), ui_scale: applyAdminUiScale(value.ui_scale, cache),
time_format: applyAdminTimeFormat(value.time_format), chart_style: applyAdminChartStyle(value.chart_style), chart_axes: applyAdminChartAxes(value.chart_axes), interface_icons: applyAdminInterfaceIcons(value.interface_icons), logo_animation: applyAdminLogoAnimation(value.logo_animation), button_style: applyAdminButtonStyle(value.button_style), corner_style: applyAdminCornerStyle(value.corner_style, cache), table_density: applyAdminTableDensity(value.table_density),
time_format: applyAdminTimeFormat(value.time_format), chart_style: applyAdminChartStyle(value.chart_style), chart_axes: applyAdminChartAxes(value.chart_axes), interface_icons: applyAdminInterfaceIcons(value.interface_icons), logo_animation: applyAdminLogoAnimation(value.logo_animation), stable_dialog_position: applyAdminStableDialogPosition(value.stable_dialog_position), button_style: applyAdminButtonStyle(value.button_style), corner_style: applyAdminCornerStyle(value.corner_style, cache), table_density: applyAdminTableDensity(value.table_density),
dashboard_density: applyAdminDashboardDensity(value.dashboard_density), dashboard_widgets: savedOrder, dashboard_hidden_widgets: savedHidden, dashboard_widget_sizes: savedSizes, dashboard_widget_heights: savedHeights, dashboard_auto_fit: savedAutoFit,
};
adminPreferences = normalized;
@@ -355,7 +361,7 @@ function updateAdminPreferences(patch) {
const next = { ...current, ...patch };
next.refresh = normalizeRefreshPreferences(next.refresh);
next.theme = normalizeAdminTheme(next.theme); next.language = normalizeAdminLanguage(next.language); next.ui_scale = normalizeAdminUiScale(next.ui_scale);
next.time_format = normalizeAdminTimeFormat(next.time_format); next.chart_style = normalizeAdminChartStyle(next.chart_style); next.chart_axes = next.chart_axes === true; next.interface_icons = next.interface_icons === true; next.logo_animation = next.logo_animation === true; next.button_style = normalizeAdminButtonStyle(next.button_style); next.corner_style = normalizeAdminCornerStyle(next.corner_style); next.table_density = normalizeAdminDensity(next.table_density);
next.time_format = normalizeAdminTimeFormat(next.time_format); next.chart_style = normalizeAdminChartStyle(next.chart_style); next.chart_axes = next.chart_axes === true; next.interface_icons = next.interface_icons === true; next.logo_animation = next.logo_animation === true; next.stable_dialog_position = next.stable_dialog_position !== false; next.button_style = normalizeAdminButtonStyle(next.button_style); next.corner_style = normalizeAdminCornerStyle(next.corner_style); next.table_density = normalizeAdminDensity(next.table_density);
next.dashboard_density = normalizeAdminDensity(next.dashboard_density, "compact"); next.dashboard_widgets = normalizeDashboardWidgets(next.dashboard_widgets); next.dashboard_hidden_widgets = normalizeHiddenDashboardWidgets(next.dashboard_hidden_widgets); next.dashboard_widget_sizes = normalizeDashboardWidgetSizes(next.dashboard_widget_sizes); next.dashboard_widget_heights = normalizeDashboardWidgetHeights(next.dashboard_widget_heights); next.dashboard_auto_fit = next.dashboard_auto_fit !== false; next.sidebar_collapsed = next.sidebar_collapsed === true;
const saved = await api("/api/preferences", { method: "PUT", body: JSON.stringify(next) });
if (!authenticated || epoch !== authEpoch) return adminPreferences;
@@ -363,7 +369,7 @@ function updateAdminPreferences(patch) {
});
adminPreferencesWrite = task.catch(() => undefined); return task;
}
function resetAdminPreferences() { adminPreferences = null; adminPreferencesLoading = null; adminPreferencesUnavailable = false; adminPreferencesWrite = Promise.resolve(); applyAdminInterfaceIcons(false); applyAdminLogoAnimation(false); window.rustProxyRefresh?.update(REFRESH_DEFAULTS); }
function resetAdminPreferences() { adminPreferences = null; adminPreferencesLoading = null; adminPreferencesUnavailable = false; adminPreferencesWrite = Promise.resolve(); applyAdminInterfaceIcons(false); applyAdminLogoAnimation(false); applyAdminStableDialogPosition(true); window.rustProxyRefresh?.update(REFRESH_DEFAULTS); }
function renderRefreshPreferences(value = REFRESH_DEFAULTS) {
const refresh = normalizeRefreshPreferences(value);
const switcher = $("refresh-live-enabled"); if (switcher) switcher.checked = refresh.live_enabled;
@@ -455,6 +461,14 @@ $("ui-logo-animation")?.addEventListener("change", () => {
applyAdminLogoAnimation(previous);
});
});
$("ui-stable-dialog-position")?.addEventListener("change", () => {
const control = $("ui-stable-dialog-position"), previous = adminPreferences?.stable_dialog_position !== false, next = control.checked;
applyAdminStableDialogPosition(next); if (adminPreferences) adminPreferences.stable_dialog_position = next;
void saveAppearancePreference({ stable_dialog_position: next }, control, () => {
if (adminPreferences) adminPreferences.stable_dialog_position = previous;
applyAdminStableDialogPosition(previous);
});
});
$("ui-button-style")?.addEventListener("change", () => {
const control = $("ui-button-style"), previous = adminPreferences?.button_style || "normal", next = normalizeAdminButtonStyle(control.value);
applyAdminButtonStyle(next); if (adminPreferences) adminPreferences.button_style = next; void saveAppearancePreference({ button_style: next }, control, () => { if (adminPreferences) adminPreferences.button_style = previous; applyAdminButtonStyle(previous); });
@@ -486,7 +500,7 @@ async function resetAppearancePatch(patch, control, messageKey = "appearanceSect
}
document.querySelectorAll("[data-appearance-reset]").forEach(control => control.addEventListener("click", () => {
const patches = {
interface: { theme: "dark", language: "auto", ui_scale: 100, time_format: "24h", interface_icons: false, logo_animation: false, button_style: "normal", corner_style: "default" }, charts: { chart_style: "default", chart_axes: false }, tables: { table_density: "normal" },
interface: { theme: "dark", language: "auto", ui_scale: 100, time_format: "24h", interface_icons: false, logo_animation: false, stable_dialog_position: true, button_style: "normal", corner_style: "default" }, charts: { chart_style: "default", chart_axes: false }, tables: { table_density: "normal" },
dashboard: { dashboard_density: ADMIN_DASHBOARD_DEFAULTS.dashboard_density, dashboard_widgets: [...ADMIN_DASHBOARD_WIDGETS], dashboard_hidden_widgets: [...ADMIN_APPEARANCE_DEFAULTS.dashboard_hidden_widgets], dashboard_widget_sizes: null, dashboard_widget_heights: null, dashboard_auto_fit: true },
};
void resetAppearancePatch(patches[control.dataset.appearanceReset] || {}, control);
+7 -2
View File
@@ -1305,12 +1305,17 @@ html[data-interface-icons="true"] .network-interface-hidden .quiet>svg.ui-icon {
display: none;
}
.metric-info>summary:focus-visible,
.metric-info>summary:hover,
.metric-info[open]>summary {
color: var(--text);
border-color: var(--border-hover);
outline: none;
}
.metric-info>summary:focus-visible {
color: var(--text);
border-color: var(--border-hover);
outline: 2px solid var(--accent);
outline-offset: 2px;
}
.metric-info-popover {
+9
View File
@@ -426,6 +426,15 @@ dialog.logs-dialog {
box-shadow: 0 18px 70px var(--shadow-strong);
}
html[data-stable-dialog-position="true"] dialog.vhost-dialog[open],
html[data-stable-dialog-position="true"] dialog.audit-dialog[open],
html[data-stable-dialog-position="true"] dialog.config-history-dialog[open],
html[data-stable-dialog-position="true"] dialog.config-history-json-dialog[open],
html[data-stable-dialog-position="true"] dialog.logs-dialog[open]:not(.docked) {
margin-block-start: 14px;
margin-block-end: auto;
}
.vh-location {
border: 1px solid var(--line);
background: var(--panel);
+2
View File
@@ -82,6 +82,7 @@
.appearance-interface-icons-setting,
.appearance-logo-animation-setting,
.appearance-stable-dialog-position-setting,
.appearance-chart-axes-setting {
align-self: center;
min-width: 0;
@@ -89,6 +90,7 @@
.appearance-interface-icons-setting>span,
.appearance-logo-animation-setting>span,
.appearance-stable-dialog-position-setting>span,
.appearance-chart-axes-setting>span {
display: grid;
gap: 4px;
+12 -2
View File
@@ -315,8 +315,18 @@
sourceSelect().replaceChildren(Object.assign(el("option", t("fileLogsAllSources")), { value: "all" }));
$("file-log-rows").replaceChildren(); $("file-log-aggregate-rows")?.replaceChildren(); renderAggregation(null); syncColumnPicker(); syncHeaders();
}
$("file-log-tab-entries").addEventListener("click", () => setView("entries"));
$("file-log-tab-counts").addEventListener("click", () => setView("counts"));
const fileLogTabs = [$("file-log-tab-entries"), $("file-log-tab-counts")];
fileLogTabs.forEach((button, index) => {
const view = index === 0 ? "entries" : "counts";
button.addEventListener("click", () => setView(view));
button.addEventListener("keydown", event => {
let next;
if (event.key === "ArrowRight" || event.key === "ArrowDown") next = (index + 1) % fileLogTabs.length;
else if (event.key === "ArrowLeft" || event.key === "ArrowUp") next = (index + fileLogTabs.length - 1) % fileLogTabs.length;
else if (event.key === "Home") next = 0; else if (event.key === "End") next = fileLogTabs.length - 1; else return;
event.preventDefault(); setView(next === 0 ? "entries" : "counts"); fileLogTabs[next].focus();
});
});
$("file-logs-open").addEventListener("click", () => { $("logs-menu").open = false; setPanel("filelogs"); });
$("settings-file-logs-open").addEventListener("click", () => setPanel("filelogs"));
$("file-logs-refresh").addEventListener("click", () => refresh(true));
+4
View File
@@ -2003,6 +2003,10 @@
data-i18n="logoAnimation">Animate logo</b><small
data-i18n="logoAnimationHelp">Plays short, subtle animations of
the sidebar logo from time to time and on hover.</small></span></label>
<label class="check appearance-stable-dialog-position-setting"><input
id="ui-stable-dialog-position" type="checkbox" /><span><b
data-i18n="stableDialogPosition">Keep dialogs at a stable top position</b><small
data-i18n="stableDialogPositionHelp">Prevents editor dialogs from moving vertically when switching between tabs with different content heights.</small></span></label>
<label><span data-i18n="cornerStyle">Corner rounding</span><select
id="ui-corner-style">
<option data-i18n="cornerStyleDefault" value="default">Original
+11 -1
View File
@@ -144,7 +144,17 @@
selectTab("overview");
}
document.querySelectorAll("[data-traffic-tab]").forEach(button => button.addEventListener("click", () => selectTab(button.dataset.trafficTab)));
const trafficTabs = [...document.querySelectorAll("[data-traffic-tab]")];
trafficTabs.forEach(button => {
button.addEventListener("click", () => selectTab(button.dataset.trafficTab));
button.addEventListener("keydown", event => {
const index = trafficTabs.indexOf(button); let next;
if (event.key === "ArrowRight" || event.key === "ArrowDown") next = (index + 1) % trafficTabs.length;
else if (event.key === "ArrowLeft" || event.key === "ArrowUp") next = (index + trafficTabs.length - 1) % trafficTabs.length;
else if (event.key === "Home") next = 0; else if (event.key === "End") next = trafficTabs.length - 1; else return;
event.preventDefault(); selectTab(trafficTabs[next].dataset.trafficTab); trafficTabs[next].focus();
});
});
$("traffic-refresh")?.addEventListener("click", () => void refresh()); $("traffic-scope")?.addEventListener("change", () => void refresh());
$("traffic-settings")?.addEventListener("click", () => { setPanel("settings"); window.rustProxySettings?.select("logging"); });
rustProxyRefresh.register("traffic", {
+1 -1
View File
@@ -58,7 +58,7 @@ const defaults = () => ({
});
function activateTab(name) { document.querySelectorAll("#vhost-tabs button").forEach(b => { const active = b.dataset.tab === name; b.classList.toggle("active", active); b.setAttribute("aria-pressed", String(active)); b.setAttribute("aria-selected", String(active)); b.tabIndex = active ? 0 : -1; }); container.querySelectorAll(".vh-group").forEach(g => g.hidden = g.dataset.tab !== name); }
function initTabs() { const tabs = $("vhost-tabs"); tabs.replaceChildren(); tabs.setAttribute("role", "tablist"); for (const [name, key] of [["details", "vhDetailsTab"], ["backends", "vhBackendPool"], ["health", "vhHealth"], ["locations", "vhLocations"], ["auth", "vhTabAuth"], ["ssl", "vhSsl"], ["cache", "vhCache"], ["compression", "vhCompression"], ["transform", "vhTransform"], ["security", "vhSecurity"], ["pages", "vhPages"], ["advanced", "advanced"]]) { const b = button(key, () => activateTab(name)); b.dataset.tab = name; b.setAttribute("role", "tab"); tabs.append(b); } activateTab("details"); }
function initTabs() { const tabs = $("vhost-tabs"); tabs.replaceChildren(); tabs.setAttribute("role", "tablist"); for (const [name, key] of [["details", "vhDetailsTab"], ["backends", "vhBackendPool"], ["health", "vhHealth"], ["locations", "vhLocations"], ["auth", "vhTabAuth"], ["ssl", "vhSsl"], ["cache", "vhCache"], ["compression", "vhCompression"], ["transform", "vhTransform"], ["security", "vhSecurity"], ["pages", "vhPages"], ["advanced", "advanced"]]) { const b = button(key, () => activateTab(name)); b.dataset.tab = name; b.setAttribute("role", "tab"); b.addEventListener("keydown", event => { const buttons = [...tabs.querySelectorAll("button")], index = buttons.indexOf(b); let next; if (event.key === "ArrowRight" || event.key === "ArrowDown") next = (index + 1) % buttons.length; else if (event.key === "ArrowLeft" || event.key === "ArrowUp") next = (index + buttons.length - 1) % buttons.length; else if (event.key === "Home") next = 0; else if (event.key === "End") next = buttons.length - 1; else return; event.preventDefault(); activateTab(buttons[next].dataset.tab); buttons[next].focus(); }); tabs.append(b); } activateTab("details"); }
function collectCache() { const tri = name => str(name) === "" ? null : str(name) === "on", number = (name, mul = 1) => { if (str(name) === "") return null; const value = Number(str(name)) * mul; if (!Number.isSafeInteger(value)) throw new Error(t("vhJsonInvalid")); return value; }; return { enabled: tri("vh-cache-enabled"), max_ttl_seconds: number("vh-cache-ttl"), default_ttl_seconds: number("vh-cache-default"), max_object_bytes: number("vh-cache-object", 1024), bypass_query: tri("vh-cache-query"), static_ignore_cookies: tri("vh-cache-static-cookie"), static_extensions: yes("vh-cache-static-custom") ? lines(str("vh-cache-static-extensions")).map(v => v.replace(/^\./, "").toLowerCase()) : null, expose_status: tri("vh-cache-status"), expose_hits: tri("vh-cache-hits"), expose_cache_status: tri("vh-cache-rfc"), expose_resident_age: tri("vh-cache-resident-age"), expose_only_hits: tri("vh-cache-only-hits"), bypass_prefixes: yes("vh-cache-prefix-custom") ? lines(str("vh-cache-prefixes")) : null, unsafe_force: { enabled: yes("vh-cache-force-enabled"), targets: lines(str("vh-cache-force-targets")) } }; }
function collectCompression() { const tri = name => str(name) === "" ? null : str(name) === "on"; return { enabled: tri("vh-compression-enabled"), zstd: tri("vh-compression-zstd"), br: tri("vh-compression-br"), gzip: tri("vh-compression-gzip"), deflate: tri("vh-compression-deflate") }; }
function collectTransform() {
+7
View File
@@ -150,6 +150,13 @@
button.dataset.i18n = key;
button.setAttribute("role", "tab");
button.addEventListener("click", () => activateTab(name));
button.addEventListener("keydown", event => {
const buttons = [...tabs.querySelectorAll("button")], index = buttons.indexOf(button); let next;
if (event.key === "ArrowRight" || event.key === "ArrowDown") next = (index + 1) % buttons.length;
else if (event.key === "ArrowLeft" || event.key === "ArrowUp") next = (index + buttons.length - 1) % buttons.length;
else if (event.key === "Home") next = 0; else if (event.key === "End") next = buttons.length - 1; else return;
event.preventDefault(); activateTab(buttons[next].dataset.tab); buttons[next].focus();
});
tabs.append(button);
}
activateTab("general");