Elevation Labels incorrectly showing #11519

Closed
opened 2025-12-29 21:46:19 +01:00 by adam · 5 comments
Owner

Originally created by @thewillwilson on GitHub (Aug 22, 2025).

Originally assigned to: @aq5747 on GitHub.

Deployment Type

Self-hosted

NetBox Version

v.4.3.6

Python Version

3.12

Steps to Reproduce

  1. Browse to Racks > Elevations

Expected Behavior

Rack elevations to only show images as per default option on dropdown "Images only"

Observed Behavior

Rack elevations are showing both images and labels, to get images only you have to change to another option (e.g. labels only) then back to images only.

Image

Originally created by @thewillwilson on GitHub (Aug 22, 2025). Originally assigned to: @aq5747 on GitHub. ### Deployment Type Self-hosted ### NetBox Version v.4.3.6 ### Python Version 3.12 ### Steps to Reproduce 1. Browse to Racks > Elevations ### Expected Behavior Rack elevations to only show images as per default option on dropdown "Images only" ### Observed Behavior Rack elevations are showing both images and labels, to get images only you have to change to another option (e.g. labels only) then back to images only. ![Image](https://github.com/user-attachments/assets/ac5a6c14-9433-4b4e-8ef4-cf3798a66e12)
adam added the type: bugstatus: acceptedseverity: low labels 2025-12-29 21:46:19 +01:00
adam closed this issue 2025-12-29 21:46:19 +01:00
Author
Owner

@jnovinger commented on GitHub (Aug 22, 2025):

So, I can't reproduce this as simply as what the original STR indicates. I think that's because the assertion that there is a default view. I've not dug in to the code yet, but it appears that the "default" appears to be whatever mode you viewed it in last.

Having said that, I can reproduce this with:

STR:

  1. Navigate to /dcim/rack-elevations/
  2. Choose "Images Only" from the elevation display mode dropdown.
  3. Navigate to any other page in the NetBox instance, say /dcim/devices/
  4. Navigate back to /dcim/rack-elevations/

Expected Behavior:
Rack elevation only show images as per last option selected from elevation display mode dropdown, "Images Only".

Observed Behavior:
Rack elevations show both image and label.

@jnovinger commented on GitHub (Aug 22, 2025): So, I can't reproduce this as simply as what the original STR indicates. I think that's because the assertion that there is a default view. I've not dug in to the code yet, but it appears that the "default" appears to be whatever mode you viewed it in last. Having said that, I can reproduce this with: **STR:** 1. Navigate to /dcim/rack-elevations/ 2. Choose "Images Only" from the elevation display mode dropdown. 3. Navigate to any other page in the NetBox instance, say /dcim/devices/ 4. Navigate back to /dcim/rack-elevations/ **Expected Behavior:** Rack elevation only show images as per last option selected from elevation display mode dropdown, "Images Only". **Observed Behavior:** Rack elevations show both image and label.
Author
Owner

@hudsonmi1 commented on GitHub (Aug 22, 2025):

Looks like the same results via a different route.

I'm taking a more convoluted route - Location, Select racks link on the right, select "View Elevations" and although the dropdown is set to Labels, the racks are showing labels and images until I change the selection.

I get the same results following your directions.

@hudsonmi1 commented on GitHub (Aug 22, 2025): Looks like the same results via a different route. I'm taking a more convoluted route - Location, Select racks link on the right, select "View Elevations" and although the dropdown is set to Labels, the racks are showing labels and images until I change the selection. I get the same results following your directions.
Author
Owner

@mf-hyacinther commented on GitHub (Sep 2, 2025):

I notice the same bug. Any workarounds, besides switching back to "images and labels" then to "images only" again?

@mf-hyacinther commented on GitHub (Sep 2, 2025): I notice the same bug. Any workarounds, besides switching back to "images and labels" then to "images only" again?
Author
Owner

@aq5747 commented on GitHub (Oct 12, 2025):

I've been running into this as well, and I think I found a fix.

In project-static/src/racks.ts if the load EventListener is changed to htmx:afterSettle and the JavaScript is rebuilt then the saved rack labels setting is properly honored again:

export function initRackElevation(): void {
// ...
  for (const element of getElements<HTMLObjectElement>('.rack_elevation')) {
      // on the following line change 'load' to 'htmx:afterSettle':
      element.addEventListener('load', () => {
      setRackView(initialView, element);
    });
  }
}

The only workaround I see is editing the netbox.js file directly, if you understand the risks and are confortable doing it. You can search for '.rack_elevation', find the hit with the addEventListener('load', ...) method and change 'load' to 'htmx:afterSettle'.

I'd be more than happy to submit a PR for this is possible.

@aq5747 commented on GitHub (Oct 12, 2025): I've been running into this as well, and I think I found a fix. In `project-static/src/racks.ts` if the `load` `EventListener` is changed to `htmx:afterSettle` and the JavaScript is rebuilt then the saved rack labels setting is properly honored again: ```typescript export function initRackElevation(): void { // ... for (const element of getElements<HTMLObjectElement>('.rack_elevation')) { // on the following line change 'load' to 'htmx:afterSettle': element.addEventListener('load', () => { setRackView(initialView, element); }); } } ``` The only workaround I see is editing the `netbox.js` file directly, if you understand the risks and are confortable doing it. You can search for `'.rack_elevation'`, find the hit with the `addEventListener('load', ...)` method and change `'load'` to `'htmx:afterSettle'`. I'd be more than happy to submit a PR for this is possible.
Author
Owner

@jnovinger commented on GitHub (Oct 13, 2025):

What a find, @aq5747! I'll assign this to you. Hopefully we can get this in the v4.4.3 release coming on Tuesday. If you don't have time before then, let me know and I can take care of it.

@jnovinger commented on GitHub (Oct 13, 2025): What a find, @aq5747! I'll assign this to you. Hopefully we can get this in the v4.4.3 release coming on Tuesday. If you don't have time before then, let me know and I can take care of it.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11519