From 16c2d2e811af2e1cb3fbe507dc57afcd12bd4921 Mon Sep 17 00:00:00 2001 From: raulmateos Date: Thu, 13 May 2010 18:29:46 +0000 Subject: [PATCH] 2010-05-13 Raul Mateos * operation/agentes/group_view.php: Clean code. Close tags. Now, if there's no agent, it shows a text. Inefficient? * godmode/agentes/agent_manager: Solved typo with .png files, but those files doesn't exists in repository... * ChangeLog: Changed date error from my last commit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2725 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 10 +++- .../godmode/agentes/agent_manager.php | 12 ++--- .../operation/agentes/group_view.php | 49 ++++++++++++++----- 3 files changed, 51 insertions(+), 20 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 312fd9d89a..ee4fb476b2 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,4 +1,12 @@ -2010-05-11 Raúl Mateos +2010-05-13 Raúl Mateos + + * operation/agentes/group_view.php: Clean code. Close tags. Now, if + there's no agent, it shows a text. Inefficient? + + * godmode/agentes/agent_manager: Solved typo with .png files, but + those files doesn't exists in repository... + +2010-05-13 Raúl Mateos * install.php: Updated year. Clean code. diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index 69c9e6b6fb..04d4df6956 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -212,11 +212,11 @@ $path = 'images/gis_map/icons/'; //TODO set better method the path $table->data[12][0] = __('Agent icon'); $table->data[12][1] = print_select($arraySelectIcon, "icon_path", $icon_path, "changeIcons();", __('None'), '', true) . - ' ' . __('Without status') . ': ' . - ' ' . __('Default') . ': ' . - ' ' . __('Ok') . ': ' . - ' ' . __('Bad') . ': ' . - ' ' . __('Warning') . ': '; + ' ' . __('Without status') . ': ' . + ' ' . __('Default') . ': ' . + ' ' . __('Ok') . ': ' . + ' ' . __('Bad') . ': ' . + ' ' . __('Warning') . ': '; if ($config['activate_gis']) { $table->data[13][0] = __('Ignore new GIS data:'); @@ -272,7 +272,7 @@ function changeIcons() { //$("#icon_default").attr("src", "" + icon + } - + $(document).ready (function () { $("select#id_os").pandoraSelectOS (); $("#text-id_parent").autocomplete ("ajax.php", diff --git a/pandora_console/operation/agentes/group_view.php b/pandora_console/operation/agentes/group_view.php index 075e85253c..052239bded 100644 --- a/pandora_console/operation/agentes/group_view.php +++ b/pandora_console/operation/agentes/group_view.php @@ -61,18 +61,30 @@ $counter = 1; // Old style table, we need a lot of special formatting,don't use table function // Prepare old-style table + +foreach ($groups as $id_group) { + $data = get_group_stats($id_group); + + if ($data["total_agents"] == 0) { + $agents = 0; + } else { + $agents = 1; + } +} +if ($agents == 1) { + echo ''; echo ""; -echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; // For each valid group for this user, take data from agent and modules foreach ($groups as $id_group => $group_name) { @@ -109,10 +121,10 @@ foreach ($groups as $id_group => $group_name) { echo ""; if (give_acl ($config['id_user'], $id_group, "AW")) { - echo ' '; - echo " "; + echo ' '; + echo " "; } - + echo ""; // Total agents echo ""; } else { echo ""; } @@ -132,6 +145,7 @@ foreach ($groups as $id_group => $group_name) { if ($data["monitor_unknown"] > 0){ echo ""; } else { echo ""; } @@ -141,6 +155,7 @@ foreach ($groups as $id_group => $group_name) { if ($data["monitor_non_init"] > 0){ echo ""; } else { echo ""; } @@ -152,11 +167,13 @@ foreach ($groups as $id_group => $group_name) { echo $data["monitor_ok"]; else echo " "; + echo ""; // Monitors Warning if ($data["monitor_warning"] > 0){ echo ""; } else { echo ""; } @@ -165,6 +182,7 @@ foreach ($groups as $id_group => $group_name) { if ($data["monitor_critical"] > 0){ echo ""; } else { echo ""; } @@ -172,16 +190,21 @@ foreach ($groups as $id_group => $group_name) { if ($data["monitor_alerts_fired"] > 0){ echo ""; } else { echo ""; } echo ""; - echo ""; + echo ""; } echo "
".__("Group"); -echo "".__("Agents"); -echo "".__("Agent unknown"); -echo "".__("Unknown"); -echo "".__("Not Init"); -echo "".__("Normal"); -echo "".__("Warning"); -echo "".__("Critical"); -echo "".__("Alert fired"); +echo "".__("Group")."".__("Agents")."".__("Agent unknown")."".__("Unknown")."".__("Not Init")."".__("Normal")."".__("Warning")."".__("Critical")."".__("Alert fired").""; @@ -124,6 +136,7 @@ foreach ($groups as $id_group => $group_name) { if ($data["agents_unknown"] > 0) { echo ""; echo $data["agents_unknown"]; + echo ""; echo $data["monitor_unknown"]; + echo ""; echo $data["monitor_non_init"]; + echo ""; echo $data["monitor_warning"]; + echo ""; echo $data["monitor_critical"]; + echo ""; echo $data["monitor_alerts_fired"]; + echo "
"; +} else { + echo "
".__('There are no defined agents')."
"; +} + ?>