diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index b370b81ad6..8e6c21594f 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,11 @@ +2013-06-05 Miguel de Dios + + * include/constants.php, include/functions_agents.php, + operation/agentes/estado_agente.php: fixed the filter of the list + of agents. + + Fixes: #2269 + 2013-06-05 Miguel de Dios * include/functions.php: cleaned source code style. diff --git a/pandora_console/include/constants.php b/pandora_console/include/constants.php index 424d209286..c883f879b9 100644 --- a/pandora_console/include/constants.php +++ b/pandora_console/include/constants.php @@ -144,7 +144,14 @@ define('AGENT_MODULE_STATUS_WARNING', 2); define('AGENT_MODULE_STATUS_UNKNOW', 3); define('AGENT_MODULE_STATUS_NOT_INIT', 5); - +/* Agent module status */ +define('AGENT_STATUS_ALL', -1); +define('AGENT_STATUS_CRITICAL', 1); +define('AGENT_STATUS_NORMAL', 0); +define('AGENT_STATUS_NOT_INIT', 5); +define('AGENT_STATUS_NOT_NORMAL', 6); +define('AGENT_STATUS_UNKNOW', 3); +define('AGENT_STATUS_WARNING', 2); /* Visual maps contants */ //The items kind diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index 4b66b8944d..fea9669390 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -268,27 +268,27 @@ function agents_get_agents ($filter = false, $fields = false, $access = 'AR', $o $status_sql = ' 1 = 1'; if (isset($filter['status'])) { switch ($filter['status']) { - case AGENT_MODULE_STATUS_NORMAL: + case AGENT_STATUS_NORMAL: $status_sql = "normal_count = total_count"; break; - case AGENT_MODULE_STATUS_WARNING: + case AGENT_STATUS_WARNING: $status_sql = "critical_count = 0 AND warning_count > 0"; break; - case AGENT_MODULE_STATUS_CRITICAL_BAD: + case AGENT_STATUS_CRITICAL: $status_sql = "critical_count > 0"; break; - case AGENT_MODULE_STATUS_UNKNOW: + case AGENT_STATUS_UNKNOW: $status_sql = "critical_count = 0 AND warning_count = 0 AND unknown_count > 0"; break; - case AGENT_MODULE_STATUS_NO_DATA: + case AGENT_STATUS_NOT_NORMAL: $status_sql = "normal_count <> total_count"; break; - case AGENT_MODULE_STATUS_NOT_INIT: + case AGENT_STATUS_NOT_INIT: $status_sql = "notinit_count = total_count"; break; } @@ -515,6 +515,7 @@ function agents_process_manage_config ($source_id_agent, $destiny_id_agents, $co $repeated_modules = array(); foreach ($destiny_id_agents as $id_destiny_agent) { foreach ($target_modules as $id_agent_module) { + // Check the module name exists in target $module = modules_get_agentmodule ($id_agent_module); if ($module === false) @@ -530,6 +531,7 @@ function agents_process_manage_config ($source_id_agent, $destiny_id_agents, $co $repeated_modules[] = $modules_repeated; } else { + $result = modules_copy_agent_module_to_agent ($id_agent_module, $id_destiny_agent); @@ -1568,7 +1570,7 @@ function agents_delete_agent ($id_agents, $disableACL = false) { //Convert single values to an array if (! is_array ($id_agents)) - $id_agents = (array) $id_agents; + $id_agents = (array) $id_agents; foreach ($id_agents as $id_agent) { $id_agent = (int) $id_agent; //Cast as integer diff --git a/pandora_console/operation/agentes/estado_agente.php b/pandora_console/operation/agentes/estado_agente.php index dddd41c372..4cca83b3c7 100644 --- a/pandora_console/operation/agentes/estado_agente.php +++ b/pandora_console/operation/agentes/estado_agente.php @@ -173,15 +173,15 @@ html_print_input_text ("search", $search, '', 12); echo ''; $fields = array (); -$fields[0] = __('Normal'); -$fields[2] = __('Warning'); -$fields[1] = __('Critical'); -$fields[3] = __('Unknown'); -$fields[4] = __('Not normal'); -$fields[5] = __('Not init'); +$fields[AGENT_STATUS_NORMAL] = __('Normal'); +$fields[AGENT_STATUS_WARNING] = __('Warning'); +$fields[AGENT_STATUS_CRITICAL] = __('Critical'); +$fields[AGENT_STATUS_UNKNOW] = __('Unknown'); +$fields[AGENT_STATUS_NOT_NORMAL] = __('Not normal'); +$fields[AGENT_STATUS_NOT_INIT] = __('Not init'); echo __('Status') . ' '; -html_print_select ($fields, "status", $status, 'this.form.submit()', __('All'), -1, false, false, true, '', false, 'width: 90px;'); +html_print_select ($fields, "status", $status, 'this.form.submit()', __('All'), AGENT_STATUS_ALL, false, false, true, '', false, 'width: 90px;'); echo ''; @@ -517,14 +517,5 @@ $(document).ready (function () { function () { $(".actions", this).css ("visibility", "hidden"); }); - - $("#group_id").click ( - function () { - $(this).css ("width", "auto"); - }); - - $("#group_id").blur (function () { - $(this).css ("width", "180px"); - }); });