Inprove view and fix wizard - #1748

This commit is contained in:
enriquecd 2018-01-25 20:01:03 +01:00
parent 9258d00051
commit 77fc16b690
3 changed files with 175 additions and 48 deletions

View File

@ -80,12 +80,14 @@ if ($add_cluster) {
'id_modulo' => 5,
'prediction_module' => 5,
'id_agente' =>$id_agent,
'custom_integer_1' =>$id_cluster
'custom_integer_1' =>$id_cluster,
'id_tipo_modulo' => 3,
'descripcion' => 'Cluster module'
);
$id_module = modules_create_agent_module($values_module['id_agente'],$values_module['nombre'],$values_module);
$id_module = db_process_sql_insert('tagente_modulo', $values_module);
// $id_module = db_process_sql_insert('tagente_modulo', $values_module);
if ($id_cluster !== false)
db_pandora_audit("Report management", "Create cluster #$id_cluster");
@ -177,6 +179,10 @@ elseif ($step == 3) {
$id_parent_modulo = db_process_sql('select id_agente_modulo from tagente_modulo where id_agente = '.$id_agent[0]['id_agent'].' and nombre = "Cluster status"');
$get_module_type = db_process_sql('select id_tipo_modulo from tagente_modulo where nombre = "'.$value.'" limit 1');
$get_module_type_value = $get_module_type[0]['id_tipo_modulo'];
$values_module = array(
'nombre' => $value,
'id_modulo' => 5,
@ -184,7 +190,9 @@ elseif ($step == 3) {
'id_agente' => $id_agent[0]['id_agent'],
'parent_module_id' => $id_parent_modulo[0]['id_agente_modulo'],
'custom_integer_1' =>$id_cluster,
'custom_integer_2' =>$tcluster_module
'custom_integer_2' =>$tcluster_module,
'id_tipo_modulo' =>$get_module_type_value,
'descripcion' => 'Cluster module'
);
@ -297,6 +305,10 @@ elseif ($step == 3) {
$tcluster_balanced_module = db_process_sql_insert('tcluster_item',array('name'=>$value,'id_cluster'=>$id_cluster,'item_type'=>"AP"));
$get_module_type = db_process_sql('select id_tipo_modulo from tagente_modulo where nombre = "'.$value.'" limit 1');
$get_module_type_value = $get_module_type[0]['id_tipo_modulo'];
$values_module = array(
'nombre' => $value,
'id_modulo' => 5,
@ -304,7 +316,9 @@ elseif ($step == 3) {
'id_agente' => $id_agent[0]['id_agent'],
'parent_module_id' => $id_parent_modulo[0]['id_agente_modulo'],
'custom_integer_1' => $id_cluster,
'custom_integer_2' => $tcluster_balanced_module
'custom_integer_2' => $tcluster_balanced_module,
'id_tipo_modulo' => $get_module_type_value,
'descripcion' => 'Cluster module'
);
// $id_module = db_process_sql_insert('tagente_modulo', $values_module);

View File

@ -102,7 +102,7 @@ ui_pagination (count($clusters));
$cluster_module = db_process_sql('select id_agente_modulo from tagente_modulo where id_agente = (select id_agent from tcluster where id = '.$cluster['id'].') and nombre = "Cluster status"');
$cluster_module_status = modules_get_status($cluster_module[0]['id_agente_modulo']);
$cluster_module_status = modules_get_agentmodule_last_status($cluster_module[0]['id_agente_modulo']);
//cluster module status - close
@ -121,6 +121,11 @@ ui_pagination (count($clusters));
$data[5] = '<div title="'.__('Unknown').'" style="width:35px;height:20px;background-color:gray;"></div>';
break;
case 4:
$data[5] = '<div title="'.__('No data').'" style="width:35px;height:20px;background-color:gray;"></div>';
break;
case 5:

View File

@ -31,90 +31,198 @@ ui_print_page_header ( __("Cluster detail").' » '.clusters_get_name($id_cluster
echo "<table style='width:100%;border: 1px black solid;'>";
echo "<table style='width:100%;'>";
echo "<tr>";
echo "<td style='border:1px solid black;min-width:800px;min-height:800px;vertical-align: top;'>";
echo "<div id='cluster_map' style='width:600px;height:600px;'></div>";
echo "<td style='border:1px solid black;min-width:800px;min-height:500px;vertical-align: top;width:55%';>";
echo "<div id='cluster_map' style='min-width:800px;width:100%;height:500px;'></div>";
echo "</td>";
echo "<td style='width:45%;min-width:600px;min-height:500pxpx;vertical-align: top;background-color:blue;'>";
echo "<td style='min-width:600px;min-height:600px;vertical-align: top;background-color:blue;'>";
echo "<div style='width:50%;min-width:400px;background-color:red;float:left;'>";
echo "<div style='width:50%;min-width:300px;background-color:lightblue;float:left;'>";
echo "<div style='float:left;width:100px;margin-left:20px;margin-top:20px;font-size:2em;text-align:center;'>".__('CLUSTER STATUS')."</div>";
echo "<div style='float:left;width:100px;margin-left:20px;margin-top:20px;height:50px;background-color:#82b92e;'></div>";
$cluster_module = db_process_sql('select id_agente_modulo from tagente_modulo where id_agente = (select id_agent from tcluster where id = '.$id_cluster.') and nombre = "Cluster status"');
$cluster_module_status = modules_get_agentmodule_last_status($cluster_module[0]['id_agente_modulo']);
switch ($cluster_module_status) {
case 1:
echo "<div style='float:left;width:100px;margin-left:20px;margin-top:20px;height:50px;background-color:red;'></div>";
break;
case 2:
echo "<div style='float:left;width:100px;margin-left:20px;margin-top:20px;height:50px;background-color:yellow;'></div>";
break;
case 4:
echo "<div style='float:left;width:100px;margin-left:20px;margin-top:20px;height:50px;background-color:blue;'></div>";
break;
case 3:
echo "<div style='float:left;width:100px;margin-left:20px;margin-top:20px;height:50px;background-color:gray;'></div>";
break;
case 5:
echo "<div style='float:left;width:100px;margin-left:20px;margin-top:20px;height:50px;background-color:blue;'></div>";
break;
case 0:
echo "<div style='float:left;width:100px;margin-left:20px;margin-top:20px;height:50px;background-color:green;'></div>";
break;
default:
break;
}
echo "<div style='border:1px solid lightgray;float:left;width:350px;margin-left:20px;margin-top:20px;height:200px;margin-bottom:20px;'>";
echo "<div style='border:1px solid lightgray;float:left;width:350px;margin-left:20px;margin-right:20px;margin-top:20px;height:200px;margin-bottom:20px;'>";
echo "<div style='float:left;width:100%;height:25px;background-color:#373737;text-align:center;'><span style='color:#e7e9ea;display:block;margin:5px;font-size:1.5em;'>".__('Balanced modules')."</span></div>";
echo "<div style='float:left;width:100%;height:175px;background-color:orange;text-align:center;'>";
echo "<div style='float:left;width:100%;height:175px;background-color:orange;text-align:center;overflow-y:auto;overflow-x:hidden;'>";
$balanced_modules_in = items_get_cluster_items_id_name($id_cluster,'AP');
foreach ($balanced_modules_in as $key => $value) {
$cluster_module = db_process_sql('select id_agente_modulo from tagente_modulo where custom_integer_2 = '.$key);
html_debug($cluster_module[0]['id_agente_modulo']);
$cluster_module_status = modules_get_status($cluster_module[0]['id_agente_modulo']);
html_debug(modules_get_status($cluster_module_status));
echo "<div style='float:left;'>";
$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 '<img style="width:18px;height:18px;" src="images/exito.png">'.$value;
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>';
}
else{
echo '<img style="width:18px;height:18px;" src="images/error_1.png">'.$value;
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>";
echo '</div>';
}
//
// $cluster_module_status = modules_get_status($cluster_module[0]['id_agente_modulo']);
// html_debug($balanced_modules_in);
echo "</div>";
echo "</div>";
echo "</div>";
echo "<div style='width:50%;background-color:orange;float:right;'>";
//
// echo "<div style='float:left;width:100px;px;margin-top:20px;font-size:2em;text-align:center;'>".__('LAST UPDATE')."</div>";
// echo "<div style='float:left;width:220px;margin-left:20px;margin-top:30px;font-size:1.5em;text-align:center;'>88 Hours 88 Min 88 sec ago</div>";
echo "</div>";
echo "<div style='width:50%;min-width:300px;background-color:red;float:left;'>";
$last_update = db_process_sql('select timestamp from tagente_estado where id_agente_modulo = '.$cluster_module[0]['id_agente_modulo']);
$last_update_value = $last_update[0]['timestamp'];
echo "<div style='float:left;width:100px;px;margin-top:20px;font-size:2em;text-align:center;'>".__('LAST UPDATE')."</div>";
echo "<div style='float:left;width:220px;margin-left:20px;margin-top:30px;font-size:1.5em;text-align:center;'>".$last_update_value."</div>";
echo "<div style='border:1px solid lightgray;float:left;width:350px;margin-left:20px;margin-right:20px;margin-top:20px;height:200px;margin-bottom:20px;'>";
echo "<div style='float:left;width:100%;height:25px;background-color:#373737;text-align:center;'><span style='color:#e7e9ea;display:block;margin:5px;font-size:1.5em;'>".__('Common modules')."</span></div>";
echo "<div style='float:left;width:100%;height:175px;background-color:orange;text-align:center;overflow-y:auto;overflow-x:hidden;'>";
$modules_in = items_get_cluster_items_id_name($id_cluster,'AA');
foreach ($modules_in as $key => $value) {
$cluster_module = db_process_sql('select id_agente_modulo from tagente_modulo where custom_integer_2 = '.$key);
$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>';
}
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>';
}
echo "</div>";
echo "</div>";
echo "</div>";
echo "<div style='width:100%;height:140px;min-width:600px;background-color:orange;float:left;margin-top:50px;'>";
$id_agent = db_process_sql('select id_agent from tcluster where id = '.$id_cluster);
$id_agent_value = $id_agent[0]['id_agent'];
$table = new stdClass();
$table->id = 'agent_details';
$table->width = '100%';
$table->cellspacing = 0;
$table->cellpadding = 0;
$table->class = 'agents';
$table->style = array_fill(0, 3, 'vertical-align: top;');
$data = array();
$data[0][0] = html_print_table($table_agent, true);
$data[0][0] .=
'<br /> <table width=90% class="databox agente" style="margin-left:5%;">
<tr><th>' .
__('Events (24h)') .
'</th></tr>' .
'<tr><td style="text-align:center;padding-left:20px;padding-right:20px;"><br />' .
graph_graphic_agentevents ($id_agent_value, 450, 40, SECONDS_1DAY, '', true, true) .
'<br /></td></tr>' .
'</table>';
$table->style[0] = 'width:100%; vertical-align:top;';
$data[0][1] = html_print_table($table_contact, true);
$data[0][1] .= empty($table_data->data) ?
'' :
'<br>' . html_print_table($table_data, true);
$data[0][1] .= !isset($table_incident) ?
'' :
'<br>' . html_print_table($table_incident, true);
$table->rowspan[1][0] = 0;
$table->data = $data;
$table->rowclass[] = '';
$table->cellstyle[1][0] = 'text-align:center;';
html_print_table($table);
$data2[1][0] = !isset($table_interface) ?
'' :
html_print_table($table_interface, true);
$table->data = $data2;
$table->styleTable = '';
html_print_table($table);
unset($table);
echo "</div>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td colspan='2' style='min-width:600px;min-height:600px;vertical-align: top;'>
echo "<td colspan='2' style='min-width:600px;min-height:600px;vertical-align: top;border:1px solid black;'>
<div id='cluster_modules' style='min-height:150px;'></div>
</td>";
echo "</tr>";
echo "</table>";
echo 'El estado del modulo del cluster '.clusters_get_name($id_cluster).' es '.agents_get_status(40);
?>