This commit is contained in:
Mateusz Gruszczyński committed 2026-10-13 00:57:19 +02:00
1 parent 81ab39e70a
commit 101df02a5f
45 files changed
+1148 -2277

No files matched your search

+1 -8
View File
@@ -1,5 +1,4 @@
// Four opt-in cards in the EXISTING dashboard widget order and status refresh.
// No timers, fetches, or independent persistence are created here.
window.rustProxyStreamDashboard = (() => {
const ids = ["stream_overview", "stream_traffic", "stream_sessions", "stream_backend_health"];
const history = { last: null, rx: [], tx: [] };
@@ -18,8 +17,6 @@ window.rustProxyStreamDashboard = (() => {
function syncVisibility(hiddenOverride = null) {
const prefs = window.rustProxyPreferences?.current?.();
const hidden = new Set(hiddenOverride ?? prefs?.dashboard_hidden_widgets ?? ADMIN_APPEARANCE_DEFAULTS.dashboard_hidden_widgets);
// Visibility belongs exclusively to Appearance. An absent, disabled or
// restart-pending Stream must not silently override an explicit opt-in.
for (const id of ids) if (card(id)) card(id).hidden = hidden.has(id);
if (card("stream_traffic")?.hidden && wasVisible) clearTraffic();
wasVisible = !card("stream_traffic")?.hidden;
@@ -35,8 +32,6 @@ window.rustProxyStreamDashboard = (() => {
const active = (status?.streams?.active || []).filter(item => item.enabled !== false);
const metrics = status?.streams?.metrics || {};
if (!configured.some(item => item.enabled !== false) && !active.length) {
// A deliberately shown tile has a neutral empty state, not a
// hidden DOM node. No history is sampled without running streams.
for (const name of ["overview", "sessions", "health", "traffic"]) {
if (!card(({ overview: "stream_overview", sessions: "stream_sessions", health: "stream_backend_health", traffic: "stream_traffic" })[name])?.hidden) {
set(`stream-dashboard-${name}`, "-");
@@ -79,8 +74,6 @@ window.rustProxyStreamDashboard = (() => {
trafficRates("-", "-");
return;
}
// Switching tabs or appearance preferences paints cached numbers without
// generating an extra rate sample from the same status response.
if (!recordTrafficSample) {
if (history.rx.length) {
const rx = history.rx.at(-1), tx = history.tx.at(-1);