Closes #7551: Add UI field to filter interfaces by kind

This commit is contained in:
jeremystretch 2021-10-19 15:57:02 -04:00
parent eb4b4a6c8d
commit 73f2f9fc63
3 changed files with 19 additions and 1 deletions

View File

@ -4,6 +4,7 @@
### Enhancements ### Enhancements
* [#7551](https://github.com/netbox-community/netbox/issues/7551) - Add UI field to filter interfaces by kind
* [#7561](https://github.com/netbox-community/netbox/issues/7561) - Add a utilization column to the IP ranges table * [#7561](https://github.com/netbox-community/netbox/issues/7561) - Add a utilization column to the IP ranges table
### Bug Fixes ### Bug Fixes

View File

@ -685,6 +685,18 @@ class PowerOutletFeedLegChoices(ChoiceSet):
# Interfaces # Interfaces
# #
class InterfaceKindChoices(ChoiceSet):
KIND_PHYSICAL = 'physical'
KIND_VIRTUAL = 'virtual'
KIND_WIRELESS = 'wireless'
CHOICES = (
(KIND_PHYSICAL, 'Physical'),
(KIND_VIRTUAL, 'Virtual'),
(KIND_WIRELESS, 'Wireless'),
)
class InterfaceTypeChoices(ChoiceSet): class InterfaceTypeChoices(ChoiceSet):
# Virtual # Virtual

View File

@ -957,9 +957,14 @@ class InterfaceFilterForm(DeviceComponentFilterForm):
model = Interface model = Interface
field_groups = [ field_groups = [
['q', 'tag'], ['q', 'tag'],
['name', 'label', 'type', 'enabled', 'mgmt_only', 'mac_address'], ['name', 'label', 'kind', 'type', 'enabled', 'mgmt_only', 'mac_address'],
['region_id', 'site_group_id', 'site_id', 'location_id', 'device_id'], ['region_id', 'site_group_id', 'site_id', 'location_id', 'device_id'],
] ]
kind = forms.MultipleChoiceField(
choices=InterfaceKindChoices,
required=False,
widget=StaticSelectMultiple()
)
type = forms.MultipleChoiceField( type = forms.MultipleChoiceField(
choices=InterfaceTypeChoices, choices=InterfaceTypeChoices,
required=False, required=False,