Add all files
This commit is contained in:
105
extensions/Servers/Proxmox/Admin/Resources/IPPoolResource.php
Normal file
105
extensions/Servers/Proxmox/Admin/Resources/IPPoolResource.php
Normal file
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
namespace Paymenter\Extensions\Servers\Proxmox\Admin\Resources;
|
||||
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Paymenter\Extensions\Servers\Proxmox\Admin\Resources\IPPoolResource\Pages;
|
||||
use Paymenter\Extensions\Servers\Proxmox\Admin\Resources\IPPoolResource\RelationManagers;
|
||||
use Paymenter\Extensions\Servers\Proxmox\Models\IPPool;
|
||||
|
||||
class IPPoolResource extends Resource
|
||||
{
|
||||
protected static ?string $model = IPPool::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
// Label to IP Pool
|
||||
protected static ?string $label = 'IP Pool';
|
||||
|
||||
protected static ?string $navigationGroup = 'Proxmox';
|
||||
|
||||
protected static ?string $slug = 'proxmox-ip-pools';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('name')
|
||||
->label('Name')
|
||||
->required()
|
||||
->maxLength(255)
|
||||
->unique(ignoreRecord: true)
|
||||
->live(onBlur: true),
|
||||
|
||||
Forms\Components\TextInput::make('network_interface')
|
||||
->label('Network Interface')
|
||||
->required()
|
||||
->maxLength(255)
|
||||
->helperText('The network interface to use for this IP pool, e.g., vmbr0'),
|
||||
|
||||
Forms\Components\TextInput::make('mtu')
|
||||
->label('MTU')
|
||||
->numeric()
|
||||
->default(1500)
|
||||
->required()
|
||||
->helperText('The MTU (Maximum Transmission Unit) for the network interface, default is 1500'),
|
||||
|
||||
Forms\Components\Select::make('nodes')
|
||||
->label('Nodes')
|
||||
->multiple()
|
||||
->preload()
|
||||
->relationship('nodes', 'notes'),
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Forms\Components\TextInput::make('vlan')
|
||||
->label('VLAN')
|
||||
->numeric()
|
||||
->nullable(),
|
||||
|
||||
Forms\Components\Toggle::make('firewall')
|
||||
->label('Enable Firewall')
|
||||
->default(false)
|
||||
->helperText('Enable or disable the firewall for this IP pool'),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('name'),
|
||||
Tables\Columns\TextColumn::make('nodes_count')
|
||||
->label('Nodes')
|
||||
->counts('nodes'),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
RelationManagers\IPAddressRelationManager::class,
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListIPPools::route('/'),
|
||||
'create' => Pages\CreateIPPool::route('/create'),
|
||||
'edit' => Pages\EditIPPool::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user