Rack: ports-facing separate from posts, three views, ZimaBoard 832 shelves to scale
Lint / JS (eslint) (push) Successful in 8s
Lint / Python (flake8) (push) Successful in 1m0s
Lint / Notify on failure (push) Skipped
Lint / Deploy (push) Skipped
Security / Python Security (bandit) (push) Successful in 1m9s
Lint / Python (flake8) (pull_request) Successful in 57s
Test / Python Tests (pytest) (push) Successful in 1m14s
Lint / JS (eslint) (pull_request) Successful in 8s
Lint / Notify on failure (pull_request) Skipped
Lint / Deploy (pull_request) Skipped
Security / Python Security (bandit) (pull_request) Successful in 56s
Test / Python Tests (pytest) (pull_request) Successful in 1m5s

Gear on the rear posts usually still faces the front (the StarTech's RPDU
and ZimaBoard shelf), so "which posts" and "which way the ports face" are
now separate fields (mount, facing). The page has three views: Front (front
posts), Rear posts (rear-post gear seen from the front, i.e. what is behind
the front gear) and Rear (from behind). An item seen from the side it
doesn't face shows its back. Facing defaults to front, so existing items
keep their meaning.

Shelves are drawn at true scale with their contents ordered by a new
"Position on shelf". The IceWhale ZimaBoard 832 is traced from IceWhale's
labelled photo of its port end (ZimaDocs): Mini-DP, two RJ45-over-USB 3.0
stacks with link/activity LEDs, DC jack, gunmetal case, gold PCB edge and
black base. Its RJ45 link lights follow the host's physical NICs and the
status glow follows the host.

New cutsheet_items columns facing and slot, added on first use.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-11 00:12:07 -05:00
co-authored by Claude Opus 5.5
parent 6530433d9c
commit a9de175d90
12 changed files with 281 additions and 56 deletions
+26 -8
View File
@@ -25,6 +25,11 @@ ITEM_KINDS = ('patch_panel', 'wall_jack', 'device', 'shelf', 'other')
# Which side of a 4-post rack an item is mounted from. A front and a rear item can share
# a unit; a full-depth one (a server) takes the unit on both sides.
MOUNTS = ('front', 'rear', 'full')
# Which way an item's ports face. Gear on the rear posts usually still faces the front.
FACINGS = ('front', 'rear')
# Rack views: the front posts seen from the front, the rear posts seen from the front
# (what is behind the front gear), and the rack seen from behind
RACK_VIEWS = ('front', 'behind', 'rear')
RACK_UNITS_MAX = 60
# Drawn fronts for gear without a live faceplate (keys of RACK_FRONTS in static/fronts.js)
CHASSIS = {
@@ -32,6 +37,7 @@ CHASSIS = {
'uacc-patch-24': 'UniFi Patch Panel Blank 24 (UACC-Rack-Panel-Patch-Blank-24)',
'sliger-cx4712': 'Sliger CX4712 4U (10-bay)',
'rosewill-rsv-l4500u': 'Rosewill RSV-L4500U 4U (15-bay)',
'zimaboard-832': 'IceWhale ZimaBoard 832 (shelf gear)',
'server-1u': 'Generic 1U server',
'server-2u': 'Generic 2U server',
'server-4u': 'Generic 4U server',
@@ -110,11 +116,17 @@ def validate_item(data: dict, items: Optional[Dict[str, dict]] = None) -> dict:
'device': _text(data, 'device'),
'mount': _text(data, 'mount', 10) or 'front',
'chassis': _text(data, 'chassis', 40),
'facing': _text(data, 'facing', 10) or 'front',
'slot': _int(data, 'slot', 1, 99, 'Position on the shelf'),
'shelf': _text(data, 'shelf', NAME_MAX),
'notes': _text(data, 'notes', NOTES_MAX),
}
if item['chassis'] and item['chassis'] not in CHASSIS:
raise ValidationError(f'Unknown front drawing {item["chassis"]}')
if item['facing'] not in FACINGS:
raise ValidationError(f'facing must be one of {", ".join(FACINGS)}')
if item['slot'] and not item['shelf']:
raise ValidationError('A position applies only to an item on a shelf')
if item['mount'] not in MOUNTS:
raise ValidationError(f'mount must be one of {", ".join(MOUNTS)}')
if item['shelf']:
@@ -127,6 +139,7 @@ def validate_item(data: dict, items: Optional[Dict[str, dict]] = None) -> dict:
raise ValidationError('An item on a shelf takes its rack position from the shelf; clear the rack unit')
item['rack'] = '' # the shelf's rack and side
item['mount'] = 'front'
item['facing'] = 'front'
if item['rack_height'] and not item['rack_u']:
raise ValidationError('Set a rack unit to go with the height')
if item['rack_u'] and not item['rack_height']:
@@ -602,15 +615,20 @@ def _sides(item: dict) -> Tuple[str, ...]:
def rack_layout(items: List[dict], units: int, face: str = 'front') -> dict:
"""Place items that have a rack unit, top of the rack first, as seen from one face.
"""Place items that have a rack unit, top of the rack first, for one view.
Front and rear items may share a unit; full-depth items take it on both sides.
An item that would share a unit and side with one already placed, or runs past the
top of the rack, is reported (whichever face is asked for) rather than drawn over another.
Front-post and rear-post items may share a unit; full-depth items take it on both.
Views (RACK_VIEWS): 'front' shows the front posts from the front; 'behind' shows the
rear posts from the front (what sits behind the front gear); 'rear' shows the rear posts
from behind. Full-depth items appear in all three.
An item that would share a unit and post with one already placed, or runs past the
top of the rack, is reported (whatever the view) rather than drawn over another.
Returns {'placed': [item + 'rack_top' + 'through'], 'overlaps': [{'name', 'units', 'with'}],
'outside': [name]}, where 'through' marks a full-depth item seen from the side it isn't faced to
(its back, for the rear view).
'outside': [name]}, where 'through' marks an item seen from the side it doesn't face
(its back, rather than its ports).
"""
side = 'front' if face == 'front' else 'rear'
looking = 'rear' if face == 'rear' else 'front'
taken: Dict[tuple, str] = {}
placed, overlaps, outside = [], [], []
racked = [i for i in items if i.get('rack_u')]
@@ -630,8 +648,8 @@ def rack_layout(items: List[dict], units: int, face: str = 'front') -> dict:
continue
for c in cells:
taken[c] = item['name']
if face in sides:
placed.append(dict(item, rack_top=high, through=item.get('mount') == 'full' and face == 'rear'))
if side in sides:
placed.append(dict(item, rack_top=high, through=(item.get('facing') or 'front') != looking))
return {'placed': placed, 'overlaps': overlaps, 'outside': outside}