@@ -912,6 +915,22 @@ $('button.toggle-ips').click(function() {
$(this).children('span').toggleClass('glyphicon-check glyphicon-unchecked');
return false;
});
+$('input.interface-filter').on('input', function() {
+ var filter = new RegExp(this.value);
+
+ for (interface of $(this).closest('form').find('tbody > tr')) {
+ // Slice off 'interface_' at the start of the ID
+ if (filter && filter.test(interface.id.slice(10))) {
+ // 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();
+ } else {
+ // Uncheck to prevent actions from including it when it doesn't match
+ $(interface).find('input:checkbox[name=pk]').prop('checked', false);
+ $(interface).hide();
+ }
+ }
+});
diff --git a/netbox/templates/virtualization/virtualmachine.html b/netbox/templates/virtualization/virtualmachine.html
index 2498039ff..736d6bc5c 100644
--- a/netbox/templates/virtualization/virtualmachine.html
+++ b/netbox/templates/virtualization/virtualmachine.html
@@ -253,6 +253,9 @@
Show IPs
+
+
+
@@ -325,5 +328,21 @@ $('button.toggle-ips').click(function() {
$(this).children('span').toggleClass('glyphicon-check glyphicon-unchecked');
return false;
});
+$('input.interface-filter').on('input', function() {
+ var filter = new RegExp(this.value);
+
+ for (interface of $(this).closest('form').find('tbody > tr')) {
+ // Slice off 'interface_' at the start of the ID
+ if (filter && filter.test(interface.id.slice(10))) {
+ // 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();
+ } else {
+ // Uncheck to prevent actions from including it when it doesn't match
+ $(interface).find('input:checkbox[name=pk]').prop('checked', false);
+ $(interface).hide();
+ }
+ }
+});
{% endblock %}