mirror of
https://github.com/pelican-dev/panel.git
synced 2025-08-03 15:42:13 +02:00
Filter out already used ips with the same port (#1496)
This commit is contained in:
parent
5a7c6ac6e5
commit
c5528a61f3
@ -62,7 +62,16 @@ class AllocationsRelationManager extends RelationManager
|
|||||||
->label(trans('admin/node.table.allocation_notes'))
|
->label(trans('admin/node.table.allocation_notes'))
|
||||||
->placeholder(trans('admin/node.table.no_notes')),
|
->placeholder(trans('admin/node.table.no_notes')),
|
||||||
SelectColumn::make('ip')
|
SelectColumn::make('ip')
|
||||||
->options(fn (Allocation $allocation) => collect($this->getOwnerRecord()->ipAddresses())->merge([$allocation->ip])->mapWithKeys(fn (string $ip) => [$ip => $ip]))
|
->options(function (Allocation $allocation) {
|
||||||
|
$ips = Allocation::where('port', $allocation->port)->pluck('ip');
|
||||||
|
|
||||||
|
return collect($this->getOwnerRecord()->ipAddresses())
|
||||||
|
->diff($ips)
|
||||||
|
->unshift($allocation->ip)
|
||||||
|
->unique()
|
||||||
|
->mapWithKeys(fn (string $ip) => [$ip => $ip])
|
||||||
|
->all();
|
||||||
|
})
|
||||||
->selectablePlaceholder(false)
|
->selectablePlaceholder(false)
|
||||||
->searchable()
|
->searchable()
|
||||||
->label(trans('admin/node.table.ip')),
|
->label(trans('admin/node.table.ip')),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user