mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-25 18:08:38 -06:00
Interface selector restricted to only interface
This commit is contained in:
parent
46d0e88da3
commit
5c5b9c95aa
@ -16,21 +16,20 @@ $('input.interface-filter').on('input', function() {
|
|||||||
var filter = new RegExp(this.value);
|
var filter = new RegExp(this.value);
|
||||||
var interface;
|
var interface;
|
||||||
|
|
||||||
for (interface of $('#interfaces_table > tbody > tr')) {
|
for (interface of $('#interfaces_table > tbody > tr.interface')) {
|
||||||
// Slice off 'interface_' at the start of the ID
|
// Slice off 'interface_' at the start of the ID
|
||||||
if (filter.test(interface.id.slice(10))) {
|
if (filter.test(interface.id.slice(10))) {
|
||||||
// Match the toggle in case the filter now matches the interface
|
// Match the toggle in case the filter now matches the interface
|
||||||
$(interface).find('input:checkbox[name=pk]').prop('checked', $('input.toggle').prop('checked'));
|
$(interface).find('input:checkbox[name=pk]').prop('checked', $('input.toggle').prop('checked'));
|
||||||
$(interface).show();
|
$(interface).show();
|
||||||
|
if ($('button.toggle-ips').attr('selected')) {
|
||||||
|
$(interface).next('tr.ipaddresses').show();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Uncheck to prevent actions from including it when it doesn't match
|
// Uncheck to prevent actions from including it when it doesn't match
|
||||||
$(interface).find('input:checkbox[name=pk]').prop('checked', false);
|
$(interface).find('input:checkbox[name=pk]').prop('checked', false);
|
||||||
$(interface).hide();
|
$(interface).hide();
|
||||||
|
$(interface).next('tr.ipaddresses').hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show the ip addresses table row for the visible (matched) interfaces, if checked
|
|
||||||
if ($('button.toggle-ips').attr('selected')) {
|
|
||||||
$('#interfaces_table > tbody > tr:visible').next('tr.ipaddresses').show();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user