feat(executions): add 'Load All' button to view all logs and implement loadAllLogs method for complete log retrieval
This commit is contained in:
parent
e4c3389e12
commit
97428a4a80
2 changed files with 21 additions and 4 deletions
|
|
@ -105,6 +105,19 @@ public function loadMoreLogs()
|
|||
$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) {
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
<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
|
||||
|
|
|
|||
Loading…
Reference in a new issue