This commit is contained in:
Mateusz Gruszczyński committed 2026-10-15 16:15:49 +02:00
1 parent 5dd802ae83
commit a286355b0e
22 files changed
+447 -70

No files matched your search

+6 -5
View File
@@ -134,10 +134,10 @@ window.rustProxyExtraOverview = (() => {
if (unit === "rate") return `${fmt(value, 1)}/s`;
return fmt(value);
}
function points(history, unit) {
function points(id, history, unit) {
if (!history.length) return "0,55 300,55";
const peak = unit === "percent" ? Math.max(100, ...history) : Math.max(1, ...history);
return history.map((v, i) => `${i * 300 / Math.max(1, history.length - 1)},${55 - v / peak * 50}`).join(" ");
const peak = window.rustProxyChartScale.peak(`extra:${id}`, unit, [history]);
return history.map((v, i) => `${i * 300 / Math.max(1, history.length - 1)},${55 - Math.min(v, peak) / peak * 50}`).join(" ");
}
function render(status, record = true) {
if (!status || currentPanel !== "overview") return;
@@ -150,6 +150,7 @@ window.rustProxyExtraOverview = (() => {
const value = metric.value;
if (lastUnits.get(id) !== metric.unit) {
histories.delete(id);
window.rustProxyChartScale.reset(`extra:${id}`);
lastUnits.set(id, metric.unit);
}
if (!bounded.has(id) && id !== "extra_cache_hit_rate") {
@@ -159,7 +160,7 @@ window.rustProxyExtraOverview = (() => {
if (history.length > limit()) history.shift();
histories.set(id, history);
}
$(`overview-extra-${id}-line`)?.setAttribute("points", points(history, metric.unit));
$(`overview-extra-${id}-line`)?.setAttribute("points", points(id, history, metric.unit));
}
if (record) {
lastValue.set(id, value);
@@ -177,7 +178,7 @@ window.rustProxyExtraOverview = (() => {
if (detail && id !== "extra_cache_hit_rate") detail.textContent = metric.detail || t("overviewExtraRecentSamples");
}
}
function reset() { histories.clear(); lastCounter.clear(); lastValue.clear(); lastUnits.clear(); lastSegments.clear(); }
function reset() { histories.clear(); lastCounter.clear(); lastValue.clear(); lastUnits.clear(); lastSegments.clear(); window.rustProxyChartScale.reset("extra:"); }
window.rustProxyOverviewSamples?.onChange?.(() => {
for (const history of histories.values()) window.rustProxyOverviewSamples.trim(history);
if (typeof latestStatus !== "undefined" && latestStatus && currentPanel === "overview") render(latestStatus, false);