mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-30 16:14:21 +02: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_ids = array();
|
||||||
$port_devices = 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'])) {
|
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_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']));
|
$port_dev = dbFetchRow("SELECT * FROM `devices` WHERE `device_id`=?", array($port_det['device_id']));
|
||||||
@@ -143,6 +143,8 @@ if (is_array($tmp_devices[0])) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$edges = json_encode($tmp_links);
|
$edges = json_encode($tmp_links);
|
||||||
|
|
||||||
|
if (count($node_devices) > 1 && count($tmp_links) > 0) {
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
@@ -205,6 +207,12 @@ network.redraw();
|
|||||||
|
|
||||||
<?php
|
<?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";
|
$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>');
|
<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 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>
|
<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>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
|||||||
@@ -256,15 +256,11 @@ if (device_permitted($vars['device']) || $check_device == $vars['device'])
|
|||||||
</li>');
|
</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'] . '">
|
echo('<li class="' . $select['map'] . '">
|
||||||
<a href="'.generate_device_url($device, array('tab' => 'map')).'">
|
<a href="'.generate_device_url($device, array('tab' => 'map')).'">
|
||||||
<img src="images/16/chart_organisation.png" align="absmiddle" border="0" /> Map
|
<img src="images/16/chart_organisation.png" align="absmiddle" border="0" /> Map
|
||||||
</a>
|
</a>
|
||||||
</li>');
|
</li>');
|
||||||
}
|
|
||||||
|
|
||||||
if (@dbFetchCell("SELECT COUNT(*) FROM `packages` WHERE device_id = '".$device['device_id']."'") > '0')
|
if (@dbFetchCell("SELECT COUNT(*) FROM `packages` WHERE device_id = '".$device['device_id']."'") > '0')
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user