fix: unfunctional server should see resources
This commit is contained in:
parent
7a92ecfa30
commit
7aca4930db
@ -550,21 +550,26 @@ $schema://$host {
|
|||||||
}
|
}
|
||||||
public function loadUnmanagedContainers()
|
public function loadUnmanagedContainers()
|
||||||
{
|
{
|
||||||
if ($this->isFunctional()) {
|
try {
|
||||||
$containers = instant_remote_process(["docker ps -a --format '{{json .}}' "], $this);
|
if ($this->isFunctional()) {
|
||||||
$containers = format_docker_command_output_to_json($containers);
|
$containers = instant_remote_process(["docker ps -a --format '{{json .}}' "], $this);
|
||||||
$containers = $containers->map(function ($container) {
|
$containers = format_docker_command_output_to_json($containers);
|
||||||
$labels = data_get($container, 'Labels');
|
$containers = $containers->map(function ($container) {
|
||||||
if (!str($labels)->contains("coolify.managed")) {
|
$labels = data_get($container, 'Labels');
|
||||||
return $container;
|
if (!str($labels)->contains("coolify.managed")) {
|
||||||
}
|
return $container;
|
||||||
return null;
|
}
|
||||||
});
|
return null;
|
||||||
$containers = $containers->filter();
|
});
|
||||||
return collect($containers);
|
$containers = $containers->filter();
|
||||||
} else {
|
return collect($containers);
|
||||||
return collect([]);
|
} else {
|
||||||
|
return collect([]);
|
||||||
|
}
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
return handleError($e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public function hasDefinedResources()
|
public function hasDefinedResources()
|
||||||
{
|
{
|
||||||
|
@ -1,165 +1,159 @@
|
|||||||
<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'" href="#">Unmanaged</a>
|
||||||
@click.prevent="activeTab = 'unmanaged'; window.location.hash = 'unmanaged'"
|
</div>
|
||||||
href="#">Unmanaged</a>
|
<div class="w-full pl-8">
|
||||||
</div>
|
<div x-cloak x-show="activeTab === 'managed'" class="h-full">
|
||||||
<div class="w-full pl-8">
|
<div class="flex flex-col">
|
||||||
<div x-cloak x-show="activeTab === 'managed'" class="h-full">
|
<div class="flex gap-2">
|
||||||
|
<h2>Resources</h2>
|
||||||
|
<x-forms.button wire:click="refreshStatus">Refresh</x-forms.button>
|
||||||
|
</div>
|
||||||
|
<div class="subtitle">Here you can find all resources that are managed by Coolify.</div>
|
||||||
|
</div>
|
||||||
|
@if ($server->definedResources()->count() > 0)
|
||||||
<div class="flex flex-col">
|
<div class="flex flex-col">
|
||||||
<div class="flex gap-2">
|
|
||||||
<h2>Resources</h2>
|
|
||||||
<x-forms.button wire:click="refreshStatus">Refresh</x-forms.button>
|
|
||||||
</div>
|
|
||||||
<div class="subtitle">Here you can find all resources that are managed by Coolify.</div>
|
|
||||||
</div>
|
|
||||||
@if ($server->definedResources()->count() > 0)
|
|
||||||
<div class="flex flex-col">
|
<div class="flex flex-col">
|
||||||
<div class="flex flex-col">
|
<div class="overflow-x-auto">
|
||||||
<div class="overflow-x-auto">
|
<div class="inline-block min-w-full">
|
||||||
<div class="inline-block min-w-full">
|
<div class="overflow-hidden">
|
||||||
<div class="overflow-hidden">
|
<table class="min-w-full">
|
||||||
<table class="min-w-full">
|
<thead>
|
||||||
<thead>
|
<tr>
|
||||||
|
<th class="px-5 py-3 text-xs font-medium text-left uppercase">
|
||||||
|
Project
|
||||||
|
</th>
|
||||||
|
<th class="px-5 py-3 text-xs font-medium text-left uppercase">
|
||||||
|
Environment</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>
|
||||||
|
@forelse ($server->definedResources()->sortBy('name',SORT_NATURAL) as $resource)
|
||||||
<tr>
|
<tr>
|
||||||
<th class="px-5 py-3 text-xs font-medium text-left uppercase">
|
<td class="px-5 py-4 text-sm whitespace-nowrap">
|
||||||
Project
|
{{ data_get($resource->project(), 'name') }}
|
||||||
</th>
|
</td>
|
||||||
<th class="px-5 py-3 text-xs font-medium text-left uppercase">
|
<td class="px-5 py-4 text-sm whitespace-nowrap">
|
||||||
Environment</th>
|
{{ data_get($resource, 'environment.name') }}
|
||||||
<th class="px-5 py-3 text-xs font-medium text-left uppercase">
|
</td>
|
||||||
Name
|
<td class="px-5 py-4 text-sm whitespace-nowrap hover:underline">
|
||||||
</th>
|
<a class=""
|
||||||
<th class="px-5 py-3 text-xs font-medium text-left uppercase">
|
href="{{ $resource->link() }}">{{ $resource->name }}
|
||||||
Type
|
<x-internal-link /></a>
|
||||||
</th>
|
</td>
|
||||||
<th class="px-5 py-3 text-xs font-medium text-left uppercase">
|
<td class="px-5 py-4 text-sm whitespace-nowrap">
|
||||||
Status
|
{{ str($resource->type())->headline() }}</td>
|
||||||
</th>
|
<td class="px-5 py-4 text-sm font-medium whitespace-nowrap">
|
||||||
|
@if ($resource->type() === 'service')
|
||||||
|
<x-status.services :service="$resource"
|
||||||
|
:showRefreshButton="false" />
|
||||||
|
@else
|
||||||
|
<x-status.index :resource="$resource" :showRefreshButton="false" />
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
@empty
|
||||||
<tbody>
|
@endforelse
|
||||||
@forelse ($server->definedResources()->sortBy('name',SORT_NATURAL) as $resource)
|
</tbody>
|
||||||
<tr>
|
</table>
|
||||||
<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">
|
|
||||||
{{ data_get($resource, 'environment.name') }}
|
|
||||||
</td>
|
|
||||||
<td class="px-5 py-4 text-sm whitespace-nowrap hover:underline"><a
|
|
||||||
class=""
|
|
||||||
href="{{ $resource->link() }}">{{ $resource->name }}
|
|
||||||
<x-internal-link /></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"
|
|
||||||
:showRefreshButton="false" />
|
|
||||||
@else
|
|
||||||
<x-status.index :resource="$resource"
|
|
||||||
:showRefreshButton="false" />
|
|
||||||
@endif
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
@empty
|
|
||||||
@endforelse
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@else
|
|
||||||
<div>No resources found.</div>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
<div x-cloak x-show="activeTab === 'unmanaged'" class="h-full">
|
|
||||||
<div class="flex flex-col" x-init="$wire.loadUnmanagedContainers()">
|
|
||||||
<div class="flex gap-2">
|
|
||||||
<h2>Resources</h2>
|
|
||||||
<x-forms.button wire:click="refreshStatus">Refresh</x-forms.button>
|
|
||||||
</div>
|
|
||||||
<div class="subtitle">Here you can find all other containers running on the server.</div>
|
|
||||||
</div>
|
</div>
|
||||||
@if ($unmanagedContainers->count() > 0)
|
@else
|
||||||
|
<div>No resources found.</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
<div x-cloak x-show="activeTab === 'unmanaged'" class="h-full">
|
||||||
|
<div class="flex flex-col" x-init="$wire.loadUnmanagedContainers()">
|
||||||
|
<div class="flex gap-2">
|
||||||
|
<h2>Resources</h2>
|
||||||
|
<x-forms.button wire:click="refreshStatus">Refresh</x-forms.button>
|
||||||
|
</div>
|
||||||
|
<div class="subtitle">Here you can find all other containers running on the server.</div>
|
||||||
|
</div>
|
||||||
|
@if ($unmanagedContainers->count() > 0)
|
||||||
|
<div class="flex flex-col">
|
||||||
<div class="flex flex-col">
|
<div class="flex flex-col">
|
||||||
<div class="flex flex-col">
|
<div class="overflow-x-auto">
|
||||||
<div class="overflow-x-auto">
|
<div class="inline-block min-w-full">
|
||||||
<div class="inline-block min-w-full">
|
<div class="overflow-hidden">
|
||||||
<div class="overflow-hidden">
|
<table class="min-w-full">
|
||||||
<table class="min-w-full">
|
<thead>
|
||||||
<thead>
|
<tr>
|
||||||
|
<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">
|
||||||
|
Image
|
||||||
|
</th>
|
||||||
|
<th class="px-5 py-3 text-xs font-medium text-left uppercase">
|
||||||
|
Status
|
||||||
|
</th>
|
||||||
|
<th class="px-5 py-3 text-xs font-medium text-left uppercase">
|
||||||
|
Action
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@forelse ($unmanagedContainers->sortBy('name',SORT_NATURAL) as $resource)
|
||||||
<tr>
|
<tr>
|
||||||
<th class="px-5 py-3 text-xs font-medium text-left uppercase">
|
<td class="px-5 py-4 text-sm whitespace-nowrap">
|
||||||
Name
|
{{ data_get($resource, 'Names') }}
|
||||||
</th>
|
</td>
|
||||||
<th class="px-5 py-3 text-xs font-medium text-left uppercase">
|
<td class="px-5 py-4 text-sm whitespace-nowrap">
|
||||||
Image
|
{{ data_get($resource, 'Image') }}
|
||||||
</th>
|
</td>
|
||||||
<th class="px-5 py-3 text-xs font-medium text-left uppercase">
|
<td class="px-5 py-4 text-sm whitespace-nowrap">
|
||||||
Status
|
{{ data_get($resource, 'State') }}
|
||||||
</th>
|
</td>
|
||||||
<th class="px-5 py-3 text-xs font-medium text-left uppercase">
|
<td class="flex gap-2 px-5 py-4 text-sm whitespace-nowrap">
|
||||||
Action
|
@if (data_get($resource, 'State') === 'running')
|
||||||
</th>
|
<x-forms.button
|
||||||
|
wire:click="restartUnmanaged('{{ data_get($resource, 'ID') }}')"
|
||||||
|
wire:key="{{ data_get($resource, 'ID') }}">Restart</x-forms.button>
|
||||||
|
<x-forms.button isError
|
||||||
|
wire:click="stopUnmanaged('{{ data_get($resource, 'ID') }}')"
|
||||||
|
wire:key="{{ data_get($resource, 'ID') }}">Stop</x-forms.button>
|
||||||
|
@elseif (data_get($resource, 'State') === 'exited')
|
||||||
|
<x-forms.button
|
||||||
|
wire:click="startUnmanaged('{{ data_get($resource, 'ID') }}')"
|
||||||
|
wire:key="{{ data_get($resource, 'ID') }}">Start</x-forms.button>
|
||||||
|
@elseif (data_get($resource, 'State') === 'restarting')
|
||||||
|
<x-forms.button
|
||||||
|
wire:click="stopUnmanaged('{{ data_get($resource, 'ID') }}')"
|
||||||
|
wire:key="{{ data_get($resource, 'ID') }}">Stop</x-forms.button>
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
@empty
|
||||||
<tbody>
|
@endforelse
|
||||||
@forelse ($unmanagedContainers->sortBy('name',SORT_NATURAL) as $resource)
|
</tbody>
|
||||||
<tr>
|
</table>
|
||||||
<td class="px-5 py-4 text-sm whitespace-nowrap">
|
|
||||||
{{ data_get($resource, 'Names') }}
|
|
||||||
</td>
|
|
||||||
<td class="px-5 py-4 text-sm whitespace-nowrap">
|
|
||||||
{{ data_get($resource, 'Image') }}
|
|
||||||
</td>
|
|
||||||
<td class="px-5 py-4 text-sm whitespace-nowrap">
|
|
||||||
{{ data_get($resource, 'State') }}
|
|
||||||
</td>
|
|
||||||
<td class="flex gap-2 px-5 py-4 text-sm whitespace-nowrap">
|
|
||||||
@if (data_get($resource, 'State') === 'running')
|
|
||||||
<x-forms.button
|
|
||||||
wire:click="restartUnmanaged('{{ data_get($resource, 'ID') }}')"
|
|
||||||
wire:key="{{ data_get($resource, 'ID') }}">Restart</x-forms.button>
|
|
||||||
<x-forms.button isError
|
|
||||||
wire:click="stopUnmanaged('{{ data_get($resource, 'ID') }}')"
|
|
||||||
wire:key="{{ data_get($resource, 'ID') }}">Stop</x-forms.button>
|
|
||||||
@elseif (data_get($resource, 'State') === 'exited')
|
|
||||||
<x-forms.button
|
|
||||||
wire:click="startUnmanaged('{{ data_get($resource, 'ID') }}')"
|
|
||||||
wire:key="{{ data_get($resource, 'ID') }}">Start</x-forms.button>
|
|
||||||
@elseif (data_get($resource, 'State') === 'restarting')
|
|
||||||
<x-forms.button
|
|
||||||
wire:click="stopUnmanaged('{{ data_get($resource, 'ID') }}')"
|
|
||||||
wire:key="{{ data_get($resource, 'ID') }}">Stop</x-forms.button>
|
|
||||||
@endif
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
@empty
|
|
||||||
@endforelse
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@else
|
</div>
|
||||||
<div>No resources found.</div>
|
@else
|
||||||
@endif
|
<div>No resources found.</div>
|
||||||
</div>
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@else
|
</div>
|
||||||
<div>Server is not validated. Validate first.</div>
|
|
||||||
@endif
|
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user