mirror of
https://github.com/netbox-community/netbox.git
synced 2026-01-11 21:10:29 +01:00
Display IP role labels in interfaces table #5136
Closed
opened 2025-12-29 19:24:38 +01:00 by adam
·
24 comments
No Branch/Tag Specified
main
update-changelog-comments-docs
feature-removal-issue-type
20911-dropdown
20239-plugin-menu-classes-mutable-state
21097-graphql-id-lookups
feature
fix_module_substitution
20923-dcim-templates
20044-elevation-stuck-lightmode
feature-ip-prefix-link
v4.5-beta1-release
20068-import-moduletype-attrs
20766-fix-german-translation-code-literals
20378-del-script
7604-filter-modifiers-v3
circuit-swap
12318-case-insensitive-uniqueness
20637-improve-device-q-filter
20660-script-load
19724-graphql
20614-update-ruff
14884-script
02496-max-page
19720-macaddress-interface-generic-relation
19408-circuit-terminations-export-templates
20203-openapi-check
fix-19669-api-image-download
7604-filter-modifiers
19275-fixes-interface-bulk-edit
fix-17794-get_field_value_return_list
11507-show-aggregate-and-rir-on-api
9583-add_column_specific_search_field_to_tables
v4.5.0
v4.4.10
v4.4.9
v4.5.0-beta1
v4.4.8
v4.4.7
v4.4.6
v4.4.5
v4.4.4
v4.4.3
v4.4.2
v4.4.1
v4.4.0
v4.3.7
v4.4.0-beta1
v4.3.6
v4.3.5
v4.3.4
v4.3.3
v4.3.2
v4.3.1
v4.3.0
v4.2.9
v4.3.0-beta2
v4.2.8
v4.3.0-beta1
v4.2.7
v4.2.6
v4.2.5
v4.2.4
v4.2.3
v4.2.2
v4.2.1
v4.2.0
v4.1.11
v4.1.10
v4.1.9
v4.1.8
v4.2-beta1
v4.1.7
v4.1.6
v4.1.5
v4.1.4
v4.1.3
v4.1.2
v4.1.1
v4.1.0
v4.0.11
v4.0.10
v4.0.9
v4.1-beta1
v4.0.8
v4.0.7
v4.0.6
v4.0.5
v4.0.3
v4.0.2
v4.0.1
v4.0.0
v3.7.8
v3.7.7
v4.0-beta2
v3.7.6
v3.7.5
v4.0-beta1
v3.7.4
v3.7.3
v3.7.2
v3.7.1
v3.7.0
v3.6.9
v3.6.8
v3.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.3
1.0.0
Labels
Clear labels
beta
breaking change
complexity: high
complexity: low
complexity: medium
needs milestone
netbox
pending closure
plugin candidate
pull-request
severity: high
severity: low
severity: medium
status: accepted
status: backlog
status: blocked
status: duplicate
status: needs owner
status: needs triage
status: revisions needed
status: under review
topic: GraphQL
topic: Internationalization
topic: OpenAPI
topic: UI/UX
topic: cabling
topic: event rules
topic: htmx navigation
topic: industrialization
topic: migrations
topic: plugins
topic: scripts
topic: templating
topic: testing
type: bug
type: deprecation
type: documentation
type: feature
type: housekeeping
type: translation
Mirrored from GitHub Pull Request
Milestone
No items
No Milestone
Projects
Clear projects
No project
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: starred/netbox#5136
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @candlerb on GitHub (Aug 4, 2021).
Originally assigned to: @thatmattlove on GitHub.
NetBox version
v2.11.10
Feature type
Change to existing functionality
Proposed functionality
When listing interfaces under a device, each interface can have multiple IP addresses. If the IP address has a "role" defined, I would like to see its role label displayed next to it.
Example: a particular interface on this device has a regular address 192.168.4.2/24 and a CARP address 192.168.4.1/24. Both are currently shown as the same:
I would like to see the label
next to the .1 address.
(Arguably it would be useful to show IP address Status flags too, apart from Active - IMO that would just clutter the display)
Use case
When you see an interface with multiple IPs, you can immediately tell which is the fixed IP and which is the floating VIP.
Database changes
None
External dependencies
None
@thatmattlove commented on GitHub (Aug 4, 2021):
What would you think about a tooltip instead of displaying a badge? Within a tooltip, we could easily display multiple pieces of information about the related object without having to sacrifice horizontal screen real estate.
@candlerb commented on GitHub (Aug 4, 2021):
I would still like the special addresses to be visually distinct, without having to hover over them.
How about: colourize the address and have a tooltip? For example, if the IP address is CARP, then show it as white on a green background (like the "CARP" label is); the tooltip shows that the role is CARP.
Potentially this could also be used to highlight status (!= Active).
If the address has both status != Active and role != None, one of these would have to take precedence in the colourization (although the tooltip can show both). I don't really mind; arguably if an address is Deprecated or Reserved this is most important thing to highlight. In any case, it's unlikely to have status DHCP or SLAAC and have a role associated with it.
@bellwood commented on GitHub (Aug 6, 2021):
Tooltips aren't particularly mobile friendly so a single
labelwould probably suffice.@jeremystretch I have a PR to resolve this if you're willing to accept one for this feature request.
Edit: This would actually be a
badge-successas 3.0 appears to be using badges over labels@bluikko commented on GitHub (Aug 16, 2021):
These labels used to show and were really useful. I guess they were lost when the tables were changed from templates.
@candlerb commented on GitHub (Aug 17, 2021):
Here is proof-of-concept of labels beside addresses:
I rather like this, although it would be nice to bump the label up a pixel or two.
This patch (to Netbox v2.11.11) implements it, if you want to try it out for yourself:
And here's what happens if the IP address itself is colorized if it has a non-active status or non-null role applied.
It's not great that the font sizes don't match. The label class sets
font-size: 75%, but resetting it to 100% is worse:Anyway, again here's the code for tinkering.
@bluikko commented on GitHub (Aug 19, 2021):
With the caveats on colorizing the address it self (small font / does not line up horizontally with the others; user needs to figure out what the colors mean), IMO the labels beside addresses look the best.
Horizontal screen real estate is precious and needs to be conserved (yay the new collapsible menu in v3!) - I guess adding it in a new column (that can be hidden in the column selection) would be much more work than your simple change? I would prefer to always see the labels but some other people may not need them...
@candlerb commented on GitHub (Aug 19, 2021):
Adding a new column would not be difficult. But I don't like it, because the labels would not be immediately next to the addresses. When you have multiple addresses on an interface, and some addresses are wider than others, it makes the association between address and label unclear. This is a single table cell, with multiple addresses on multiple lines split by
<br>@thatmattlove commented on GitHub (Aug 19, 2021):
I took a swing at implementing @candlerb's solution in the beta, while also using tooltips to show the status or role display text. Thoughts?
@candlerb commented on GitHub (Aug 19, 2021):
There is a problem with this patch: it removes the
<br/>, so if you have two addresses on an interface they can display side by side. I see this with an IPv4 and an IPv6 address on the same interface:@thatmattlove commented on GitHub (Aug 19, 2021):
This is supposed to mitigate that, and does when the
badgeclasses are applied. I did not, however, test this with multiple IPs withoutbadgeclasses (i.e. active status with no role). I'll take a look.@thatmattlove commented on GitHub (Aug 19, 2021):
I'm not able to reproduce this. I also noticed that your screenshot doesn't have the IPs in a monospace font, which was one of the changes I added. How are you testing this?
@bluikko commented on GitHub (Aug 20, 2021):
There used to be "Primary" label before. I think that would be useful to have. Maybe italic IP address? Or some color?
@bluikko commented on GitHub (Aug 20, 2021):
If you look at your patch diff, the
<br />between IP addresses (for loop iterations) is indeed removed.@thatmattlove commented on GitHub (Aug 20, 2021):
Yes, this was intentional.
display: block, applied via the.table-badgeclass accomplishes the same goal, without adding unneeded elements and adding a break to single addresses when it's not needed.@bluikko commented on GitHub (Aug 20, 2021):
I see - didn't scroll down there.
@candlerb commented on GitHub (Aug 20, 2021):
Just a "git pull" on the feature branch. A Shift-Reload has fixed it - must be the old CSS cached in the browser.
I'm afraid I don't really like the mono font here, because it's (a) inconsistent with text in other columns in that view:
and (b) it's inconsistent with how IP addresses are rendered everywhere else:
I tried turning off the monospace font, setting font size 0.875rem to match the rest, and bringing down padding and margin:
However there's still some CSS nonsense which means an unlabeled item is spaced further away than the spacing between labeled items:
(not an optical illusion: I've measured it)
@bluikko commented on GitHub (Aug 20, 2021):
A naive suggestion: put a label around all of them, in your 3rd IP address of last screenshot label being transparent?
@candlerb commented on GitHub (Aug 20, 2021):
I also want to avoid over-wide vertical spacing when unbadged addresses are next to each other (the normal case).
I generally get lost in a myriad of overriding and inherited CSS properties, but here's my solution:
Implementation:
@candlerb commented on GitHub (Aug 20, 2021):
@bluikko: as for "primary" address, how about a small star or other icon next to it?
@bluikko commented on GitHub (Aug 20, 2021):
Sounds to me as good as any visual cue.
@candlerb commented on GitHub (Aug 20, 2021):
OK, perhaps should make that a separate feature request though. Since "primary" is an attribute of the device, not the address or the interface, it may need some more plumbing to get it through to the interfaces table.
@bluikko commented on GitHub (Aug 20, 2021):
I am happy to do that since there's not much I can do otherwise to help. Please thumbs-up if you aren't making it yourself.
@thatmattlove commented on GitHub (Aug 20, 2021):
@candlerb Points taken,
9d46987should contain the same/similar outcome, just a slightly different CSS approach. Please test and confirm it's to your liking, and we can close this one out.@candlerb commented on GitHub (Aug 20, 2021):
Pretty good. Only odd thing I observe is some asymmetry, the vertical spacing between label and subsequent non-label is larger than between non-label and subsequent label.
AFAICS, there is margin-bottom but not margin-top: