mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 00:04:37 +02:00
New maps in progress... (get node data)
This commit is contained in:
parent
bd736ea598
commit
cccce11f79
@ -30,9 +30,55 @@ if (is_ajax ()) {
|
||||
$id_map = (int)get_parameter('id_map');
|
||||
$data_graph_id = (int)get_parameter('data_graph_id');
|
||||
|
||||
$return_data = '<span>GOD SAVE FERMIN!!</span>';
|
||||
$return_data = '';
|
||||
|
||||
sleep(2);
|
||||
switch ($type) {
|
||||
case ITEM_TYPE_AGENT_NETWORKMAP:
|
||||
$node_data = db_get_all_rows_sql("SELECT *
|
||||
FROM tagente
|
||||
WHERE id_agente = " . $id_node_data);
|
||||
$node_data = $node_data[0];
|
||||
if (!empty($node_data)) {
|
||||
$return_data .= '<div id="agent_data_to_show_"' . $node_data['id_agente'] .'>';
|
||||
$return_data .= '<span><strong>Agent: </strong>' . $node_data['nombre'] . '</span></br>';
|
||||
$return_data .= '<span><strong>IP Addres: </strong>' . $node_data['direccion'] . '</span></br>';
|
||||
$agent_os = db_get_row_sql("SELECT name FROM tconfig_os WHERE id_os = " . $node_data['id_os']);
|
||||
$agent_os = $agent_os['name'];
|
||||
$return_data .= '<span><strong>OS: </strong>' . $agent_os . ' ' . $node_data['os_version'] .'</span></br>';
|
||||
$return_data .= '<span><strong>Description: </strong>' . $node_data['comentarios'] . '</span></br>';
|
||||
$agent_group = db_get_row_sql("SELECT nombre FROM tgrupo WHERE id_grupo = " . $node_data['id_grupo']);
|
||||
$agent_group = $agent_group['nombre'];
|
||||
$return_data .= '<span><strong>Group: </strong>' . $agent_group . '</span></br>';
|
||||
$return_data .= '<span><strong>Agent Version: </strong>' . $node_data['agent_version'] . '</span></br>';
|
||||
$return_data .= '<span><strong>Last Contact: </strong>' . $node_data['ultimo_contacto'] . '</span></br>';
|
||||
$return_data .= '<span><strong>Remote: </strong>' . $node_data['ultimo_contacto_remoto'] . '</span>';
|
||||
$return_data .= '</div>';
|
||||
}
|
||||
else {
|
||||
$return_data = '<span>No data to show</span>';
|
||||
}
|
||||
break;
|
||||
case ITEM_TYPE_MODULE_NETWORKMAP:
|
||||
$node_data = db_get_all_rows_sql("SELECT *
|
||||
FROM tagente_modulo
|
||||
WHERE id_agente_modulo = " . $id_node_data);
|
||||
$node_data = $node_data[0];
|
||||
if (!empty($node_data)) {
|
||||
$return_data .= '<div id="module_data_to_show_"' . $node_data['id_agente'] .'>';
|
||||
$return_data .= '<span><strong>Module: </strong>' . $node_data['nombre'] . '</span></br>';
|
||||
$agent_module = db_get_row_sql("SELECT nombre FROM tagente WHERE id_agente = " . $node_data['id_agnte']);
|
||||
$agent_module = $agent_module['nombre'];
|
||||
$return_data .= '<span><strong>Agent: </strong>' . $agent_module . '</span></br>';
|
||||
$return_data .= '<span><strong>Description: </strong>' . $node_data['descripcion'] . '</span>';
|
||||
$return_data .= '</div>';
|
||||
}
|
||||
else {
|
||||
$return_data = '<span>No data to show</span>';
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
sleep(1);
|
||||
echo json_encode($return_data);
|
||||
return;
|
||||
}
|
||||
|
@ -120,6 +120,10 @@ abstract class Map {
|
||||
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"include/styles/tooltipster-shadow.css\"/>" . "\n";
|
||||
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"include/styles/tooltipster-noir.css\"/>" . "\n";
|
||||
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"include/styles/tooltipster-light.css\"/>" . "\n";
|
||||
//Tooltips spinner
|
||||
echo "<div id='spinner_tooltip' style='display:none;'>";
|
||||
html_print_image('images/spinner.gif');
|
||||
echo "</div>";
|
||||
foreach ($this->requires_js as $js) {
|
||||
echo "<script type='text/javascript' src='$js'></script>" . "\n";
|
||||
}
|
||||
|
@ -239,6 +239,7 @@ This function manages nodes tooltips
|
||||
*/
|
||||
MapController.prototype.tooltip_map_create = function(self, event) {
|
||||
var nodeTarget = $(event.currentTarget).parent();
|
||||
var spinner = $('#spinner_tooltip').html();
|
||||
|
||||
var nodeR = parseInt($(event.currentTarget).attr("r"));
|
||||
nodeR = nodeR * self._zoomManager.scale(); // Apply zoom
|
||||
@ -249,7 +250,7 @@ MapController.prototype.tooltip_map_create = function(self, event) {
|
||||
var data_graph_id = parseInt(nodeTarget.data("graph_id"));
|
||||
|
||||
if (this.containsTooltipId(node_id)) {
|
||||
nodeTarget.tooltipster('content', 'Loading...');
|
||||
nodeTarget.tooltipster('content', spinner);
|
||||
self.nodeData(data_id, type, self._id, data_graph_id, nodeTarget);
|
||||
nodeTarget.tooltipster("option", "offsetX", nodeR);
|
||||
nodeTarget.tooltipster("show");
|
||||
@ -263,7 +264,7 @@ MapController.prototype.tooltip_map_create = function(self, event) {
|
||||
offsetX: nodeR,
|
||||
theme: 'tooltipster-noir',
|
||||
multiple: true,
|
||||
content: 'Loading...',
|
||||
content: spinner,
|
||||
functionBefore: function(origin, continueTooltip) {
|
||||
continueTooltip();
|
||||
self.nodeData(data_id, type, self._id, data_graph_id, origin);
|
||||
|
Loading…
x
Reference in New Issue
Block a user