Expanded view for Prefixes doesn't display hierarchy #3668

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

Originally created by @abrahamvegh on GitHub (May 10, 2020).

Originally assigned to: @jeremystretch on GitHub.

Environment

  • Python version: 3.7.3
  • NetBox version: 2.8.3

Steps to Reproduce

Create a prefix that is a child of another prefix. e.g. 203.0.113.0/24 and 203.0.113.0/25

Expected Behavior

When viewing the list with the ‘Expand’ mode turned on, the prefixes used to display with an indication of their hierarchy.

Observed Behavior

All prefixes display at the same level in the list, making hierarchy less obvious.
Screen Shot 2020-05-10 at 3 21 56 AM
Screen Shot 2020-05-10 at 3 22 02 AM

Notes

I’m not sure exactly when this broke, but I'm pretty confident it was very recent, perhaps something in #492?

Originally created by @abrahamvegh on GitHub (May 10, 2020). Originally assigned to: @jeremystretch on GitHub. <!-- NOTE: IF YOUR ISSUE DOES NOT FOLLOW THIS TEMPLATE, IT WILL BE CLOSED. This form is only for reproducible bugs. If you need assistance with NetBox installation, or if you have a general question, DO NOT open an issue. Instead, post to our mailing list: https://groups.google.com/forum/#!forum/netbox-discuss Please describe the environment in which you are running NetBox. Be sure that you are running an unmodified instance of the latest stable release before submitting a bug report, and that any plugins have been disabled. --> ### Environment * Python version: 3.7.3 * NetBox version: 2.8.3 <!-- Describe in detail the exact steps that someone else can take to reproduce this bug using the current stable release of NetBox. Begin with the creation of any necessary database objects and call out every operation being performed explicitly. If reporting a bug in the REST API, be sure to reconstruct the raw HTTP request(s) being made: Don't rely on a client library such as pynetbox. --> ### Steps to Reproduce Create a prefix that is a child of another prefix. e.g. `203.0.113.0/24` and `203.0.113.0/25` <!-- What did you expect to happen? --> ### Expected Behavior When viewing the list with the ‘Expand’ mode turned on, the prefixes used to display with an indication of their hierarchy. <!-- What happened instead? --> ### Observed Behavior All prefixes display at the same level in the list, making hierarchy less obvious. ![Screen Shot 2020-05-10 at 3 21 56 AM](https://user-images.githubusercontent.com/53161/81493332-92c9a300-926d-11ea-9b77-278e5201c130.png) ![Screen Shot 2020-05-10 at 3 22 02 AM](https://user-images.githubusercontent.com/53161/81493336-96f5c080-926d-11ea-88df-e5e3720db3eb.png) ### Notes I’m not sure exactly when this broke, but I'm pretty confident it was very recent, perhaps something in #492?
adam added the type: bugstatus: accepted labels 2025-12-29 18:30:29 +01:00
adam closed this issue 2025-12-29 18:30:30 +01:00
Author
Owner

@jeremystretch commented on GitHub (May 13, 2020):

I can confirm that this was broken by the change in #492. It seems that calling prefetch_related() on the queryset after annotate() wipes out the annotations, though I can't figure out why. AFAIK this shouldn't happen, but we may have run into some obscure caveat of the ORM.

@jeremystretch commented on GitHub (May 13, 2020): I can confirm that this was broken by the change in #492. It seems that calling `prefetch_related()` on the queryset _after_ `annotate()` wipes out the annotations, though I can't figure out why. AFAIK this shouldn't happen, but we may have run into some obscure caveat of the ORM.
Author
Owner

@jeremystretch commented on GitHub (May 13, 2020):

So we're not actually using annotate() to do this, but rather some convoluted logic in the annotate_depth() method on PrefixQuerySet. It's probably best to address this directly (which is already long overdue) rather than coming up with a workaround.

Marking this as blocked by #4639.

@jeremystretch commented on GitHub (May 13, 2020): So we're not actually using `annotate()` to do this, but rather some convoluted logic in the `annotate_depth()` method on PrefixQuerySet. It's probably best to address this directly (which is already long overdue) rather than coming up with a workaround. Marking this as blocked by #4639.
Author
Owner

@jeremystretch commented on GitHub (May 13, 2020):

I spent too much time today digging into #4639 and I'm afraid it isn't going anywhere soon. Going to throw in a "meh" workaround for an immediate fix for the UI.

@jeremystretch commented on GitHub (May 13, 2020): I spent too much time today digging into #4639 and I'm afraid it isn't going anywhere soon. Going to throw in a "meh" workaround for an immediate fix for the UI.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#3668