mirror of
https://github.com/Kpa-clawbot/meshcore-analyzer.git
synced 2026-08-28 20:48:31 +00:00
Closes #1108 ## What When an operator selects a region on the Live map, default to **hiding** nodes outside that region. The operator picked the region for a reason — far-away markers are visual noise. Operators who want the legacy show-everything behavior can flip the new **Show all nodes** checkbox next to the region dropdown. Default: **off (hide non-region nodes)**. State persists in `localStorage['mc-region-show-all-nodes']`. ## Why Tracks the request in #1108 — region filtering currently scopes packet feeds + metrics but the map keeps every node visible, which defeats the point of selecting a region in the first place. ## How - `public/region-filter.js`: new `RegionShowAll` module (`get` / `set` / `onChange` / `STORAGE_KEY`) plus `RegionFilter.nodesRegionQueryString()` — returns `®ion=…` only when a region is selected **and** showAll is off. Other surfaces (packets, metrics) continue to use the unconditional `regionQueryString()`. - `public/live.js`: `loadNodes()` appends `nodesRegionQueryString()`; region-change and showAll-change handlers reload nodes so markers update immediately. - `public/live.css`: aligns the new toggle with the existing `.live-toggles` rhythm. - `test-1108-region-hide-nodes.js`: 7 unit assertions covering default-off, persistence across reloads, set/get, and the conditional query-string builder. ## TDD trail - `dbf6d6db` — red test commit (assertion failures, helpers do not exist yet) - `eefa1185` — green commit (helpers + wiring) ## CDP validation (staging, after hot-deploy) | state | markers | | --- | --- | | no region | 517 | | region=SJC, showAll=off | **497** (region-scoped) | | region=SJC, showAll=on | 517 (legacy behavior) | Toggle state survives reload (`RegionShowAll.get() === true` after refresh). ## Out of scope - Static `/map` page (`public/map.js`) — its region UI is jump-buttons, not the shared `RegionFilter` selector. A follow-up could wire `nodesRegionQueryString` there too, but it's a separate UX surface. --------- Co-authored-by: openclaw-bot <bot@openclaw.local>