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

173 lines
9.3 KiB
PHP

<div class="space-y-4">
<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 flex-col sm:flex-row sm:items-center sm:justify-between gap-2 mb-2">
<div class="flex items-center gap-3 min-w-0 flex-shrink">
@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
$iconPrefix = $server->user_set_icon_prefix ?? 'ri';
$iconName = $server->user_set_icon;
$componentName = $iconPrefix . '-' . $iconName;
@endphp
<div class="p-2 rounded-lg flex-shrink-0" style="background-color: {{ $bgColor }};">
<x-dynamic-component :component="$componentName" class="size-5" style="color: {{ $iconColor }};" />
</div>
@else
<div class="bg-secondary/10 p-2 rounded-lg flex-shrink-0">
<x-ri-server-line class="size-5 text-secondary" />
</div>
@endif
<span class="font-medium truncate">{{ $status->name }}</span>
</div>
<div class="flex items-center gap-2 px-3 py-1.5 rounded-lg flex-shrink-0
@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>
</div>
</div>
{{-- Server Tags - Separate row for better mobile layout --}}
@if($server->tag1 || $server->tag2 || $server->tag3)
<div class="flex flex-wrap items-center gap-1.5 mb-3">
@if($server->tag1)
<span class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium text-white"
style="background-color: {{ $server->tag1color ?? '#3498db' }};">
{{ $server->tag1 }}
</span>
@endif
@if($server->tag2)
<span class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium text-white"
style="background-color: {{ $server->tag2color ?? '#2ecc71' }};">
{{ $server->tag2 }}
</span>
@endif
@if($server->tag3)
<span class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium text-white"
style="background-color: {{ $server->tag3color ?? '#e74c3c' }};">
{{ $server->tag3 }}
</span>
@endif
</div>
@endif
<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>
</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>
@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">
@php
$uptime = $status->uptime;
$days = floor($uptime / 86400);
$hours = floor(($uptime % 86400) / 3600);
$minutes = floor(($uptime % 3600) / 60);
$uptimeStr = '';
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">
@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>
@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>
@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>
<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">
<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 (95% threshold: {{ $this->bandwidthThreshold95 }} GiB)</span>
</div>
<span class="text-base font-medium">
{{ $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>
</div>
</div>
</div>
</div>
</a>
</div>