From 63b9896ac4a89bf59fb335f5b712f12647eef66f Mon Sep 17 00:00:00 2001 From: PipoCanaja <38363551+PipoCanaja@users.noreply.github.com> Date: Sun, 4 Jul 2021 20:58:05 +0200 Subject: [PATCH] Leave it to generate_device_link for sysName/hostName/IP (#13000) * avoid forcing displayed name, so generate_device_link decides according to LibreNMS config * same fix for BGP display * other generate_device_link occurences * more * more --- includes/html/pages/routing/bgp.inc.php | 2 +- includes/html/print-interface.inc.php | 4 ++-- includes/html/table/alertlog-stats.inc.php | 2 +- includes/html/table/alertlog.inc.php | 2 +- includes/html/table/poll-log.inc.php | 2 +- includes/html/table/stp-ports.inc.php | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/includes/html/pages/routing/bgp.inc.php b/includes/html/pages/routing/bgp.inc.php index 11334e7113..686d7444f8 100644 --- a/includes/html/pages/routing/bgp.inc.php +++ b/includes/html/pages/routing/bgp.inc.php @@ -312,7 +312,7 @@ if (! Auth::user()->hasGlobalRead()) { unset($sep); echo ' - ' . $localaddresslink . '
' . generate_device_link($peer, shorthost($peer['hostname']), ['tab' => 'routing', 'proto' => 'bgp']) . ' + ' . $localaddresslink . '
' . generate_device_link($peer, null, ['tab' => 'routing', 'proto' => 'bgp']) . ' » ' . $peeraddresslink . " $peer_type diff --git a/includes/html/print-interface.inc.php b/includes/html/print-interface.inc.php index 63aeaa5819..b1e2e7af93 100644 --- a/includes/html/print-interface.inc.php +++ b/includes/html/print-interface.inc.php @@ -269,7 +269,7 @@ if (strpos($port['label'], 'oopback') === false && ! $graph_type) { echo " "; } - echo '' . generate_port_link($link_if, makeshortif($link_if['label'])) . ' on ' . generate_device_link($link_if, shorthost($link_if['hostname'])); + echo '' . generate_port_link($link_if, makeshortif($link_if['label'])) . ' on ' . generate_device_link($link_if); if ($int_links_v6[$int_link]) { echo " v6"; @@ -293,7 +293,7 @@ if ($port_details && Config::get('enable_port_relationship') === true && port_pe $pw_peer_int = dbFetchRow('SELECT * FROM `ports` AS I, pseudowires AS P WHERE I.device_id = ? AND P.cpwVcID = ? AND P.port_id = I.port_id', [$pseudowire['peer_device_id'], $pseudowire['cpwVcID']]); $pw_peer_int = cleanPort($pw_peer_int); - echo "$br " . generate_port_link($pw_peer_int, makeshortif($pw_peer_int['label'])) . ' on ' . generate_device_link($pw_peer_dev, shorthost($pw_peer_dev['hostname'])) . ''; + echo "$br " . generate_port_link($pw_peer_int, makeshortif($pw_peer_int['label'])) . ' on ' . generate_device_link($pw_peer_dev) . ''; $br = '
'; } diff --git a/includes/html/table/alertlog-stats.inc.php b/includes/html/table/alertlog-stats.inc.php index 503f386218..5f6fac2766 100644 --- a/includes/html/table/alertlog-stats.inc.php +++ b/includes/html/table/alertlog-stats.inc.php @@ -72,7 +72,7 @@ foreach (dbFetchRows($sql, $param) as $alertlog) { $response[] = [ 'id' => $rulei++, 'count' => $alertlog['COUNT(*)'], - 'hostname' => '
' . generate_device_link($dev, shorthost($dev['hostname'])), + 'hostname' => '
' . generate_device_link($dev), 'alert_rule' => $alertlog['name'], ]; }//end foreach diff --git a/includes/html/table/alertlog.inc.php b/includes/html/table/alertlog.inc.php index a9d2c9b7cb..9cda513bf5 100644 --- a/includes/html/table/alertlog.inc.php +++ b/includes/html/table/alertlog.inc.php @@ -108,7 +108,7 @@ foreach (dbFetchRows($sql, $param) as $alertlog) { 'time_logged' => $alertlog['humandate'], 'details' => '', 'verbose_details' => "", - 'hostname' => '
' . generate_device_link($dev, shorthost($dev['hostname'])) . '
' . $fault_detail . '
', + 'hostname' => '
' . generate_device_link($dev) . '
' . $fault_detail . '
', 'alert' => htmlspecialchars($alertlog['alert']), 'status' => "", 'severity' => $alertlog['severity'], diff --git a/includes/html/table/poll-log.inc.php b/includes/html/table/poll-log.inc.php index 4047062063..eb4bd8fbd4 100644 --- a/includes/html/table/poll-log.inc.php +++ b/includes/html/table/poll-log.inc.php @@ -62,7 +62,7 @@ foreach (dbFetchRows($sql, $param) as $device) { $device['group_name'] = 'General'; } $response[] = [ - 'hostname' => generate_device_link($device, format_hostname($device), ['tab' => 'graphs', 'group' => 'poller']), + 'hostname' => generate_device_link($device, null, ['tab' => 'graphs', 'group' => 'poller']), 'last_polled' => $device['last_polled'], 'poller_group' => $device['group_name'], 'location' => $device['location'], diff --git a/includes/html/table/stp-ports.inc.php b/includes/html/table/stp-ports.inc.php index b05f723461..9eb44c9a85 100644 --- a/includes/html/table/stp-ports.inc.php +++ b/includes/html/table/stp-ports.inc.php @@ -40,9 +40,9 @@ foreach (dbFetchRows($sql, [$device_id]) as $stp_ports_db) { 'state' => $stp_ports_db['state'], 'enable' => $stp_ports_db['enable'], 'pathCost' => $stp_ports_db['pathCost'], - 'designatedRoot' => ($root_device ? generate_device_link($root_device, $root_device['hostname']) : \LibreNMS\Util\Rewrite::readableOUI($stp_ports_db['designatedRoot'])) . '
' . \LibreNMS\Util\Rewrite::readableMac($stp_ports_db['designatedRoot']), + 'designatedRoot' => ($root_device ? generate_device_link($root_device) : \LibreNMS\Util\Rewrite::readableOUI($stp_ports_db['designatedRoot'])) . '
' . \LibreNMS\Util\Rewrite::readableMac($stp_ports_db['designatedRoot']), 'designatedCost' => $stp_ports_db['designatedCost'], - 'designatedBridge' => ($bridge_device ? generate_device_link($bridge_device, $bridge_device['hostname']) : \LibreNMS\Util\Rewrite::readableOUI($stp_ports_db['designatedBridge'])) . '
' . \LibreNMS\Util\Rewrite::readableMac($stp_ports_db['designatedBridge']), + 'designatedBridge' => ($bridge_device ? generate_device_link($bridge_device) : \LibreNMS\Util\Rewrite::readableOUI($stp_ports_db['designatedBridge'])) . '
' . \LibreNMS\Util\Rewrite::readableMac($stp_ports_db['designatedBridge']), 'designatedPort' => $stp_ports_db['designatedPort'], 'forwardTransitions' => $stp_ports_db['forwardTransitions'], ];