Make allocations mobile friendly

This commit is contained in:
Charles 2024-04-19 10:18:51 -04:00
parent ee142a26b0
commit 82c294ab63

View File

@ -51,32 +51,21 @@ class EditNode extends EditRecord
]), ]),
Tabs\Tab::make('Allocations') Tabs\Tab::make('Allocations')
->icon('tabler-plug-connected') ->icon('tabler-plug-connected')
->columns(4) ->columns([
'default' => 1,
'sm' => 2,
'md' => 4,
])
->schema([ ->schema([
Forms\Components\Repeater::make('allocations') Forms\Components\Section::make('Create Allocation')
->orderColumn('server_id') ->columnSpan(4)
->columnSpan(1) ->columns([
->columns(4) 'default' => 1,
->relationship() 'sm' => 2,
->addActionLabel('Create New Allocation') 'md' => 4,
->addAction(fn ($action) => $action->color('info')) 'lg' => 5,
->schema([ ])
Forms\Components\TextInput::make('ip') //->inlineLabel()
->label('IP Address'),
Forms\Components\TextInput::make('ip_alias')
->label('Alias'),
Forms\Components\TextInput::make('port')
->minValue(0)
->maxValue(65535)
->numeric(),
Forms\Components\TextInput::make('server')
->formatStateUsing(fn (Allocation $allocation) => $allocation->server?->name)
->readOnly()
->placeholder('No Server'),
]),
Forms\Components\Section::make('Assign New Allocations')
->columnSpan(2)
->inlineLabel()
->headerActions([ ->headerActions([
Forms\Components\Actions\Action::make('submit') Forms\Components\Actions\Action::make('submit')
->color('success') ->color('success')
@ -86,22 +75,91 @@ class EditNode extends EditRecord
]) ])
->schema([ ->schema([
Forms\Components\TextInput::make('ip') Forms\Components\TextInput::make('ip')
->columnSpan([
'default' => 1,
'sm' => 1,
'md' => 2,
'lg' => 2,
])
->label('IP Address') ->label('IP Address')
->placeholder('0.0.0.0') ->placeholder('x.x.x.x')
->helperText('IP address to assign ports to') ->helperText('IP address to assign ports to'),
->columnSpanFull(), Forms\Components\TagsInput::make('port')
Forms\Components\TextInput::make('ip_alias') ->columnSpan([
->label('Alias') 'default' => 1,
->placeholder('minecraft') 'sm' => 1,
->helperText('Display name to help you remember') 'md' => 1,
->columnSpanFull(), 'lg' => 1,
Forms\Components\TextInput::make('ports') ])
->label('Ports')
->placeholder('25565') ->placeholder('25565')
->helperText('Individual ports or port ranges here separated by commas or spaces') ->helperText('Individual ports or port ranges here separated by spaces')
->columnSpanFull(), ->splitKeys(['Tab', ' ']),
Forms\Components\TextInput::make('ip_alias')
->columnSpan([
'default' => 1,
'sm' => 2,
'md' => 1,
'lg' => 2,
])
->label('Alias')
->placeholder('minecraft.pelican.dev')
->helperText('Display name to help you remember.'),
]),
Forms\Components\Repeater::make('allocations')
->orderColumn('server_id')
->columnSpan(4)
->columns([
'default' => 1,
'sm' => 3,
'md' => 4,
'lg' => 9,
])
->relationship()
->addActionLabel('Create New Allocation')
->addAction(fn ($action) => $action->color('info'))
->schema([
Forms\Components\TextInput::make('ip')
->label('IP Address')
->placeholder('x.x.x.x')
->columnSpan([
'default' => 1,
'sm' => 2,
'md' => 3,
'lg' => 2,
]),
Forms\Components\TextInput::make('port')
->placeholder('25565')
->columnSpan([
'default' => 1,
'sm' => 1,
'md' => 1,
'lg' => 1,
])
->minValue(0)
->maxValue(65535)
->numeric(),
Forms\Components\TextInput::make('ip_alias')
->placeholder('mincraft.pelican.dev')
->columnSpan([
'default' => 1,
'sm' => 2,
'md' => 2,
'lg' => 3,
])
->label('Alias'),
Forms\Components\TextInput::make('server')
->columnSpan([
'default' => 1,
'sm' => 1,
'md' => 2,
'lg' => 3,
])
->formatStateUsing(fn (Allocation $allocation) => $allocation->server?->name)
->activeUrl(true)
->placeholder('Not assigned'),
]), ]),
]), ]),
]), ]),
]); ]);
} }