dashboard: trim comment bloat in tabs.js + swarm.js
Per mara's guidance on hyperhive#3901 (target ~15% comment density overall, less where obvious, more where not; prefer docs for abstract/general topics; don't restate facts in multiple places; don't document history). tabs.js: removed 4 pure "X now lives in Y" / "moved to Z" historical asides (the underlying facts are already documented in docs/web-ui/dashboard.md, not lost by removing the floating in-code aside) and merged one comment block that had drifted into restating the same fact twice (one ticker feeding two live displays, documented as if it were two separate tickers). swarm.js: cut a comment narrating the removal history of two features that no longer exist in the code (a per-agent queued-badge and a client-side jobq tally), keeping only the design constraint still in force (why the jobq-derived state here is deliberately narrow); cut a comment documenting a removed CSS class's history down to a statement of the current class's purpose; cut a comment restating the jobq-rollup rendering rationale already stated once, above, down to a one-line pointer; trimmed a "legacy flat layout is bit-identical" history clause down to what the depth-0 case actually renders.
This commit is contained in:
parent
9749e9324d
commit
08f4f60106
2 changed files with 17 additions and 54 deletions
|
|
@ -89,15 +89,11 @@ window.marked = marked;
|
|||
// opts out via `data-no-refresh` (its mutation arrives via an SSE event).
|
||||
bindAsyncForms(() => refreshState());
|
||||
|
||||
// Live ticker for approval request-age chips. Approval cards only
|
||||
// re-render on `approval_added`/`approval_resolved` SSE events, so
|
||||
// a request pending for an hour could still show "0s ago" without
|
||||
// this ticker. Also flips `.stale` (amber highlight) at exactly 1h
|
||||
// rather than only at the next re-render.
|
||||
// Live countdown for schedule next-fire cells. Renderers stamp
|
||||
// `data-due-at` on `.sched-due` elements so this single ticker keeps
|
||||
// them fresh without triggering a full re-render. Also keeps
|
||||
// `.approval-ts` stale-highlight fresh at the 1h boundary.
|
||||
// One ticker feeds two live displays that would otherwise only
|
||||
// update on the next SSE-triggered re-render: approval request-age
|
||||
// chips (`.approval-ts`, flips `.stale` at the 1h mark) and schedule
|
||||
// next-fire countdowns (`.sched-due`, stamped with `data-due-at` by
|
||||
// the renderers so this loop can refresh them without a full re-render).
|
||||
setInterval(() => {
|
||||
const now = Math.floor(Date.now() / 1000);
|
||||
document.querySelectorAll('.approval-ts[data-requested-at]').forEach((node) => {
|
||||
|
|
@ -188,8 +184,6 @@ window.marked = marked;
|
|||
// names from here instead of refetching on every keystroke).
|
||||
window.__hyperhive_state = s;
|
||||
renderServerWarnings(s.server_warnings);
|
||||
// (The M4TR1X surface is reachable directly at /matrix/ when enabled
|
||||
// — no link in the dashboard tab strip or the H0M3 hub.)
|
||||
// Hive identity: render the swarm/hive name as a headline at the
|
||||
// top of the SW4RM pane + update the page title once the
|
||||
// server-side display names are known. `hive_name` / `swarm_name`
|
||||
|
|
@ -228,8 +222,6 @@ window.marked = marked;
|
|||
// Sync the derived approvals store from the snapshot, then
|
||||
// render. Live `*_added` / `*_resolved` events mutate the store
|
||||
// directly and re-render without a snapshot refetch.
|
||||
// (renderInbox now lives in ./flow.js — dashboard has no
|
||||
// #inbox-section element to render into.)
|
||||
syncApprovalsFromSnapshot(s);
|
||||
renderApprovals();
|
||||
refreshSchedules();
|
||||
|
|
@ -289,8 +281,6 @@ window.marked = marked;
|
|||
transient_cleared: applyTransientCleared,
|
||||
container_state_changed: applyContainerStateChanged,
|
||||
container_removed: applyContainerRemoved,
|
||||
// tombstones_changed / meta_inputs_changed / meta_update_running are
|
||||
// handled on /core.html now (the SYST3M panels moved there).
|
||||
// rebuild_queue_changed: refreshes the SW4RM queue-summary banner
|
||||
// (see swarm.js) — a payload-less push trigger, same treatment
|
||||
// /builds.html gives it for its JobqGraph mount handle's .refresh()
|
||||
|
|
@ -383,11 +373,6 @@ window.marked = marked;
|
|||
if (target === 'call') { refreshOperatorInbox(); }
|
||||
}
|
||||
|
||||
// ST4TS (hive-wide turn-stats rollup) moved to its own page,
|
||||
// `/stats.html` — the render JS + the window selector live in
|
||||
// stats.js now. The dashboard no longer fetches
|
||||
// /api/stats-hive.
|
||||
|
||||
// Wire the shared tab strip now that activateTab + the lazy-load fns it
|
||||
// calls are defined. The strip resolves the active tab from the hash
|
||||
// (default SW4RM), toggles the active tab/pane + aria-selected, and
|
||||
|
|
@ -404,10 +389,6 @@ window.marked = marked;
|
|||
// 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.
|
||||
// The operator inbox (unread agent->operator messages) now lives in
|
||||
// call.js — `refreshOperatorInbox`, `operatorInboxAppendFromEvent`, and
|
||||
// `operatorInboxCount` are imported above. It calls back through the
|
||||
// `onCountsChanged` callback registered via `initCall` at boot.
|
||||
|
||||
function setTabCount(tab, n) {
|
||||
const el_ = $('tab-count-' + tab);
|
||||
|
|
|
|||
Loading…
Reference in a new issue