mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Fixes #5499: Fix filtering of displayed device/VM interfaces by regex
This commit is contained in:
@ -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,
|
||||
}
|
||||
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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,
|
||||
}
|
||||
|
Reference in New Issue
Block a user