v0.33.2
This commit is contained in:
1 parent
b757b34a31
commit
5a36bb0c4b
20 files changed
+356
-186
No files matched your search
@@ -18,6 +18,7 @@ window.rustProxyBackendDashboard = (() => {
|
||||
}
|
||||
function syncVisibility(hiddenOverride = null) {
|
||||
const prefs = window.rustProxyPreferences?.current?.();
|
||||
// While unlocked, currentDraft is authoritative until Save or Cancel.
|
||||
const hidden = new Set(hiddenOverride ?? window.rustProxyInlineLayout?.currentDraft?.()?.hidden
|
||||
?? prefs?.dashboard_hidden_widgets ?? ADMIN_APPEARANCE_DEFAULTS.dashboard_hidden_widgets);
|
||||
for (const id of ids) if (card(id)) card(id).hidden = hidden.has(id);
|
||||
@@ -49,7 +50,8 @@ window.rustProxyBackendDashboard = (() => {
|
||||
window.rustProxyExtraOverview?.meter?.("backend-dashboard-capacity", null);
|
||||
reset();
|
||||
}
|
||||
|
||||
// Counter deltas are matched to stable (pool, member) IDs, not aggregate
|
||||
// totals: removed/rebuilt pools must never become negative or spike rates.
|
||||
function memberCounters(members) {
|
||||
const values = new Map();
|
||||
for (const { pool, member } of members) {
|
||||
@@ -71,6 +73,7 @@ window.rustProxyBackendDashboard = (() => {
|
||||
for (const [id, next] of current) {
|
||||
const old = earlier.get(id);
|
||||
if (!old) continue;
|
||||
// A generation reset on a member invalidates its entire interval.
|
||||
if (tracked.some(field => next[field] < old[field])) continue;
|
||||
for (const field of tracked) total[field] += next[field] - old[field];
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
|
||||
// Opt-in compact metrics and bounded visualizations. All readings reuse the
|
||||
// existing Overview live-status payload (no additional requests or timers).
|
||||
window.rustProxyExtraOverview = (() => {
|
||||
const limit = () => window.rustProxyOverviewSamples?.getLimit?.() ?? 60;
|
||||
const names = [
|
||||
@@ -150,6 +151,7 @@ window.rustProxyExtraOverview = (() => {
|
||||
for (const id of names) {
|
||||
const tile = node(id);
|
||||
if (!tile) { lastCounter.delete(id); continue; }
|
||||
// Visibility is only a presentation concern; retain live history.
|
||||
const metric = read(id, status, now, record);
|
||||
const value = metric.value;
|
||||
if (lastUnits.get(id) !== metric.unit) {
|
||||
|
||||
@@ -85,7 +85,7 @@ window.rustProxyWideOverview = (() => {
|
||||
for (const [id, config] of Object.entries(configurations)) {
|
||||
const node = tile(id);
|
||||
if (!node) { baselines.delete(id); continue; }
|
||||
|
||||
// Keep collecting while hidden so restoring a widget does not restart rates.
|
||||
const values = config.counters ? counterRates(id, config.counters(status), now, record)
|
||||
: config.values(status).map(finite);
|
||||
const series = history.get(id) || config.names.map(() => []);
|
||||
|
||||
@@ -319,8 +319,20 @@ function renderDiagnostics(status, appendSample = true, systemSample = appendSam
|
||||
$("system-source").hidden = !sourceSupported; if (sourceSupported) $("system-source").textContent = t("realSample");
|
||||
const systemMemory = knownPair(d.memory_used_bytes, d.memory_total_bytes, value => fmtBytes(value));
|
||||
setOptionalMetric("system-memory", systemMemory != null, systemMemory);
|
||||
$("memory-meter").hidden = systemMemory == null;
|
||||
if (d.memory_used_bytes != null && d.memory_total_bytes > 0) $("memory-meter").value = d.memory_used_bytes / d.memory_total_bytes * 100; else $("memory-meter").removeAttribute("value");
|
||||
const ramMeter = $("memory-meter"), ramFill = $("memory-meter-fill");
|
||||
ramMeter.hidden = systemMemory == null;
|
||||
const ramUsed = Number(d.memory_used_bytes), ramTotal = Number(d.memory_total_bytes);
|
||||
const ramPercent = d.memory_used_bytes != null && d.memory_total_bytes != null &&
|
||||
Number.isFinite(ramUsed) && Number.isFinite(ramTotal) && ramTotal > 0
|
||||
? Math.max(0, Math.min(100, ramUsed / ramTotal * 100)) : null;
|
||||
ramFill.style.width = `${ramPercent ?? 0}%`;
|
||||
if (ramPercent == null) {
|
||||
ramMeter.removeAttribute("aria-valuenow");
|
||||
ramMeter.setAttribute("aria-valuetext", "-");
|
||||
} else {
|
||||
ramMeter.setAttribute("aria-valuenow", String(ramPercent));
|
||||
ramMeter.setAttribute("aria-valuetext", `${fmt(ramPercent, 1)}%`);
|
||||
}
|
||||
const systemSwap = knownPair(d.system_swap_used_bytes, d.system_swap_total_bytes, value => fmtBytes(value));
|
||||
setOptionalMetric("system-swap", systemSwap != null, systemSwap);
|
||||
const loadSupported = Array.isArray(d.load_average) && d.load_average.length > 0;
|
||||
|
||||
@@ -16,6 +16,7 @@ window.rustProxyStreamDashboard = (() => {
|
||||
}
|
||||
function syncVisibility(hiddenOverride = null) {
|
||||
const prefs = window.rustProxyPreferences?.current?.();
|
||||
// While unlocked, currentDraft is authoritative until Save or Cancel.
|
||||
const hidden = new Set(hiddenOverride ?? window.rustProxyInlineLayout?.currentDraft?.()?.hidden
|
||||
?? prefs?.dashboard_hidden_widgets ?? ADMIN_APPEARANCE_DEFAULTS.dashboard_hidden_widgets);
|
||||
for (const id of ids) if (card(id)) card(id).hidden = hidden.has(id);
|
||||
|
||||
Reference in new issue
Block a user