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

1285 lines
84 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
<script>
function copyToClipboard(text, buttonEl) {
navigator.clipboard.writeText(text).then(() => {
// Change button style & text
const originalText = buttonEl.innerText;
buttonEl.innerText = "Copied!";
buttonEl.classList.remove("bg-blue-600", "hover:bg-blue-700");
buttonEl.classList.add("bg-green-600", "hover:bg-green-700");
// Revert after 2s
setTimeout(() => {
buttonEl.innerText = originalText;
buttonEl.classList.remove("bg-green-600", "hover:bg-green-700");
buttonEl.classList.add("bg-blue-600", "hover:bg-blue-700");
}, 2000);
}).catch(err => {
console.error("Failed to copy: ", err);
});
}
</script>
<div class="lte-callout lte-callout-info lte-fade-in"
x-data="{
isCollapsed: localStorage.getItem('overview-notice-collapsed') === 'true',
isAdvancedView: localStorage.getItem('proxmox-view-mode') === 'advanced',
toggle() {
this.isCollapsed = !this.isCollapsed;
localStorage.setItem('overview-notice-collapsed', this.isCollapsed);
}
}"
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
style="margin-bottom: 1.5rem;">
<div style="display: flex; align-items: flex-start; gap: 0.75rem;">
<x-ri-information-line class="size-5 lte-text-info" style="flex-shrink: 0; margin-top: 0.125rem;" />
<div style="flex: 1; min-width: 0;">
<div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem;">
<h5 style="font-size: 1.1rem; font-weight: 600; margin: 0;">Cloud-init Configuration</h5>
<button @click="toggle()" type="button" class="lte-btn lte-btn-sm lte-btn-outline-secondary" style="padding: 0.25rem 0.5rem;">
<x-ri-arrow-down-s-line class="size-4" x-bind:class="isCollapsed ? 'rotate-180' : ''" />
</button>
</div>
<div x-show="!isCollapsed" x-transition>
<p style="font-size: 0.875rem; margin-bottom: 0.75rem;">
<strong>Hostname, password, and networking</strong> are configured via <strong>cloud-init</strong>. Manual configuration required for:
</p>
<ul style="font-size: 0.875rem; margin-left: 1.5rem; margin-bottom: 0.75rem; list-style: disc;">
<li>ISO installations</li>
<li>Manual OS configuration</li>
<li>Windows systems (no cloud-init support)</li>
</ul>
<p style="font-size: 0.875rem; margin: 0;">
You will need to <strong>manually configure networking, security settings, and hostname</strong> within the operating system in these scenarios.
</p>
</div>
</div>
</div>
</div>
<div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem;" wire:poll.{{ $fastPolling ? '2s' : '30s' }}="checkStatus"
wire:key="{{ $fastPolling ? 'fast' : 'slow' }}">
<div style="display: flex; align-items: center; gap: 0.75rem;">
<div style="display: flex; align-items: center; justify-content: center; width: 2.5rem; height: 2.5rem; border-radius: 0.5rem;" class="lte-bg-primary" style="background: linear-gradient(135deg, var(--lte-primary), var(--lte-info));">
<x-ri-server-line class="size-5" style="color: white;" />
</div>
<div>
<h2 style="font-size: 1.5rem; font-weight: 700; margin: 0;">Server Overview</h2>
<p class="lte-text-muted" style="font-size: 0.875rem; margin: 0;">Real-time resource monitoring and server details</p>
</div>
</div>
<div class="relative" x-data="{ open: false }" x-cloak>
<button type="button" @click="open = true" class="lte-btn lte-btn-sm lte-btn-outline-secondary">
<x-ri-question-line class="size-4" />
<span>Help</span>
</button>
<!-- Modal Backdrop -->
<div x-show="open"
x-transition:enter="transition ease-out duration-200"
x-transition:enter-start="opacity-0"
x-transition:enter-end="opacity-100"
x-transition:leave="transition ease-in duration-150"
x-transition:leave-start="opacity-100"
x-transition:leave-end="opacity-0"
@click="open = false"
@keydown.escape.window="open = false"
class="fixed inset-0 z-[60] bg-gray-900 bg-opacity-50"
style="display: none;">
</div>
<!-- Modal -->
<div x-show="open"
x-transition:enter="transition ease-out duration-200"
x-transition:enter-start="opacity-0 scale-95"
x-transition:enter-end="opacity-100 scale-100"
x-transition:leave="transition ease-in duration-150"
x-transition:leave-start="opacity-100 scale-100"
x-transition:leave-end="opacity-0 scale-95"
@click.away="open = false"
class="fixed inset-0 z-[60] flex items-center justify-center p-4"
style="display: none;">
<div class="relative w-full max-w-xl max-h-[90vh] overflow-y-auto bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 shadow-xl p-5">
<button @click="open = false" class="absolute top-3 right-3 text-gray-400 hover:text-gray-600 dark:text-gray-500">
<x-ri-close-line class="size-5" />
</button>
<div class="flex items-center gap-2 mb-3 pr-6">
<div class="flex items-center justify-center w-8 h-8 rounded bg-blue-100 dark:bg-blue-900">
<x-ri-server-line class="size-4 text-blue-600 dark:text-blue-400" />
</div>
<h6 class="text-base font-semibold text-gray-800 dark:text-gray-100">Server Details</h6>
</div>
<p class="text-sm text-gray-700 dark:text-gray-300 mb-3">
VM information: status, resources, network config.
</p>
<div class="pt-3 border-t border-gray-200 dark:border-gray-700 space-y-1.5 text-xs text-gray-600 dark:text-gray-400">
<p><span class="font-semibold text-gray-700 dark:text-gray-300">Status:</span> Power state with real-time updates.</p>
<p><span class="font-semibold text-gray-700 dark:text-gray-300">Resources:</span> CPU, memory, disk, network stats.</p>
<p><span class="font-semibold text-gray-700 dark:text-gray-300">Network:</span> IP addresses and interface info.</p>
</div>
</div>
</div>
</div>
</div>
</div>
<style>
/* TailAdmin Progress Bar Styles */
progress {
border-radius: 8px;
background-color: #f1f5f9;
border: none;
width: 100%;
overflow: hidden;
height: 8px;
}
.dark progress {
background-color: #334155;
}
progress[value]::-webkit-progress-bar {
background-color: #f1f5f9;
border-radius: 8px;
}
.dark progress[value]::-webkit-progress-bar {
background-color: #334155;
}
progress[value]#memory::-webkit-progress-value {
background: linear-gradient(90deg, #22c55e 0%, #10b981 100%);
border-radius: 8px;
}
progress[value]#memory::-moz-progress-bar {
background: linear-gradient(90deg, #22c55e 0%, #10b981 100%);
border-radius: 8px;
}
progress[value]#cpu::-webkit-progress-value {
background: linear-gradient(90deg, #465fff 0%, #818cf8 100%);
border-radius: 8px;
}
progress[value]#cpu::-moz-progress-bar {
background: linear-gradient(90deg, #465fff 0%, #818cf8 100%);
border-radius: 8px;
}
.formRight select {
background-color: white;
border: 1px solid #e2e8f0;
border-radius: 8px;
padding: 0.625rem 1rem;
font-size: 0.875rem;
line-height: 1.25rem;
outline: none;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
transition: all 0.15s ease;
}
.dark .formRight select {
background-color: #1e293b;
border-color: #334155;
}
.formRight select:focus {
outline: none;
border-color: #465fff;
box-shadow: 0 0 0 3px rgba(70, 95, 255, 0.1);
}
</style>
</div>
@php
$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;
$manualSnapshotLimit = 5;
$manualSnapshotUsed = $server->statistics()->where('is_automatic', false)->count();
$manualSnapshotPercent = $manualSnapshotLimit > 0
? round(($manualSnapshotUsed / $manualSnapshotLimit) * 100, 1)
: 0;
$badgeForPercent = function (float $value) {
if ($value >= 100) {
return ['label' => 'Over entitlement', 'class' => 'text-red-600 bg-red-100 dark:text-red-400 dark:bg-red-900'];
}
if ($value >= 85) {
return ['label' => 'Watchlist', 'class' => 'text-amber-600 bg-amber-100 dark:text-amber-400 dark:bg-amber-900'];
}
return ['label' => 'Healthy', 'class' => 'text-emerald-600 bg-emerald-100 dark:text-emerald-400 dark:bg-emerald-900'];
};
$cpuBadge = $badgeForPercent($cpuUsagePercent);
$memoryBadge = $badgeForPercent($memoryPercent);
$reportedUptime = $this->status && isset($this->status->uptime)
? $this->formatSeconds($this->status->uptime)
: 'N/A';
$powerStats = $this->powerEventStats ?? [
'starts' => 0,
'shutdowns' => 0,
'reboots' => 0,
'uptime_percent' => 0,
'samples' => 0,
];
$resourceAllocations = [
[
'label' => 'CPU Allocation',
'used_percent' => $cpuUsagePercent,
'usage_summary' => number_format(($status->cpu ?? 0) * $cpuCores, 2) . ' / ' . $cpuCores . ' vCPU',
'entitlement_label' => $cpuCores . ' vCPU entitlement',
'description' => 'Live hypervisor usage sampled directly from the cluster.',
'gradient' => 'linear-gradient(90deg, #38bdf8 0%, #6366f1 100%)',
'badge' => $cpuBadge,
],
[
'label' => 'Memory Allocation',
'used_percent' => $memoryPercent,
'usage_summary' => ($memoryTotal > 0
? \Illuminate\Support\Number::fileSize(bytes: $memoryUsed) . ' / ' . \Illuminate\Support\Number::fileSize(bytes: $memoryTotal)
: \Illuminate\Support\Number::fileSize(bytes: $memoryUsed) . ' / N/A'),
'entitlement_label' => $memoryTotal > 0
? \Illuminate\Support\Number::fileSize(bytes: $memoryTotal) . ' entitlement'
: 'Entitlement unavailable',
'description' => 'Calculated from the VPS\'s provisioned RAM.',
'gradient' => 'linear-gradient(90deg, #34d399 0%, #10b981 100%)',
'badge' => $memoryBadge,
],
[
'label' => 'Hypervisor Uptime',
'used_percent' => null,
'usage_summary' => $reportedUptime,
'entitlement_label' => ($powerStats['starts'] ?? 0) . ' starts • ' . ($powerStats['shutdowns'] ?? 0) . ' shutdowns • ' . ($powerStats['reboots'] ?? 0) . ' reboots',
'description' => 'Shows the live uptime reported by the hypervisor plus counts from the task history.',
'gradient' => 'linear-gradient(90deg, #a855f7 0%, #ec4899 100%)',
'badge' => ['label' => 'Live', 'class' => 'text-blue-600 bg-blue-100 dark:text-blue-400 dark:bg-blue-900'],
],
];
$networkRates = $this->networkRateStats ?? ['in_rate' => 0, 'out_rate' => 0];
$formatRate = function ($bytesPerSecond) {
if ($bytesPerSecond >= 1073741824) {
return number_format($bytesPerSecond / 1073741824, 2) . ' GiB/s';
}
if ($bytesPerSecond >= 1048576) {
return number_format($bytesPerSecond / 1048576, 2) . ' MiB/s';
}
if ($bytesPerSecond >= 1024) {
return number_format($bytesPerSecond / 1024, 2) . ' KiB/s';
}
return number_format($bytesPerSecond, 0) . ' B/s';
};
$rateScale = 5 * 1024 * 1024; // 5 MiB/s caps the bar width
$aggregateRate = ($networkRates['in_rate'] ?? 0) + ($networkRates['out_rate'] ?? 0);
$totalNetworkBytes = (int) (($status->netin ?? 0) + ($status->netout ?? 0));
$totalNetworkFormatted = number_format($totalNetworkBytes / 1024 / 1024, 2);
$lastSampleTimestamp = now()->toIso8601String();
@endphp
<!-- Resource Stats Grid -->
<div style="display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; margin-bottom: 1.5rem;">
@foreach($resourceAllocations as $resource)
<div class="lte-card" style="margin-bottom: 0;">
<div class="lte-card-body" style="padding: 1.25rem;">
<div style="display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 0.75rem;">
<div>
<h6 style="font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; margin: 0 0 0.5rem 0;" class="lte-text-muted">{{ $resource['label'] }}</h6>
<div style="font-size: 1.5rem; font-weight: 700; line-height: 1;">{{ $resource['usage_summary'] }}</div>
</div>
@if(isset($resource['badge']))
<span class="lte-badge lte-badge-{{ $resource['badge']['label'] === 'Healthy' ? 'success' : ($resource['badge']['label'] === 'Watchlist' ? 'warning' : 'danger') }}" style="font-size: 0.65rem;">
{{ $resource['badge']['label'] }}
</span>
@endif
</div>
@if($resource['used_percent'] !== null)
<div class="lte-progress" style="height: 6px; margin-bottom: 0.5rem;">
<div class="lte-progress-bar" style="width: {{ min(100, $resource['used_percent']) }}%; background: {{ $resource['gradient'] }};" role="progressbar"></div>
</div>
<div style="font-size: 0.75rem;" class="lte-text-muted">{{ number_format($resource['used_percent'], 1) }}% of {{ $resource['entitlement_label'] }}</div>
@else
<div style="font-size: 0.75rem; margin-top: 0.5rem;" class="lte-text-muted">{{ $resource['entitlement_label'] }}</div>
@endif
</div>
</div>
@endforeach
</div>
<!-- Main Grid Layout -->
<div style="display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem;">
<!-- Server Information Card -->
<div class="lte-card lte-card-outline-primary">
<div class="lte-card-header" style="background: linear-gradient(135deg, var(--lte-primary), var(--lte-info)); color: white; padding: 1rem 1.25rem;">
<div class="lte-card-title" style="display: flex; align-items: center; gap: 0.75rem; margin: 0; font-weight: 600;">
<x-ri-server-fill class="size-5" />
<span>Server Information</span>
</div>
</div>
<div class="lte-card-body" style="padding: 0;">
<div style="background-image: url('https://billing.virtnet.bond/assets/images/main.png'); background-size: cover; height: 100px; border-bottom: 1px solid rgba(0,0,0,0.1);"></div>
<div style="padding: 1.25rem;">
<!-- Status -->
<div style="display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 0; border-bottom: 1px solid rgba(0,0,0,0.05);">
<div style="display: flex; align-items: center; gap: 0.5rem;">
<x-ri-pulse-line class="size-4 lte-text-muted" />
<span style="font-size: 0.875rem; font-weight: 600;" class="lte-text-muted">Status</span>
</div>
<div style="display: flex; align-items: center; gap: 0.5rem;">
@if ($status && $status->status === 'running')
<span class="lte-badge lte-badge-success" style="display: flex; align-items: center; gap: 0.375rem; padding: 0.375rem 0.75rem;">
<span style="width: 6px; height: 6px; background: currentColor; border-radius: 50%; animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;"></span>
Running
</span>
@else
<span class="lte-badge lte-badge-warning" style="display: flex; align-items: center; gap: 0.375rem; padding: 0.375rem 0.75rem;">
<x-ri-stop-circle-line class="size-3" />
Stopped
</span>
@endif
</div>
</div>
<!-- Operating System -->
<div style="display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 0; border-bottom: 1px solid rgba(0,0,0,0.05);">
<div style="display: flex; align-items: center; gap: 0.5rem;">
<x-ri-ubuntu-line class="size-4 lte-text-muted" />
<span style="font-size: 0.875rem; font-weight: 600;" class="lte-text-muted">Operating System</span>
</div>
<span style="font-size: 0.875rem; font-weight: 500;">{{ $server->os->name }}</span>
</div>
<!-- Hostname -->
<div style="display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 0; border-bottom: 1px solid rgba(0,0,0,0.05);" x-data="{ showHostnameEditModal: @entangle('isEditingHostname') }">
<div style="display: flex; align-items: center; gap: 0.5rem;">
<x-ri-computer-line class="size-4 lte-text-muted" />
<span style="font-size: 0.875rem; font-weight: 600;" class="lte-text-muted">Hostname</span>
</div>
<div style="display: flex; align-items: center; gap: 0.5rem;">
<code style="font-size: 0.875rem; background: rgba(0,0,0,0.05); padding: 0.25rem 0.5rem; border-radius: 0.25rem; font-family: 'Courier New', monospace;">{{ $server->hostname ?? $status->name ?? 'N/A' }}</code>
<button wire:click="startEditingHostname" type="button" class="lte-btn lte-btn-xs lte-btn-outline-secondary">
<x-ri-edit-fill class="size-3" />
</button>
</div>
<!-- Hostname Edit Modal (unchanged for brevity) -->
<div x-cloak x-show="showHostnameEditModal"
x-transition:enter="transition ease-out duration-200"
x-transition:enter-start="opacity-0"
x-transition:enter-end="opacity-100"
x-transition:leave="transition ease-in duration-150"
x-transition:leave-start="opacity-100"
x-transition:leave-end="opacity-0"
@click="showHostnameEditModal = false; $wire.cancelEditingHostname()"
@keydown.escape.window="showHostnameEditModal = false; $wire.cancelEditingHostname()"
class="fixed inset-0 z-[60] bg-gray-900 bg-opacity-50"
style="display: none;">
</div>
<div x-cloak x-show="showHostnameEditModal"
x-transition:enter="transition ease-out duration-200"
x-transition:enter-start="opacity-0 scale-95"
x-transition:enter-end="opacity-100 scale-100"
x-transition:leave="transition ease-in duration-150"
x-transition:leave-start="opacity-100 scale-100"
x-transition:leave-end="opacity-0 scale-95"
@click.away="showHostnameEditModal = false; $wire.cancelEditingHostname()"
class="fixed inset-0 z-[60] flex items-center justify-center p-4"
style="display: none;">
<div class="lte-card" style="width: 100%; max-width: 500px; margin: 0;">
<div class="lte-card-header lte-bg-primary" style="color: white;">
<div style="display: flex; align-items: center; justify-content: space-between;">
<h5 class="lte-card-title" style="margin: 0; color: white;">Edit Hostname</h5>
<button type="button" class="lte-btn lte-btn-sm" style="background: rgba(255,255,255,0.2); border: none; color: white;"
@click="showHostnameEditModal = false; $wire.cancelEditingHostname()">
<x-ri-close-line class="size-4" />
</button>
</div>
</div>
<div class="lte-card-body">
<div style="margin-bottom: 1rem;">
<label style="font-size: 0.875rem; font-weight: 600; display: block; margin-bottom: 0.5rem;">Hostname</label>
<input type="text" wire:model.defer="hostname" class="lte-form-control" placeholder="Enter hostname" />
</div>
@if($hostnameError)
<div class="lte-alert lte-alert-danger" style="font-size: 0.875rem;">{{ $hostnameError }}</div>
@endif
<div class="lte-callout lte-callout-info" style="font-size: 0.875rem; padding: 0.75rem;">
<strong>Save:</strong> Database only. <strong>Save & Apply:</strong> + cloud-init on next boot.
</div>
</div>
<div class="lte-card-footer" style="display: flex; justify-content: flex-end; gap: 0.5rem;">
<button type="button" @click="showHostnameEditModal = false; $wire.cancelEditingHostname()" class="lte-btn lte-btn-secondary">
Cancel
</button>
<button type="button" wire:click="updateHostname" class="lte-btn lte-btn-primary">
Save
</button>
<button type="button" wire:click="applyHostname" class="lte-btn lte-btn-success">
<x-ri-check-line class="size-4" />
Save & Apply
</button>
</div>
</div>
</div>
</div>
<!-- Primary IPv4 Address -->
@if($server->primaryIpv4)
<div style="display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 0; border-bottom: 1px solid rgba(0,0,0,0.05);" x-data="{ copied: false, copyText: '{{ $server->primaryIpv4->ip }}', copy() { navigator.clipboard.writeText(this.copyText); this.copied = true; setTimeout(() => this.copied = false, 2000); } }">
<div style="display: flex; align-items: center; gap: 0.5rem;">
<x-ri-global-line class="size-4 lte-text-muted" />
<span style="font-size: 0.875rem; font-weight: 600;" class="lte-text-muted">IPv4 Address</span>
</div>
<div style="display: flex; align-items: center; gap: 0.5rem;">
<code style="font-size: 0.875rem; background: rgba(0,0,0,0.05); padding: 0.25rem 0.5rem; border-radius: 0.25rem; font-family: 'Courier New', monospace;">{{ $server->primaryIpv4->ip }}</code>
<button @click="copy()" type="button" class="lte-btn lte-btn-xs lte-btn-outline-secondary">
<x-ri-check-fill x-show="copied" class="size-3 lte-text-success" />
<x-ri-file-copy-fill x-show="!copied" class="size-3" />
</button>
</div>
</div>
@endif
<!-- Primary IPv6 Address -->
@if($server->primaryIpv6)
<div style="display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 0; border-bottom: 1px solid rgba(0,0,0,0.05);" x-data="{ copied: false, copyText: '{{ $server->primaryIpv6->ip }}', copy() { navigator.clipboard.writeText(this.copyText); this.copied = true; setTimeout(() => this.copied = false, 2000); } }">
<div style="display: flex; align-items: center; gap: 0.5rem;">
<x-ri-global-line class="size-4 lte-text-muted" />
<span style="font-size: 0.875rem; font-weight: 600;" class="lte-text-muted">IPv6 Address</span>
</div>
<div style="display: flex; align-items: center; gap: 0.5rem;">
<code style="font-size: 0.75rem; background: rgba(0,0,0,0.05); padding: 0.25rem 0.5rem; border-radius: 0.25rem; font-family: 'Courier New', monospace; max-width: 200px; overflow: hidden; text-overflow: ellipsis;">{{ $server->primaryIpv6->ip }}</code>
<button @click="copy()" type="button" class="lte-btn lte-btn-xs lte-btn-outline-secondary">
<x-ri-check-fill x-show="copied" class="size-3 lte-text-success" />
<x-ri-file-copy-fill x-show="!copied" class="size-3" />
</button>
</div>
</div>
@endif
<!-- Root Password -->
<div style="display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 0;" x-data="{ showPasswordViewModal: false, showPasswordEditModal: @entangle('isEditingPassword') }">
<div style="display: flex; align-items: center; gap: 0.5rem;">
<x-ri-lock-password-line class="size-4 lte-text-muted" />
<span style="font-size: 0.875rem; font-weight: 600;" class="lte-text-muted">Root Password</span>
</div>
<div style="display: flex; align-items: center; gap: 0.5rem;">
<span style="font-size: 0.875rem;">
@if(isset($server->password) && $server->password)
••••••••
@else
<span class="lte-badge lte-badge-info">Emailed</span>
@endif
</span>
@if(isset($server->password) && $server->password)
<button type="button" class="lte-btn lte-btn-xs lte-btn-outline-secondary" @click="showPasswordViewModal = true">
<x-ri-eye-line class="size-3" />
</button>
@endif
<button type="button" class="lte-btn lte-btn-xs lte-btn-outline-primary" wire:click="startEditingPassword">
<x-ri-edit-fill class="size-3" />
</button>
</div>
<!-- Password View Modal -->
<div x-cloak x-show="showPasswordViewModal"
x-transition:enter="transition ease-out duration-200"
x-transition:enter-start="opacity-0"
x-transition:enter-end="opacity-100"
x-transition:leave="transition ease-in duration-150"
x-transition:leave-start="opacity-100"
x-transition:leave-end="opacity-0"
@click="showPasswordViewModal = false"
@keydown.escape.window="showPasswordViewModal = false"
class="fixed inset-0 z-[60] bg-gray-900 bg-opacity-50"
style="display: none;">
</div>
<div x-cloak x-show="showPasswordViewModal"
x-transition:enter="transition ease-out duration-200"
x-transition:enter-start="opacity-0 scale-95"
x-transition:enter-end="opacity-100 scale-100"
x-transition:leave="transition ease-in duration-150"
x-transition:leave-start="opacity-100 scale-100"
x-transition:leave-end="opacity-0 scale-95"
@click.away="showPasswordViewModal = false"
class="fixed inset-0 z-[60] flex items-center justify-center p-4"
style="display: none;"
x-data="{
copied: false,
copyText: {{ json_encode($server->password) }},
copy() { navigator.clipboard.writeText(this.copyText); this.copied = true; setTimeout(() => this.copied = false, 2000); }
}">
<div class="lte-card" style="width: 100%; max-width: 500px; margin: 0;">
<div class="lte-card-header lte-bg-primary" style="color: white;">
<div style="display: flex; align-items: center; justify-content: space-between;">
<h5 class="lte-card-title" style="margin: 0; color: white;">Root Password</h5>
<button type="button" class="lte-btn lte-btn-sm" style="background: rgba(255,255,255,0.2); border: none; color: white;" @click="showPasswordViewModal = false">
<x-ri-close-line class="size-4" />
</button>
</div>
</div>
<div class="lte-card-body">
<div style="background: rgba(0,0,0,0.05); border: 1px solid rgba(0,0,0,0.1); border-radius: 0.375rem; padding: 1rem;">
<code style="display: block; font-family: 'Courier New', monospace; font-size: 0.875rem; word-break: break-all;">{{ $server->password }}</code>
</div>
</div>
<div class="lte-card-footer" style="display: flex; justify-content: flex-end;">
<button type="button" class="lte-btn lte-btn-success" @click="copy()">
<x-ri-file-copy-line class="size-4" />
<span x-show="!copied">Copy Password</span>
<span x-show="copied">Copied!</span>
</button>
</div>
</div>
</div>
<!-- Password Edit Modal (keeping structure but styling with AdminLTE) -->
<div x-cloak x-show="showPasswordEditModal"
x-transition:enter="transition ease-out duration-200"
x-transition:enter-start="opacity-0"
x-transition:enter-end="opacity-100"
x-transition:leave="transition ease-in duration-150"
x-transition:leave-start="opacity-100"
x-transition:leave-end="opacity-0"
@click="showPasswordEditModal = false; $wire.cancelEditingPassword()"
@keydown.escape.window="showPasswordEditModal = false; $wire.cancelEditingPassword()"
class="fixed inset-0 z-[60] bg-gray-900 bg-opacity-50"
style="display: none;">
</div>
<div x-cloak x-show="showPasswordEditModal"
x-transition:enter="transition ease-out duration-200"
x-transition:enter-start="opacity-0 scale-95"
x-transition:enter-end="opacity-100 scale-100"
x-transition:leave="transition ease-in duration-150"
x-transition:leave-start="opacity-100 scale-100"
x-transition:leave-end="opacity-0 scale-95"
@click.away="showPasswordEditModal = false; $wire.cancelEditingPassword()"
class="fixed inset-0 z-[60] flex items-center justify-center p-4"
style="display: none;">
<div class="lte-card" style="width: 100%; max-width: 500px; margin: 0;">
<div class="lte-card-header lte-bg-primary" style="color: white;">
<div style="display: flex; align-items: center; justify-content: space-between;">
<h5 class="lte-card-title" style="margin: 0; color: white;">Edit Root Password</h5>
<button type="button" class="lte-btn lte-btn-sm" style="background: rgba(255,255,255,0.2); border: none; color: white;"
@click="showPasswordEditModal = false; $wire.cancelEditingPassword()">
<x-ri-close-line class="size-4" />
</button>
</div>
</div>
<div class="lte-card-body">
<div style="margin-bottom: 1rem;">
<label style="font-size: 0.875rem; font-weight: 600; display: block; margin-bottom: 0.5rem;">New Password</label>
<input type="password" wire:model.defer="password" class="lte-form-control" placeholder="Enter new password" />
</div>
<div style="margin-bottom: 1rem;">
<label style="font-size: 0.875rem; font-weight: 600; display: block; margin-bottom: 0.5rem;">Confirm Password</label>
<input type="password" wire:model.defer="password_confirmation" class="lte-form-control" placeholder="Confirm password" />
</div>
@if($passwordError)
<div class="lte-alert lte-alert-danger" style="font-size: 0.875rem; margin-bottom: 1rem;">{{ $passwordError }}</div>
@endif
<div class="lte-callout lte-callout-info" style="font-size: 0.875rem; padding: 0.75rem;">
<strong>Save:</strong> Database only. <strong>Save & Apply:</strong> + cloud-init (reboot required).
</div>
</div>
<div class="lte-card-footer" style="display: flex; justify-content: flex-end; gap: 0.5rem;">
<button type="button" @click="showPasswordEditModal = false; $wire.cancelEditingPassword()" class="lte-btn lte-btn-secondary">
Cancel
</button>
<button type="button" wire:click="updatePassword" class="lte-btn lte-btn-primary">
Save
</button>
<button type="button" wire:click="applyPassword" class="lte-btn lte-btn-success">
<x-ri-check-line class="size-4" />
Save & Apply
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<x-proxmox::ui.button type="button" @click="showPasswordEditModal = false; $wire.cancelEditingPassword()" variant="secondary">
Cancel
</x-proxmox::ui.button>
<x-proxmox::ui.button type="button" wire:click="updatePassword" variant="primary">
Save
</x-proxmox::ui.button>
<x-proxmox::ui.button type="button" wire:click="applyPassword" variant="primary">
Save & Apply
</x-proxmox::ui.button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="flex items-center justify-between bg-red-50 dark:bg-red-950 border-t border-x border-red-200 dark:border-red-800 px-3 py-2 rounded-b-lg">
<div>
<span class="text-sm font-semibold text-red-700 dark:text-red-300">Reinstall Server</span>
<p class="text-xs text-red-600 dark:text-red-400">Data permanently deleted. Irreversible.</p>
</div>
<livewire:proxmox.reinstall :server="$server" />
</div>
</div>
</div>
<div>
<div style="background-image: url('https://billing.virtnet.bond/assets/images/dns.jpeg'); background-size: cover; background-position: center; height: 3rem;" class="rounded-t-lg border-t border-x border-gray-200 dark:border-gray-700"></div>
<div class="bg-white dark:bg-gray-800 border-x border-gray-200 dark:border-gray-700 p-3 space-y-3">
<div class="flex items-center gap-2 min-w-0">
<h2 class="text-base font-semibold">DNS</h2>
<div class="relative" x-data="{ open: false }" x-cloak>
<button type="button" @click="open = true" class="text-gray-400 hover:text-gray-600 dark:hover:text-gray-300">
<x-ri-question-line class="size-4" />
</button>
<div x-show="open" @click="open = false" @keydown.escape.window="open = false"
class="fixed inset-0 z-[60] bg-gray-900 bg-opacity-50" style="display: none;"></div>
<div x-show="open" @click.away="open = false"
class="fixed inset-0 z-[60] flex items-center justify-center p-4" style="display: none;">
<div class="relative w-full max-w-xl max-h-[90vh] overflow-y-auto bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 shadow-xl p-4">
<button @click="open = false" class="absolute top-3 right-3 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300">
<x-ri-close-line class="size-4" />
</button>
<div class="flex items-center gap-2 mb-3 pr-6">
<div class="flex items-center justify-center w-8 h-8 rounded bg-blue-50 dark:bg-blue-900">
<x-ri-global-line class="size-4 text-primary" />
</div>
<h6 class="text-base font-semibold">Domain Name System (DNS)</h6>
</div>
<p class="text-sm text-gray-700 dark:text-gray-300 mb-3">
DNS info for your VM. Displays hostname and DNS configuration for the guest OS.
</p>
<div class="pt-3 border-t border-gray-200 dark:border-gray-700">
<p class="text-xs text-gray-600 dark:text-gray-400">
<strong>Note:</strong> DNS configured via cloud-init. For Windows/manual, configure within guest OS.
</p>
</div>
</div>
</div>
</div>
</div>
<div class="text-sm text-gray-600 dark:text-gray-400">
<p class="font-medium">IPv6 DNS: {{ $server->primaryIpv6->ip }}</p>
<!-- Virtnet -->
<div class="flex items-center gap-1 ml-4 text-xs">
<span>{{ str_replace(':', '-', $server->primaryIpv6->ip) . '.virtnet.host' }} <small class="text-gray-500">(Internal)</small></span>
<div x-data="{
copied: false,
copyText: '{{ str_replace(':', '-', $server->primaryIpv6->ip) . '.virtnet.host' }}',
copyToClipboard() { navigator.clipboard.writeText(this.copyText); this.copied = true; setTimeout(() => this.copied = false, 2000); }
}">
<button @click="copyToClipboard()" type="button" class="text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 relative inline-flex items-center justify-center">
<span x-show="copied" x-transition class="absolute"><x-ri-check-fill class="size-3 text-success" /></span>
<span x-show="!copied" x-transition class="absolute"><x-ri-file-copy-fill class="size-3" /></span>
</button>
</div>
</div>
<!-- nip.io -->
<div class="flex items-center gap-1 ml-4 text-xs">
<span>{{ str_replace(':', '-', $server->primaryIpv6->ip) . '.nip.io' }} <small class="text-gray-500">(<a href="https://nip.io" target="_blank" class="underline">nip.io</a>)</small></span>
<div x-data="{
copied: false,
copyText: '{{ str_replace(':', '-', $server->primaryIpv6->ip) . '.nip.io' }}',
copyToClipboard() { navigator.clipboard.writeText(this.copyText); this.copied = true; setTimeout(() => this.copied = false, 2000); }
}">
<button @click="copyToClipboard()" type="button" class="text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 relative inline-flex items-center justify-center">
<span x-show="copied" x-transition class="absolute"><x-ri-check-fill class="size-3 text-success" /></span>
<span x-show="!copied" x-transition class="absolute"><x-ri-file-copy-fill class="size-3" /></span>
</button>
</div>
</div>
<!-- sslip.io -->
<div class="flex items-center gap-1 ml-4 text-xs">
<span>{{ str_replace(':', '-', $server->primaryIpv6->ip) . '.sslip.io' }} <small class="text-gray-500">(<a href="https://sslip.io" target="_blank" class="underline">sslip.io</a>)</small></span>
<div x-data="{
copied: false,
copyText: '{{ str_replace(':', '-', $server->primaryIpv6->ip) . '.sslip.io' }}',
copyToClipboard() { navigator.clipboard.writeText(this.copyText); this.copied = true; setTimeout(() => this.copied = false, 2000); }
}">
<button @click="copyToClipboard()" type="button" class="text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 relative inline-flex items-center justify-center">
<span x-show="copied" x-transition class="absolute"><x-ri-check-fill class="size-3 text-success" /></span>
<span x-show="!copied" x-transition class="absolute"><x-ri-file-copy-fill class="size-3" /></span>
</button>
</div>
</div>
<!-- backname.io -->
<div class="flex items-center gap-1 ml-4 text-xs">
<span>{{ str_replace(':', '-', $server->primaryIpv6->ip) . '.backname.io' }} <small class="text-gray-500">(<a href="https://backname.io" target="_blank" class="underline">backname.io</a>)</small></span>
<div x-data="{
copied: false,
copyText: '{{ str_replace(':', '-', $server->primaryIpv6->ip) . '.backname.io' }}',
copyToClipboard() { navigator.clipboard.writeText(this.copyText); this.copied = true; setTimeout(() => this.copied = false, 2000); }
}">
<button @click="copyToClipboard()" type="button" class="text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 relative inline-flex items-center justify-center">
<span x-show="copied" x-transition class="absolute"><x-ri-check-fill class="size-3 text-success" /></span>
<span x-show="!copied" x-transition class="absolute"><x-ri-file-copy-fill class="size-3" /></span>
</button>
</div>
</div>
</div>
</div>
<div class="bg-blue-50 dark:bg-blue-950 border border-blue-200 dark:border-blue-800 p-3 rounded-b-lg text-xs text-gray-600 dark:text-gray-400">
<p class="font-semibold"><code>@</code> = root domain → {{ $server->primaryIpv6->ip }} | <code>*.@</code> = wildcard subdomains → same IP</p>
<p class="mt-1 text-gray-500 dark:text-gray-500">rDNS PTR: No PTR records via RIR systems except direct contract customers.</p>
</div>
</div>
@if(stripos($server->os->name, 'Windows') !== false)
<div>
<div style="background-image: url('https://billing.virtnet.bond/assets/images/windows.jpg'); background-size: cover; background-position: center; height: 3rem;" class="rounded-t-lg border-t border-x border-gray-200 dark:border-gray-700"></div>
<div class="bg-blue-50 dark:bg-blue-950 border border-blue-200 dark:border-blue-800 p-3 rounded-b-lg">
<div class="flex items-center gap-2">
<h2 class="text-base font-semibold">Windows Server</h2>
<div class="relative" x-data="{ open: false }" x-cloak>
<button type="button" @click="open = true" class="text-gray-400 hover:text-gray-600 dark:hover:text-gray-300">
<x-ri-question-line class="size-4" />
</button>
<div x-show="open" @click="open = false" @keydown.escape.window="open = false"
class="fixed inset-0 z-[60] bg-gray-900 bg-opacity-50 backdrop-blur-sm" style="display: none;"></div>
<div x-show="open" @click.away="open = false"
class="fixed inset-0 z-[60] flex items-center justify-center p-4" style="display: none;">
<div class="relative w-full max-w-xl max-h-[90vh] overflow-y-auto bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 shadow-xl p-4">
<button @click="open = false" class="absolute top-3 right-3 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300">
<x-ri-close-line class="size-4" />
</button>
<div class="flex items-center gap-2 mb-3 pr-6">
<div class="flex items-center justify-center w-8 h-8 rounded bg-blue-50 dark:bg-blue-900">
<x-ri-windows-line class="size-4 text-primary" />
</div>
<h6 class="text-base font-semibold">Windows Server</h6>
</div>
<p class="text-sm text-gray-700 dark:text-gray-300 mb-3">Windows doesn't support cloud-init. Manual config required.</p>
<div class="pt-3 border-t border-gray-200 dark:border-gray-700 space-y-2 text-xs text-gray-600 dark:text-gray-400">
<p><strong>Manual Config:</strong> Configure networking, hostname, and users during/after install.</p>
<p><strong>Network:</strong> Use static IPs or DHCP via Windows Network Configuration.</p>
<p><strong>Remote Access:</strong> Enable RDP within Windows for remote server access.</p>
</div>
</div>
</div>
</div>
</div>
<div class="mt-2 space-y-2 text-xs">
<div class="border-l-4 border-blue-400 bg-blue-100 dark:bg-blue-900 p-2 rounded-r">
<p class="font-semibold text-gray-700 dark:text-gray-200">IPv4/IPv6 Setup:</p>
<p class="text-gray-600 dark:text-gray-400">Cloud-init doesn't configure networking on Windows. Configure addresses manually.</p>
</div>
<div class="border-l-4 border-blue-400 bg-blue-100 dark:bg-blue-900 p-2 rounded-r">
<p class="font-semibold text-gray-700 dark:text-gray-200">Licensing:</p>
<p class="text-gray-600 dark:text-gray-400">No license key provided. User must maintain compliant licensing.</p>
</div>
<div class="border-l-4 border-blue-400 bg-blue-100 dark:bg-blue-900 p-2 rounded-r">
<p class="font-semibold text-gray-700 dark:text-gray-200">Audits:</p>
<p class="text-gray-600 dark:text-gray-400">Periodic audits may occur. Non-compliant installations subject to suspension.</p>
</div>
</div>
</div>
@endif
</div>
<!-- Notes Section -->
<div class="mt-4">
<div id="notes-section" class="bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-4 flex flex-col" x-data="{ showExportErrorModal: false }" x-cloak>
<div class="flex items-center justify-between mb-3">
<div class="flex items-center gap-2">
<h2 class="text-base font-semibold">Notes</h2>
<div class="relative" x-data="{ open: false }" x-cloak>
<button type="button" @click="open = true" class="text-gray-400 hover:text-gray-600 dark:hover:text-gray-300">
<x-ri-question-line class="size-4" />
</button>
<div x-show="open" @click="open = false" @keydown.escape.window="open = false"
class="fixed inset-0 z-[60] bg-gray-900 bg-opacity-50 backdrop-blur-sm" style="display: none;"></div>
<div x-show="open" @click.away="open = false" @keydown.escape.window="open = false"
class="fixed inset-0 z-[60] flex items-center justify-center p-4" style="display: none;">
<div class="relative w-full max-w-xl max-h-[90vh] overflow-y-auto bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 shadow-xl p-4">
<button @click="open = false" class="absolute top-3 right-3 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300">
<x-ri-close-line class="size-4" />
</button>
<div class="flex items-center gap-2 mb-3 pr-6">
<div class="flex items-center justify-center w-8 h-8 rounded bg-blue-50 dark:bg-blue-900">
<x-ri-file-text-line class="size-4 text-primary" />
</div>
<h6 class="text-base font-semibold">Notes</h6>
</div>
<p class="text-sm text-gray-700 dark:text-gray-300 mb-3">Store notes about this VM with Markdown support.</p>
<div class="pt-3 border-t border-gray-200 dark:border-gray-700 space-y-2 text-xs text-gray-600 dark:text-gray-400">
<p><strong>Markdown:</strong> Headers, lists, links, code blocks supported.</p>
<p><strong>Persistence:</strong> Notes saved to DB but deleted on reinstall.</p>
<p><strong>Uses:</strong> Config docs, IPs, credentials, install steps.</p>
</div>
</div>
</div>
</div>
<span class="text-xs text-gray-500 dark:text-gray-400">(Markdown • Cleared on reinstall)</span>
</div>
<div class="flex items-center gap-2">
<button type="button" @click="exportNotesToCSV()"
class="bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 px-2 py-1 rounded text-xs font-semibold hover:bg-gray-100 dark:hover:bg-gray-800 flex items-center gap-1"
title="Export notes">
<x-ri-download-line class="size-3" />
Export
</button>
</div>
</div>
<!-- Export Error Modal -->
<div x-show="showExportErrorModal"
x-transition:enter="transition ease-out duration-300"
x-transition:enter-start="opacity-0"
x-transition:enter-end="opacity-100"
x-transition:leave="transition ease-in duration-200"
x-transition:leave-start="opacity-100"
x-transition:leave-end="opacity-0"
@click="showExportErrorModal = false"
@keydown.escape.window="showExportErrorModal = false"
class="fixed inset-0 z-[60] bg-gray-900 bg-opacity-50 backdrop-blur-sm"
style="display: none;">
</div>
<div x-show="showExportErrorModal" @click.away="showExportErrorModal = false"
class="fixed inset-0 z-[60] flex items-center justify-center p-4" style="display: none;">
<div class="relative w-full max-w-sm bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 shadow-xl p-4">
<button @click="showExportErrorModal = false" class="absolute top-3 right-3 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300">
<x-ri-close-line class="size-4" />
</button>
<div class="flex items-center gap-2 mb-3 pr-6">
<div class="flex items-center justify-center w-8 h-8 rounded bg-red-50 dark:bg-red-900">
<x-ri-error-warning-line class="size-4 text-error" />
</div>
<h6 class="text-base font-semibold">Export Error</h6>
</div>
<p class="text-sm text-gray-700 dark:text-gray-300 mb-3">No notes available to export.</p>
<div class="flex justify-end">
<x-proxmox::ui.button type="button" @click="showExportErrorModal = false" variant="secondary">Close</x-proxmox::ui.button>
</div>
</div>
</div>
<div class="flex flex-col gap-2 flex-1">
@if($isEditingNotes)
<div class="space-y-2 flex-1 flex flex-col">
<textarea wire:model="notes"
class="bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded px-2 py-1 text-sm w-full resize-y flex-1 focus:outline-none focus:ring-2 focus:ring-secondary"
placeholder="Enter notes..."></textarea>
@if($notesError)
<div class="text-xs text-error">{{ $notesError }}</div>
@endif
<div class="flex gap-2">
<x-proxmox::ui.button wire:click="saveNotes" wire:loading.attr="disabled" variant="primary">
<span wire:loading.remove wire:target="saveNotes">Save</span>
<span wire:loading wire:target="saveNotes">Saving...</span>
</x-proxmox::ui.button>
<x-proxmox::ui.button wire:click="cancelEditingNotes" wire:loading.attr="disabled" variant="secondary">Cancel</x-proxmox::ui.button>
</div>
</div>
@else
<div class="space-y-2 flex-1 flex flex-col">
<div class="bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded px-2 py-1 text-sm flex-1 overflow-auto prose prose-sm dark:prose-invert max-w-none text-gray-700 dark:text-gray-300">
@if($notes)
{!! \Illuminate\Support\Str::markdown(e($notes), [
'allow_unsafe_links' => false,
'renderer' => ['soft_break' => "<br>"]
]) !!}
@else
<p class="text-gray-500 dark:text-gray-400">No notes. Click Edit to add.</p>
@endif
</div>
<div class="flex gap-2">
<x-proxmox::ui.button wire:click="startEditingNotes" variant="secondary" icon="ri-edit-fill">
Edit
</x-proxmox::ui.button>
</div>
</div>
@endif
</div>
</div>
</div>
<!-- Server Information Section -->
@php
// Gather comprehensive server information
$diskTotal = (int)($status->maxdisk ?? 0);
$diskUsed = (int)($status->disk ?? 0);
$diskPercent = $diskTotal > 0 ? round(($diskUsed / $diskTotal) * 100, 1) : 0;
// Get product settings for allocated resources
$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;
// Network totals
$totalNetIn = (int)($status->netin ?? 0);
$totalNetOut = (int)($status->netout ?? 0);
// Service/billing info
$servicePlan = $server->service?->plan;
$serviceExpires = $server->service?->expires_at;
$serviceStatus = $server->service?->status ?? 'unknown';
$productName = $server->service?->product?->name ?? 'Unknown Product';
// Location info
$locationName = $server->node?->location?->name ?? 'Unknown';
$nodeName = $server->node?->name ?? 'Unknown';
@endphp
<div class="mt-4">
<div class="bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-4">
<div class="flex items-center justify-between mb-4">
<div class="flex items-center gap-2">
<h2 class="text-base font-semibold">Server Information</h2>
<x-proxmox::ui.help-modal title="Server Information">
<p class="text-sm text-gray-700 dark:text-gray-300 mb-3">
Comprehensive details about your virtual machine including specifications, billing, and infrastructure information.
</p>
<div class="pt-3 border-t border-gray-200 dark:border-gray-700 space-y-1.5 text-xs text-gray-600 dark:text-gray-400">
<p><span class="font-semibold text-gray-700 dark:text-gray-300">Specifications:</span> Allocated CPU, RAM, and storage resources.</p>
<p><span class="font-semibold text-gray-700 dark:text-gray-300">Network:</span> Total bandwidth consumed since VM creation.</p>
<p><span class="font-semibold text-gray-700 dark:text-gray-300">Billing:</span> Service plan and renewal information.</p>
<p><span class="font-semibold text-gray-700 dark:text-gray-300">Infrastructure:</span> Datacenter location and node assignment.</p>
</div>
</x-proxmox::ui.help-modal>
</div>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
<!-- Specifications Card -->
<div class="bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg p-3">
<div class="flex items-center gap-2 mb-3">
<div class="flex items-center justify-center w-7 h-7 rounded bg-blue-100 dark:bg-blue-900">
<x-ri-cpu-line class="size-4 text-blue-600 dark:text-blue-400" />
</div>
<h3 class="text-sm font-semibold text-gray-800 dark:text-gray-200">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-800 dark:text-gray-200">{{ $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-800 dark:text-gray-200">
@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-800 dark:text-gray-200">
@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">Backup Slots</span>
<span class="font-medium text-gray-800 dark:text-gray-200">{{ $allocatedBackups > 0 ? $allocatedBackups : 'Disabled' }}</span>
</div>
<div class="flex justify-between">
<span class="text-gray-500 dark:text-gray-400">Operating System</span>
<span class="font-medium text-gray-800 dark:text-gray-200">{{ $server->os->name ?? 'Unknown' }}</span>
</div>
</div>
</div>
<!-- Network Statistics Card -->
<div class="bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg p-3">
<div class="flex items-center gap-2 mb-3">
<div class="flex items-center justify-center w-7 h-7 rounded bg-green-100 dark:bg-green-900">
<x-ri-global-line class="size-4 text-green-600 dark:text-green-400" />
</div>
<h3 class="text-sm font-semibold text-gray-800 dark:text-gray-200">Network Statistics</h3>
</div>
<div class="space-y-2 text-sm">
<div class="flex justify-between">
<span class="text-gray-500 dark:text-gray-400">Primary IPv4</span>
<span class="font-medium font-mono text-gray-800 dark:text-gray-200">{{ $server->primaryIpv4?->address ?? 'Not assigned' }}</span>
</div>
<div class="flex justify-between">
<span class="text-gray-500 dark:text-gray-400">Primary IPv6</span>
<span class="font-medium font-mono text-gray-800 dark:text-gray-200 text-xs">{{ $server->primaryIpv6?->address ? \Illuminate\Support\Str::limit($server->primaryIpv6->address, 20) : 'Not assigned' }}</span>
</div>
<div class="flex justify-between">
<span class="text-gray-500 dark:text-gray-400">Total Inbound</span>
<span class="font-medium text-gray-800 dark:text-gray-200">{{ \Illuminate\Support\Number::fileSize(bytes: $totalNetIn) }}</span>
</div>
<div class="flex justify-between">
<span class="text-gray-500 dark:text-gray-400">Total Outbound</span>
<span class="font-medium text-gray-800 dark:text-gray-200">{{ \Illuminate\Support\Number::fileSize(bytes: $totalNetOut) }}</span>
</div>
<div class="flex justify-between">
<span class="text-gray-500 dark:text-gray-400">Combined Transfer</span>
<span class="font-medium text-gray-800 dark:text-gray-200">{{ \Illuminate\Support\Number::fileSize(bytes: $totalNetIn + $totalNetOut) }}</span>
</div>
</div>
</div>
<!-- Billing & Service Card -->
<div class="bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg p-3">
<div class="flex items-center gap-2 mb-3">
<div class="flex items-center justify-center w-7 h-7 rounded bg-purple-100 dark:bg-purple-900">
<x-ri-calendar-line class="size-4 text-purple-600 dark:text-purple-400" />
</div>
<h3 class="text-sm font-semibold text-gray-800 dark:text-gray-200">Billing & Service</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-800 dark:text-gray-200">{{ \Illuminate\Support\Str::limit($productName, 20) }}</span>
</div>
<div class="flex justify-between">
<span class="text-gray-500 dark:text-gray-400">Billing Cycle</span>
<span class="font-medium text-gray-800 dark:text-gray-200">{{ ucfirst($servicePlan?->billing_period ?? 'N/A') }}</span>
</div>
<div class="flex justify-between">
<span class="text-gray-500 dark:text-gray-400">Service Status</span>
<span class="font-medium {{ $serviceStatus === 'active' ? 'text-green-600 dark:text-green-400' : 'text-amber-600 dark:text-amber-400' }}">
{{ ucfirst($serviceStatus) }}
</span>
</div>
<div class="flex justify-between">
<span class="text-gray-500 dark:text-gray-400">Next Renewal</span>
<span class="font-medium text-gray-800 dark:text-gray-200">
{{ $serviceExpires ? $serviceExpires->format('M d, Y') : 'N/A' }}
</span>
</div>
@if($serviceExpires)
<div class="flex justify-between">
<span class="text-gray-500 dark:text-gray-400">Days Until Renewal</span>
<span class="font-medium {{ $serviceExpires->diffInDays(now()) <= 7 ? 'text-amber-600 dark:text-amber-400' : 'text-gray-800 dark:text-gray-200' }}">
{{ $serviceExpires->diffInDays(now()) }} days
</span>
</div>
@endif
</div>
</div>
<!-- Infrastructure Card -->
<div class="bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg p-3">
<div class="flex items-center gap-2 mb-3">
<div class="flex items-center justify-center w-7 h-7 rounded bg-amber-100 dark:bg-amber-900">
<x-ri-building-line class="size-4 text-amber-600 dark:text-amber-400" />
</div>
<h3 class="text-sm font-semibold text-gray-800 dark:text-gray-200">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-800 dark:text-gray-200">{{ $locationName }}</span>
</div>
<div class="flex justify-between">
<span class="text-gray-500 dark:text-gray-400">Hypervisor Node</span>
<span class="font-medium text-gray-800 dark:text-gray-200">{{ $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-800 dark:text-gray-200">{{ $server->vm_id ?? 'N/A' }}</span>
</div>
<div class="flex justify-between">
<span class="text-gray-500 dark:text-gray-400">VNC Console</span>
<span class="font-medium {{ $server->node?->vnc_enabled ? 'text-green-600 dark:text-green-400' : 'text-gray-500 dark:text-gray-400' }}">
{{ $server->node?->vnc_enabled ? 'Enabled' : 'Disabled' }}
</span>
</div>
<div class="flex justify-between">
<span class="text-gray-500 dark:text-gray-400">Virtualization</span>
<span class="font-medium text-gray-800 dark:text-gray-200">KVM/QEMU</span>
</div>
</div>
</div>
<!-- Identifiers Card -->
<div class="bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg p-3">
<div class="flex items-center gap-2 mb-3">
<div class="flex items-center justify-center w-7 h-7 rounded bg-cyan-100 dark:bg-cyan-900">
<x-ri-fingerprint-line class="size-4 text-cyan-600 dark:text-cyan-400" />
</div>
<h3 class="text-sm font-semibold text-gray-800 dark:text-gray-200">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-800 dark:text-gray-200">{{ $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-800 dark:text-gray-200">{{ $server->service_id ?? 'N/A' }}</span>
</div>
<div class="flex justify-between">
<span class="text-gray-500 dark:text-gray-400">Hostname</span>
<span class="font-medium font-mono text-gray-800 dark:text-gray-200">{{ $server->hostname ?? '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-800 dark:text-gray-200">{{ $server->created_at?->format('M d, Y') ?? 'N/A' }}</span>
</div>
<div class="flex justify-between">
<span class="text-gray-500 dark:text-gray-400">Last Modified</span>
<span class="font-medium text-gray-800 dark:text-gray-200">{{ $server->updated_at?->diffForHumans() ?? 'N/A' }}</span>
</div>
</div>
</div>
<!-- Current Usage Card -->
<div class="bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg p-3">
<div class="flex items-center gap-2 mb-3">
<div class="flex items-center justify-center w-7 h-7 rounded bg-rose-100 dark:bg-rose-900">
<x-ri-line-chart-line class="size-4 text-rose-600 dark:text-rose-400" />
</div>
<h3 class="text-sm font-semibold text-gray-800 dark:text-gray-200">Current Usage</h3>
</div>
<div class="space-y-2 text-sm">
<div class="flex justify-between items-center">
<span class="text-gray-500 dark:text-gray-400">CPU Usage</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-800 dark:text-gray-200 text-xs w-12 text-right">{{ $cpuUsagePercent }}%</span>
</div>
</div>
<div class="flex justify-between items-center">
<span class="text-gray-500 dark:text-gray-400">Memory Usage</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-800 dark:text-gray-200 text-xs w-12 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 Usage</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-800 dark:text-gray-200 text-xs w-12 text-right">{{ $diskPercent }}%</span>
</div>
</div>
@endif
<div class="flex justify-between">
<span class="text-gray-500 dark:text-gray-400">Uptime</span>
<span class="font-medium text-gray-800 dark:text-gray-200">{{ $reportedUptime }}</span>
</div>
<div class="flex justify-between">
<span class="text-gray-500 dark:text-gray-400">Power State</span>
<span class="font-medium {{ $status && $status->status === 'running' ? 'text-green-600 dark:text-green-400' : 'text-amber-600 dark:text-amber-400' }}">
{{ $status && $status->status === 'running' ? 'Running' : 'Stopped' }}
</span>
</div>
</div>
</div>
</div>
</div>
</div>
@once
<script>
// Export helper function for downloading text files
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);
};
// Export Notes to text file
window.exportNotesToCSV = function() {
let notesText = '';
// Try to get notes from Livewire component
const livewireComponent = Livewire.find(document.querySelector('[wire\\:id]')?.getAttribute('wire:id') ||
document.querySelector('[wire\\:model="notes"]')?.closest('[wire\\:id]')?.getAttribute('wire:id'));
if (livewireComponent && livewireComponent.get('notes')) {
notesText = livewireComponent.get('notes') || '';
} else {
// Fallback: try to get from textarea
const notesTextarea = document.querySelector('[wire\\:model="notes"]');
if (notesTextarea && notesTextarea.tagName === 'TEXTAREA') {
notesText = notesTextarea.value || '';
} else {
// Fallback: extract from rendered markdown (less ideal, but works)
const notesElement = document.querySelector('.prose');
if (notesElement) {
notesText = notesElement.innerText || notesElement.textContent || '';
}
}
}
if (!notesText || notesText.trim() === '' || notesText.includes('No notes stored')) {
// Find the notes section and show the error modal
const notesSection = document.getElementById('notes-section');
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>