Files
Virtnet.bond/extensions/Servers/Proxmox/views/components/ui/network-address-card.blade.php
Joseph.Rawlings b4e2923a2c refactor: update Proxmox UI components to use TailAdmin styling
- Changed component styles and classes to align with TailAdmin design patterns.
- Updated color schemes, typography, and layout for consistency across components.
- Refactored Info Row, Network Address Card, Notice Banner, Progress Bar, Resource Gauge, Section Header, Server Status, Spinner, Stat Card, and Tab Panel components.
- Enhanced responsiveness and accessibility features in various components.
2025-12-17 12:33:10 -05:00

182 lines
7.6 KiB
PHP

{{--
Network Address Card Component - TailAdmin 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="mb-4 rounded-2xl border border-gray-200 bg-white p-6 dark:border-gray-800 dark:bg-white/[0.03]">
{{-- Header --}}
<div class="mb-5 flex items-center justify-between">
<h3 class="text-lg font-semibold text-gray-800 dark:text-white/90">{{ 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="space-y-2">
<span class="text-theme-sm font-medium text-gray-500 dark:text-gray-400">IP Address</span>
<div class="flex items-center gap-2.5">
<span class="font-mono font-semibold text-gray-800 dark:text-white/90">{{ $ip }}</span>
<x-proxmox::ui.copy-button :value="$ip" />
</div>
@if($cidr)
<p class="text-theme-xs text-gray-500 dark:text-gray-400">CIDR: {{ $ip }}{{ $cidr }}</p>
@endif
</div>
{{-- Gateway --}}
<div class="space-y-2">
<span class="text-theme-sm font-medium text-gray-500 dark:text-gray-400">Gateway</span>
<div class="flex items-center gap-2.5">
<span class="font-mono font-semibold text-gray-800 dark:text-white/90">{{ $gateway ?? 'N/A' }}</span>
@if($gateway)
<x-proxmox::ui.copy-button :value="$gateway" />
@endif
</div>
<p class="text-theme-xs text-gray-500 dark:text-gray-400">
{{ $fromGuestAgent && !$gateway ? 'Not configured in database' : 'Default route' }}
</p>
</div>
{{-- Netmask --}}
<div class="space-y-2">
<span class="text-theme-sm font-medium text-gray-500 dark:text-gray-400">Subnet Mask</span>
<div class="flex items-center gap-2.5">
<span class="font-mono font-semibold text-gray-800 dark:text-white/90">{{ $netmask ?? 'N/A' }}</span>
@if($netmask)
<x-proxmox::ui.copy-button :value="$netmask" />
@endif
</div>
<p class="text-theme-xs text-gray-500 dark:text-gray-400">
{{ $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-gray-200 pt-5 dark:border-gray-800">
@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-gray-200 pt-5 dark:border-gray-800"
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-200"
x-transition:enter-start="opacity-0"
x-transition:enter-end="opacity-100"
>
<h4 class="mb-4 text-theme-sm font-medium text-gray-500 dark:text-gray-400">Technical Details</h4>
<div class="grid gap-4 md:grid-cols-2">
@if(isset($guestInterface['hardware-address']))
<div class="space-y-1.5">
<span class="text-theme-xs font-medium text-gray-500 dark:text-gray-400">MAC Address</span>
<div class="flex items-center gap-2.5">
<span class="font-mono text-theme-sm text-gray-700 dark:text-gray-300">{{ $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.5">
<span class="text-theme-xs font-medium text-gray-500 dark:text-gray-400">Interface</span>
<span class="block font-mono text-theme-sm text-gray-700 dark:text-gray-300">{{ $guestInterface['name'] }}</span>
</div>
@endif
@if(isset($guestInterface['statistics']))
<div class="space-y-1.5 md:col-span-2">
<span class="text-theme-xs font-medium text-gray-500 dark:text-gray-400">Statistics</span>
<div class="flex flex-wrap gap-4 text-theme-sm text-gray-600 dark:text-gray-400">
@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>