mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 15:44:45 +02:00
Switch to authorize
Co-authored-by: Boy132 <Boy132@users.noreply.github.com>
This commit is contained in:
parent
329a3993c1
commit
45b73debc2
@ -4,7 +4,6 @@ namespace App\Filament\Resources\ServerResource\Pages;
|
|||||||
|
|
||||||
use App\Filament\Resources\ServerResource;
|
use App\Filament\Resources\ServerResource;
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
use App\Models\User;
|
|
||||||
use Filament\Actions;
|
use Filament\Actions;
|
||||||
use Filament\Resources\Pages\ListRecords;
|
use Filament\Resources\Pages\ListRecords;
|
||||||
use Filament\Tables\Actions\Action;
|
use Filament\Tables\Actions\Action;
|
||||||
@ -64,10 +63,14 @@ class ListServers extends ListRecords
|
|||||||
->searchable(),
|
->searchable(),
|
||||||
SelectColumn::make('allocation_id')
|
SelectColumn::make('allocation_id')
|
||||||
->label('Primary Allocation')
|
->label('Primary Allocation')
|
||||||
->disabled(fn () => !auth()->user()->can('update server'))
|
->hidden(!auth()->user()->can('update server'))
|
||||||
->options(fn (Server $server) => $server->allocations->mapWithKeys(fn ($allocation) => [$allocation->id => $allocation->address]))
|
->options(fn (Server $server) => $server->allocations->mapWithKeys(fn ($allocation) => [$allocation->id => $allocation->address]))
|
||||||
->selectablePlaceholder(false)
|
->selectablePlaceholder(false)
|
||||||
->sortable(),
|
->sortable(),
|
||||||
|
TextColumn::make('allocation_id_can')
|
||||||
|
->label('Primary Allocation')
|
||||||
|
->hidden(auth()->user()->can('update server'))
|
||||||
|
->state(fn (Server $server) => $server->allocation->address),
|
||||||
TextColumn::make('image')->hidden(),
|
TextColumn::make('image')->hidden(),
|
||||||
TextColumn::make('backups_count')
|
TextColumn::make('backups_count')
|
||||||
->counts('backups')
|
->counts('backups')
|
||||||
@ -80,7 +83,7 @@ class ListServers extends ListRecords
|
|||||||
Action::make('View')
|
Action::make('View')
|
||||||
->icon('tabler-terminal')
|
->icon('tabler-terminal')
|
||||||
->url(fn (Server $server) => "/server/$server->uuid_short")
|
->url(fn (Server $server) => "/server/$server->uuid_short")
|
||||||
->visible(fn () => auth()->user()->can('view server')),
|
->authorize(fn () => auth()->user()->can('view server')),
|
||||||
EditAction::make(),
|
EditAction::make(),
|
||||||
])
|
])
|
||||||
->emptyStateIcon('tabler-brand-docker')
|
->emptyStateIcon('tabler-brand-docker')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user