fix: unfunctional server should see resources

This commit is contained in:
Andras Bacsai 2024-03-31 18:38:26 +02:00
parent 7a92ecfa30
commit 7aca4930db
2 changed files with 157 additions and 158 deletions

View File

@ -550,6 +550,7 @@ $schema://$host {
} }
public function loadUnmanagedContainers() public function loadUnmanagedContainers()
{ {
try {
if ($this->isFunctional()) { if ($this->isFunctional()) {
$containers = instant_remote_process(["docker ps -a --format '{{json .}}' "], $this); $containers = instant_remote_process(["docker ps -a --format '{{json .}}' "], $this);
$containers = format_docker_command_output_to_json($containers); $containers = format_docker_command_output_to_json($containers);
@ -565,6 +566,10 @@ $schema://$host {
} else { } else {
return collect([]); return collect([]);
} }
} catch (\Throwable $e) {
return handleError($e);
}
} }
public function hasDefinedResources() public function hasDefinedResources()
{ {

View File

@ -1,13 +1,11 @@
<div> <div>
<x-server.navbar :server="$server" :parameters="$parameters" /> <x-server.navbar :server="$server" :parameters="$parameters" />
@if ($server->isFunctional())
<div x-data="{ activeTab: window.location.hash ? window.location.hash.substring(1) : 'managed' }" class="flex h-full"> <div x-data="{ activeTab: window.location.hash ? window.location.hash.substring(1) : 'managed' }" class="flex h-full">
<div class="flex flex-col gap-4"> <div class="flex flex-col gap-4">
<a :class="activeTab === 'managed' && 'dark:text-white'" <a :class="activeTab === 'managed' && 'dark:text-white'"
@click.prevent="activeTab = 'managed'; window.location.hash = 'managed'" href="#">Managed</a> @click.prevent="activeTab = 'managed'; window.location.hash = 'managed'" href="#">Managed</a>
<a :class="activeTab === 'unmanaged' && 'dark:text-white'" <a :class="activeTab === 'unmanaged' && 'dark:text-white'"
@click.prevent="activeTab = 'unmanaged'; window.location.hash = 'unmanaged'" @click.prevent="activeTab = 'unmanaged'; window.location.hash = 'unmanaged'" href="#">Unmanaged</a>
href="#">Unmanaged</a>
</div> </div>
<div class="w-full pl-8"> <div class="w-full pl-8">
<div x-cloak x-show="activeTab === 'managed'" class="h-full"> <div x-cloak x-show="activeTab === 'managed'" class="h-full">
@ -52,8 +50,8 @@
<td class="px-5 py-4 text-sm whitespace-nowrap"> <td class="px-5 py-4 text-sm whitespace-nowrap">
{{ data_get($resource, 'environment.name') }} {{ data_get($resource, 'environment.name') }}
</td> </td>
<td class="px-5 py-4 text-sm whitespace-nowrap hover:underline"><a <td class="px-5 py-4 text-sm whitespace-nowrap hover:underline">
class="" <a class=""
href="{{ $resource->link() }}">{{ $resource->name }} href="{{ $resource->link() }}">{{ $resource->name }}
<x-internal-link /></a> <x-internal-link /></a>
</td> </td>
@ -64,8 +62,7 @@
<x-status.services :service="$resource" <x-status.services :service="$resource"
:showRefreshButton="false" /> :showRefreshButton="false" />
@else @else
<x-status.index :resource="$resource" <x-status.index :resource="$resource" :showRefreshButton="false" />
:showRefreshButton="false" />
@endif @endif
</td> </td>
</tr> </tr>
@ -159,7 +156,4 @@
</div> </div>
</div> </div>
</div> </div>
@else
<div>Server is not validated. Validate first.</div>
@endif
</div> </div>