Files
Virtnet.bond/extensions/Servers/Proxmox/views/components/ui/network-address-card.blade.php
Joseph.Rawlings e7b33a2f6c Refactor Proxmox server views for improved UI consistency and usability
- Updated server card component to use new UI elements and improved layout.
- Enhanced status display with badges and better status indicators.
- Refined quick info row for server details with consistent styling.
- Reorganized server configuration statistics into stat cards for clarity.
- Improved help modals for statistics and storage management sections.
- Streamlined alerts and warnings for better user experience.
- Updated storage management view to utilize new UI components and improve readability.
2025-12-17 11:24:17 -05:00

192 lines
8.4 KiB
PHP

{{--
Network Address Card Component - TailServer Theme
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,
])
<x-proxmox::ui.card class="mb-4">
{{-- Header --}}
<div class="flex items-center justify-between mb-4">
<h3 class="text-lg font-semibold text-base">{{ 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 grid-cols-1 gap-4 network-tools-grid">
{{-- IP Address --}}
<div class="flex flex-col gap-2 min-w-0">
<h4 class="text-sm font-semibold text-base/70">IP Address</h4>
<div class="flex items-center gap-2">
<span class="text-base font-semibold text-base/80">{{ $ip }}</span>
<x-proxmox::ui.copy-button :value="$ip" />
</div>
@if($cidr)
<p class="text-xs text-base/50 mt-1">CIDR: {{ $ip }}{{ $cidr }}</p>
@endif
</div>
{{-- Gateway --}}
<div class="flex flex-col gap-2 min-w-0">
<h4 class="text-sm font-semibold text-base/70">Gateway</h4>
<div class="flex items-center gap-2">
<span class="text-base font-semibold text-base/80">{{ $gateway ?? 'N/A' }}</span>
@if($gateway)
<x-proxmox::ui.copy-button :value="$gateway" />
@endif
</div>
<p class="text-xs text-base/50 mt-1">
{{ $fromGuestAgent && !$gateway ? 'Not configured in database' : 'Default route for this network' }}
</p>
</div>
{{-- Netmask --}}
<div class="flex flex-col gap-2 min-w-0">
<h4 class="text-sm font-semibold text-base/70">Subnet Mask</h4>
<div class="flex items-center gap-2">
<span class="text-base font-semibold text-base/80">{{ $netmask ?? 'N/A' }}</span>
@if($netmask)
<x-proxmox::ui.copy-button :value="$netmask" />
@endif
</div>
<p class="text-xs text-base/50 mt-1 break-words">
{{ $fromGuestAgent && !$netmask ? 'Not configured in database' : 'Network address range mask' }}
</p>
</div>
{{-- Network Tools (for public IPs) --}}
@if($isPublic)
<div class="network-tools-column flex flex-col gap-2 relative min-w-0 @if($guestInterface) network-tools-with-details @endif">
<div class="flex-1"></div>
<div class="flex gap-2 justify-end mt-auto">
@if($isIpv6)
<x-proxmox::ui.button
variant="primary"
size="sm"
onclick="window.open('https://ping6.ping.pe/{{ $ip }}', '_blank')"
>
Ping
</x-proxmox::ui.button>
<x-proxmox::ui.button
variant="primary"
size="sm"
onclick="window.open('https://mtr6.ping.pe/{{ $ip }}', '_blank')"
>
MTR
</x-proxmox::ui.button>
<x-proxmox::ui.button
variant="primary"
size="sm"
onclick="window.open('https://bgp.ping.pe/{{ $ip }}', '_blank')"
>
BGP
</x-proxmox::ui.button>
@else
<x-proxmox::ui.button
variant="primary"
size="sm"
onclick="window.open('https://ping.pe/{{ $ip }}', '_blank')"
>
Ping
</x-proxmox::ui.button>
<x-proxmox::ui.button
variant="primary"
size="sm"
onclick="window.open('https://mtr.ping.pe/{{ $ip }}', '_blank')"
>
MTR
</x-proxmox::ui.button>
<x-proxmox::ui.button
variant="primary"
size="sm"
onclick="window.open('https://bgp.ping.pe/{{ $ip }}', '_blank')"
>
BGP
</x-proxmox::ui.button>
@endif
</div>
</div>
@endif
</div>
{{-- Guest Agent Technical Details --}}
@if($guestInterface)
<div
class="border-t border-neutral/20 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
>
<h4 class="text-sm font-semibold text-base/70 mb-3">Technical Details (Guest Agent)</h4>
<div class="grid md:grid-cols-2 grid-cols-1 gap-4">
@if(isset($guestInterface['hardware-address']))
<div class="flex flex-col gap-1">
<span class="text-xs font-semibold text-base/60">MAC Address</span>
<div class="flex items-center gap-2">
<span class="text-sm font-mono text-base/80">{{ $guestInterface['hardware-address'] }}</span>
<x-proxmox::ui.copy-button :value="$guestInterface['hardware-address']" />
</div>
<p class="text-xs text-base/50 mt-1">Hardware address for this interface</p>
</div>
@endif
@if(isset($guestInterface['name']))
<div class="flex flex-col gap-1">
<span class="text-xs font-semibold text-base/60">Interface Name</span>
<span class="text-sm font-mono text-base/80">{{ $guestInterface['name'] }}</span>
<p class="text-xs text-base/50 mt-1">Network interface identifier within the guest OS</p>
</div>
@endif
@if(isset($guestInterface['statistics']))
<div class="flex flex-col gap-1">
<span class="text-xs font-semibold text-base/60">Statistics</span>
<div class="text-xs text-base/60 space-y-1">
@if(isset($guestInterface['statistics']['rx-bytes']))
<div>RX: {{ number_format($guestInterface['statistics']['rx-bytes']) }} bytes</div>
@endif
@if(isset($guestInterface['statistics']['tx-bytes']))
<div>TX: {{ number_format($guestInterface['statistics']['tx-bytes']) }} bytes</div>
@endif
@if(isset($guestInterface['statistics']['rx-packets']))
<div>RX Packets: {{ number_format($guestInterface['statistics']['rx-packets']) }}</div>
@endif
@if(isset($guestInterface['statistics']['tx-packets']))
<div>TX Packets: {{ number_format($guestInterface['statistics']['tx-packets']) }}</div>
@endif
</div>
<p class="text-xs text-base/50 mt-1">Network traffic statistics from guest OS</p>
</div>
@endif
</div>
</div>
@endif
</x-proxmox::ui.card>