mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-29 02:44:45 +02:00
Add data lists
This commit is contained in:
parent
a9a39ae502
commit
f25bd33f06
@ -95,13 +95,32 @@ class ServerResource extends Resource
|
|||||||
'ip',
|
'ip',
|
||||||
fn (Builder $query, Forms\Get $get) => $query->where('node_id', $get('node_id')),
|
fn (Builder $query, Forms\Get $get) => $query->where('node_id', $get('node_id')),
|
||||||
)
|
)
|
||||||
->createOptionForm([
|
->createOptionForm(fn (Forms\Get $get) => [
|
||||||
Forms\Components\TextInput::make('allocation_ip')
|
Forms\Components\TextInput::make('allocation_ip')
|
||||||
|
->ipv4()
|
||||||
|
->datalist(function () use ($get) {
|
||||||
|
$node = Node::find($get('node_id'));
|
||||||
|
if (is_ip($node->fqdn)) {
|
||||||
|
return [$node->fqdn];
|
||||||
|
}
|
||||||
|
|
||||||
|
$validRecords = gethostbynamel($node->fqdn);
|
||||||
|
if (!$validRecords) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $validRecords ?: [];
|
||||||
|
})
|
||||||
->label('IP Address')
|
->label('IP Address')
|
||||||
->helperText('Usually your machine\'s public IP unless you are port forwarding.')
|
->helperText("Usually your machine's public IP unless you are port forwarding.")
|
||||||
->required(),
|
->required(),
|
||||||
Forms\Components\TextInput::make('allocation_alias')
|
Forms\Components\TextInput::make('allocation_alias')
|
||||||
->label('Alias')
|
->label('Alias')
|
||||||
|
->default(null)
|
||||||
|
->datalist([
|
||||||
|
$get('name'),
|
||||||
|
Egg::find($get('egg_id'))?->name,
|
||||||
|
])
|
||||||
->helperText('This is just a display only name to help you recognize what this Allocation is used for.')
|
->helperText('This is just a display only name to help you recognize what this Allocation is used for.')
|
||||||
->required(false),
|
->required(false),
|
||||||
Forms\Components\TagsInput::make('allocation_ports')
|
Forms\Components\TagsInput::make('allocation_ports')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user