Fix port down alert toggle (#12884)

* Fix port down alert toggle

* Further JS fixes.
This commit is contained in:
Tony Murray
2021-05-18 07:42:15 -05:00
committed by GitHub
parent 5f3537c52e
commit cb739fa2ce

View File

@@ -125,30 +125,24 @@
$('#disable-select').on("click", function (event) {
// select all disable buttons
event.preventDefault();
$('.disable-check').prop('checked', true);
//TODO: find a better solution for 'select-all' button refresh
$('.disable-check').trigger('click');
$('.disable-check').trigger('click');
$('.disable-check').bootstrapSwitch('state', true);
});
$('#ignore-select').on("click", function (event) {
// select all ignore buttons
event.preventDefault();
$('.ignore-check').prop('checked', true);
//TODO: find a better solution for 'select-all' button refresh
$('.ignore-check').trigger('click');
$('.ignore-check').trigger('click');
$('.ignore-check').bootstrapSwitch('state', true);
});
$('#down-select').on("click", function (event) {
// select ignore buttons for all ports which are down
event.preventDefault();
$('[id^="operstatus_"]').each(function () {
var name = $(this).attr('name');
var name = $(this).attr('id');
var text = $(this).text();
if (name && text == 'down') {
if (name && text === 'down') {
// get the interface number from the object name
var port_id = name.split('_')[1];
// find its corresponding checkbox and toggle it
$('input[name="ignore_' + port_id + '"]').trigger('click');
// find its corresponding checkbox and enable it
$('input[name="ignore_' + port_id + '"]').bootstrapSwitch('state', true);
}
});
});
@@ -156,12 +150,12 @@
// toggle ignore buttons for all ports which are in class red
event.preventDefault();
$('.red').each(function () {
var name = $(this).attr('name');
var name = $(this).attr('id');
if (name) {
// get the interface number from the object name
var port_id = name.split('_')[1];
// find its corresponding checkbox and toggle it
$('input[name="ignore_' + port_id + '"]').trigger('click');
// find its corresponding checkbox and enable it
$('input[name="ignore_' + port_id + '"]').bootstrapSwitch('state', true);
}
});
});