Fixed BGP Remote peer link and graph in Routing Overview, or just static text when not a device in LibreNMS (#15535)

* Fixed BGP Remote peer link and graph in Routing Overview, or just static text when not a device in LibreNMS

* Added extra space

* Reverted back to overlibLink (due to BGP update graphs on hover)

* Added extra space

* Remove graph for remote peer, as it is falsely (showed earlier the Updates Graph for local peer)

* Removed unnecessary/unused code

* Remove graph for remote peer, as it is falsely (showed earlier the Updates Graph for local peer), replaced with just a DeviceLinks

* Change Url::deviceLink to return $text if the device doesn't exist.  Default to ''
Import some of the things to improve readability.

* update phpdoc

---------

Co-authored-by: Tony Murray <murraytony@gmail.com>
This commit is contained in:
Tim de Boer
2023-11-02 06:41:19 +01:00
committed by GitHub
parent 05a5fbc5b5
commit d5c6d0aaf4
2 changed files with 20 additions and 17 deletions

View File

@@ -39,8 +39,8 @@ use Symfony\Component\HttpFoundation\ParameterBag;
class Url
{
/**
* @param Device $device
* @param string $text
* @param Device|null $device
* @param string|null $text
* @param array $vars
* @param int $start
* @param int $end
@@ -48,10 +48,10 @@ class Url
* @param int $overlib
* @return string
*/
public static function deviceLink($device, $text = null, $vars = [], $start = 0, $end = 0, $escape_text = 1, $overlib = 1)
public static function deviceLink($device, $text = '', $vars = [], $start = 0, $end = 0, $escape_text = 1, $overlib = 1)
{
if (! $device instanceof Device || ! $device->hostname) {
return '';
return (string) $text;
}
if (! $device->canAccess(Auth::user())) {