Skip to content

Commit 73f2f9f

Browse files
committed
Closes #7551: Add UI field to filter interfaces by kind
1 parent eb4b4a6 commit 73f2f9f

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

docs/release-notes/version-3.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### Enhancements
66

7+
* [#7551](https://github.com/netbox-community/netbox/issues/7551) - Add UI field to filter interfaces by kind
78
* [#7561](https://github.com/netbox-community/netbox/issues/7561) - Add a utilization column to the IP ranges table
89

910
### Bug Fixes

netbox/dcim/choices.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,18 @@ class PowerOutletFeedLegChoices(ChoiceSet):
685685
# Interfaces
686686
#
687687

688+
class InterfaceKindChoices(ChoiceSet):
689+
KIND_PHYSICAL = 'physical'
690+
KIND_VIRTUAL = 'virtual'
691+
KIND_WIRELESS = 'wireless'
692+
693+
CHOICES = (
694+
(KIND_PHYSICAL, 'Physical'),
695+
(KIND_VIRTUAL, 'Virtual'),
696+
(KIND_WIRELESS, 'Wireless'),
697+
)
698+
699+
688700
class InterfaceTypeChoices(ChoiceSet):
689701

690702
# Virtual

netbox/dcim/forms/filtersets.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -957,9 +957,14 @@ class InterfaceFilterForm(DeviceComponentFilterForm):
957957
model = Interface
958958
field_groups = [
959959
['q', 'tag'],
960-
['name', 'label', 'type', 'enabled', 'mgmt_only', 'mac_address'],
960+
['name', 'label', 'kind', 'type', 'enabled', 'mgmt_only', 'mac_address'],
961961
['region_id', 'site_group_id', 'site_id', 'location_id', 'device_id'],
962962
]
963+
kind = forms.MultipleChoiceField(
964+
choices=InterfaceKindChoices,
965+
required=False,
966+
widget=StaticSelectMultiple()
967+
)
963968
type = forms.MultipleChoiceField(
964969
choices=InterfaceTypeChoices,
965970
required=False,

0 commit comments

Comments
 (0)