2013-06-05 Miguel de Dios <miguel.dedios@artica.es>

* include/constants.php, include/functions_agents.php,
	operation/agentes/estado_agente.php: fixed the filter of the list
	of agents.
	
	Fixes: #2269




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8260 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-06-05 14:36:13 +00:00
parent 3bf0cd67cb
commit bfc822b1aa
4 changed files with 32 additions and 24 deletions

View File

@ -1,3 +1,11 @@
2013-06-05 Miguel de Dios <miguel.dedios@artica.es>
* 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 <miguel.dedios@artica.es> 2013-06-05 Miguel de Dios <miguel.dedios@artica.es>
* include/functions.php: cleaned source code style. * include/functions.php: cleaned source code style.

View File

@ -144,7 +144,14 @@ define('AGENT_MODULE_STATUS_WARNING', 2);
define('AGENT_MODULE_STATUS_UNKNOW', 3); define('AGENT_MODULE_STATUS_UNKNOW', 3);
define('AGENT_MODULE_STATUS_NOT_INIT', 5); 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 */ /* Visual maps contants */
//The items kind //The items kind

View File

@ -268,27 +268,27 @@ function agents_get_agents ($filter = false, $fields = false, $access = 'AR', $o
$status_sql = ' 1 = 1'; $status_sql = ' 1 = 1';
if (isset($filter['status'])) { if (isset($filter['status'])) {
switch ($filter['status']) { switch ($filter['status']) {
case AGENT_MODULE_STATUS_NORMAL: case AGENT_STATUS_NORMAL:
$status_sql = $status_sql =
"normal_count = total_count"; "normal_count = total_count";
break; break;
case AGENT_MODULE_STATUS_WARNING: case AGENT_STATUS_WARNING:
$status_sql = $status_sql =
"critical_count = 0 AND warning_count > 0"; "critical_count = 0 AND warning_count > 0";
break; break;
case AGENT_MODULE_STATUS_CRITICAL_BAD: case AGENT_STATUS_CRITICAL:
$status_sql = $status_sql =
"critical_count > 0"; "critical_count > 0";
break; break;
case AGENT_MODULE_STATUS_UNKNOW: case AGENT_STATUS_UNKNOW:
$status_sql = $status_sql =
"critical_count = 0 AND warning_count = 0 "critical_count = 0 AND warning_count = 0
AND unknown_count > 0"; AND unknown_count > 0";
break; break;
case AGENT_MODULE_STATUS_NO_DATA: case AGENT_STATUS_NOT_NORMAL:
$status_sql = "normal_count <> total_count"; $status_sql = "normal_count <> total_count";
break; break;
case AGENT_MODULE_STATUS_NOT_INIT: case AGENT_STATUS_NOT_INIT:
$status_sql = "notinit_count = total_count"; $status_sql = "notinit_count = total_count";
break; break;
} }
@ -515,6 +515,7 @@ function agents_process_manage_config ($source_id_agent, $destiny_id_agents, $co
$repeated_modules = array(); $repeated_modules = array();
foreach ($destiny_id_agents as $id_destiny_agent) { foreach ($destiny_id_agents as $id_destiny_agent) {
foreach ($target_modules as $id_agent_module) { foreach ($target_modules as $id_agent_module) {
// Check the module name exists in target // Check the module name exists in target
$module = modules_get_agentmodule ($id_agent_module); $module = modules_get_agentmodule ($id_agent_module);
if ($module === false) if ($module === false)
@ -530,6 +531,7 @@ function agents_process_manage_config ($source_id_agent, $destiny_id_agents, $co
$repeated_modules[] = $modules_repeated; $repeated_modules[] = $modules_repeated;
} }
else { else {
$result = modules_copy_agent_module_to_agent ($id_agent_module, $result = modules_copy_agent_module_to_agent ($id_agent_module,
$id_destiny_agent); $id_destiny_agent);
@ -1568,7 +1570,7 @@ function agents_delete_agent ($id_agents, $disableACL = false) {
//Convert single values to an array //Convert single values to an array
if (! is_array ($id_agents)) if (! is_array ($id_agents))
$id_agents = (array) $id_agents; $id_agents = (array) $id_agents;
foreach ($id_agents as $id_agent) { foreach ($id_agents as $id_agent) {
$id_agent = (int) $id_agent; //Cast as integer $id_agent = (int) $id_agent; //Cast as integer

View File

@ -173,15 +173,15 @@ html_print_input_text ("search", $search, '', 12);
echo '</td><td style="white-space:nowrap;">'; echo '</td><td style="white-space:nowrap;">';
$fields = array (); $fields = array ();
$fields[0] = __('Normal'); $fields[AGENT_STATUS_NORMAL] = __('Normal');
$fields[2] = __('Warning'); $fields[AGENT_STATUS_WARNING] = __('Warning');
$fields[1] = __('Critical'); $fields[AGENT_STATUS_CRITICAL] = __('Critical');
$fields[3] = __('Unknown'); $fields[AGENT_STATUS_UNKNOW] = __('Unknown');
$fields[4] = __('Not normal'); $fields[AGENT_STATUS_NOT_NORMAL] = __('Not normal');
$fields[5] = __('Not init'); $fields[AGENT_STATUS_NOT_INIT] = __('Not init');
echo __('Status') . '&nbsp;'; echo __('Status') . '&nbsp;';
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 '</td><td style="white-space:nowrap;">'; echo '</td><td style="white-space:nowrap;">';
@ -517,14 +517,5 @@ $(document).ready (function () {
function () { function () {
$(".actions", this).css ("visibility", "hidden"); $(".actions", this).css ("visibility", "hidden");
}); });
$("#group_id").click (
function () {
$(this).css ("width", "auto");
});
$("#group_id").blur (function () {
$(this).css ("width", "180px");
});
}); });
</script> </script>