mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Final final updates to get better map support
This commit is contained in:
@@ -42,7 +42,7 @@ $tmp_exp_ids = implode(',',$tmp_ids);
|
||||
|
||||
$port_ids = array();
|
||||
$port_devices = array();
|
||||
foreach (dbFetchRows("SELECT DISTINCT LEAST(`M`.`port_id`, `P`.`port_id`) AS `remote_port_id`, GREATEST(`P`.`port_id`,`M`.`port_id`) AS `local_port_id` FROM `ipv4_mac` AS `M` LEFT JOIN `ports` AS `P` ON `M`.`mac_address` = `P`.`ifPhysAddress` LEFT JOIN `devices` AS `D` ON `P`.`device_id`=`D`.`device_id` WHERE `P`.`port_id` IS NOT NULL AND `M`.`port_id` IS NOT NULL $mac_sql", $mac_array) as $macs) {
|
||||
foreach (dbFetchRows("SELECT DISTINCT LEAST(`M`.`port_id`, `P`.`port_id`) AS `remote_port_id`, GREATEST(`P`.`port_id`,`M`.`port_id`) AS `local_port_id` FROM `ipv4_mac` AS `M` LEFT JOIN `ports` AS `P` ON `M`.`mac_address` = `P`.`ifPhysAddress` LEFT JOIN `devices` AS `D` ON `P`.`device_id`=`D`.`device_id` WHERE `P`.`port_id` IS NOT NULL AND `M`.`port_id` IS NOT NULL AND `M`.`port_id` != 0 AND `P`.`port_id` != 0 $mac_sql", $mac_array) as $macs) {
|
||||
if (!in_array($macs['local_port_id'], $port_ids) && port_permitted($macs['local_port_id'])) {
|
||||
$port_det = dbFetchRow("SELECT * FROM `ports` WHERE `port_id`=?", array($macs['local_port_id']));
|
||||
$port_dev = dbFetchRow("SELECT * FROM `devices` WHERE `device_id`=?", array($port_det['device_id']));
|
||||
@@ -144,6 +144,8 @@ if (is_array($tmp_devices[0])) {
|
||||
|
||||
$edges = json_encode($tmp_links);
|
||||
|
||||
if (count($node_devices) > 1 && count($tmp_links) > 0) {
|
||||
|
||||
?>
|
||||
|
||||
<div id="visualization"></div>
|
||||
@@ -205,6 +207,12 @@ network.redraw();
|
||||
|
||||
<?php
|
||||
|
||||
} else {
|
||||
|
||||
print_message("No map to display, this may be because you aren't running autodiscovery or no devices are linked by mac address.");
|
||||
|
||||
}
|
||||
|
||||
$pagetitle[] = "Map";
|
||||
|
||||
?>
|
||||
|
@@ -147,17 +147,9 @@ if ($config['show_locations'])
|
||||
<li><a href="delhost/"><i class="fa fa-trash fa-col-info fa-fw fa-lg"></i> Delete Device</a></li>');
|
||||
}
|
||||
|
||||
if ($links['count'] > 0) {
|
||||
|
||||
?>
|
||||
<li role="presentation" class="divider"></li>
|
||||
<li><a href="map/"><img src="images/16/chart_organisation.png" border="0" alt="Network Map" width="16" height="16" /> Network Map</a></li>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
|
@@ -256,15 +256,11 @@ if (device_permitted($vars['device']) || $check_device == $vars['device'])
|
||||
</li>');
|
||||
}
|
||||
|
||||
if ($_SESSION['userlevel'] >= "5" && dbFetchCell("SELECT COUNT(*) FROM links AS L, ports AS I WHERE I.device_id = '".$device['device_id']."' AND I.port_id = L.local_port_id"))
|
||||
{
|
||||
$discovery_links = TRUE;
|
||||
echo('<li class="' . $select['map'] . '">
|
||||
<a href="'.generate_device_url($device, array('tab' => 'map')).'">
|
||||
<img src="images/16/chart_organisation.png" align="absmiddle" border="0" /> Map
|
||||
</a>
|
||||
</li>');
|
||||
}
|
||||
|
||||
if (@dbFetchCell("SELECT COUNT(*) FROM `packages` WHERE device_id = '".$device['device_id']."'") > '0')
|
||||
{
|
||||
|
Reference in New Issue
Block a user