mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Fix plugins menu (#10222)
* Merge pull request #54 from librenms-plugins/revert-52-PluginNamespaceCorrection Revert "Adding namespace LibreNMS\Plugins;" Fix plugins menu * Only use scrollable where needed
This commit is contained in:
@@ -171,14 +171,16 @@ class Plugins
|
||||
/**
|
||||
* Call hook for plugin.
|
||||
*
|
||||
* @param string $hook Name of hook to call
|
||||
* @param array $params Optional array of parameters for hook
|
||||
* @param string $hook Name of hook to call
|
||||
* @param array|false $params Optional array of parameters for hook
|
||||
* @return string
|
||||
*/
|
||||
public static function call($hook, $params = false)
|
||||
{
|
||||
chdir(Config::get('install_dir') . '/html');
|
||||
self::start();
|
||||
|
||||
ob_start();
|
||||
if (!empty(self::$plugins[$hook])) {
|
||||
foreach (self::$plugins[$hook] as $name) {
|
||||
try {
|
||||
@@ -192,7 +194,11 @@ class Plugins
|
||||
}
|
||||
}
|
||||
}
|
||||
$output = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
chdir(Config::get('install_dir'));
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -15,7 +15,7 @@ echo('
|
||||
require 'includes/html/dev-overview-data.inc.php';
|
||||
require 'overview/tracepath.inc.php';
|
||||
|
||||
LibreNMS\Plugins::call('device_overview_container', array($device));
|
||||
echo LibreNMS\Plugins::call('device_overview_container', [$device]);
|
||||
|
||||
require 'overview/ports.inc.php';
|
||||
|
||||
|
@@ -20,5 +20,5 @@ $no_refresh = true;
|
||||
<h3>Plugins</h3>
|
||||
<hr>
|
||||
<?php
|
||||
\LibreNMS\Plugins::call('port_container', [$device, $port]);
|
||||
echo \LibreNMS\Plugins::call('port_container', [$device, $port]);
|
||||
|
||||
|
@@ -43,20 +43,22 @@
|
||||
@if(auth()->user()->isAdmin() || \LibreNMS\Plugins::count())
|
||||
<li class="dropdown-submenu">
|
||||
<a><i class="fa fa-plug fa-fw fa-lg" aria-hidden="true"></i> Plugins</a>
|
||||
<ul class="dropdown-menu scrollable-menu">
|
||||
<ul class="dropdown-menu">
|
||||
{!! \LibreNMS\Plugins::call('menu') !!}
|
||||
@admin
|
||||
@if(\LibreNMS\Plugins::count())
|
||||
<li role="presentation" class="divider"></li>
|
||||
@endif
|
||||
<li><a href="{{ url('plugin', ['view' => 'admin']) }}"> <i class="fa fa-lock fa-fw fa-lg" aria-hidden="true"></i>Plugin Admin</a></li>
|
||||
<li><a href="{{ url('plugin/view=admin') }}"> <i class="fa fa-lock fa-fw fa-lg"
|
||||
aria-hidden="true"></i>Plugin Admin</a>
|
||||
</li>
|
||||
@endadmin
|
||||
</ul>
|
||||
</li>
|
||||
@endif
|
||||
<li class="dropdown-submenu">
|
||||
<a href="{{ url('overview') }}"><i class="fa fa-wrench fa-fw fa-lg" aria-hidden="true"></i> Tools</a>
|
||||
<ul class="dropdown-menu scrollable-menu">
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="{{ url('ripenccapi') }}"><i class="fa fa-star fa-fw fa-lg" aria-hidden="true"></i> RIPE NCC API</a></li>
|
||||
@config('oxidized.enabled')
|
||||
<li><a href="{{ url('oxidized') }}"><i class="fa fa-stack-overflow fa-fw fa-lg" aria-hidden="true"></i> Oxidized</a></li>
|
||||
@@ -366,7 +368,7 @@
|
||||
<li role="presentation" class="divider"></li>
|
||||
<li class="dropdown-submenu">
|
||||
<a href="{{ url('pollers') }}"><i class="fa fa-th-large fa-fw fa-lg" aria-hidden="true"></i> @lang('Pollers')</a>
|
||||
<ul class="dropdown-menu scrollable-menu">
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="{{ url('pollers/tab=pollers') }}"><i class="fa fa-th-large fa-fw fa-lg" aria-hidden="true"></i> @lang('Pollers')</a></li>
|
||||
@config('distributed_poller')
|
||||
<li><a href="{{ url('pollers/tab=groups') }}"><i class="fa fa-th fa-fw fa-lg" aria-hidden="true"></i> @lang('Groups')</a></li>
|
||||
@@ -378,7 +380,7 @@
|
||||
<li role="presentation" class="divider"></li>
|
||||
<li class="dropdown-submenu">
|
||||
<a href="#"><i class="fa fa-code fa-fw fa-lg" aria-hidden="true"></i> API</a>
|
||||
<ul class="dropdown-menu scrollable-menu">
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="{{ url('api-access') }}"><i class="fa fa-cog fa-fw fa-lg" aria-hidden="true"></i> API Settings</a></li>
|
||||
<li><a href="https://docs.librenms.org/API/" target="_blank" rel="noopener"><i class="fa fa-book fa-fw fa-lg" aria-hidden="true"></i> API Docs</a></li>
|
||||
</ul>
|
||||
@@ -388,7 +390,7 @@
|
||||
@if (isset($refresh))
|
||||
<li class="dropdown-submenu">
|
||||
<a href="#"><span class="countdown_timer" id="countdown_timer"></span></a>
|
||||
<ul class="dropdown-menu scrollable-menu">
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="#"><span class="countdown_timer_status" id="countdown_timer_status"></span></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
Reference in New Issue
Block a user