mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Convert plugins to Blade
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
<?php
|
||||
|
||||
echo 'Well done, the plugin system is up and running';
|
||||
echo view('plugins.test.plugin');
|
||||
|
||||
@@ -2,26 +2,38 @@
|
||||
|
||||
namespace LibreNMS\Plugins;
|
||||
|
||||
use App\Models\Device;
|
||||
use App\Models\Port;
|
||||
|
||||
class Test
|
||||
{
|
||||
public static function menu()
|
||||
{
|
||||
echo '<li><a href="plugin/p=Test">Test</a></li>';
|
||||
$name = self::className();
|
||||
echo view(self::viewPath(), compact('name'));
|
||||
}
|
||||
|
||||
//end menu()
|
||||
|
||||
public function device_overview_container($device)
|
||||
{
|
||||
echo '<div class="container-fluid"><div class="row"> <div class="col-md-12"> <div class="panel panel-default panel-condensed"> <div class="panel-heading"><strong>' . get_class() . ' Plugin </strong> </div>';
|
||||
echo ' Example plugin in "Device - Overview" tab <br>';
|
||||
echo '</div></div></div></div>';
|
||||
$name = self::className() . ' Plugin';
|
||||
$device = Device::find($device['device_id']);
|
||||
echo view(self::viewPath(), compact('name','device'));
|
||||
}
|
||||
|
||||
public function port_container($device, $port)
|
||||
{
|
||||
echo '<div class="container-fluid"><div class="row"> <div class="col-md-12"> <div class="panel panel-default panel-condensed"> <div class="panel-heading"><strong>' . get_class() . ' plugin in "Port" tab</strong> </div>';
|
||||
echo 'Example display in Port tab</br>';
|
||||
echo '</div></div></div></div>';
|
||||
$name = self::className() . ' Plugin';
|
||||
$port = Port::find($port['port_id']);
|
||||
echo view(self::viewPath(), compact('name','port'));
|
||||
}
|
||||
|
||||
private static function viewPath()
|
||||
{
|
||||
return 'plugins.' . strtolower(self::className()) . '.' . debug_backtrace()[1]['function'];
|
||||
}
|
||||
|
||||
private static function className()
|
||||
{
|
||||
return str_replace(__NAMESPACE__ . '\\', '', self::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="panel panel-default panel-condensed">
|
||||
<div class="panel-heading">
|
||||
<strong>{{ $name }}</strong>
|
||||
</div>
|
||||
Example plugin in "Device - Overview" tab <br>
|
||||
{{ $device->hostname }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,3 @@
|
||||
<li>
|
||||
<a href="plugin/p={{ $name }}">{{ $name }}</a>
|
||||
</li>
|
||||
@@ -0,0 +1 @@
|
||||
<p>Well done, the plugin system is up and running</p>
|
||||
@@ -0,0 +1,13 @@
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="panel panel-default panel-condensed">
|
||||
<div class="panel-heading">
|
||||
<strong>{{ $name }} plugin in "Port" tab</strong>
|
||||
</div>
|
||||
Example display in Port tab</br>
|
||||
{{ $port->device->hostname }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user