New maps in progress... (node details)

This commit is contained in:
Arturo Gonzalez 2016-03-17 10:31:18 +01:00
parent 12565ada17
commit 9d2dff71e3
2 changed files with 54 additions and 74 deletions

View File

@ -161,7 +161,7 @@ if (is_ajax ()) {
ob_start(); ob_start();
?> ?>
<div id="tooltip_{data_graph_id}"> <div id="details_{data_graph_id}">
<div class="title_bar"> <div class="title_bar">
<span class="title">{title}</span> <span class="title">{title}</span>
</div> </div>
@ -187,42 +187,57 @@ if (is_ajax ()) {
agents_get_name($id_node_data), agents_get_name($id_node_data),
$details); $details);
$agent_modules = agents_get_modules($id_node_data);
$agent_modules = array_keys($agent_modules);
$agent_interval = agents_get_interval ($id_node_data);
$agent_group = groups_get_name( $table = new stdClass();
db_get_value('id_grupo', 'tagente', 'id_agente', $id_node_data)); $table->width = '100%';
$table->class = 'databox data';
ob_start(); $table->head = array ();
?> $table->head[0] = __('Name');
<span> $table->head[1] = __('Description');
<strong><?php echo __('IP Address');?>: </strong> $table->head[2] = __('Type');
<?php echo agents_get_address($id_node_data);?> $table->head[3] = __('Interval');
</span><br /> $table->head[4] = __('Status');
<span> $table->rowstyle = array();
<strong><?php echo __('OS');?>: </strong> $table->style = array ();
<?php echo os_get_name(agents_get_os($id_node_data));?> $table->style[0] = 'font-weight: bold';
</span><br /> $table->align = array ();
<span> $table->align[0] = 'center';
<strong><?php echo __('Description');?>: </strong> $table->align[1] = 'center';
<?php echo db_get_value('comentarios', 'tagente', 'id_agente', $id_node_data);?> $table->align[2] = 'center';
</span> <br/> $table->align[3] = 'center';
<span> $table->align[4] = 'center';
<strong><?php echo __('Group');?>: </strong> $table->data = array ();
<?php echo $agent_group;?> foreach ($agent_modules as $module) {
</span><br /> $data = array ();
<span> $status = '';
<strong><?php echo __('Agent Version');?>: </strong> $title = '';
<?php echo db_get_value('agent_version', 'tagente', 'id_agente', $id_node_data);?> $module_data = db_get_all_rows_sql("SELECT nombre, id_tipo_modulo, descripcion, module_interval
</span><br /> FROM tagente_modulo WHERE id_agente_modulo = " . $module);
<span> $module_data = $module_data[0];
<strong><?php echo __('Last Contact');?>: </strong>
<?php echo db_get_value('ultimo_contacto', 'tagente', 'id_agente', $id_node_data);?> $module_status = db_get_row('tagente_estado', 'id_agente_modulo', $module);
</span><br /> modules_get_status($module_status['id_agente_modulo'], $module_status['estado'], $module_status['datos'], $status, $title);
<span>
<strong><?php echo __('Remote');?>: </strong> $data[0] = $module_data['nombre'];
<?php echo db_get_value('ultimo_contacto_remoto', 'tagente', 'id_agente', $id_node_data);?> $data[1] = $module_data['descripcion'];
</span> $data[2] = '';
<?php $type = $module_data['id_tipo_modulo'];
$body = ob_get_clean(); if ($type) {
$data[2] = ui_print_moduletype_icon($type, true);
}
if ($module_data['module_interval']) {
$data[3] = human_time_description_raw($module_data['module_interval']);
}
else {
$data[3] = human_time_description_raw($agent_interval);
}
$data[4] = ui_print_status_image($status, $title, true);;
array_push ($table->data, $data);
}
$body = html_print_table ($table, true);
$details = str_replace( $details = str_replace(
"{body}", "{body}",
@ -231,45 +246,10 @@ if (is_ajax ()) {
break; break;
case ITEM_TYPE_MODULE_NETWORKMAP: case ITEM_TYPE_MODULE_NETWORKMAP:
$node_data = db_get_all_rows_sql("SELECT descripcion $details = "<span>...</span>";
FROM tagente_modulo
WHERE id_agente_modulo = " . $id_node_data);
$node_data = $node_data[0];
$details = str_replace(
"{data_graph_id}",
$data_graph_id,
$details);
$details = str_replace(
"{node_id}",
$node_id,
$details);
$details = str_replace(
"{title}",
modules_get_agentmodule_name($id_node_data),
$details);
ob_start();
?>
<span>
<strong><?php echo __('Agent Name');?>: </strong>
<?php echo agents_get_name(modules_get_agentmodule_agent($id_node_data));?>
</span> <br/>
<span>
<strong><?php echo __('Description');?>: </strong>
<?php echo db_get_value('descripcion', 'tagente_modulo', 'id_agente_modulo', $id_node_data);?>
</span> <br/>
<?php
$body = ob_get_clean();
$details = str_replace(
"{body}",
$body,
$details);
break; break;
} }
echo json_encode($details); echo json_encode($details);
return; return;
} }

View File

@ -1310,7 +1310,7 @@ MapController.prototype.nodeGetDetails = function(self, target) {
jQuery.ajax ({ jQuery.ajax ({
data: params, data: params,
dataType: "html", dataType: "JSON",
type: "POST", type: "POST",
url: "ajax.php", url: "ajax.php",
success: function (data) { success: function (data) {