Fix 10-bay ASCII box alignment

Border was 130 columns wide but bay lines were 138. Widened border
and all interior format strings to match the bay content width (136
interior = 138 total). Long controller descriptions are now truncated
to prevent overflow.

Ref #25

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-06 18:27:33 -05:00
parent 4a98a6f6f8
commit 555ecd54b2

View File

@@ -344,26 +344,29 @@ generate_10bay_layout() {
# Fixed width for consistent box drawing (fits device names like "nvme0n1")
local drive_width=10
# Box interior width = 136 (determined by 10 bay boxes: 4 + 10*13 + 2)
# Total box width = 138 (136 interior + 2 for │ borders)
# Main chassis section
printf "┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐\n"
printf "│ %-126s │\n" "$hostname - Sliger CX4712 (10x 3.5\" Hot-swap)"
printf "│ │\n"
printf "┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐\n"
printf "│ %-132s │\n" "$hostname - Sliger CX4712 (10x 3.5\" Hot-swap)"
printf "│%-136s│\n" ""
# Show storage controllers
printf "│ Storage Controllers: │\n"
printf "│ %-134s│\n" "Storage Controllers:"
while IFS= read -r ctrl; do
[[ -n "$ctrl" ]] && printf "│ %-126s│\n" "$ctrl"
[[ -n "$ctrl" ]] && printf "│ %-134.134s│\n" "$ctrl"
done < <(get_storage_controllers)
printf "│ │\n"
printf "│%-136s│\n" ""
# M.2 NVMe slot if present
if [[ -n "${DRIVE_MAP[m2-1]}" ]]; then
printf "│ M.2 NVMe: %-10s │\n" "${DRIVE_MAP[m2-1]}"
printf "│ │\n"
printf "│ %-134s│\n" " M.2 NVMe: ${DRIVE_MAP[m2-1]}"
printf "│%-136s│\n" ""
fi
printf "│ Front Hot-swap Bays: │\n"
printf "│ │\n"
printf "│ %-134s│\n" " Front Hot-swap Bays:"
printf "│%-136s│\n" ""
# Bay top borders
printf "│ "
@@ -386,7 +389,7 @@ generate_10bay_layout() {
done
printf " │\n"
printf "└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘\n"
printf "└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘\n"
}
#------------------------------------------------------------------------------