Repository navigation
feat(ports): mark the management port in the chassis - #550
Merged
Merged
Conversation
The chassis view treated every port the same, but the port the panel itself is reached through is the risky one to touch with mirror, rate limit or STP changes. The mirror probe already deduced it (gateway -> ARP -> bridge FDB) but fetching the whole mirror probe for a badge is too heavy (a tc filter show per port). Add a lightweight GET /api/management-port that runs only the heuristic (two /proc reads plus one brctl showmacs) and load it lazily from the chassis after the first paint: the matching tile gets a lock badge in the corner opposite the PoE one, the tooltip names it and the legend gains an entry. Undetected or missing probe: no badge, the chassis renders exactly as before. Demo mode stubs an empty port. Verified end-to-end on a 52-port Linksys LGS352C: the endpoint returns lan27 (the real uplink), the badge lands on the LAN 27 tile and the legend shows, with zero page errors. Closes #543
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The chassis view treats every port the same, but the port the panel itself is reached through is the risky one to touch with mirror, rate limit or STP changes. The mirror probe already deduces it (default gateway -> ARP -> bridge FDB, as
management_port), but fetching the whole mirror probe just for a badge is too heavy: it runs atc filter showper port.Approach
A lightweight
GET /api/management-portruns only the heuristic (two /proc reads plus onebrctl showmacs). The chassis fetches it lazily after the first paint, so detection latency on dense switches never delays the initial render. The matching tile gets a lock badge in the corner opposite the PoE one, the tooltip names the port and the chassis legend gains an entry. When the port cannot be deduced, or the probe is missing, there is no badge and the chassis renders exactly as before. Demo mode stubs an empty port.Verification
End-to-end on a live 52-port Linksys LGS352C (OpenWrt, mips): the endpoint returns
lan27, the real uplink. A headless browser session confirms the lock badge lands on the LAN 27 tile, the legend shows "Puerto de gestión", and there are zero page errors.go vet, the full Go test suite and the TypeScript + Vite build are green.