2011-07-11 Juan Manuel Ramon <juanmanuel.ramon@artica.es>

* include/functions_visual_map.php
	include/ajax/visual_console_builder.ajax.php
	godmode/users/configure_user.php
	godmode/reporting/visual_console_builder.editor.js
	godmode/reporting/visual_console_builder.editor.php
	godmode/reporting/visual_console_builder.constans.php: Added min,
	max and avg process to simple value items in visual maps.
	
	Pending tasks: #3014709



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4541 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
juanmanuelr 2011-07-11 10:16:18 +00:00
parent dbc7ecb2e8
commit aec10bea6b
7 changed files with 162 additions and 10 deletions

View File

@ -1,3 +1,15 @@
2011-07-11 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/functions_visual_map.php
include/ajax/visual_console_builder.ajax.php
godmode/users/configure_user.php
godmode/reporting/visual_console_builder.editor.js
godmode/reporting/visual_console_builder.editor.php
godmode/reporting/visual_console_builder.constans.php: Added min,
max and avg process to simple value items in visual maps.
Pending tasks: #3014709
2011-07-11 Junichi Satoh <junichi@rworks.jp>
* operation/agentes/estado_agente.php,

View File

@ -19,4 +19,7 @@ define('MODULE_GRAPH', 1);
define('SIMPLE_VALUE', 2);
define('LABEL', 4);
define('ICON', 5);
?>
define('SIMPLE_VALUE_MAX', 6);
define('SIMPLE_VALUE_MIN', 7);
define('SIMPLE_VALUE_AVG', 8);
?>

View File

@ -266,6 +266,7 @@ function readFields() {
values['top'] = $("input[name=top]").val();
values['agent'] = $("input[name=agent]").val();
values['module'] = $("select[name=module]").val();
values['process_simple_value'] = $("select[name=process_value]").val();
values['background'] = $("#background_image").val();
values['period'] = $("select[name=period]").val();
values['width'] = $("input[name=width]").val();
@ -420,6 +421,7 @@ function loadFieldsFromDB(item) {
moduleId = val;
$("select[name=module]").val(val);
}
if (key == 'process_value') $("select[name=process_value]").val(val);
if (key == 'period') $("select[name=period]").val(val);
if (key == 'width') $("input[name=width]").val(val);
if (key == 'height') $("input[name=height]").val(val);
@ -522,8 +524,8 @@ function hiddenFields(item) {
$("#agent_row").css('display', 'none');
$("#agent_row." + item).css('display', '');
$("#module_row").css('display', 'none');
$("#module_row." + item).css('display', '');
$("#process_value_row").css('display', 'none');
$("#process_value_row." + item).css('display', '');
$("#background_row_1").css('display', 'none');
$("#background_row_1." + item).css('display', '');
@ -569,6 +571,7 @@ function cleanFields() {
$("input[name=top]").val(0);
$("input[name=agent]").val('');
$("select[name=module]").val('');
$("input[name=process_value]").val('');
$("select[name=background_image]").val('');
$("input[name=width_percentile]").val('');
$("input[name=max_percentile]").val('');

View File

@ -136,6 +136,12 @@ echo '<div id="properties_panel" style="display: none; position: absolute; borde
<td><?php echo __('Module');?></td>
<td><?php html_print_select (array (), 'module', '', '', __('Any'), 0);?></td>
</tr>
<tr id="process_value_row" class="simple_value datos">
<td><?php echo '<span>' . __('Process') . '</span>';?></td>
<td><?php html_print_select (array ('1' => __('Min value'),
'2' => __('Max value'),
'3' => __('Avg value')), 'process_value', '', '', __('None'), 0);?></td>
</tr>
<tr id="background_row_1" class="background datos">
<td><?php echo __('Background');?></td>
<td><?php html_print_select($backgrounds_list, 'background_image', $background, '', 'None', '');?></td>

View File

@ -391,7 +391,7 @@ echo '<br />';
if (empty ($id) || $new_user)
return;
echo '<h3>'.__('Profiles/Groups assigned to this user').'</h3>';
echo '<h4>'.__('Profiles/Groups assigned to this user').'</h4>';
$table->width = '98%';
$table->data = array ();

View File

@ -57,6 +57,7 @@ $max_percentile = get_parameter('max_percentile', null);
$height_module_graph = get_parameter('height_module_graph', null);
$width_module_graph = get_parameter('width_module_graph', null);
$id_agent_module = get_parameter('id_agent_module', 0);
$process_simple_value = get_parameter('process_simple_value', 0);
$get_element_status = get_parameter('get_element_status', 0);
$get_image_path_status = get_parameter('get_image_path_status', 0);
@ -84,8 +85,35 @@ switch ($action) {
break;
case 'get_module_value':
$layoutData = db_get_row_filter('tlayout_data', array('id' => $id_element));
$returnValue = db_get_sql ('SELECT datos FROM tagente_estado WHERE id_agente_modulo = ' . $layoutData['id_agente_modulo']);
switch ($layoutData['type']){
case SIMPLE_VALUE_MAX:
$value = reporting_get_agentmodule_data_max ($layoutData['id_agente_modulo'], 86400, 0);
if ($value === false) {
$returnValue = __('Unknown');
} else {
$returnValue = format_numeric ($value);
}
break;
case SIMPLE_VALUE_MIN:
$value = reporting_get_agentmodule_data_min ($layoutData['id_agente_modulo'], 86400, 0);
if ($value === false) {
$returnValue = __('Unknown');
} else {
$returnValue = format_numeric ($value);
}
break;
case SIMPLE_VALUE_AVG:
$value = reporting_get_agentmodule_data_average ($layoutData['id_agente_modulo'], 86400, 0);
if ($value === false) {
$returnValue = __('Unknown');
} else {
$returnValue = format_numeric ($value);
}
break;
default:
$returnValue = db_get_sql ('SELECT datos FROM tagente_estado WHERE id_agente_modulo = ' . $layoutData['id_agente_modulo']);
break;
}
$return = array();
$return['value'] = $returnValue;
$return['max_percentile'] = $layoutData['height'];
@ -231,6 +259,23 @@ switch ($action) {
$elementFields['height_module_graph'] = $elementFields['height'];
break;
}
//Support for max, min and svg process on simple value items
if ($type == 'simple_value'){
switch ($elementFields['type']) {
case SIMPLE_VALUE:
$elementFields['process_value'] = 0;
break;
case SIMPLE_VALUE_MAX:
$elementFields['process_value'] = 2;
break;
case SIMPLE_VALUE_MIN:
$elementFields['process_value'] = 1;
break;
case SIMPLE_VALUE_AVG:
$elementFields['process_value'] = 3;
break;
}
}
$elementFields['label'] = io_safe_output($elementFields['label']);
echo json_encode($elementFields);
break;
@ -271,7 +316,21 @@ switch ($action) {
$values['height'] = $height;
break;
case 'simple_value':
$values['type'] = SIMPLE_VALUE;
//This allows min, max and avg process in a simple value
switch ($process_simple_value){
case 0:
$values['type'] = SIMPLE_VALUE;
break;
case 1:
$values['type'] = SIMPLE_VALUE_MIN;
break;
case 2:
$values['type'] = SIMPLE_VALUE_MAX;
break;
case 3:
$values['type'] = SIMPLE_VALUE_AVG;
break;
}
break;
case 'label':
$values['type'] = LABEL;

View File

@ -132,9 +132,43 @@ function visual_map_print_item($layoutData) {
echo '</div>';
break;
case SIMPLE_VALUE:
case SIMPLE_VALUE_MAX:
case SIMPLE_VALUE_MIN:
case SIMPLE_VALUE_AVG:
echo '<div id="' . $id . '" class="item simple_value" style="left: 0px; top: 0px; color: ' . $color . '; text-align: center; position: absolute; ' . $sizeStyle . ' margin-top: ' . $top . 'px; margin-left: ' . $left . 'px;">';
echo $text;
echo ' <strong>' . db_get_value ('datos', 'tagente_estado', 'id_agente_modulo', $id_module) . '</strong>';
echo $text;
switch ($type){
case SIMPLE_VALUE:
echo ' <strong>' . db_get_value ('datos', 'tagente_estado', 'id_agente_modulo', $id_module) . '</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);
}
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);
}
echo ' <strong> ' . $value . '</strong>';
break;
case SIMPLE_VALUE_AVG:
$value = reporting_get_agentmodule_data_average ($id_module, 86400, 0);
if ($value === false) {
$value = __('Unknown');
} else {
$value = format_numeric ($value);
}
echo ' <strong> ' . $value . '</strong>';
break;
}
echo '</div>';
break;
case LABEL:
@ -731,6 +765,9 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
echo "</div>";
break;
case 2:
case 6:
case 7:
case 8:
// ****************************************************************
// SIMPLE DATA VALUE (type = 2)
// ****************************************************************
@ -761,7 +798,39 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
}
echo '<strong>'.$layout_data['label']. ' ';
echo db_get_value ('datos', 'tagente_estado', 'id_agente_modulo', $layout_data['id_agente_modulo']);
//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']);
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);
}
echo $value;
break;
case 7:
$value = reporting_get_agentmodule_data_min ($layout_data['id_agente_modulo'], 86400, 0);
if ($value === false) {
$value = __('Unknown');
} else {
$value = format_numeric ($value);
}
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);
}
echo $value;
break;
}
echo '</strong>';
if ($endTagA) echo '</a>';