netbox-community / netbox

The premier source of truth powering network automation. Open source under Apache 2. Try NetBox Cloud free: https://netboxlabs.com/free-netbox-cloud/
http://netboxlabs.com/oss/netbox/
Apache License 2.0
16.34k stars 2.6k forks source link

Show device location in breadcrumbs #14972

Open llamafilm opened 10 months ago

llamafilm commented 10 months ago

NetBox version

v3.7.0

Feature type

Change to existing functionality

Proposed functionality

When viewing a device, the breadcrumbs at the top of the page currently show the site and parent device. I'd like to also include the location here. Mockup image:

image

Use case

My devices are primarily organized using the hierarchy Site > Location > Device. This would save a lot of time when editing a device, to be able to quickly jump to a list of other devices in the same location. (By the way, location means room name in my system).

Database changes

none

External dependencies

none

llamafilm commented 10 months ago

At first glance, it seems like all that is required is adding these lines in netbox/templates/dcim/device/base.html

  {% if object.location %}
    <li class="breadcrumb-item"><a href="{% url 'dcim:device_list' %}?site_id={{ object.site.pk }}&location_id={{ object.location.pk }}">{{ object.location }}</a></li>
  {% endif %}
sleepinggenius2 commented 10 months ago

As Locations can be nested, I would assume that the full hierarchy would be desirable, so the code would be a little more complicated. It looks like it's already being done on MPTT views themselves, like Location, Region, and Site Group, so it would probably make sense to make a template tag like the existing nested_tree one to handle this use case.

llamafilm commented 3 months ago

You're right, the full hierarchy would be better. I guess there would need to be some limit in case the string is too long, shortening the middle with ellipses to fit on screen.

github-actions[bot] commented 3 weeks ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Do not attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our contributing guide.