mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Merge branch 'develop' into 3840-limit-vlan-choices
This commit is contained in:
11
netbox/project-static/js/configcontext.js
Normal file
11
netbox/project-static/js/configcontext.js
Normal file
@@ -0,0 +1,11 @@
|
||||
$('.rendered-context-format').on('click', function() {
|
||||
if (!$(this).hasClass('active')) {
|
||||
// Update selection in the button group
|
||||
$('span.rendered-context-format').removeClass('active');
|
||||
$('span.rendered-context-format[data-format=' + $(this).data('format') + ']').addClass('active');
|
||||
|
||||
// Hide all rendered contexts and only show the selected one
|
||||
$('div.rendered-context-data').hide();
|
||||
$('div.rendered-context-data[data-format=' + $(this).data('format') + ']').show();
|
||||
}
|
||||
});
|
||||
@@ -2,9 +2,9 @@
|
||||
$('button.toggle-ips').click(function() {
|
||||
var selected = $(this).attr('selected');
|
||||
if (selected) {
|
||||
$('#interfaces_table tr.ipaddresses').hide();
|
||||
$('#interfaces_table tr.interface:visible + tr.ipaddresses').hide();
|
||||
} else {
|
||||
$('#interfaces_table tr.ipaddresses').show();
|
||||
$('#interfaces_table tr.interface:visible + tr.ipaddresses').show();
|
||||
}
|
||||
$(this).attr('selected', !selected);
|
||||
$(this).children('span').toggleClass('glyphicon-check glyphicon-unchecked');
|
||||
@@ -14,17 +14,22 @@ $('button.toggle-ips').click(function() {
|
||||
// Inteface filtering
|
||||
$('input.interface-filter').on('input', function() {
|
||||
var filter = new RegExp(this.value);
|
||||
var interface;
|
||||
|
||||
for (interface of $(this).closest('div.panel').find('tbody > tr')) {
|
||||
for (interface of $('#interfaces_table > tbody > tr.interface')) {
|
||||
// Slice off 'interface_' at the start of the ID
|
||||
if (filter && filter.test(interface.id.slice(10))) {
|
||||
if (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();
|
||||
if ($('button.toggle-ips').attr('selected')) {
|
||||
$(interface).next('tr.ipaddresses').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();
|
||||
$(interface).next('tr.ipaddresses').hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user