mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Allow adding custom quick links to device navigation (#10403)
* Add Open-Audit link display device asset details * Add an external link using the template method * Add external system link setting. * Update device.inc.php * Update Customizing-the-Web-UI.md
This commit is contained in:
committed by
Neil Lathwood
parent
d6862b0e34
commit
49310dc693
@@ -28,3 +28,18 @@ Example contents:
|
|||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Custom device menu entry
|
||||||
|
|
||||||
|
You can add custom external links in the menu on the device page.
|
||||||
|
|
||||||
|
This feature allows you to easily link applications to related systems, as shown in the example of Open-audIT.
|
||||||
|
|
||||||
|
The Links value is parsed by Laravel Blade's templating engine so you can use Device variables such as `hostname`, `sysName` and more.
|
||||||
|
|
||||||
|
`config.php:`
|
||||||
|
|
||||||
|
```php
|
||||||
|
$config['html']['device']['links'][] = ['url' => 'http://atssrv/open-audit/index/devices/{{ $device[\'sysName\'] }}', 'title' => 'Open-AudIT'];
|
||||||
|
```
|
||||||
|
|||||||
@@ -454,6 +454,12 @@ if (device_permitted($vars['device']) || $permitted_by_port) {
|
|||||||
<span class="caret"></span></button>
|
<span class="caret"></span></button>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li><a href="https://'.$device['hostname'].'" onclick="http_fallback(this); return false;" target="_blank" rel="noopener"><i class="fa fa-globe fa-lg icon-theme" aria-hidden="true"></i> Web</a></li>';
|
<li><a href="https://'.$device['hostname'].'" onclick="http_fallback(this); return false;" target="_blank" rel="noopener"><i class="fa fa-globe fa-lg icon-theme" aria-hidden="true"></i> Web</a></li>';
|
||||||
|
|
||||||
|
foreach (Config::get('html.device.links') as $links) {
|
||||||
|
$html_link = view(['template' => $links['url']], ['device' => $device])->__toString();
|
||||||
|
echo '<li><a href="'.$html_link.'" onclick="http_fallback(this); return false;" target="_blank" rel="noopener"><i class="fa fa-globe fa-lg icon-theme" aria-hidden="true"></i> '.$links['title'].'</a></li>';
|
||||||
|
}
|
||||||
|
|
||||||
if (Config::has('gateone.server')) {
|
if (Config::has('gateone.server')) {
|
||||||
if (Config::get('gateone.use_librenms_user') == true) {
|
if (Config::get('gateone.use_librenms_user') == true) {
|
||||||
echo '<li><a href="' . Config::get('gateone.server') . '?ssh=ssh://' . Auth::user()->username . '@' . $device['hostname'] . '&location=' . $device['hostname'] . '" target="_blank" rel="noopener"><i class="fa fa-lock fa-lg icon-theme" aria-hidden="true"></i> SSH</a></li>';
|
echo '<li><a href="' . Config::get('gateone.server') . '?ssh=ssh://' . Auth::user()->username . '@' . $device['hostname'] . '&location=' . $device['hostname'] . '" target="_blank" rel="noopener"><i class="fa fa-lock fa-lg icon-theme" aria-hidden="true"></i> SSH</a></li>';
|
||||||
|
|||||||
Reference in New Issue
Block a user