36 lines
1.2 KiB
PHP
36 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\StationResource\Pages;
|
|
|
|
use App\Filament\Resources\StationResource;
|
|
use App\Jobs\PollFuelPricesJob;
|
|
use Filament\Actions\Action;
|
|
use Filament\Notifications\Notification;
|
|
use Filament\Resources\Pages\ListRecords;
|
|
|
|
class ListStations extends ListRecords
|
|
{
|
|
protected static string $resource = StationResource::class;
|
|
|
|
protected function getHeaderActions(): array
|
|
{
|
|
return [
|
|
Action::make('triggerFullPoll')
|
|
->label('Trigger Full Poll')
|
|
->icon('heroicon-o-arrow-path')
|
|
->requiresConfirmation()
|
|
->modalHeading('Trigger full station refresh?')
|
|
->modalDescription('This dispatches a background job to refresh all ~14,500 stations from the Fuel Finder API. Results will appear in API Logs once complete.')
|
|
->action(function () {
|
|
PollFuelPricesJob::dispatch();
|
|
|
|
Notification::make()
|
|
->title('Poll dispatched to queue')
|
|
->body('Check API Logs once the job completes.')
|
|
->success()
|
|
->send();
|
|
}),
|
|
];
|
|
}
|
|
}
|