fix: server stopped, service page not reachable
This commit is contained in:
parent
adf5c9bd46
commit
b39ac73cd8
@ -71,6 +71,9 @@ class GetLogs extends Component
|
|||||||
}
|
}
|
||||||
public function getLogs($refresh = false)
|
public function getLogs($refresh = false)
|
||||||
{
|
{
|
||||||
|
if (!$this->server->isFunctional()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if ($this->resource?->getMorphClass() === 'App\Models\Application') {
|
if ($this->resource?->getMorphClass() === 'App\Models\Application') {
|
||||||
if (str($this->container)->contains('-pr-')) {
|
if (str($this->container)->contains('-pr-')) {
|
||||||
$this->pull_request = "Pull Request: " . str($this->container)->afterLast('-pr-')->beforeLast('_')->value();
|
$this->pull_request = "Pull Request: " . str($this->container)->afterLast('-pr-')->beforeLast('_')->value();
|
||||||
|
@ -29,6 +29,9 @@ class Logs extends Component
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$server = $this->servers->firstWhere('id', $server_id);
|
$server = $this->servers->firstWhere('id', $server_id);
|
||||||
|
if (!$server->isFunctional()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if ($server->isSwarm()) {
|
if ($server->isSwarm()) {
|
||||||
$containers = collect([
|
$containers = collect([
|
||||||
[
|
[
|
||||||
@ -96,7 +99,6 @@ class Logs extends Component
|
|||||||
$this->resource->databases()->get()->each(function ($database) {
|
$this->resource->databases()->get()->each(function ($database) {
|
||||||
$this->containers->push(data_get($database, 'name') . '-' . data_get($this->resource, 'uuid'));
|
$this->containers->push(data_get($database, 'name') . '-' . data_get($this->resource, 'uuid'));
|
||||||
});
|
});
|
||||||
|
|
||||||
if ($this->resource->server->isFunctional()) {
|
if ($this->resource->server->isFunctional()) {
|
||||||
$this->servers = $this->servers->push($this->resource->server);
|
$this->servers = $this->servers->push($this->resource->server);
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<div class="pt-2" wire:loading wire:target="loadContainers">
|
<div class="pt-2" wire:loading wire:target="loadContainers">
|
||||||
Loading containers...
|
Loading containers...
|
||||||
</div>
|
</div>
|
||||||
@foreach ($servers as $server)
|
@forelse ($servers as $server)
|
||||||
<h3 x-init="$wire.loadContainers({{ $server->id }})"></h3>
|
<h3 x-init="$wire.loadContainers({{ $server->id }})"></h3>
|
||||||
<div wire:loading.remove wire:target="loadContainers">
|
<div wire:loading.remove wire:target="loadContainers">
|
||||||
@forelse (data_get($server,'containers',[]) as $container)
|
@forelse (data_get($server,'containers',[]) as $container)
|
||||||
@ -16,7 +16,9 @@
|
|||||||
<div class="pt-2">No containers are not running on server: {{ $server->name }}</div>
|
<div class="pt-2">No containers are not running on server: {{ $server->name }}</div>
|
||||||
@endforelse
|
@endforelse
|
||||||
</div>
|
</div>
|
||||||
@endforeach
|
@empty
|
||||||
|
<div>No functional server found for the application.</div>
|
||||||
|
@endforelse
|
||||||
</div>
|
</div>
|
||||||
@elseif ($type === 'database')
|
@elseif ($type === 'database')
|
||||||
<h1>Logs</h1>
|
<h1>Logs</h1>
|
||||||
@ -26,7 +28,11 @@
|
|||||||
@if ($loop->first)
|
@if ($loop->first)
|
||||||
<h2 class="pb-4">Logs</h2>
|
<h2 class="pb-4">Logs</h2>
|
||||||
@endif
|
@endif
|
||||||
<livewire:project.shared.get-logs :server="$servers[0]" :resource="$resource" :container="$container" />
|
@if (data_get($servers, '0'))
|
||||||
|
<livewire:project.shared.get-logs :server="data_get($servers, '0')" :resource="$resource" :container="$container" />
|
||||||
|
@else
|
||||||
|
<div> No functional server found for the database.</div>
|
||||||
|
@endif
|
||||||
@empty
|
@empty
|
||||||
<div class="pt-2">No containers are not running.</div>
|
<div class="pt-2">No containers are not running.</div>
|
||||||
@endforelse
|
@endforelse
|
||||||
@ -37,7 +43,11 @@
|
|||||||
@if ($loop->first)
|
@if ($loop->first)
|
||||||
<h2 class="pb-4">Logs</h2>
|
<h2 class="pb-4">Logs</h2>
|
||||||
@endif
|
@endif
|
||||||
<livewire:project.shared.get-logs :server="$servers[0]" :resource="$resource" :container="$container" />
|
@if (data_get($servers, '0'))
|
||||||
|
<livewire:project.shared.get-logs :server="data_get($servers, '0')" :resource="$resource" :container="$container" />
|
||||||
|
@else
|
||||||
|
<div> No functional server found for the service.</div>
|
||||||
|
@endif
|
||||||
@empty
|
@empty
|
||||||
<div class="pt-2">No containers are not running.</div>
|
<div class="pt-2">No containers are not running.</div>
|
||||||
@endforelse
|
@endforelse
|
||||||
|
Loading…
x
Reference in New Issue
Block a user