From 27243101e7fc19ebb18dd4206116794c753a0628 Mon Sep 17 00:00:00 2001 From: "Joseph.Rawlings" Date: Sat, 6 Dec 2025 12:40:22 -0500 Subject: [PATCH] Add IP Addresses display for Proxmox server in service view --- app/Livewire/Services/Show.php | 2 +- themes/lucentui/views/services/show.blade.php | 64 +++++++++++++++++++ 2 files changed, 65 insertions(+), 1 deletion(-) diff --git a/app/Livewire/Services/Show.php b/app/Livewire/Services/Show.php index b2439ab0c..85338f06e 100644 --- a/app/Livewire/Services/Show.php +++ b/app/Livewire/Services/Show.php @@ -36,7 +36,7 @@ class Show extends Component public function mount() { // Attach Proxmox server (if any) so we can show hostname on the service page - $this->proxmoxServer = ProxmoxServer::with(['os', 'node'])->where('service_id', $this->service->id)->first(); + $this->proxmoxServer = ProxmoxServer::with(['os', 'node', 'ipAddresses'])->where('service_id', $this->service->id)->first(); // Fetch actual VM status from Proxmox API if server exists if ($this->proxmoxServer) { diff --git a/themes/lucentui/views/services/show.blade.php b/themes/lucentui/views/services/show.blade.php index 90ad91193..5cfe18b17 100644 --- a/themes/lucentui/views/services/show.blade.php +++ b/themes/lucentui/views/services/show.blade.php @@ -216,6 +216,70 @@ @endif + + @if($proxmoxServer && $proxmoxServer->ipAddresses->count() > 0) +
+
+ +

IP Addresses

+
+
+ @foreach($proxmoxServer->ipAddresses as $ipAddress) + @php + // Determine if IP is private (NAT) or public + $ip = $ipAddress->ip; + $isPrivate = false; + + // Check for IPv4 private ranges (RFC 1918) + if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) { + $isPrivate = ( + str_starts_with($ip, '10.') || + str_starts_with($ip, '192.168.') || + preg_match('/^172\.(1[6-9]|2[0-9]|3[0-1])\./', $ip) || + str_starts_with($ip, '100.64.') || // CGNAT + str_starts_with($ip, '169.254.') // Link-local + ); + $ipType = 'IPv4'; + } else { + // IPv6 private ranges + $isPrivate = ( + str_starts_with(strtolower($ip), 'fc') || + str_starts_with(strtolower($ip), 'fd') || + str_starts_with(strtolower($ip), 'fe80') + ); + $ipType = 'IPv6'; + } + + $networkType = $isPrivate ? 'NAT' : 'Public'; + @endphp +
+
+ @if($ipType === 'IPv4') + + @else + + @endif +
+ {{ $ip }} + @if($ipAddress->gateway) + Gateway: {{ $ipAddress->gateway }} + @endif +
+
+
+ + {{ $networkType }} + + + {{ $ipType }} + +
+
+ @endforeach +
+
+ @endif + @if($service->cancellable || $service->upgradable || count($buttons) > 0)