Prevent Select All

Prevent Select all on allocations, prevent people from trying to delete 30,000 ports at once ....
This commit is contained in:
notCharles 2024-11-13 16:21:27 -05:00
parent d9016702d6
commit a787af7a06
2 changed files with 26 additions and 30 deletions

View File

@ -48,6 +48,7 @@ class AllocationsRelationManager extends RelationManager
// All assigned allocations
->checkIfRecordIsSelectableUsing(fn(Allocation $allocation) => $allocation->server_id === null)
->searchable()
->selectCurrentPageOnly() //Prevent people from trying to nuke 30,000 ports at once.... -,-
->columns([
TextColumn::make('id'),
TextColumn::make('port')
@ -65,12 +66,6 @@ class AllocationsRelationManager extends RelationManager
->searchable()
->label('IP'),
])
->filters([
//
])
->actions([
//
])
->headerActions([
Tables\Actions\Action::make('create new allocation')->label('Create Allocations')
->form(fn() => [

View File

@ -40,6 +40,7 @@ class AllocationsRelationManager extends RelationManager
public function table(Table $table): Table
{
return $table
->selectCurrentPageOnly()
->recordTitleAttribute('ip')
->recordTitle(fn(Allocation $allocation) => "$allocation->ip:$allocation->port")
->checkIfRecordIsSelectableUsing(fn(Allocation $record) => $record->id !== $this->getOwnerRecord()->allocation_id)