hive ui: remove the counters on the tabs
The pills on 4G3NTS, R3BU1LD QU3U3 and K3PT ST4T3, the poll that fed them, the two count helpers, their styles, and the tab strip's unused badge option.
This commit is contained in:
parent
46001be283
commit
a781addcfe
1 changed files with 7 additions and 93 deletions
|
|
@ -28,11 +28,9 @@ import {
|
|||
initBuilds,
|
||||
onBuildsTabShown,
|
||||
onRebuildQueueChanged,
|
||||
rebuildCount,
|
||||
} from "./builds.js";
|
||||
import {
|
||||
applyTombstonesChanged,
|
||||
keptCount,
|
||||
renderKept,
|
||||
syncKeptFromSnapshot,
|
||||
} from "./kept.js";
|
||||
|
|
@ -286,41 +284,6 @@ import { renderUserMenu } from "./user-menu.js";
|
|||
// (default 4G3NTS), toggles the active tab/pane + aria-selected, and
|
||||
// fires activateTab for the per-tab side-effects on every change.
|
||||
createTabStrip($("tabbar"), { defaultId: "agents", onShow: activateTab });
|
||||
// The rebuild queue mounts now, not on first show, so its tab's count pill
|
||||
// is live from the start.
|
||||
// The rebuild queue mounts now, not on first show.
|
||||
initBuilds();
|
||||
|
||||
// Tab count pills — pure derived data from the existing state
|
||||
// stores so SSE-driven updates flow through without extra plumbing.
|
||||
// Set `hidden` when the count is zero so the pill doesn't draw
|
||||
// attention to an empty room.
|
||||
|
||||
function setTabCount(tab, n) {
|
||||
const el_ = $("tab-count-" + tab);
|
||||
if (!el_) return;
|
||||
el_.textContent = String(n);
|
||||
el_.hidden = n <= 0;
|
||||
}
|
||||
/** Recompute every tab's count from the current state. Called on
|
||||
* every renderXxx that's tab-relevant. */
|
||||
function refreshTabCounts() {
|
||||
// 4G3NTS — flag any container that's stale (needs_update). Empty
|
||||
// when everyone's current. Container-row pulse signals state
|
||||
// transitions; the pill catches "deploy-pending" specifically.
|
||||
let stale = 0;
|
||||
for (const c of containersState.values()) {
|
||||
if (c.needs_update) stale++;
|
||||
}
|
||||
setTabCount("agents", stale);
|
||||
// R3BU1LD QU3U3 — rebuilds in flight.
|
||||
setTabCount("rebuild", rebuildCount());
|
||||
// K3PT ST4T3 — entries of kept state.
|
||||
setTabCount("kept", keptCount());
|
||||
}
|
||||
// Poll the state stores on a 1s tick to keep the pill counts in
|
||||
// sync. The state stores are mutated synchronously by every SSE
|
||||
// event + refreshState call, so polling them is correct and cheap
|
||||
// — no per-renderer hookup needed.
|
||||
refreshTabCounts();
|
||||
setInterval(refreshTabCounts, 1000);
|
||||
})();
|
||||
|
|
|
|||
Loading…
Reference in a new issue