|
| 1 | +<?php |
| 2 | + |
| 3 | +/** |
| 4 | + * LogTabs.php |
| 5 | + * |
| 6 | + * -Description- |
| 7 | + * |
| 8 | + * This program is free software: you can redistribute it and/or modify |
| 9 | + * it under the terms of the GNU General Public License as published by |
| 10 | + * the Free Software Foundation, either version 3 of the License, or |
| 11 | + * (at your option) any later version. |
| 12 | + * |
| 13 | + * This program is distributed in the hope that it will be useful, |
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the |
| 16 | + * GNU General Public License for more details. |
| 17 | + * |
| 18 | + * You should have received a copy of the GNU General Public License |
| 19 | + * along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 20 | + * |
| 21 | + * @link https://www.librenms.org |
| 22 | + * |
| 23 | + * @copyright 2025 Tony Murray |
| 24 | + * @author Tony Murray <murraytony@gmail.com> |
| 25 | + */ |
| 26 | + |
| 27 | +namespace App\View\Components\Device; |
| 28 | + |
| 29 | +use App\Facades\LibrenmsConfig; |
| 30 | +use App\Models\Device; |
| 31 | +use Closure; |
| 32 | +use Illuminate\Contracts\View\View; |
| 33 | +use Illuminate\View\Component; |
| 34 | + |
| 35 | +class LogTabs extends Component |
| 36 | +{ |
| 37 | + public array $tabs = []; |
| 38 | + |
| 39 | + public function __construct( |
| 40 | + public readonly Device $device, |
| 41 | + public readonly ?string $tab = null, |
| 42 | + ) { |
| 43 | + $this->tabs['outages'] = [ |
| 44 | + 'text' => __('Outages'), |
| 45 | + 'link' => route('device.outages', $this->device->device_id), |
| 46 | + ]; |
| 47 | + |
| 48 | + $this->tabs['eventlog'] = [ |
| 49 | + 'text' => __('Event Log'), |
| 50 | + 'link' => route('device.eventlog', $this->device->device_id), |
| 51 | + ]; |
| 52 | + |
| 53 | + if (LibrenmsConfig::get('enable_syslog')) { |
| 54 | + $this->tabs['syslog'] = [ |
| 55 | + 'text' => __('Syslog'), |
| 56 | + 'link' => route('device.syslog', $this->device->device_id), |
| 57 | + ]; |
| 58 | + } |
| 59 | + |
| 60 | + if (LibrenmsConfig::get('graylog.server')) { |
| 61 | + $this->tabs['graylog'] = [ |
| 62 | + 'text' => __('Graylog'), |
| 63 | + 'link' => route('device.graylog', $this->device->device_id), |
| 64 | + ]; |
| 65 | + } |
| 66 | + } |
| 67 | + |
| 68 | + /** |
| 69 | + * Get the view / contents that represent the component. |
| 70 | + */ |
| 71 | + public function render(): View|Closure|string |
| 72 | + { |
| 73 | + return view('components.device.log-tabs'); |
| 74 | + } |
| 75 | +} |
0 commit comments