mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Fixes minor issues
This commit is contained in:
parent
5b40a4f700
commit
7bfe699802
@ -108,3 +108,7 @@ enterprise/godmode/alerts/alert_events_rules.php
|
|||||||
enterprise/godmode/alerts/configure_alert_rule.php
|
enterprise/godmode/alerts/configure_alert_rule.php
|
||||||
enterprise/include/functions_networkmap.php
|
enterprise/include/functions_networkmap.php
|
||||||
enterprise/operation/agentes/pandora_networkmap.view.php
|
enterprise/operation/agentes/pandora_networkmap.view.php
|
||||||
|
enterprise/include/ajax/map_enterprise.ajax.php
|
||||||
|
enterprise/include/javascript/SimpleMapController.js
|
||||||
|
enterprise/include/javascript/tooltipster.bundle.min.js
|
||||||
|
enterprise/include/styles/tooltipster.bundle.min.css
|
102
pandora_console/include/ajax/map_enterprise.ajax.php
Normal file
102
pandora_console/include/ajax/map_enterprise.ajax.php
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
<?php
|
||||||
|
// ______ __ _______ _______ _______
|
||||||
|
// | __ \.---.-.-----.--| |.-----.----.---.-. | ___| | | __|
|
||||||
|
// | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
// |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
//
|
||||||
|
// ============================================================================
|
||||||
|
// Copyright (c) 2007-2021 Artica Soluciones Tecnologicas, http://www.artica.es
|
||||||
|
// This code is NOT free software. This code is NOT licenced under GPL2 licence
|
||||||
|
// You cannnot redistribute it without written permission of copyright holder.
|
||||||
|
// ============================================================================
|
||||||
|
$networkmap = get_parameter('networkmap', false);
|
||||||
|
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
require_once $config['homedir'].'/include/class/NetworkMap.class.php';
|
||||||
|
|
||||||
|
|
||||||
|
if ((bool) is_metaconsole() === true) {
|
||||||
|
$node = get_parameter('node', 0);
|
||||||
|
if ($node > 0) {
|
||||||
|
metaconsole_connect(null, $node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($networkmap) {
|
||||||
|
$networkmap_id = get_parameter('networkmap_id', 0);
|
||||||
|
$x_offset = get_parameter('x_offset', 0);
|
||||||
|
$y_offset = get_parameter('y_offset', 0);
|
||||||
|
$zoom_dash = get_parameter('zoom_dash', 0.5);
|
||||||
|
|
||||||
|
// Dashboard mode.
|
||||||
|
$ignore_acl = (bool) get_parameter('ignore_acl', 0);
|
||||||
|
|
||||||
|
$networkmap = db_get_row_filter('tmap', ['id' => $networkmap_id]);
|
||||||
|
|
||||||
|
if ($ignore_acl === false) {
|
||||||
|
// ACL for the network map.
|
||||||
|
$networkmap_read = check_acl($config['id_user'], $networkmap['id_group'], 'MR');
|
||||||
|
$networkmap_write = check_acl($config['id_user'], $networkmap['id_group'], 'MW');
|
||||||
|
$networkmap_manage = check_acl($config['id_user'], $networkmap['id_group'], 'MM');
|
||||||
|
|
||||||
|
if (!$networkmap_read && !$networkmap_write && !$networkmap_manage) {
|
||||||
|
db_pandora_audit(
|
||||||
|
'ACL Violation',
|
||||||
|
'Trying to access networkmap'
|
||||||
|
);
|
||||||
|
include 'general/noaccess.php';
|
||||||
|
|
||||||
|
if ($node > 0) {
|
||||||
|
metaconsole_restore_db();
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
if ($networkmap['generation_method'] == LAYOUT_RADIAL_DYNAMIC) {
|
||||||
|
$data['name'] = '<a href="index.php?'.'sec=network&'.'sec2=operation/agentes/networkmap.dinamic&'.'activeTab=radial_dynamic&'.'id_networkmap='.$networkmap['id'].'">'.$networkmap['name'].'</a>';
|
||||||
|
global $id_networkmap;
|
||||||
|
$id_networkmap = $networkmap['id'];
|
||||||
|
$tab = 'radial_dynamic';
|
||||||
|
|
||||||
|
include_once 'operation/agentes/networkmap.dinamic.php';
|
||||||
|
} else {
|
||||||
|
$map = new NetworkMap(
|
||||||
|
[
|
||||||
|
'id_map' => $networkmap_id,
|
||||||
|
'widget' => 1,
|
||||||
|
'pure' => 1,
|
||||||
|
'no_popup' => 1,
|
||||||
|
'map_options' => [
|
||||||
|
'x_offs' => $x_offset,
|
||||||
|
'y_offs' => $y_offset,
|
||||||
|
'z_dash' => $zoom_dash,
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$map->printMap(false, $ignore_acl);
|
||||||
|
}
|
||||||
|
|
||||||
|
$return = ob_get_clean();
|
||||||
|
|
||||||
|
echo $return;
|
||||||
|
|
||||||
|
|
||||||
|
if ($node > 0) {
|
||||||
|
metaconsole_restore_db();
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($node > 0) {
|
||||||
|
metaconsole_restore_db();
|
||||||
|
}
|
@ -30,7 +30,6 @@
|
|||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
require_once $config['homedir'].'/include/functions_networkmap.php';
|
require_once $config['homedir'].'/include/functions_networkmap.php';
|
||||||
enterprise_include_once('include/functions_networkmap.php');
|
|
||||||
enterprise_include_once('include/functions_discovery.php');
|
enterprise_include_once('include/functions_discovery.php');
|
||||||
|
|
||||||
// Avoid node overlapping.
|
// Avoid node overlapping.
|
||||||
@ -723,13 +722,7 @@ class NetworkMap
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->idMap !== false) {
|
if ($this->idMap !== false) {
|
||||||
if (enterprise_installed()) {
|
$this->nodes = get_nodes_from_db($this->idMap);
|
||||||
// Enterprise environment: LOAD.
|
|
||||||
$this->nodes = enterprise_hook(
|
|
||||||
'get_nodes_from_db',
|
|
||||||
[$this->idMap]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->nodes;
|
return $this->nodes;
|
||||||
@ -762,12 +755,7 @@ class NetworkMap
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->idMap !== false) {
|
if ($this->idMap !== false) {
|
||||||
if (enterprise_installed()) {
|
$this->relations = get_relations_from_db($this->idMap);
|
||||||
$this->relations = enterprise_hook(
|
|
||||||
'get_relations_from_db',
|
|
||||||
[$this->idMap]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->relations;
|
return $this->relations;
|
||||||
@ -786,12 +774,9 @@ class NetworkMap
|
|||||||
|
|
||||||
// Calculate.
|
// Calculate.
|
||||||
// Search.
|
// Search.
|
||||||
if (enterprise_installed() && $this->idTask) {
|
if ($this->idTask) {
|
||||||
// Network map, based on discovery task.
|
// Network map, based on discovery task.
|
||||||
return enterprise_hook(
|
return get_discovery_agents($this->idTask);
|
||||||
'get_discovery_agents',
|
|
||||||
[$this->idTask]
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->network) {
|
if ($this->network) {
|
||||||
@ -1101,18 +1086,14 @@ class NetworkMap
|
|||||||
$relations = $this->relations;
|
$relations = $this->relations;
|
||||||
|
|
||||||
// Generate if there's no data in DB about nodes or relations.
|
// Generate if there's no data in DB about nodes or relations.
|
||||||
if (empty($nodes) && empty($relations)) {
|
if (empty($nodes) === true && empty($relations) === true) {
|
||||||
$this->generateNetworkMap();
|
$this->generateNetworkMap();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$graph = enterprise_hook(
|
$graph = networkmap_load_map($this);
|
||||||
'networkmap_load_map',
|
|
||||||
[$this]
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($graph === ENTERPRISE_NOT_HOOK) {
|
if (empty($graph) === true) {
|
||||||
// Method not available, regenerate.
|
|
||||||
$this->generateNetworkMap();
|
$this->generateNetworkMap();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2607,15 +2588,7 @@ class NetworkMap
|
|||||||
|
|
||||||
// Save data.
|
// Save data.
|
||||||
if ($this->idMap > 0 && (isset($this->map['__simulated']) === false)) {
|
if ($this->idMap > 0 && (isset($this->map['__simulated']) === false)) {
|
||||||
if (enterprise_installed()) {
|
$graph = save_generate_nodes($this->idMap, $graph);
|
||||||
$graph = enterprise_hook(
|
|
||||||
'save_generate_nodes',
|
|
||||||
[
|
|
||||||
$this->idMap,
|
|
||||||
$graph,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
db_process_sql_update(
|
db_process_sql_update(
|
||||||
'tmap',
|
'tmap',
|
||||||
@ -2733,7 +2706,6 @@ class NetworkMap
|
|||||||
$output .= 'var networkmap_refresh_time = 1000 * '.$networkmap['source_period'].";\n";
|
$output .= 'var networkmap_refresh_time = 1000 * '.$networkmap['source_period'].";\n";
|
||||||
$output .= 'var networkmap_center = [ '.$networkmap['center_x'].', '.$networkmap['center_y']."];\n";
|
$output .= 'var networkmap_center = [ '.$networkmap['center_x'].', '.$networkmap['center_y']."];\n";
|
||||||
$output .= 'var networkmap_dimensions = [ '.$networkmap['width'].', '.$networkmap['height']."];\n";
|
$output .= 'var networkmap_dimensions = [ '.$networkmap['width'].', '.$networkmap['height']."];\n";
|
||||||
$output .= 'var enterprise_installed = '.((int) enterprise_installed()).";\n";
|
|
||||||
$output .= 'var networkmap_write = '.$networkmap_write.";\n";
|
$output .= 'var networkmap_write = '.$networkmap_write.";\n";
|
||||||
$output .= 'var node_radius = '.$networkmap['filter']['node_radius'].";\n";
|
$output .= 'var node_radius = '.$networkmap['filter']['node_radius'].";\n";
|
||||||
$output .= 'var networkmap_holding_area_dimensions = '.json_encode($networkmap['filter']['holding_area']).";\n";
|
$output .= 'var networkmap_holding_area_dimensions = '.json_encode($networkmap['filter']['holding_area']).";\n";
|
||||||
@ -2883,22 +2855,14 @@ class NetworkMap
|
|||||||
public function loadAdvancedInterface()
|
public function loadAdvancedInterface()
|
||||||
{
|
{
|
||||||
$list_networkmaps = get_networkmaps($this->idMap);
|
$list_networkmaps = get_networkmaps($this->idMap);
|
||||||
if (empty($list_networkmaps)) {
|
hd($list_networkmaps);
|
||||||
|
if (empty($list_networkmaps) === true) {
|
||||||
$list_networkmaps = [];
|
$list_networkmaps = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$id = 'dialog_node_edit';
|
$id = 'dialog_node_edit';
|
||||||
if (!enterprise_installed()) {
|
|
||||||
$id = 'open_version_dialog';
|
|
||||||
$output = '<div id="open_version" style="display: none" title="'.__('Warning').'">';
|
|
||||||
$output .= '<div class="center mrgn_top_20px w90p font_13px">'.__(
|
|
||||||
'In the Open version of %s can not be edited nodes or map',
|
|
||||||
get_product_name()
|
|
||||||
);
|
|
||||||
$output .= '</div></div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
$output .= '<div id="'.$id.'" class="invisible" title="';
|
$output = '<div id="'.$id.'" class="invisible" title="';
|
||||||
$output .= __('Edit node').'">';
|
$output .= __('Edit node').'">';
|
||||||
$output .= '<div class="left w100p">';
|
$output .= '<div class="left w100p">';
|
||||||
|
|
||||||
@ -3017,7 +2981,6 @@ class NetworkMap
|
|||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
if (enterprise_installed()) {
|
|
||||||
$output .= ui_toggle(
|
$output .= ui_toggle(
|
||||||
html_print_table($table, true),
|
html_print_table($table, true),
|
||||||
__('Node options'),
|
__('Node options'),
|
||||||
@ -3026,7 +2989,6 @@ class NetworkMap
|
|||||||
true,
|
true,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
$table = new StdClass();
|
$table = new StdClass();
|
||||||
$table->id = 'relations_table';
|
$table->id = 'relations_table';
|
||||||
@ -3109,7 +3071,6 @@ class NetworkMap
|
|||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
if (enterprise_installed()) {
|
|
||||||
$output .= ui_toggle(
|
$output .= ui_toggle(
|
||||||
html_print_table($table, true),
|
html_print_table($table, true),
|
||||||
__('Relations'),
|
__('Relations'),
|
||||||
@ -3118,7 +3079,6 @@ class NetworkMap
|
|||||||
true,
|
true,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
$output .= '</div></div>';
|
$output .= '</div></div>';
|
||||||
|
|
||||||
@ -3340,8 +3300,7 @@ class NetworkMap
|
|||||||
{
|
{
|
||||||
$output = '';
|
$output = '';
|
||||||
|
|
||||||
if (enterprise_installed()
|
if ($this->useTooltipster
|
||||||
&& $this->useTooltipster
|
|
||||||
) {
|
) {
|
||||||
$output .= '<script type="text/javascript">
|
$output .= '<script type="text/javascript">
|
||||||
$(function() {
|
$(function() {
|
||||||
@ -3376,7 +3335,7 @@ class NetworkMap
|
|||||||
graph: networkmap,
|
graph: networkmap,
|
||||||
networkmap_center: networkmap_center,
|
networkmap_center: networkmap_center,
|
||||||
networkmap_dimensions: networkmap_dimensions,
|
networkmap_dimensions: networkmap_dimensions,
|
||||||
enterprise_installed: enterprise_installed,
|
enterprise_installed: 1,
|
||||||
node_radius: node_radius,
|
node_radius: node_radius,
|
||||||
holding_area_dimensions: networkmap_holding_area_dimensions,
|
holding_area_dimensions: networkmap_holding_area_dimensions,
|
||||||
url_background_grid: url_background_grid,
|
url_background_grid: url_background_grid,
|
||||||
@ -3419,18 +3378,17 @@ class NetworkMap
|
|||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if (enterprise_installed()
|
if (isset($this->useTooltipster) === true
|
||||||
&& isset($this->useTooltipster)
|
&& (bool) $this->useTooltipster === true
|
||||||
&& $this->useTooltipster == true
|
|
||||||
) {
|
) {
|
||||||
$output = '<script type="text/javascript" src="'.ui_get_full_url(
|
$output = '<script type="text/javascript" src="'.ui_get_full_url(
|
||||||
'include/javascript/d3.3.5.14.js'
|
'include/javascript/d3.3.5.14.js'
|
||||||
).'" charset="utf-8"></script>';
|
).'" charset="utf-8"></script>';
|
||||||
$output .= '<script type="text/javascript" src="'.ui_get_full_url(
|
$output .= '<script type="text/javascript" src="'.ui_get_full_url(
|
||||||
'enterprise/include/javascript/SimpleMapController.js'
|
'include/javascript/SimpleMapController.js'
|
||||||
).'"></script>';
|
).'"></script>';
|
||||||
$output .= '<script type="text/javascript" src="'.ui_get_full_url(
|
$output .= '<script type="text/javascript" src="'.ui_get_full_url(
|
||||||
'enterprise/include/javascript/tooltipster.bundle.min.js'
|
'include/javascript/tooltipster.bundle.min.js'
|
||||||
).'"></script>';
|
).'"></script>';
|
||||||
$output .= '<script type="text/javascript" src="'.ui_get_full_url(
|
$output .= '<script type="text/javascript" src="'.ui_get_full_url(
|
||||||
'include/javascript/jquery.svg.js'
|
'include/javascript/jquery.svg.js'
|
||||||
@ -3439,7 +3397,7 @@ class NetworkMap
|
|||||||
'include/javascript/jquery.svgdom.js'
|
'include/javascript/jquery.svgdom.js'
|
||||||
).'"></script>';
|
).'"></script>';
|
||||||
$output .= '<link rel="stylesheet" type="text/css" href="'.ui_get_full_url(
|
$output .= '<link rel="stylesheet" type="text/css" href="'.ui_get_full_url(
|
||||||
'/enterprise/include/styles/tooltipster.bundle.min.css'
|
'include/styles/tooltipster.bundle.min.css'
|
||||||
).'" />'."\n";
|
).'" />'."\n";
|
||||||
|
|
||||||
$output .= '<div id="simple_map" data-id="'.$this->idMap.'" ';
|
$output .= '<div id="simple_map" data-id="'.$this->idMap.'" ';
|
||||||
|
459
pandora_console/include/javascript/SimpleMapController.js
Normal file
459
pandora_console/include/javascript/SimpleMapController.js
Normal file
@ -0,0 +1,459 @@
|
|||||||
|
// Pandora FMS - http://pandorafms.com
|
||||||
|
// ==================================================
|
||||||
|
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
||||||
|
// Please see http://pandorafms.org for full contribution list
|
||||||
|
|
||||||
|
// This program is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Lesser General Public License
|
||||||
|
// as published by the Free Software Foundation; version 2
|
||||||
|
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
|
||||||
|
/* globals d3 */
|
||||||
|
/* globals jQuery */
|
||||||
|
/* globals $ */
|
||||||
|
|
||||||
|
/*-----------------------------------------------*/
|
||||||
|
/*-------------------Constants-------------------*/
|
||||||
|
/*-----------------------------------------------*/
|
||||||
|
var MAX_ZOOM_LEVEL = 5;
|
||||||
|
|
||||||
|
/*-----------------------------------------------*/
|
||||||
|
/*------------------Constructor------------------*/
|
||||||
|
/*-----------------------------------------------*/
|
||||||
|
var SimpleMapController = function(params) {
|
||||||
|
if (!params) {
|
||||||
|
console.log("[SimpleMapController]: No params received");
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
this._target = params["target"];
|
||||||
|
|
||||||
|
if (typeof params["map_width"] == "undefined") {
|
||||||
|
this.map_width = 0;
|
||||||
|
} else {
|
||||||
|
this.map_width = params["map_width"];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof params["map_height"] == "undefined") {
|
||||||
|
this.map_height = 0;
|
||||||
|
} else {
|
||||||
|
this.map_height = params["map_height"];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof params["font_size"] == "undefined") {
|
||||||
|
this.font_size = 20;
|
||||||
|
} else {
|
||||||
|
this.font_size = params["font_size"];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof params["homedir"] == "undefined") {
|
||||||
|
this.homedir = "";
|
||||||
|
} else {
|
||||||
|
this.homedir = params["homedir"];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof params["custom_params"] == "undefined") {
|
||||||
|
this.custom_params = "";
|
||||||
|
} else {
|
||||||
|
this.custom_params = params["custom_params"];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof params["center_x"] == "undefined") {
|
||||||
|
this.center_x = 0;
|
||||||
|
} else {
|
||||||
|
this.center_x = params["center_x"];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof params["center_y"] == "undefined") {
|
||||||
|
this.center_y = 0;
|
||||||
|
} else {
|
||||||
|
this.center_y = params["center_y"];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof params["z_dash"] == "undefined") {
|
||||||
|
this.z_dash = 0.5;
|
||||||
|
} else {
|
||||||
|
this.z_dash = params["z_dash"];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof params["nodes"] == "undefined") {
|
||||||
|
this.nodes = [];
|
||||||
|
} else {
|
||||||
|
this.nodes = params["nodes"];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof params["arrows"] == "undefined") {
|
||||||
|
this.arrows = [];
|
||||||
|
} else {
|
||||||
|
this.arrows = params["arrows"];
|
||||||
|
}
|
||||||
|
|
||||||
|
var factor = $(this._target).width() / $(this._target).height();
|
||||||
|
|
||||||
|
// Center is about complete SVG map not only central node.
|
||||||
|
// Calculus is to leave same space on left-right (width)
|
||||||
|
// and top-bottom (height).
|
||||||
|
this.center_x = ($(this._target).width() - this.map_width * factor) / 2;
|
||||||
|
this.center_y = ($(this._target).height() - this.map_height * factor) / 2;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*-----------------------------------------------*/
|
||||||
|
/*------------------Atributes--------------------*/
|
||||||
|
/*-----------------------------------------------*/
|
||||||
|
SimpleMapController.prototype._viewport = null;
|
||||||
|
SimpleMapController.prototype._zoomManager = null;
|
||||||
|
|
||||||
|
/*-----------------------------------------------*/
|
||||||
|
/*--------------------Methods--------------------*/
|
||||||
|
/*-----------------------------------------------*/
|
||||||
|
/**
|
||||||
|
* Function init_trans_map
|
||||||
|
* Return void
|
||||||
|
* This function init the transactional map
|
||||||
|
*/
|
||||||
|
SimpleMapController.prototype.init_map = function() {
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
var svg = d3.select(self._target + " svg");
|
||||||
|
|
||||||
|
self._zoomManager = d3.behavior
|
||||||
|
.zoom()
|
||||||
|
.scale(self.z_dash)
|
||||||
|
.scaleExtent([1 / MAX_ZOOM_LEVEL, MAX_ZOOM_LEVEL])
|
||||||
|
.on("zoom", zoom);
|
||||||
|
|
||||||
|
self._viewport = svg
|
||||||
|
.call(self._zoomManager)
|
||||||
|
.append("g")
|
||||||
|
.attr("class", "viewport")
|
||||||
|
.attr("transform", "translate(0, 0) scale(" + self.z_dash + ")");
|
||||||
|
|
||||||
|
self._slider = d3
|
||||||
|
.select(self._target + " .zoom_controller .vertical_range")
|
||||||
|
.property("value", 0)
|
||||||
|
.property("min", -Math.log(MAX_ZOOM_LEVEL))
|
||||||
|
.property("max", Math.log(MAX_ZOOM_LEVEL))
|
||||||
|
.property("step", (Math.log(MAX_ZOOM_LEVEL) * 2) / MAX_ZOOM_LEVEL)
|
||||||
|
.on("input", slided);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function zoom
|
||||||
|
* Return void
|
||||||
|
* This function manages the zoom
|
||||||
|
*/
|
||||||
|
function zoom() {
|
||||||
|
self.last_event = "zoom";
|
||||||
|
|
||||||
|
var zoom_level = d3.event.scale;
|
||||||
|
|
||||||
|
self._slider.property("value", Math.log(zoom_level));
|
||||||
|
|
||||||
|
self._viewport.attr(
|
||||||
|
"transform",
|
||||||
|
"translate(" + d3.event.translate + ") scale(" + zoom_level + ")"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function slided
|
||||||
|
* Return void
|
||||||
|
* This function manages the slide (zoom system)
|
||||||
|
*/
|
||||||
|
function slided() {
|
||||||
|
var slider_value = parseFloat(self._slider.property("value"));
|
||||||
|
|
||||||
|
var zoom_level = Math.exp(slider_value);
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------*/
|
||||||
|
/*-Code to translate the map with the zoom for to hold the center-*/
|
||||||
|
/*----------------------------------------------------------------*/
|
||||||
|
var center = [
|
||||||
|
parseFloat(d3.select(self._target).style("width")) / 2,
|
||||||
|
parseFloat(d3.select(self._target).style("height")) / 2
|
||||||
|
];
|
||||||
|
|
||||||
|
var old_translate = self._zoomManager.translate();
|
||||||
|
var old_scale = self._zoomManager.scale();
|
||||||
|
|
||||||
|
var temp1 = [
|
||||||
|
(center[0] - old_translate[0]) / old_scale,
|
||||||
|
(center[1] - old_translate[1]) / old_scale
|
||||||
|
];
|
||||||
|
|
||||||
|
var temp2 = [
|
||||||
|
temp1[0] * zoom_level + old_translate[0],
|
||||||
|
temp1[1] * zoom_level + old_translate[1]
|
||||||
|
];
|
||||||
|
|
||||||
|
var new_translation = [
|
||||||
|
old_translate[0] + center[0] - temp2[0],
|
||||||
|
old_translate[1] + center[1] - temp2[1]
|
||||||
|
];
|
||||||
|
|
||||||
|
self._zoomManager
|
||||||
|
.scale(zoom_level)
|
||||||
|
.translate(new_translation)
|
||||||
|
.event(self._viewport);
|
||||||
|
}
|
||||||
|
|
||||||
|
self.paint_arrows();
|
||||||
|
self.paint_nodes();
|
||||||
|
};
|
||||||
|
|
||||||
|
SimpleMapController.prototype.paint_nodes = function() {
|
||||||
|
var self = this;
|
||||||
|
if (self.nodes != null) {
|
||||||
|
// Initialize objects.
|
||||||
|
var circle_elem = self._viewport
|
||||||
|
.selectAll(".node")
|
||||||
|
.data(self.nodes)
|
||||||
|
.enter()
|
||||||
|
.append("g")
|
||||||
|
.attr("id", function(d) {
|
||||||
|
return "node_" + d["id"];
|
||||||
|
})
|
||||||
|
.attr("transform", function(d) {
|
||||||
|
return "translate(" + d["x"] + ", " + d["y"] + ")";
|
||||||
|
})
|
||||||
|
.attr("class", "draggable node")
|
||||||
|
.attr("image", function(d) {
|
||||||
|
return d["image"];
|
||||||
|
})
|
||||||
|
.attr("style", function(d) {
|
||||||
|
return (
|
||||||
|
"fill: " + d["color"] + "; " + "stroke: " + d["stroke-color"] + ";"
|
||||||
|
);
|
||||||
|
})
|
||||||
|
.attr("stroke-width", function(d) {
|
||||||
|
return d["stroke-width"];
|
||||||
|
})
|
||||||
|
.style("cursor", function(d) {
|
||||||
|
if (d["id"] === "0") {
|
||||||
|
return "default";
|
||||||
|
} else {
|
||||||
|
return "pointer";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Node size in map.
|
||||||
|
circle_elem
|
||||||
|
.append("circle")
|
||||||
|
.attr("cx", self.center_x)
|
||||||
|
.attr("cy", function(d) {
|
||||||
|
return self.center_y + d["radius"];
|
||||||
|
})
|
||||||
|
.attr("r", function(d) {
|
||||||
|
return d["radius"];
|
||||||
|
});
|
||||||
|
|
||||||
|
circle_elem.each(function(node, index) {
|
||||||
|
if (Array.isArray(node["label"])) {
|
||||||
|
node["label"].forEach(function(value, index2) {
|
||||||
|
d3.selectAll("#node_" + index)
|
||||||
|
.append("text")
|
||||||
|
.attr("dx", function(d) {
|
||||||
|
if (typeof d["label_x_offset"] == "undefined") {
|
||||||
|
d["label_x_offset"] = 0;
|
||||||
|
}
|
||||||
|
return self.center_x + d["label_x_offset"];
|
||||||
|
})
|
||||||
|
.attr("dy", function(d) {
|
||||||
|
if (typeof d["font_size"] == "undefined") {
|
||||||
|
d["font_size"] = self.font_size;
|
||||||
|
}
|
||||||
|
if (typeof d["label_y_offset"] == "undefined") {
|
||||||
|
d["label_y_offset"] = d["radius"] + d["font_size"];
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
self.center_y +
|
||||||
|
d["radius"] +
|
||||||
|
d["label_y_offset"] +
|
||||||
|
index2 * d["font_size"]
|
||||||
|
);
|
||||||
|
})
|
||||||
|
.style("text-anchor", "middle")
|
||||||
|
.style("font-size", function(d) {
|
||||||
|
if (typeof d["font_size"] == "undefined") {
|
||||||
|
d["font_size"] = self.font_size;
|
||||||
|
}
|
||||||
|
return d["font_size"] + "px";
|
||||||
|
})
|
||||||
|
.style("stroke-width", 0)
|
||||||
|
.attr("fill", "black")
|
||||||
|
.text(value);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
circle_elem
|
||||||
|
.append("text")
|
||||||
|
.attr("dx", function(d) {
|
||||||
|
if (typeof d["label_x_offset"] == "undefined") {
|
||||||
|
d["label_x_offset"] = 0;
|
||||||
|
}
|
||||||
|
return self.center_x + d["label_x_offset"];
|
||||||
|
})
|
||||||
|
.attr("dy", function(d) {
|
||||||
|
if (typeof d["font_size"] == "undefined") {
|
||||||
|
d["font_size"] = self.font_size;
|
||||||
|
}
|
||||||
|
if (typeof d["label_y_offset"] == "undefined") {
|
||||||
|
d["label_y_offset"] = d["radius"] + d["font_size"];
|
||||||
|
}
|
||||||
|
return self.center_y + d["radius"] + d["label_y_offset"];
|
||||||
|
})
|
||||||
|
.style("text-anchor", "middle")
|
||||||
|
.style("font-size", function(d) {
|
||||||
|
if (typeof d["font_size"] == "undefined") {
|
||||||
|
d["font_size"] = self.font_size;
|
||||||
|
}
|
||||||
|
return d["font_size"] + "px";
|
||||||
|
})
|
||||||
|
.style("stroke-width", 0)
|
||||||
|
.attr("fill", "black")
|
||||||
|
.text(function(d) {
|
||||||
|
return d["label"];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Node image.
|
||||||
|
circle_elem
|
||||||
|
.append("svg:image")
|
||||||
|
.attr("class", "node_image")
|
||||||
|
.attr("xlink:href", function(d) {
|
||||||
|
return d["image"];
|
||||||
|
})
|
||||||
|
.attr("x", function(d) {
|
||||||
|
if (typeof d["size_image"] != "undefined") {
|
||||||
|
return self.center_x - d["size_image"] / 2;
|
||||||
|
} else {
|
||||||
|
return self.center_x - 52 / 2;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.attr("y", function(d) {
|
||||||
|
if (typeof size_image != "undefined") {
|
||||||
|
return self.center_y + d["radius"] - d["size_image"] / 2;
|
||||||
|
} else {
|
||||||
|
return self.center_y + d["radius"] - 52 / 2;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.attr("width", function(d) {
|
||||||
|
return d["image_width"];
|
||||||
|
})
|
||||||
|
.attr("height", function(d) {
|
||||||
|
return d["image_height"];
|
||||||
|
});
|
||||||
|
|
||||||
|
// Tooltipster. This could be dynamic.
|
||||||
|
self.nodes.forEach(function(node) {
|
||||||
|
if (node["id_agent"] != 0) {
|
||||||
|
$("#node_" + node["id"]).tooltipster({
|
||||||
|
contentAsHTML: true,
|
||||||
|
onlyOne: true,
|
||||||
|
updateAnimation: null,
|
||||||
|
interactive: true,
|
||||||
|
trigger: "click",
|
||||||
|
content: $('<img src="' + self.homedir + '/images/spinner.gif"/>'),
|
||||||
|
functionReady: function() {
|
||||||
|
$("#node_" + node["id"]).tooltipster("open");
|
||||||
|
$(".tooltipster-content").css("background", "#FFF");
|
||||||
|
$(".tooltipster-content").css("color", "#000");
|
||||||
|
|
||||||
|
var params = self.custom_params;
|
||||||
|
|
||||||
|
// Add data node click.
|
||||||
|
params.node_data = node;
|
||||||
|
|
||||||
|
params["id_agent"] = node["id_agent"];
|
||||||
|
jQuery.ajax({
|
||||||
|
data: params,
|
||||||
|
dataType: "html",
|
||||||
|
type: "POST",
|
||||||
|
url: self.homedir + "/ajax.php",
|
||||||
|
success: function(data) {
|
||||||
|
$(".tooltipster-content").css("min-height", "330px");
|
||||||
|
$(".tooltipster-content").css("max-height", "500px");
|
||||||
|
$("#node_" + node["id"]).tooltipster("content", data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
SimpleMapController.prototype.paint_arrows = function() {
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
if (self.arrows != null) {
|
||||||
|
self._viewport
|
||||||
|
.selectAll(".arrow")
|
||||||
|
.data(self.arrows)
|
||||||
|
.enter()
|
||||||
|
.append("g")
|
||||||
|
.attr("class", "arrow")
|
||||||
|
.attr("to", function(d) {
|
||||||
|
return d["dest"];
|
||||||
|
})
|
||||||
|
.attr("from", function(d) {
|
||||||
|
return d["orig"];
|
||||||
|
})
|
||||||
|
.attr("style", "fill: rgb(50, 50, 128);")
|
||||||
|
.append("line")
|
||||||
|
.attr("stroke", "#373737")
|
||||||
|
.attr("stroke-width", 3)
|
||||||
|
.attr("x1", function(d) {
|
||||||
|
return self.center_x + self.getFirstPoint(d["orig"], "x");
|
||||||
|
})
|
||||||
|
.attr("y1", function(d) {
|
||||||
|
return self.center_y + self.getFirstPoint(d["orig"], "y");
|
||||||
|
})
|
||||||
|
.attr("x2", function(d) {
|
||||||
|
return self.center_x + self.getSecondPoint(d["dest"], "x");
|
||||||
|
})
|
||||||
|
.attr("y2", function(d) {
|
||||||
|
return self.center_y + self.getSecondPoint(d["dest"], "y");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
SimpleMapController.prototype.getFirstPoint = function(orig, coord) {
|
||||||
|
var self = this;
|
||||||
|
var point = 0;
|
||||||
|
|
||||||
|
self.nodes.forEach(function(node) {
|
||||||
|
if (node["id"] === orig) {
|
||||||
|
if (coord == "x") {
|
||||||
|
point = parseFloat(node["x"]);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
point = parseFloat(node["y"]) + node["radius"];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return point;
|
||||||
|
};
|
||||||
|
|
||||||
|
SimpleMapController.prototype.getSecondPoint = function(dest, coord) {
|
||||||
|
var self = this;
|
||||||
|
var point = 0;
|
||||||
|
|
||||||
|
self.nodes.forEach(function(node) {
|
||||||
|
if (node["id"] === dest) {
|
||||||
|
if (coord == "x") {
|
||||||
|
point = parseFloat(node["x"]);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
point = parseFloat(node["y"]) + node["radius"];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return point;
|
||||||
|
};
|
@ -194,7 +194,6 @@ function delete_link(
|
|||||||
target_module_id,
|
target_module_id,
|
||||||
id_link
|
id_link
|
||||||
) {
|
) {
|
||||||
if (enterprise_installed) {
|
|
||||||
var params = [];
|
var params = [];
|
||||||
params.push("delete_link=1");
|
params.push("delete_link=1");
|
||||||
params.push("networkmap_id=" + networkmap_id);
|
params.push("networkmap_id=" + networkmap_id);
|
||||||
@ -203,7 +202,7 @@ function delete_link(
|
|||||||
params.push("target_id=" + target_id);
|
params.push("target_id=" + target_id);
|
||||||
params.push("target_module_id=" + target_module_id);
|
params.push("target_module_id=" + target_module_id);
|
||||||
params.push("id_link=" + id_link);
|
params.push("id_link=" + id_link);
|
||||||
params.push("page=enterprise/operation/agentes/pandora_networkmap.view");
|
params.push("page=operation/agentes/pandora_networkmap.view");
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
@ -247,10 +246,8 @@ function delete_link(
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function update_fictional_node(id_db_node) {
|
function update_fictional_node(id_db_node) {
|
||||||
if (enterprise_installed) {
|
|
||||||
var name = $("input[name='edit_name_fictional_node']").val();
|
var name = $("input[name='edit_name_fictional_node']").val();
|
||||||
var networkmap_to_link = $("#edit_networkmap_to_link").val();
|
var networkmap_to_link = $("#edit_networkmap_to_link").val();
|
||||||
|
|
||||||
@ -260,7 +257,7 @@ function update_fictional_node(id_db_node) {
|
|||||||
params.push("node_id=" + id_db_node);
|
params.push("node_id=" + id_db_node);
|
||||||
params.push("name=" + name);
|
params.push("name=" + name);
|
||||||
params.push("networkmap_to_link=" + networkmap_to_link);
|
params.push("networkmap_to_link=" + networkmap_to_link);
|
||||||
params.push("page=enterprise/operation/agentes/pandora_networkmap.view");
|
params.push("page=operation/agentes/pandora_networkmap.view");
|
||||||
|
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
@ -289,10 +286,8 @@ function update_fictional_node(id_db_node) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function update_node_name(id_db_node) {
|
function update_node_name(id_db_node) {
|
||||||
if (enterprise_installed) {
|
|
||||||
var name = $("input[name='edit_name_node']").val();
|
var name = $("input[name='edit_name_node']").val();
|
||||||
|
|
||||||
var params = [];
|
var params = [];
|
||||||
@ -300,7 +295,7 @@ function update_node_name(id_db_node) {
|
|||||||
params.push("networkmap_id=" + networkmap_id);
|
params.push("networkmap_id=" + networkmap_id);
|
||||||
params.push("node_id=" + id_db_node);
|
params.push("node_id=" + id_db_node);
|
||||||
params.push("name=" + name);
|
params.push("name=" + name);
|
||||||
params.push("page=enterprise/operation/agentes/pandora_networkmap.view");
|
params.push("page=operation/agentes/pandora_networkmap.view");
|
||||||
|
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
@ -331,10 +326,8 @@ function update_node_name(id_db_node) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function change_shape(id_db_node) {
|
function change_shape(id_db_node) {
|
||||||
if (enterprise_installed) {
|
|
||||||
var shape = $("select[name='shape']").val();
|
var shape = $("select[name='shape']").val();
|
||||||
|
|
||||||
var params = [];
|
var params = [];
|
||||||
@ -342,7 +335,7 @@ function change_shape(id_db_node) {
|
|||||||
params.push("networkmap_id=" + networkmap_id);
|
params.push("networkmap_id=" + networkmap_id);
|
||||||
params.push("id=" + id_db_node);
|
params.push("id=" + id_db_node);
|
||||||
params.push("shape=" + shape);
|
params.push("shape=" + shape);
|
||||||
params.push("page=enterprise/operation/agentes/pandora_networkmap.view");
|
params.push("page=operation/agentes/pandora_networkmap.view");
|
||||||
|
|
||||||
$("#shape_icon_correct").css("display", "none");
|
$("#shape_icon_correct").css("display", "none");
|
||||||
$("#shape_icon_fail").css("display", "none");
|
$("#shape_icon_fail").css("display", "none");
|
||||||
@ -587,7 +580,6 @@ function change_shape(id_db_node) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function update_link(row_index, id_link) {
|
function update_link(row_index, id_link) {
|
||||||
var interface_source = parseInt(
|
var interface_source = parseInt(
|
||||||
@ -623,7 +615,7 @@ function update_link(row_index, id_link) {
|
|||||||
params.push("interface_target=" + interface_target);
|
params.push("interface_target=" + interface_target);
|
||||||
params.push("source_text=" + text_source_interface);
|
params.push("source_text=" + text_source_interface);
|
||||||
params.push("target_text=" + text_target_interface);
|
params.push("target_text=" + text_target_interface);
|
||||||
params.push("page=enterprise/operation/agentes/pandora_networkmap.view");
|
params.push("page=operation/agentes/pandora_networkmap.view");
|
||||||
|
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
@ -750,7 +742,7 @@ function move_to_networkmap(node) {
|
|||||||
params.push("get_networkmap_from_fictional=1");
|
params.push("get_networkmap_from_fictional=1");
|
||||||
params.push("id=" + node.id_db);
|
params.push("id=" + node.id_db);
|
||||||
params.push("id_map=" + node.map_id);
|
params.push("id_map=" + node.map_id);
|
||||||
params.push("page=enterprise/operation/agentes/pandora_networkmap.view");
|
params.push("page=operation/agentes/pandora_networkmap.view");
|
||||||
|
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
@ -771,6 +763,7 @@ function move_to_networkmap(node) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function edit_node(data_node, dblClick) {
|
function edit_node(data_node, dblClick) {
|
||||||
|
console.log("PATATA");
|
||||||
var flag_edit_node = true;
|
var flag_edit_node = true;
|
||||||
var edit_node = null;
|
var edit_node = null;
|
||||||
|
|
||||||
@ -825,11 +818,7 @@ function edit_node(data_node, dblClick) {
|
|||||||
var params = [];
|
var params = [];
|
||||||
params.push("get_agent_info=1");
|
params.push("get_agent_info=1");
|
||||||
params.push("id_agent=" + node_selected["id_agent"]);
|
params.push("id_agent=" + node_selected["id_agent"]);
|
||||||
params.push("page=enterprise/operation/agentes/pandora_networkmap.view");
|
|
||||||
|
|
||||||
if (!enterprise_installed) {
|
|
||||||
params.push("page=operation/agentes/pandora_networkmap.view");
|
params.push("page=operation/agentes/pandora_networkmap.view");
|
||||||
}
|
|
||||||
|
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
@ -914,7 +903,7 @@ function get_interface_data_to_table(node_selected, selected_links) {
|
|||||||
var params = [];
|
var params = [];
|
||||||
params.push("get_interface_info=1");
|
params.push("get_interface_info=1");
|
||||||
params.push("id_agent=" + node_selected["id_agent"]);
|
params.push("id_agent=" + node_selected["id_agent"]);
|
||||||
params.push("page=enterprise/operation/agentes/pandora_networkmap.view");
|
params.push("page=operation/agentes/pandora_networkmap.view");
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
@ -999,7 +988,7 @@ function load_interfaces(selected_links) {
|
|||||||
params3.push("get_intefaces=1");
|
params3.push("get_intefaces=1");
|
||||||
params3.push("id_agent_target=" + link_each.target.id_agent);
|
params3.push("id_agent_target=" + link_each.target.id_agent);
|
||||||
params3.push("id_agent_source=" + link_each.source.id_agent);
|
params3.push("id_agent_source=" + link_each.source.id_agent);
|
||||||
params3.push("page=enterprise/operation/agentes/pandora_networkmap.view");
|
params3.push("page=operation/agentes/pandora_networkmap.view");
|
||||||
|
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
data: params3.join("&"),
|
data: params3.join("&"),
|
||||||
@ -1162,7 +1151,6 @@ function add_agent_node(agents) {
|
|||||||
var x = (click_menu_position_svg[0] - translation[0]) / scale;
|
var x = (click_menu_position_svg[0] - translation[0]) / scale;
|
||||||
var y = (click_menu_position_svg[1] - translation[1]) / scale;
|
var y = (click_menu_position_svg[1] - translation[1]) / scale;
|
||||||
|
|
||||||
if (enterprise_installed) {
|
|
||||||
jQuery.each(id_agents, function(i, id_agent) {
|
jQuery.each(id_agents, function(i, id_agent) {
|
||||||
x = x + i * 20;
|
x = x + i * 20;
|
||||||
y = y + i * 20;
|
y = y + i * 20;
|
||||||
@ -1173,7 +1161,7 @@ function add_agent_node(agents) {
|
|||||||
params.push("id_agent=" + id_agent);
|
params.push("id_agent=" + id_agent);
|
||||||
params.push("x=" + x);
|
params.push("x=" + x);
|
||||||
params.push("y=" + y);
|
params.push("y=" + y);
|
||||||
params.push("page=enterprise/operation/agentes/pandora_networkmap.view");
|
params.push("page=operation/agentes/pandora_networkmap.view");
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
@ -1215,45 +1203,6 @@ function add_agent_node(agents) {
|
|||||||
|
|
||||||
graph.nodes.push(temp_node);
|
graph.nodes.push(temp_node);
|
||||||
|
|
||||||
/*jQuery.each(data['rel'], function(i, relation) {
|
|
||||||
var temp_link = {};
|
|
||||||
if (i == 0) {
|
|
||||||
var found = 0;
|
|
||||||
temp_link['source'] = graph.nodes[temp_node['id']];
|
|
||||||
jQuery.each(graph.nodes, function(j, element) {
|
|
||||||
if (element.id_agent == relation['id_agent_end']) {
|
|
||||||
found = j;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
temp_link['target'] = graph.nodes[found];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
var found = 0;
|
|
||||||
temp_link['target'] = graph.nodes[temp_node['id']];
|
|
||||||
jQuery.each(graph.nodes, function(j, element) {
|
|
||||||
if (element.id_agent == relation['id_agent_start']) {
|
|
||||||
found = j;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
temp_link['source'] = graph.nodes[found];
|
|
||||||
}
|
|
||||||
temp_link['id_db'] = String(relation['id_db']);
|
|
||||||
temp_link['id_agent_end'] = String(relation['id_agent_end']);
|
|
||||||
temp_link['id_agent_start'] = String(relation['id_agent_start']);
|
|
||||||
temp_link['id_module_end'] = relation['id_module_end'];
|
|
||||||
temp_link['id_module_start'] = relation['id_module_start'];
|
|
||||||
temp_link['source_in_db'] = String(relation['source_in_db']);
|
|
||||||
temp_link['target_in_db'] = String(relation['target_in_db']);
|
|
||||||
temp_link['arrow_end'] = relation['arrow_end'];
|
|
||||||
temp_link['arrow_start'] = relation['arrow_start'];
|
|
||||||
temp_link['status_end'] = relation['status_end'];
|
|
||||||
temp_link['status_start'] = relation['status_start'];
|
|
||||||
temp_link['text_end'] = relation['text_end'];
|
|
||||||
temp_link['text_start'] = relation['text_start'];
|
|
||||||
|
|
||||||
graph.links.push(temp_link);
|
|
||||||
});*/
|
|
||||||
|
|
||||||
draw_elements_graph();
|
draw_elements_graph();
|
||||||
init_drag_and_drop();
|
init_drag_and_drop();
|
||||||
set_positions_graph();
|
set_positions_graph();
|
||||||
@ -1268,26 +1217,6 @@ function add_agent_node(agents) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
$("#agent_name").val("");
|
|
||||||
$("#dialog_node_add").dialog("close");
|
|
||||||
|
|
||||||
var temp_node = {};
|
|
||||||
temp_node["id"] = graph.nodes.length;
|
|
||||||
temp_node["id_db"] = graph.nodes.length;
|
|
||||||
temp_node["id_agent"] = id_agent;
|
|
||||||
temp_node["id_module"] = "";
|
|
||||||
temp_node["px"] = x;
|
|
||||||
temp_node["py"] = y;
|
|
||||||
temp_node["x"] = x;
|
|
||||||
temp_node["y"] = y;
|
|
||||||
temp_node["z"] = 0;
|
|
||||||
temp_node["fixed"] = true;
|
|
||||||
temp_node["type"] = 0;
|
|
||||||
temp_node["map_id"] = networkmap_id;
|
|
||||||
|
|
||||||
graph.nodes.push(temp_node);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function hide_labels() {
|
function hide_labels() {
|
||||||
@ -1361,7 +1290,6 @@ function function_close_minimap() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function delete_nodes() {
|
function delete_nodes() {
|
||||||
if (enterprise_installed) {
|
|
||||||
var selection = d3.selectAll(".node_selected");
|
var selection = d3.selectAll(".node_selected");
|
||||||
selection.each(function(d) {
|
selection.each(function(d) {
|
||||||
//Avoid to delete pandora node center
|
//Avoid to delete pandora node center
|
||||||
@ -1372,7 +1300,7 @@ function delete_nodes() {
|
|||||||
var params = [];
|
var params = [];
|
||||||
params.push("id=" + d.id_db);
|
params.push("id=" + d.id_db);
|
||||||
params.push("delete_node=1");
|
params.push("delete_node=1");
|
||||||
params.push("page=enterprise/operation/agentes/pandora_networkmap.view");
|
params.push("page=operation/agentes/pandora_networkmap.view");
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
@ -1416,7 +1344,6 @@ function delete_nodes() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function zoom(manual) {
|
function zoom(manual) {
|
||||||
if (typeof manual == "undefined") {
|
if (typeof manual == "undefined") {
|
||||||
@ -1700,16 +1627,13 @@ function clear_selection() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function update_networkmap() {
|
function update_networkmap() {
|
||||||
if (enterprise_installed) {
|
|
||||||
node.each(function(d) {
|
node.each(function(d) {
|
||||||
// Do not update Pandora FMS node.
|
// Do not update Pandora FMS node.
|
||||||
if (d.type != 2) {
|
if (d.type != 2) {
|
||||||
var params = [];
|
var params = [];
|
||||||
params.push("update_node_color=1");
|
params.push("update_node_color=1");
|
||||||
params.push("id=" + d.id_db);
|
params.push("id=" + d.id_db);
|
||||||
params.push(
|
params.push("page=operation/agentes/pandora_networkmap.view");
|
||||||
"page=enterprise/operation/agentes/pandora_networkmap.view"
|
|
||||||
);
|
|
||||||
|
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
@ -1717,9 +1641,10 @@ function update_networkmap() {
|
|||||||
type: "POST",
|
type: "POST",
|
||||||
url: window.base_url_homedir + "/ajax.php",
|
url: window.base_url_homedir + "/ajax.php",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
d3.select(
|
d3.select("#id_node_" + d.id + networkmap_id + " .node_shape").style(
|
||||||
"#id_node_" + d.id + networkmap_id + " .node_shape"
|
"fill",
|
||||||
).style("fill", data["color"]);
|
data["color"]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -1728,7 +1653,7 @@ function update_networkmap() {
|
|||||||
link.each(function(d) {
|
link.each(function(d) {
|
||||||
if (d.id_module_start != 0 || d.id_module_end != 0) {
|
if (d.id_module_start != 0 || d.id_module_end != 0) {
|
||||||
if (d.id_module_start && d.id_module_start > 0) {
|
if (d.id_module_start && d.id_module_start > 0) {
|
||||||
var params = [];
|
let params = [];
|
||||||
params.push("module_get_status=1");
|
params.push("module_get_status=1");
|
||||||
params.push("page=operation/agentes/pandora_networkmap.view");
|
params.push("page=operation/agentes/pandora_networkmap.view");
|
||||||
params.push("id=" + d.id_module_start);
|
params.push("id=" + d.id_module_start);
|
||||||
@ -1751,7 +1676,7 @@ function update_networkmap() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (d.id_module_end && d.id_module_end > 0) {
|
if (d.id_module_end && d.id_module_end > 0) {
|
||||||
var params = [];
|
let params = [];
|
||||||
params.push("module_get_status=1");
|
params.push("module_get_status=1");
|
||||||
params.push("page=operation/agentes/pandora_networkmap.view");
|
params.push("page=operation/agentes/pandora_networkmap.view");
|
||||||
params.push("id=" + d.id_module_end);
|
params.push("id=" + d.id_module_end);
|
||||||
@ -1777,7 +1702,6 @@ function update_networkmap() {
|
|||||||
|
|
||||||
draw_minimap();
|
draw_minimap();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
// Minimap
|
// Minimap
|
||||||
@ -1902,13 +1826,7 @@ function show_menu(item, data) {
|
|||||||
items_list["details"] = {
|
items_list["details"] = {
|
||||||
name: edit_menu,
|
name: edit_menu,
|
||||||
icon: "details",
|
icon: "details",
|
||||||
disabled: function() {
|
disabled: false,
|
||||||
if (enterprise_installed) {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
callback: function(key, options) {
|
callback: function(key, options) {
|
||||||
edit_node(data, false);
|
edit_node(data, false);
|
||||||
}
|
}
|
||||||
@ -1917,15 +1835,11 @@ function show_menu(item, data) {
|
|||||||
name: interface_link_add,
|
name: interface_link_add,
|
||||||
icon: "interface_link_children",
|
icon: "interface_link_children",
|
||||||
disabled: function() {
|
disabled: function() {
|
||||||
if (enterprise_installed) {
|
|
||||||
if (data.type == 3 || data.type == 2) {
|
if (data.type == 3 || data.type == 2) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
callback: function(key, options) {
|
callback: function(key, options) {
|
||||||
var selection = d3.selectAll(".node_children");
|
var selection = d3.selectAll(".node_children");
|
||||||
@ -1949,13 +1863,7 @@ function show_menu(item, data) {
|
|||||||
items_list["children"] = {
|
items_list["children"] = {
|
||||||
name: set_as_children_menu,
|
name: set_as_children_menu,
|
||||||
icon: "children",
|
icon: "children",
|
||||||
disabled: function() {
|
disabled: false,
|
||||||
if (enterprise_installed) {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
callback: function(key, options) {
|
callback: function(key, options) {
|
||||||
var selection = d3.selectAll(".node_children");
|
var selection = d3.selectAll(".node_children");
|
||||||
selection.each(function(d) {
|
selection.each(function(d) {
|
||||||
@ -1987,15 +1895,11 @@ function show_menu(item, data) {
|
|||||||
name: set_parent_link,
|
name: set_parent_link,
|
||||||
icon: "interface_link_parent",
|
icon: "interface_link_parent",
|
||||||
disabled: function() {
|
disabled: function() {
|
||||||
if (enterprise_installed) {
|
|
||||||
if (data.type == 3 || data.type == 2) {
|
if (data.type == 3 || data.type == 2) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
callback: function(key, options) {
|
callback: function(key, options) {
|
||||||
var selection = d3.selectAll(".node_selected");
|
var selection = d3.selectAll(".node_selected");
|
||||||
@ -2013,15 +1917,11 @@ function show_menu(item, data) {
|
|||||||
name: abort_relationship_interface,
|
name: abort_relationship_interface,
|
||||||
icon: "interface_link_cancel",
|
icon: "interface_link_cancel",
|
||||||
disabled: function() {
|
disabled: function() {
|
||||||
if (enterprise_installed) {
|
|
||||||
if (data.type == 3) {
|
if (data.type == 3) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
callback: function(key, options) {
|
callback: function(key, options) {
|
||||||
cancel_set_parent_interface();
|
cancel_set_parent_interface();
|
||||||
@ -2039,13 +1939,7 @@ function show_menu(item, data) {
|
|||||||
items_list["set_parent"] = {
|
items_list["set_parent"] = {
|
||||||
name: set_parent_menu,
|
name: set_parent_menu,
|
||||||
icon: "set_parent",
|
icon: "set_parent",
|
||||||
disabled: function() {
|
disabled: false,
|
||||||
if (enterprise_installed) {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
callback: function(key, options) {
|
callback: function(key, options) {
|
||||||
var selection = d3.selectAll(".node_selected");
|
var selection = d3.selectAll(".node_selected");
|
||||||
selection = selection[0];
|
selection = selection[0];
|
||||||
@ -2061,13 +1955,7 @@ function show_menu(item, data) {
|
|||||||
items_list["cancel_set_parent"] = {
|
items_list["cancel_set_parent"] = {
|
||||||
name: abort_relationship_menu,
|
name: abort_relationship_menu,
|
||||||
icon: "cancel_set_parent",
|
icon: "cancel_set_parent",
|
||||||
disabled: function() {
|
disabled: false,
|
||||||
if (enterprise_installed) {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
callback: function(key, options) {
|
callback: function(key, options) {
|
||||||
cancel_set_parent();
|
cancel_set_parent();
|
||||||
}
|
}
|
||||||
@ -2079,13 +1967,7 @@ function show_menu(item, data) {
|
|||||||
items_list["delete"] = {
|
items_list["delete"] = {
|
||||||
name: delete_menu,
|
name: delete_menu,
|
||||||
icon: "delete",
|
icon: "delete",
|
||||||
disabled: function() {
|
disabled: false,
|
||||||
if (enterprise_installed) {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
callback: function(key, options) {
|
callback: function(key, options) {
|
||||||
delete_nodes();
|
delete_nodes();
|
||||||
}
|
}
|
||||||
@ -2107,16 +1989,11 @@ function show_menu(item, data) {
|
|||||||
name: add_node_menu,
|
name: add_node_menu,
|
||||||
icon: "add_node",
|
icon: "add_node",
|
||||||
disabled: function() {
|
disabled: function() {
|
||||||
if (enterprise_installed) {
|
|
||||||
// Check if user can write network maps.
|
|
||||||
if (networkmap_write) {
|
if (networkmap_write) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
callback: function(key, options) {
|
callback: function(key, options) {
|
||||||
add_node();
|
add_node();
|
||||||
@ -2140,13 +2017,7 @@ function show_menu(item, data) {
|
|||||||
items_list["refresh"] = {
|
items_list["refresh"] = {
|
||||||
name: refresh_menu,
|
name: refresh_menu,
|
||||||
icon: "refresh",
|
icon: "refresh",
|
||||||
disabled: function() {
|
disabled: false,
|
||||||
if (enterprise_installed) {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
callback: function(key, options) {
|
callback: function(key, options) {
|
||||||
update_networkmap();
|
update_networkmap();
|
||||||
}
|
}
|
||||||
@ -2154,13 +2025,7 @@ function show_menu(item, data) {
|
|||||||
items_list["refresh_holding_area"] = {
|
items_list["refresh_holding_area"] = {
|
||||||
name: refresh_holding_area_menu,
|
name: refresh_holding_area_menu,
|
||||||
icon: "refresh_holding_area",
|
icon: "refresh_holding_area",
|
||||||
disabled: function() {
|
disabled: false,
|
||||||
if (enterprise_installed) {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
callback: function(key, options) {
|
callback: function(key, options) {
|
||||||
refresh_holding_area();
|
refresh_holding_area();
|
||||||
}
|
}
|
||||||
@ -2169,16 +2034,11 @@ function show_menu(item, data) {
|
|||||||
name: restart_map_menu,
|
name: restart_map_menu,
|
||||||
icon: "restart_map",
|
icon: "restart_map",
|
||||||
disabled: function() {
|
disabled: function() {
|
||||||
if (enterprise_installed) {
|
|
||||||
// Check if user can write network maps.
|
|
||||||
if (networkmap_write) {
|
if (networkmap_write) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
callback: function(key, options) {
|
callback: function(key, options) {
|
||||||
restart_map();
|
restart_map();
|
||||||
@ -2189,13 +2049,7 @@ function show_menu(item, data) {
|
|||||||
items_list["cancel_set_parent"] = {
|
items_list["cancel_set_parent"] = {
|
||||||
name: abort_relationship_menu,
|
name: abort_relationship_menu,
|
||||||
icon: "cancel_set_parent",
|
icon: "cancel_set_parent",
|
||||||
disabled: function() {
|
disabled: false,
|
||||||
if (enterprise_installed) {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
callback: function(key, options) {
|
callback: function(key, options) {
|
||||||
cancel_set_parent();
|
cancel_set_parent();
|
||||||
}
|
}
|
||||||
@ -2206,13 +2060,7 @@ function show_menu(item, data) {
|
|||||||
items_list["cancel_set_parent_interface"] = {
|
items_list["cancel_set_parent_interface"] = {
|
||||||
name: abort_relationship_interface,
|
name: abort_relationship_interface,
|
||||||
icon: "cancel_set_parent",
|
icon: "cancel_set_parent",
|
||||||
disabled: function() {
|
disabled: false,
|
||||||
if (enterprise_installed) {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
callback: function(key, options) {
|
callback: function(key, options) {
|
||||||
cancel_set_parent_interface();
|
cancel_set_parent_interface();
|
||||||
}
|
}
|
||||||
@ -2281,7 +2129,7 @@ function add_interface_link(data_parent) {
|
|||||||
params.push("id=" + networkmap_id);
|
params.push("id=" + networkmap_id);
|
||||||
params.push("child=" + child_data.id_db);
|
params.push("child=" + child_data.id_db);
|
||||||
params.push("parent=" + data_parent.id_db);
|
params.push("parent=" + data_parent.id_db);
|
||||||
params.push("page=enterprise/operation/agentes/pandora_networkmap.view");
|
params.push("page=operation/agentes/pandora_networkmap.view");
|
||||||
|
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
@ -2343,7 +2191,7 @@ function add_interface_link_js() {
|
|||||||
|
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
data: {
|
data: {
|
||||||
page: "enterprise/operation/agentes/pandora_networkmap.view",
|
page: "operation/agentes/pandora_networkmap.view",
|
||||||
add_interface_relation: 1,
|
add_interface_relation: 1,
|
||||||
id: networkmap_id,
|
id: networkmap_id,
|
||||||
source_value: source_value,
|
source_value: source_value,
|
||||||
@ -2414,14 +2262,14 @@ function refresh_holding_area() {
|
|||||||
|
|
||||||
var pos_x = parseInt(holding_pos_x) + parseInt(node_radius);
|
var pos_x = parseInt(holding_pos_x) + parseInt(node_radius);
|
||||||
var pos_y = parseInt(holding_pos_y) + parseInt(node_radius);
|
var pos_y = parseInt(holding_pos_y) + parseInt(node_radius);
|
||||||
if (enterprise_installed) {
|
|
||||||
$("#holding_spinner_" + networkmap_id).css("display", "");
|
$("#holding_spinner_" + networkmap_id).css("display", "");
|
||||||
var params = [];
|
var params = [];
|
||||||
params.push("refresh_holding_area=1");
|
params.push("refresh_holding_area=1");
|
||||||
params.push("id=" + networkmap_id);
|
params.push("id=" + networkmap_id);
|
||||||
params.push("x=" + pos_x);
|
params.push("x=" + pos_x);
|
||||||
params.push("y=" + pos_y);
|
params.push("y=" + pos_y);
|
||||||
params.push("page=enterprise/operation/agentes/pandora_networkmap.view");
|
params.push("page=operation/agentes/pandora_networkmap.view");
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
@ -2526,7 +2374,6 @@ function refresh_holding_area() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function restart_map() {
|
function restart_map() {
|
||||||
$(
|
$(
|
||||||
@ -2637,7 +2484,7 @@ function proceed_to_restart_map() {
|
|||||||
var params = [];
|
var params = [];
|
||||||
params.push("get_reset_map_form=1");
|
params.push("get_reset_map_form=1");
|
||||||
params.push("map_id=" + networkmap_id);
|
params.push("map_id=" + networkmap_id);
|
||||||
params.push("page=enterprise/operation/agentes/pandora_networkmap.view");
|
params.push("page=operation/agentes/pandora_networkmap.view");
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
dataType: "html",
|
dataType: "html",
|
||||||
@ -2655,7 +2502,7 @@ function reset_map_from_form(new_elements) {
|
|||||||
var data = new_elements;
|
var data = new_elements;
|
||||||
data.map_id = networkmap_id;
|
data.map_id = networkmap_id;
|
||||||
data.reset_map = 1;
|
data.reset_map = 1;
|
||||||
data.page = "enterprise/operation/agentes/pandora_networkmap.view";
|
data.page = "operation/agentes/pandora_networkmap.view";
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
data: data,
|
data: data,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
@ -2670,10 +2517,9 @@ function reset_map_from_form(new_elements) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function set_parent(parent_data) {
|
function set_parent(parent_data) {
|
||||||
if (enterprise_installed) {
|
|
||||||
var selection = d3.selectAll(".node_children");
|
var selection = d3.selectAll(".node_children");
|
||||||
|
|
||||||
count = selection.size();
|
var count = selection.size();
|
||||||
|
|
||||||
selection.each(function(child_data) {
|
selection.each(function(child_data) {
|
||||||
//Check if exist the link as
|
//Check if exist the link as
|
||||||
@ -2720,7 +2566,7 @@ function set_parent(parent_data) {
|
|||||||
params.push("id=" + networkmap_id);
|
params.push("id=" + networkmap_id);
|
||||||
params.push("child=" + child_data.id_db);
|
params.push("child=" + child_data.id_db);
|
||||||
params.push("parent=" + parent_data.id_db);
|
params.push("parent=" + parent_data.id_db);
|
||||||
params.push("page=enterprise/operation/agentes/pandora_networkmap.view");
|
params.push("page=operation/agentes/pandora_networkmap.view");
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
@ -2743,7 +2589,7 @@ function set_parent(parent_data) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
//Add the relationship and paint
|
//Add the relationship and paint
|
||||||
item = {};
|
var item = {};
|
||||||
item["arrow_start"] = "";
|
item["arrow_start"] = "";
|
||||||
item["arrow_end"] = "";
|
item["arrow_end"] = "";
|
||||||
item["status_start"] = "";
|
item["status_start"] = "";
|
||||||
@ -2775,7 +2621,6 @@ function set_parent(parent_data) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function cancel_set_parent_interface() {
|
function cancel_set_parent_interface() {
|
||||||
var selection = d3.selectAll(".node_children");
|
var selection = d3.selectAll(".node_children");
|
||||||
@ -2814,7 +2659,7 @@ function init_drag_and_drop() {
|
|||||||
.on("dragstart", function() {
|
.on("dragstart", function() {
|
||||||
if (d3.event.sourceEvent.button == 2) return;
|
if (d3.event.sourceEvent.button == 2) return;
|
||||||
|
|
||||||
mouse_coords = d3.mouse(this);
|
var mouse_coords = d3.mouse(this);
|
||||||
drag_start[0] = drag_end[0] = mouse_coords[0];
|
drag_start[0] = drag_end[0] = mouse_coords[0];
|
||||||
drag_start[1] = drag_end[1] = mouse_coords[1];
|
drag_start[1] = drag_end[1] = mouse_coords[1];
|
||||||
|
|
||||||
@ -2829,13 +2674,8 @@ function init_drag_and_drop() {
|
|||||||
|
|
||||||
var selection = d3.selectAll(".node_selected");
|
var selection = d3.selectAll(".node_selected");
|
||||||
|
|
||||||
if (enterprise_installed) {
|
var holding_pos_x = d3.select("#holding_area_" + networkmap_id).attr("x");
|
||||||
var holding_pos_x = d3
|
var holding_pos_y = d3.select("#holding_area_" + networkmap_id).attr("y");
|
||||||
.select("#holding_area_" + networkmap_id)
|
|
||||||
.attr("x");
|
|
||||||
var holding_pos_y = d3
|
|
||||||
.select("#holding_area_" + networkmap_id)
|
|
||||||
.attr("y");
|
|
||||||
delete d.raw_text;
|
delete d.raw_text;
|
||||||
selection.each(function(d) {
|
selection.each(function(d) {
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
@ -2847,40 +2687,6 @@ function init_drag_and_drop() {
|
|||||||
x: holding_pos_x,
|
x: holding_pos_x,
|
||||||
y: holding_pos_y,
|
y: holding_pos_y,
|
||||||
update_node: 1,
|
update_node: 1,
|
||||||
page: "enterprise/operation/agentes/pandora_networkmap.view"
|
|
||||||
},
|
|
||||||
success: function(data) {
|
|
||||||
if (d.state == "holding_area") {
|
|
||||||
//It is out the holding area
|
|
||||||
if (data["state"] == "") {
|
|
||||||
//Remove the style of nodes and links
|
|
||||||
//in holding area
|
|
||||||
d3.select("#id_node_" + d.id + networkmap_id).classed(
|
|
||||||
"holding_area",
|
|
||||||
false
|
|
||||||
);
|
|
||||||
d3.select(".source_" + d.id + networkmap_id).classed(
|
|
||||||
"holding_area_link",
|
|
||||||
false
|
|
||||||
);
|
|
||||||
d3.select(".target_" + d.id + networkmap_id).classed(
|
|
||||||
"holding_area_link",
|
|
||||||
false
|
|
||||||
);
|
|
||||||
graph.nodes[d.id].state = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
jQuery.ajax({
|
|
||||||
dataType: "json",
|
|
||||||
type: "POST",
|
|
||||||
url: window.base_url_homedir + "/ajax.php",
|
|
||||||
data: {
|
|
||||||
node: JSON.stringify(d),
|
|
||||||
update_node: 1,
|
|
||||||
page: "operation/agentes/pandora_networkmap.view"
|
page: "operation/agentes/pandora_networkmap.view"
|
||||||
},
|
},
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
@ -2906,16 +2712,16 @@ function init_drag_and_drop() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
|
|
||||||
d3.event.sourceEvent.stopPropagation();
|
d3.event.sourceEvent.stopPropagation();
|
||||||
})
|
})
|
||||||
.on("drag", function(d, i) {
|
.on("drag", function(d, i) {
|
||||||
if (d3.event.sourceEvent.button == 2) return;
|
if (d3.event.sourceEvent.button == 2) return;
|
||||||
|
|
||||||
mouse_coords = d3.mouse(this);
|
var mouse_coords = d3.mouse(this);
|
||||||
|
|
||||||
delta = [0, 0];
|
var delta = [0, 0];
|
||||||
delta[0] = mouse_coords[0] - drag_end[0];
|
delta[0] = mouse_coords[0] - drag_end[0];
|
||||||
delta[1] = mouse_coords[1] - drag_end[1];
|
delta[1] = mouse_coords[1] - drag_end[1];
|
||||||
|
|
||||||
@ -2949,7 +2755,6 @@ function add_fictional_node() {
|
|||||||
var x = (click_menu_position_svg[0] - translation[0]) / scale;
|
var x = (click_menu_position_svg[0] - translation[0]) / scale;
|
||||||
var y = (click_menu_position_svg[1] - translation[1]) / scale;
|
var y = (click_menu_position_svg[1] - translation[1]) / scale;
|
||||||
|
|
||||||
if (enterprise_installed) {
|
|
||||||
var params = [];
|
var params = [];
|
||||||
params.push("create_fictional_point=1");
|
params.push("create_fictional_point=1");
|
||||||
params.push("id=" + networkmap_id);
|
params.push("id=" + networkmap_id);
|
||||||
@ -2960,7 +2765,7 @@ function add_fictional_node() {
|
|||||||
params.push("shape=circle");
|
params.push("shape=circle");
|
||||||
params.push("x=" + x);
|
params.push("x=" + x);
|
||||||
params.push("y=" + y);
|
params.push("y=" + y);
|
||||||
params.push("page=enterprise/operation/agentes/pandora_networkmap.view");
|
params.push("page=operation/agentes/pandora_networkmap.view");
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
@ -3004,41 +2809,6 @@ function add_fictional_node() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
$("#dialog_node_add").dialog("close");
|
|
||||||
|
|
||||||
const new_id =
|
|
||||||
Math.max.apply(
|
|
||||||
Math,
|
|
||||||
graph.nodes.map(function(o) {
|
|
||||||
return o.id;
|
|
||||||
})
|
|
||||||
) + 1;
|
|
||||||
|
|
||||||
var temp_node = {};
|
|
||||||
temp_node["id"] = new_id;
|
|
||||||
temp_node["id_db"] = data["id_node"];
|
|
||||||
temp_node["id_agent"] = data["id_agent"];
|
|
||||||
temp_node["id_module"] = 0;
|
|
||||||
temp_node["x"] = x;
|
|
||||||
temp_node["y"] = y;
|
|
||||||
temp_node["z"] = 0;
|
|
||||||
temp_node["fixed"] = true;
|
|
||||||
temp_node["type"] = 3;
|
|
||||||
temp_node["color"] = data["color"];
|
|
||||||
temp_node["shape"] = data["shape"];
|
|
||||||
temp_node["text"] = data["text"];
|
|
||||||
temp_node["image_url"] = "";
|
|
||||||
temp_node["image_width"] = 0;
|
|
||||||
temp_node["image_height"] = 0;
|
|
||||||
temp_node["networkmap_id"] = networkmap_to_link;
|
|
||||||
|
|
||||||
graph.nodes.push(temp_node);
|
|
||||||
|
|
||||||
draw_elements_graph();
|
|
||||||
init_drag_and_drop();
|
|
||||||
set_positions_graph();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function init_graph(parameter_object) {
|
function init_graph(parameter_object) {
|
||||||
@ -3366,7 +3136,6 @@ function init_graph(parameter_object) {
|
|||||||
.attr("id", "layer_graph_" + networkmap_id)
|
.attr("id", "layer_graph_" + networkmap_id)
|
||||||
.attr("transform", "translate(" + translation + ")scale(" + scale + ")");
|
.attr("transform", "translate(" + translation + ")scale(" + scale + ")");
|
||||||
|
|
||||||
if (enterprise_installed) {
|
|
||||||
window.layer_graph
|
window.layer_graph
|
||||||
.append("rect")
|
.append("rect")
|
||||||
.attr("id", "holding_area_" + networkmap_id)
|
.attr("id", "holding_area_" + networkmap_id)
|
||||||
@ -3420,7 +3189,6 @@ function init_graph(parameter_object) {
|
|||||||
networkmap_dimensions[1] + node_radius - holding_area_dimensions[1] - 10
|
networkmap_dimensions[1] + node_radius - holding_area_dimensions[1] - 10
|
||||||
)
|
)
|
||||||
.text(holding_area_title);
|
.text(holding_area_title);
|
||||||
}
|
|
||||||
|
|
||||||
window.layer_graph_links = window.layer_graph
|
window.layer_graph_links = window.layer_graph
|
||||||
.append("g")
|
.append("g")
|
||||||
@ -4122,8 +3890,7 @@ function get_node_name_ov(data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function choose_group_for_show_agents() {
|
function choose_group_for_show_agents() {
|
||||||
if (enterprise_installed) {
|
var group = $("#group_for_show_agents option:selected").val();
|
||||||
group = $("#group_for_show_agents option:selected").val();
|
|
||||||
|
|
||||||
$("#agents_filter_group").attr("disabled", true);
|
$("#agents_filter_group").attr("disabled", true);
|
||||||
$("#spinner_group").css("display", "");
|
$("#spinner_group").css("display", "");
|
||||||
@ -4139,7 +3906,7 @@ function choose_group_for_show_agents() {
|
|||||||
params.push("get_agents_in_group=1");
|
params.push("get_agents_in_group=1");
|
||||||
params.push("id=" + networkmap_id);
|
params.push("id=" + networkmap_id);
|
||||||
params.push("group=" + group);
|
params.push("group=" + group);
|
||||||
params.push("page=enterprise/operation/agentes/pandora_networkmap.view");
|
params.push("page=operation/agentes/pandora_networkmap.view");
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
@ -4171,7 +3938,6 @@ function choose_group_for_show_agents() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
// Old code for the details node
|
// Old code for the details node
|
||||||
@ -4601,7 +4367,7 @@ function move_to_networkmap_widget(networkmap_id, id_cell) {
|
|||||||
params.push("networkmap=true");
|
params.push("networkmap=true");
|
||||||
params.push("networkmap_id=" + networkmap_id);
|
params.push("networkmap_id=" + networkmap_id);
|
||||||
|
|
||||||
params.push("page=enterprise/include/ajax/map_enterprise.ajax");
|
params.push("page=include/ajax/map_enterprise.ajax");
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
dataType: "html",
|
dataType: "html",
|
||||||
|
2
pandora_console/include/javascript/tooltipster.bundle.min.js
vendored
Normal file
2
pandora_console/include/javascript/tooltipster.bundle.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -437,7 +437,7 @@ class NetworkMapWidget extends Widget
|
|||||||
$settings = \json_encode(
|
$settings = \json_encode(
|
||||||
[
|
[
|
||||||
'cellId' => $this->cellId,
|
'cellId' => $this->cellId,
|
||||||
'page' => 'enterprise/include/ajax/map_enterprise.ajax',
|
'page' => 'include/ajax/map_enterprise.ajax',
|
||||||
'url' => ui_get_full_url('ajax.php'),
|
'url' => ui_get_full_url('ajax.php'),
|
||||||
'networkmap_id' => $id_networkmap,
|
'networkmap_id' => $id_networkmap,
|
||||||
'x_offset' => $x_offset,
|
'x_offset' => $x_offset,
|
||||||
|
1
pandora_console/include/styles/tooltipster.bundle.min.css
vendored
Normal file
1
pandora_console/include/styles/tooltipster.bundle.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user