2012-03-13 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_visual_map.php,
	include/ajax/visual_console_builder.ajax.php: fixed the show value in the
	item simple value, now show formated and with units.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5755 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2012-03-13 13:14:28 +00:00
parent 49a514bb62
commit 8345131eb5
3 changed files with 74 additions and 20 deletions

View File

@ -1,3 +1,9 @@
2012-03-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_visual_map.php,
include/ajax/visual_console_builder.ajax.php: fixed the show value in the
item simple value, now show formated and with units.
2012-03-13 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/functions_graph.php: Removed legend in

View File

@ -90,30 +90,45 @@ switch ($action) {
$layoutData = db_get_row_filter('tlayout_data', array('id' => $id_element));
switch ($layoutData['type']) {
case SIMPLE_VALUE_MAX:
$unit = db_get_sql ('SELECT unit FROM tagente_modulo WHERE id_agente_modulo = ' . $layoutData['id_agente_modulo']);
$unit = trim(io_safe_output($unit));
$value = reporting_get_agentmodule_data_max ($layoutData['id_agente_modulo'], 86400, 0);
if ($value === false) {
$returnValue = __('Unknown');
}
else {
$returnValue = format_numeric ($value);
$returnValue = format_for_graph($returnValue, 2);
if (!empty($unit_text))
$returnValue .= " " . $unit_text;
}
break;
case SIMPLE_VALUE_MIN:
$unit = db_get_sql ('SELECT unit FROM tagente_modulo WHERE id_agente_modulo = ' . $layoutData['id_agente_modulo']);
$unit = trim(io_safe_output($unit));
$value = reporting_get_agentmodule_data_min ($layoutData['id_agente_modulo'], 86400, 0);
if ($value === false) {
$returnValue = __('Unknown');
}
else {
$returnValue = format_numeric ($value);
$returnValue = format_for_graph($returnValue, 2);
if (!empty($unit_text))
$returnValue .= " " . $unit_text;
}
break;
case SIMPLE_VALUE_AVG:
$unit = db_get_sql ('SELECT unit FROM tagente_modulo WHERE id_agente_modulo = ' . $layoutData['id_agente_modulo']);
$unit = trim(io_safe_output($unit));
$value = reporting_get_agentmodule_data_average ($layoutData['id_agente_modulo'], 86400, 0);
if ($value === false) {
$returnValue = __('Unknown');
}
else {
$returnValue = format_numeric ($value);
$returnValue = format_for_graph($returnValue, 2);
if (!empty($unit_text))
$returnValue .= " " . $unit_text;
}
break;
case PERCENTILE_BAR:

View File

@ -234,27 +234,41 @@ function visual_map_print_item($layoutData) {
case SIMPLE_VALUE_MAX:
case SIMPLE_VALUE_MIN:
case SIMPLE_VALUE_AVG:
$unit_text = db_get_sql ('SELECT unit FROM tagente_modulo WHERE id_agente_modulo = ' . $id_module);
$unit_text = trim(io_safe_output($unit_text));
echo '<div id="' . $id . '" class="item simple_value" style="left: 0px; top: 0px; color: ' . $color . '; text-align: center; position: absolute; display: inline-block; ' . $sizeStyle . ' top: ' . $top . 'px; left: ' . $left . 'px;">';
echo $text;
switch ($type){
case SIMPLE_VALUE:
echo ' <strong>' . db_get_value ('datos', 'tagente_estado', 'id_agente_modulo', $id_module) . '</strong>';
$value = db_get_value ('datos', 'tagente_estado', 'id_agente_modulo', $id_module);
$value = format_for_graph($value, 2);
if (!empty($unit_text))
$value .= " " . $unit_text;
echo ' <strong>' . $value . '</strong>';
break;
case SIMPLE_VALUE_MAX:
$value = reporting_get_agentmodule_data_max ($id_module, 86400, 0);
if ($value === false) {
$value = __('Unknown');
} else {
$value = format_numeric ($value);
}
}
else {
$value = format_for_graph($value, 2);
if (!empty($unit_text))
$value .= " " . $unit_text;
}
echo ' <strong> ' . $value . '</strong>';
break;
case SIMPLE_VALUE_MIN:
$value = reporting_get_agentmodule_data_min ($id_module, 86400, 0);
if ($value === false) {
$value = __('Unknown');
} else {
$value = format_numeric ($value);
}
else {
$value = format_for_graph($value, 2);
if (!empty($unit_text))
$value .= " " . $unit_text;
}
echo ' <strong> ' . $value . '</strong>';
break;
@ -262,8 +276,11 @@ function visual_map_print_item($layoutData) {
$value = reporting_get_agentmodule_data_average ($id_module, 86400, 0);
if ($value === false) {
$value = __('Unknown');
} else {
$value = format_numeric ($value);
}
else {
$value = format_for_graph($value, 2);
if (!empty($unit_text))
$value .= " " . $unit_text;
}
echo ' <strong> ' . $value . '</strong>';
break;
@ -964,6 +981,9 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
// ****************************************************************
// SIMPLE DATA VALUE (type = 2)
// ****************************************************************
$unit_text = db_get_sql ('SELECT unit FROM tagente_modulo WHERE id_agente_modulo = ' . $id_module);
$unit_text = trim(io_safe_output($unit_text));
if ($resizedMap)
echo '<div style="left: 0px; top: 0px; z-index: 1; color: '.$layout_data['label_color'].'; position: absolute; margin-left: '.((integer)($proportion *$layout_data['pos_x'])).'px; margin-top:'.((integer)($proportion *$layout_data['pos_y'])).'px;" id="layout-data-'.$layout_data['id'].'" class="layout-data">';
else
@ -1000,14 +1020,21 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
//TODO: change interface to add a period parameter, now is set to 1 day
switch ($layout_data['type']){
case 2:
echo db_get_value ('datos', 'tagente_estado', 'id_agente_modulo', $layout_data['id_agente_modulo']);
$value = db_get_value ('datos', 'tagente_estado', 'id_agente_modulo', $layout_data['id_agente_modulo']);
$value = format_for_graph($value, 2);
if (!empty($unit_text))
$value .= " " . $unit_text;
echo $value;
break;
case 6:
$value = reporting_get_agentmodule_data_max ($layout_data['id_agente_modulo'], 86400, 0);
if ($value === false) {
$value = __('Unknown');
} else {
$value = format_numeric ($value);
}
else {
$value = format_for_graph($value, 2);
if (!empty($unit_text))
$value .= " " . $unit_text;
}
echo $value;
break;
@ -1015,18 +1042,24 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
$value = reporting_get_agentmodule_data_min ($layout_data['id_agente_modulo'], 86400, 0);
if ($value === false) {
$value = __('Unknown');
} else {
$value = format_numeric ($value);
}
}
else {
$value = format_for_graph($value, 2);
if (!empty($unit_text))
$value .= " " . $unit_text;
}
echo $value;
break;
case 8:
$value = reporting_get_agentmodule_data_average($layout_data['id_agente_modulo'], 86400, 0);
if ($value === false) {
$value = __('Unknown');
} else {
$value = format_numeric ($value);
}
}
else {
$value = format_for_graph($value, 2);
if (!empty($unit_text))
$value .= " " . $unit_text;
}
echo $value;
break;
}