mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Updated physics and sql query
This commit is contained in:
@ -71,6 +71,7 @@ $ports = dbFetchRows("SELECT
|
||||
`P2`.`port_id` IS NOT NULL AND
|
||||
`D1`.`device_id` != `D2`.`device_id`
|
||||
$sql
|
||||
GROUP BY `P1`.`port_id`,`P2`.`port_id`
|
||||
", $sql_array);
|
||||
|
||||
$devices = dbFetchRows("SELECT
|
||||
@ -109,6 +110,7 @@ $devices = dbFetchRows("SELECT
|
||||
`local_device_id` IS NOT NULL AND
|
||||
`remote_device_id` IS NOT NULL
|
||||
$sql
|
||||
GROUP BY `P1`.`port_id`,`P2`.`port_id`
|
||||
", $sql_array);
|
||||
|
||||
$list = array_merge($ports,$devices);
|
||||
@ -162,7 +164,7 @@ foreach ($list as $items) {
|
||||
$link_color = $config['map_legend'][$link_used];
|
||||
$tmp_links[] = array('from'=>$items['local_device_id'],'to'=>$items['remote_device_id'],'label'=>shorten_interface_type($items['local_ifname']) . ' > ' . shorten_interface_type($items['remote_ifname']),'title'=>generate_port_link($local_port, "<img src='graph.php?type=port_bits&id=".$items['local_port_id']."&from=".$config['time']['day']."&to=".$config['time']['now']."&width=100&height=20&legend=no&bg=".str_replace("#","", $row_colour)."'>",'',0,1),'width'=>$width,'color'=>$link_color);
|
||||
if (!in_array($items['remote_port_id'],$tmp_link_ids)) {
|
||||
$tmp_links[] = array('from'=>$items['local_device_id'],'to'=>$items['remote_device_id'],'label'=>shorten_interface_type($items['local_ifname']) . ' > ' . shorten_interface_type($items['remote_ifname']),'title'=>generate_port_link($local_port, "<img src='graph.php?type=port_bits&id=".$items['local_port_id']."&from=".$config['time']['day']."&to=".$config['time']['now']."&width=100&height=20&legend=no&bg=".str_replace("#","", $row_colour)."'>",'',0,1),'width'=>$width,'color'=>$link_color);
|
||||
$tmp_links[] = array('from'=>$items['local_device_id'],'to'=>$items['remote_device_id'],'label'=>shorten_interface_type($items['local_ifname']) . ' > ' . shorten_interface_type($items['remote_ifname']),'title'=>generate_port_link($local_port, "<img src='graph.php?type=port_bits&id=".$items['local_port_id']."&from=".$config['time']['day']."&to=".$config['time']['now']."&width=100&height=20&legend=no&bg=".str_replace("#","", $row_colour)."'>\n",'',0,1),'width'=>$width,'color'=>$link_color);
|
||||
}
|
||||
array_push($tmp_link_ids,$items['local_port_id']);
|
||||
}
|
||||
@ -201,27 +203,39 @@ echo $edges;
|
||||
edges: edges,
|
||||
stabilize: true
|
||||
};
|
||||
var options = {
|
||||
autoResize: true,
|
||||
height: '100%',
|
||||
width: '100%',
|
||||
physics: {
|
||||
barnesHut: {
|
||||
gravitationalConstant: -10000, springConstant: 0.001, springLength: 50
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
color: {
|
||||
background: '#ffffff'
|
||||
}
|
||||
},
|
||||
smoothCurves: {dynamic:false, type: "continuous"},
|
||||
edges: {
|
||||
color: {
|
||||
color: '#000000'
|
||||
}
|
||||
}
|
||||
};
|
||||
var options = {
|
||||
layout:{
|
||||
randomSeed:2
|
||||
},
|
||||
"edges": {
|
||||
"smooth": {
|
||||
"type": "continuous",
|
||||
"roundness": 0.95
|
||||
},
|
||||
font: {
|
||||
size: 12,
|
||||
color: 'red',
|
||||
face: 'sans',
|
||||
background: 'white',
|
||||
strokeWidth:3,
|
||||
align: 'bottom'
|
||||
}
|
||||
},
|
||||
"physics": {
|
||||
"forceAtlas2Based": {
|
||||
"gravitationalConstant": -800,
|
||||
"centralGravity": 0.03,
|
||||
"springLength": 50,
|
||||
"springConstant": 0,
|
||||
"damping": 1,
|
||||
"avoidOverlap": 1
|
||||
},
|
||||
"maxVelocity": 50,
|
||||
"minVelocity": 0.01,
|
||||
"solver": "forceAtlas2Based",
|
||||
"timestep": 0.30
|
||||
}
|
||||
}
|
||||
var network = new vis.Network(container, data, options);
|
||||
network.on('click', function (properties) {
|
||||
if (properties.nodes > 0) {
|
||||
|
Reference in New Issue
Block a user