Fetch and display actual VM status from Proxmox API in service view
This commit is contained in:
@@ -126,49 +126,42 @@
|
||||
</div>
|
||||
|
||||
<!-- Server Specifications Card (Proxmox) -->
|
||||
@if($proxmoxServer)
|
||||
@php
|
||||
$cores = $service->product->settings()->where('key', 'cores')->first()?->value;
|
||||
$memory = $service->product->settings()->where('key', 'memory')->first()?->value;
|
||||
$disk = $service->product->settings()->where('key', 'disk')->first()?->value;
|
||||
$bandwidth = $service->product->settings()->where('key', 'bandwidth')->first()?->value;
|
||||
@endphp
|
||||
@if($proxmoxServer && $vmStatus)
|
||||
<div class="bg-gradient-to-br from-background/50 to-background/20 border border-neutral/20 rounded-2xl p-6 backdrop-blur-sm hover:shadow-lg transition-all duration-300">
|
||||
<div class="flex items-center gap-3 mb-6">
|
||||
<x-ri-cpu-line class="size-6 text-primary" />
|
||||
<h3 class="uppercase font-black text-color-base text-sm tracking-wider">Server Specifications</h3>
|
||||
</div>
|
||||
<div class="space-y-4">
|
||||
@if($cores)
|
||||
@if(isset($vmStatus['cpus']))
|
||||
<div class="flex items-center justify-between py-3 px-4 bg-background/50 rounded-xl">
|
||||
<span class="text-color-muted text-sm font-medium flex items-center gap-2">
|
||||
<x-ri-cpu-line class="size-4" /> CPU Cores
|
||||
</span>
|
||||
<span class="font-bold text-color-base">{{ $cores }} {{ $cores == 1 ? 'Core' : 'Cores' }}</span>
|
||||
<span class="font-bold text-color-base">{{ $vmStatus['cpus'] }} {{ $vmStatus['cpus'] == 1 ? 'Core' : 'Cores' }}</span>
|
||||
</div>
|
||||
@endif
|
||||
@if($memory)
|
||||
@if(isset($vmStatus['maxmem']))
|
||||
<div class="flex items-center justify-between py-3 px-4 bg-background/50 rounded-xl">
|
||||
<span class="text-color-muted text-sm font-medium flex items-center gap-2">
|
||||
<x-ri-ram-2-line class="size-4" /> Memory
|
||||
</span>
|
||||
<span class="font-bold text-color-base">
|
||||
@if($memory >= 1024)
|
||||
{{ round($memory / 1024, 1) }} GB
|
||||
@else
|
||||
{{ $memory }} MB
|
||||
@endif
|
||||
{{ round($vmStatus['maxmem'] / (1024 * 1024 * 1024), 2) }} GB
|
||||
</span>
|
||||
</div>
|
||||
@endif
|
||||
@if($disk)
|
||||
@if(isset($vmStatus['maxdisk']))
|
||||
<div class="flex items-center justify-between py-3 px-4 bg-background/50 rounded-xl">
|
||||
<span class="text-color-muted text-sm font-medium flex items-center gap-2">
|
||||
<x-ri-hard-drive-2-line class="size-4" /> Storage
|
||||
</span>
|
||||
<span class="font-bold text-color-base">{{ $disk }} GB</span>
|
||||
<span class="font-bold text-color-base">{{ Illuminate\Support\Number::fileSize(bytes: $vmStatus['maxdisk']) }}</span>
|
||||
</div>
|
||||
@endif
|
||||
@php
|
||||
$bandwidth = $service->product->settings()->where('key', 'bandwidth')->first()?->value;
|
||||
@endphp
|
||||
@if($bandwidth)
|
||||
<div class="flex items-center justify-between py-3 px-4 bg-background/50 rounded-xl">
|
||||
<span class="text-color-muted text-sm font-medium flex items-center gap-2">
|
||||
|
||||
Reference in New Issue
Block a user