feat: initial api endpoints

feat: server resources are now looks better
This commit is contained in:
Andras Bacsai
2024-02-16 21:56:38 +01:00
parent 3539e4dce9
commit b8708f086e
24 changed files with 318 additions and 142 deletions

View File

@@ -22,37 +22,33 @@
@endif
@if ($resource->link())
<a class="flex gap-2 p-1 hover:bg-coolgray-100 hover:no-underline" href="{{ $resource->link() }}">
<div class="w-64">{{ str($resource->type())->headline() }}</div>
<div>{{ $resource->name }}</div>
<div class="w-40">
@if ($resource->type() === 'service')
<x-status.services :service="$resource" />
@else
<x-status.index :status="$resource->status" :showRefreshButton="false" :showIcon="false" />
@endif
</div>
<div>{{ $resource->name }}<span
class="px-2 text-xs">({{ str($resource->type())->headline() }})</span></div>
</a>
@else
<div class="flex gap-2 p-1 hover:bg-coolgray-100 hover:no-underline">
<div class="w-64">{{ str($resource->type())->headline() }}</div>
<div>{{ $resource->name }}</div>
<div class="w-40">
@if ($resource->type() === 'service')
<x-status.services :service="$resource" />
@else
<x-status.index :status="$resource->status" :showRefreshButton="false" :showIcon="false" />
@endif
</div>
<div>{{ $resource->name }}<span
class="px-2 text-xs">({{ str($resource->type())->headline() }})</span></div>
</div>
@endif
@empty
@endforelse
</div>
@else
<div class="flex flex-col">
@forelse ($server->definedResources() as $resource)
@if ($loop->first)
<h3 class="pt-4">Resources</h3>
@endif
@if ($resource->link())
<a class="flex gap-2 p-1 hover:bg-coolgray-100 hover:no-underline" href="{{ $resource->link() }}">
<div class="w-64">{{ str($resource->type())->headline() }}</div>
<div>{{ $resource->name }}</div>
</a>
@else
<div class="flex gap-2 p-1 hover:bg-coolgray-100 hover:no-underline">
<div class="w-64">{{ str($resource->type())->headline() }}</div>
<div>{{ $resource->name }}</div>
</div>
@endif
@empty
@endforelse
</div>
@endif
</div>

View File

@@ -0,0 +1,46 @@
<div>
<x-server.navbar :server="$server" :parameters="$parameters" />
<h2>Resources</h2>
<div class="pb-4 title">Here you can find all resources for this server.</div>
<div class="flex flex-col">
<div class="flex flex-col">
<div class="overflow-x-auto">
<div class="inline-block min-w-full">
<div class="overflow-hidden">
<table class="min-w-full divide-y divide-coolgray-400">
<thead>
<tr class="text-neutral-500">
<th class="px-5 py-3 text-xs font-medium text-left uppercase">Project Name</th>
<th class="px-5 py-3 text-xs font-medium text-left uppercase">Name</th>
<th class="px-5 py-3 text-xs font-medium text-left uppercase">Type</th>
<th class="px-5 py-3 text-xs font-medium text-left uppercase">Status</th>
</tr>
</thead>
<tbody class="divide-y divide-coolgray-400">
@forelse ($server->definedResources()->sortBy('name',SORT_NATURAL) as $resource)
<tr class="text-white bg-coolblack hover:bg-coolgray-100">
<td class="px-5 py-4 text-sm whitespace-nowrap">
{{ data_get($resource->project(), 'name') }}
</td>
<td class="px-5 py-4 text-sm whitespace-nowrap"> <a class=""
href="{{ $resource->link() }}">{{ $resource->name }} </a></td>
<td class="px-5 py-4 text-sm whitespace-nowrap">
{{ str($resource->type())->headline() }}</td>
<td class="px-5 py-4 text-sm font-medium whitespace-nowrap">
@if ($resource->type() === 'service')
<x-status.services :service="$resource" />
@else
<x-status.index :status="$resource->status" :showRefreshButton="false" />
@endif
</td>
</tr>
@empty
@endforelse
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>