mirror of
https://github.com/pelican-dev/panel.git
synced 2026-05-04 18:00:48 +03:00
Plugin system (#1866)
This commit is contained in:
27
app/Enums/PluginCategory.php
Normal file
27
app/Enums/PluginCategory.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
use Filament\Support\Contracts\HasIcon;
|
||||
use Filament\Support\Contracts\HasLabel;
|
||||
|
||||
enum PluginCategory: string implements HasIcon, HasLabel
|
||||
{
|
||||
case Plugin = 'plugin';
|
||||
case Theme = 'theme';
|
||||
case Language = 'language';
|
||||
|
||||
public function getIcon(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Plugin => 'tabler-package',
|
||||
self::Theme => 'tabler-palette',
|
||||
self::Language => 'tabler-language',
|
||||
};
|
||||
}
|
||||
|
||||
public function getLabel(): string
|
||||
{
|
||||
return trans('admin/plugin.category_enum.' . $this->value);
|
||||
}
|
||||
}
|
||||
43
app/Enums/PluginStatus.php
Normal file
43
app/Enums/PluginStatus.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
use Filament\Support\Contracts\HasColor;
|
||||
use Filament\Support\Contracts\HasIcon;
|
||||
use Filament\Support\Contracts\HasLabel;
|
||||
|
||||
enum PluginStatus: string implements HasColor, HasIcon, HasLabel
|
||||
{
|
||||
case NotInstalled = 'not_installed';
|
||||
case Disabled = 'disabled';
|
||||
case Enabled = 'enabled';
|
||||
case Errored = 'errored';
|
||||
case Incompatible = 'incompatible';
|
||||
|
||||
public function getIcon(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::NotInstalled => 'tabler-heart-off',
|
||||
self::Disabled => 'tabler-heart-x',
|
||||
self::Enabled => 'tabler-heart-check',
|
||||
self::Errored => 'tabler-heart-broken',
|
||||
self::Incompatible => 'tabler-heart-cancel',
|
||||
};
|
||||
}
|
||||
|
||||
public function getColor(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::NotInstalled => 'gray',
|
||||
self::Disabled => 'warning',
|
||||
self::Enabled => 'success',
|
||||
self::Errored => 'danger',
|
||||
self::Incompatible => 'danger',
|
||||
};
|
||||
}
|
||||
|
||||
public function getLabel(): string
|
||||
{
|
||||
return trans('admin/plugin.status_enum.' . $this->value);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user