mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 15:44:45 +02:00
wip
This commit is contained in:
parent
7b12f8cb04
commit
9eb1710c3a
@ -7,7 +7,7 @@ use Filament\Pages\Dashboard as BaseDashboard;
|
|||||||
|
|
||||||
class Dashboard extends BaseDashboard
|
class Dashboard extends BaseDashboard
|
||||||
{
|
{
|
||||||
protected static string | \BackedEnum | null $navigationIcon = 'tabler-layout-dashboard';
|
protected static string|\BackedEnum|null $navigationIcon = 'tabler-layout-dashboard';
|
||||||
|
|
||||||
private SoftwareVersionService $softwareVersionService;
|
private SoftwareVersionService $softwareVersionService;
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ use Spatie\Health\ResultStores\ResultStore;
|
|||||||
|
|
||||||
class Health extends Page
|
class Health extends Page
|
||||||
{
|
{
|
||||||
protected static string | \BackedEnum | null $navigationIcon = 'tabler-heart';
|
protected static string|\BackedEnum|null $navigationIcon = 'tabler-heart';
|
||||||
|
|
||||||
protected string $view = 'filament.pages.health';
|
protected string $view = 'filament.pages.health';
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ class Settings extends Page implements HasSchemas
|
|||||||
use InteractsWithForms;
|
use InteractsWithForms;
|
||||||
use InteractsWithHeaderActions;
|
use InteractsWithHeaderActions;
|
||||||
|
|
||||||
protected static string | \BackedEnum | null $navigationIcon = 'tabler-settings';
|
protected static string|\BackedEnum|null $navigationIcon = 'tabler-settings';
|
||||||
|
|
||||||
protected string $view = 'filament.pages.settings';
|
protected string $view = 'filament.pages.settings';
|
||||||
|
|
||||||
@ -237,12 +237,12 @@ class Settings extends Page implements HasSchemas
|
|||||||
$set('TRUSTED_PROXIES', $ips->values()->all());
|
$set('TRUSTED_PROXIES', $ips->values()->all());
|
||||||
}),
|
}),
|
||||||
]),
|
]),
|
||||||
Select::make('FILAMENT_WIDTH')
|
// Select::make('FILAMENT_WIDTH')
|
||||||
->label(trans('admin/setting.general.display_width'))
|
// ->label(trans('admin/setting.general.display_width'))
|
||||||
->native(false)
|
// ->native(false)
|
||||||
->options(Width::class)
|
// ->options(Width::class->value)
|
||||||
->selectablePlaceholder(false)
|
// ->selectablePlaceholder(false)
|
||||||
->default(env('FILAMENT_WIDTH', config('panel.filament.display-width'))),
|
// ->default(env('FILAMENT_WIDTH', config('panel.filament.display-width'))),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ class ApiKeyResource extends Resource
|
|||||||
{
|
{
|
||||||
protected static ?string $model = ApiKey::class;
|
protected static ?string $model = ApiKey::class;
|
||||||
|
|
||||||
protected static string | \BackedEnum | null $navigationIcon = 'tabler-key';
|
protected static string|\BackedEnum|null $navigationIcon = 'tabler-key';
|
||||||
|
|
||||||
public static function getNavigationLabel(): string
|
public static function getNavigationLabel(): string
|
||||||
{
|
{
|
||||||
|
@ -21,7 +21,7 @@ class DatabaseHostResource extends Resource
|
|||||||
{
|
{
|
||||||
protected static ?string $model = DatabaseHost::class;
|
protected static ?string $model = DatabaseHost::class;
|
||||||
|
|
||||||
protected static string | \BackedEnum | null $navigationIcon = 'tabler-database';
|
protected static string|\BackedEnum|null $navigationIcon = 'tabler-database';
|
||||||
|
|
||||||
protected static ?string $recordTitleAttribute = 'name';
|
protected static ?string $recordTitleAttribute = 'name';
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ class EggResource extends Resource
|
|||||||
{
|
{
|
||||||
protected static ?string $model = Egg::class;
|
protected static ?string $model = Egg::class;
|
||||||
|
|
||||||
protected static string | \BackedEnum | null $navigationIcon = 'tabler-eggs';
|
protected static string|\BackedEnum|null $navigationIcon = 'tabler-eggs';
|
||||||
|
|
||||||
protected static ?string $recordTitleAttribute = 'name';
|
protected static ?string $recordTitleAttribute = 'name';
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ class MountResource extends Resource
|
|||||||
{
|
{
|
||||||
protected static ?string $model = Mount::class;
|
protected static ?string $model = Mount::class;
|
||||||
|
|
||||||
protected static string | \BackedEnum | null $navigationIcon = 'tabler-layers-linked';
|
protected static string|\BackedEnum|null $navigationIcon = 'tabler-layers-linked';
|
||||||
|
|
||||||
protected static ?string $recordTitleAttribute = 'name';
|
protected static ?string $recordTitleAttribute = 'name';
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ class NodeResource extends Resource
|
|||||||
{
|
{
|
||||||
protected static ?string $model = Node::class;
|
protected static ?string $model = Node::class;
|
||||||
|
|
||||||
protected static string | \BackedEnum | null $navigationIcon = 'tabler-server-2';
|
protected static string|\BackedEnum|null $navigationIcon = 'tabler-server-2';
|
||||||
|
|
||||||
protected static ?string $recordTitleAttribute = 'name';
|
protected static ?string $recordTitleAttribute = 'name';
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ class AllocationsRelationManager extends RelationManager
|
|||||||
{
|
{
|
||||||
protected static string $relationship = 'allocations';
|
protected static string $relationship = 'allocations';
|
||||||
|
|
||||||
protected static string | \BackedEnum | null $icon = 'tabler-plug-connected';
|
protected static string|\BackedEnum|null $icon = 'tabler-plug-connected';
|
||||||
|
|
||||||
public function setTitle(): string
|
public function setTitle(): string
|
||||||
{
|
{
|
||||||
|
@ -12,7 +12,7 @@ class NodesRelationManager extends RelationManager
|
|||||||
{
|
{
|
||||||
protected static string $relationship = 'servers';
|
protected static string $relationship = 'servers';
|
||||||
|
|
||||||
protected static string | \BackedEnum | null $icon = 'tabler-brand-docker';
|
protected static string|\BackedEnum|null $icon = 'tabler-brand-docker';
|
||||||
|
|
||||||
public function setTitle(): string
|
public function setTitle(): string
|
||||||
{
|
{
|
||||||
|
@ -28,7 +28,7 @@ class RoleResource extends Resource
|
|||||||
{
|
{
|
||||||
protected static ?string $model = Role::class;
|
protected static ?string $model = Role::class;
|
||||||
|
|
||||||
protected static string | \BackedEnum | null $navigationIcon = 'tabler-users-group';
|
protected static string|\BackedEnum|null $navigationIcon = 'tabler-users-group';
|
||||||
|
|
||||||
protected static ?string $recordTitleAttribute = 'name';
|
protected static ?string $recordTitleAttribute = 'name';
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ class ServerResource extends Resource
|
|||||||
{
|
{
|
||||||
protected static ?string $model = Server::class;
|
protected static ?string $model = Server::class;
|
||||||
|
|
||||||
protected static string | \BackedEnum | null $navigationIcon = 'tabler-brand-docker';
|
protected static string|\BackedEnum|null $navigationIcon = 'tabler-brand-docker';
|
||||||
|
|
||||||
protected static ?string $recordTitleAttribute = 'name';
|
protected static ?string $recordTitleAttribute = 'name';
|
||||||
|
|
||||||
|
@ -125,19 +125,19 @@ class EditServer extends EditRecord
|
|||||||
->getOptionLabelFromRecordUsing(fn (User $user) => "$user->username ($user->email)")
|
->getOptionLabelFromRecordUsing(fn (User $user) => "$user->username ($user->email)")
|
||||||
->preload()
|
->preload()
|
||||||
->required(),
|
->required(),
|
||||||
|
//
|
||||||
ToggleButtons::make('condition')
|
// ToggleButtons::make('condition')
|
||||||
->label(trans('admin/server.server_status'))
|
// ->label(trans('admin/server.server_status'))
|
||||||
->formatStateUsing(fn (Server $server) => $server->condition)
|
// ->formatStateUsing(fn (Server $server) => $server->condition)
|
||||||
->options(fn ($state) => [$state->value => $state->getLabel()])
|
// ->options(fn ($state) => [$state->value => $state->getLabel()])
|
||||||
->colors(fn ($state) => [$state->value => $state->getColor()])
|
// ->colors(fn ($state) => [$state->value => $state->getColor()])
|
||||||
->icons(fn ($state) => [$state->value => $state->getIcon()])
|
// ->icons(fn ($state) => [$state->value => $state->getIcon()])
|
||||||
->columnSpan([
|
// ->columnSpan([
|
||||||
'default' => 2,
|
// 'default' => 2,
|
||||||
'sm' => 1,
|
// 'sm' => 1,
|
||||||
'md' => 1,
|
// 'md' => 1,
|
||||||
'lg' => 1,
|
// 'lg' => 1,
|
||||||
]),
|
// ]),
|
||||||
|
|
||||||
Textarea::make('description')
|
Textarea::make('description')
|
||||||
->label(trans('admin/server.description'))
|
->label(trans('admin/server.description'))
|
||||||
@ -392,6 +392,7 @@ class EditServer extends EditRecord
|
|||||||
->columnSpanFull()
|
->columnSpanFull()
|
||||||
->schema([
|
->schema([
|
||||||
ToggleButtons::make('oom_killer')
|
ToggleButtons::make('oom_killer')
|
||||||
|
->dehydrated()
|
||||||
->label(trans('admin/server.oom'))->inlineLabel()->inline()
|
->label(trans('admin/server.oom'))->inlineLabel()->inline()
|
||||||
->columnSpan(2)
|
->columnSpan(2)
|
||||||
->options([
|
->options([
|
||||||
@ -827,7 +828,6 @@ class EditServer extends EditRecord
|
|||||||
->success()
|
->success()
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
$this->refreshFormData(['status', 'docker']);
|
|
||||||
} catch (Exception) {
|
} catch (Exception) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title(trans('admin/server.notifications.reinstall_failed'))
|
->title(trans('admin/server.notifications.reinstall_failed'))
|
||||||
@ -844,7 +844,6 @@ class EditServer extends EditRecord
|
|||||||
->success()
|
->success()
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
$this->refreshFormData(['status', 'docker']);
|
|
||||||
} catch (Exception $exception) {
|
} catch (Exception $exception) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title(trans('admin/server.notifications.install_toggle_failed'))
|
->title(trans('admin/server.notifications.install_toggle_failed'))
|
||||||
@ -875,7 +874,6 @@ class EditServer extends EditRecord
|
|||||||
->title(trans('admin/server.notifications.server_suspended'))
|
->title(trans('admin/server.notifications.server_suspended'))
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
$this->refreshFormData(['status', 'docker']);
|
|
||||||
} catch (Exception) {
|
} catch (Exception) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->warning()
|
->warning()
|
||||||
@ -897,7 +895,6 @@ class EditServer extends EditRecord
|
|||||||
->title(trans('admin/server.notifications.server_unsuspended'))
|
->title(trans('admin/server.notifications.server_unsuspended'))
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
$this->refreshFormData(['status', 'docker']);
|
|
||||||
} catch (Exception) {
|
} catch (Exception) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->warning()
|
->warning()
|
||||||
@ -962,8 +959,6 @@ class EditServer extends EditRecord
|
|||||||
->title(trans('admin/server.notifications.reinstall_started'))
|
->title(trans('admin/server.notifications.reinstall_started'))
|
||||||
->success()
|
->success()
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
$this->refreshFormData(['status', 'docker']);
|
|
||||||
} catch (Exception) {
|
} catch (Exception) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title(trans('admin/server.notifications.reinstall_failed'))
|
->title(trans('admin/server.notifications.reinstall_failed'))
|
||||||
@ -1085,7 +1080,7 @@ class EditServer extends EditRecord
|
|||||||
$data['description'] = '';
|
$data['description'] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($data['docker'], $data['status']);
|
unset($data['docker'], $data['condition']);
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ class UserResource extends Resource
|
|||||||
{
|
{
|
||||||
protected static ?string $model = User::class;
|
protected static ?string $model = User::class;
|
||||||
|
|
||||||
protected static string | \BackedEnum | null $navigationIcon = 'tabler-users';
|
protected static string|\BackedEnum|null $navigationIcon = 'tabler-users';
|
||||||
|
|
||||||
protected static ?string $recordTitleAttribute = 'username';
|
protected static ?string $recordTitleAttribute = 'username';
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ class WebhookResource extends Resource
|
|||||||
{
|
{
|
||||||
protected static ?string $model = WebhookConfiguration::class;
|
protected static ?string $model = WebhookConfiguration::class;
|
||||||
|
|
||||||
protected static string | \BackedEnum | null $navigationIcon = 'tabler-webhook';
|
protected static string|\BackedEnum|null $navigationIcon = 'tabler-webhook';
|
||||||
|
|
||||||
protected static ?string $recordTitleAttribute = 'description';
|
protected static ?string $recordTitleAttribute = 'description';
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@ use App\Filament\Server\Widgets\ServerOverview;
|
|||||||
use App\Livewire\AlertBanner;
|
use App\Livewire\AlertBanner;
|
||||||
use App\Models\Permission;
|
use App\Models\Permission;
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
use Filament\Actions\Concerns\InteractsWithActions;
|
|
||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
use Filament\Actions\Action;
|
use Filament\Actions\Action;
|
||||||
use Filament\Pages\Page;
|
use Filament\Pages\Page;
|
||||||
@ -25,7 +24,7 @@ use Livewire\Attributes\On;
|
|||||||
|
|
||||||
class Console extends Page
|
class Console extends Page
|
||||||
{
|
{
|
||||||
protected static string | \BackedEnum | null $navigationIcon = 'tabler-brand-tabler';
|
protected static string|\BackedEnum|null $navigationIcon = 'tabler-brand-tabler';
|
||||||
|
|
||||||
protected static ?int $navigationSort = 1;
|
protected static ?int $navigationSort = 1;
|
||||||
|
|
||||||
|
@ -30,32 +30,12 @@ abstract class ServerFormPage extends Page
|
|||||||
|
|
||||||
protected function authorizeAccess(): void {}
|
protected function authorizeAccess(): void {}
|
||||||
|
|
||||||
protected function fillForm(): void
|
protected function fillform(): void
|
||||||
{
|
{
|
||||||
$data = $this->getRecord()->attributesToArray();
|
$data = $this->getRecord()->attributesToArray();
|
||||||
$this->form->fill($data);
|
$this->form->fill($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return array<int | string, string | Form>
|
|
||||||
*/
|
|
||||||
protected function getFormSchema(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'schema' => $this->form($this->makeSchema()
|
|
||||||
->model($this->getRecord())
|
|
||||||
->statePath($this->getFormStatePath())
|
|
||||||
->columns($this->hasInlineLabels() ? 1 : 2)
|
|
||||||
->inlineLabel($this->hasInlineLabels()),
|
|
||||||
),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getFormStatePath(): ?string
|
|
||||||
{
|
|
||||||
return 'data';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getRecord(): Server
|
public function getRecord(): Server
|
||||||
{
|
{
|
||||||
/** @var Server $server */
|
/** @var Server $server */
|
||||||
|
@ -21,7 +21,7 @@ use Illuminate\Support\Number;
|
|||||||
|
|
||||||
class Settings extends ServerFormPage
|
class Settings extends ServerFormPage
|
||||||
{
|
{
|
||||||
protected static string | \BackedEnum | null $navigationIcon = 'tabler-settings';
|
protected static string|\BackedEnum|null $navigationIcon = 'tabler-settings';
|
||||||
|
|
||||||
protected static ?int $navigationSort = 10;
|
protected static ?int $navigationSort = 10;
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ use Illuminate\Support\Facades\Validator;
|
|||||||
|
|
||||||
class Startup extends ServerFormPage
|
class Startup extends ServerFormPage
|
||||||
{
|
{
|
||||||
protected static string | \BackedEnum | null $navigationIcon = 'tabler-player-play';
|
protected static string|\BackedEnum|null $navigationIcon = 'tabler-player-play';
|
||||||
|
|
||||||
protected static ?int $navigationSort = 9;
|
protected static ?int $navigationSort = 9;
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ class ActivityResource extends Resource
|
|||||||
|
|
||||||
protected static ?int $navigationSort = 8;
|
protected static ?int $navigationSort = 8;
|
||||||
|
|
||||||
protected static string | \BackedEnum | null $navigationIcon = 'tabler-stack';
|
protected static string|\BackedEnum|null $navigationIcon = 'tabler-stack';
|
||||||
|
|
||||||
public static function getEloquentQuery(): Builder
|
public static function getEloquentQuery(): Builder
|
||||||
{
|
{
|
||||||
|
@ -20,7 +20,7 @@ class AllocationResource extends Resource
|
|||||||
|
|
||||||
protected static ?int $navigationSort = 7;
|
protected static ?int $navigationSort = 7;
|
||||||
|
|
||||||
protected static string | \BackedEnum | null $navigationIcon = 'tabler-network';
|
protected static string|\BackedEnum|null $navigationIcon = 'tabler-network';
|
||||||
|
|
||||||
// TODO: find better way handle server conflict state
|
// TODO: find better way handle server conflict state
|
||||||
public static function canAccess(): bool
|
public static function canAccess(): bool
|
||||||
|
@ -16,7 +16,7 @@ class BackupResource extends Resource
|
|||||||
|
|
||||||
protected static ?int $navigationSort = 3;
|
protected static ?int $navigationSort = 3;
|
||||||
|
|
||||||
protected static string | \BackedEnum | null $navigationIcon = 'tabler-file-zip';
|
protected static string|\BackedEnum|null $navigationIcon = 'tabler-file-zip';
|
||||||
|
|
||||||
protected static bool $canCreateAnother = false;
|
protected static bool $canCreateAnother = false;
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ class DatabaseResource extends Resource
|
|||||||
|
|
||||||
protected static ?int $navigationSort = 6;
|
protected static ?int $navigationSort = 6;
|
||||||
|
|
||||||
protected static string | \BackedEnum | null $navigationIcon = 'tabler-database';
|
protected static string|\BackedEnum|null $navigationIcon = 'tabler-database';
|
||||||
|
|
||||||
public const WARNING_THRESHOLD = 0.7;
|
public const WARNING_THRESHOLD = 0.7;
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ class FileResource extends Resource
|
|||||||
|
|
||||||
protected static ?int $navigationSort = 2;
|
protected static ?int $navigationSort = 2;
|
||||||
|
|
||||||
protected static string | \BackedEnum | null $navigationIcon = 'tabler-files';
|
protected static string|\BackedEnum|null $navigationIcon = 'tabler-files';
|
||||||
|
|
||||||
// TODO: find better way handle server conflict state
|
// TODO: find better way handle server conflict state
|
||||||
public static function canAccess(): bool
|
public static function canAccess(): bool
|
||||||
|
@ -23,7 +23,6 @@ use Filament\Resources\Pages\PageRegistration;
|
|||||||
use Filament\Schemas\Schema;
|
use Filament\Schemas\Schema;
|
||||||
use Filament\Support\Enums\Alignment;
|
use Filament\Support\Enums\Alignment;
|
||||||
use Illuminate\Contracts\Filesystem\FileNotFoundException;
|
use Illuminate\Contracts\Filesystem\FileNotFoundException;
|
||||||
use Illuminate\Http\Client\ConnectionException;
|
|
||||||
use Illuminate\Routing\Route;
|
use Illuminate\Routing\Route;
|
||||||
use Illuminate\Support\Facades\Route as RouteFacade;
|
use Illuminate\Support\Facades\Route as RouteFacade;
|
||||||
use Livewire\Attributes\Locked;
|
use Livewire\Attributes\Locked;
|
||||||
|
@ -33,7 +33,7 @@ class ScheduleResource extends Resource
|
|||||||
|
|
||||||
protected static ?int $navigationSort = 4;
|
protected static ?int $navigationSort = 4;
|
||||||
|
|
||||||
protected static string | \BackedEnum | null $navigationIcon = 'tabler-clock';
|
protected static string|\BackedEnum|null $navigationIcon = 'tabler-clock';
|
||||||
|
|
||||||
// TODO: find better way handle server conflict state
|
// TODO: find better way handle server conflict state
|
||||||
public static function canAccess(): bool
|
public static function canAccess(): bool
|
||||||
|
@ -33,7 +33,7 @@ class UserResource extends Resource
|
|||||||
|
|
||||||
protected static ?int $navigationSort = 5;
|
protected static ?int $navigationSort = 5;
|
||||||
|
|
||||||
protected static string | \BackedEnum | null $navigationIcon = 'tabler-users';
|
protected static string|\BackedEnum|null $navigationIcon = 'tabler-users';
|
||||||
|
|
||||||
protected static ?string $tenantOwnershipRelationshipName = 'subServers';
|
protected static ?string $tenantOwnershipRelationshipName = 'subServers';
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user