Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

feat(executions): add 'Load All' button to view all logs and implement loadAllLogs method for complete log retrieval

Andras Bacsai97428a4a8043
diff --git a/app/Livewire/Project/Shared/ScheduledTask/Executions.php b/app/Livewire/Project/Shared/ScheduledTask/Executions.php
index 6f62a5b5bf..ca2bbd9b45 100644
--- a/app/Livewire/Project/Shared/ScheduledTask/Executions.php
+++ b/app/Livewire/Project/Shared/ScheduledTask/Executions.php
@@ -105,6 +105,19 @@ class Executions extends Component
$this->currentPage++;
}
+ public function loadAllLogs()
+ {
+ if (! $this->selectedExecution || ! $this->selectedExecution->message) {
+ return;
+ }
+
+ $lines = collect(explode("\n", $this->selectedExecution->message));
+ $totalLines = $lines->count();
+ $totalPages = ceil($totalLines / $this->logsPerPage);
+
+ $this->currentPage = $totalPages;
+ }
+
public function getLogLinesProperty()
{
if (! $this->selectedExecution) {
diff --git a/resources/views/livewire/project/shared/scheduled-task/executions.blade.php b/resources/views/livewire/project/shared/scheduled-task/executions.blade.php
index 8f0f309c64..2ed3adc0c9 100644
--- a/resources/views/livewire/project/shared/scheduled-task/executions.blade.php
+++ b/resources/views/livewire/project/shared/scheduled-task/executions.blade.php
@@ -14,7 +14,7 @@
}">
@forelse($executions as $execution)
<a wire:click="selectTask({{ data_get($execution, 'id') }})" @class([
- 'flex flex-col border-l-2 transition-colors p-4 cursor-pointer bg-white hover:bg-gray-100 dark:bg-coolgray-100 dark:hover:bg-coolgray-200 text-black dark:text-white',
+ 'relative flex flex-col border-l-2 transition-colors p-4 cursor-pointer bg-white hover:bg-gray-100 dark:bg-coolgray-100 dark:hover:bg-coolgray-200 text-black dark:text-white',
'bg-gray-200 dark:bg-coolgray-200' => data_get($execution, 'id') == $selectedKey,
'border-blue-500/50 border-dashed' => data_get($execution, 'status') === 'running',
'border-error' => data_get($execution, 'status') === 'failed',
@@ -67,18 +67,22 @@
@endif
@if ($this->logLines->isNotEmpty())
<div>
- <pre class="whitespace-pre-wrap">
+ <div class="max-h-[600px] overflow-y-auto border border-gray-200 dark:border-coolgray-300 rounded p-4 bg-gray-50 dark:bg-coolgray-100 scrollbar">
+ <pre class="whitespace-pre-wrap">
@foreach ($this->logLines as $line)
{{ $line }}
@endforeach
</pre>
- <div class="flex gap-2">
+ </div>
+ <div class="flex gap-2 mt-4">
@if ($this->hasMoreLogs())
<x-forms.button wire:click.prevent="loadMoreLogs" isHighlighted>
Load More
</x-forms.button>
+ <x-forms.button wire:click.prevent="loadAllLogs">
+ Load All
+ </x-forms.button>
@endif
-
</div>
</div>
@else