feat: logs and execute commands with several servers
This commit is contained in:
@@ -12,23 +12,44 @@
|
||||
@elseif ($type === 'service')
|
||||
<h2>Execute Command</h2>
|
||||
@endif
|
||||
@if (count($containers) > 0)
|
||||
<form class="flex flex-col gap-2 pt-4" wire:submit='runCommand'>
|
||||
<div class="flex gap-2">
|
||||
<x-forms.input placeholder="ls -l" autofocus id="command" label="Command" required />
|
||||
<x-forms.input id="workDir" label="Working directory" />
|
||||
</div>
|
||||
<x-forms.select label="Container" id="container" required>
|
||||
<option disabled selected>Select container</option>
|
||||
@foreach ($containers as $container)
|
||||
<option value="{{ $container }}">{{ $container }}</option>
|
||||
@endforeach
|
||||
</x-forms.select>
|
||||
<x-forms.button type="submit">Run</x-forms.button>
|
||||
</form>
|
||||
@else
|
||||
<div class="pt-4">No containers are not running.</div>
|
||||
@endif
|
||||
<div x-init="$wire.loadContainers">
|
||||
<div class="pt-4" wire:loading wire:target='loadContainers'>
|
||||
Loading containers...
|
||||
</div>
|
||||
<div wire:loading.remove wire:target='loadContainers'>
|
||||
@if (count($containers) > 0)
|
||||
<form class="flex flex-col gap-2 pt-4" wire:submit='runCommand'>
|
||||
<div class="flex gap-2">
|
||||
<x-forms.input placeholder="ls -l" autofocus id="command" label="Command" required />
|
||||
<x-forms.input id="workDir" label="Working directory" />
|
||||
</div>
|
||||
<x-forms.select label="Container" id="container" required>
|
||||
<option disabled selected>Select container</option>
|
||||
@if (data_get($this->parameters, 'application_uuid'))
|
||||
@foreach ($containers as $container)
|
||||
<option value="{{ data_get($container, 'container.Names') }}">
|
||||
{{ data_get($container, 'container.Names') }}
|
||||
</option>
|
||||
@endforeach
|
||||
@elseif(data_get($this->parameters, 'service_uuid'))
|
||||
@foreach ($containers as $container)
|
||||
<option value="{{ $container }}">
|
||||
{{ $container }}
|
||||
</option>
|
||||
@endforeach
|
||||
@else
|
||||
<option value="{{ $container }}">
|
||||
{{ $container }}
|
||||
</option>
|
||||
@endif
|
||||
</x-forms.select>
|
||||
<x-forms.button type="submit">Run</x-forms.button>
|
||||
</form>
|
||||
@else
|
||||
<div class="pt-4">No containers are not running.</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<div class="container w-full pt-10 mx-auto">
|
||||
<livewire:activity-monitor header="Command output" />
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
<div>
|
||||
<div x-init="$wire.getLogs" id="screen" x-data="{ fullscreen: false, alwaysScroll: false, intervalId: null }">
|
||||
<div class="flex items-center gap-2">
|
||||
<h3>{{ str($container)->beforeLast('-')->headline() }}</h3>
|
||||
@if ($resource->type() === 'application')
|
||||
<h3>{{ $container }}</h3>
|
||||
@else
|
||||
<h3>{{ str($container)->beforeLast('-')->headline() }}</h3>
|
||||
@endif
|
||||
<div>Server: {{ $server->name }} </div>
|
||||
@if ($pull_request)
|
||||
<div>({{ $pull_request }})</div>
|
||||
@endif
|
||||
|
||||
@@ -3,14 +3,20 @@
|
||||
<h1>Logs</h1>
|
||||
<livewire:project.application.heading :application="$resource" />
|
||||
<div class="pt-4">
|
||||
@forelse ($containers as $container)
|
||||
@if ($loop->first)
|
||||
<h2 class="pb-4">Logs</h2>
|
||||
@endif
|
||||
<livewire:project.shared.get-logs :server="$server" :resource="$resource" :container="$container" />
|
||||
@empty
|
||||
<div>No containers are not running.</div>
|
||||
@endforelse
|
||||
<h2 class="pb-4">Logs</h2>
|
||||
<div class="pt-2" wire:loading wire:target="loadContainers">
|
||||
Loading containers...
|
||||
</div>
|
||||
@foreach ($servers as $server)
|
||||
<h3 x-init="$wire.loadContainers({{ $server->id }})"></h3>
|
||||
<div wire:loading.remove wire:target="loadContainers">
|
||||
@forelse (data_get($server,'containers',[]) as $container)
|
||||
<livewire:project.shared.get-logs :server="$server" :resource="$resource" :container="data_get($container,'Names')" />
|
||||
@empty
|
||||
<div class="pt-2">No containers are not running on server: {{$server->name}}</div>
|
||||
@endforelse
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@elseif ($type === 'database')
|
||||
<h1>Logs</h1>
|
||||
@@ -20,9 +26,9 @@
|
||||
@if ($loop->first)
|
||||
<h2 class="pb-4">Logs</h2>
|
||||
@endif
|
||||
<livewire:project.shared.get-logs :server="$server" :resource="$resource" :container="$container" />
|
||||
<livewire:project.shared.get-logs :server="$servers[0]" :resource="$resource" :container="$container" />
|
||||
@empty
|
||||
<div>No containers are not running.</div>
|
||||
<div class="pt-2">No containers are not running.</div>
|
||||
@endforelse
|
||||
</div>
|
||||
@elseif ($type === 'service')
|
||||
@@ -31,9 +37,9 @@
|
||||
@if ($loop->first)
|
||||
<h2 class="pb-4">Logs</h2>
|
||||
@endif
|
||||
<livewire:project.shared.get-logs :server="$server" :resource="$resource" :container="$container" />
|
||||
<livewire:project.shared.get-logs :server="$servers[0]" :resource="$resource" :container="$container" />
|
||||
@empty
|
||||
<div>No containers are not running.</div>
|
||||
<div class="pt-2">No containers are not running.</div>
|
||||
@endforelse
|
||||
</div>
|
||||
@endif
|
||||
|
||||
Reference in New Issue
Block a user