- Change listStates method to accept nullable integer for limit parameter. - Modify TechnitiumDns class to return structured error messages on failure. - Enhance VNC and xterm popup routes with user authorization checks. - Update backups view to improve loading states and add unique keys for dynamic elements. - Refactor cloud-init view to ensure proper data binding and improve user experience. - Add wire:key attributes to various elements in views for better Livewire performance. - Improve error handling and user feedback in the firewall view. - Update server overview and statistics views to handle potential null values gracefully. - Add new migration files to extend database schema with user-set icons and notes for Proxmox nodes.
49 lines
1.7 KiB
PHP
49 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace Paymenter\Extensions\Servers\Proxmox\Admin\Resources\ServerResource\RelationManagers;
|
|
|
|
use Filament\Notifications\Notification;
|
|
use Filament\Resources\RelationManagers\RelationManager;
|
|
use Filament\Tables;
|
|
use Filament\Tables\Table;
|
|
|
|
class Ipv4RelationManager extends RelationManager
|
|
{
|
|
protected static string $relationship = 'ipaddresses';
|
|
|
|
public function table(Table $table): Table
|
|
{
|
|
return $table
|
|
->recordTitleAttribute('ip')
|
|
->columns([
|
|
Tables\Columns\TextColumn::make('ip')->searchable(),
|
|
Tables\Columns\TextColumn::make('gateway'),
|
|
Tables\Columns\TextColumn::make('bridge'),
|
|
Tables\Columns\TextColumn::make('netmask'),
|
|
])
|
|
->filters([
|
|
//
|
|
])
|
|
->headerActions([
|
|
Tables\Actions\AssociateAction::make()
|
|
->modelLabel('IPv4')
|
|
->preloadRecordSelect()
|
|
->label('Add'),
|
|
])
|
|
->actions([
|
|
Tables\Actions\DissociateAction::make()
|
|
->label('Remove')
|
|
->before(function (Tables\Actions\DissociateAction $action, RelationManager $livewire) {
|
|
if ($livewire->ownerRecord->primary_ipv4 == $action->getRecord()->id) {
|
|
Notification::make()
|
|
->danger()
|
|
->title('You cannot remove the primary IP')
|
|
->send();
|
|
|
|
$action->cancel();
|
|
}
|
|
}),
|
|
]);
|
|
}
|
|
}
|