Refactor Proxmox server views for improved UI consistency and usability
- Updated server card component to use new UI elements and improved layout. - Enhanced status display with badges and better status indicators. - Refined quick info row for server details with consistent styling. - Reorganized server configuration statistics into stat cards for clarity. - Improved help modals for statistics and storage management sections. - Streamlined alerts and warnings for better user experience. - Updated storage management view to utilize new UI components and improve readability.
This commit is contained in:
@@ -1,16 +1,15 @@
|
||||
{{-- Server Card Component - TailServer Theme --}}
|
||||
<div class="space-y-4">
|
||||
@if($status)
|
||||
<a href="{{ route('proxmox.server.overview', ['server' => $server->id]) }}" wire:navigate>
|
||||
<div class="bg-background-secondary hover:bg-background-secondary/80 border border-neutral p-4 rounded-lg mb-4">
|
||||
|
||||
<div class="flex items-center justify-between mb-2">
|
||||
<x-proxmox::ui.card class="hover:border-primary/30 transition-colors cursor-pointer">
|
||||
{{-- Header: Server Name & Status --}}
|
||||
<div class="flex items-center justify-between mb-4">
|
||||
<div class="flex items-center gap-3">
|
||||
@if($server->user_set_icon)
|
||||
@php
|
||||
$iconColor = $server->user_set_icon_color ?? '#6366f1';
|
||||
// Calculate a lighter background color (20% opacity of the icon color)
|
||||
$bgColor = $iconColor . '33'; // 33 in hex = 20% opacity
|
||||
// Build the full component name with prefix
|
||||
$bgColor = $iconColor . '33';
|
||||
$iconPrefix = $server->user_set_icon_prefix ?? 'ri';
|
||||
$iconName = $server->user_set_icon;
|
||||
$componentName = $iconPrefix . '-' . $iconName;
|
||||
@@ -19,50 +18,29 @@
|
||||
<x-dynamic-component :component="$componentName" class="size-5" style="color: {{ $iconColor }};" />
|
||||
</div>
|
||||
@else
|
||||
<div class="bg-secondary/10 p-2 rounded-lg">
|
||||
<x-ri-server-line class="size-5 text-secondary" />
|
||||
<div class="bg-primary/10 p-2 rounded-lg">
|
||||
<x-ri-server-line class="size-5 text-primary" />
|
||||
</div>
|
||||
@endif
|
||||
<span class="font-medium">{{ $status->name }}</span>
|
||||
</div>
|
||||
<div class="flex items-center gap-2 px-3 py-1.5 rounded-lg
|
||||
@if($status->status == 'running') text-success bg-success/20
|
||||
@elseif($status->status == 'stopped') text-inactive bg-inactive/20
|
||||
@else text-warning bg-warning/20 @endif">
|
||||
<div class="size-5">
|
||||
@if($status->status == 'running')
|
||||
<x-ri-checkbox-circle-fill />
|
||||
@elseif($status->status == 'stopped')
|
||||
<x-ri-forbid-fill />
|
||||
@else
|
||||
<x-ri-error-warning-fill />
|
||||
@endif
|
||||
</div>
|
||||
<span class="text-sm font-medium">
|
||||
@if($status->status == 'running')
|
||||
Running
|
||||
@elseif($status->status == 'stopped')
|
||||
Stopped
|
||||
@else
|
||||
{{ ucfirst($status->status) }}
|
||||
@endif
|
||||
</span>
|
||||
<span class="font-semibold text-base">{{ $status->name }}</span>
|
||||
</div>
|
||||
<x-proxmox::ui.server-status :status="$status->status" showLabel />
|
||||
</div>
|
||||
|
||||
<div class="flex flex-row flex-wrap gap-4 mt-4">
|
||||
<div class="flex flex-col">
|
||||
<span class="text-xs text-base/50">IPv4 Address</span>
|
||||
<span class="text-base">{{ $server->primaryIpv4->ip ?? 'None' }}</span>
|
||||
{{-- Quick Info Row --}}
|
||||
<div class="flex flex-row flex-wrap gap-6 py-3 border-y border-neutral/10">
|
||||
<div class="flex flex-col min-w-[120px]">
|
||||
<span class="text-xs font-medium text-base/50 uppercase tracking-wide">IPv4 Address</span>
|
||||
<span class="text-sm text-base mt-0.5">{{ $server->primaryIpv4->ip ?? 'None' }}</span>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<span class="text-xs text-base/50">IPv6 Address</span>
|
||||
<span class="text-base">{{ $server->primaryIpv6->ip }}</span>
|
||||
<div class="flex flex-col min-w-[120px]">
|
||||
<span class="text-xs font-medium text-base/50 uppercase tracking-wide">IPv6 Address</span>
|
||||
<span class="text-sm text-base mt-0.5">{{ $server->primaryIpv6->ip ?? 'None' }}</span>
|
||||
</div>
|
||||
@if($status->status == 'running' && isset($status->uptime))
|
||||
<div class="flex flex-col">
|
||||
<span class="text-xs text-base/50">Uptime</span>
|
||||
<span class="text-base">
|
||||
<div class="flex flex-col min-w-[100px]">
|
||||
<span class="text-xs font-medium text-base/50 uppercase tracking-wide">Uptime</span>
|
||||
<span class="text-sm text-base mt-0.5">
|
||||
@php
|
||||
$uptime = $status->uptime;
|
||||
$days = floor($uptime / 86400);
|
||||
@@ -70,100 +48,90 @@
|
||||
$minutes = floor(($uptime % 3600) / 60);
|
||||
|
||||
$uptimeStr = '';
|
||||
if ($days > 0) {
|
||||
$uptimeStr .= $days . 'd ';
|
||||
}
|
||||
if ($hours > 0 || $days > 0) {
|
||||
$uptimeStr .= $hours . 'h ';
|
||||
}
|
||||
if ($days > 0) $uptimeStr .= $days . 'd ';
|
||||
if ($hours > 0 || $days > 0) $uptimeStr .= $hours . 'h ';
|
||||
$uptimeStr .= $minutes . 'm';
|
||||
@endphp
|
||||
{{ trim($uptimeStr) }}
|
||||
</span>
|
||||
</div>
|
||||
@endif
|
||||
<div class="hidden sm:flex flex-col">
|
||||
<span class="text-xs text-base/50">Memory</span>
|
||||
<span class="text-base">
|
||||
<div class="hidden sm:flex flex-col min-w-[100px]">
|
||||
<span class="text-xs font-medium text-base/50 uppercase tracking-wide">Memory</span>
|
||||
<span class="text-sm text-base mt-0.5">
|
||||
@if($status->status == 'running')
|
||||
{{ Illuminate\Support\Number::fileSize(bytes: $status->mem) }}/
|
||||
@endif
|
||||
{{ Illuminate\Support\Number::fileSize(bytes: $status->maxmem) }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="hidden sm:flex flex-col">
|
||||
<span class="text-xs text-base/50">Disk</span>
|
||||
<span class="text-base">
|
||||
{{ Illuminate\Support\Number::fileSize(bytes: $status->maxdisk) }}
|
||||
</span>
|
||||
<div class="hidden sm:flex flex-col min-w-[80px]">
|
||||
<span class="text-xs font-medium text-base/50 uppercase tracking-wide">Disk</span>
|
||||
<span class="text-sm text-base mt-0.5">{{ Illuminate\Support\Number::fileSize(bytes: $status->maxdisk) }}</span>
|
||||
</div>
|
||||
@if($status->status == 'running')
|
||||
<div class="hidden sm:flex flex-col">
|
||||
<span class="text-xs text-base/50">CPU</span>
|
||||
<span class="text-base">{{ round($status->cpu * 100, 2) }}%</span>
|
||||
<div class="hidden sm:flex flex-col min-w-[60px]">
|
||||
<span class="text-xs font-medium text-base/50 uppercase tracking-wide">CPU</span>
|
||||
<span class="text-sm text-base mt-0.5">{{ round($status->cpu * 100, 2) }}%</span>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
{{-- Server Configuration Statistics --}}
|
||||
<div class="mt-4 pt-4 border-t border-neutral">
|
||||
<div class="text-sm font-medium text-base/70 mb-3">Server Configuration</div>
|
||||
{{-- Server Configuration Grid --}}
|
||||
<div class="mt-4">
|
||||
<div class="text-xs font-semibold text-base/60 uppercase tracking-wide mb-3">Server Configuration</div>
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4">
|
||||
<div class="flex flex-col">
|
||||
<div class="flex items-center gap-2 mb-1">
|
||||
<x-ri-cpu-line class="size-4 text-base/50" />
|
||||
<span class="text-xs text-base/50">CPU Cores</span>
|
||||
</div>
|
||||
<span class="text-base">{{ $status->cpus ?? 'N/A' }} {{ ($status->cpus ?? 0) > 1 ? 'Cores' : 'Core' }}</span>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<div class="flex items-center gap-2 mb-1">
|
||||
<x-ri-database-2-line class="size-4 text-base/50" />
|
||||
<span class="text-xs text-base/50">RAM Allocation</span>
|
||||
</div>
|
||||
<span class="text-base">{{ round(($status->maxmem ?? 0) / (1024 * 1024 * 1024), 2) }} GiB</span>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<div class="flex items-center gap-2 mb-1">
|
||||
<x-ri-hard-drive-2-line class="size-4 text-base/50" />
|
||||
<span class="text-xs text-base/50">Disk Capacity</span>
|
||||
</div>
|
||||
<span class="text-base">{{ Illuminate\Support\Number::fileSize(bytes: $status->maxdisk ?? 0) }}</span>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<x-proxmox::ui.stat-card
|
||||
label="CPU Cores"
|
||||
:value="($status->cpus ?? 'N/A') . ' ' . (($status->cpus ?? 0) > 1 ? 'Cores' : 'Core')"
|
||||
icon="ri-cpu-line"
|
||||
variant="default"
|
||||
/>
|
||||
<x-proxmox::ui.stat-card
|
||||
label="RAM Allocation"
|
||||
:value="round(($status->maxmem ?? 0) / (1024 * 1024 * 1024), 2) . ' GiB'"
|
||||
icon="ri-ram-line"
|
||||
variant="default"
|
||||
/>
|
||||
<x-proxmox::ui.stat-card
|
||||
label="Disk Capacity"
|
||||
:value="Illuminate\Support\Number::fileSize(bytes: $status->maxdisk ?? 0)"
|
||||
icon="ri-hard-drive-2-line"
|
||||
variant="default"
|
||||
/>
|
||||
<div class="flex flex-col p-3 bg-neutral/5 rounded-lg">
|
||||
<div class="flex items-center gap-2 mb-1">
|
||||
<x-ri-speed-line class="size-4 text-base/50" />
|
||||
<span class="text-xs text-base/50">Bandwidth</span>
|
||||
</div>
|
||||
<span class="text-base font-medium">
|
||||
<span class="text-sm font-medium text-base">
|
||||
{{ $this->monthlyTraffic }} GiB / {{ $this->bandwidthThreshold95 }} GiB
|
||||
</span>
|
||||
<span class="text-base text-xs leading-relaxed text-base/60 mt-1">
|
||||
Threshold: 95% of average usage or 10 GiB minimum. Connection reduced to 1 MiB/s if exceeded.
|
||||
<span class="text-xs text-base/50 mt-1 leading-relaxed">
|
||||
95% threshold or 10 GiB min. Reduced to 1 MiB/s if exceeded.
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</x-proxmox::ui.card>
|
||||
</a>
|
||||
@else
|
||||
{{-- Status unavailable - show error state --}}
|
||||
{{-- Error State: Status unavailable --}}
|
||||
<a href="{{ route('proxmox.server.overview', ['server' => $server->id]) }}" wire:navigate>
|
||||
<div class="bg-background-secondary hover:bg-background-secondary/80 border border-danger/30 p-4 rounded-lg mb-4">
|
||||
<x-proxmox::ui.card class="border-danger/30 hover:border-danger/50 transition-colors cursor-pointer">
|
||||
<div class="flex items-center justify-between mb-2">
|
||||
<div class="flex items-center gap-3">
|
||||
<div class="bg-danger/10 p-2 rounded-lg">
|
||||
<x-ri-server-line class="size-5 text-danger" />
|
||||
</div>
|
||||
<span class="font-medium">{{ $server->hostname ?? 'Server #' . $server->id }}</span>
|
||||
</div>
|
||||
<div class="flex items-center gap-2 px-3 py-1.5 rounded-lg text-danger bg-danger/20">
|
||||
<x-ri-error-warning-fill class="size-5" />
|
||||
<span class="text-sm font-medium">Unavailable</span>
|
||||
<span class="font-semibold text-base">{{ $server->hostname ?? 'Server #' . $server->id }}</span>
|
||||
</div>
|
||||
<x-proxmox::ui.badge variant="danger" icon="ri-error-warning-fill">
|
||||
Unavailable
|
||||
</x-proxmox::ui.badge>
|
||||
</div>
|
||||
<p class="text-sm text-base/60 mt-2">Unable to retrieve server status. Click to view details or try again.</p>
|
||||
</div>
|
||||
</x-proxmox::ui.card>
|
||||
</a>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user