Merge branch 'feature/new_networkmap' of https://github.com/pandorafms/pandorafms into feature/new_networkmap
Conflicts: pandora_console/include/class/Map.class.php pandora_console/include/javascript/map/MapController.js
This commit is contained in:
commit
6c037e0ef7
|
@ -25,11 +25,62 @@ if (is_ajax ()) {
|
|||
$getNodeData = (bool)get_parameter('getNodeData', 0);
|
||||
|
||||
if ($getNodeData) {
|
||||
$id_node = (int)get_parameter('id_node');
|
||||
$id_node_data = (int)get_parameter('id_node_data');
|
||||
$type = (int)get_parameter('type');
|
||||
$id_map = (int)get_parameter('id_map');
|
||||
$data_graph_id = (int)get_parameter('data_graph_id');
|
||||
|
||||
$node = new Node($id_node);
|
||||
$return_data = '';
|
||||
|
||||
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";
|
||||
}
|
||||
|
@ -130,7 +134,7 @@ abstract class Map {
|
|||
?>
|
||||
|
||||
<div id="map" data-id="<?php echo $this->id;?>" style="border: 1px red solid;">
|
||||
<div class="zoom_box" style="position: absolute;">
|
||||
<div class="zoom_box" style="">
|
||||
<style type="text/css">
|
||||
.zoom_controller {
|
||||
width: 30px;
|
||||
|
@ -138,7 +142,7 @@ abstract class Map {
|
|||
background: blue;
|
||||
border-radius: 15px;
|
||||
|
||||
top: 50px;
|
||||
top: 100px;
|
||||
left: 10px;
|
||||
position: absolute;
|
||||
}
|
||||
|
@ -173,7 +177,7 @@ abstract class Map {
|
|||
}
|
||||
|
||||
.home_zoom {
|
||||
top: 310px;
|
||||
top: 360px;
|
||||
left: 10px;
|
||||
|
||||
display: table-cell;
|
||||
|
@ -195,7 +199,7 @@ abstract class Map {
|
|||
left: 10px;
|
||||
|
||||
display: table-cell;
|
||||
position: absolute;
|
||||
position: relative;
|
||||
font-weight: bolder;
|
||||
font-size: 20px;
|
||||
background: blue;
|
||||
|
@ -209,7 +213,7 @@ abstract class Map {
|
|||
}
|
||||
|
||||
.zoom_out {
|
||||
top: 270px;
|
||||
top: 320px;
|
||||
left: 10px;
|
||||
|
||||
display: table-cell;
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
* @subpackage Maps
|
||||
*/
|
||||
|
||||
abstract class Node {
|
||||
class Node {
|
||||
|
||||
private $id_node = null;
|
||||
|
||||
|
@ -27,4 +27,5 @@ abstract class Node {
|
|||
$this->$id_node = $id;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -264,7 +264,7 @@ MapController.prototype.click_event = function(event) {
|
|||
event.stopPropagation();
|
||||
switch (event.which) {
|
||||
case 1:
|
||||
if ($(event.currentTarget).hasClass("node")) {
|
||||
if ($(event.currentTarget).parent().hasClass("node")) {
|
||||
self.tooltip_map_create(self, event);
|
||||
}
|
||||
else {
|
||||
|
@ -286,24 +286,25 @@ Return void
|
|||
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
|
||||
var node_id = $(event.currentTarget).attr("id");
|
||||
var node_id = nodeTarget.attr("id");
|
||||
|
||||
//Always changes the content because this may be change
|
||||
var nodeContent = this.nodeData(node_id/*, type, id_map*/);
|
||||
|
||||
/*----------------------FOR TEST--------------------*/
|
||||
nodeContent = '<span>I\'M A FUCKING TOOLTIP!!</span>';
|
||||
/*--------------------------------------------------*/
|
||||
var type = parseInt(nodeTarget.data("type"));
|
||||
var data_id = parseInt(nodeTarget.data("id"));
|
||||
var data_graph_id = parseInt(nodeTarget.data("graph_id"));
|
||||
|
||||
if (this.containsTooltipId(node_id)) {
|
||||
$(event.currentTarget).tooltipster("option", "offsetX", nodeR);
|
||||
$(event.currentTarget).tooltipster('content', $(nodeContent));
|
||||
$(event.currentTarget).tooltipster("show");
|
||||
nodeTarget.tooltipster('content', spinner);
|
||||
self.nodeData(data_id, type, self._id, data_graph_id, nodeTarget);
|
||||
nodeTarget.tooltipster("option", "offsetX", nodeR);
|
||||
nodeTarget.tooltipster("show");
|
||||
}
|
||||
else {
|
||||
$(event.currentTarget).tooltipster({
|
||||
nodeTarget.tooltipster({
|
||||
arrow: true,
|
||||
trigger: 'click',
|
||||
contentAsHTML: true,
|
||||
|
@ -311,12 +312,16 @@ MapController.prototype.tooltip_map_create = function(self, event) {
|
|||
offsetX: nodeR,
|
||||
theme: 'tooltipster-noir',
|
||||
multiple: true,
|
||||
content: nodeContent
|
||||
content: spinner,
|
||||
functionBefore: function(origin, continueTooltip) {
|
||||
continueTooltip();
|
||||
self.nodeData(data_id, type, self._id, data_graph_id, origin);
|
||||
}
|
||||
});
|
||||
|
||||
this._tooltipsID.push(node_id);
|
||||
|
||||
$(event.currentTarget).tooltipster("show");
|
||||
nodeTarget.tooltipster("show");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -350,24 +355,22 @@ Function nodeData
|
|||
Return array(data)
|
||||
This function returns the data of the node
|
||||
*/
|
||||
MapController.prototype.nodeData = function() {
|
||||
/*
|
||||
$.ajax({
|
||||
url: ,
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
getNodeData: 1,
|
||||
},
|
||||
complete: function(xhr, textStatus) {
|
||||
|
||||
},
|
||||
success: function(data, textStatus, xhr) {
|
||||
|
||||
},
|
||||
error: function(xhr, textStatus, errorThrown) {
|
||||
MapController.prototype.nodeData = function(data_id, type, id_map, data_graph_id, origin) {
|
||||
var params = {};
|
||||
params["getNodeData"] = 1;
|
||||
params["id_node_data"] = data_id;
|
||||
params["type"] = type;
|
||||
params["id_map"] = id_map;
|
||||
params["data_graph_id"] = data_graph_id;
|
||||
params["page"] = "include/ajax/map.ajax";
|
||||
|
||||
jQuery.ajax ({
|
||||
data: params,
|
||||
dataType: "json",
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
success: function (data) {
|
||||
origin.tooltipster('content', data);
|
||||
}
|
||||
});
|
||||
*/
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue