1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Closes #7884: Add FHRP groups column to interface tables

This commit is contained in:
jeremystretch
2021-11-19 10:27:56 -05:00
parent 30a5c70260
commit cd128e557c
4 changed files with 21 additions and 6 deletions

View File

@ -14,6 +14,7 @@
* [#7775](https://github.com/netbox-community/netbox/issues/7775) - Enable dynamic config for `CHANGELOG_RETENTION`, `CUSTOM_VALIDATORS`, and `GRAPHQL_ENABLED`
* [#7812](https://github.com/netbox-community/netbox/issues/7812) - Enable change logging for image attachments
* [#7858](https://github.com/netbox-community/netbox/issues/7858) - Standardize the representation of content types across import & export functions
* [#7884](https://github.com/netbox-community/netbox/issues/7884) - Add FHRP groups column to interface tables
### Bug Fixes

View File

@ -475,6 +475,12 @@ class BaseInterfaceTable(BaseTable):
orderable=False,
verbose_name='IP Addresses'
)
fhrp_groups = tables.TemplateColumn(
accessor=Accessor('fhrp_group_assignments'),
template_code=INTERFACE_FHRPGROUPS,
orderable=False,
verbose_name='FHRP Groups'
)
untagged_vlan = tables.Column(linkify=True)
tagged_vlans = TemplateColumn(
template_code=INTERFACE_TAGGED_VLANS,
@ -509,7 +515,7 @@ class InterfaceTable(DeviceComponentTable, BaseInterfaceTable, PathEndpointTable
'pk', 'id', 'name', 'device', 'label', 'enabled', 'type', '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', 'ip_addresses', 'untagged_vlan', 'tagged_vlans',
'tags', 'ip_addresses', 'fhrp_groups', 'untagged_vlan', 'tagged_vlans',
)
default_columns = ('pk', 'name', 'device', 'label', 'enabled', 'type', 'description')
@ -542,9 +548,9 @@ class DeviceInterfaceTable(InterfaceTable):
model = Interface
fields = (
'pk', 'id', 'name', 'label', 'enabled', 'type', 'parent', 'bridge', 'lag', 'mgmt_only', 'mtu', 'mode',
'mac_address', 'wwn', 'rf_role', 'rf_channel', 'rf_channel_width', 'tx_power', 'description',
'mark_connected', 'cable', 'cable_color', 'wireless_link', 'wireless_lans', 'link_peer', 'connection',
'tags', 'ip_addresses', 'untagged_vlan', 'tagged_vlans', 'actions',
'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', 'ip_addresses', 'fhrp_groups', 'untagged_vlan', 'tagged_vlans', 'actions',
)
order_by = ('name',)
default_columns = (

View File

@ -50,6 +50,14 @@ INTERFACE_IPADDRESSES = """
</div>
"""
INTERFACE_FHRPGROUPS = """
<div class="table-badge-group">
{% for assignment in value.all %}
<a href="{{ assignment.group.get_absolute_url }}">{{ assignment.group.group_id }} ({{ assignment.group.get_protocol_display }})</a>
{% endfor %}
</div>
"""
INTERFACE_TAGGED_VLANS = """
{% if record.mode == 'tagged' %}
{% for vlan in record.tagged_vlans.all %}

View File

@ -171,7 +171,7 @@ class VMInterfaceTable(BaseInterfaceTable):
model = VMInterface
fields = (
'pk', 'id', 'name', 'virtual_machine', 'enabled', 'mac_address', 'mtu', 'mode', 'description', 'tags',
'ip_addresses', 'untagged_vlan', 'tagged_vlans',
'ip_addresses', 'fhrp_groups', 'untagged_vlan', 'tagged_vlans',
)
default_columns = ('pk', 'name', 'virtual_machine', 'enabled', 'description')
@ -193,7 +193,7 @@ class VirtualMachineVMInterfaceTable(VMInterfaceTable):
model = VMInterface
fields = (
'pk', 'id', 'name', 'enabled', 'parent', 'bridge', 'mac_address', 'mtu', 'mode', 'description', 'tags',
'ip_addresses', 'untagged_vlan', 'tagged_vlans', 'actions',
'ip_addresses', 'fhrp_groups', 'untagged_vlan', 'tagged_vlans', 'actions',
)
default_columns = (
'pk', 'name', 'enabled', 'mac_address', 'mtu', 'mode', 'description', 'ip_addresses', 'actions',