Expose default rack elevation height and width as configuration parameters #3812

Closed
opened 2025-12-29 18:31:19 +01:00 by adam · 3 comments
Owner

Originally created by @fstolba on GitHub (Jun 26, 2020).

Originally assigned to: @jeremystretch on GitHub.

Environment

  • Python version: 3.7.3
  • NetBox version: 2.8.6

Steps to Reproduce

  1. Have a device whose name is longer than 32 characters
  2. Display the containing rack in rack view or elevation

Expected Behavior

Device name being truncated near the 32 character limit on non-alpha characters (e.g. whitespace or dash).
Bildschirmfoto 2020-06-26 um 11 28 33

Observed Behavior

The whole device name is shown, center aligned, which makes it hard to read and recognize which device it actually is. I hope it's recognizeable even though I had to obfuscate some parts of the image.
Bildschirmfoto 2020-06-26 um 11 01 03

Description

This behaviour was changed some time between 2.6.11 and 2.8.6 with all the changes done to elevation view and such. However I think the new behaviour is broken, although that perception probably depends a lot on the device naming convention in use.
I would propose having a config knob to switch truncation behaviour.

Originally created by @fstolba on GitHub (Jun 26, 2020). Originally assigned to: @jeremystretch on GitHub. ### Environment * Python version: 3.7.3 * NetBox version: 2.8.6 ### Steps to Reproduce 1. Have a device whose name is longer than 32 characters 2. Display the containing rack in rack view or elevation ### Expected Behavior Device name being truncated near the 32 character limit on non-alpha characters (e.g. whitespace or dash). ![Bildschirmfoto 2020-06-26 um 11 28 33](https://user-images.githubusercontent.com/2249547/85842787-87402600-b7a0-11ea-9f45-09387e83c281.png) ### Observed Behavior The whole device name is shown, center aligned, which makes it hard to read and recognize which device it actually is. I hope it's recognizeable even though I had to obfuscate some parts of the image. ![Bildschirmfoto 2020-06-26 um 11 01 03](https://user-images.githubusercontent.com/2249547/85843362-5b717000-b7a1-11ea-8ba2-f091412125e9.png) ### Description This behaviour was changed some time between 2.6.11 and 2.8.6 with all the changes done to elevation view and such. However I think the new behaviour is broken, although that perception probably depends a lot on the device naming convention in use. I would propose having a config knob to switch truncation behaviour.
adam added the status: acceptedtype: feature labels 2025-12-29 18:31:19 +01:00
adam closed this issue 2025-12-29 18:31:19 +01:00
Author
Owner

@jeremystretch commented on GitHub (Jun 26, 2020):

SVG rendering of rack elevations was introduced in v2.7. As the height and width of a unit is user-configurable, we no longer force concatenation of device names. I'll also point out that doing so is often frivolous: For example, if you have 35-character names but only the last two characters are unique per device, truncating to 32 characters results in the same text for each device.

You can pass specific unit_height and unit_width parameters when making an API call to generate a rack elevation, though the UI employs static values to ensure that the resulting images fit on the page. I don't see any other feasible solution, aside from using shorter device names.

@jeremystretch commented on GitHub (Jun 26, 2020): SVG rendering of rack elevations was introduced in v2.7. As the height and width of a unit is user-configurable, we no longer force concatenation of device names. I'll also point out that doing so is often frivolous: For example, if you have 35-character names but only the last two characters are unique per device, truncating to 32 characters results in the same text for each device. You can pass specific `unit_height` and `unit_width` parameters when making an API call to generate a rack elevation, though the UI employs static values to ensure that the resulting images fit on the page. I don't see any other feasible solution, aside from using shorter device names.
Author
Owner

@fstolba commented on GitHub (Jun 26, 2020):

Thanks @jeremystretch, is it possible to set those parameters globally so we can extend the width of the SVGs on pages like /dcim/rack/NNN in order to make those rack elevations more readable until we eventually rename them?

@fstolba commented on GitHub (Jun 26, 2020): Thanks @jeremystretch, is it possible to set those parameters globally so we can extend the width of the SVGs on pages like `/dcim/rack/NNN` in order to make those rack elevations more readable until we eventually rename them?
Author
Owner

@jeremystretch commented on GitHub (Jun 30, 2020):

I think that makes sense, although it will be on the user to avoid setting values which interfere with proper rendering of the UI. I've updated the title of this issue for this purpose.

@jeremystretch commented on GitHub (Jun 30, 2020): I think that makes sense, although it will be on the user to avoid setting values which interfere with proper rendering of the UI. I've updated the title of this issue for this purpose.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#3812