Popup when click modules in cluster view, new images, filter modules - #1748

This commit is contained in:
enriquecd 2018-01-30 17:38:29 +01:00
parent 13884a44d6
commit 2b446a681d
13 changed files with 195 additions and 22 deletions

View File

@ -25,7 +25,7 @@ ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no cl
<div class="new_task">
<div class="image_task">
<?php echo html_print_image('images/firts_task/icono_grande_custom_reporting.png', true, array("title" => __('Clusters')));?>
<?php echo html_print_image('images/firts_task/icono-cluster-activo.png', true, array("title" => __('Clusters')));?>
</div>
<div class="text_task">
<h3> <?php echo __('Create Cluster'); ?></h3>

View File

@ -250,13 +250,9 @@ elseif($step == 2){
$cluster_agents_all[$value['id_agente']] = $value['alias'];
}
$cluster_agents_out = array();
$cluster_agents_out = array_diff_key($template_agents_all, $template_agents_in);
$cluster_agents_out = array_diff_key($cluster_agents_all,$cluster_agents_in);
$cluster_agents_in_keys = array_keys($template_agents_in);
$cluster_agents_out_keys = array_keys($template_agents_out);
html_print_select ($cluster_agents_all, 'id_agents[]', 0, false, '', '', false, true, true, '', false, 'width: 100%;', $option_style);
html_print_select ($cluster_agents_out, 'id_agents[]', 0, false, '', '', false, true, true, '', false, 'width: 100%;', $option_style);
echo "</td>";

View File

@ -77,8 +77,7 @@ ui_pagination (count($clusters));
foreach ($clusters as $cluster) {
$data = array ();
$data[0] = '<a href="index.php?sec=reporting&sec2=godmode/reporting/cluster_view&id='.$cluster["id"].'">'.$cluster["name"].' - Enlace Map Dani (Mapa de red)</a><br><br>'.
'<a href="index.php?sec=reporting&sec2=godmode/reporting/cluster_view_2&id='.$cluster["id"].'">'.$cluster["name"].' - Enlace Enrique (pantalla informativa)</a>';
$data[0] = '<a href="index.php?sec=reporting&sec2=godmode/reporting/cluster_view&id='.$cluster["id"].'">'.$cluster["name"].'</a>';
$data[1] = ui_print_truncate_text($cluster["description"], 70);
$data[2] = ui_print_group_icon($cluster['group'],true);
@ -143,7 +142,7 @@ ui_pagination (count($clusters));
break;
}
$data[6] = "<a href='index.php?sec=reporting&sec2=godmode/reporting/cluster_builder&delete_cluster=".$cluster["id"]."'><img src='images/cross.png'></a>
$data[6] = "<a href='index.php?sec=reporting&sec2=godmode/reporting/cluster_builder&delete_cluster=".$cluster["id"]."' onclick='javascript: if (!confirm(\"Are you sure to delete?\")) return false;'><img src='images/cross.png'></a>
<a href='index.php?sec=reporting&sec2=godmode/reporting/cluster_builder.cluster_editor&id=".$cluster["id"]."'><img src='images/builder.png'></a>";
array_push ($table->data, $data);

View File

@ -0,0 +1,136 @@
<?php
$name_module = get_parameter('name_module',0);
$id_cluster = get_parameter('id_cluster',0);
$module_ap = get_parameter('module_ap',0);
//
// $module_agents = db_process_sql('select id_agente_modulo,id_agente from tagente_modulo where nombre = "'.$name_module.'" and id_agente in
// (select id_agent from tcluster_agent where id_cluster = '.$id_cluster.')');
//
//
$module_agents = db_process_sql('select tagente_modulo.id_agente_modulo,tagente_modulo.id_agente,utimestamp from tagente_modulo,tagente_estado where tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo and nombre = "'.$name_module.'" and tagente_modulo.id_agente in
(select id_agent from tcluster_agent where id_cluster = '.$id_cluster.') ORDER BY utimestamp DESC');
// $module_agents = db_process_sql('select id_agente_modulo,id_agente,utimestamp from tagente_modulo,tagente_estado');
foreach ($module_agents as $key => $value) {
$module_agents_value[$module_agents[$key]['id_agente']] = $module_agents[$key]['id_agente_modulo'];
}
echo '
<table style="width:100%;border:2px black solid" cellpadding="4" cellspacing="4" border="0" class="databox data" id="table2">
<thead><tr>
<th class="header c0" style="text-align: left;" scope="col">Agent alias</th>
<th class="header c1" style="text-align: left;" scope="col">Module name</th>
<th class="header c2" style="text-align: left;" scope="col">Status</th>
<th class="header c3" style="text-align: left;" scope="col">Data</th>
<th class="header c4" style="text-align: left;" scope="col">Graph</th>
<th class="header c5" style="text-align: left;" scope="col">Last contact</th>
<th id="modal_module_popup_close" onclick="$(\'#modal_module_popup\').css(\'display\',\'none\');" class="header c4" style="text-align: left;" scope="col"><img src="images/icono_cerrar.png"></th>
</tr></thead>
<tbody>
';
foreach ($module_agents_value as $key => $value) {
if ($value === reset($module_agents_value) && $module_ap) {
echo '<tr style="background-color:#33ffe3;" class="datos2">';
}
else{
echo '<tr class="datos2">';
}
echo '<td style=" text-align:left;" class="datos2 ">'.agents_get_alias($key).'</td>';
echo '<td style=" text-align:left;" class="datos2 ">'.modules_get_agentmodule_name($value).'</td>';
echo '<td style=" text-align:left;" class="datos2 ">';
switch (modules_get_agentmodule_last_status($value)) {
case 1:
echo '<img src="images/status_sets/default/module_critical.png" data-title="CRITICAL: '.modules_get_last_value($value).'" data-use_title_for_force_title="1" class="forced_title" alt="CRITICAL: '.modules_get_last_value($value).'">';
break;
case 2:
echo '<img src="images/status_sets/default/module_warning.png" data-title="WARNING: '.modules_get_last_value($value).'" data-use_title_for_force_title="1" class="forced_title" alt="WARNING: '.modules_get_last_value($value).'">';
break;
case 4:
echo '<img src="images/status_sets/default/module_no_data.png" data-title="NO DATA: '.modules_get_last_value($value).'" data-use_title_for_force_title="1" class="forced_title" alt="NO DATA: '.modules_get_last_value($value).'">';
break;
case 3:
echo '<img src="images/status_sets/default/module_unknown.png" data-title="UNKNOWN: '.modules_get_last_value($value).'" data-use_title_for_force_title="1" class="forced_title" alt="UNKNOWN: '.modules_get_last_value($value).'">';
break;
case 5:
echo '<img src="images/status_sets/default/module_ok.png" data-title="NOT INIT: '.modules_get_last_value($value).'" data-use_title_for_force_title="1" class="forced_title" alt="NOT INIT: '.modules_get_last_value($value).'">';
break;
case 0:
echo '<img src="images/status_sets/default/module_ok.png" data-title="NORMAL: '.modules_get_last_value($value).'" data-use_title_for_force_title="1" class="forced_title" alt="NORMAL: '.modules_get_last_value($value).'">';
break;
default:
break;
}
echo '</td>';
echo '<td style=" text-align:left;" class="datos2 ">'.modules_get_last_value($value).'</td>';
echo '<td style=" text-align:left;" class="datos2 ">';
echo '<a href=\'javascript: show_module_detail_dialog('.$value.', '.$key.', "", 0, 86400, "'.modules_get_agentmodule_name($value).'")\'>';
echo '<img src="images/binary.png" style="border:0px;" alt="">';
echo '</a>&nbsp;&nbsp;&nbsp;';
$nombre_tipo_modulo = modules_get_moduletype_name (modules_get_type_id($value));
$handle = "stat".$nombre_tipo_modulo."_".$value;
$url = 'include/procesos.php?agente='.$value;
$win_handle=dechex(crc32($value.modules_get_agentmodule_name($value)));
if ($graph_type == 'boolean') {
$draw_events = 1;
} else {
$draw_events = 0;
}
$link ="winopeng('" .
"operation/agentes/stat_win.php?" .
"type=$graph_type&amp;" .
"period=" . SECONDS_1DAY . "&amp;" .
"id=" . $value . "&amp;" .
"label=" . rawurlencode(
urlencode(
base64_encode($module["nombre"]))) . "&amp;" .
"refresh=" . SECONDS_10MINUTES . "&amp;" .
"draw_events=$draw_events', 'day_".$win_handle."')";
echo '<a href="javascript:'.$link.'">';
echo '<img src="images/chart_curve.png" style="border:0px;" alt="">';
echo '</a>';
echo '</td>';
echo '<td style=" text-align:left;" class="datos2 ">'.date("d/m/Y - H:i:s",modules_get_last_contact($value)).'</td>';
echo '<td>';
echo '</td>';
echo '</tr>';
}
echo '
</tbody>
</table>
';
return;
?>

View File

@ -142,7 +142,7 @@ echo "<table style='width:100%;'>";
echo "<div style='float:left;width:100%;height:175px;text-align:center;overflow-y:auto;overflow-x:hidden;'>";
$balanced_modules_in = items_get_cluster_items_id_name($id_cluster,'AP');
$balanced_modules_in = items_get_cluster_items_id_name($id_cluster,'AP',1);
foreach ($balanced_modules_in as $key => $value) {
$cluster_module = db_process_sql('select id_agente_modulo from tagente_modulo where custom_integer_2 = '.$key);
@ -150,12 +150,12 @@ echo "<table style='width:100%;'>";
$cluster_module_status = modules_get_agentmodule_last_status($cluster_module[0]['id_agente_modulo']);
echo "<div style='float:left;margin-left:20px;margin-top:10px;width:330px;'>";
if($cluster_module_status == 5){
echo '<div style="float:left;"><img style="width:18px;height:18px;margin-right:5px;vertical-align:middle;" src="images/exito.png">'.ui_print_truncate_text($value, 40,false).'</div>';
if($cluster_module_status == 0){
echo '<div class="modal_module_list" style="float:left;" onclick="modal_module(\''.$value.'\','.$id_cluster.',1,event);"><img style="width:18px;height:18px;margin-right:5px;vertical-align:middle;" src="images/exito.png">'.ui_print_truncate_text($value, 40,false).'</div>';
}
else{
echo '<div style="float:left;"><img style="width:18px;height:18px;margin-right:5px;vertical-align:middle;" src="images/error_1.png">'.ui_print_truncate_text($value, 40,false).'</div>';
echo '<div class="modal_module_list" style="float:left;" onclick="modal_module(\''.$value.'\','.$id_cluster.',1,event);"><img style="width:18px;height:18px;margin-right:5px;vertical-align:middle;" src="images/error_1.png">'.ui_print_truncate_text($value, 40,false).'</div>';
}
echo '</div>';
@ -169,7 +169,9 @@ echo "<table style='width:100%;'>";
echo "</div>";
}
// $module_agents = db_process_sql('select tagente_modulo.id_agente_modulo,tagente_modulo.id_agente,utimestamp from tagente_modulo,tagente_estado where tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo and nombre = "CPU&#x20;Load" and tagente_modulo.id_agente in
// (select id_agent from tcluster_agent where id_cluster = 6)');
// html_debug($module_agents);
echo "<div style='width:50%;min-width:390px;max-width:390px;float:left;'>";
@ -195,11 +197,11 @@ echo "<table style='width:100%;'>";
echo "<div style='float:left;margin-left:20px;margin-top:10px;width:330px;'>";
if($cluster_module_status == 5){
echo '<div style="float:left;"><img style="width:18px;height:18px;margin-right:5px;vertical-align:middle;" src="images/exito.png">'.ui_print_truncate_text($value, 40,false).'</div>';
if($cluster_module_status == 0){
echo '<div class="modal_module_list" onclick="modal_module(\''.$value.'\','.$id_cluster.',0,event);" style="float:left;"><img style="width:18px;height:18px;margin-right:5px;vertical-align:middle;" src="images/exito.png">'.ui_print_truncate_text($value, 40,false).'</div>';
}
else{
echo '<div style="float:left;"><img style="width:18px;height:18px;margin-right:5px;vertical-align:middle;" src="images/error_1.png">'.ui_print_truncate_text($value, 40,false).'</div>';
echo '<div class="modal_module_list" onclick="modal_module(\''.$value.'\','.$id_cluster.',0,event);" style="float:left;"><img style="width:18px;height:18px;margin-right:5px;vertical-align:middle;" src="images/error_1.png">'.ui_print_truncate_text($value, 40,false).'</div>';
}
echo '</div>';
@ -280,6 +282,8 @@ echo "<table style='width:100%;'>";
echo "</tr>";
echo "</table>";
echo "<div id='modal_module_popup' style='position:absolute;'></div>";
$id_agent = db_process_sql('select id_agent from tcluster where id = '.$id_cluster);
$id_agent_value = $id_agent[0]['id_agent'];
@ -513,8 +517,32 @@ function refresh_pagination_callback (module_id, id_agent, server_name,module_na
});
}
function modal_module(name,id_cluster,module_ap,event){
x=event.clientX-550;
y=event.clientY-50;
$.ajax({
type: "POST",
url: "ajax.php",
data: {"page" : "godmode/reporting/cluster_name_agents",
"name_module" : name,
"id_cluster" : id_cluster,
"module_ap" : module_ap
},
success: function(data) {
$('#modal_module_popup').css({'display':'block','width':'600px','left':x+'px','top': y+'px'});
$('#modal_module_popup').html(data);
}
});
}
$(document).ready(function(){
$('.tooltip').tooltipster();
var controller = null
$(function() {

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 850 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 659 B

View File

@ -123,8 +123,8 @@ function items_get_cluster_items_id ($id_cluster,$item_type = 'AA'){
return ($post_items);
}
function items_get_cluster_items_id_name ($id_cluster,$item_type = 'AA'){
$items = db_get_all_rows_filter("tcluster_item", array("id_cluster" => $id_cluster,"item_type" => $item_type), array("id"));
function items_get_cluster_items_id_name ($id_cluster,$item_type = 'AA',$is_critical = '%%'){
$items = db_get_all_rows_filter("tcluster_item", array("id_cluster" => $id_cluster,"item_type" => $item_type,"is_critical" => $is_critical), array("id"));
$post_items = array();
@ -214,4 +214,5 @@ function cluster_get_status ($id_agente){
}
?>

View File

@ -1649,6 +1649,11 @@ function modules_is_unit_macro($macro) {
return false;
}
function modules_get_last_contact ($id_agentmodule) {
return db_get_value ('utimestamp', 'tagente_estado',
'id_agente_modulo', $id_agentmodule);
}
/**
* Get the current value of an agent module.
*

View File

@ -4451,3 +4451,11 @@ form ul.form_flex li ul li{
height: 50px;
width: 100%;
}
#modal_module_popup_close:hover{
cursor: pointer;
}
.modal_module_list:hover{
cursor: pointer;
}

View File

@ -142,7 +142,7 @@ INSERT INTO `tconfig_os` (`id_os`, `name`, `description`, `icon_name`) VALUES
(18, 'Switch', 'Generic switch', 'so_switch.png'),
(19, 'Satellite', 'Satellite agent', 'satellite.png'),
(20, 'Mainframe', 'Mainframe agent', 'so_mainframe.png'),
(21, 'Cluster', 'Cluster agent', 'so_mainframe.png');
(21, 'Cluster', 'Cluster agent', 'so_cluster.png');
UNLOCK TABLES;