Topology: power map, what each outlet feeds #40
Open
jared
wants to merge 1 commits from
power-map into main
pull from: power-map
merge into: :main
:main
:pr-40-screenshots
:power-map
:pr-39-screenshots
:topology
:pr-37-screenshots
:stale-alerts
:pr-36-screenshots
:wan-incidents
:pr-35-screenshots
:unused-interfaces
:pr-32-screenshots
:loose-gear-on-top
:tinker-create-action
:revert-31
:stale-interface-alerts
:zimaboard-and-facing
:pr-30-screenshots
:pr-29-screenshots
:pro-max-faceplates
:rack-unlinked-port-clicks
:pr-27-screenshots
:rack-drawn-fronts
:rack-panel-label
:pr-25-screenshots
:rack-rear-and-settings
:pr-24-screenshots
:racks-shelves-export
:pr-23-screenshots
:rack-view
:pr-22-screenshots
:inventory-and-faceplate-marks
:pr-21-screenshots
:events-history
:ticket-recovery-and-context
:pr-18-screenshots
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
This is part 2 of the topology page (part 1 was #39). It shows what each PDU, UPS and power strip outlet feeds, with live watts, and lets admins correct it.
What's on the page
How an outlet is matched, in order
host_macs, added in part 1) and UniFi device MACs.Generic names like "Outlet 7" and "USB Outlet 1" match nothing. Gandalf never renames anything in UniFi.
On today's prod data, this matches six RPDU outlets automatically:
Four outlets draw power without a name (7, 8, 19 and 20), and UPS outlet 1 draws 551 W unnamed (presumably the RPDU). These show as unassigned, ready to be set.
Editing (admins)
PUT /api/topology/power/<device>/<outlet>with{"target": "<device>" | "" | null}.Code
db.py: a newpower_feedstable, created on first use with the cutsheet tables, so no migration step is needed. Alsoget_power_feeds()andset_power_feed(), whereNonedeletes the row and goes back to automatic.topology.py:build_power()._named_device(), now shared withname_mismatch.build_graphreturnspowerand each node'spower_in.app.py:PUT /api/topology/power/..../api/topologynow passes saved feeds, and the page knows whether the viewer can edit.static/topology.js: outlet rows, badges, hover feeds, the editor, and the off-outlet problem. Power gear is shown by default again.Tests
TestPower(6 tests) covers:power_inTestPowerFeedApi(6 tests) covers:TestPowerFeedsintest_db.py(3 tests).Screenshots
These come from prod-shaped data, with anonymised addresses. The problem view has simulated assignments and outlet 19 switched off.
🤖 Generated with Claude Code
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.