Files
Virtnet.bond/extensions/Servers/Proxmox/views/overview.blade.php

717 lines
48 KiB
PHP

<x-proxmox::layout
:server="$server"
view="overview"
:status="$status"
:status-polling="true"
:status-polling-interval="'2s'"
>
@if(!$status)
{{-- Error state when status cannot be loaded --}}
<x-proxmox::ui.alert variant="danger" icon="ri-error-warning-fill" class="mt-8">
<x-slot name="title">Unable to Load Server Status</x-slot>
<p class="text-gray-600 dark:text-gray-400 mb-3">Could not retrieve status from hypervisor:</p>
<ul class="list-disc list-inside text-gray-600 dark:text-gray-400 mb-3 space-y-1 text-sm">
<li>Temporary connectivity issues with the Proxmox cluster</li>
<li>The VM may be in an intermediate state</li>
<li>Network timeout while fetching data</li>
</ul>
<x-proxmox::ui.button wire:click="loadVmStatus" icon="ri-refresh-line">
Retry
</x-proxmox::ui.button>
</x-proxmox::ui.alert>
@else
@php
// Calculate resource metrics
$cpuCores = max(1, (int)($status->cpus ?? 1));
$cpuUsagePercent = round(max(0, ($status->cpu ?? 0) * 100), 1);
$memoryTotal = (int)($status->maxmem ?? 0);
$memoryUsed = (int)($status->mem ?? 0);
$memoryPercent = $memoryTotal > 0 ? round(($memoryUsed / $memoryTotal) * 100, 1) : 0;
$diskTotal = (int)($status->maxdisk ?? 0);
$diskUsed = (int)($status->disk ?? 0);
$diskPercent = $diskTotal > 0 ? round(($diskUsed / $diskTotal) * 100, 1) : 0;
// Uptime
$reportedUptime = $this->status && isset($this->status->uptime)
? $this->formatSeconds($this->status->uptime)
: 'N/A';
// Power stats
$powerStats = $this->powerEventStats ?? [
'starts' => 0,
'shutdowns' => 0,
'reboots' => 0,
];
// Network
$totalNetIn = (int)($status->netin ?? 0);
$totalNetOut = (int)($status->netout ?? 0);
// Product/Service info
$productSettings = $server->service?->product?->settings ?? collect();
$allocatedCores = $productSettings->where('key', 'cores')->first()?->value ?? $cpuCores;
$allocatedMemoryMiB = $productSettings->where('key', 'memory')->first()?->value ?? 0;
$allocatedDiskGiB = $productSettings->where('key', 'disk')->first()?->value ?? 0;
$allocatedBackups = $productSettings->where('key', 'backups')->first()?->value ?? 0;
$servicePlan = $server->service?->plan;
$serviceExpires = $server->service?->expires_at;
$serviceStatus = $server->service?->status ?? 'unknown';
$productName = $server->service?->product?->name ?? 'Unknown Product';
$locationName = $server->node?->location?->name ?? 'Unknown';
$nodeName = $server->node?->name ?? 'Unknown';
// Badge helper
$badgeForPercent = function (float $value) {
if ($value >= 100) return ['label' => 'Critical', 'class' => 'bg-error/15 text-error'];
if ($value >= 85) return ['label' => 'Warning', 'class' => 'bg-warning/15 text-warning'];
return ['label' => 'Healthy', 'class' => 'bg-success/15 text-success'];
};
$cpuBadge = $badgeForPercent($cpuUsagePercent);
$memoryBadge = $badgeForPercent($memoryPercent);
@endphp
<div class="space-y-6" x-data="{ pageLoaded: false }" x-init="setTimeout(() => pageLoaded = true, 50)" wire:init="checkStatus" wire:poll.{{ $fastPolling ? '2s' : '30s' }}="checkStatus" wire:key="{{ $fastPolling ? 'fast' : 'slow' }}">
<!-- Page Header -->
<div class="flex flex-col gap-2"
:class="pageLoaded ? 'opacity-100 translate-y-0' : 'opacity-0 -translate-y-2'"
style="transition: all 0.4s ease-out;">
<x-proxmox::ui.section-header
title="Server Overview"
icon="ri-server-line"
subtitle="Real-time monitoring dashboard for your virtual machine."
class="mb-0">
<x-slot name="actions">
<x-proxmox::ui.help-modal title="Server Overview" icon="ri-question-line">
<p class="block font-sans text-sm font-normal leading-relaxed text-base/90 mb-4">
The Server Overview provides a comprehensive real-time dashboard of your virtual machine's status, resource utilization, and configuration details.
</p>
<div class="pt-4 mt-4 border-t border-neutral/30 space-y-2.5">
<p class="block font-sans text-xs font-normal leading-relaxed text-base/75">
<span class="font-semibold text-base/90">Resource Metrics:</span> Live CPU, memory, and storage utilization with health indicators.
</p>
<p class="block font-sans text-xs font-normal leading-relaxed text-base/75">
<span class="font-semibold text-base/90">Server Details:</span> Operating system, hostname, IP addresses, and credentials.
</p>
<p class="block font-sans text-xs font-normal leading-relaxed text-base/75">
<span class="font-semibold text-base/90">DNS Configuration:</span> Available hostname resolution options for your server.
</p>
<p class="block font-sans text-xs font-normal leading-relaxed text-base/75">
<span class="font-semibold text-base/90">Infrastructure:</span> Datacenter location, billing cycle, and service information.
</p>
</div>
</x-proxmox::ui.help-modal>
</x-slot>
</x-proxmox::ui.section-header>
</div>
<!-- Resource Metrics Section -->
<section class="bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-800 rounded-2xl p-6 shadow-theme-sm transition-all duration-300 hover:shadow-md"
:class="pageLoaded ? 'opacity-100 translate-y-0' : 'opacity-0 translate-y-4'"
style="transition: all 0.4s ease-out 0.1s;">
<div class="flex items-center gap-2 mb-5">
<x-ri-dashboard-line class="size-5 text-primary" />
<h2 class="text-lg font-semibold text-gray-900 dark:text-white">Resource Metrics</h2>
<span class="ml-auto inline-flex items-center gap-1.5 px-2.5 py-1 text-xs font-medium rounded-full {{ $status && $status->status === 'running' ? 'bg-success/15 text-success' : 'bg-warning/15 text-warning' }}">
@if($status && $status->status === 'running')
<span class="w-1.5 h-1.5 bg-success rounded-full animate-pulse"></span>
Running
@else
<span class="w-1.5 h-1.5 bg-warning rounded-full"></span>
Stopped
@endif
</span>
</div>
<div class="grid grid-cols-1 md:grid-cols-3 gap-5">
<!-- CPU -->
<div class="bg-gray-50 dark:bg-gray-800/50 rounded-xl p-4 border border-gray-100 dark:border-gray-700/50">
<div class="flex items-center justify-between mb-3">
<div class="flex items-center gap-2">
<div class="w-8 h-8 rounded-lg bg-blue-100 dark:bg-blue-900/50 flex items-center justify-center">
<x-ri-cpu-line class="size-4 text-blue-600 dark:text-blue-400" />
</div>
<span class="text-sm font-semibold text-gray-700 dark:text-gray-300">CPU</span>
</div>
<span class="text-xs font-medium px-2 py-0.5 rounded-full {{ $cpuBadge['class'] }}">{{ $cpuBadge['label'] }}</span>
</div>
<div class="text-2xl font-bold text-gray-900 dark:text-white mb-1">{{ $cpuUsagePercent }}%</div>
<p class="text-xs text-gray-500 dark:text-gray-400 mb-3">{{ number_format(($status->cpu ?? 0) * $cpuCores, 2) }} / {{ $cpuCores }} vCPU</p>
<div class="w-full h-2 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden">
<div class="h-full bg-gradient-to-r from-blue-400 to-blue-600 rounded-full transition-all duration-500" style="width: {{ min(100, $cpuUsagePercent) }}%"></div>
</div>
</div>
<!-- Memory -->
<div class="bg-gray-50 dark:bg-gray-800/50 rounded-xl p-4 border border-gray-100 dark:border-gray-700/50">
<div class="flex items-center justify-between mb-3">
<div class="flex items-center gap-2">
<div class="w-8 h-8 rounded-lg bg-green-100 dark:bg-green-900/50 flex items-center justify-center">
<x-ri-database-2-line class="size-4 text-green-600 dark:text-green-400" />
</div>
<span class="text-sm font-semibold text-gray-700 dark:text-gray-300">Memory</span>
</div>
<span class="text-xs font-medium px-2 py-0.5 rounded-full {{ $memoryBadge['class'] }}">{{ $memoryBadge['label'] }}</span>
</div>
<div class="text-2xl font-bold text-gray-900 dark:text-white mb-1">{{ $memoryPercent }}%</div>
<p class="text-xs text-gray-500 dark:text-gray-400 mb-3">{{ \Illuminate\Support\Number::fileSize(bytes: $memoryUsed) }} / {{ \Illuminate\Support\Number::fileSize(bytes: $memoryTotal) }}</p>
<div class="w-full h-2 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden">
<div class="h-full bg-gradient-to-r from-green-400 to-green-600 rounded-full transition-all duration-500" style="width: {{ min(100, $memoryPercent) }}%"></div>
</div>
</div>
<!-- Uptime -->
<div class="bg-gray-50 dark:bg-gray-800/50 rounded-xl p-4 border border-gray-100 dark:border-gray-700/50">
<div class="flex items-center justify-between mb-3">
<div class="flex items-center gap-2">
<div class="w-8 h-8 rounded-lg bg-purple-100 dark:bg-purple-900/50 flex items-center justify-center">
<x-ri-time-line class="size-4 text-purple-600 dark:text-purple-400" />
</div>
<span class="text-sm font-semibold text-gray-700 dark:text-gray-300">Uptime</span>
</div>
<span class="text-xs font-medium px-2 py-0.5 rounded-full bg-blue-100 dark:bg-blue-900/50 text-blue-600 dark:text-blue-400">Live</span>
</div>
<div class="text-2xl font-bold text-gray-900 dark:text-white mb-1">{{ $reportedUptime }}</div>
<p class="text-xs text-gray-500 dark:text-gray-400">{{ $powerStats['starts'] }} starts • {{ $powerStats['shutdowns'] }} shutdowns • {{ $powerStats['reboots'] }} reboots</p>
</div>
</div>
</section>
<!-- Server Details & DNS Grid -->
<div class="grid grid-cols-1 xl:grid-cols-2 gap-6">
<!-- Server Details Section -->
<section class="bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-800 rounded-2xl shadow-theme-sm overflow-hidden transition-all duration-300 hover:shadow-md"
:class="pageLoaded ? 'opacity-100 translate-y-0' : 'opacity-0 translate-y-4'"
style="transition: all 0.4s ease-out 0.2s;">
<div class="flex items-center gap-2 p-5 border-b border-gray-100 dark:border-gray-800">
<x-ri-server-line class="size-5 text-primary" />
<h2 class="text-lg font-semibold text-gray-900 dark:text-white">Server Details</h2>
</div>
<div class="p-5 space-y-3">
<!-- Status -->
<div class="flex items-center justify-between py-2 px-3 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-800/50 transition-colors">
<span class="text-sm text-gray-600 dark:text-gray-400">Status</span>
<span class="inline-flex items-center gap-1.5 px-2.5 py-1 text-xs font-semibold rounded-full {{ $status && $status->status === 'running' ? 'bg-success/15 text-success' : 'bg-warning/15 text-warning' }}">
@if($status && $status->status === 'running')
<span class="w-1.5 h-1.5 bg-success rounded-full animate-pulse"></span>
Running
@else
Stopped
@endif
</span>
</div>
<!-- Operating System -->
<div class="flex items-center justify-between py-2 px-3 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-800/50 transition-colors">
<span class="text-sm text-gray-600 dark:text-gray-400">Operating System</span>
<span class="text-sm font-medium text-gray-900 dark:text-white">{{ $server->os->name }}</span>
</div>
<!-- Hostname -->
<div class="flex items-center justify-between py-2 px-3 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-800/50 transition-colors" x-data="{ showHostnameEditModal: @entangle('isEditingHostname') }">
<span class="text-sm text-gray-600 dark:text-gray-400">Hostname</span>
<div class="flex items-center gap-2">
<code class="text-sm font-mono text-gray-900 dark:text-white">{{ $server->hostname ?? $status->name ?? 'N/A' }}</code>
<button wire:click="startEditingHostname" type="button" class="text-primary opacity-70 hover:opacity-100 transition-opacity">
<x-ri-edit-line class="size-4" />
</button>
</div>
</div>
<!-- Primary IPv4 -->
@if($server->primaryIpv4)
<div class="flex items-center justify-between py-2 px-3 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-800/50 transition-colors" x-data="{ copied: false }">
<span class="text-sm text-gray-600 dark:text-gray-400">IPv4 Address</span>
<div class="flex items-center gap-2">
<code class="text-sm font-mono text-gray-900 dark:text-white">{{ $server->primaryIpv4->ip }}</code>
<button @click="navigator.clipboard.writeText('{{ $server->primaryIpv4->ip }}'); copied = true; setTimeout(() => copied = false, 2000)" type="button" class="text-gray-400 hover:text-success transition-colors">
<x-ri-check-fill x-show="copied" class="size-4 text-success" x-cloak />
<x-ri-file-copy-line x-show="!copied" class="size-4" />
</button>
</div>
</div>
@endif
<!-- Primary IPv6 -->
@if($server->primaryIpv6)
<div class="flex items-center justify-between py-2 px-3 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-800/50 transition-colors" x-data="{ copied: false }">
<span class="text-sm text-gray-600 dark:text-gray-400">IPv6 Address</span>
<div class="flex items-center gap-2">
<code class="text-xs font-mono text-gray-900 dark:text-white truncate max-w-[180px]">{{ $server->primaryIpv6->ip }}</code>
<button @click="navigator.clipboard.writeText('{{ $server->primaryIpv6->ip }}'); copied = true; setTimeout(() => copied = false, 2000)" type="button" class="text-gray-400 hover:text-success transition-colors flex-shrink-0">
<x-ri-check-fill x-show="copied" class="size-4 text-success" x-cloak />
<x-ri-file-copy-line x-show="!copied" class="size-4" />
</button>
</div>
</div>
@endif
<!-- Root Password -->
<div class="flex items-center justify-between py-2 px-3 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-800/50 transition-colors" x-data="{ showPasswordViewModal: false, showPasswordEditModal: @entangle('isEditingPassword') }">
<span class="text-sm text-gray-600 dark:text-gray-400">Root Password</span>
<div class="flex items-center gap-2">
@if(isset($server->password) && $server->password)
<span class="text-sm text-gray-500">••••••••</span>
<button type="button" class="text-gray-400 hover:text-gray-600 transition-colors" @click="showPasswordViewModal = true">
<x-ri-eye-line class="size-4" />
</button>
@else
<span class="text-xs font-medium px-2 py-0.5 rounded-full bg-info/15 text-info">Emailed</span>
@endif
<button type="button" class="text-primary opacity-70 hover:opacity-100 transition-opacity" wire:click="startEditingPassword">
<x-ri-edit-line class="size-4" />
</button>
</div>
</div>
</div>
<!-- Reinstall Footer -->
<div class="flex items-center justify-between bg-error/5 border-t border-error/20 px-5 py-3">
<div>
<span class="text-sm font-semibold text-error">Reinstall Server</span>
<p class="text-xs text-error/70">Data permanently deleted. Irreversible.</p>
</div>
<livewire:proxmox.reinstall :server="$server" />
</div>
</section>
<!-- DNS Configuration Section -->
<section class="bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-800 rounded-2xl shadow-theme-sm overflow-hidden transition-all duration-300 hover:shadow-md"
:class="pageLoaded ? 'opacity-100 translate-y-0' : 'opacity-0 translate-y-4'"
style="transition: all 0.4s ease-out 0.25s;">
<div class="flex items-center gap-2 p-5 border-b border-gray-100 dark:border-gray-800">
<x-ri-global-line class="size-5 text-primary" />
<h2 class="text-lg font-semibold text-gray-900 dark:text-white">DNS Configuration</h2>
<x-proxmox::ui.help-modal title="DNS Configuration" icon="ri-question-line" class="ml-auto">
<p class="block font-sans text-sm font-normal leading-relaxed text-base/90 mb-4">
DNS hostnames that automatically resolve to your server's IP address. These work without any configuration.
</p>
<div class="pt-4 mt-4 border-t border-neutral/30">
<p class="block font-sans text-xs font-normal leading-relaxed text-base/75">
<span class="font-semibold text-base/90">Note:</span> DNS is configured via cloud-init. For Windows or manual configuration, configure DNS directly within the guest OS.
</p>
</div>
</x-proxmox::ui.help-modal>
</div>
<div class="p-5 space-y-3">
@if($server->primaryIpv6)
@php
$ipv6Dashed = str_replace(':', '-', $server->primaryIpv6->ip);
$dnsProviders = [
['name' => 'Virtnet Internal', 'domain' => $ipv6Dashed . '.virtnet.host', 'badge' => 'Internal'],
['name' => 'nip.io', 'domain' => $ipv6Dashed . '.nip.io', 'badge' => 'Public'],
['name' => 'sslip.io', 'domain' => $ipv6Dashed . '.sslip.io', 'badge' => 'Public'],
['name' => 'backname.io', 'domain' => $ipv6Dashed . '.backname.io', 'badge' => 'Public'],
];
@endphp
@foreach($dnsProviders as $provider)
<div class="flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800/50 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors" x-data="{ copied: false }">
<div class="min-w-0 flex-1">
<div class="flex items-center gap-2 mb-1">
<span class="text-xs font-semibold text-gray-600 dark:text-gray-400">{{ $provider['name'] }}</span>
<span class="text-xs px-1.5 py-0.5 rounded bg-gray-200 dark:bg-gray-700 text-gray-600 dark:text-gray-400">{{ $provider['badge'] }}</span>
</div>
<code class="text-sm text-gray-900 dark:text-white font-mono break-all">{{ $provider['domain'] }}</code>
</div>
<button @click="navigator.clipboard.writeText('{{ $provider['domain'] }}'); copied = true; setTimeout(() => copied = false, 2000)" type="button" class="text-gray-400 hover:text-success transition-colors ml-3 flex-shrink-0">
<x-ri-check-fill x-show="copied" class="size-4 text-success" x-cloak />
<x-ri-file-copy-line x-show="!copied" class="size-4" />
</button>
</div>
@endforeach
@else
<div class="text-center py-8">
<x-ri-global-line class="size-10 text-gray-300 dark:text-gray-600 mx-auto mb-3" />
<p class="text-sm text-gray-500 dark:text-gray-400">No IPv6 address assigned</p>
</div>
@endif
</div>
<div class="bg-gray-50 dark:bg-gray-800/50 border-t border-gray-100 dark:border-gray-800 px-5 py-3">
<p class="text-xs text-gray-500 dark:text-gray-400">
<x-ri-information-line class="inline size-3.5 mr-1" />
<code class="font-mono">@</code> = root domain • <code class="font-mono">*.@</code> = wildcard subdomains
</p>
</div>
</section>
</div>
<!-- Notes & Windows Sections Grid -->
<div class="grid grid-cols-1 {{ stripos($server->os->name, 'Windows') !== false ? 'xl:grid-cols-2' : '' }} gap-6">
<!-- Notes Section -->
<section class="bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-800 rounded-2xl shadow-theme-sm overflow-hidden transition-all duration-300 hover:shadow-md"
:class="pageLoaded ? 'opacity-100 translate-y-0' : 'opacity-0 translate-y-4'"
style="transition: all 0.4s ease-out 0.3s;"
x-data="{ showExportErrorModal: false }">
<div class="flex items-center gap-2 p-5 border-b border-gray-100 dark:border-gray-800">
<x-ri-file-text-line class="size-5 text-primary" />
<h2 class="text-lg font-semibold text-gray-900 dark:text-white">Notes</h2>
<span class="text-xs text-gray-500 dark:text-gray-400">(Markdown supported)</span>
<div class="ml-auto flex items-center gap-2">
<button type="button" @click="exportNotesToCSV()"
class="text-xs text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 transition-colors flex items-center gap-1">
<x-ri-download-line class="size-3.5" />
Export
</button>
</div>
</div>
<div class="p-5">
@if($isEditingNotes)
<div class="space-y-4">
<textarea wire:model.live.debounce.500ms="notes"
class="w-full min-h-[150px] bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg px-4 py-3 text-sm font-mono focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary transition-colors resize-y"
placeholder="Enter notes with Markdown support..."></textarea>
@if($notesError)
<p class="text-xs text-error flex items-center gap-1">
<x-ri-alert-line class="size-3.5" />
{{ $notesError }}
</p>
@endif
<div class="flex gap-2">
<button wire:click="saveNotes" wire:loading.attr="disabled" class="px-4 py-2 bg-primary hover:bg-primary/90 disabled:opacity-50 text-white text-sm font-medium rounded-lg transition-colors">
<span wire:loading.remove wire:target="saveNotes">Save Notes</span>
<span wire:loading wire:target="saveNotes">Saving...</span>
</button>
<button wire:click="cancelEditingNotes" class="px-4 py-2 bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 text-sm font-medium rounded-lg transition-colors">Cancel</button>
</div>
</div>
@else
<div class="space-y-4">
<div class="bg-gray-50 dark:bg-gray-800/50 border border-gray-100 dark:border-gray-700/50 rounded-lg px-4 py-3 min-h-[100px] prose prose-sm dark:prose-invert max-w-none">
@if($notes)
{!! \Illuminate\Support\Str::markdown(e($notes), ['allow_unsafe_links' => false, 'renderer' => ['soft_break' => "<br>"]]) !!}
@else
<p class="text-gray-400 dark:text-gray-500 italic">No notes yet. Click Edit to add some.</p>
@endif
</div>
<button wire:click="startEditingNotes" class="px-4 py-2 bg-primary hover:bg-primary/90 text-white text-sm font-medium rounded-lg transition-colors inline-flex items-center gap-2">
<x-ri-edit-line class="size-4" />
Edit Notes
</button>
</div>
@endif
</div>
<!-- Export Error Modal -->
<div x-show="showExportErrorModal" x-cloak
x-transition:enter="transition ease-out duration-200"
x-transition:enter-start="opacity-0"
x-transition:enter-end="opacity-100"
@click="showExportErrorModal = false"
class="fixed inset-0 z-[60] bg-black/50 backdrop-blur-sm">
</div>
<div x-show="showExportErrorModal" x-cloak @click.away="showExportErrorModal = false"
x-transition:enter="transition ease-out duration-200"
x-transition:enter-start="opacity-0 scale-95"
x-transition:enter-end="opacity-100 scale-100"
class="fixed inset-0 z-[60] flex items-center justify-center p-4">
<div class="relative w-full max-w-sm bg-white dark:bg-gray-900 rounded-xl border border-gray-200 dark:border-gray-800 shadow-2xl p-6">
<button @click="showExportErrorModal = false" class="absolute top-4 right-4 text-gray-400 hover:text-gray-600 transition-colors">
<x-ri-close-line class="size-5" />
</button>
<div class="flex items-center gap-3 mb-4">
<div class="w-10 h-10 rounded-lg bg-error/10 flex items-center justify-center">
<x-ri-alert-line class="size-5 text-error" />
</div>
<h3 class="text-base font-semibold text-gray-900 dark:text-white">Export Error</h3>
</div>
<p class="text-sm text-gray-600 dark:text-gray-400 mb-5">No notes available to export. Add some notes first.</p>
<button @click="showExportErrorModal = false" class="w-full px-4 py-2 bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 text-sm font-medium rounded-lg transition-colors">Close</button>
</div>
</div>
</section>
<!-- Windows Notice (conditional) -->
@if(stripos($server->os->name, 'Windows') !== false)
<section class="bg-white dark:bg-gray-900 border border-warning/30 rounded-2xl shadow-theme-sm overflow-hidden transition-all duration-300 hover:shadow-md"
:class="pageLoaded ? 'opacity-100 translate-y-0' : 'opacity-0 translate-y-4'"
style="transition: all 0.4s ease-out 0.3s;">
<div class="flex items-center gap-2 p-5 border-b border-warning/20 bg-warning/5">
<x-ri-windows-line class="size-5 text-warning" />
<h2 class="text-lg font-semibold text-gray-900 dark:text-white">Windows Configuration</h2>
</div>
<div class="p-5 space-y-4">
<p class="text-sm text-gray-600 dark:text-gray-400">
Windows doesn't support cloud-init for automated configuration. You'll need to manually configure networking, hostname, and system settings.
</p>
<div class="space-y-3">
<div class="flex items-start gap-3 p-3 rounded-lg border border-info/20 bg-info/5">
<x-ri-settings-3-line class="size-4 text-info flex-shrink-0 mt-0.5" />
<div>
<p class="text-xs font-semibold text-gray-900 dark:text-white">Network Setup</p>
<p class="text-xs text-gray-500 dark:text-gray-400 mt-0.5">Configure IP addresses manually in Windows Network Settings.</p>
</div>
</div>
<div class="flex items-start gap-3 p-3 rounded-lg border border-warning/20 bg-warning/5">
<x-ri-key-line class="size-4 text-warning flex-shrink-0 mt-0.5" />
<div>
<p class="text-xs font-semibold text-gray-900 dark:text-white">Licensing</p>
<p class="text-xs text-gray-500 dark:text-gray-400 mt-0.5">You must maintain valid Windows licensing.</p>
</div>
</div>
<div class="flex items-start gap-3 p-3 rounded-lg border border-error/20 bg-error/5">
<x-ri-shield-check-line class="size-4 text-error flex-shrink-0 mt-0.5" />
<div>
<p class="text-xs font-semibold text-gray-900 dark:text-white">Compliance</p>
<p class="text-xs text-gray-500 dark:text-gray-400 mt-0.5">Non-compliant installations may be suspended.</p>
</div>
</div>
</div>
</div>
</section>
@endif
</div>
<!-- Infrastructure & Billing Section -->
<section class="bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-800 rounded-2xl shadow-theme-sm overflow-hidden transition-all duration-300 hover:shadow-md"
:class="pageLoaded ? 'opacity-100 translate-y-0' : 'opacity-0 translate-y-4'"
style="transition: all 0.4s ease-out 0.35s;">
<div class="flex items-center gap-2 p-5 border-b border-gray-100 dark:border-gray-800">
<x-ri-information-line class="size-5 text-primary" />
<h2 class="text-lg font-semibold text-gray-900 dark:text-white">Server Information</h2>
</div>
<div class="p-5">
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-5">
<!-- Specifications -->
<div class="bg-gray-50 dark:bg-gray-800/50 rounded-xl p-4 border border-gray-100 dark:border-gray-700/50">
<div class="flex items-center gap-2 mb-4">
<div class="w-8 h-8 rounded-lg bg-blue-100 dark:bg-blue-900/50 flex items-center justify-center">
<x-ri-cpu-line class="size-4 text-blue-600 dark:text-blue-400" />
</div>
<h3 class="text-sm font-semibold text-gray-700 dark:text-gray-300">Specifications</h3>
</div>
<div class="space-y-2 text-sm">
<div class="flex justify-between">
<span class="text-gray-500 dark:text-gray-400">vCPU Cores</span>
<span class="font-medium text-gray-900 dark:text-white">{{ $allocatedCores }} cores</span>
</div>
<div class="flex justify-between">
<span class="text-gray-500 dark:text-gray-400">Memory</span>
<span class="font-medium text-gray-900 dark:text-white">
@if($allocatedMemoryMiB > 0)
{{ number_format($allocatedMemoryMiB / 1024, 1) }} GiB
@else
{{ \Illuminate\Support\Number::fileSize(bytes: $memoryTotal) }}
@endif
</span>
</div>
<div class="flex justify-between">
<span class="text-gray-500 dark:text-gray-400">Storage</span>
<span class="font-medium text-gray-900 dark:text-white">
@if($allocatedDiskGiB > 0)
{{ $allocatedDiskGiB }} GiB
@elseif($diskTotal > 0)
{{ number_format($diskTotal / 1024 / 1024 / 1024, 0) }} GiB
@else
N/A
@endif
</span>
</div>
<div class="flex justify-between">
<span class="text-gray-500 dark:text-gray-400">Backups</span>
<span class="font-medium text-gray-900 dark:text-white">{{ $allocatedBackups > 0 ? $allocatedBackups . ' slots' : 'Disabled' }}</span>
</div>
</div>
</div>
<!-- Network -->
<div class="bg-gray-50 dark:bg-gray-800/50 rounded-xl p-4 border border-gray-100 dark:border-gray-700/50">
<div class="flex items-center gap-2 mb-4">
<div class="w-8 h-8 rounded-lg bg-green-100 dark:bg-green-900/50 flex items-center justify-center">
<x-ri-global-line class="size-4 text-green-600 dark:text-green-400" />
</div>
<h3 class="text-sm font-semibold text-gray-700 dark:text-gray-300">Network Transfer</h3>
</div>
<div class="space-y-2 text-sm">
<div class="flex justify-between">
<span class="text-gray-500 dark:text-gray-400">Inbound</span>
<span class="font-medium text-gray-900 dark:text-white">{{ \Illuminate\Support\Number::fileSize(bytes: $totalNetIn) }}</span>
</div>
<div class="flex justify-between">
<span class="text-gray-500 dark:text-gray-400">Outbound</span>
<span class="font-medium text-gray-900 dark:text-white">{{ \Illuminate\Support\Number::fileSize(bytes: $totalNetOut) }}</span>
</div>
<div class="flex justify-between pt-2 border-t border-gray-200 dark:border-gray-700">
<span class="text-gray-500 dark:text-gray-400">Total</span>
<span class="font-semibold text-gray-900 dark:text-white">{{ \Illuminate\Support\Number::fileSize(bytes: $totalNetIn + $totalNetOut) }}</span>
</div>
</div>
</div>
<!-- Billing -->
<div class="bg-gray-50 dark:bg-gray-800/50 rounded-xl p-4 border border-gray-100 dark:border-gray-700/50">
<div class="flex items-center gap-2 mb-4">
<div class="w-8 h-8 rounded-lg bg-purple-100 dark:bg-purple-900/50 flex items-center justify-center">
<x-ri-calendar-line class="size-4 text-purple-600 dark:text-purple-400" />
</div>
<h3 class="text-sm font-semibold text-gray-700 dark:text-gray-300">Billing</h3>
</div>
<div class="space-y-2 text-sm">
<div class="flex justify-between">
<span class="text-gray-500 dark:text-gray-400">Product</span>
<span class="font-medium text-gray-900 dark:text-white truncate max-w-[120px]">{{ $productName }}</span>
</div>
<div class="flex justify-between">
<span class="text-gray-500 dark:text-gray-400">Status</span>
<span class="font-medium {{ $serviceStatus === 'active' ? 'text-success' : 'text-warning' }}">{{ ucfirst($serviceStatus) }}</span>
</div>
<div class="flex justify-between">
<span class="text-gray-500 dark:text-gray-400">Renewal</span>
<span class="font-medium text-gray-900 dark:text-white">{{ $serviceExpires ? $serviceExpires->format('M d, Y') : 'N/A' }}</span>
</div>
</div>
</div>
<!-- Infrastructure -->
<div class="bg-gray-50 dark:bg-gray-800/50 rounded-xl p-4 border border-gray-100 dark:border-gray-700/50">
<div class="flex items-center gap-2 mb-4">
<div class="w-8 h-8 rounded-lg bg-amber-100 dark:bg-amber-900/50 flex items-center justify-center">
<x-ri-building-line class="size-4 text-amber-600 dark:text-amber-400" />
</div>
<h3 class="text-sm font-semibold text-gray-700 dark:text-gray-300">Infrastructure</h3>
</div>
<div class="space-y-2 text-sm">
<div class="flex justify-between">
<span class="text-gray-500 dark:text-gray-400">Datacenter</span>
<span class="font-medium text-gray-900 dark:text-white">{{ $locationName }}</span>
</div>
<div class="flex justify-between">
<span class="text-gray-500 dark:text-gray-400">Node</span>
<span class="font-medium text-gray-900 dark:text-white">{{ $nodeName }}</span>
</div>
<div class="flex justify-between">
<span class="text-gray-500 dark:text-gray-400">VM ID</span>
<span class="font-medium font-mono text-gray-900 dark:text-white">{{ $server->vm_id ?? 'N/A' }}</span>
</div>
</div>
</div>
<!-- Identifiers -->
<div class="bg-gray-50 dark:bg-gray-800/50 rounded-xl p-4 border border-gray-100 dark:border-gray-700/50">
<div class="flex items-center gap-2 mb-4">
<div class="w-8 h-8 rounded-lg bg-cyan-100 dark:bg-cyan-900/50 flex items-center justify-center">
<x-ri-fingerprint-line class="size-4 text-cyan-600 dark:text-cyan-400" />
</div>
<h3 class="text-sm font-semibold text-gray-700 dark:text-gray-300">Identifiers</h3>
</div>
<div class="space-y-2 text-sm">
<div class="flex justify-between">
<span class="text-gray-500 dark:text-gray-400">Server ID</span>
<span class="font-medium font-mono text-gray-900 dark:text-white">{{ $server->id }}</span>
</div>
<div class="flex justify-between">
<span class="text-gray-500 dark:text-gray-400">Service ID</span>
<span class="font-medium font-mono text-gray-900 dark:text-white">{{ $server->service_id ?? 'N/A' }}</span>
</div>
<div class="flex justify-between">
<span class="text-gray-500 dark:text-gray-400">Created</span>
<span class="font-medium text-gray-900 dark:text-white">{{ $server->created_at?->format('M d, Y') ?? 'N/A' }}</span>
</div>
</div>
</div>
<!-- Current Usage -->
<div class="bg-gray-50 dark:bg-gray-800/50 rounded-xl p-4 border border-gray-100 dark:border-gray-700/50">
<div class="flex items-center gap-2 mb-4">
<div class="w-8 h-8 rounded-lg bg-rose-100 dark:bg-rose-900/50 flex items-center justify-center">
<x-ri-line-chart-line class="size-4 text-rose-600 dark:text-rose-400" />
</div>
<h3 class="text-sm font-semibold text-gray-700 dark:text-gray-300">Live Usage</h3>
</div>
<div class="space-y-2.5 text-sm">
<div class="flex justify-between items-center">
<span class="text-gray-500 dark:text-gray-400">CPU</span>
<div class="flex items-center gap-2">
<div class="w-16 h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden">
<div class="h-full bg-blue-500 rounded-full" style="width: {{ min(100, $cpuUsagePercent) }}%"></div>
</div>
<span class="font-medium text-gray-900 dark:text-white text-xs w-10 text-right">{{ $cpuUsagePercent }}%</span>
</div>
</div>
<div class="flex justify-between items-center">
<span class="text-gray-500 dark:text-gray-400">Memory</span>
<div class="flex items-center gap-2">
<div class="w-16 h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden">
<div class="h-full bg-green-500 rounded-full" style="width: {{ min(100, $memoryPercent) }}%"></div>
</div>
<span class="font-medium text-gray-900 dark:text-white text-xs w-10 text-right">{{ $memoryPercent }}%</span>
</div>
</div>
@if($diskTotal > 0)
<div class="flex justify-between items-center">
<span class="text-gray-500 dark:text-gray-400">Disk</span>
<div class="flex items-center gap-2">
<div class="w-16 h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden">
<div class="h-full bg-purple-500 rounded-full" style="width: {{ min(100, $diskPercent) }}%"></div>
</div>
<span class="font-medium text-gray-900 dark:text-white text-xs w-10 text-right">{{ $diskPercent }}%</span>
</div>
</div>
@endif
</div>
</div>
</div>
</div>
</section>
</div>
@once
<script>
window.downloadText = function(textContent, filename) {
const blob = new Blob([textContent], { type: 'text/plain;charset=utf-8;' });
const link = document.createElement('a');
const url = URL.createObjectURL(blob);
link.setAttribute('href', url);
link.setAttribute('download', filename);
link.style.visibility = 'hidden';
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
};
window.exportNotesToCSV = function() {
let notesText = '';
const livewireComponent = Livewire.find(document.querySelector('[wire\\:id]')?.getAttribute('wire:id'));
if (livewireComponent && livewireComponent.get('notes')) {
notesText = livewireComponent.get('notes') || '';
} else {
const notesTextarea = document.querySelector('[wire\\:model="notes"]');
if (notesTextarea && notesTextarea.tagName === 'TEXTAREA') {
notesText = notesTextarea.value || '';
} else {
const notesElement = document.querySelector('.prose');
if (notesElement) {
notesText = notesElement.innerText || notesElement.textContent || '';
}
}
}
if (!notesText || notesText.trim() === '' || notesText.includes('No notes')) {
const notesSection = document.querySelector('[x-data*="showExportErrorModal"]');
if (notesSection && notesSection._x_dataStack && notesSection._x_dataStack[0]) {
notesSection._x_dataStack[0].showExportErrorModal = true;
}
return;
}
const filename = 'notes-' + new Date().toISOString().split('T')[0] + '.txt';
window.downloadText(notesText, filename);
};
</script>
@endonce
@endif
</x-proxmox::layout>