feat: implement available IPs loading in Proxmox Firewall component to streamline IP selection for firewall rules and enhance user experience

This commit is contained in:
2025-12-01 14:25:08 -05:00
parent 3b170e88ba
commit d320a5cdce
2 changed files with 21 additions and 68 deletions

View File

@@ -261,20 +261,7 @@
<div>
<label class="block text-sm font-medium mb-2">Destination</label>
<select wire:model="ruleDest" class="w-full px-3 py-2 border border-neutral rounded-lg bg-background">
@php
$allIps = collect();
if ($server->primaryIpv4) {
$allIps->push(['ip' => $server->primaryIpv4->ip, 'type' => 'IPv4', 'label' => 'Primary']);
}
if ($server->primaryIpv6) {
$allIps->push(['ip' => $server->primaryIpv6->ip, 'type' => 'IPv6', 'label' => 'Primary']);
}
foreach ($server->ipAddresses as $ipAddress) {
$allIps->push(['ip' => $ipAddress->ip, 'type' => strtoupper($ipAddress->type), 'label' => 'Assigned']);
}
$uniqueIps = $allIps->unique('ip');
@endphp
@foreach($uniqueIps as $ipData)
@foreach($availableIps as $ipData)
<option value="{{ $ipData['ip'] }}">{{ $ipData['ip'] }} ({{ $ipData['type'] }} - {{ $ipData['label'] }})</option>
@endforeach
</select>