Draw realistic front panels for every device model
Lint / JS (eslint) (push) Successful in 10s
Lint / Python (flake8) (push) Successful in 57s
Lint / Notify on failure (push) Skipped
Lint / Deploy (push) Skipped
Security / Python Security (bandit) (push) Successful in 1m7s
Lint / Python (flake8) (pull_request) Successful in 59s
Test / Python Tests (pytest) (push) Successful in 1m22s
Lint / JS (eslint) (pull_request) Successful in 11s
Lint / Notify on failure (pull_request) Skipped
Lint / Deploy (pull_request) Skipped
Security / Python Security (bandit) (pull_request) Successful in 1m7s
Test / Python Tests (pytest) (pull_request) Successful in 1m28s
Lint / JS (eslint) (push) Successful in 10s
Lint / Python (flake8) (push) Successful in 57s
Lint / Notify on failure (push) Skipped
Lint / Deploy (push) Skipped
Security / Python Security (bandit) (push) Successful in 1m7s
Lint / Python (flake8) (pull_request) Successful in 59s
Test / Python Tests (pytest) (push) Successful in 1m22s
Lint / JS (eslint) (pull_request) Successful in 11s
Lint / Notify on failure (pull_request) Skipped
Lint / Deploy (pull_request) Skipped
Security / Python Security (bandit) (pull_request) Successful in 1m7s
Test / Python Tests (pytest) (pull_request) Successful in 1m28s
Replace the port blocks on device pages with SVG faceplates traced from reference images: Dream Machine Pro, USW Pro 24 PoE, USW Aggregation, USW Flex, USW Flex Mini, USP PDU Pro and UPS 2U Pro. Port LEDs use each model's documented colors, and ports show a cable or module when up. Remove SWITCH_LAYOUTS, which had wrong data: the aggregation switch was numbered across the rows instead of odd over even, and the USW Flex had an SFP cage it doesn't have. Models without a faceplate use plain blocks. Show PDU and UPS outlets with on/off state and auto power-cycle, and let the UPS page show its panel even though it reports no ports. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d6263049ef
commit
051e70b82b
7 files changed
+750
-117
No files matched your search
@@ -136,8 +136,8 @@ sees but `config.json` doesn't list still get a page, with their state shown as
|
||||
they aren't alerted on.
|
||||
|
||||
### Port inspector (on switch and router device pages)
|
||||
A model-accurate front panel, drawn from the layout config in `static/port-inspector.js`
|
||||
(`SWITCH_LAYOUTS`). `/inspector` now redirects to the dashboard. Link to a port with `/device/<name>#port-<n>`.
|
||||
A realistic front panel, drawn as SVG from the model's real geometry in `static/faceplates.js`
|
||||
(`FACEPLATES`). `/inspector` now redirects to the dashboard. Link to a port with `/device/<name>#port-<n>`.
|
||||
|
||||
**Port block colours:**
|
||||
| Colour | State |
|
||||
@@ -168,19 +168,20 @@ neighbors that can't be matched show their MAC. Bonded NICs share a MAC, so only
|
||||
2. The Pulse worker can SSH to the server
|
||||
3. Optional: `lldpd` on the server lets diagnostics confirm the cabling from the server's side
|
||||
|
||||
**Supported switch models** (set `SWITCH_LAYOUTS` keys to your UniFi model codes):
|
||||
**Supported models** (keys are UniFi model codes):
|
||||
|
||||
| Key | Model | Layout |
|
||||
| Key | Model | Front panel |
|
||||
|---|---|---|
|
||||
| `USF5P` | UniFi Switch Flex 5 PoE | 4×RJ45 + 1×SFP uplink |
|
||||
| `USL8A` | UniFi Switch Lite 8 PoE | 8×SFP (2 rows of 4) |
|
||||
| `US24PRO` | UniFi Switch Pro 24 | 24×RJ45 staggered + 2×SFP |
|
||||
| `USPPDUP` | Custom/other | Single-port fallback |
|
||||
| `UDMPRO` | Dream Machine Pro | 9×RJ45 + 2×SFP+ |
|
||||
| `USMINI` | UniFi Switch Mini | 5-port row |
|
||||
| `UDMPRO` | Dream Machine Pro | 8×RJ45 LAN, RJ45 WAN, SFP+ WAN, SFP+ LAN, screen, drive bay |
|
||||
| `US24PRO` | USW Pro 24 PoE | 24×RJ45 in two blocks of 12, 2×SFP+ |
|
||||
| `USL8A` | USW Aggregation | 8×SFP+ in four stacked pairs |
|
||||
| `USF5P` | USW Flex | 5×RJ45, PoE in on port 1, PoE out on 2-5 |
|
||||
| `USMINI` | USW Flex Mini | 5×RJ45, PoE in on port 1 |
|
||||
| `USPPDUP` | USP PDU Pro | 20 outlets (4 USB-C, 16 AC), management port 21, surge pass-through ports 22-23 |
|
||||
| `USPDA2B` | UPS 2U Pro | Front with touchscreen outlet tiles; rear with 8 outlets, EPO, surge and MGMT ports |
|
||||
|
||||
Add new layouts by adding a key to `SWITCH_LAYOUTS` matching the `model` field
|
||||
returned by the UniFi API for that device.
|
||||
Port LEDs use the colors from each model's quick start guide. Other models use plain blocks until they get an
|
||||
entry in `FACEPLATES`.
|
||||
|
||||
### Suppressions (`/suppressions`)
|
||||
- Create timed (30 min / 1 hr / 4 hr / 8 hr) or manual suppressions
|
||||
@@ -480,9 +481,9 @@ after `ldap.cache_ttl` seconds or can be removed from `ldap.cache_dir`.
|
||||
- Hosts missing from `config.json` are named by IP, so their ports may not match what you expect
|
||||
|
||||
### Port inspector: front panel shows as a flat list (no layout)
|
||||
- The switch's `model` field from UniFi doesn't match any key in `SWITCH_LAYOUTS` in `port-inspector.js`
|
||||
- The switch's `model` field from UniFi doesn't match any key in `FACEPLATES` in `faceplates.js`
|
||||
- The model is shown on the device page
|
||||
- Add the model key to `SWITCH_LAYOUTS` in `port-inspector.js` with the correct row/SFP layout
|
||||
- Add the model to `FACEPLATES` in `faceplates.js` (see Adding a New Device Faceplate)
|
||||
|
||||
### Baseline re-initializing on every restart
|
||||
- `interface_baseline` is stored in the `monitor_state` DB table; survives restarts
|
||||
@@ -545,19 +546,24 @@ gandalf/
|
||||
4. Restart monitor: `systemctl restart gandalf-monitor`
|
||||
5. For SFP DOM / ethtool: ensure the host is SSH-accessible from the Pulse worker
|
||||
|
||||
### Adding a New Switch Layout
|
||||
### Adding a New Device Faceplate
|
||||
|
||||
Find the UniFi model code for the switch (shown on its device page), then add to `SWITCH_LAYOUTS` in
|
||||
`static/port-inspector.js`:
|
||||
Find the UniFi model code on the device page, then add an entry to `FACEPLATES` in `static/faceplates.js`.
|
||||
Trace coordinates from a front-on image of the device, using the image's pixels as the `viewBox`:
|
||||
|
||||
```javascript
|
||||
'MYNEWMODEL': {
|
||||
rows: [[1,2,3,4,5,6,7,8], [9,10,11,12,13,14,15,16]], // port_idx by row
|
||||
sfp_section: [17, 18], // separate SFP cage ports (rendered below rows)
|
||||
sfp_ports: [], // port_idx values that are SFP-type within rows
|
||||
width: 1100, height: 110, frameClass: 'fp-scroll', scrollX: 500,
|
||||
label: 'My New Switch',
|
||||
legend: [['off', 'no link'], ['amber', '10/100M'], ['green', '1G']],
|
||||
roles: { 1: 'RJ45' },
|
||||
ports: rj45Pairs([520, 557, 594], { top: 38, bottom: 69, topLabel: 15.5, bottomLabel: 98 }),
|
||||
decor() { return fpVents([[90, 500]], 3) + fpQuadScreen(15, 23, 60); },
|
||||
},
|
||||
```
|
||||
|
||||
Take LED colors from the model's quick start guide. See the comment at the top of the file for every option.
|
||||
|
||||
### Database Schema Notes
|
||||
|
||||
- `network_events`: one row per active event; `resolved_at` is set when recovered
|
||||
|
||||
Reference in new issue
Block a user