fix block selector in snmp wizards

This commit is contained in:
alejandro.campos@artica.es 2021-10-05 16:51:13 +02:00
parent d1b9dc4ef8
commit 4016d97c39
1 changed files with 19 additions and 13 deletions

View File

@ -1227,7 +1227,7 @@ class AgentWizard extends HTML
$this->idPolicy, $this->idPolicy,
io_safe_input($module['name']) io_safe_input($module['name'])
); );
$msgError = __('Module exist in policy'); $msgError = __('Module exists in policy');
} else { } else {
$sql = sprintf( $sql = sprintf(
"SELECT id_agente_modulo "SELECT id_agente_modulo
@ -1237,7 +1237,7 @@ class AgentWizard extends HTML
$this->idAgent, $this->idAgent,
io_safe_input($module['name']) io_safe_input($module['name'])
); );
$msgError = __('Module exist in agent'); $msgError = __('Module exists in agent');
} }
$existInDb = db_get_value_sql($sql); $existInDb = db_get_value_sql($sql);
@ -1931,7 +1931,7 @@ class AgentWizard extends HTML
// Already defined. // Already defined.
$this->message['type'][] = 'error'; $this->message['type'][] = 'error';
$this->message['message'][] = __( $this->message['message'][] = __(
'Module "%s" exits in this agent', 'Module "%s" exists in this agent',
$candidate['name'] $candidate['name']
); );
$errorflag = true; $errorflag = true;
@ -5681,22 +5681,28 @@ class AgentWizard extends HTML
.parent() .parent()
.removeClass("alpha50"); .removeClass("alpha50");
if (selectedBlock.prop("checked")) { if (selectedBlock.prop("checked")) {
// Set to active the values of fields. // Set all inputs in block to checked.
for (i = 0; i<=15; i++) { var blockItems = document.querySelectorAll('[id^="hidden-module-active-'+switchName[2]+'"]');
document.getElementById("hidden-module-active-" + switchName[2] + "_"+i+"-"+i).value = 1;
} blockItems.forEach(function(item) {
// Set checked. item.value = 1;
});
// Set block selector to checked.
$("[id*=checkbox-sel_module_" + blockNumber + "]") $("[id*=checkbox-sel_module_" + blockNumber + "]")
.each(function() { .each(function() {
$(this).prop("checked", true); $(this).prop("checked", true);
}); });
imageInfoModules.removeClass('hidden'); imageInfoModules.removeClass('hidden');
} else { } else {
// Set to inactive the values of fields. // Set all inputs in block to unchecked.
for (i = 0; i<=15; i++) { var blockItems = document.querySelectorAll('[id^="hidden-module-active-'+switchName[2]+'"]');
document.getElementById("hidden-module-active-" + switchName[2] + "_"+i+"-"+i).value = 0;
} blockItems.forEach(function(item) {
// Set unchecked. item.value = 0;
});
// Set block selector to unchecked.
$("[id*=checkbox-sel_module_" + blockNumber + "]") $("[id*=checkbox-sel_module_" + blockNumber + "]")
.each(function() { .each(function() {
$(this).prop("checked", false); $(this).prop("checked", false);