This commit is contained in:
Mateusz Gruszczyński committed 2026-11-16 22:27:51 +01:00
1 parent a977cf78a5
commit 1239ff524d
17 files changed
+245 -50

No files matched your search

+2 -1
View File
@@ -6,7 +6,8 @@ Release history focused on **features, settings, default behavior, compatibility
Panel-only release: no configuration, API or proxy behavior changes. Panel-only release: no configuration, API or proxy behavior changes.
- **Chart crosshair:** with **Settings → Appearance → Show X/Y scales on charts** on, pointing at a chart (or touching it) shows dashed guide lines through the pointer with the Y value in the chart's unit and the X sample number; charts with one scale per series show each series' value. It follows the interface scale and corner style and is hidden when axes are off. - **Value tooltips on charts (optional):** new **Settings → Appearance → Charts → Show values on hover** (off by default). Pointing at a chart (or touching it) shows a Grafana-style tooltip: a dashed vertical line snaps to the nearest sample, each series gets a dot, and the tooltip lists the sample number and every series' name, colour and value at that sample; with X/Y scales also on, a dashed horizontal line marks the Y value under the pointer. Values are read from the plotted lines with the chart's own scale. Preferences API: additive `chart_tooltips` boolean (default `false`).
- **Fix:** with a chart style other than the default (for example colour-blind), the legend colours of Requests per second, Connection activity, HIT / MISS / BYPASS and Transient RAM did not match their lines.
- **Switches never share a row with fields:** in the vhost, stream, redirect and Web Service editors a switch that enables fields now takes its own row and a switch after fields starts a new row, so the fields below line up (for example HSTS, security headers, per-client IP rate limit, response identity and diagnostics, WebSocket, retries, keep-alive, passive health, .htaccess). **Override global TLS policy** has its own row above the TLS versions. - **Switches never share a row with fields:** in the vhost, stream, redirect and Web Service editors a switch that enables fields now takes its own row and a switch after fields starts a new row, so the fields below line up (for example HSTS, security headers, per-client IP rate limit, response identity and diagnostics, WebSocket, retries, keep-alive, passive health, .htaccess). **Override global TLS policy** has its own row above the TLS versions.
- **Aligned fields:** fields in one row of an editor or settings form now start their inputs and drop-downs on the same line even when one caption wraps to more lines (for example Tinyauth URL / public login URL, passive health thresholds, Prometheus address / path); multi-line text areas take the whole row. Stacked switches no longer leave large gaps between them, most visible on phones. - **Aligned fields:** fields in one row of an editor or settings form now start their inputs and drop-downs on the same line even when one caption wraps to more lines (for example Tinyauth URL / public login URL, passive health thresholds, Prometheus address / path); multi-line text areas take the whole row. Stacked switches no longer leave large gaps between them, most visible on phones.
- **Server-Timing metric names:** the option for the pre-0.38.2 names is now labelled **Legacy (proxy, origin, cache)**; the stored value `legacy` is unchanged. - **Server-Timing metric names:** the option for the pre-0.38.2 names is now labelled **Legacy (proxy, origin, cache)**; the stored value `legacy` is unchanged.
+1 -1
View File
@@ -31,7 +31,7 @@ The current bundled `src/admin/openapi.json` declares these operations (among ot
| `GET /api/certificates` · `POST /api/certificates/upload` | Certificate inventory/import. | | `GET /api/certificates` · `POST /api/certificates/upload` | Certificate inventory/import. |
| `POST /api/certificates/inspect` | Read DNS SAN coverage from a managed/external public PEM path for the editor; admin browser session only. | | `POST /api/certificates/inspect` | Read DNS SAN coverage from a managed/external public PEM path for the editor; admin browser session only. |
| `GET /api/acme` · `POST /api/acme/issue` · `POST /api/acme/renew` | Managed certificate jobs. | | `GET /api/acme` · `POST /api/acme/issue` · `POST /api/acme/renew` | Managed certificate jobs. |
| `GET/PUT /api/preferences` | Personal UI settings, including theme/layout, optional `interface_icons` and `logo_animation` (both default `false`), `stable_dialog_position` and `switch_controls` (both default `true`). | | `GET/PUT /api/preferences` | Personal UI settings, including theme/layout, optional `interface_icons` and `logo_animation` (both default `false`), `stable_dialog_position` and `switch_controls` (both default `true`), optional `chart_tooltips` (default `false`). |
| `GET /api/dashboard-presets` and named preset operations | Saved Overview presets. | | `GET /api/dashboard-presets` and named preset operations | Saved Overview presets. |
| `GET /docs/openapi.json` | Protected machine-readable API specification. | | `GET /docs/openapi.json` | Protected machine-readable API specification. |
+4
View File
@@ -126,6 +126,10 @@ Under **Settings → Appearance → Charts**, turn on **Show X/Y scales on chart
If axis labels look crowded in a small card or on mobile, disable the setting; the default presentation is unchanged. If axis labels look crowded in a small card or on mobile, disable the setting; the default presentation is unchanged.
## Value tooltips on charts
Under **Settings → Appearance → Charts**, **Show values on hover** is **off by default** and stored per administrator as `chart_tooltips: true|false` in `/api/preferences`. When it is on, pointing at a sampled line chart (or touching it) shows a dashed vertical line at the nearest sample, a dot on each series and a tooltip with the sample number and every series' name, colour and value at that sample, in the chart's unit. Values are read from the plotted lines with the chart's own scale. It works with or without **Show X/Y scales on charts**; with the scales on, a dashed horizontal line also marks the Y value under the pointer.
## Interpreting charts ## Interpreting charts
- The **Cache hit ratio** donut shows cumulative `HIT / (HIT + MISS)`: BYPASS and requests outside cache are deliberately excluded from its denominator. - The **Cache hit ratio** donut shows cumulative `HIT / (HIT + MISS)`: BYPASS and requests outside cache are deliberately excluded from its denominator.
+3
View File
@@ -2446,8 +2446,11 @@
"chartStyle": "Chart style", "chartStyle": "Chart style",
"chartAxes": "Show X/Y scales on charts", "chartAxes": "Show X/Y scales on charts",
"chartAxesHelp": "Keep adaptive scaling and all existing chart lines. Y shows the plotted range; X shows sample indices, not elapsed time. Off by default.", "chartAxesHelp": "Keep adaptive scaling and all existing chart lines. Y shows the plotted range; X shows sample indices, not elapsed time. Off by default.",
"chartTooltips": "Show values on hover",
"chartTooltipsHelp": "Pointing at a chart (or touching it) shows a dashed line at the nearest sample, a dot on each series and a tooltip with every series' value. Works with or without X/Y scales. Off by default.",
"chartAxisSamples": "samples", "chartAxisSamples": "samples",
"chartAxisSamplesHint": "X values are sample indices; gaps and aggregated buckets do not indicate elapsed time.", "chartAxisSamplesHint": "X values are sample indices; gaps and aggregated buckets do not indicate elapsed time.",
"chartAxisSample": "Sample",
"chartStyleDefault": "Default", "chartStyleDefault": "Default",
"chartStyleSoft": "Soft", "chartStyleSoft": "Soft",
"chartStyleTechnical": "Technical", "chartStyleTechnical": "Technical",
+3
View File
@@ -2446,8 +2446,11 @@
"chartStyle": "Styl wykresów", "chartStyle": "Styl wykresów",
"chartAxes": "Pokaż skale X/Y na wykresach", "chartAxes": "Pokaż skale X/Y na wykresach",
"chartAxesHelp": "Zachowuje automatyczne skalowanie i przebieg linii. Y pokazuje zakres użyty do rysowania, X numer próbki, nie czas. Domyślnie wyłączone.", "chartAxesHelp": "Zachowuje automatyczne skalowanie i przebieg linii. Y pokazuje zakres użyty do rysowania, X numer próbki, nie czas. Domyślnie wyłączone.",
"chartTooltips": "Pokazuj wartości po najechaniu",
"chartTooltipsHelp": "Po najechaniu na wykres (lub dotknięciu) pokazuje przerywaną linię przy najbliższej próbce, kropki na seriach i dymek z wartością każdej serii. Działa z osiami X/Y i bez nich. Domyślnie wyłączone.",
"chartAxisSamples": "próbki", "chartAxisSamples": "próbki",
"chartAxisSamplesHint": "Oś X pokazuje indeksy próbek; przerwy i zagregowane okresy nie oznaczają czasu, jaki upłynął.", "chartAxisSamplesHint": "Oś X pokazuje indeksy próbek; przerwy i zagregowane okresy nie oznaczają czasu, jaki upłynął.",
"chartAxisSample": "Próbka",
"chartStyleDefault": "Domyślny", "chartStyleDefault": "Domyślny",
"chartStyleSoft": "Łagodny", "chartStyleSoft": "Łagodny",
"chartStyleTechnical": "Techniczny", "chartStyleTechnical": "Techniczny",
+5
View File
@@ -4159,6 +4159,11 @@
"default": false, "default": false,
"description": "Account-scoped optional X/Y scales on sampled time-series charts. Shows the same Y range used to draw each SVG and X sample indices rather than inferred elapsed time; does not change adaptive scaling." "description": "Account-scoped optional X/Y scales on sampled time-series charts. Shows the same Y range used to draw each SVG and X sample indices rather than inferred elapsed time; does not change adaptive scaling."
}, },
"chart_tooltips": {
"type": "boolean",
"default": false,
"description": "Since 0.38.6. Account-scoped optional value tooltips on sampled time-series charts: pointing at a chart snaps a dashed line to the nearest sample and lists every series' value there. Independent of chart_axes; presentation only."
},
"interface_icons": { "interface_icons": {
"type": "boolean", "type": "boolean",
"default": false, "default": false,
+3
View File
@@ -158,6 +158,8 @@ struct AdminPreferences {
#[serde(default)] #[serde(default)]
chart_axes: bool, chart_axes: bool,
#[serde(default)] #[serde(default)]
chart_tooltips: bool,
#[serde(default)]
interface_icons: bool, interface_icons: bool,
#[serde(default)] #[serde(default)]
logo_animation: bool, logo_animation: bool,
@@ -237,6 +239,7 @@ impl Default for AdminPreferences {
time_format: default_admin_time_format(), time_format: default_admin_time_format(),
chart_style: default_admin_chart_style(), chart_style: default_admin_chart_style(),
chart_axes: false, chart_axes: false,
chart_tooltips: false,
interface_icons: false, interface_icons: false,
logo_animation: false, logo_animation: false,
stable_dialog_position: default_admin_stable_dialog_position(), stable_dialog_position: default_admin_stable_dialog_position(),
+14
View File
@@ -45,6 +45,7 @@ fn overview_factory_preset_matches_registry_and_operator_visibility() {
assert!(hidden.iter().all(|id| order.contains(id))); assert!(hidden.iter().all(|id| order.contains(id)));
assert!(validate_admin_preferences(&AdminPreferences::default()).is_ok()); assert!(validate_admin_preferences(&AdminPreferences::default()).is_ok());
assert!(!AdminPreferences::default().chart_axes); assert!(!AdminPreferences::default().chart_axes);
assert!(!AdminPreferences::default().chart_tooltips);
assert!(!AdminPreferences::default().interface_icons); assert!(!AdminPreferences::default().interface_icons);
assert!(!AdminPreferences::default().logo_animation); assert!(!AdminPreferences::default().logo_animation);
assert!(AdminPreferences::default().stable_dialog_position); assert!(AdminPreferences::default().stable_dialog_position);
@@ -105,6 +106,19 @@ fn optional_interface_icons_preference_is_backward_compatible_and_off_by_default
assert!(recovered.interface_icons); assert!(recovered.interface_icons);
} }
#[test]
fn optional_chart_tooltips_preference_is_backward_compatible_and_off_by_default() {
let legacy: AdminPreferences = serde_json::from_str(r#"{"chart_axes":true}"#).unwrap();
assert!(!legacy.chart_tooltips);
let mut enabled = legacy.clone();
enabled.chart_tooltips = true;
assert!(validate_admin_preferences(&enabled).is_ok());
let stored = serde_json::to_string(&enabled).unwrap();
assert!(stored.contains("\"chart_tooltips\":true"));
let recovered: AdminPreferences = serde_json::from_str(&stored).unwrap();
assert!(recovered.chart_tooltips);
}
#[test] #[test]
fn optional_chart_axes_preference_is_backward_compatible() { fn optional_chart_axes_preference_is_backward_compatible() {
let legacy: AdminPreferences = serde_json::from_str(r#"{"chart_style":"neon"}"#).unwrap(); let legacy: AdminPreferences = serde_json::from_str(r#"{"chart_style":"neon"}"#).unwrap();
+3
View File
@@ -2174,6 +2174,7 @@ mod tests {
assert_eq!(initial["time_format"], "24h"); assert_eq!(initial["time_format"], "24h");
assert_eq!(initial["chart_style"], "default"); assert_eq!(initial["chart_style"], "default");
assert_eq!(initial["chart_axes"], false); assert_eq!(initial["chart_axes"], false);
assert_eq!(initial["chart_tooltips"], false);
assert_eq!(initial["interface_icons"], false); assert_eq!(initial["interface_icons"], false);
assert_eq!(initial["logo_animation"], false); assert_eq!(initial["logo_animation"], false);
assert_eq!(initial["stable_dialog_position"], true); assert_eq!(initial["stable_dialog_position"], true);
@@ -2225,6 +2226,7 @@ mod tests {
assert_eq!(legacy["time_format"], "24h"); assert_eq!(legacy["time_format"], "24h");
assert_eq!(legacy["chart_style"], "default"); assert_eq!(legacy["chart_style"], "default");
assert_eq!(legacy["chart_axes"], false); assert_eq!(legacy["chart_axes"], false);
assert_eq!(legacy["chart_tooltips"], false);
assert_eq!(legacy["interface_icons"], false); assert_eq!(legacy["interface_icons"], false);
assert_eq!(legacy["logo_animation"], false); assert_eq!(legacy["logo_animation"], false);
assert_eq!(legacy["stable_dialog_position"], true); assert_eq!(legacy["stable_dialog_position"], true);
@@ -2251,6 +2253,7 @@ mod tests {
"time_format":"12h", "time_format":"12h",
"chart_style":"neon", "chart_style":"neon",
"chart_axes":true, "chart_axes":true,
"chart_tooltips":true,
"interface_icons":true, "interface_icons":true,
"logo_animation":true, "logo_animation":true,
"stable_dialog_position":false, "stable_dialog_position":false,
+86 -16
View File
@@ -50,25 +50,79 @@ window.rustProxyChartScale = (() => {
} }
return `${format(n)}${unit === "percent" ? "%" : unit === "ms" ? " ms" : unit === "rate" ? "/s" : ""}`; return `${format(n)}${unit === "percent" ? "%" : unit === "ms" ? " ms" : unit === "rate" ? "/s" : ""}`;
} }
// Crosshair: with axes enabled, dashed guide lines follow the pointer and // Crosshair (Grafana-style): with value tooltips enabled, a dashed vertical line
// label the Y value and X sample under it. Values come from the same // snaps to the nearest sample, each series gets a dot, and a tooltip lists
// axis data the overlay uses, so they match the drawn scale. // every series' value at that sample; a dashed horizontal line marks the
// Y value under the pointer. Values are read back from the drawn lines
// with the chart's own axis scale, so they match what is plotted.
function lineSeries(svg) {
const box = svg.viewBox?.baseVal, height = box?.height || svg.clientHeight || 1;
return [...svg.querySelectorAll("polyline, path")].filter(node => !node.classList.contains("chart-grid") && !node.closest(".rp-chart-crosshair")).map(node => {
const style = getComputedStyle(node);
if (style.display === "none" || style.visibility === "hidden" || style.stroke === "none" || Number(style.strokeOpacity) === 0) return null;
const numbers = (node.getAttribute(node.tagName.toLowerCase() === "polyline" ? "points" : "d") || "").match(/-?\d*\.?\d+(?:e[-+]?\d+)?/gi) || [];
const points = []; for (let i = 0; i + 1 < numbers.length; i += 2) points.push([Number(numbers[i]), Number(numbers[i + 1])]);
return points.length ? { node, points, color: style.stroke, height } : null;
}).filter(Boolean);
}
function legendItems(svg) {
const card = svg.closest(".card, .stat, .mini-live-chart, .vhost-chart, .docker-service-metrics, article") || svg.parentElement?.parentElement;
if (!card) return [];
const swatch = item => {
const key = item.querySelector(":scope > i");
for (const [node, pseudo] of [[key, null], [item, "::before"], [key, "::before"]]) {
if (!node) continue;
const style = getComputedStyle(node, pseudo), visible = value => value && value !== "rgba(0, 0, 0, 0)" && value !== "transparent";
if (visible(style.backgroundColor)) return style.backgroundColor;
for (const side of ["Top", "Left", "Bottom"]) if (parseFloat(style[`border${side}Width`]) > 0 && visible(style[`border${side}Color`])) return style[`border${side}Color`];
}
return "";
};
return [...card.querySelectorAll("[class*=legend] > span, [class*=legend] > *[class*=key], [class*=-key]")].filter(item => !item.closest("svg, .rp-chart-axis-host") && (item.querySelector(":scope > i") || /(^|\s)\S*(key|legend-)\S*/.test(item.className))).map(item => {
const label = [...item.childNodes].filter(node => node.nodeType === 3 || (node.nodeType === 1 && !["B", "STRONG", "I"].includes(node.tagName))).map(node => node.textContent).join(" ").replace(/\s+/g, " ").trim();
return label ? { label, color: swatch(item) } : null;
}).filter(Boolean);
}
function seriesName(svg, series, index, legend, scales, total) {
if (total < 2) return "";
if (scales?.[index]) return scales[index][0];
const byColor = legend.filter(item => item.color === series.color);
if (byColor.length === 1) return byColor[0].label;
if (legend.length === total) return legend[index].label;
const token = `${series.node.id || ""} ${series.node.getAttribute("class") || ""}`.match(/(?:-|^)(h1|h2|h3|total|transform|hit|miss|bypass|open|exchange|rx|tx|[a-z0-9_]+?)-(?:line|sparkline)\b/i)?.[1];
return token ? token.replace(/_/g, " ").toUpperCase() : "";
}
function crosshairValues(svg, event) { function crosshairValues(svg, event) {
const data = svg.rustProxyAxisData, box = svg.getBoundingClientRect(); const data = svg.rustProxyAxisData, box = svg.getBoundingClientRect();
if (!data || !box.width || !box.height) return null; if (!data || !box.width || !box.height) return null;
const fx = Math.min(1, Math.max(0, (event.clientX - box.left) / box.width)); const fx = Math.min(1, Math.max(0, (event.clientX - box.left) / box.width));
const fy = Math.min(1, Math.max(0, (event.clientY - box.top) / box.height)); const fy = Math.min(1, Math.max(0, (event.clientY - box.top) / box.height));
const span = data.bottom - data.top || 1, ratio = Math.max(0, (data.bottom - fy) / span); const span = data.bottom - data.top || 1, ratio = y => Math.max(0, (data.bottom - y) / span);
const sample = data.count > 1 ? Math.round(fx * (data.count - 1)) + 1 : data.count;
const scales = Array.isArray(data.seriesScales) && data.seriesScales.length ? data.seriesScales : null; const scales = Array.isArray(data.seriesScales) && data.seriesScales.length ? data.seriesScales : null;
const y = scales ? scales.map(([name, peak]) => `${name}: ${axisValue(peak * ratio, data.unit)}`).join(" · ") : `Y ${axisValue(data.peak * ratio, data.unit)}`; const series = lineSeries(svg), width = svg.viewBox?.baseVal?.width || box.width;
return { box, fx, fy, y, x: data.count ? `X ${sample}/${data.count}` : "X –" }; let snap = fx, sample = data.count > 1 ? Math.round(fx * (data.count - 1)) + 1 : data.count;
const rows = [];
if (series.length) {
const xs = series[0].points.map(([x]) => x), target = fx * width;
let index = 0; for (let i = 1; i < xs.length; i++) if (Math.abs(xs[i] - target) < Math.abs(xs[index] - target)) index = i;
snap = xs[index] / width;
sample = data.count ? Math.min(data.count, Math.max(1, data.count - (xs.length - 1 - index))) : index + 1;
const legend = legendItems(svg);
series.forEach((line, i) => {
const point = line.points.reduce((best, current) => Math.abs(current[0] - xs[index]) < Math.abs(best[0] - xs[index]) ? current : best, line.points[0]);
const peak = scales?.[i]?.[1] ?? data.peak, fraction = point[1] / line.height;
rows.push({ name: seriesName(svg, line, i, legend, scales, series.length), color: line.color, value: axisValue(peak * ratio(fraction), data.unit), fy: fraction });
});
} }
const y = scales ? "" : `Y ${axisValue(data.peak * ratio(fy), data.unit)}`;
return { box, fx, fy, snap, y, sample, count: data.count, rows };
}
let activeCrosshair = null;
function attachCrosshair(host, svg) { function attachCrosshair(host, svg) {
const cross = document.createElement("div"); cross.className = "rp-chart-crosshair"; cross.hidden = true; cross.setAttribute("aria-hidden", "true"); const cross = document.createElement("div"); cross.className = "rp-chart-crosshair"; cross.hidden = true; cross.setAttribute("aria-hidden", "true");
const vertical = document.createElement("i"), horizontal = document.createElement("i"), yLabel = document.createElement("span"), xLabel = document.createElement("span"); const vertical = document.createElement("i"), horizontal = document.createElement("i"), yLabel = document.createElement("span"), dots = document.createElement("div"), tip = document.createElement("div");
vertical.className = "rp-chart-crosshair-v"; horizontal.className = "rp-chart-crosshair-h"; yLabel.className = "rp-chart-crosshair-y"; xLabel.className = "rp-chart-crosshair-x"; vertical.className = "rp-chart-crosshair-v"; horizontal.className = "rp-chart-crosshair-h"; yLabel.className = "rp-chart-crosshair-y"; dots.className = "rp-chart-crosshair-dots"; tip.className = "rp-chart-tooltip";
cross.append(vertical, horizontal, yLabel, xLabel); host.append(cross); cross.append(vertical, horizontal, yLabel, dots, tip); host.append(cross);
let frame = 0, last = null; let frame = 0, last = null;
const draw = () => { const draw = () => {
frame = 0; if (!last || !host.isConnected) return; frame = 0; if (!last || !host.isConnected) return;
@@ -77,14 +131,24 @@ window.rustProxyChartScale = (() => {
// overlay is positioned in the host's own (unscaled) pixels. // overlay is positioned in the host's own (unscaled) pixels.
const hostBox = host.getBoundingClientRect(), scale = host.offsetWidth ? hostBox.width / host.offsetWidth : 1; const hostBox = host.getBoundingClientRect(), scale = host.offsetWidth ? hostBox.width / host.offsetWidth : 1;
const left = (values.box.left - hostBox.left) / scale, top = (values.box.top - hostBox.top) / scale, width = values.box.width / scale, height = values.box.height / scale; const left = (values.box.left - hostBox.left) / scale, top = (values.box.top - hostBox.top) / scale, width = values.box.width / scale, height = values.box.height / scale;
const x = left + values.fx * width, y = top + values.fy * height; const x = left + values.snap * width, y = top + values.fy * height, pointerX = left + values.fx * width;
cross.style.setProperty("--rp-cross-left", `${left}px`); cross.style.setProperty("--rp-cross-top", `${top}px`); cross.style.setProperty("--rp-cross-left", `${left}px`); cross.style.setProperty("--rp-cross-top", `${top}px`);
cross.style.setProperty("--rp-cross-width", `${width}px`); cross.style.setProperty("--rp-cross-height", `${height}px`); cross.style.setProperty("--rp-cross-width", `${width}px`); cross.style.setProperty("--rp-cross-height", `${height}px`);
cross.style.setProperty("--rp-cross-x", `${x}px`); cross.style.setProperty("--rp-cross-y", `${y}px`); cross.style.setProperty("--rp-cross-x", `${x}px`); cross.style.setProperty("--rp-cross-y", `${y}px`);
cross.classList.toggle("is-right", values.fx > .6); cross.classList.toggle("is-low", values.fy > .7); yLabel.textContent = values.y; yLabel.hidden = !values.y;
yLabel.textContent = values.y; xLabel.textContent = values.x; cross.hidden = false; dots.replaceChildren(...values.rows.map(row => { const dot = document.createElement("i"); dot.style.left = `${x}px`; dot.style.top = `${top + row.fy * height}px`; dot.style.background = row.color; return dot; }));
const head = document.createElement("b"); head.textContent = values.count ? `${t("chartAxisSample")} ${values.sample}/${values.count}` : "–";
tip.replaceChildren(head, ...values.rows.map(row => {
const line = document.createElement("span"), key = document.createElement("i"), name = document.createElement("span"), value = document.createElement("strong");
key.style.background = row.color; name.textContent = row.name; value.textContent = row.value; line.append(key, name, value); return line;
}));
tip.hidden = !values.rows.length; cross.hidden = false;
if (activeCrosshair && activeCrosshair !== cross) activeCrosshair.hidden = true; activeCrosshair = cross;
const hostWidth = host.offsetWidth, tipWidth = tip.offsetWidth || 160, tipHeight = tip.offsetHeight || 40;
const tipLeft = pointerX + 14 + tipWidth > hostWidth ? Math.max(0, pointerX - 14 - tipWidth) : pointerX + 14;
tip.style.left = `${tipLeft}px`; tip.style.top = `${Math.max(0, Math.min(top + height - tipHeight, y - tipHeight / 2))}px`;
}; };
const move = event => { if (event.target.closest?.(".rp-chart-axis-x, .rp-chart-axis-series")) { cross.hidden = true; return; } last = event; if (!frame) frame = requestAnimationFrame(draw); }; const move = event => { if (!tooltipsOn() || event.target.closest?.(".rp-chart-axis-x, .rp-chart-axis-series")) { cross.hidden = true; return; } last = event; if (!frame) frame = requestAnimationFrame(draw); };
const leave = () => { last = null; cross.hidden = true; }; const leave = () => { last = null; cross.hidden = true; };
host.addEventListener("pointermove", move); host.addEventListener("pointerdown", move); host.addEventListener("pointermove", move); host.addEventListener("pointerdown", move);
host.addEventListener("pointerleave", leave); host.addEventListener("pointercancel", leave); host.addEventListener("pointerleave", leave); host.addEventListener("pointercancel", leave);
@@ -92,6 +156,11 @@ window.rustProxyChartScale = (() => {
function setAxisText(node, value) { function setAxisText(node, value) {
if (node.textContent !== value) node.textContent = value; if (node.textContent !== value) node.textContent = value;
} }
// The overlay host is needed for X/Y scales and for value tooltips; each
// is a separate appearance preference, both off by default.
const axesOn = () => document.documentElement.dataset.chartAxes === "true";
const tooltipsOn = () => document.documentElement.dataset.chartTooltips === "true";
const axesWanted = () => axesOn() || tooltipsOn();
function renderAxes(svg) { function renderAxes(svg) {
if (!svg?.isConnected || !svg.rustProxyAxisData) return; if (!svg?.isConnected || !svg.rustProxyAxisData) return;
let host = svg.parentElement; let host = svg.parentElement;
@@ -123,6 +192,7 @@ window.rustProxyChartScale = (() => {
attachCrosshair(host, svg); attachCrosshair(host, svg);
} }
const { peak: maximum, unit, count, top, bottom, clipped, seriesScales } = svg.rustProxyAxisData; const { peak: maximum, unit, count, top, bottom, clipped, seriesScales } = svg.rustProxyAxisData;
host.classList.toggle("rp-chart-axis-off", !axesOn());
const compact = svg.closest(".stat-chart") !== null; const compact = svg.closest(".stat-chart") !== null;
host.classList.toggle("rp-chart-axis-compact", compact); host.classList.toggle("rp-chart-axis-compact", compact);
const multi = Array.isArray(seriesScales) && seriesScales.length > 0; const multi = Array.isArray(seriesScales) && seriesScales.length > 0;
@@ -163,10 +233,10 @@ window.rustProxyChartScale = (() => {
seriesScales: Array.isArray(seriesScales) ? seriesScales.filter(row => seriesScales: Array.isArray(seriesScales) ? seriesScales.filter(row =>
Array.isArray(row) && typeof row[0] === "string" && Number.isFinite(row[1]) && row[1] >= 0) : null, Array.isArray(row) && typeof row[0] === "string" && Number.isFinite(row[1]) && row[1] >= 0) : null,
}; };
if (document.documentElement.dataset.chartAxes === "true") renderAxes(svg); if (axesWanted()) renderAxes(svg);
} }
function refreshAxes() { function refreshAxes() {
const show = document.documentElement.dataset.chartAxes === "true"; const show = axesWanted();
for (const svg of document.querySelectorAll("svg:not(.ui-icon)")) { for (const svg of document.querySelectorAll("svg:not(.ui-icon)")) {
if (show && svg.rustProxyAxisData) renderAxes(svg); if (show && svg.rustProxyAxisData) renderAxes(svg);
else if (!show && svg.parentElement?.classList.contains("rp-chart-axis-host")) { else if (!show && svg.parentElement?.classList.contains("rp-chart-axis-host")) {
+19 -4
View File
@@ -13,7 +13,7 @@ const ADMIN_DEFAULT_HIDDEN_WIDGETS = Object.freeze([...new Set([
])]); ])]);
const ADMIN_APPEARANCE_DEFAULTS = Object.freeze({ const ADMIN_APPEARANCE_DEFAULTS = Object.freeze({
theme: "dark", language: "auto", ui_scale: 100, time_format: "24h", chart_style: "default", theme: "dark", language: "auto", ui_scale: 100, time_format: "24h", chart_style: "default",
chart_axes: false, interface_icons: false, logo_animation: false, stable_dialog_position: true, switch_controls: true, chart_axes: false, chart_tooltips: false, interface_icons: false, logo_animation: false, stable_dialog_position: true, switch_controls: 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_widget_positions: null, dashboard_auto_fit: true, sidebar_collapsed: false, 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_widget_positions: 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" }); 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" });
@@ -137,6 +137,13 @@ function applyAdminChartStyle(value) {
const style = normalizeAdminChartStyle(value); document.documentElement.dataset.chartStyle = style; const style = normalizeAdminChartStyle(value); document.documentElement.dataset.chartStyle = style;
const select = $("ui-chart-style"); if (select) select.value = style; refreshChartStylePalette(style); return style; const select = $("ui-chart-style"); if (select) select.value = style; refreshChartStylePalette(style); return style;
} }
function applyAdminChartTooltips(value) {
const enabled = value === true;
document.documentElement.dataset.chartTooltips = String(enabled);
const input = $("ui-chart-tooltips"); if (input) input.checked = enabled;
window.rustProxyChartScale?.refreshAxes?.();
return enabled;
}
function applyAdminChartAxes(value) { function applyAdminChartAxes(value) {
const enabled = value === true; const enabled = value === true;
document.documentElement.dataset.chartAxes = String(enabled); document.documentElement.dataset.chartAxes = String(enabled);
@@ -337,7 +344,7 @@ function applyAdminPreferences(value, cache = true) {
...value, ...value,
refresh: normalizeRefreshPreferences(value.refresh), refresh: normalizeRefreshPreferences(value.refresh),
theme: applyAdminTheme(value.theme, cache), language: applyAdminLanguage(value.language, cache, false), ui_scale: applyAdminUiScale(value.ui_scale, cache), 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), stable_dialog_position: applyAdminStableDialogPosition(value.stable_dialog_position), switch_controls: applyAdminSwitchControls(value.switch_controls), 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), chart_tooltips: applyAdminChartTooltips(value.chart_tooltips), interface_icons: applyAdminInterfaceIcons(value.interface_icons), logo_animation: applyAdminLogoAnimation(value.logo_animation), stable_dialog_position: applyAdminStableDialogPosition(value.stable_dialog_position), switch_controls: applyAdminSwitchControls(value.switch_controls), 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_widget_positions: savedPositions, dashboard_auto_fit: savedAutoFit, dashboard_density: applyAdminDashboardDensity(value.dashboard_density), dashboard_widgets: savedOrder, dashboard_hidden_widgets: savedHidden, dashboard_widget_sizes: savedSizes, dashboard_widget_heights: savedHeights, dashboard_widget_positions: savedPositions, dashboard_auto_fit: savedAutoFit,
}; };
adminPreferences = normalized; adminPreferences = normalized;
@@ -389,7 +396,7 @@ function updateAdminPreferences(patch) {
const next = { ...current, ...patch }; const next = { ...current, ...patch };
next.refresh = normalizeRefreshPreferences(next.refresh); next.refresh = normalizeRefreshPreferences(next.refresh);
next.theme = normalizeAdminTheme(next.theme); next.language = normalizeAdminLanguage(next.language); next.ui_scale = normalizeAdminUiScale(next.ui_scale); 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.stable_dialog_position = next.stable_dialog_position !== false; next.switch_controls = next.switch_controls !== false; 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.chart_tooltips = next.chart_tooltips === 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.switch_controls = next.switch_controls !== 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_widget_positions = normalizeDashboardWidgetPositions(next.dashboard_widget_positions); next.dashboard_auto_fit = next.dashboard_auto_fit !== false; next.sidebar_collapsed = next.sidebar_collapsed === true; 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_widget_positions = normalizeDashboardWidgetPositions(next.dashboard_widget_positions); 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) }); const saved = await api("/api/preferences", { method: "PUT", body: JSON.stringify(next) });
if (!authenticated || epoch !== authEpoch) return adminPreferences; if (!authenticated || epoch !== authEpoch) return adminPreferences;
@@ -473,6 +480,14 @@ $("ui-chart-axes")?.addEventListener("change", () => {
applyAdminChartAxes(previous); applyAdminChartAxes(previous);
}); });
}); });
$("ui-chart-tooltips")?.addEventListener("change", () => {
const control = $("ui-chart-tooltips"), previous = adminPreferences?.chart_tooltips === true, next = control.checked;
applyAdminChartTooltips(next); if (adminPreferences) adminPreferences.chart_tooltips = next;
void saveAppearancePreference({ chart_tooltips: next }, control, () => {
if (adminPreferences) adminPreferences.chart_tooltips = previous;
applyAdminChartTooltips(previous);
});
});
$("ui-interface-icons")?.addEventListener("change", () => { $("ui-interface-icons")?.addEventListener("change", () => {
const control = $("ui-interface-icons"), previous = adminPreferences?.interface_icons === true, next = control.checked; const control = $("ui-interface-icons"), previous = adminPreferences?.interface_icons === true, next = control.checked;
applyAdminInterfaceIcons(next); if (adminPreferences) adminPreferences.interface_icons = next; applyAdminInterfaceIcons(next); if (adminPreferences) adminPreferences.interface_icons = next;
@@ -536,7 +551,7 @@ async function resetAppearancePatch(patch, control, messageKey = "appearanceSect
} }
document.querySelectorAll("[data-appearance-reset]").forEach(control => control.addEventListener("click", () => { document.querySelectorAll("[data-appearance-reset]").forEach(control => control.addEventListener("click", () => {
const patches = { const patches = {
interface: { theme: "dark", language: "auto", ui_scale: 100, time_format: "24h", interface_icons: false, logo_animation: false, stable_dialog_position: true, switch_controls: true, 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, switch_controls: true, button_style: "normal", corner_style: "default" }, charts: { chart_style: "default", chart_axes: false, chart_tooltips: 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 }, 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); void resetAppearancePatch(patches[control.dataset.appearanceReset] || {}, control);
+1 -1
View File
@@ -456,7 +456,7 @@ function renderNetworkInterfaceCharts(interfaces, appendSample) {
if (children.length !== target.children.length || children.some((node, index) => node !== target.children[index])) { if (children.length !== target.children.length || children.some((node, index) => node !== target.children[index])) {
target.replaceChildren(...children); target.replaceChildren(...children);
if (document.documentElement.dataset.chartAxes === "true") window.rustProxyChartScale.refreshAxes(); if (document.documentElement.dataset.chartAxes === "true" || document.documentElement.dataset.chartTooltips === "true") window.rustProxyChartScale.refreshAxes();
} }
} }
+66 -21
View File
@@ -169,6 +169,11 @@ html[data-theme=cream] :is(.card, .stat, dialog) {
gap: 2px; gap: 2px;
} }
/* Value tooltips without X/Y scales: keep the host for the crosshair only. */
.rp-chart-axis-off :is(.rp-chart-axis-y, .rp-chart-axis-x, .rp-chart-axis-series, .rp-chart-crosshair-h, .rp-chart-crosshair-y) {
display: none;
}
.rp-chart-crosshair { .rp-chart-crosshair {
position: absolute; position: absolute;
inset: 0; inset: 0;
@@ -203,9 +208,11 @@ html[data-theme=cream] :is(.card, .stat, dialog) {
border-top-width: 1px; border-top-width: 1px;
} }
.rp-chart-crosshair-y, .rp-chart-crosshair-y {
.rp-chart-crosshair-x {
position: absolute; position: absolute;
top: var(--rp-cross-y);
left: calc(var(--rp-cross-left) + 3px);
transform: translateY(-120%);
padding: 1px 4px; padding: 1px 4px;
border: 1px solid var(--line); border: 1px solid var(--line);
border-radius: min(3px, var(--rp-radius-control, 3px)); border-radius: min(3px, var(--rp-radius-control, 3px));
@@ -214,24 +221,62 @@ html[data-theme=cream] :is(.card, .stat, dialog) {
white-space: nowrap; white-space: nowrap;
} }
.rp-chart-crosshair-y { .rp-chart-crosshair-y[hidden] {
top: var(--rp-cross-y); display: none;
left: calc(var(--rp-cross-left) + 3px);
transform: translateY(-120%);
} }
.rp-chart-crosshair.is-low .rp-chart-crosshair-y { .rp-chart-crosshair-dots>i {
transform: translateY(20%); position: absolute;
width: 7px;
height: 7px;
margin: -3.5px 0 0 -3.5px;
border: 1px solid var(--panel);
border-radius: 50%;
} }
.rp-chart-crosshair-x { .rp-chart-tooltip {
top: calc(var(--rp-cross-top) + var(--rp-cross-height) - 2px); position: absolute;
left: var(--rp-cross-x); display: grid;
transform: translate(6px, -100%); gap: 2px;
min-width: 120px;
max-width: min(280px, 90%);
padding: 5px 7px;
border: 1px solid var(--line);
border-radius: min(6px, var(--rp-radius-surface, 6px));
background: color-mix(in srgb, var(--panel) 94%, transparent);
box-shadow: 0 4px 14px var(--shadow-mid);
color: var(--text);
font: 10px/1.35 var(--mono);
font-variant-numeric: tabular-nums;
} }
.rp-chart-crosshair.is-right .rp-chart-crosshair-x { .rp-chart-tooltip[hidden] {
transform: translate(calc(-100% - 6px), -100%); display: none;
}
.rp-chart-tooltip>b {
color: var(--muted);
font-weight: 500;
}
.rp-chart-tooltip>span {
display: grid;
grid-template-columns: 8px minmax(0, 1fr) auto;
align-items: center;
gap: 6px;
}
.rp-chart-tooltip>span>i {
width: 8px;
height: 3px;
border-radius: 2px;
}
.rp-chart-tooltip>span>span {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: var(--muted);
} }
.rp-chart-axis-series { .rp-chart-axis-series {
@@ -582,23 +627,23 @@ html[data-theme=cream] :is(.card, .stat, dialog) {
width: 12px; width: 12px;
height: 2px; height: 2px;
display: inline-block; display: inline-block;
background: var(--muted); background: var(--chart-septenary);
} }
.traffic-protocol-legend .legend-h1 i { .traffic-protocol-legend .legend-h1 i {
background: var(--accent); background: var(--chart-accent);
} }
.traffic-protocol-legend .legend-h2 i { .traffic-protocol-legend .legend-h2 i {
background: var(--green); background: var(--chart-secondary);
} }
.traffic-protocol-legend .legend-h3 i { .traffic-protocol-legend .legend-h3 i {
background: var(--blue); background: var(--chart-tertiary);
} }
.traffic-protocol-legend .legend-transform i { .traffic-protocol-legend .legend-transform i {
background: var(--transform-chart); background: var(--chart-quaternary);
} }
.traffic-protocol-legend b { .traffic-protocol-legend b {
@@ -1027,11 +1072,11 @@ html[data-dashboard-density=ultra] #panel-overview .stat-cache-outcomes .cache-m
} }
.connection-open-key { .connection-open-key {
color: var(--accent) !important; color: var(--chart-accent) !important;
} }
.connection-exchange-key { .connection-exchange-key {
color: var(--green) !important; color: var(--chart-secondary) !important;
} }
.dashboard-widget-setting-label { .dashboard-widget-setting-label {
+8 -4
View File
@@ -83,7 +83,8 @@
.appearance-logo-animation-setting, .appearance-logo-animation-setting,
.appearance-stable-dialog-position-setting, .appearance-stable-dialog-position-setting,
.appearance-switch-controls-setting, .appearance-switch-controls-setting,
.appearance-chart-axes-setting { .appearance-chart-axes-setting,
.appearance-chart-tooltips-setting {
align-self: center; align-self: center;
min-width: 0; min-width: 0;
} }
@@ -92,17 +93,20 @@
.appearance-logo-animation-setting>span, .appearance-logo-animation-setting>span,
.appearance-stable-dialog-position-setting>span, .appearance-stable-dialog-position-setting>span,
.appearance-switch-controls-setting>span, .appearance-switch-controls-setting>span,
.appearance-chart-axes-setting>span { .appearance-chart-axes-setting>span,
.appearance-chart-tooltips-setting>span {
display: grid; display: grid;
gap: 4px; gap: 4px;
min-width: 0; min-width: 0;
} }
.appearance-chart-axes-setting>span b { .appearance-chart-axes-setting>span b,
.appearance-chart-tooltips-setting>span b {
font-weight: 600; font-weight: 600;
} }
.appearance-chart-axes-setting>span small { .appearance-chart-axes-setting>span small,
.appearance-chart-tooltips-setting>span small {
color: var(--muted); color: var(--muted);
font-size: 10px; font-size: 10px;
line-height: 1.45; line-height: 1.45;
+17 -2
View File
@@ -487,11 +487,26 @@ html[data-dashboard-density] #panel-overview .dashboard-overview-grid>.card.pool
} }
.cache-queue-key { .cache-queue-key {
color: var(--blue); color: var(--chart-tertiary);
} }
.cache-io-key { .cache-io-key {
color: var(--transform-chart); color: var(--chart-quaternary);
}
/* Legend keys use the same chart palette variables as their lines, so they
still match when a chart style (for example colour-blind) is selected. */
.cache-hit-key,
.cache-fill-key {
color: var(--chart-secondary);
}
.cache-miss-key {
color: var(--chart-accent);
}
.cache-bypass-key {
color: var(--chart-tertiary);
} }
.config-history-dialog { .config-history-dialog {
+5
View File
@@ -2206,6 +2206,11 @@
charts</b><small data-i18n="chartAxesHelp">Keep automatic scaling; charts</b><small data-i18n="chartAxesHelp">Keep automatic scaling;
show Y values and sample indices on X (not elapsed show Y values and sample indices on X (not elapsed
time).</small></span></label> time).</small></span></label>
<label class="check appearance-chart-tooltips-setting"><input class="switch" id="ui-chart-tooltips"
type="checkbox" /><span><b data-i18n="chartTooltips">Show values on
hover</b><small data-i18n="chartTooltipsHelp">Pointing at a chart
shows a guide line at the nearest sample and every series'
value there.</small></span></label>
<div class="appearance-chart-preview" aria-hidden="true"> <div class="appearance-chart-preview" aria-hidden="true">
<svg viewBox="0 0 300 74" preserveAspectRatio="none"> <svg viewBox="0 0 300 74" preserveAspectRatio="none">
<path class="chart-grid" d="M0 18H300 M0 37H300 M0 56H300"></path> <path class="chart-grid" d="M0 18H300 M0 37H300 M0 56H300"></path>
+5
View File
@@ -89,6 +89,11 @@ assert 'html[data-stable-dialog-position="true"] dialog.vhost-dialog[open]' in e
assert openapi["components"]["schemas"]["AdminPreferences"]["properties"]["stable_dialog_position"]["default"] is True assert openapi["components"]["schemas"]["AdminPreferences"]["properties"]["stable_dialog_position"]["default"] is True
assert pl.get("stableDialogPosition") and pl.get("stableDialogPositionHelp") assert pl.get("stableDialogPosition") and pl.get("stableDialogPositionHelp")
assert "ui-switch-controls" in id_set, "Appearance must expose the switch controls toggle" assert "ui-switch-controls" in id_set, "Appearance must expose the switch controls toggle"
assert "ui-chart-tooltips" in id_set, "Appearance must expose the chart value tooltip toggle"
assert re.search(r"chart_tooltips:\s*false", preferences_js), "chart tooltips must default off in the panel"
assert "saveAppearancePreference({ chart_tooltips: next }" in preferences_js
assert openapi["components"]["schemas"]["AdminPreferences"]["properties"]["chart_tooltips"]["default"] is False
assert pl.get("chartTooltips") and pl.get("chartTooltipsHelp")
assert re.search(r"switch_controls:\s*true", preferences_js), "switch controls must default on in the panel" assert re.search(r"switch_controls:\s*true", preferences_js), "switch controls must default on in the panel"
assert "applyAdminSwitchControls(value.switch_controls)" in preferences_js assert "applyAdminSwitchControls(value.switch_controls)" in preferences_js
assert "saveAppearancePreference({ switch_controls: next }" in preferences_js assert "saveAppearancePreference({ switch_controls: next }" in preferences_js