coolify/resources/views/livewire/project/shared/logs.blade.php
Andras Bacsai a7a06aa6c8 feat(ui): polish domains, storage, env vars and resource nav
Improve project resource UIs: sort domains by DNS failure, stop re-adding www pairs on refresh, lazy-load storage tabs with counts, tighten env-var tables, keep application tabs active across Livewire polls, unify database type labels, and update related CSS/JS and tests.
2026-08-05 13:50:11 +02:00

78 lines
3.7 KiB
PHP

<div>
<x-slot:title>
{{ data_get_str($resource, 'name')->limit(10) }} > Logs | Coolify
</x-slot>
<livewire:project.shared.configuration-checker :resource="$resource" />
@if ($type === 'application')
<livewire:project.application.heading :application="$resource" wire:key="application-heading-logs" />
@elseif ($type === 'database')
<livewire:project.database.heading :database="$resource" />
@elseif ($type === 'service')
<livewire:project.service.heading :service="$resource" :parameters="$parameters" :query="$query"
title="Logs" />
@endif
@php
$totalContainers = collect($serverContainers)->flatten(1)->count();
$functionalServers = $servers->filter(fn ($server) => $server->isFunctional());
$logsUnavailable = $containersLoaded && (
$servers->isEmpty()
|| $functionalServers->isEmpty()
|| $totalContainers === 0
);
@endphp
<div wire:loading.flex wire:target="loadAllContainers"
class="mt-4 hidden min-h-32 w-full items-center justify-center lg:mt-3">
<x-loading text="Loading containers" />
</div>
<div class="mt-4 w-full lg:mt-3" x-init="if (! $wire.containersLoaded) { $wire.loadAllContainers() }"
wire:loading.remove wire:target="loadAllContainers">
@if (! $containersLoaded)
<div class="flex min-h-32 items-center justify-center">
<x-loading text="Loading containers" />
</div>
@elseif ($logsUnavailable)
@if ($servers->isEmpty())
<x-empty size="lg" title="Runtime logs unavailable"
description="Connect and validate a server before viewing resource logs."
icon-name="file-content" />
@elseif ($functionalServers->isEmpty())
<x-empty size="lg" title="Runtime logs unavailable"
description="No functional servers are available, so container logs cannot be loaded."
icon-name="file-content" />
@else
<x-empty size="lg" title="Runtime logs unavailable"
description="No containers are running, so there are no runtime logs to show."
icon-name="file-content" />
@endif
@else
<div class="flex flex-col gap-4">
@foreach ($servers as $server)
@if (! $server->isFunctional())
<x-callout type="warning" title="Server unavailable">
{{ $server->name }} is not functional, so its container logs cannot be loaded.
</x-callout>
@elseif (isset($serverContainers[$server->id]) && count($serverContainers[$server->id]) > 0)
@if ($servers->count() > 1)
<div class="flex items-center gap-2 px-1">
<x-reicon name="servers" class="size-3.5 text-neutral-400 dark:text-fg-faint" />
<p class="text-xs font-medium text-neutral-500 dark:text-fg-dim">{{ $server->name }}</p>
</div>
@endif
@foreach ($serverContainers[$server->id] as $container)
<livewire:project.shared.get-logs
wire:key="{{ data_get($container, 'ID', uniqid()) }}" :server="$server"
:resource="$resource" :container="data_get($container, 'Names')"
:expandByDefault="$totalContainers === 1" />
@endforeach
@endif
@endforeach
</div>
@endif
</div>
</div>