mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-29 16:44:44 +02:00
Simplify logic greatly
This commit is contained in:
parent
933e693897
commit
1800f105d7
@ -219,24 +219,13 @@ class CreateServer extends CreateRecord
|
|||||||
($allocation->ip_alias ? " ($allocation->ip_alias)" : '')
|
($allocation->ip_alias ? " ($allocation->ip_alias)" : '')
|
||||||
)
|
)
|
||||||
->placeholder('Select additional Allocations')
|
->placeholder('Select additional Allocations')
|
||||||
|
->disableOptionsWhenSelectedInSiblingRepeaterItems()
|
||||||
->relationship(
|
->relationship(
|
||||||
'allocations',
|
'allocations',
|
||||||
'ip',
|
'ip',
|
||||||
fn (Builder $query, Forms\Get $get, Forms\Components\Select $component, $state) => $query
|
fn (Builder $query, Forms\Get $get, Forms\Components\Select $component, $state) => $query
|
||||||
->where('node_id', $get('../../node_id'))
|
->where('node_id', $get('../../node_id'))
|
||||||
->whereNotIn(
|
->whereNot('id', $get('../../allocation_id'))
|
||||||
'id',
|
|
||||||
collect(($repeater = $component->getParentRepeater())->getState())
|
|
||||||
->pluck(
|
|
||||||
(string) str($component->getStatePath())
|
|
||||||
->after("{$repeater->getStatePath()}.")
|
|
||||||
->after('.'),
|
|
||||||
)
|
|
||||||
->flatten()
|
|
||||||
->diff(Arr::wrap($state))
|
|
||||||
->filter(fn (mixed $siblingItemState): bool => filled($siblingItemState))
|
|
||||||
->add($get('../../allocation_id'))
|
|
||||||
)
|
|
||||||
->whereNull('server_id'),
|
->whereNull('server_id'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user