mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Device page dropdown hero button, Performance -> Latency (#11328)
* Throw some shit together, rough outline. * Reorganize tabs, use tab controllers * Implement performance (into the latency tab) * Update resources/views/device/header.blade.php Co-Authored-By: Jellyfrog <[email protected]> * Add more tabs * All controllers created * Implement routes * Implement smokeping * routing and auth * fix smokeping check * Implement device dropdown menu * Update deviceUrl to new style * Use Gates * Fix style * use more appropriate gates * add show-config gate remove Laravel helper * Only show vlan tab if VLANs exist for the device :D * Fix rancid file check will return false * revert over-zealous file name changes * don't need to request the location parameter, just cast to string to avoid bugs when not found * Move latency tab (ping/performance) to the position of performance instead of ping. Co-authored-by: Jellyfrog <[email protected]>
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
/**
|
||||
* LoadBalancerController.php
|
||||
*
|
||||
* -Description-
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @link http://librenms.org
|
||||
* @copyright 2020 Tony Murray
|
||||
* @author Tony Murray <[email protected]>
|
||||
*/
|
||||
|
||||
namespace App\Http\Controllers\Device\Tabs;
|
||||
|
||||
use App\Facades\DeviceCache;
|
||||
use App\Models\Device;
|
||||
use LibreNMS\Interfaces\UI\DeviceTab;
|
||||
|
||||
class LoadBalancerController implements DeviceTab
|
||||
{
|
||||
private $tabs = [];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$device = DeviceCache::getPrimary();
|
||||
|
||||
if ($device->os == 'netscaler') {
|
||||
if ($device->netscalerVservers()->exists()) {
|
||||
$this->tabs[] = 'netscaler_vsvr';
|
||||
}
|
||||
}
|
||||
|
||||
// Cisco ACE
|
||||
if ($device->os == 'acsw') {
|
||||
if ($device->vServers()->exists()) {
|
||||
$this->tabs[] = 'loadbalancer_vservers';
|
||||
}
|
||||
}
|
||||
|
||||
// F5 LTM
|
||||
if ($device->os == 'f5') {
|
||||
$component = new \LibreNMS\Component();
|
||||
$component_count = $component->getComponentCount($device['device_id']);
|
||||
|
||||
if (isset($component_count['f5-ltm-vs'])) {
|
||||
$this->tabs[] = 'ltm_vs';
|
||||
}
|
||||
if (isset($component_count['f5-ltm-pool'])) {
|
||||
$this->tabs[] = 'ltm_pool';
|
||||
}
|
||||
if (isset($component_count['f5-gtm-wide'])) {
|
||||
$this->tabs[] = 'gtm_wide';
|
||||
}
|
||||
if (isset($component_count['f5-gtm-pool'])) {
|
||||
$this->tabs[] = 'gtm_pool';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function visible(Device $device): bool
|
||||
{
|
||||
return !empty($this->tabs);
|
||||
}
|
||||
|
||||
public function slug(): string
|
||||
{
|
||||
return 'loadbalancer';
|
||||
}
|
||||
|
||||
public function icon(): string
|
||||
{
|
||||
return 'fa-balance-scale';
|
||||
}
|
||||
|
||||
public function name(): string
|
||||
{
|
||||
return __('Load Balancer');
|
||||
}
|
||||
|
||||
public function data(Device $device): array
|
||||
{
|
||||
return [
|
||||
'loadbalancer_tabs' => $this->tabs,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user