From c8332ca9bf8e9441c6e2bfe6cd2ef21afa577642 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 28 Feb 2024 09:51:45 +0100 Subject: [PATCH] fix: resource tab not loading if server is not reachable --- app/Models/Server.php | 24 ++++++++++--------- public/svgs/internal-link.svg | 3 +++ .../views/components/internal-link.blade.php | 1 + .../views/livewire/server/resources.blade.php | 2 +- 4 files changed, 18 insertions(+), 12 deletions(-) create mode 100644 public/svgs/internal-link.svg create mode 100644 resources/views/components/internal-link.blade.php diff --git a/app/Models/Server.php b/app/Models/Server.php index 73e10a587..d43256c8d 100644 --- a/app/Models/Server.php +++ b/app/Models/Server.php @@ -263,17 +263,19 @@ public function startUnmanaged($id) } public function loadUnmanagedContainers() { - $containers = instant_remote_process(["docker ps -a --format '{{json .}}' "], $this); - $containers = format_docker_command_output_to_json($containers); - $containers = $containers->map(function ($container) { - $labels = data_get($container, 'Labels'); - if (!str($labels)->contains("coolify.managed")) { - return $container; - } - return null; - }); - $containers = $containers->filter(); - return collect($containers); + if ($this->isFunctional()) { + $containers = instant_remote_process(["docker ps -a --format '{{json .}}' "], $this); + $containers = format_docker_command_output_to_json($containers); + $containers = $containers->map(function ($container) { + $labels = data_get($container, 'Labels'); + if (!str($labels)->contains("coolify.managed")) { + return $container; + } + return null; + }); + $containers = $containers->filter(); + return collect($containers); + } } public function hasDefinedResources() { diff --git a/public/svgs/internal-link.svg b/public/svgs/internal-link.svg new file mode 100644 index 000000000..a85b16d47 --- /dev/null +++ b/public/svgs/internal-link.svg @@ -0,0 +1,3 @@ + + + diff --git a/resources/views/components/internal-link.blade.php b/resources/views/components/internal-link.blade.php new file mode 100644 index 000000000..19fe52635 --- /dev/null +++ b/resources/views/components/internal-link.blade.php @@ -0,0 +1 @@ + diff --git a/resources/views/livewire/server/resources.blade.php b/resources/views/livewire/server/resources.blade.php index 2f43960f1..9c943eb65 100644 --- a/resources/views/livewire/server/resources.blade.php +++ b/resources/views/livewire/server/resources.blade.php @@ -45,7 +45,7 @@ {{ data_get($resource, 'environment.name') }} {{ $resource->name }} + href="{{ $resource->link() }}">{{ $resource->name }} {{ str($resource->type())->headline() }}