Refactor dashboard view to remove unnecessary code and improve readability

This commit is contained in:
Andras Bacsai 2024-03-18 14:35:46 +01:00
parent 8e2ee5e5e4
commit ef2be40478

View File

@ -15,11 +15,6 @@
subscription is activated.<br> Please be patient.</span>
</div>
@endif
@if ($servers->count() === 0)
No resources found. Add your first server & private key <a class="text-white underline"
href="{{ route('server.create') }}">here</a> or go to the <a class="text-white underline"
href="{{ route('onboarding') }}">onboarding page</a>.
@endif
<h3 class="pb-4">Projects</h3>
<div class="grid grid-cols-1 gap-2 xl:grid-cols-2">
@forelse ($projects as $project)
@ -58,48 +53,51 @@
</div>
</div>
@empty
<div>
No project found.
<x-forms.button class="btn" onclick="newEmptyProject.showModal()">+ Add</x-forms.button>
<livewire:project.add-empty />
</div>
<div>
No projects found. Add your first server <a class="text-white underline"
onclick="newEmptyProject.showModal()">here</a> or
go to the <a class="text-white underline" href="{{ route('onboarding') }}">onboarding page.</a>
<livewire:project.add-empty />
</div>
@endforelse
</div>
<h3 class="py-4">Servers</h3>
@if ($servers->count() === 1)
<div class="grid grid-cols-1 gap-2">
@else
<div class="grid grid-cols-1 gap-2 xl:grid-cols-2">
@endif
@foreach ($servers as $server)
<a href="{{ route('server.show', ['server_uuid' => data_get($server, 'uuid')]) }}"
@class([
'gap-2 border cursor-pointer box group',
'border-transparent' => $server->settings->is_reachable,
'border-red-500' => !$server->settings->is_reachable,
])>
<div class="flex flex-col mx-6">
<div class="font-bold text-white">
{{ $server->name }}
</div>
<div class="description">
{{ $server->description }}</div>
<div class="flex gap-1 text-xs text-error">
@if (!$server->settings->is_reachable)
<span>Not reachable</span>
@endif
@if (!$server->settings->is_reachable && !$server->settings->is_usable)
&
@endif
@if (!$server->settings->is_usable)
<span>Not usable by Coolify</span>
@endif
<div class="grid grid-cols-1 gap-2 xl:grid-cols-2">
@forelse ($servers as $server)
<a href="{{ route('server.show', ['server_uuid' => data_get($server, 'uuid')]) }}"
@class([
'gap-2 border cursor-pointer box group',
'border-transparent' => $server->settings->is_reachable,
'border-red-500' => !$server->settings->is_reachable,
])>
<div class="flex flex-col mx-6">
<div class="font-bold text-white">
{{ $server->name }}
</div>
<div class="description">
{{ $server->description }}</div>
<div class="flex gap-1 text-xs text-error">
@if (!$server->settings->is_reachable)
<span>Not reachable</span>
@endif
@if (!$server->settings->is_reachable && !$server->settings->is_usable)
&
@endif
@if (!$server->settings->is_usable)
<span>Not usable by Coolify</span>
@endif
</div>
</div>
<div class="flex-1"></div>
</a>
@empty
<div>
No servers found.
Add your first server <a class="text-white underline" href="{{ route('server.create') }}">here</a> or
go to the <a class="text-white underline" href="{{ route('onboarding') }}">onboarding page.</a>
</div>
<div class="flex-1"></div>
</a>
@endforeach
@endforelse
</div>
<div class="flex items-center gap-2">
<h3 class="py-4">Deployments</h3>
@if (count($deployments_per_server) > 0)