Browse Source

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

jeremystretch 4 năm trước cách đây
mục cha
commit
73f2f9fc63

+ 1 - 0
docs/release-notes/version-3.0.md

@@ -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

+ 12 - 0
netbox/dcim/choices.py

@@ -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

+ 6 - 1
netbox/dcim/forms/filtersets.py

@@ -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,