mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-16 09:42:29 -04:00
Dark mode keeps a black canvas, paints cards at #121212, and tints the sidebar purple-black. Active navigation, secondary buttons, and the view switcher use brand purple; warning yellow stays for real warnings. Co-authored-by: Andras Bacsai <andrasbacsai@users.noreply.github.com>
266 lines
16 KiB
PHP
266 lines
16 KiB
PHP
<div class="application-settings-form w-full">
|
|
<x-slot:title>
|
|
Servers | Coolify
|
|
</x-slot>
|
|
|
|
<div class="mb-5 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
|
|
<h1 class="min-w-0 text-[24px]! leading-7! font-semibold! tracking-tight!">Servers</h1>
|
|
<div class="flex flex-wrap items-center gap-2">
|
|
@can('createAnyResource')
|
|
<a href="{{ route('server.create') }}" {{ wireNavigate() }}
|
|
class="button w-fit shrink-0 whitespace-nowrap button-highlighted">
|
|
<x-reicon name="plus" class="size-3.5" />
|
|
New server
|
|
</a>
|
|
@endcan
|
|
</div>
|
|
</div>
|
|
|
|
@php
|
|
$serverRows = $servers->map(function ($server) {
|
|
$isTransferredAway = $server->isTransferredAway();
|
|
$isReady = $server->settings->is_reachable
|
|
&& $server->settings->is_usable
|
|
&& ! $server->settings->force_disabled
|
|
&& ! $isTransferredAway;
|
|
$proxyNeedsAttention = $isReady && $server->proxySet()
|
|
&& ($server->proxy->status !== 'running' || $server->hasCurrentTraefikOutdatedInfo());
|
|
$sentinelNeedsAttention = $isReady && $server->isSentinelEnabled() && $server->sentinelStatus() === 'out_of_sync';
|
|
|
|
$status = match (true) {
|
|
$isTransferredAway => 'Transferred away',
|
|
$server->settings->force_disabled => 'Disabled',
|
|
$proxyNeedsAttention || $sentinelNeedsAttention => 'Attention required',
|
|
$isReady => 'Ready',
|
|
default => 'Validation required',
|
|
};
|
|
|
|
$statusType = match (true) {
|
|
$proxyNeedsAttention || $sentinelNeedsAttention => 'warning',
|
|
$isReady => 'success',
|
|
$isTransferredAway || $server->settings->force_disabled => 'error',
|
|
default => 'error',
|
|
};
|
|
|
|
$patchStatus = auth()->user()?->can('viewSecurity', $server) ? $server->settings->patchStatus() : null;
|
|
$patchBadges = [];
|
|
if ($patchStatus !== null) {
|
|
$patchBadges[] = match (true) {
|
|
$patchStatus['error'] !== null => ['label' => 'Patch check failed', 'type' => 'error'],
|
|
$patchStatus['security'] > 0 => ['label' => $patchStatus['security'].' security '.str('update')->plural($patchStatus['security']), 'type' => 'error'],
|
|
$patchStatus['updates'] > 0 => ['label' => $patchStatus['updates'].' '.str('update')->plural($patchStatus['updates']), 'type' => 'warning'],
|
|
default => ['label' => 'Up to date', 'type' => 'success'],
|
|
};
|
|
if ($patchStatus['error'] === null && $patchStatus['reboot_required']) {
|
|
$patchBadges[] = ['label' => 'Reboot required', 'type' => 'warning'];
|
|
}
|
|
}
|
|
|
|
return [
|
|
'uuid' => $server->uuid,
|
|
'name' => $server->name,
|
|
'description' => $server->description,
|
|
'href' => route('server.show', ['server_uuid' => $server->uuid]),
|
|
'status' => $status,
|
|
'statusType' => $statusType,
|
|
'resourceCount' => $server->definedResources()->count(),
|
|
'patchStatus' => $patchStatus === null ? null : [
|
|
'failed' => $patchStatus['error'] !== null,
|
|
'updates' => $patchStatus['error'] === null ? $patchStatus['updates'] : 0,
|
|
'security' => $patchStatus['error'] === null ? $patchStatus['security'] : 0,
|
|
'rebootRequired' => $patchStatus['error'] === null && $patchStatus['reboot_required'],
|
|
],
|
|
'patchBadges' => $patchBadges,
|
|
'patchCheckedAt' => $patchStatus === null ? null : 'Patches checked '.$patchStatus['checked_at']->diffForHumans(),
|
|
];
|
|
})->values();
|
|
|
|
$patchStatuses = $serverRows->pluck('patchStatus')->filter();
|
|
$showPatches = $patchStatuses->isNotEmpty();
|
|
@endphp
|
|
|
|
<div x-data="{
|
|
search: '',
|
|
viewMode: @js($this->listView('servers', 'table')),
|
|
servers: @js($serverRows),
|
|
get filteredServers() {
|
|
const query = this.search.trim().toLowerCase();
|
|
if (!query) return this.servers;
|
|
return this.servers.filter(server =>
|
|
[server.name, server.description, server.status, ...server.patchBadges.map(badge => badge.label)]
|
|
.some(value => String(value || '').toLowerCase().includes(query))
|
|
);
|
|
},
|
|
setViewMode(mode) {
|
|
this.viewMode = mode;
|
|
this.$wire.saveListView('servers', mode);
|
|
}
|
|
}">
|
|
@if ($servers->isEmpty())
|
|
<x-empty title="No servers yet"
|
|
description="Add a server to deploy applications, databases, and services."
|
|
icon-name="servers" />
|
|
@else
|
|
<div class="mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
|
|
<div class="relative w-full sm:max-w-sm">
|
|
<x-reicon name="search"
|
|
class="pointer-events-none absolute top-1/2 left-2.5 z-10 size-3.5 -translate-y-1/2 text-neutral-400 dark:text-fg-faint" />
|
|
<input x-model.debounce.150ms="search" type="search" placeholder="Search servers"
|
|
class="h-8! w-full rounded-lg! border-neutral-200! bg-white! py-0! pr-8! pl-8! text-[12px]! shadow-none! placeholder:text-neutral-400 focus:border-accent! focus:ring-0! dark:border-white/[0.08]! dark:bg-white/[0.035]! dark:text-fg! dark:placeholder:text-fg-faint">
|
|
<button x-cloak x-show="search" x-on:click="search = ''" type="button"
|
|
class="absolute top-1/2 right-2 flex size-5 -translate-y-1/2 items-center justify-center rounded text-neutral-400 transition-colors hover:bg-neutral-100 hover:text-black dark:text-fg-faint dark:hover:bg-white/[0.07] dark:hover:text-fg"
|
|
aria-label="Clear search">
|
|
<x-reicon name="x" class="size-3" />
|
|
</button>
|
|
</div>
|
|
|
|
<div class="flex flex-wrap items-center gap-3 sm:justify-end">
|
|
<x-canvas-view-toggle :list-url="route('server.index')"
|
|
:canvas-url="route('server.canvas.index')" />
|
|
</div>
|
|
</div>
|
|
|
|
<div x-cloak x-show="viewMode === 'grid'"
|
|
class="grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4">
|
|
@foreach ($servers as $server)
|
|
@php
|
|
$serverRow = $serverRows->firstWhere('uuid', $server->uuid);
|
|
@endphp
|
|
<a x-cloak
|
|
x-show="filteredServers.some(server => server.uuid === @js($server->uuid))"
|
|
href="{{ $serverRow['href'] }}" {{ wireNavigate() }}
|
|
class="group relative flex min-h-28 flex-col rounded-xl border border-neutral-200 bg-white p-3 shadow-sm transition-all hover:-translate-y-px hover:border-neutral-300 hover:no-underline hover:shadow-md dark:border-white/[0.08] dark:bg-white/[0.05] dark:hover:border-white/[0.14]">
|
|
@if ($server->isMetricsEnabled())
|
|
<livewire:dashboard.server-metrics-chart :server="$server"
|
|
:key="'server-index-metrics-'.$server->uuid" />
|
|
@endif
|
|
|
|
<div class="relative z-10 flex items-start gap-3">
|
|
<div
|
|
class="resource-glyph flex size-8 shrink-0 items-center justify-center rounded-lg border border-neutral-200 bg-neutral-50 text-neutral-500">
|
|
<x-reicon name="servers" class="size-4" />
|
|
</div>
|
|
<div class="min-w-0 flex-1 self-center">
|
|
<h2 class="truncate text-[13px]! leading-4! font-semibold! text-black dark:text-fg">
|
|
{{ $serverRow['name'] }}
|
|
</h2>
|
|
@if (filled($serverRow['description']))
|
|
<p class="mt-0.5 truncate text-[11px] text-neutral-500 dark:text-fg-faint">
|
|
{{ $serverRow['description'] }}
|
|
</p>
|
|
@endif
|
|
</div>
|
|
@if ($serverRow['statusType'] !== 'success')
|
|
<span data-tooltip="{{ $serverRow['status'] }}"
|
|
aria-label="Server status: {{ $serverRow['status'] }}"
|
|
@class([
|
|
'ml-auto flex size-6 shrink-0 items-center justify-center rounded-md',
|
|
'text-orange-500 dark:text-warning' => $serverRow['statusType'] === 'warning',
|
|
'text-red-500 dark:text-red-400' => $serverRow['statusType'] === 'error',
|
|
])>
|
|
<x-reicon name="alert-triangle" class="size-4" />
|
|
</span>
|
|
@endif
|
|
</div>
|
|
|
|
@php
|
|
$cardPatchBadges = array_filter($serverRow['patchBadges'], fn ($badge) => $badge['type'] !== 'success');
|
|
@endphp
|
|
@if ($cardPatchBadges !== [])
|
|
<div class="relative z-10 mt-auto flex flex-wrap gap-1.5 pt-3"
|
|
data-tooltip="{{ $serverRow['patchCheckedAt'] }}">
|
|
@foreach ($cardPatchBadges as $badge)
|
|
<x-status-badge :status="$badge['label']" :type="$badge['type']" />
|
|
@endforeach
|
|
</div>
|
|
@endif
|
|
</a>
|
|
@endforeach
|
|
</div>
|
|
|
|
<div x-show="viewMode === 'table'"
|
|
class="overflow-x-auto rounded-xl border border-neutral-200 bg-white shadow-sm dark:border-white/[0.08] dark:bg-white/[0.05]">
|
|
<div @class([
|
|
'grid min-w-[480px] grid-cols-[minmax(0,1fr)_9.5rem] border-b border-neutral-200 bg-neutral-50 px-4 py-2.5 text-[11px] font-medium text-neutral-500 md:min-w-[560px] md:grid-cols-[minmax(0,1fr)_6rem_9.5rem] dark:border-white/[0.08] dark:bg-white/[0.05] dark:text-fg-faint',
|
|
'lg:min-w-[760px] lg:grid-cols-[minmax(0,1fr)_6rem_12rem_9.5rem]' => $showPatches,
|
|
])>
|
|
<div>Server</div>
|
|
<div class="hidden md:block">Resources</div>
|
|
@if ($showPatches)
|
|
<div class="hidden lg:block">Patches</div>
|
|
@endif
|
|
<div>Status</div>
|
|
</div>
|
|
<template x-for="server in filteredServers" :key="server.uuid">
|
|
<a :href="server.href" {{ wireNavigate() }}
|
|
@class([
|
|
'grid min-h-14 min-w-[480px] grid-cols-[minmax(0,1fr)_9.5rem] items-center border-b border-neutral-200 px-4 py-2.5 text-[12px] transition-colors last:border-b-0 hover:bg-neutral-50 hover:no-underline md:min-w-[560px] md:grid-cols-[minmax(0,1fr)_6rem_9.5rem] dark:border-white/[0.07] dark:hover:bg-white/[0.025]',
|
|
'lg:min-w-[760px] lg:grid-cols-[minmax(0,1fr)_6rem_12rem_9.5rem]' => $showPatches,
|
|
])>
|
|
<div class="flex min-w-0 items-center gap-3">
|
|
<div
|
|
class="resource-glyph flex size-8 shrink-0 items-center justify-center rounded-lg border border-neutral-200 bg-neutral-50 text-neutral-500">
|
|
<x-reicon name="servers" class="size-4" />
|
|
</div>
|
|
<div class="min-w-0">
|
|
<p class="truncate text-[13px] font-semibold text-black dark:text-fg"
|
|
x-text="server.name"></p>
|
|
<p class="truncate text-[11px] text-neutral-500 dark:text-fg-faint"
|
|
x-text="server.description"></p>
|
|
</div>
|
|
<span x-show="server.statusType !== 'success'" :data-tooltip="server.status"
|
|
:aria-label="`Server status: ${server.status}`"
|
|
class="ml-auto flex size-6 shrink-0 items-center justify-center rounded-md md:hidden"
|
|
:class="server.statusType === 'warning' ? 'text-orange-500 dark:text-warning' : 'text-red-500 dark:text-red-400'">
|
|
<x-reicon name="alert-triangle" class="size-4" />
|
|
</span>
|
|
</div>
|
|
<div class="hidden text-[12px] font-medium text-neutral-600 md:block dark:text-fg-dim">
|
|
<span class="inline-flex items-center gap-1" :title="`${server.resourceCount} ${server.resourceCount === 1 ? 'resource' : 'resources'}`">
|
|
<x-reicon name="grid" class="size-3.5 text-neutral-400 dark:text-fg-faint" />
|
|
<span x-text="server.resourceCount"></span>
|
|
</span>
|
|
</div>
|
|
@if ($showPatches)
|
|
<div class="hidden flex-wrap gap-1 lg:flex" :data-tooltip="server.patchCheckedAt">
|
|
<template x-for="badge in server.patchBadges" :key="badge.label">
|
|
<x-status-badge :dynamic="true">
|
|
<span class="relative inline-flex size-1.5 shrink-0 rounded-full"
|
|
:class="{
|
|
'bg-emerald-500': badge.type === 'success',
|
|
'bg-warning': badge.type === 'warning',
|
|
'bg-red-500': badge.type === 'error',
|
|
}"></span>
|
|
<span class="truncate" x-text="badge.label"></span>
|
|
</x-status-badge>
|
|
</template>
|
|
</div>
|
|
@endif
|
|
<div class="flex items-center gap-2 text-[11px] font-medium text-neutral-600 dark:text-fg-dim">
|
|
<span x-show="server.statusType !== 'success'"
|
|
class="hidden size-2 shrink-0 rounded-full md:inline-block"
|
|
:class="server.statusType === 'warning' ? 'bg-orange-500 dark:bg-warning' : 'bg-red-500 dark:bg-red-400'"></span>
|
|
<span x-show="server.statusType === 'success'"
|
|
class="hidden size-2 shrink-0 rounded-full bg-green-500 md:inline-block dark:bg-green-400"></span>
|
|
<span x-text="server.status"></span>
|
|
</div>
|
|
</a>
|
|
</template>
|
|
</div>
|
|
|
|
<div x-show="filteredServers.length === 0"
|
|
class="flex min-h-52 flex-col items-center justify-center rounded-xl border border-neutral-200 bg-white px-6 text-center dark:border-white/[0.08] dark:bg-white/[0.05]">
|
|
<x-reicon name="search" class="mb-3 size-6 text-neutral-300 dark:text-fg-faint" />
|
|
<p class="text-[13px] font-medium">No matching servers</p>
|
|
<p class="mt-1 text-[12px] text-neutral-500 dark:text-fg-dim">Try a different search.</p>
|
|
</div>
|
|
@endif
|
|
|
|
@isset($error)
|
|
<div class="mt-4 rounded-lg border border-red-200 bg-red-50 p-3 text-[12px] text-red-700 dark:border-red-500/20 dark:bg-red-500/[0.06] dark:text-red-300">
|
|
{{ $error }}
|
|
</div>
|
|
@endisset
|
|
</div>
|
|
</div>
|