56 lines
3.3 KiB
PHP
56 lines
3.3 KiB
PHP
<div class="space-y-5">
|
|
<div class="flex items-start justify-between gap-4 animate-rise">
|
|
<div>
|
|
<h1 class="text-2xl font-semibold tracking-tight text-ink">{{ __('hosts.title') }}</h1>
|
|
<p class="mt-1 text-sm text-muted">{{ __('hosts.subtitle') }}</p>
|
|
</div>
|
|
<a href="{{ route('admin.hosts.create') }}" wire:navigate>
|
|
<x-ui.button variant="primary" size="sm"><x-ui.icon name="plus" class="size-4" />{{ __('hosts.add') }}</x-ui.button>
|
|
</a>
|
|
</div>
|
|
|
|
@if ($hosts->isEmpty())
|
|
<div class="rounded-xl border border-dashed border-line-strong bg-surface p-10 text-center animate-rise">
|
|
<span class="mx-auto grid size-12 place-items-center rounded-lg bg-surface-2 text-muted"><x-ui.icon name="server" class="size-6" /></span>
|
|
<p class="mt-3 text-sm text-muted">{{ __('hosts.empty') }}</p>
|
|
</div>
|
|
@else
|
|
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2">
|
|
@foreach ($hosts as $host)
|
|
@php
|
|
$badge = ['pending' => 'pending', 'onboarding' => 'provisioning', 'active' => 'active', 'error' => 'failed', 'disabled' => 'suspended'][$host->status] ?? 'info';
|
|
$usedPct = $host->total_gb ? (int) round(($host->total_gb - $host->freeGb()) / max($host->total_gb, 1) * 100) : 0;
|
|
@endphp
|
|
<a href="{{ route('admin.hosts.show', $host) }}" wire:navigate
|
|
class="block rounded-xl border border-line bg-surface p-5 shadow-xs transition hover:bg-surface-hover animate-rise">
|
|
<div class="flex items-center gap-3">
|
|
<span class="grid size-10 shrink-0 place-items-center rounded-lg bg-surface-2 text-accent-text"><x-ui.icon name="server" class="size-5" /></span>
|
|
<div class="min-w-0">
|
|
<p class="font-mono font-semibold text-ink">{{ $host->name }}</p>
|
|
<p class="font-mono text-xs text-muted">{{ $host->public_ip }} · {{ __('hosts.datacenter.'.$host->datacenter) }}</p>
|
|
</div>
|
|
<x-ui.badge :status="$badge" class="ml-auto">{{ __('hosts.status.'.$host->status) }}</x-ui.badge>
|
|
</div>
|
|
<div class="mt-4">
|
|
<div class="flex justify-between text-xs">
|
|
<span class="text-muted">{{ __('hosts.capacity') }}</span>
|
|
<span class="font-mono text-body">
|
|
@if ($host->total_gb)
|
|
{{ $host->freeGb() }} / {{ $host->total_gb }} GB {{ __('hosts.free') }}
|
|
@else
|
|
{{ __('hosts.unknown') }}
|
|
@endif
|
|
</span>
|
|
</div>
|
|
@if ($host->total_gb)
|
|
<div class="mt-1 h-1.5 overflow-hidden rounded-pill bg-surface-2">
|
|
<div class="h-full rounded-pill {{ $usedPct >= 80 ? 'bg-danger' : 'bg-accent' }}" style="width: {{ $usedPct }}%"></div>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
</a>
|
|
@endforeach
|
|
</div>
|
|
@endif
|
|
</div>
|