Skip to content

Claude at it again, fixing the rack diagram he broke himself - #26

Merged
AzertoxHDW merged 6 commits into
mainfrom
claude/fix-rack-diagram-updates-01Vd6Wm45FJrywKeASqdS954
Nov 20, 2025
Merged

Claude at it again, fixing the rack diagram he broke himself#26
AzertoxHDW merged 6 commits into
mainfrom
claude/fix-rack-diagram-updates-01Vd6Wm45FJrywKeASqdS954

Conversation

@AzertoxHDW

Copy link
Copy Markdown
Owner

No description provided.

Created a shared rack-data.ts file to centralize rack device configuration, ensuring the rack diagram on infrastructure detail pages stays in sync with the main rack configuration page.

Changes:
- Created src/lib/rack-data.ts with shared RackDevice interfaces and configuration
- Updated /rack page to import from shared data file
- Updated /infra/[machineId] page to import from shared data file
- Now both pages show consistent rack positions (e.g., Sierra at U6, TrueNAS at U8)

This fixes the issue where the mini rack diagram on machine detail pages showed outdated/different positions than the main rack page.
Fixed two issues with the mini rack visualization on infrastructure detail pages:
1. Removed flex-col-reverse to display rack correctly (U18 at top, U1 at bottom)
2. Corrected device positioning logic to properly handle uPosition as the bottom U slot
   - Now correctly calculates device range: uPosition to (uPosition + uHeight - 1)
   - Properly renders multi-U devices and skips occupied slots
   - Fixed device detection to check if each U slot falls within device range

The mini rack now accurately reflects the same layout as the main rack page.
Changed mini rack to display U1 at the top and U18 at the bottom:
- Updated uNumber calculation from (TOTAL_U_SLOTS - i) to (i + 1)
- Fixed device start detection to use d.uPosition directly
- Now correctly displays racks with U1 at top, matching typical rack numbering

This ensures the mini rack shows the proper orientation where lower U numbers appear at the top.
Changed d.uPosition to device.uPosition to fix ReferenceError.
The variable 'd' only exists within the find() callback scope.
Changed the mini rack logic so uPosition represents the topmost (lowest U number) slot:
- For a device at uPosition: 6 with uHeight: 4
- It now occupies U6, U7, U8, U9 (6 is at top)
- Previously it was treating these values differently

Updated calculations:
- deviceTop = uPosition (now the start position)
- deviceBottom = uPosition + uHeight - 1
- Render device at deviceTop position
Removed substring truncation to show complete device names.
Added px-1 padding and truncate class for better text display.
@AzertoxHDW
AzertoxHDW merged commit 0410166 into main Nov 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants