From be3853f885e4d87d6b11fd3a95f5439a80f9981e Mon Sep 17 00:00:00 2001 From: SourceDoctor Date: Mon, 9 Nov 2020 14:48:03 +0100 Subject: [PATCH] Fix Network Map Device Group Highlighting (#12290) * Fix Network Map Device Group Highlighting * style fix * change parameter fallback * change if clause --- includes/html/print-map.inc.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/includes/html/print-map.inc.php b/includes/html/print-map.inc.php index be358ed5cd..2abbb5d3a4 100644 --- a/includes/html/print-map.inc.php +++ b/includes/html/print-map.inc.php @@ -14,7 +14,8 @@ use LibreNMS\Config; -$highlight_node = $vars['highlight_node'] | 0; +$highlight_node = $vars['highlight_node'] ?? 0; +$group = $vars['group'] ?? 0; //Don't know where this should come from, but it is used later, so I just define it here. $row_colour = '#ffffff'; @@ -44,11 +45,11 @@ $ports = []; $devices = []; $where = ''; -if (is_numeric($vars['group'])) { +if (is_numeric($group) && $group) { $where .= ' AND D1.device_id IN (SELECT `device_id` FROM `device_group_device` WHERE `device_group_id` = ?)'; - $sql_array[] = $vars['group']; + $sql_array[] = $group; $where .= ' OR D2.device_id IN (SELECT `device_id` FROM `device_group_device` WHERE `device_group_id` = ?)'; - $sql_array[] = $vars['group']; + $sql_array[] = $group; } if (in_array('mac', Config::get('network_map_items'))) { @@ -385,7 +386,12 @@ var network = new vis.Network(container, data, options); function highlightNode(e) { highlight_node = document.getElementById("highlight_node").value; - window.location.pathname = 'map/highlight_node=' + highlight_node; + } $('#highlight_node option[value=""]').prop('selected', true);