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

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:
2026-11-05 11:11:48 -05:00
co-authored by Claude Opus 5.5
parent d6263049ef
commit 051e70b82b
7 changed files with 750 additions and 117 deletions
+138
View File
@@ -1172,3 +1172,141 @@ tr.device-row.is-selected { background: var(--bg-tertiary); box-shadow: inset 3p
.device-inspector .inspector-panel-inner { width: 100%; max-height: none; }
.device-chassis .chassis-ear-l, .device-chassis .chassis-ear-r { display: none; }
}
/* ── Realistic device faceplates (static/faceplates.js) ───────────── */
/* Hardware colors are fixed: a silver chassis stays silver in every theme. */
.device-chassis { container-type: inline-size; }
.fp-wrap { padding: 14px 16px; }
.fp-frame { overflow: hidden; border-radius: 3px; box-shadow: 0 2px 10px rgba(0,0,0,.55); }
.fp-svg { display: block; width: 100%; height: auto; }
/* Too narrow for the whole unit: zoom to the port area so jacks stay tappable.
Width = viewBox width / visible width; margin = cropX / visible width. */
@container (max-width: 620px) {
.fp-crop-udmpro .fp-svg { width: 308.7%; max-width: none; margin-left: -208.7%; }
}
.fp-body { fill: url(#fp-metal); }
.fp-vent { fill: #242326; }
.fp-screen { fill: #0c1020; stroke: #2a2c34; stroke-width: 1; }
.fp-screen-ring{ fill: none; stroke: #3f7bd9; stroke-width: 2.2; }
.fp-screen-dot { fill: #dfe8f8; }
.fp-brand { fill: #55565c; font: 600 7.5px Arial, Helvetica, sans-serif; }
.fp-bay { fill: url(#fp-bay-face); stroke: #54555a; stroke-width: 1; }
.fp-bay-edge { fill: #bdbdc1; }
.fp-bay-led { fill: #3a3a3e; }
.fp-block { fill: #e1e1e3; stroke: #5d5e63; stroke-width: 1; }
.fp-divider { fill: #dcdcde; }
.fp-label { fill: #55565c; font: 9px Arial, Helvetica, sans-serif; }
.fp-label-sm { font-size: 6.5px; letter-spacing: .03em; }
.fp-globe { fill: none; stroke: #3f7bd9; stroke-width: .8; }
.fp-reset { fill: #1b1b1d; }
.fp-jack { fill: #18181b; stroke: #0c0c0d; stroke-width: .6; }
.fp-contacts { fill: #b89545; }
.fp-plug { fill: #9ea1a8; stroke: #5b5d63; stroke-width: .6; }
.fp-plug-clip { fill: #7e8087; stroke: #5b5d63; stroke-width: .5; }
.fp-cage { fill: #17171a; stroke: #6e6f74; stroke-width: 1; }
.fp-cage-spring{ fill: none; stroke: #5d5e63; stroke-width: 1.2; stroke-dasharray: 2.5 1.5; }
.fp-cage-rail { fill: #3b3c41; }
.fp-module { fill: #a5a7ad; stroke: #6a6b70; stroke-width: .6; }
.fp-module-lc { fill: #2a4a7f; stroke: #1a2a44; stroke-width: .5; }
.fp-led-idle { fill: #6a6b70; }
.fp-led-off { fill: #4b4c50; }
.fp-led-amber { fill: #ffad1f; }
.fp-led-green { fill: #35f06f; }
.fp-led-white { fill: #ffffff; stroke: #8fa6c4; stroke-width: .5; }
.fp-led-unknown{ fill: #b9bcc2; }
.fp-led-amber, .fp-led-green, .fp-led-white { filter: drop-shadow(0 0 1.5px currentColor); }
.fp-led-amber { color: #ffad1f; }
.fp-led-green { color: #35f06f; }
.fp-led-white { color: #cfe2ff; }
.fp-led-active { animation: fp-blink 1.3s steps(2, jump-none) infinite; }
@keyframes fp-blink { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .fp-led-active { animation: none; } }
.fp-port { cursor: pointer; outline: none; }
.fp-hit { fill: transparent; stroke: transparent; stroke-width: 2.5; pointer-events: all; }
.fp-port:hover .fp-hit { stroke: rgba(0,90,220,.55); }
.fp-port:focus-visible .fp-hit,
.fp-port.selected .fp-hit { stroke: #0058e0; fill: rgba(0,88,224,.14); }
.fp-legend-led { width: 12px; height: 5px; border-radius: 1px; display: inline-block; background: #4b4c50; }
.fp-legend-led.fp-led-amber { background: #ffad1f; }
.fp-legend-led.fp-led-green { background: #35f06f; }
.fp-legend-led.fp-led-white { background: #fff; }
.fp-readout { margin-left: auto; font-size: .72em; color: var(--text-dim, var(--text-muted)); text-transform: none; letter-spacing: 0; }
/* Narrow panels: crop to the ports, or scroll within the panel */
@container (max-width: 620px) {
.fp-crop-agg .fp-svg { width: 437%; max-width: none; margin-left: -337%; }
.fp-scroll { overflow-x: auto; }
.fp-scroll .fp-svg { width: 260%; max-width: none; }
}
.fp-desk { box-shadow: none; }
.fp-desk .fp-svg { max-width: 560px; margin: 0 auto; filter: drop-shadow(0 3px 6px rgba(0,0,0,.5)); }
.fp-body-white { fill: #f2f2f3; stroke: #c9c9cc; stroke-width: 1; }
.fp-frame-grey { fill: #c6c8cc; stroke: #8b8d92; stroke-width: 1; }
.fp-foot { fill: #b7b7ba; }
.fp-body-metal { fill: url(#fp-metal); }
.fp-ear { fill: #c4c4c7; stroke: #8f9095; stroke-width: 1; }
.fp-ear-hole { fill: #0b0d12; }
.fp-button { fill: #3a3a3e; stroke: #1b1b1d; stroke-width: 1; }
.fp-speed-bar { fill: #8d8e93; }
.fp-screen-grid{ fill: none; stroke: #2f6fd0; stroke-width: 1; }
.fp-screen-icon{ fill: #6b9be4; }
.fp-static { opacity: .85; }
.fp-bolt { fill: #e88a00; }
.fp-cycle { fill: none; stroke: #0058e0; stroke-width: 1.4; stroke-linecap: round; }
.fp-outlet { cursor: default; outline: none; }
.fp-outlet-face { fill: #2a2a2d; stroke: #111113; stroke-width: 1; }
.fp-slot { fill: #050506; }
.fp-usbc { fill: #1c1c1f; stroke: #8b8d92; stroke-width: 1; }
.fp-usbc-tongue { fill: #b9bcc2; }
.fp-outlet-is-off .fp-outlet-face { fill: #5b5c60; }
.fp-outlet-is-off .fp-usbc { fill: #66676b; }
.fp-outlet:hover .fp-hit { stroke: rgba(0,90,220,.55); }
.fp-outlet:focus-visible .fp-hit { stroke: #0058e0; fill: rgba(0,88,224,.14); }
.fp-outlet-state { fill: #8d8e93; }
.fp-state-on { fill: #12a84a; }
.fp-state-off { fill: #d6332a; }
.fp-ups-band { fill: #8c8d90; }
.fp-ups-vent { fill: #2b2b2e; }
.fp-ups-rib { fill: none; stroke: #77787c; stroke-width: 1; }
.fp-ups-batt { fill: none; stroke: #2b2b2e; stroke-width: 1.3; }
.fp-ups-batt-tip{ fill: #2b2b2e; }
.fp-led-blue { fill: #2f7bff; color: #2f7bff; filter: drop-shadow(0 0 2px currentColor); }
.fp-legend-led.fp-led-blue { background: #2f7bff; }
.fp-legend-led.fp-led-outlet-on { background: #12a84a; width: 7px; height: 7px; border-radius: 50%; }
.fp-legend-led.fp-led-outlet-off { background: #d6332a; width: 7px; height: 7px; border-radius: 50%; }
.fp-legend-icon { width: 11px; height: 11px; flex-shrink: 0; }
/* A white LED needs an edge to show against the light metal around it */
polygon.fp-led-white { stroke: #6b7c95; stroke-width: .7; }
polygon.fp-led-off { fill: #6b6c71; }
.fp-key { fill: none; stroke: #55565c; stroke-width: .8; }
.fp-key-amber { fill: #e8762c; stroke: none; }
.fp-key-green { fill: #7ec23a; stroke: none; }
.fp-ups-bolt { fill: #2b2b2e; }
/* UPS 2U Pro: front and rear panels stacked */
.fp-stack { box-shadow: none; }
.fp-caption { fill: #8b96a6; font: 600 10px Arial, Helvetica, sans-serif; letter-spacing: .1em; }
.fp-ups-band-light { fill: #f4f4f5; }
.fp-power-ring { fill: none; stroke: #8d8e93; stroke-width: 3; }
.fp-power-on { stroke: #2f9bff; filter: drop-shadow(0 0 3px #2f9bff); }
.fp-power-face { fill: #dcdcde; stroke: #a9a9ad; stroke-width: 1; }
.fp-power-icon { fill: none; stroke: #55565c; stroke-width: 1.5; stroke-linecap: round; }
.fp-tile { fill: #1f6fff; }
.fp-tile-num { fill: #fff; font: 600 9px Arial, Helvetica, sans-serif; }
.fp-outlet-is-off .fp-tile { fill: #3a3d46; }
.fp-screen-tile-dim{ fill: #2a2d36; }
.fp-breaker { fill: #4a4a4e; }
.fp-fan { fill: none; stroke: #3a3a3e; stroke-width: 7; }
.fp-fan-strut { fill: none; stroke: #c9c9cc; stroke-width: 5; }
.fp-epo { fill: #1c1c1f; }
.fp-bracket { fill: none; stroke: #55565c; stroke-width: 1; }