Files
Virtnet.bond/extensions/Servers/Proxmox/views/components/ui/network-address-card.blade.php
Joseph.Rawlings af62a16354 Refactor modal close behavior and improve styling
- Changed modal close event from `@click.away` to `@click.self` for better control over closing modals.
- Updated various modal button styles for consistency and improved accessibility.
- Adjusted transition durations for modal animations to enhance user experience.
- Added aria-labels to close buttons for better screen reader support.
2026-02-23 20:02:41 -05:00

180 lines
7.1 KiB
PHP

{{--
Network Address Card Component - AdminLTE style
For displaying IP address information with gateway, netmask, and tools
Usage:
<x-proxmox::ui.network-address-card
:network="$network"
:cidr="$cidr"
:is-public="$isPublic"
:is-ipv6="$isIpv6"
:guest-interface="$guestInterface"
/>
--}}
@props([
'type' => 'ipv4',
'ip',
'gateway' => null,
'netmask' => null,
'cidr' => null,
'isPublic' => false,
'isIpv6' => false,
'guestInterface' => null,
'fromGuestAgent' => false,
])
<div class="card-lte mb-4 bg-background-secondary rounded-md shadow-md p-6">
{{-- Header --}}
<div class="mb-5 flex items-center justify-between">
<h3 class="text-lg font-semibold">{{ strtoupper($type) }} Address</h3>
<x-proxmox::ui.badge variant="default">
{{ $type === 'ipv6' ? 'IPv6' : 'IPv4' }}
</x-proxmox::ui.badge>
</div>
{{-- Address Grid --}}
<div class="grid gap-5 md:grid-cols-3">
{{-- IP Address --}}
<div class="flex flex-col gap-2">
<span class="text-sm font-medium text-base/50">IP Address</span>
<div class="flex items-center gap-2.5">
<span class="font-mono font-semibold">{{ $ip }}</span>
<x-proxmox::ui.copy-button :value="$ip" />
</div>
@if($cidr)
<p class="text-xs text-base/50">CIDR: {{ $ip }}{{ $cidr }}</p>
@endif
</div>
{{-- Gateway --}}
<div class="flex flex-col gap-2">
<span class="text-sm font-medium text-base/50">Gateway</span>
<div class="flex items-center gap-2.5">
<span class="font-mono font-semibold">{{ $gateway ?? 'N/A' }}</span>
@if($gateway)
<x-proxmox::ui.copy-button :value="$gateway" />
@endif
</div>
<p class="text-xs text-base/50">
{{ $fromGuestAgent && !$gateway ? 'Not configured in database' : 'Default route' }}
</p>
</div>
{{-- Netmask --}}
<div class="flex flex-col gap-2">
<span class="text-sm font-medium text-base/50">Subnet Mask</span>
<div class="flex items-center gap-2.5">
<span class="font-mono font-semibold">{{ $netmask ?? 'N/A' }}</span>
@if($netmask)
<x-proxmox::ui.copy-button :value="$netmask" />
@endif
</div>
<p class="text-xs text-base/50">
{{ $fromGuestAgent && !$netmask ? 'Not configured' : 'Network range' }}
</p>
</div>
</div>
{{-- Network Tools (for public IPs) --}}
@if($isPublic)
<div class="mt-5 flex justify-end gap-3 border-t border-neutral/20 pt-5">
@if($isIpv6)
<x-proxmox::ui.button
variant="outline"
size="sm"
onclick="window.open('https://ping6.ping.pe/{{ $ip }}', '_blank')"
>
Ping
</x-proxmox::ui.button>
<x-proxmox::ui.button
variant="outline"
size="sm"
onclick="window.open('https://mtr6.ping.pe/{{ $ip }}', '_blank')"
>
MTR
</x-proxmox::ui.button>
<x-proxmox::ui.button
variant="outline"
size="sm"
onclick="window.open('https://bgp.ping.pe/{{ $ip }}', '_blank')"
>
BGP
</x-proxmox::ui.button>
@else
<x-proxmox::ui.button
variant="outline"
size="sm"
onclick="window.open('https://ping.pe/{{ $ip }}', '_blank')"
>
Ping
</x-proxmox::ui.button>
<x-proxmox::ui.button
variant="outline"
size="sm"
onclick="window.open('https://mtr.ping.pe/{{ $ip }}', '_blank')"
>
MTR
</x-proxmox::ui.button>
<x-proxmox::ui.button
variant="outline"
size="sm"
onclick="window.open('https://bgp.ping.pe/{{ $ip }}', '_blank')"
>
BGP
</x-proxmox::ui.button>
@endif
</div>
@endif
{{-- Guest Agent Technical Details --}}
@if($guestInterface)
<div
class="mt-5 border-t border-neutral/20 pt-5"
x-data="{ isAdvancedView: localStorage.getItem('proxmox-view-mode') === 'advanced' }"
x-init="
isAdvancedView = localStorage.getItem('proxmox-view-mode') === 'advanced';
"
@proxmox-view-mode-changed.window="isAdvancedView = $event.detail.isAdvancedView"
x-show="isAdvancedView"
x-transition:enter="transition ease-out duration-200"
x-transition:enter-start="opacity-0"
x-transition:enter-end="opacity-100"
>
<h4 class="mb-4 text-sm font-medium text-base/50">Technical Details</h4>
<div class="grid gap-4 md:grid-cols-2">
@if(isset($guestInterface['hardware-address']))
<div class="flex flex-col gap-1.5">
<span class="text-xs font-medium text-base/50">MAC Address</span>
<div class="flex items-center gap-2.5">
<span class="font-mono text-sm text-base/70">{{ $guestInterface['hardware-address'] }}</span>
<x-proxmox::ui.copy-button :value="$guestInterface['hardware-address']" />
</div>
</div>
@endif
@if(isset($guestInterface['name']))
<div class="flex flex-col gap-1.5">
<span class="text-xs font-medium text-base/50">Interface</span>
<span class="block font-mono text-sm text-base/70">{{ $guestInterface['name'] }}</span>
</div>
@endif
@if(isset($guestInterface['statistics']))
<div class="md:col-span-2 flex flex-col gap-1.5">
<span class="text-xs font-medium text-base/50">Statistics</span>
<div class="flex flex-wrap gap-4 text-sm text-base/70">
@if(isset($guestInterface['statistics']['rx-bytes']))
<span>RX: {{ number_format($guestInterface['statistics']['rx-bytes']) }} bytes</span>
@endif
@if(isset($guestInterface['statistics']['tx-bytes']))
<span>TX: {{ number_format($guestInterface['statistics']['tx-bytes']) }} bytes</span>
@endif
</div>
</div>
@endif
</div>
</div>
@endif
</div>