Formatting of cable length in cable trace #2584

Closed
opened 2025-12-29 18:20:09 +01:00 by adam · 2 comments
Owner

Originally created by @candlerb on GitHub (May 5, 2019).

Environment

  • Python version: 3.5.2
  • NetBox version: 2.5.12

Steps to Reproduce

This is a minor issue, but the display of cable length units could be improved.

  1. Create cable with length 200, units Centimeters
  2. Trace the cable

Expected Behavior

Length to be shown as "200cm" or "200 Centimeters"

Observed Behavior

image

This is ugly because "200" and "Centimeters" are pressed up against each other; also there is a leading hyphen which looks like a minus.

I would prefer displaying the abbreviated length unit here - e.g. cm, ft etc (*) - in which case having no space is entirely appropriate. Otherwise, insert a space.

Please also omit the hyphen unless there is a field to separate it from. (I guess this is for the cable label? But in this case, the cable is unlabelled)

(*) There's no need to have both long and short versions - I'd be entirely happy if the abbreviations were used everywhere.

CABLE_LENGTH_UNIT_CHOICES = (
    (LENGTH_UNIT_METER, 'm'),
    (LENGTH_UNIT_CENTIMETER, 'cm'),
    (LENGTH_UNIT_FOOT, 'ft'),
    (LENGTH_UNIT_INCH, 'in'),
)
RACK_DIMENSION_UNIT_CHOICES = (
    (LENGTH_UNIT_MILLIMETER, 'mm'),
    (LENGTH_UNIT_INCH, 'in'),
)
Originally created by @candlerb on GitHub (May 5, 2019). ### Environment * Python version: 3.5.2 * NetBox version: 2.5.12 ### Steps to Reproduce This is a minor issue, but the display of cable length units could be improved. 1. Create cable with length 200, units Centimeters 2. Trace the cable ### Expected Behavior Length to be shown as "200cm" or "200 Centimeters" ### Observed Behavior ![image](https://user-images.githubusercontent.com/44789/57196976-b884e380-6f59-11e9-8029-17c92a0b51ed.png) This is ugly because "200" and "Centimeters" are pressed up against each other; also there is a leading hyphen which looks like a minus. I would prefer displaying the abbreviated length unit here - e.g. cm, ft etc (*) - in which case having no space is entirely appropriate. Otherwise, insert a space. Please also omit the hyphen unless there is a field to separate it from. (I guess this is for the cable label? But in this case, the cable is unlabelled) (*) There's no need to have both long and short versions - I'd be entirely happy if the abbreviations were used everywhere. ``` CABLE_LENGTH_UNIT_CHOICES = ( (LENGTH_UNIT_METER, 'm'), (LENGTH_UNIT_CENTIMETER, 'cm'), (LENGTH_UNIT_FOOT, 'ft'), (LENGTH_UNIT_INCH, 'in'), ) RACK_DIMENSION_UNIT_CHOICES = ( (LENGTH_UNIT_MILLIMETER, 'mm'), (LENGTH_UNIT_INCH, 'in'), ) ```
adam added the status: acceptedtype: housekeeping labels 2025-12-29 18:20:09 +01:00
adam closed this issue 2025-12-29 18:20:09 +01:00
Author
Owner

@tb-killa commented on GitHub (May 6, 2019):

If you Label the Cable this would be visible on TOP of the trace View.

https://github.com/digitalocean/netbox/blob/develop/netbox/templates/dcim/cable_trace.html#L29

With Label:
image

Without Label:
image

I think this is a simple Bug because the one character is too much:

https://github.com/digitalocean/netbox/blob/develop/netbox/templates/dcim/cable_trace.html#L34

@tb-killa commented on GitHub (May 6, 2019): If you ``Label`` the ``Cable`` this would be visible on TOP of the ``trace`` View. ``https://github.com/digitalocean/netbox/blob/develop/netbox/templates/dcim/cable_trace.html#L29`` **With Label:** ![image](https://user-images.githubusercontent.com/932481/57210969-eeb87680-6fde-11e9-9c50-e069e89eeb44.png) **Without Label:** ![image](https://user-images.githubusercontent.com/932481/57211007-13ace980-6fdf-11e9-888e-faacc6045fed.png) I think this is a simple Bug because the one character is too much: ``https://github.com/digitalocean/netbox/blob/develop/netbox/templates/dcim/cable_trace.html#L34``
Author
Owner

@rogerholten commented on GitHub (May 6, 2019):

Just want to add that according to SI rules, there should always be a space between number and unit even if the unit is abbreviated. Source: SI Brochure, Section 5.3.3: https://www.bipm.org/en/publications/si-brochure/section5-3.html

@rogerholten commented on GitHub (May 6, 2019): Just want to add that according to SI rules, there should always be a space between number and unit even if the unit is abbreviated. Source: SI Brochure, Section 5.3.3: https://www.bipm.org/en/publications/si-brochure/section5-3.html
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#2584