Closes #2057: Added description columns to interface connections list

This commit is contained in:
Jeremy Stretch 2018-11-05 14:41:51 -05:00
parent 82076d3ca6
commit e57b3bc4ab
3 changed files with 12 additions and 1 deletions

View File

@ -27,6 +27,7 @@ NetBox now supports modeling physical cables for console, power, and interface c
* [#1444](https://github.com/digitalocean/netbox/issues/1444) - Added an `asset_tag` field for racks * [#1444](https://github.com/digitalocean/netbox/issues/1444) - Added an `asset_tag` field for racks
* [#1931](https://github.com/digitalocean/netbox/issues/1931) - Added a count of assigned IP addresses to the interface API serializer * [#1931](https://github.com/digitalocean/netbox/issues/1931) - Added a count of assigned IP addresses to the interface API serializer
* [#2000](https://github.com/digitalocean/netbox/issues/2000) - Dropped support for Python 2 * [#2000](https://github.com/digitalocean/netbox/issues/2000) - Dropped support for Python 2
* [#2057](https://github.com/digitalocean/netbox/issues/2057) - Added description columns to interface connections list
* [#2104](https://github.com/digitalocean/netbox/issues/2104) - Added a `status` field for racks * [#2104](https://github.com/digitalocean/netbox/issues/2104) - Added a `status` field for racks
* [#2165](https://github.com/digitalocean/netbox/issues/2165) - Improved natural ordering of Interfaces * [#2165](https://github.com/digitalocean/netbox/issues/2165) - Improved natural ordering of Interfaces
* [#2292](https://github.com/digitalocean/netbox/issues/2292) - Removed the deprecated UserAction model * [#2292](https://github.com/digitalocean/netbox/issues/2292) - Removed the deprecated UserAction model

View File

@ -716,6 +716,10 @@ class InterfaceConnectionTable(BaseTable):
args=[Accessor('pk')], args=[Accessor('pk')],
verbose_name='Interface A' verbose_name='Interface A'
) )
description_a = tables.Column(
accessor=Accessor('description'),
verbose_name='Description'
)
device_b = tables.LinkColumn( device_b = tables.LinkColumn(
viewname='dcim:device', viewname='dcim:device',
accessor=Accessor('connected_endpoint.device'), accessor=Accessor('connected_endpoint.device'),
@ -728,6 +732,10 @@ class InterfaceConnectionTable(BaseTable):
args=[Accessor('connected_endpoint.pk')], args=[Accessor('connected_endpoint.pk')],
verbose_name='Interface B' verbose_name='Interface B'
) )
description_b = tables.Column(
accessor=Accessor('connected_endpoint.description'),
verbose_name='Description'
)
cable = tables.LinkColumn( cable = tables.LinkColumn(
viewname='dcim:cable', viewname='dcim:cable',
args=[Accessor('cable.pk')] args=[Accessor('cable.pk')]
@ -735,7 +743,7 @@ class InterfaceConnectionTable(BaseTable):
class Meta(BaseTable.Meta): class Meta(BaseTable.Meta):
model = Interface model = Interface
fields = ('device_a', 'interface_a', 'device_b', 'interface_b', 'cable') fields = ('device_a', 'interface_a', 'description_a', 'device_b', 'interface_b', 'description_b', 'cable')
# #

View File

@ -1732,6 +1732,8 @@ class InterfaceConnectionsListView(ObjectListView):
# Avoid duplicate connections by only selecting the lower PK in a connected pair # Avoid duplicate connections by only selecting the lower PK in a connected pair
_connected_interface__isnull=False, _connected_interface__isnull=False,
pk__lt=F('_connected_interface') pk__lt=F('_connected_interface')
).order_by(
'device'
) )
filter = filters.InterfaceConnectionFilter filter = filters.InterfaceConnectionFilter
filter_form = forms.InterfaceConnectionFilterForm filter_form = forms.InterfaceConnectionFilterForm