refactor: optimize IP visibility handling in Proxmox firewall view by integrating conditional checks for public IPs, enhancing user interaction

This commit is contained in:
2025-12-04 14:11:07 -05:00
parent 69a57459d8
commit 3b474fc4a0

View File

@@ -573,9 +573,9 @@
<td class="py-3 px-4 text-sm"> <td class="py-3 px-4 text-sm">
<div class="flex items-center gap-1"> <div class="flex items-center gap-1">
<span class="font-mono text-xs">{{ $rule['source'] ?? '-' }}</span> <span class="font-mono text-xs">{{ $rule['source'] ?? '-' }}</span>
@if($rule['source'] && $rule['source'] !== '-' && window.isPublicIP($rule['source'])) <div class="relative" x-data="{ open: false, loading: false, ipData: null }" x-cloak x-show="{{ $rule['source'] && $rule['source'] !== '-' }}">
<div class="relative" x-data="{ open: false, loading: false, ipData: null }" x-cloak>
<button type="button" @click.stop=" <button type="button" @click.stop="
if (!window.isPublicIP('{{ $rule['source'] }}')) return;
if (!ipData && !loading) { if (!ipData && !loading) {
loading = true; loading = true;
open = true; open = true;
@@ -589,7 +589,7 @@
} else { } else {
open = true; open = true;
} }
" class="text-base/50 hover:text-base/70 transition-colors" title="View IP Location"> " class="text-base/50 hover:text-base/70 transition-colors" title="View IP Location" x-show="window.isPublicIP('{{ $rule['source'] }}')">
<x-ri-map-pin-line class="size-3" /> <x-ri-map-pin-line class="size-3" />
</button> </button>
<!-- Modal --> <!-- Modal -->
@@ -666,18 +666,17 @@
</div> </div>
</template> </template>
</div> </div>
@endif
</td> </td>
<td class="py-3 px-4 text-sm"> <td class="py-3 px-4 text-sm">
<div class="flex items-center gap-1"> <div class="flex items-center gap-1">
<span class="font-mono text-xs">{{ $rule['dest'] ?? '-' }}</span> <span class="font-mono text-xs">{{ $rule['dest'] ?? '-' }}</span>
@if($rule['dest'] && $rule['dest'] !== '-' && window.isPublicIP($rule['dest'])) <div class="relative" x-data="{ open: false, loading: false, ipData: null }" x-cloak x-show="{{ $rule['dest'] && $rule['dest'] !== '-' }}">
<div class="relative" x-data="{ open: false, loading: false, ipData: null }" x-cloak>
<button type="button" @click.stop=" <button type="button" @click.stop="
if (!window.isPublicIP('{{ $rule['dest'] }}')) return;
if (!ipData && !loading) { if (!ipData && !loading) {
loading = true; loading = true;
open = true; open = true;
window.fetchIPLocation(rule.dest).then(data => { window.fetchIPLocation('{{ $rule['dest'] }}').then(data => {
ipData = data; ipData = data;
loading = false; loading = false;
}).catch(err => { }).catch(err => {
@@ -687,7 +686,7 @@
} else { } else {
open = true; open = true;
} }
" class="text-base/50 hover:text-base/70 transition-colors" title="View IP Location"> " class="text-base/50 hover:text-base/70 transition-colors" title="View IP Location" x-show="window.isPublicIP('{{ $rule['dest'] }}')">
<x-ri-map-pin-line class="size-3" /> <x-ri-map-pin-line class="size-3" />
</button> </button>
<!-- Modal --> <!-- Modal -->
@@ -764,7 +763,6 @@
</div> </div>
</template> </template>
</div> </div>
@endif
</td> </td>
<td class="py-3 px-4 text-sm">{{ strtoupper($rule['proto'] ?? 'any') }}</td> <td class="py-3 px-4 text-sm">{{ strtoupper($rule['proto'] ?? 'any') }}</td>
<td class="py-3 px-4 text-sm">{{ $rule['dport'] ?? $rule['sport'] ?? '-' }}</td> <td class="py-3 px-4 text-sm">{{ $rule['dport'] ?? $rule['sport'] ?? '-' }}</td>