-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show virtual ips in interfaces table #18075
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -557,6 +557,12 @@ class BaseInterfaceTable(NetBoxTable): | |||||
orderable=False, | ||||||
verbose_name=_('IP Addresses') | ||||||
) | ||||||
virtual_ips = tables.TemplateColumn( | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suggest renaming this to |
||||||
accessor=Accessor('fhrp_group_assignments'), | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
We should reference the IP assignments directly to ensure they are prefetched when the table column is displayed. |
||||||
template_code=INTERFACE_VIRTUAL_IPS, | ||||||
orderable=False, | ||||||
verbose_name=_('Virtual IPs') | ||||||
) | ||||||
fhrp_groups = tables.TemplateColumn( | ||||||
accessor=Accessor('fhrp_group_assignments'), | ||||||
template_code=INTERFACE_FHRPGROUPS, | ||||||
|
@@ -637,8 +643,8 @@ class Meta(DeviceComponentTable.Meta): | |||||
'speed', 'speed_formatted', 'duplex', 'mode', 'mac_address', 'wwn', 'poe_mode', 'poe_type', 'rf_role', 'rf_channel', | ||||||
'rf_channel_frequency', 'rf_channel_width', 'tx_power', 'description', 'mark_connected', 'cable', | ||||||
'cable_color', 'wireless_link', 'wireless_lans', 'link_peer', 'connection', 'tags', 'vdcs', 'vrf', 'l2vpn', | ||||||
'tunnel', 'ip_addresses', 'fhrp_groups', 'untagged_vlan', 'tagged_vlans', 'inventory_items', 'created', | ||||||
'last_updated', | ||||||
'tunnel', 'ip_addresses', 'virtual_ips', 'fhrp_groups', 'untagged_vlan', 'tagged_vlans', 'inventory_items', | ||||||
'created', 'last_updated', | ||||||
) | ||||||
default_columns = ('pk', 'name', 'device', 'label', 'enabled', 'type', 'description') | ||||||
|
||||||
|
@@ -675,7 +681,7 @@ class Meta(DeviceComponentTable.Meta): | |||||
'mgmt_only', 'mtu', 'mode', 'mac_address', 'wwn', 'rf_role', 'rf_channel', 'rf_channel_frequency', | ||||||
'rf_channel_width', 'tx_power', 'description', 'mark_connected', 'cable', 'cable_color', 'wireless_link', | ||||||
'wireless_lans', 'link_peer', 'connection', 'tags', 'vdcs', 'vrf', 'l2vpn', 'tunnel', 'ip_addresses', | ||||||
'fhrp_groups', 'untagged_vlan', 'tagged_vlans', 'actions', | ||||||
'virtual_ips', 'fhrp_groups', 'untagged_vlan', 'tagged_vlans', 'actions', | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This also needs to be added to VirtualMachineVMInterfaceTable. |
||||||
) | ||||||
default_columns = ( | ||||||
'pk', 'name', 'label', 'enabled', 'type', 'parent', 'lag', 'mtu', 'mode', 'description', 'ip_addresses', | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be a
ManyToManyColumn
withlinkify_item=True
IMO. We should avoid custom template code where possible.