mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
38 lines
872 B
PHP
38 lines
872 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\View\Components;
|
||
|
|
|
||
|
|
use Closure;
|
||
|
|
use Illuminate\Contracts\View\View;
|
||
|
|
use Illuminate\View\Component;
|
||
|
|
use LibreNMS\Enum\Severity;
|
||
|
|
|
||
|
|
class Label extends Component
|
||
|
|
{
|
||
|
|
public string $statusClass;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Create a new component instance.
|
||
|
|
*/
|
||
|
|
public function __construct(
|
||
|
|
public ?Severity $status = null
|
||
|
|
) {
|
||
|
|
$this->statusClass = match ($status) {
|
||
|
|
Severity::Ok => 'label-success',
|
||
|
|
Severity::Error => 'label-danger',
|
||
|
|
Severity::Info => 'label-info',
|
||
|
|
Severity::Notice => 'label-primary',
|
||
|
|
Severity::Warning => 'label-warning',
|
||
|
|
default => 'label-default',
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Get the view / contents that represent the component.
|
||
|
|
*/
|
||
|
|
public function render(): View|Closure|string
|
||
|
|
{
|
||
|
|
return view('components.label');
|
||
|
|
}
|
||
|
|
}
|