diff --git a/docs/release-notes/version-2.10.md b/docs/release-notes/version-2.10.md index 1580b9077..ca53d0cbf 100644 --- a/docs/release-notes/version-2.10.md +++ b/docs/release-notes/version-2.10.md @@ -17,6 +17,7 @@ * [#5486](https://github.com/netbox-community/netbox/issues/5486) - Optimize retrieval of config context data for device/VM REST API views * [#5487](https://github.com/netbox-community/netbox/issues/5487) - Support filtering rack type/width with multiple values * [#5498](https://github.com/netbox-community/netbox/issues/5498) - Fix filtering rack reservations by username +* [#5499](https://github.com/netbox-community/netbox/issues/5499) - Fix filtering of displayed device/VM interfaces by regex --- diff --git a/netbox/dcim/tables/devices.py b/netbox/dcim/tables/devices.py index 536be66d9..663206505 100644 --- a/netbox/dcim/tables/devices.py +++ b/netbox/dcim/tables/devices.py @@ -447,7 +447,8 @@ class DeviceInterfaceTable(InterfaceTable): 'connection', 'actions', ) row_attrs = { - 'class': lambda record: record.cable.get_status_class() if record.cable else '' + 'class': lambda record: record.cable.get_status_class() if record.cable else '', + 'data-name': lambda record: record.name, } diff --git a/netbox/project-static/js/interface_filtering.js b/netbox/project-static/js/interface_filtering.js index fecb156f4..51ac70198 100644 --- a/netbox/project-static/js/interface_filtering.js +++ b/netbox/project-static/js/interface_filtering.js @@ -1,11 +1,10 @@ // Inteface filtering $('input.interface-filter').on('input', function() { - var filter = new RegExp(this.value); - var interface; + let filter = new RegExp(this.value); + let interface; for (interface of $('table > tbody > tr')) { - // Slice off 'interface_' at the start of the ID - if (filter.test(interface.id.slice(10))) { + if (filter.test(interface.getAttribute('data-name'))) { // Match the toggle in case the filter now matches the interface $(interface).find('input:checkbox[name=pk]').prop('checked', $('input.toggle').prop('checked')); $(interface).show(); diff --git a/netbox/virtualization/tables.py b/netbox/virtualization/tables.py index 97e1d6e36..34a070623 100644 --- a/netbox/virtualization/tables.py +++ b/netbox/virtualization/tables.py @@ -183,3 +183,6 @@ class VirtualMachineVMInterfaceTable(VMInterfaceTable): default_columns = ( 'pk', 'name', 'enabled', 'mac_address', 'mtu', 'mode', 'description', 'ip_addresses', 'actions', ) + row_attrs = { + 'data-name': lambda record: record.name, + }