Customize RackView labels #8815

Open
opened 2025-12-29 20:41:37 +01:00 by adam · 6 comments
Owner

Originally created by @PieterL75 on GitHub (Nov 7, 2023).

NetBox version

v3.6.4

Feature type

Change to existing functionality

Proposed functionality

The rack elevation views currently only show either the 'label' and/or the images of a device.
I would to make that 'label' and 'postcard' customizable, using jinja2 templates.
This way the 'label' and 'postcard' can show information relevant to the engineer working on the racks

The custom templates can be stored in a new 'Customization' item 'Rack Labels'
a rack-label item consists of the template for the device label and a template for the postcard

the rack view gets a new dropdown where the Custom Labels can be choosen:
image

Optional : Is there a mechanism that can store the last used label in a users' preferences ? So that he gets the same racklabels the next time he opens the elevation

This FR is an update of https://github.com/netbox-community/netbox/issues/12518

Use case

Our DC Eng needs to work with 'asset_tags' in stead of hostnames to identify devices. Now he has to either hover over a device, or click on it to see the asset tags. When doing their regular rack inventory, this is very time consuming. With the alternate view, they can set the asset_tag as label.
When doing a power-audit, the label could be replaced with the 'allocated and maximum draw'

The postcard currently contains some info, but I can imaging that some people would like to see other info in there.

Database changes

New table 'Rack Labels'
Fields:

  • Label : Drowdown of all field related to a device OR a jinja2 firld that creates the label (one line)
  • Postcard : jinja2 field that allows a custom postcard when hovering over the device

External dependencies

No response

Originally created by @PieterL75 on GitHub (Nov 7, 2023). ### NetBox version v3.6.4 ### Feature type Change to existing functionality ### Proposed functionality The rack elevation views currently only show either the 'label' and/or the images of a device. I would to make that 'label' and 'postcard' customizable, using jinja2 templates. This way the 'label' and 'postcard' can show information relevant to the engineer working on the racks The custom templates can be stored in a new 'Customization' item 'Rack Labels' a rack-label item consists of the template for the device label and a template for the postcard the rack view gets a new dropdown where the Custom Labels can be choosen: ![image](https://github.com/netbox-community/netbox/assets/74899468/1f0f2293-9bf5-4d4d-b30b-c17228578d11) Optional : Is there a mechanism that can store the last used label in a users' preferences ? So that he gets the same racklabels the next time he opens the elevation This FR is an update of https://github.com/netbox-community/netbox/issues/12518 ### Use case Our DC Eng needs to work with 'asset_tags' in stead of hostnames to identify devices. Now he has to either hover over a device, or click on it to see the asset tags. When doing their regular rack inventory, this is very time consuming. With the alternate view, they can set the asset_tag as label. When doing a power-audit, the label could be replaced with the 'allocated and maximum draw' The postcard currently contains some info, but I can imaging that some people would like to see other info in there. ### Database changes New table 'Rack Labels' Fields: - Label : Drowdown of all field related to a device OR a jinja2 firld that creates the label (one line) - Postcard : jinja2 field that allows a custom postcard when hovering over the device ### External dependencies _No response_
adam added the type: featurenetboxstatus: backlogcomplexity: high labels 2025-12-29 20:41:37 +01:00
Author
Owner

@PieterL75 commented on GitHub (Jan 8, 2024):

Other use cases that can bring a pre-rack overview directly visible. Each with its own label and postcard

  • Power usage per device
  • free/used network ports per device
  • airflow
  • if linked to monitoring system : devices with errors/alerts/...
  • Status of the devices
@PieterL75 commented on GitHub (Jan 8, 2024): Other use cases that can bring a pre-rack overview directly visible. Each with its own label and postcard - Power usage per device - free/used network ports per device - airflow - if linked to monitoring system : devices with errors/alerts/... - Status of the devices
Author
Owner

@AirDRoN-lab commented on GitHub (Apr 11, 2024):

Hello. It would be extremely useful if the jinja2 templates could be applied to the pop-up bubble. All devices at our sites are registered with a VNF/CNF tag with reasonable length and custom field, which would like to see in pop-up (and/or label).

@AirDRoN-lab commented on GitHub (Apr 11, 2024): Hello. It would be extremely useful if the jinja2 templates could be applied to the pop-up bubble. All devices at our sites are registered with a VNF/CNF tag with reasonable length and custom field, which would like to see in pop-up (and/or label).
Author
Owner

@llamafilm commented on GitHub (Jul 30, 2024):

Adding another use case for this: I have lots of non-rackable devices which I model as children. I use a Generic 1U Shelf parent with 2 or 3 device bays. I'd like to use the shelf's description field to describe what it contains in the rack elevation view. Jinja templates would allow me to customize this only for devices which have children.

image
@llamafilm commented on GitHub (Jul 30, 2024): Adding another use case for this: I have lots of non-rackable devices which I model as children. I use a `Generic 1U Shelf` parent with 2 or 3 device bays. I'd like to use the shelf's `description` field to describe what it contains in the rack elevation view. Jinja templates would allow me to customize this only for devices which have children. <img width="264" alt="image" src="https://github.com/user-attachments/assets/e87e7213-1e2f-41f9-b7a9-e9c8142c7b15">
Author
Owner

@llamafilm commented on GitHub (Dec 5, 2025):

I'd like to work on this feature and I think it can be simplified. Adding a new model for RackViewLabel seems over-complicated. This is what I propose:

Add a new ConfigParam containing a JSON list of named rack elevation templates. This would function similarly to Custom Validators, so it can either be hard-coded in configuration.py or set dynamically with ConfigRevisions.

Add a new UserPreference to choose one of those templates.

If the template is unset, then default to the current display.

Image Image
@llamafilm commented on GitHub (Dec 5, 2025): I'd like to work on this feature and I think it can be simplified. Adding a new model for RackViewLabel seems over-complicated. This is what I propose: Add a new ConfigParam containing a JSON list of named rack elevation templates. This would function similarly to Custom Validators, so it can either be hard-coded in configuration.py or set dynamically with ConfigRevisions. Add a new UserPreference to choose one of those templates. If the template is unset, then default to the current display. <img width="827" height="332" alt="Image" src="https://github.com/user-attachments/assets/f92f20a2-a61a-471a-bac2-66e9e7281266" /> <img width="1050" height="460" alt="Image" src="https://github.com/user-attachments/assets/5918d46e-87e2-4c76-8214-caaeb3146982" />
Author
Owner

@PieterL75 commented on GitHub (Dec 5, 2025):

I agree that the label and tooltip definition can go in the configurations.py. It is not something that the enduser needs to change, but that is defined by the operators of netbox.

The dropdown for the elevation template should be implemented. It should be easy to switch between them.
With you current proposal, the user will have a hardtime to find out where he can change that setting.
The user profile field can be kept to store the 'last used' of the template.

Thx for picking this up and your work on it !

@PieterL75 commented on GitHub (Dec 5, 2025): I agree that the label and tooltip definition can go in the configurations.py. It is not something that the enduser needs to change, but that is defined by the operators of netbox. The dropdown for the elevation template should be implemented. It should be easy to switch between them. With you current proposal, the user will have a hardtime to find out where he can change that setting. The user profile field can be kept to store the 'last used' of the template. Thx for picking this up and your work on it !
Author
Owner

@llamafilm commented on GitHub (Dec 7, 2025):

I thought about this some more and tried to mimic the behavior of the images/text selector, which stores its choice in local storage where it can be read by javascript on page load. But changing the template requires refreshing data from the server, so local storage won't work. So, with the value stored as a UserPreference, I can add a selector like this, but on the next session it will revert back to the user preference. I think this is probably desirable for most users.

It might be possible to update the user preference every time this selector is changed, but that would be an anomaly, since no other user preference gets updated dynamically like that, and I think it would be more confusing.

Image
@llamafilm commented on GitHub (Dec 7, 2025): I thought about this some more and tried to mimic the behavior of the images/text selector, which stores its choice in local storage where it can be read by javascript on page load. But changing the template requires refreshing data from the server, so local storage won't work. So, with the value stored as a UserPreference, I can add a selector like this, but on the next session it will revert back to the user preference. I think this is probably desirable for most users. It might be possible to update the user preference every time this selector is changed, but that would be an anomaly, since no other user preference gets updated dynamically like that, and I think it would be more confusing. <img width="1082" height="305" alt="Image" src="https://github.com/user-attachments/assets/6874d1b4-9195-4703-9b2f-49cf13ae514e" />
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8815