Device pages: show the hardware for hosts, the modem and the AP #63

Merged
jared merged 1 commits from device-hardware-visuals into main 2026-11-25 13:53:38 -05:00
Owner

Closes #62

What changes

  • Host pages now show the same drawing as the rack page, taken from the host's cutsheet item and its Front drawing setting.
    • Sliger fronts show the power light in the host's live status colour.
    • ZimaBoard drawings light each NIC from its live state, so monitor-01's enp3s0 shows dark.
  • Location: the drawing header shows where the host sits and links to the rack page, e.g. "U5-U8, full depth" or "Rear shelf (U22-U23), slot 1". The Overview section lists the location too.
  • Modem and AP pages use the topology page's drawings. Those drawings moved into fronts.js (modemFront, apFront), and the topology page now uses those shared versions.
  • No-drawing case: a host with no cutsheet item or no Front drawing (pbs, compute-storage-02 today) shows no picture, the same as before.
  • Unchanged: switch, router and PDU pages keep their live faceplate.

Backend

  • cutsheet.item_for_device and cutsheet.location_text, both pure functions with tests.
  • /api/device/<name> gains hardware: {item, item_id, chassis, location, rack_url, interfaces}, or null when there is no item.
  • The cutsheet is now loaded once per device request instead of once per field.

Verification

  • 655 tests pass. flake8, bandit -ll and eslint are clean; the only eslint warnings are the existing ones in the vendored base.js.
  • No em or en dashes.
  • Ran the app locally against a copy of prod's state and cutsheet. Screenshots were taken in desktop dark, desktop light and phone (390px) for monitor-01, storage-01, att-modem, AP, pbs and 24RJ45-POE:
    • no page-level horizontal scroll
    • no page script errors
    • /topology still draws the modem and AP

🤖 Generated with Claude Code

Closes #62 ## What changes - **Host pages** now show the same drawing as the rack page, taken from the host's cutsheet item and its *Front drawing* setting. - Sliger fronts show the power light in the host's live status colour. - ZimaBoard drawings light each NIC from its live state, so monitor-01's enp3s0 shows dark. - **Location:** the drawing header shows where the host sits and links to the rack page, e.g. "U5-U8, full depth" or "Rear shelf (U22-U23), slot 1". The Overview section lists the location too. - **Modem and AP pages** use the topology page's drawings. Those drawings moved into `fronts.js` (`modemFront`, `apFront`), and the topology page now uses those shared versions. - **No-drawing case:** a host with no cutsheet item or no Front drawing (pbs, compute-storage-02 today) shows no picture, the same as before. - **Unchanged:** switch, router and PDU pages keep their live faceplate. ## Backend - `cutsheet.item_for_device` and `cutsheet.location_text`, both pure functions with tests. - `/api/device/<name>` gains `hardware: {item, item_id, chassis, location, rack_url, interfaces}`, or `null` when there is no item. - The cutsheet is now loaded once per device request instead of once per field. ## Verification - 655 tests pass. flake8, bandit `-ll` and eslint are clean; the only eslint warnings are the existing ones in the vendored `base.js`. - No em or en dashes. - Ran the app locally against a copy of prod's state and cutsheet. Screenshots were taken in desktop dark, desktop light and phone (390px) for monitor-01, storage-01, att-modem, AP, pbs and 24RJ45-POE: - no page-level horizontal scroll - no page script errors - /topology still draws the modem and AP 🤖 Generated with [Claude Code](https://claude.com/claude-code)
jared added 1 commit 2026-11-25 13:51:26 -05:00
Device pages: show the hardware for hosts, the modem and the AP
Lint / JS (eslint) (push) Successful in 26s
Lint / Python (flake8) (push) Successful in 1m49s
Lint / Notify on failure (push) Skipped
Lint / Deploy (push) Skipped
Security / Python Security (bandit) (push) Successful in 1m43s
Test / Python Tests (pytest) (push) Successful in 1m27s
Lint / Python (flake8) (pull_request) Successful in 1m6s
Lint / JS (eslint) (pull_request) Successful in 33s
Lint / Notify on failure (pull_request) Skipped
Lint / Deploy (pull_request) Skipped
Security / Python Security (bandit) (pull_request) Successful in 2m34s
Test / Python Tests (pytest) (pull_request) Successful in 1m46s
dd6d86b068
A host's page now draws the same front the rack page shows, from its
cutsheet item's Front drawing (ZimaBoard NIC lights follow its live
interfaces), with its rack location linking to the rack page. The modem
and AP pages use the topology drawings, now shared from fronts.js.

Closes #62

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
Owner

Screenshots from a local run against a copy of prod's state and cutsheet:

monitor-01 (desktop, dark): the ZimaBoard drawing shows enp3s0 dark, which matches the missing cable. The location links to the rack page.
monitor-01

storage-01 (desktop, light)
storage-01

att-modem and AP (desktop, dark)
modem
AP

Phone (390px)
monitor-01 phone
storage-01 phone

Screenshots from a local run against a copy of prod's state and cutsheet: **monitor-01** (desktop, dark): the ZimaBoard drawing shows enp3s0 dark, which matches the missing cable. The location links to the rack page. ![monitor-01](https://code.lotusguild.org/LotusGuild/gandalf/raw/branch/pr-63-screenshots/desk-dark-monitor-01.png) **storage-01** (desktop, light) ![storage-01](https://code.lotusguild.org/LotusGuild/gandalf/raw/branch/pr-63-screenshots/desk-light-storage-01.png) **att-modem** and **AP** (desktop, dark) ![modem](https://code.lotusguild.org/LotusGuild/gandalf/raw/branch/pr-63-screenshots/desk-dark-att-modem.png) ![AP](https://code.lotusguild.org/LotusGuild/gandalf/raw/branch/pr-63-screenshots/desk-dark-AP.png) **Phone (390px)** ![monitor-01 phone](https://code.lotusguild.org/LotusGuild/gandalf/raw/branch/pr-63-screenshots/phone-monitor-01.png) ![storage-01 phone](https://code.lotusguild.org/LotusGuild/gandalf/raw/branch/pr-63-screenshots/phone-storage-01.png)
jared scheduled this pull request to auto merge when all checks succeed 2026-11-25 13:53:37 -05:00
jared merged commit f636d29c9f into main 2026-11-25 13:53:38 -05:00
jared deleted branch device-hardware-visuals 2026-11-25 13:53:44 -05:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: LotusGuild/gandalf#63