mirror of
https://github.com/pelican-dev/panel.git
synced 2025-06-30 21:01:08 +02:00
Various fixes
This commit is contained in:
parent
0c3baa5cd8
commit
1e530d589f
@ -27,7 +27,6 @@ use Filament\Pages\Concerns\InteractsWithHeaderActions;
|
|||||||
use Filament\Pages\Page;
|
use Filament\Pages\Page;
|
||||||
use Filament\Schemas\Components\Actions;
|
use Filament\Schemas\Components\Actions;
|
||||||
use Filament\Schemas\Components\Component;
|
use Filament\Schemas\Components\Component;
|
||||||
use Filament\Schemas\Components\Form;
|
|
||||||
use Filament\Schemas\Components\Group;
|
use Filament\Schemas\Components\Group;
|
||||||
use Filament\Schemas\Components\Section;
|
use Filament\Schemas\Components\Section;
|
||||||
use Filament\Schemas\Components\StateCasts\BooleanStateCast;
|
use Filament\Schemas\Components\StateCasts\BooleanStateCast;
|
||||||
@ -42,9 +41,10 @@ use Illuminate\Support\Facades\Artisan;
|
|||||||
use Illuminate\Support\Facades\Notification as MailNotification;
|
use Illuminate\Support\Facades\Notification as MailNotification;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use Filament\Schemas\Contracts\HasSchemas;
|
use Filament\Schemas\Contracts\HasSchemas;
|
||||||
|
use Filament\Schemas\Schema;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property Form $form
|
* @property Schema $form
|
||||||
*/
|
*/
|
||||||
class Settings extends Page implements HasSchemas
|
class Settings extends Page implements HasSchemas
|
||||||
{
|
{
|
||||||
@ -84,6 +84,7 @@ class Settings extends Page implements HasSchemas
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array<Component>
|
* @return array<Component>
|
||||||
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
protected function getFormSchema(): array
|
protected function getFormSchema(): array
|
||||||
|
@ -82,15 +82,15 @@ class ListEggs extends ListRecords
|
|||||||
])
|
])
|
||||||
->groupedBulkActions([
|
->groupedBulkActions([
|
||||||
DeleteBulkAction::make()
|
DeleteBulkAction::make()
|
||||||
->before(fn (DeleteBulkAction $action, Collection $records) => $action->records($records->filter(function ($egg) {
|
->before(fn (Collection &$records) => $records = $records->filter(function ($egg) {
|
||||||
/** @var Egg $egg */
|
/** @var Egg $egg */
|
||||||
return $egg->servers_count <= 0;
|
return $egg->servers_count <= 0;
|
||||||
}))),
|
})),
|
||||||
UpdateEggBulkAction::make()
|
UpdateEggBulkAction::make()
|
||||||
->before(fn (UpdateEggBulkAction $action, Collection $records) => $action->records($records->filter(function ($egg) {
|
->before(fn (Collection &$records) => $records = $records->filter(function ($egg) {
|
||||||
/** @var Egg $egg */
|
/** @var Egg $egg */
|
||||||
return cache()->get("eggs.$egg->uuid.update", false);
|
return cache()->get("eggs.$egg->uuid.update", false);
|
||||||
}))),
|
})),
|
||||||
])
|
])
|
||||||
->emptyStateIcon('tabler-eggs')
|
->emptyStateIcon('tabler-eggs')
|
||||||
->emptyStateDescription('')
|
->emptyStateDescription('')
|
||||||
|
@ -8,7 +8,8 @@ use App\Filament\Components\Tables\Filters\TagsFilter;
|
|||||||
use App\Models\Node;
|
use App\Models\Node;
|
||||||
use App\Traits\Filament\CanCustomizeHeaderActions;
|
use App\Traits\Filament\CanCustomizeHeaderActions;
|
||||||
use App\Traits\Filament\CanCustomizeHeaderWidgets;
|
use App\Traits\Filament\CanCustomizeHeaderWidgets;
|
||||||
use Filament\Actions;
|
use Filament\Actions\Action;
|
||||||
|
use Filament\Actions\ActionGroup;
|
||||||
use Filament\Resources\Pages\ListRecords;
|
use Filament\Resources\Pages\ListRecords;
|
||||||
use Filament\Actions\CreateAction;
|
use Filament\Actions\CreateAction;
|
||||||
use Filament\Actions\EditAction;
|
use Filament\Actions\EditAction;
|
||||||
@ -78,7 +79,7 @@ class ListNodes extends ListRecords
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return array<Actions\Action|Actions\ActionGroup> */
|
/** @return array<Action|ActionGroup> */
|
||||||
protected function getDefaultHeaderActions(): array
|
protected function getDefaultHeaderActions(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
@ -132,20 +132,6 @@ 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')
|
|
||||||
// ->label(trans('admin/server.server_status'))
|
|
||||||
// ->formatStateUsing(fn (Server $server) => $server->condition)
|
|
||||||
// ->options(fn ($state) => [$state->value => $state->getLabel()])
|
|
||||||
// ->colors(fn ($state) => [$state->value => $state->getColor()])
|
|
||||||
// ->icons(fn ($state) => [$state->value => $state->getIcon()])
|
|
||||||
// ->columnSpan([
|
|
||||||
// 'default' => 2,
|
|
||||||
// 'sm' => 1,
|
|
||||||
// 'md' => 1,
|
|
||||||
// 'lg' => 1,
|
|
||||||
// ]),
|
|
||||||
|
|
||||||
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)
|
||||||
|
@ -7,9 +7,9 @@ use App\Filament\Admin\Resources\ServerResource;
|
|||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
use App\Traits\Filament\CanCustomizeHeaderActions;
|
use App\Traits\Filament\CanCustomizeHeaderActions;
|
||||||
use App\Traits\Filament\CanCustomizeHeaderWidgets;
|
use App\Traits\Filament\CanCustomizeHeaderWidgets;
|
||||||
use Filament\Actions;
|
|
||||||
use Filament\Resources\Pages\ListRecords;
|
use Filament\Resources\Pages\ListRecords;
|
||||||
use Filament\Actions\Action;
|
use Filament\Actions\Action;
|
||||||
|
use Filament\Actions\ActionGroup;
|
||||||
use Filament\Actions\CreateAction;
|
use Filament\Actions\CreateAction;
|
||||||
use Filament\Actions\EditAction;
|
use Filament\Actions\EditAction;
|
||||||
use Filament\Tables\Columns\SelectColumn;
|
use Filament\Tables\Columns\SelectColumn;
|
||||||
@ -106,7 +106,7 @@ class ListServers extends ListRecords
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return array<Actions\Action|Actions\ActionGroup> */
|
/** @return array<Action|ActionGroup> */
|
||||||
protected function getDefaultHeaderActions(): array
|
protected function getDefaultHeaderActions(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
@ -9,7 +9,6 @@ use Filament\Resources\Pages\ListRecords;
|
|||||||
use Filament\Actions\Action;
|
use Filament\Actions\Action;
|
||||||
use Filament\Actions\ActionGroup;
|
use Filament\Actions\ActionGroup;
|
||||||
use Filament\Actions\CreateAction;
|
use Filament\Actions\CreateAction;
|
||||||
use Filament\Actions\DeleteAction;
|
|
||||||
|
|
||||||
class ListUsers extends ListRecords
|
class ListUsers extends ListRecords
|
||||||
{
|
{
|
||||||
@ -18,7 +17,7 @@ class ListUsers extends ListRecords
|
|||||||
|
|
||||||
protected static string $resource = UserResource::class;
|
protected static string $resource = UserResource::class;
|
||||||
|
|
||||||
/** @return array<Action|ActionGroup|CreateAction|DeleteAction> */
|
/** @return array<Action|ActionGroup> */
|
||||||
protected function getDefaultHeaderActions(): array
|
protected function getDefaultHeaderActions(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
@ -17,7 +17,6 @@ use Filament\Actions\ActionGroup;
|
|||||||
use Filament\Notifications\Notification;
|
use Filament\Notifications\Notification;
|
||||||
use Filament\Resources\Pages\ListRecords;
|
use Filament\Resources\Pages\ListRecords;
|
||||||
use Filament\Schemas\Components\Tabs\Tab;
|
use Filament\Schemas\Components\Tabs\Tab;
|
||||||
use Filament\Support\Enums\Alignment;
|
|
||||||
use Filament\Support\Enums\TextSize;
|
use Filament\Support\Enums\TextSize;
|
||||||
use Filament\Tables\Columns\Column;
|
use Filament\Tables\Columns\Column;
|
||||||
use Filament\Tables\Columns\Layout\Stack;
|
use Filament\Tables\Columns\Layout\Stack;
|
||||||
@ -66,7 +65,8 @@ class ListServers extends ListRecords
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
TextColumn::make('condition')
|
TextColumn::make('condition')
|
||||||
->label('')
|
->label('Status')
|
||||||
|
->alignCenter()
|
||||||
->default('unknown')
|
->default('unknown')
|
||||||
->wrap()
|
->wrap()
|
||||||
->size(TextSize::Medium)
|
->size(TextSize::Medium)
|
||||||
@ -75,9 +75,9 @@ class ListServers extends ListRecords
|
|||||||
->icon(fn (Server $server) => $server->condition->getIcon())
|
->icon(fn (Server $server) => $server->condition->getIcon())
|
||||||
->color(fn (Server $server) => $server->condition->getColor()),
|
->color(fn (Server $server) => $server->condition->getColor()),
|
||||||
TextColumn::make('name')
|
TextColumn::make('name')
|
||||||
|
->label('Server')
|
||||||
->description(fn (Server $server) => $server->description)
|
->description(fn (Server $server) => $server->description)
|
||||||
->grow()
|
->grow()
|
||||||
->label('')
|
|
||||||
->size(TextSize::Medium)
|
->size(TextSize::Medium)
|
||||||
->searchable(),
|
->searchable(),
|
||||||
TextColumn::make('allocation.address')
|
TextColumn::make('allocation.address')
|
||||||
@ -87,7 +87,6 @@ class ListServers extends ListRecords
|
|||||||
->copyable(request()->isSecure()),
|
->copyable(request()->isSecure()),
|
||||||
TextColumn::make('cpuUsage')
|
TextColumn::make('cpuUsage')
|
||||||
->label('Resources')
|
->label('Resources')
|
||||||
->label('')
|
|
||||||
->size(TextSize::Medium)
|
->size(TextSize::Medium)
|
||||||
->icon('tabler-cpu')
|
->icon('tabler-cpu')
|
||||||
->tooltip(fn (Server $server) => 'Usage Limit: ' . $server->formatResource('cpu', limit: true, type: ServerResourceType::Percentage, precision: 0))
|
->tooltip(fn (Server $server) => 'Usage Limit: ' . $server->formatResource('cpu', limit: true, type: ServerResourceType::Percentage, precision: 0))
|
||||||
@ -97,7 +96,6 @@ class ListServers extends ListRecords
|
|||||||
->label('')
|
->label('')
|
||||||
->icon('tabler-device-desktop-analytics')
|
->icon('tabler-device-desktop-analytics')
|
||||||
->size(TextSize::Medium)
|
->size(TextSize::Medium)
|
||||||
->icon('tabler-memory')
|
|
||||||
->tooltip(fn (Server $server) => 'Usage Limit: ' . $server->formatResource('memory', limit: true))
|
->tooltip(fn (Server $server) => 'Usage Limit: ' . $server->formatResource('memory', limit: true))
|
||||||
->state(fn (Server $server) => $server->formatResource('memory_bytes'))
|
->state(fn (Server $server) => $server->formatResource('memory_bytes'))
|
||||||
->color(fn (Server $server) => $this->getResourceColor($server, 'memory')),
|
->color(fn (Server $server) => $this->getResourceColor($server, 'memory')),
|
||||||
@ -105,7 +103,6 @@ class ListServers extends ListRecords
|
|||||||
->label('')
|
->label('')
|
||||||
->icon('tabler-device-sd-card')
|
->icon('tabler-device-sd-card')
|
||||||
->size(TextSize::Medium)
|
->size(TextSize::Medium)
|
||||||
->icon('tabler-device-floppy')
|
|
||||||
->tooltip(fn (Server $server) => 'Usage Limit: ' . $server->formatResource('disk', limit: true))
|
->tooltip(fn (Server $server) => 'Usage Limit: ' . $server->formatResource('disk', limit: true))
|
||||||
->state(fn (Server $server) => $server->formatResource('disk_bytes'))
|
->state(fn (Server $server) => $server->formatResource('disk_bytes'))
|
||||||
->color(fn (Server $server) => $this->getResourceColor($server, 'disk')),
|
->color(fn (Server $server) => $this->getResourceColor($server, 'disk')),
|
||||||
@ -126,10 +123,9 @@ class ListServers extends ListRecords
|
|||||||
->query(fn () => $baseQuery)
|
->query(fn () => $baseQuery)
|
||||||
->poll('15s')
|
->poll('15s')
|
||||||
->columns($usingGrid ? $this->gridColumns() : $this->tableColumns())
|
->columns($usingGrid ? $this->gridColumns() : $this->tableColumns())
|
||||||
->recordUrl(!$usingGrid ? (fn (Server $server) => Console::getUrl(panel: 'server', tenant: $server)) : null)
|
|
||||||
->recordActions(!$usingGrid ? ActionGroup::make(static::getPowerActions()) : [])
|
|
||||||
->recordActionsAlignment(Alignment::Center->value)
|
|
||||||
->contentGrid($usingGrid ? ['default' => 1, 'md' => 2] : null)
|
->contentGrid($usingGrid ? ['default' => 1, 'md' => 2] : null)
|
||||||
|
->recordActions($usingGrid ? [] : ActionGroup::make(static::getPowerActions())->icon('tabler-power')->tooltip('Power Actions'))
|
||||||
|
->recordUrl(fn (Server $server) => $usingGrid ? null : Console::getUrl(panel: 'server', tenant: $server))
|
||||||
->emptyStateIcon('tabler-brand-docker')
|
->emptyStateIcon('tabler-brand-docker')
|
||||||
->emptyStateDescription('')
|
->emptyStateDescription('')
|
||||||
->emptyStateHeading(fn () => $this->activeTab === 'my' ? 'You don\'t own any servers!' : 'You don\'t have access to any servers!')
|
->emptyStateHeading(fn () => $this->activeTab === 'my' ? 'You don\'t own any servers!' : 'You don\'t have access to any servers!')
|
||||||
@ -238,34 +234,34 @@ class ListServers extends ListRecords
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** @return Action[] */
|
/** @return Action[] */
|
||||||
public static function getPowerActions(Server $server): array
|
public static function getPowerActions(?Server $server = null): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
Action::make('start')
|
Action::make('start')
|
||||||
->color('primary')
|
->color('primary')
|
||||||
->icon('tabler-player-play-filled')
|
->icon('tabler-player-play-filled')
|
||||||
->authorize(fn () => auth()->user()->can(Permission::ACTION_CONTROL_START, $server))
|
->authorize(fn (?Server $record) => auth()->user()->can(Permission::ACTION_CONTROL_START, $record ?? $server))
|
||||||
->visible(fn () => !$server->isInConflictState() & $server->retrieveStatus()->isStartable())
|
->visible(fn (?Server $record) => !($record ?? $server)->isInConflictState() & ($record ?? $server)->retrieveStatus()->isStartable())
|
||||||
->dispatch('powerAction', fn () => ['server' => $server, 'action' => 'start']),
|
->dispatch('powerAction', fn (?Server $record) => ['server' => $record ?? $server, 'action' => 'start']),
|
||||||
Action::make('restart')
|
Action::make('restart')
|
||||||
->color('gray')
|
->color('gray')
|
||||||
->icon('tabler-reload')
|
->icon('tabler-reload')
|
||||||
->authorize(fn () => auth()->user()->can(Permission::ACTION_CONTROL_RESTART, $server))
|
->authorize(fn (?Server $record) => auth()->user()->can(Permission::ACTION_CONTROL_RESTART, $record ?? $server))
|
||||||
->visible(fn () => !$server->isInConflictState() & $server->retrieveStatus()->isRestartable())
|
->visible(fn (?Server $record) => !($record ?? $server)->isInConflictState() & ($record ?? $server)->retrieveStatus()->isRestartable())
|
||||||
->dispatch('powerAction', fn () => ['server' => $server, 'action' => 'restart']),
|
->dispatch('powerAction', fn (?Server $record) => ['server' => $record ?? $server, 'action' => 'restart']),
|
||||||
Action::make('stop')
|
Action::make('stop')
|
||||||
->color('danger')
|
->color('danger')
|
||||||
->icon('tabler-player-stop-filled')
|
->icon('tabler-player-stop-filled')
|
||||||
->authorize(fn () => auth()->user()->can(Permission::ACTION_CONTROL_STOP, $server))
|
->authorize(fn (?Server $record) => auth()->user()->can(Permission::ACTION_CONTROL_STOP, $record ?? $server))
|
||||||
->visible(fn () => !$server->isInConflictState() & $server->retrieveStatus()->isStoppable())
|
->visible(fn (?Server $record) => !($record ?? $server)->isInConflictState() & ($record ?? $server)->retrieveStatus()->isStoppable())
|
||||||
->dispatch('powerAction', fn () => ['server' => $server, 'action' => 'stop']),
|
->dispatch('powerAction', fn (?Server $record) => ['server' => $record ?? $server, 'action' => 'stop']),
|
||||||
Action::make('kill')
|
Action::make('kill')
|
||||||
->color('danger')
|
->color('danger')
|
||||||
->icon('tabler-alert-square')
|
->icon('tabler-alert-square')
|
||||||
->tooltip('This can result in data corruption and/or data loss!')
|
->tooltip('This can result in data corruption and/or data loss!')
|
||||||
->authorize(fn () => auth()->user()->can(Permission::ACTION_CONTROL_STOP, $server))
|
->authorize(fn (?Server $record) => auth()->user()->can(Permission::ACTION_CONTROL_STOP, $record ?? $server))
|
||||||
->visible(fn () => !$server->isInConflictState() & $server->retrieveStatus()->isKillable())
|
->visible(fn (?Server $record) => !($record ?? $server)->isInConflictState() & ($record ?? $server)->retrieveStatus()->isKillable())
|
||||||
->dispatch('powerAction', fn () => ['server' => $server, 'action' => 'kill']),
|
->dispatch('powerAction', fn (?Server $record) => ['server' => $record ?? $server, 'action' => 'kill']),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ use App\Extensions\Captcha\Providers\CaptchaProvider;
|
|||||||
use App\Extensions\OAuth\Providers\OAuthProvider;
|
use App\Extensions\OAuth\Providers\OAuthProvider;
|
||||||
use App\Facades\Activity;
|
use App\Facades\Activity;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Filament\Auth\Http\Responses\LoginResponse;
|
use Filament\Auth\Http\Responses\Contracts\LoginResponse;
|
||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
use Filament\Actions\Action;
|
use Filament\Actions\Action;
|
||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
|
@ -3,14 +3,11 @@
|
|||||||
namespace App\Filament\Server\Components;
|
namespace App\Filament\Server\Components;
|
||||||
|
|
||||||
use Closure;
|
use Closure;
|
||||||
use Filament\Support\Concerns\EvaluatesClosures;
|
|
||||||
use Filament\Widgets\StatsOverviewWidget\Stat;
|
use Filament\Widgets\StatsOverviewWidget\Stat;
|
||||||
use Illuminate\Contracts\View\View;
|
use Illuminate\Contracts\View\View;
|
||||||
|
|
||||||
class SmallStatBlock extends Stat
|
class SmallStatBlock extends Stat
|
||||||
{
|
{
|
||||||
use EvaluatesClosures;
|
|
||||||
|
|
||||||
protected bool|Closure $copyOnClick = false;
|
protected bool|Closure $copyOnClick = false;
|
||||||
|
|
||||||
public function copyOnClick(bool|Closure $copyOnClick = true): static
|
public function copyOnClick(bool|Closure $copyOnClick = true): static
|
||||||
@ -27,6 +24,6 @@ class SmallStatBlock extends Stat
|
|||||||
|
|
||||||
public function render(): View
|
public function render(): View
|
||||||
{
|
{
|
||||||
return view('filament.components.server-small-data-block', $this->data());
|
return view('filament.components.server-small-data-block', array_merge($this->getViewData(), $this->extractPublicMethods()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ use Filament\Facades\Filament;
|
|||||||
use Filament\Actions\Action;
|
use Filament\Actions\Action;
|
||||||
use Filament\Actions\ActionGroup;
|
use Filament\Actions\ActionGroup;
|
||||||
use Filament\Pages\Page;
|
use Filament\Pages\Page;
|
||||||
|
use Filament\Schemas\Components\Concerns\HasHeaderActions;
|
||||||
use Filament\Support\Enums\Size;
|
use Filament\Support\Enums\Size;
|
||||||
use Filament\Widgets\Widget;
|
use Filament\Widgets\Widget;
|
||||||
use Filament\Widgets\WidgetConfiguration;
|
use Filament\Widgets\WidgetConfiguration;
|
||||||
@ -27,7 +28,9 @@ use Livewire\Attributes\On;
|
|||||||
|
|
||||||
class Console extends Page
|
class Console extends Page
|
||||||
{
|
{
|
||||||
use CanCustomizeHeaderActions;
|
use CanCustomizeHeaderActions, HasHeaderActions {
|
||||||
|
CanCustomizeHeaderActions::getHeaderActions insteadof HasHeaderActions;
|
||||||
|
}
|
||||||
use InteractsWithActions;
|
use InteractsWithActions;
|
||||||
|
|
||||||
protected static ?int $navigationSort = 1;
|
protected static ?int $navigationSort = 1;
|
||||||
@ -141,9 +144,7 @@ class Console extends Page
|
|||||||
$this->status = ContainerStatus::from($state);
|
$this->status = ContainerStatus::from($state);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->cachedHeaderActions = [];
|
$this->headerActions($this->getHeaderActions());
|
||||||
|
|
||||||
$this->cacheHeaderActions();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return array<Action|ActionGroup> */
|
/** @return array<Action|ActionGroup> */
|
||||||
|
@ -8,13 +8,12 @@ use App\Traits\Filament\CanCustomizeHeaderActions;
|
|||||||
use App\Traits\Filament\CanCustomizeHeaderWidgets;
|
use App\Traits\Filament\CanCustomizeHeaderWidgets;
|
||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
use Filament\Forms\Concerns\InteractsWithForms;
|
use Filament\Forms\Concerns\InteractsWithForms;
|
||||||
use Filament\Schemas\Components\Form;
|
|
||||||
use Filament\Pages\Concerns\InteractsWithFormActions;
|
use Filament\Pages\Concerns\InteractsWithFormActions;
|
||||||
use Filament\Pages\Page;
|
use Filament\Pages\Page;
|
||||||
use Filament\Schemas\Schema;
|
use Filament\Schemas\Schema;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property Form $form
|
* @property Schema $form
|
||||||
*/
|
*/
|
||||||
abstract class ServerFormPage extends Page
|
abstract class ServerFormPage extends Page
|
||||||
{
|
{
|
||||||
@ -26,6 +25,7 @@ abstract class ServerFormPage extends Page
|
|||||||
|
|
||||||
protected string $view = 'filament.server.pages.server-form-page';
|
protected string $view = 'filament.server.pages.server-form-page';
|
||||||
|
|
||||||
|
/** @var array<string, mixed>|null */
|
||||||
public ?array $data = [];
|
public ?array $data = [];
|
||||||
|
|
||||||
public function mount(): void
|
public function mount(): void
|
||||||
@ -58,4 +58,6 @@ abstract class ServerFormPage extends Page
|
|||||||
|
|
||||||
return $server;
|
return $server;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function save(): void {}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,6 @@ use Filament\Pages\Concerns\InteractsWithFormActions;
|
|||||||
use Filament\Panel;
|
use Filament\Panel;
|
||||||
use Filament\Resources\Pages\Page;
|
use Filament\Resources\Pages\Page;
|
||||||
use Filament\Resources\Pages\PageRegistration;
|
use Filament\Resources\Pages\PageRegistration;
|
||||||
use Filament\Schemas\Components\Form;
|
|
||||||
use Filament\Schemas\Components\Section;
|
use Filament\Schemas\Components\Section;
|
||||||
use Filament\Schemas\Schema;
|
use Filament\Schemas\Schema;
|
||||||
use Filament\Support\Enums\Alignment;
|
use Filament\Support\Enums\Alignment;
|
||||||
@ -36,7 +35,7 @@ use Illuminate\Support\Facades\Route as RouteFacade;
|
|||||||
use Livewire\Attributes\Locked;
|
use Livewire\Attributes\Locked;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property Schema $schema
|
* @property Schema $form
|
||||||
*/
|
*/
|
||||||
class EditFiles extends Page
|
class EditFiles extends Page
|
||||||
{
|
{
|
||||||
@ -56,6 +55,7 @@ class EditFiles extends Page
|
|||||||
|
|
||||||
private DaemonFileRepository $fileRepository;
|
private DaemonFileRepository $fileRepository;
|
||||||
|
|
||||||
|
/** @var array<string, mixed>|null */
|
||||||
public ?array $data = [];
|
public ?array $data = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -201,7 +201,7 @@ class EditFiles extends Page
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array<int | string, string | Form>
|
* @return array<string, Schema>
|
||||||
*/
|
*/
|
||||||
protected function getForms(): array
|
protected function getForms(): array
|
||||||
{
|
{
|
||||||
|
@ -11,8 +11,9 @@ use App\Traits\Filament\CanCustomizeHeaderActions;
|
|||||||
use App\Traits\Filament\CanCustomizeHeaderWidgets;
|
use App\Traits\Filament\CanCustomizeHeaderWidgets;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Filament\Actions\CreateAction;
|
use Filament\Actions\CreateAction;
|
||||||
use Filament\Facades\Filament;
|
|
||||||
use Filament\Actions\Action;
|
use Filament\Actions\Action;
|
||||||
|
use Filament\Actions\ActionGroup;
|
||||||
|
use Filament\Facades\Filament;
|
||||||
use Filament\Forms\Components\CheckboxList;
|
use Filament\Forms\Components\CheckboxList;
|
||||||
use Filament\Schemas\Components\Actions;
|
use Filament\Schemas\Components\Actions;
|
||||||
use Filament\Schemas\Components\Grid;
|
use Filament\Schemas\Components\Grid;
|
||||||
@ -32,7 +33,7 @@ class ListUsers extends ListRecords
|
|||||||
|
|
||||||
protected static string $resource = UserResource::class;
|
protected static string $resource = UserResource::class;
|
||||||
|
|
||||||
/** @return array<Actions\Action|Actions\ActionGroup> */
|
/** @return array<Action|ActionGroup> */
|
||||||
protected function getDefaultHeaderActions(): array
|
protected function getDefaultHeaderActions(): array
|
||||||
{
|
{
|
||||||
/** @var Server $server */
|
/** @var Server $server */
|
||||||
|
@ -17,10 +17,11 @@ use Exception;
|
|||||||
use Filament\Actions\Action;
|
use Filament\Actions\Action;
|
||||||
use Filament\Schemas\Components\Wizard;
|
use Filament\Schemas\Components\Wizard;
|
||||||
use Filament\Forms\Concerns\InteractsWithForms;
|
use Filament\Forms\Concerns\InteractsWithForms;
|
||||||
use Filament\Schemas\Components\Form;
|
|
||||||
use Filament\Notifications\Notification;
|
use Filament\Notifications\Notification;
|
||||||
use Filament\Pages\SimplePage;
|
use Filament\Pages\SimplePage;
|
||||||
|
use Filament\Schemas\Components\Component;
|
||||||
use Filament\Schemas\Contracts\HasSchemas;
|
use Filament\Schemas\Contracts\HasSchemas;
|
||||||
|
use Filament\Schemas\Schema;
|
||||||
use Filament\Support\Enums\Width;
|
use Filament\Support\Enums\Width;
|
||||||
use Filament\Support\Exceptions\Halt;
|
use Filament\Support\Exceptions\Halt;
|
||||||
use Illuminate\Support\Facades\Artisan;
|
use Illuminate\Support\Facades\Artisan;
|
||||||
@ -28,7 +29,7 @@ use Illuminate\Support\Facades\Blade;
|
|||||||
use Illuminate\Support\HtmlString;
|
use Illuminate\Support\HtmlString;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property Form $form
|
* @property Schema $schema
|
||||||
*/
|
*/
|
||||||
class PanelInstaller extends SimplePage implements HasSchemas
|
class PanelInstaller extends SimplePage implements HasSchemas
|
||||||
{
|
{
|
||||||
@ -36,6 +37,7 @@ class PanelInstaller extends SimplePage implements HasSchemas
|
|||||||
use EnvironmentWriterTrait;
|
use EnvironmentWriterTrait;
|
||||||
use InteractsWithForms;
|
use InteractsWithForms;
|
||||||
|
|
||||||
|
/** @var array<string, mixed> */
|
||||||
public array $data = [];
|
public array $data = [];
|
||||||
|
|
||||||
protected string $view = 'filament.pages.installer';
|
protected string $view = 'filament.pages.installer';
|
||||||
@ -54,9 +56,10 @@ class PanelInstaller extends SimplePage implements HasSchemas
|
|||||||
{
|
{
|
||||||
abort_if(self::isInstalled(), 404);
|
abort_if(self::isInstalled(), 404);
|
||||||
|
|
||||||
$this->form->fill();
|
$this->schema->fill();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return Component[] */
|
||||||
protected function getFormSchema(): array
|
protected function getFormSchema(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
@ -25,7 +25,7 @@ trait CanCustomizeHeaderActions
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return array<Action|ActionGroup|CreateAction|DeleteAction>
|
/** @return array<Action|ActionGroup>
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
protected function getHeaderActions(): array
|
protected function getHeaderActions(): array
|
||||||
|
Loading…
x
Reference in New Issue
Block a user