change first option value when not_condition its enabled

This commit is contained in:
marcos 2021-08-30 11:19:53 +02:00
parent 2ed657c166
commit 80f4e25b92
2 changed files with 29 additions and 11 deletions

View File

@ -12,7 +12,6 @@ function parse_alert_command(command, classs) {
// Only render values different from '' // Only render values different from ''
var field = "_field" + nfield + "_"; var field = "_field" + nfield + "_";
var regex = new RegExp(field, "gi"); var regex = new RegExp(field, "gi");
console.log($(this).val());
if ($(this).val() == "") { if ($(this).val() == "") {
if ( if (
classs == "fields_recovery" && classs == "fields_recovery" &&

View File

@ -2060,13 +2060,10 @@ function refresh_pagination_callback (module_id, id_agent, server_name,module_na
function changeNotConditionStatus() { function changeNotConditionStatus() {
let chkbox =document.getElementById('not_condition_switch'); let chkbox =document.getElementById('not_condition_switch');
if(chkbox.checked) { if(chkbox.checked) {
document.getElementById("select2-status-container").innerHTML = "None";
document.getElementById("select2-moduletype-container").innerHTML = "None";
document.getElementById("select2-ag_group-container").innerHTML = "None";
document.getElementById("select2-modulegroup-container").innerHTML = "None";
document.getElementById("select2-tag_filter-container").innerHTML = "None";
$('select[name=datatypebox] > option:first-child').val('None'); $('select[name=datatypebox] > option:first-child').val('None');
$('#datatypebox option:first').text('None'); $('#datatypebox option:first').text('None');
$('select[name=status] > option:first-child').text('None'); $('select[name=status] > option:first-child').text('None');
@ -2074,17 +2071,39 @@ function changeNotConditionStatus() {
$('select[name=modulegroup] > option:first-child').text('None'); $('select[name=modulegroup] > option:first-child').text('None');
$('select[name=tag_filter] > option:first-child').text('None'); $('select[name=tag_filter] > option:first-child').text('None');
$("#status").select2().val(["None"]).trigger("change");
$("#moduletype").select2().val(["None"]).trigger("change");
$("#modulegroup").select2().val(["None"]).trigger("change");
$("#tag_filter").select2().val(["None"]).trigger("change");
document.getElementById("select2-status-container").innerHTML = "None";
document.getElementById("select2-moduletype-container").innerHTML = "None";
document.getElementById("select2-ag_group-container").innerHTML = "None";
document.getElementById("select2-modulegroup-container").innerHTML = "None";
document.getElementById("select2-tag_filter-container").innerHTML = "None";
}else { }else {
document.getElementById("select2-status-container").innerHTML = "All"; $('select[name=datatypebox] > option:first-child').val('All');
document.getElementById("select2-moduletype-container").innerHTML = "All";
document.getElementById("select2-ag_group-container").innerHTML = "All";
document.getElementById("select2-modulegroup-container").innerHTML = "All";
document.getElementById("select2-tag_filter-container").innerHTML = "All";
$('#datatypebox option:first').text('All'); $('#datatypebox option:first').text('All');
$('select[name=status] > option:first-child').text('All'); $('select[name=status] > option:first-child').text('All');
$('select[name=moduletype] > option:first-child').text('All'); $('select[name=moduletype] > option:first-child').text('All');
$('select[name=modulegroup] > option:first-child').text('All'); $('select[name=modulegroup] > option:first-child').text('All');
$('select[name=tag_filter] > option:first-child').text('All'); $('select[name=tag_filter] > option:first-child').text('All');
$('#datatypebox option:first').text('All');
$("#status").select2().val(["All"]).trigger("change");
$("#moduletype").select2().val(["All"]).trigger("change");
$("#modulegroup").select2().val(["All"]).trigger("change");
$("#tag_filter").select2().val(["All"]).trigger("change");
document.getElementById("select2-status-container").innerHTML = "All";
document.getElementById("select2-moduletype-container").innerHTML = "All";
document.getElementById("select2-ag_group-container").innerHTML = "All";
document.getElementById("select2-modulegroup-container").innerHTML = "All";
document.getElementById("select2-tag_filter-container").innerHTML = "All";
} }
} }