- Add tenantpilot.bulk_operations config (chunk size, poll interval) - Use config chunk size across all bulk jobs - Make progress widget polling interval configurable - Document settings in README + feature quickstart; mark tasks done
51 lines
1.1 KiB
PHP
51 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Livewire;
|
|
|
|
use App\Models\BulkOperationRun;
|
|
use App\Models\Tenant;
|
|
use Livewire\Attributes\Computed;
|
|
use Livewire\Component;
|
|
|
|
class BulkOperationProgress extends Component
|
|
{
|
|
public $runs;
|
|
|
|
public int $pollSeconds = 3;
|
|
|
|
public function mount()
|
|
{
|
|
$this->pollSeconds = max(1, min(10, (int) config('tenantpilot.bulk_operations.poll_interval_seconds', 3)));
|
|
$this->loadRuns();
|
|
}
|
|
|
|
#[Computed]
|
|
public function activeRuns()
|
|
{
|
|
return $this->runs;
|
|
}
|
|
|
|
public function loadRuns()
|
|
{
|
|
try {
|
|
$tenant = Tenant::current();
|
|
} catch (\RuntimeException $e) {
|
|
$this->runs = collect();
|
|
|
|
return;
|
|
}
|
|
|
|
$this->runs = BulkOperationRun::query()
|
|
->where('tenant_id', $tenant->id)
|
|
->where('user_id', auth()->id())
|
|
->whereIn('status', ['pending', 'running'])
|
|
->orderByDesc('created_at')
|
|
->get();
|
|
}
|
|
|
|
public function render(): \Illuminate\Contracts\View\View
|
|
{
|
|
return view('livewire.bulk-operation-progress');
|
|
}
|
|
}
|