182 lines
7.1 KiB
PHP
182 lines
7.1 KiB
PHP
{{--
|
|
Network Address Card Component - shadcn-inspired
|
|
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="rounded-xl border bg-card p-6 shadow-sm mb-4">
|
|
{{-- Header --}}
|
|
<div class="flex items-center justify-between mb-4">
|
|
<h3 class="text-base 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 md:grid-cols-3 gap-4">
|
|
{{-- IP Address --}}
|
|
<div class="space-y-1.5">
|
|
<span class="text-sm font-medium text-muted-foreground">IP Address</span>
|
|
<div class="flex items-center gap-2">
|
|
<span class="font-semibold font-mono">{{ $ip }}</span>
|
|
<x-proxmox::ui.copy-button :value="$ip" />
|
|
</div>
|
|
@if($cidr)
|
|
<p class="text-xs text-muted-foreground">CIDR: {{ $ip }}{{ $cidr }}</p>
|
|
@endif
|
|
</div>
|
|
|
|
{{-- Gateway --}}
|
|
<div class="space-y-1.5">
|
|
<span class="text-sm font-medium text-muted-foreground">Gateway</span>
|
|
<div class="flex items-center gap-2">
|
|
<span class="font-semibold font-mono">{{ $gateway ?? 'N/A' }}</span>
|
|
@if($gateway)
|
|
<x-proxmox::ui.copy-button :value="$gateway" />
|
|
@endif
|
|
</div>
|
|
<p class="text-xs text-muted-foreground">
|
|
{{ $fromGuestAgent && !$gateway ? 'Not configured in database' : 'Default route' }}
|
|
</p>
|
|
</div>
|
|
|
|
{{-- Netmask --}}
|
|
<div class="space-y-1.5">
|
|
<span class="text-sm font-medium text-muted-foreground">Subnet Mask</span>
|
|
<div class="flex items-center gap-2">
|
|
<span class="font-semibold font-mono">{{ $netmask ?? 'N/A' }}</span>
|
|
@if($netmask)
|
|
<x-proxmox::ui.copy-button :value="$netmask" />
|
|
@endif
|
|
</div>
|
|
<p class="text-xs text-muted-foreground">
|
|
{{ $fromGuestAgent && !$netmask ? 'Not configured' : 'Network range' }}
|
|
</p>
|
|
</div>
|
|
</div>
|
|
|
|
{{-- Network Tools (for public IPs) --}}
|
|
@if($isPublic)
|
|
<div class="flex gap-2 justify-end mt-4 pt-4 border-t">
|
|
@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="border-t pt-4 mt-4"
|
|
x-data="{ isAdvancedView: localStorage.getItem('proxmox-view-mode') === 'advanced' }"
|
|
x-init="
|
|
isAdvancedView = localStorage.getItem('proxmox-view-mode') === 'advanced';
|
|
window.addEventListener('proxmox-view-mode-changed', (e) => {
|
|
isAdvancedView = e.detail.isAdvancedView;
|
|
});
|
|
"
|
|
x-show="isAdvancedView"
|
|
x-transition:enter="transition ease-out duration-150"
|
|
x-transition:enter-start="opacity-0"
|
|
x-transition:enter-end="opacity-100"
|
|
>
|
|
<h4 class="text-sm font-medium text-muted-foreground mb-3">Technical Details</h4>
|
|
<div class="grid md:grid-cols-2 gap-4">
|
|
@if(isset($guestInterface['hardware-address']))
|
|
<div class="space-y-1">
|
|
<span class="text-xs font-medium text-muted-foreground">MAC Address</span>
|
|
<div class="flex items-center gap-2">
|
|
<span class="text-sm font-mono">{{ $guestInterface['hardware-address'] }}</span>
|
|
<x-proxmox::ui.copy-button :value="$guestInterface['hardware-address']" />
|
|
</div>
|
|
</div>
|
|
@endif
|
|
|
|
@if(isset($guestInterface['name']))
|
|
<div class="space-y-1">
|
|
<span class="text-xs font-medium text-muted-foreground">Interface</span>
|
|
<span class="text-sm font-mono block">{{ $guestInterface['name'] }}</span>
|
|
</div>
|
|
@endif
|
|
|
|
@if(isset($guestInterface['statistics']))
|
|
<div class="space-y-1 md:col-span-2">
|
|
<span class="text-xs font-medium text-muted-foreground">Statistics</span>
|
|
<div class="flex flex-wrap gap-4 text-sm text-muted-foreground">
|
|
@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>
|