2013-08-02 Miguel de Dios <miguel.dedios@artica.es>
* include/graphs/functions_gd.php, include/graphs/fgraph.php, include/functions.php, include/functions_graph.php, include/functions_visual_map.php, include/ajax/visual_console_builder.ajax.php, operation/visual_console/render_view.php: a lot of fixes in the visualmap. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8622 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
aa1bc58e0d
commit
c72879741b
|
@ -1,3 +1,12 @@
|
|||
2013-08-02 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/graphs/functions_gd.php, include/graphs/fgraph.php,
|
||||
include/functions.php, include/functions_graph.php,
|
||||
include/functions_visual_map.php,
|
||||
include/ajax/visual_console_builder.ajax.php,
|
||||
operation/visual_console/render_view.php: a lot of fixes in the
|
||||
visualmap.
|
||||
|
||||
2013-08-02 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* include/functions_modules.php: Fix modules and
|
||||
|
|
|
@ -234,26 +234,26 @@ switch ($action) {
|
|||
}
|
||||
|
||||
switch ($status) {
|
||||
case 1:
|
||||
case VISUAL_MAP_STATUS_CRITICAL_BAD:
|
||||
//Critical (BAD)
|
||||
$colorStatus = "#ff0000";
|
||||
$colorStatus = COL_CRITICAL;
|
||||
break;
|
||||
case 4:
|
||||
case VISUAL_MAP_STATUS_CRITICAL_ALERT:
|
||||
//Critical (ALERT)
|
||||
$colorStatus = "#ff8800";
|
||||
$colorStatus = COL_ALERTFIRED;
|
||||
break;
|
||||
case 0:
|
||||
case VISUAL_MAP_STATUS_NORMAL:
|
||||
//Normal (OK)
|
||||
$colorStatus = "#00ff00";
|
||||
$colorStatus = COL_NORMAL;
|
||||
break;
|
||||
case 2:
|
||||
case VISUAL_MAP_STATUS_WARNING:
|
||||
//Warning
|
||||
$colorStatus = "#ffff00";
|
||||
$colorStatus = COL_WARNING;
|
||||
break;
|
||||
case 3:
|
||||
case VISUAL_MAP_STATUS_UNKNOWN:
|
||||
//Unknown
|
||||
default:
|
||||
$colorStatus = "#5A5AFF";
|
||||
$colorStatus = COL_UNKNOWN;
|
||||
// Default is Grey (Other)
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1778,8 +1778,9 @@ function can_user_access_node () {
|
|||
|
||||
$userinfo = get_user_info ($config['id_user']);
|
||||
|
||||
if (defined('METACONSOLE')) {
|
||||
return $userinfo["is_admin"] == 1 ? 1 : $userinfo["metaconsole_access_node"];
|
||||
if (defined('METACONSOLE')) {
|
||||
return $userinfo["is_admin"] == 1 ? 1 :
|
||||
$userinfo["metaconsole_access_node"];
|
||||
}
|
||||
else {
|
||||
return 1;
|
||||
|
|
|
@ -1501,7 +1501,8 @@ function graph_event_module ($width = 300, $height = 200, $id_agent) {
|
|||
function progress_bar($progress, $width, $height, $title = '', $mode = 1, $value_text = false, $color = false, $options = false) {
|
||||
global $config;
|
||||
|
||||
$out_of_lim_str = __("Out of limits");
|
||||
$out_of_lim_str = io_safe_output(__("Out of limits"));
|
||||
|
||||
$title = "";
|
||||
|
||||
if ($value_text === false) {
|
||||
|
@ -1547,7 +1548,7 @@ function progress_bubble($progress, $width, $height, $title = '', $mode = 1, $va
|
|||
if (defined('METACONSOLE'))
|
||||
$hack_metaconsole = '../../';
|
||||
|
||||
$out_of_lim_str = __("Out of limits");
|
||||
$out_of_lim_str = io_safe_output(__("Out of limits"));
|
||||
$title = "";
|
||||
|
||||
if ($value_text === false) {
|
||||
|
|
|
@ -74,25 +74,25 @@ function visual_map_print_item($layoutData) {
|
|||
switch ($status) {
|
||||
case VISUAL_MAP_STATUS_CRITICAL_BAD:
|
||||
//Critical (BAD)
|
||||
$colorStatus = "#ff0000";
|
||||
$colorStatus = COL_CRITICAL;
|
||||
break;
|
||||
case VISUAL_MAP_STATUS_CRITICAL_ALERT:
|
||||
//Critical (ALERT)
|
||||
$colorStatus = "#ff8800";
|
||||
$colorStatus = COL_ALERTFIRED;
|
||||
break;
|
||||
case VISUAL_MAP_STATUS_NORMAL:
|
||||
//Normal (OK)
|
||||
$colorStatus = "#00ff00";
|
||||
$colorStatus = COL_NORMAL;
|
||||
break;
|
||||
case VISUAL_MAP_STATUS_WARNING:
|
||||
//Warning
|
||||
$colorStatus = "#ffff00";
|
||||
$colorStatus = COL_WARNING;
|
||||
break;
|
||||
case VISUAL_MAP_STATUS_UNKNOWN:
|
||||
default:
|
||||
//Unknown
|
||||
// Default is Blue (Other)
|
||||
$colorStatus = "#5A5AFF";
|
||||
$colorStatus = COL_UNKNOWN;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -823,12 +823,12 @@ function visual_map_get_status_element($layoutData) {
|
|||
//Status for a simple module
|
||||
if ($layoutData['id_agente_modulo'] != 0) {
|
||||
$status = modules_get_agentmodule_status ($layoutData['id_agente_modulo']);
|
||||
|
||||
|
||||
//We need to get the diference between warning and critical alerts!!!
|
||||
$real_status = db_get_row ("tagente_estado", "id_agente_modulo", $layoutData["id_agente_modulo"]);
|
||||
|
||||
if ($real_status['estado'] == 2) {
|
||||
|
||||
if ($real_status['estado'] == 2) {
|
||||
|
||||
//This module has an alert fired and warning status
|
||||
$status = VISUAL_MAP_STATUS_WARNING_ALERT;
|
||||
}
|
||||
|
@ -1039,9 +1039,11 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
|
|||
echo '<div style="left: 0px; top: 0px; text-align: center; z-index: '.$z_index.'; '.($layout_data['label_color'][0] == '#' ? 'color: '.$layout_data['label_color'].';' : '').' position: absolute; margin-left: '.$layout_data['pos_x'].'px; margin-top:'.$layout_data['pos_y'].'px;" id="layout-data-'.$layout_data['id'].'" class="layout-data">';
|
||||
|
||||
if ($show_links) {
|
||||
|
||||
if (!empty($layout_data['id_agent']) && empty($layout_data['id_layout_linked'])) {
|
||||
if ($layout_data['enable_link']) {
|
||||
if (!empty($layout_data['id_agent'])
|
||||
&& empty($layout_data['id_layout_linked'])) {
|
||||
|
||||
if ($layout_data['enable_link']
|
||||
&& can_user_access_node()) {
|
||||
|
||||
$id_service = false;
|
||||
if (!defined('METACONSOLE')) {
|
||||
|
@ -1055,25 +1057,46 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
|
|||
|
||||
if (!empty($id_service)) {
|
||||
//Link to an service page
|
||||
echo '<a href="'.$config['homeurl'].'index.php?sec=services&sec2=enterprise/operation/services/services&id_service=' .
|
||||
$id_service . '&offset=0">';
|
||||
if (empty($layout_data['id_metaconsole'])) {
|
||||
$url = $config['homeurl'] .
|
||||
'index.php?sec=services&sec2=enterprise/operation/services/services&id_service=' .
|
||||
$id_service . '&offset=0';
|
||||
}
|
||||
else {
|
||||
$server = db_get_row('tmetaconsole_setup',
|
||||
'id', $layout_data['id_metaconsole']);
|
||||
|
||||
$url = $server["server_url"] . "/" .
|
||||
'index.php?sec=services&sec2=enterprise/operation/services/services&id_service=' .
|
||||
$id_service . '&offset=0';
|
||||
}
|
||||
}
|
||||
else if ($layout_data['id_agente_modulo'] != 0) {
|
||||
// Link to an module
|
||||
echo '<a href="'.$config['homeurl'].'/index.php?sec=estado&sec2=operation/agentes/status_monitor&id_module=' . $layout_data['id_agente_modulo'] . '">';
|
||||
}
|
||||
else {
|
||||
if (empty($layout_data['id_metaconsole'])) {
|
||||
$url = $config['homeurl'] . 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $layout_data['id_agent'];
|
||||
$url = $config['homeurl'] .
|
||||
'index.php?sec=estado&sec2=operation/agentes/status_monitor&id_module=' . $layout_data['id_agente_modulo'];
|
||||
}
|
||||
else {
|
||||
$url = ui_meta_get_url_console_child(
|
||||
$layout_data['id_metaconsole'],
|
||||
"estado", "operation/agentes/ver_agente&id_agente=" . $layout_data['id_agent']);
|
||||
}
|
||||
// Link to an agent
|
||||
echo '<a href="' . $url . '">';
|
||||
}
|
||||
else {
|
||||
// Link to an agent
|
||||
if (empty($layout_data['id_metaconsole'])) {
|
||||
$url = $config['homeurl'] .
|
||||
'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $layout_data['id_agent'];
|
||||
}
|
||||
else {
|
||||
$url = ui_meta_get_url_console_child(
|
||||
$layout_data['id_metaconsole'],
|
||||
"estado", "operation/agentes/ver_agente&id_agente=" . $layout_data['id_agent']);
|
||||
}
|
||||
}
|
||||
|
||||
echo '<a href="' . $url . '">';
|
||||
}
|
||||
}
|
||||
elseif ($layout_data['id_layout_linked'] > 0) {
|
||||
|
@ -1167,6 +1190,8 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
|
|||
echo "</a>";
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case LABEL:
|
||||
$z_index = 4;
|
||||
if ($resizedMap)
|
||||
|
@ -1189,6 +1214,9 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
|
|||
if ($endTagA) echo "</a>";
|
||||
echo "</div>";
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case ICON:
|
||||
$z_index = 4;
|
||||
if ($resizedMap)
|
||||
|
@ -1255,6 +1283,9 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
|
|||
|
||||
echo "</div>";
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case SIMPLE_VALUE:
|
||||
case SIMPLE_VALUE_MAX:
|
||||
case SIMPLE_VALUE_MIN:
|
||||
|
@ -1290,6 +1321,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
|
|||
|
||||
$endTagA = false;
|
||||
|
||||
|
||||
if ($show_links) {
|
||||
//Extract id service if it is a prediction module.
|
||||
$id_service = db_get_value_filter('custom_integer_1',
|
||||
|
@ -1297,16 +1329,25 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
|
|||
array('id_agente_modulo' => $layout_data['id_agente_modulo'],
|
||||
'prediction_module' => 1));
|
||||
|
||||
if ($id_service === false) {
|
||||
$id_service = 0;
|
||||
}
|
||||
|
||||
if ($id_service != 0) {
|
||||
if (!empty($id_service) && can_user_access_node()) {
|
||||
|
||||
if ($layout_data['enable_link']) {
|
||||
if ($layout_data['enable_link']) {
|
||||
//Link to an service page
|
||||
echo '<a href="index.php?sec=services&sec2=enterprise/operation/services/services&id_service=' .
|
||||
$id_service . '&offset=0">';
|
||||
if (!empty($layout_data['id_metaconsole'])) {
|
||||
$server = db_get_row('tmetaconsole_setup',
|
||||
'id', $layout_data['id_metaconsole']);
|
||||
|
||||
echo '<a href="' .
|
||||
$server["server_url"] . "/" .
|
||||
'index.php?sec=services&sec2=enterprise/operation/services/services&id_service=' .
|
||||
$id_service . '&offset=0">';
|
||||
}
|
||||
else {
|
||||
echo '<a href="index.php?sec=services&sec2=enterprise/operation/services/services&id_service=' .
|
||||
$id_service . '&offset=0">';
|
||||
}
|
||||
|
||||
|
||||
$endTagA = true;
|
||||
}
|
||||
|
||||
|
@ -1462,6 +1503,9 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
|
|||
|
||||
echo '</div>';
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case PERCENTILE_BAR:
|
||||
case PERCENTILE_BUBBLE:
|
||||
|
||||
|
@ -1510,15 +1554,18 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
|
|||
echo "<br>";
|
||||
|
||||
if ($show_links) {
|
||||
if (!empty($layout_data['id_agent']) && empty($layout_data['id_layout_linked'])) {
|
||||
if (!empty($layout_data['id_agent'])
|
||||
&& empty($layout_data['id_layout_linked'])) {
|
||||
|
||||
|
||||
if ($layout_data['enable_link']) {
|
||||
|
||||
if ($layout_data['enable_link']
|
||||
&& can_user_access_node()) {
|
||||
|
||||
//Extract id service if it is a prediction module.
|
||||
$id_service = db_get_value_filter('custom_integer_1',
|
||||
'tagente_modulo',
|
||||
array('id_agente_modulo' => $layout_data['id_agente_modulo'],
|
||||
array(
|
||||
'id_agente_modulo' => $layout_data['id_agente_modulo'],
|
||||
'prediction_module' => 1));
|
||||
|
||||
if ($id_service === false) {
|
||||
|
@ -1527,13 +1574,36 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
|
|||
|
||||
if ($id_service != 0) {
|
||||
//Link to an service page
|
||||
echo '<a href="index.php?sec=services&sec2=enterprise/operation/services/services&id_service=' .
|
||||
$id_service . '&offset=0">';
|
||||
|
||||
if (!empty($layout_data['id_metaconsole'])) {
|
||||
$server = db_get_row('tmetaconsole_setup',
|
||||
'id', $layout_data['id_metaconsole']);
|
||||
|
||||
echo '<a href="' .
|
||||
$server["server_url"] . "/" .
|
||||
'index.php?sec=services&sec2=enterprise/operation/services/services&id_service=' .
|
||||
$id_service . '&offset=0">';
|
||||
}
|
||||
else {
|
||||
echo '<a href="index.php?sec=services&sec2=enterprise/operation/services/services&id_service=' .
|
||||
$id_service . '&offset=0">';
|
||||
}
|
||||
$endTagA = true;
|
||||
}
|
||||
else if ($layout_data['id_agente_modulo'] != 0) {
|
||||
// Link to an module
|
||||
echo '<a href="'.$config['homeurl'].'/index.php?sec=estado&sec2=operation/agentes/status_monitor&id_module=' . $layout_data['id_agente_modulo'] . '">';
|
||||
if (!empty($layout_data['id_metaconsole'])) {
|
||||
$server = db_get_row('tmetaconsole_setup',
|
||||
'id', $layout_data['id_metaconsole']);
|
||||
|
||||
echo '<a href="' .
|
||||
$server["server_url"] .
|
||||
'/index.php?sec=estado&sec2=operation/agentes/status_monitor&id_module=' . $layout_data['id_agente_modulo'] . '">';
|
||||
}
|
||||
else {
|
||||
echo '<a href="'.$config['homeurl'].'/index.php?sec=estado&sec2=operation/agentes/status_monitor&id_module=' . $layout_data['id_agente_modulo'] . '">';
|
||||
}
|
||||
$endTagA = true;
|
||||
}
|
||||
else {
|
||||
// Link to an agent
|
||||
|
@ -1602,6 +1672,9 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
|
|||
|
||||
echo '</div>';
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case MODULE_GRAPH:
|
||||
if ($resizedMap) {
|
||||
$layout_data['width'] =
|
||||
|
@ -1622,7 +1695,10 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
|
|||
$endTagA = false;
|
||||
|
||||
if ($show_links) {
|
||||
if (($layout_data['id_layout_linked'] == "") || ($layout_data['id_layout_linked'] == 0)) {
|
||||
if ((
|
||||
($layout_data['id_layout_linked'] == "")
|
||||
|| ($layout_data['id_layout_linked'] == 0))
|
||||
&& can_user_access_node()) {
|
||||
|
||||
if ($layout_data['enable_link']) {
|
||||
|
||||
|
@ -1638,8 +1714,19 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
|
|||
|
||||
if ($id_service != 0) {
|
||||
//Link to an service page
|
||||
echo '<a href="'.$config['homeurl'].'/index.php?sec=services&sec2=enterprise/operation/services/services&id_service=' .
|
||||
$id_service . '&offset=0">';
|
||||
if (!empty($layout_data['id_metaconsole'])) {
|
||||
$server = db_get_row('tmetaconsole_setup',
|
||||
'id', $layout_data['id_metaconsole']);
|
||||
|
||||
echo '<a href="' .
|
||||
$server["server_url"] .
|
||||
'/index.php?sec=services&sec2=enterprise/operation/services/services&id_service=' .
|
||||
$id_service . '&offset=0">';
|
||||
}
|
||||
else {
|
||||
echo '<a href="'.$config['homeurl'].'/index.php?sec=services&sec2=enterprise/operation/services/services&id_service=' .
|
||||
$id_service . '&offset=0">';
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (empty($layout_data['id_metaconsole'])) {
|
||||
|
|
|
@ -65,7 +65,7 @@ switch($graph_type) {
|
|||
$height = get_parameter('height');
|
||||
$progress = get_parameter('progress');
|
||||
|
||||
$out_of_lim_str = get_parameter('out_of_lim_str', false);
|
||||
$out_of_lim_str = io_safe_output(get_parameter('out_of_lim_str', false));
|
||||
$out_of_lim_image = get_parameter('out_of_lim_image', false);
|
||||
|
||||
$font = get_parameter('font');
|
||||
|
@ -86,7 +86,7 @@ switch($graph_type) {
|
|||
$height = get_parameter('height');
|
||||
$progress = get_parameter('progress');
|
||||
|
||||
$out_of_lim_str = get_parameter('out_of_lim_str', false);
|
||||
$out_of_lim_str = io_safe_output(get_parameter('out_of_lim_str', false));
|
||||
$out_of_lim_image = get_parameter('out_of_lim_image', false);
|
||||
|
||||
$font = get_parameter('font');
|
||||
|
|
|
@ -162,7 +162,7 @@ function gd_histogram ($width, $height, $mode, $data, $max_value, $font, $title,
|
|||
// ***************************************************************************
|
||||
function gd_progress_bubble ($width, $height, $progress, $title, $font, $out_of_lim_str, $out_of_lim_image, $mode = 1, $fontsize=10, $value_text = '', $colorRGB = '') {
|
||||
if ($out_of_lim_str === false) {
|
||||
$out_of_lim_str = __("Out of limits");
|
||||
$out_of_lim_str = io_safe_output(__("Out of limits"));
|
||||
}
|
||||
|
||||
if ($out_of_lim_image === false) {
|
||||
|
@ -254,7 +254,7 @@ function gd_progress_bubble ($width, $height, $progress, $title, $font, $out_of_
|
|||
|
||||
function gd_progress_bar ($width, $height, $progress, $title, $font, $out_of_lim_str, $out_of_lim_image, $mode = 1, $fontsize=10, $value_text = '', $colorRGB = '') {
|
||||
if ($out_of_lim_str === false) {
|
||||
$out_of_lim_str = __("Out of limits");
|
||||
$out_of_lim_str = io_safe_output(__("Out of limits"));
|
||||
}
|
||||
|
||||
if ($out_of_lim_image === false) {
|
||||
|
|
|
@ -31,7 +31,7 @@ if ($id_layout) {
|
|||
else {
|
||||
$default_action = 'new';
|
||||
}
|
||||
|
||||
|
||||
if (!defined('METACONSOLE')) {
|
||||
$action = get_parameterBetweenListValues('action', array('new', 'save', 'edit', 'update', 'delete'), $default_action);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue