refactor history view to use Livewire component for dynamic updates; add navigation links for upload and processing history
parent
513f8ce671
commit
a114325425
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire;
|
||||
|
||||
use App\Models\ProcessHistories;
|
||||
use Livewire\Component;
|
||||
|
||||
class History extends Component
|
||||
{
|
||||
public $histories;
|
||||
|
||||
protected $listeners = ['refreshHistory' => '$refresh'];
|
||||
|
||||
public function mount()
|
||||
{
|
||||
$this->loadHistories();
|
||||
}
|
||||
|
||||
public function loadHistories()
|
||||
{
|
||||
$this->histories = ProcessHistories::orderBy('id', 'desc')->get();
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.history');
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
<div class="p-4" wire:poll.750ms>
|
||||
<h1 class="text-2xl font-bold mb-4">История обработок</h1>
|
||||
<table class="min-w-full border-collapse">
|
||||
<thead>
|
||||
<tr class="border-b">
|
||||
<th class="p-2 text-left">ID</th>
|
||||
<th class="p-2 text-left">Изображения</th>
|
||||
<th class="p-2 text-left">Step файл</th>
|
||||
<th class="p-2 text-left">Время начала</th>
|
||||
<th class="p-2 text-left">Время окончания</th>
|
||||
<th class="p-2 text-left">Обработано</th>
|
||||
<th class="p-2 text-left">Затраты времени (сек)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($histories as $h)
|
||||
<tr class="border-b">
|
||||
<td class="p-2">{{ $h->id }}</td>
|
||||
<td class="p-2">
|
||||
@foreach($h->images as $img)
|
||||
<div>{{ $img['original_name'] }} ({{ $img['path'] }})</div>
|
||||
@endforeach
|
||||
</td>
|
||||
<td class="p-2">{{ $h->step_file_name }}</td>
|
||||
<td class="p-2">{{ $h->started_at }}</td>
|
||||
<td class="p-2">{{ $h->finished_at }}</td>
|
||||
<td class="p-2">{{ $h->processed_count }}/3</td>
|
||||
<td class="p-2">
|
||||
@if($h->stages_timing)
|
||||
Очередь: {{ $h->stages_timing['queue_wait_time'] ?? 'N/A' }}<br>
|
||||
Загрузка: {{ $h->stages_timing['upload_time'] ?? 'N/A' }}<br>
|
||||
Обработка: {{ $h->stages_timing['processing_time'] ?? 'N/A' }}<br>
|
||||
Сохранение: {{ $h->stages_timing['saving_time'] ?? 'N/A' }}<br>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
Loading…
Reference in new issue