Fixed the minimap.
This commit is contained in:
parent
f0d4ae7a9c
commit
5cc89d968c
|
@ -154,12 +154,14 @@ if (is_ajax ()) {
|
||||||
}
|
}
|
||||||
else if ($getNodeDetails) {
|
else if ($getNodeDetails) {
|
||||||
$id_node_data = (int)get_parameter('id_node_data');
|
$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');
|
$data_graph_id = (int)get_parameter('data_graph_id');
|
||||||
$node_id = get_parameter('node_id');
|
$node_id = get_parameter('node_id');
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
?>
|
?>
|
||||||
<div id="details_{data_graph_id}">
|
<div id="tooltip_{data_graph_id}">
|
||||||
<div class="title_bar">
|
<div class="title_bar">
|
||||||
<span class="title">{title}</span>
|
<span class="title">{title}</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -170,68 +172,102 @@ if (is_ajax ()) {
|
||||||
<?php
|
<?php
|
||||||
$details = ob_get_clean();
|
$details = ob_get_clean();
|
||||||
|
|
||||||
$details = str_replace(
|
switch ($type) {
|
||||||
"{data_graph_id}",
|
case ITEM_TYPE_AGENT_NETWORKMAP:
|
||||||
$data_graph_id,
|
$details = str_replace(
|
||||||
$details);
|
"{data_graph_id}",
|
||||||
$details = str_replace(
|
$data_graph_id,
|
||||||
"{node_id}",
|
$details);
|
||||||
$node_id,
|
$details = str_replace(
|
||||||
$details);
|
"{node_id}",
|
||||||
$details = str_replace(
|
$node_id,
|
||||||
"{title}",
|
$details);
|
||||||
agents_get_name($id_node_data),
|
$details = str_replace(
|
||||||
$details);
|
"{title}",
|
||||||
|
agents_get_name($id_node_data),
|
||||||
$agent_modules = agents_get_modules($id_node_data);
|
$details);
|
||||||
$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);
|
$details = str_replace(
|
||||||
}
|
"{body}",
|
||||||
if ($module_data['module_interval']) {
|
$body,
|
||||||
$data[3] = human_time_description_raw($module_data['module_interval']);
|
$details);
|
||||||
}
|
|
||||||
else {
|
break;
|
||||||
$data[3] = human_time_description_raw($agent_interval);
|
case ITEM_TYPE_MODULE_NETWORKMAP:
|
||||||
}
|
$node_data = db_get_all_rows_sql("SELECT descripcion
|
||||||
$data[4] = ui_print_status_image($status, $title, true);;
|
FROM tagente_modulo
|
||||||
array_push ($table->data, $data);
|
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;
|
||||||
}
|
}
|
||||||
$body = html_print_table ($table, true);
|
$body = html_print_table ($table, true);
|
||||||
|
|
||||||
|
|
|
@ -184,11 +184,11 @@ MapController.prototype.init_map = function() {
|
||||||
MapController.prototype.minimap_get_size = function() {
|
MapController.prototype.minimap_get_size = function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
var map_size = d3.select(self._target).node().getBoundingClientRect();
|
var map_size = d3.select(self._target + " .minimap").node().getBBox();
|
||||||
|
|
||||||
var minimap_size = [];
|
var minimap_size = [];
|
||||||
minimap_size[0] = map_size.width / RELATION_MINIMAP;
|
minimap_size[0] = map_size.width;
|
||||||
minimap_size[1] = map_size.height / RELATION_MINIMAP;
|
minimap_size[1] = map_size.height;
|
||||||
|
|
||||||
return minimap_size;
|
return minimap_size;
|
||||||
}
|
}
|
||||||
|
@ -344,11 +344,11 @@ MapController.prototype.event_toggle_minimap = function() {
|
||||||
MapController.prototype.paint_minimap = function() {
|
MapController.prototype.paint_minimap = function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
var map_size = d3.select(self._target).node().getBoundingClientRect();
|
var screen_size = d3.select(self._target).node().getBoundingClientRect();
|
||||||
var viewport_size = d3.select(self._target + " .viewport").node().getBBox();
|
var map_size = d3.select(self._target + " .viewport").node().getBBox();
|
||||||
|
|
||||||
var minimap_map_width = map_size.width / RELATION_MINIMAP;
|
var minimap_map_width = (map_size.width + map_size.x) / RELATION_MINIMAP;
|
||||||
var minimap_map_height = map_size.height / RELATION_MINIMAP;
|
var minimap_map_height = (map_size.height + map_size.y) / RELATION_MINIMAP;
|
||||||
|
|
||||||
var minimap = d3.select(self._target + " .minimap");
|
var minimap = d3.select(self._target + " .minimap");
|
||||||
var svg = d3.select(self._target + " svg");
|
var svg = d3.select(self._target + " svg");
|
||||||
|
@ -356,7 +356,8 @@ MapController.prototype.paint_minimap = function() {
|
||||||
var transform = d3.transform();
|
var transform = d3.transform();
|
||||||
|
|
||||||
// Move the minimap to the right upper corner
|
// Move the minimap to the right upper corner
|
||||||
transform.translate[0] = map_size.width - minimap_map_width;
|
transform.translate[0] = screen_size.width - minimap_map_width;
|
||||||
|
transform.translate[1] = 0;
|
||||||
minimap.attr("transform", transform.toString());
|
minimap.attr("transform", transform.toString());
|
||||||
|
|
||||||
svg.append("defs")
|
svg.append("defs")
|
||||||
|
@ -376,34 +377,41 @@ MapController.prototype.paint_minimap = function() {
|
||||||
.attr("height", minimap_map_height)
|
.attr("height", minimap_map_height)
|
||||||
.attr("style", "fill: #ffffff; stroke: #000000; stroke-width: 1;");
|
.attr("style", "fill: #ffffff; stroke: #000000; stroke-width: 1;");
|
||||||
|
|
||||||
|
transform = d3.transform();
|
||||||
|
transform.scale[0] = 1 / RELATION_MINIMAP;
|
||||||
|
transform.scale[1] = 1 / RELATION_MINIMAP;
|
||||||
|
|
||||||
var minimap_layer = minimap
|
var minimap_layer = minimap
|
||||||
.append("g")
|
.append("g")
|
||||||
.attr("class", "clip_minimap")
|
.attr("class", "clip_minimap")
|
||||||
.attr("clip-path", "url(#clip_minimap)")
|
.attr("clip-path", "url(#clip_minimap)")
|
||||||
.append("g")
|
.append("g")
|
||||||
.attr("class", "layer");
|
.attr("class", "map")
|
||||||
|
.attr("transform", transform.toString());
|
||||||
|
|
||||||
|
|
||||||
var minimap_viewport = minimap_layer.append("g")
|
//~ var minimap_viewport = minimap_layer.append("g")
|
||||||
.attr("id", "viewport");
|
//~ .attr("id", "viewport");
|
||||||
|
//~
|
||||||
minimap_viewport.append("rect")
|
//~ minimap_viewport.append("rect")
|
||||||
.attr("style", "fill: #dddddd; stroke: #aaaaaa; stroke-width: 1;")
|
//~ .attr("style", "fill: #dddddd; stroke: #aaaaaa; stroke-width: 1;")
|
||||||
.attr("x", 0)
|
//~ .attr("x", 0)
|
||||||
.attr("y", 0)
|
//~ .attr("y", 0)
|
||||||
.attr("height", viewport_size.width)
|
//~ .attr("height", screen_size.height)
|
||||||
.attr("width", viewport_size.height);
|
//~ .attr("width", screen_size.width);
|
||||||
|
//~
|
||||||
self.paint_toggle_button();
|
self.paint_toggle_button();
|
||||||
|
|
||||||
self.paint_items_minimap();
|
self.paint_items_minimap();
|
||||||
|
|
||||||
self.zoom_minimap();
|
//~
|
||||||
|
//~ self.zoom_minimap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MapController.prototype.paint_items_minimap = function() {
|
MapController.prototype.paint_items_minimap = function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
var minimap_viewport = d3.select(self._target + " .minimap #viewport");
|
var minimap_viewport = d3.select(self._target + " .minimap .map");
|
||||||
|
|
||||||
minimap_viewport.selectAll(".node")
|
minimap_viewport.selectAll(".node")
|
||||||
.data(
|
.data(
|
||||||
|
@ -422,6 +430,7 @@ MapController.prototype.paint_items_minimap = function() {
|
||||||
function(d) {
|
function(d) {
|
||||||
var x = d['x'];
|
var x = d['x'];
|
||||||
var y = d['y'];
|
var y = d['y'];
|
||||||
|
|
||||||
return "translate(" + x + " " + y + ")";
|
return "translate(" + x + " " + y + ")";
|
||||||
})
|
})
|
||||||
.attr("class", "node")
|
.attr("class", "node")
|
||||||
|
@ -430,8 +439,10 @@ MapController.prototype.paint_items_minimap = function() {
|
||||||
.attr("data-graph_id", function(d) { return d['graph_id'];})
|
.attr("data-graph_id", function(d) { return d['graph_id'];})
|
||||||
.attr("data-type", function(d) { return d['type'];})
|
.attr("data-type", function(d) { return d['type'];})
|
||||||
.append("circle")
|
.append("circle")
|
||||||
.attr("style", "fill: #000000;")
|
.attr("style", "fill: rgb(50, 50, 128);")
|
||||||
.attr("r", 15);
|
.attr("x", -8)
|
||||||
|
.attr("y", -8)
|
||||||
|
.attr("r", 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
MapController.prototype.zoom_minimap = function() {
|
MapController.prototype.zoom_minimap = function() {
|
||||||
|
|
Loading…
Reference in New Issue