From f384d1bd72b7ca11446980fb91ef4085596eb9e2 Mon Sep 17 00:00:00 2001 From: Kamran Biglari Date: Tue, 27 Aug 2024 20:30:03 +0100 Subject: [PATCH] details action --- resources/lang/cs/translations.php | 1 + resources/lang/de/translations.php | 1 + resources/lang/en/translations.php | 1 + resources/lang/es/translations.php | 1 + resources/lang/fr/translations.php | 1 + resources/lang/it/translations.php | 3 ++- resources/lang/sk/translations.php | 1 + resources/views/queue-monitor-details.blade.php | 8 ++++++++ src/FilamentJobsMonitorServiceProvider.php | 1 + src/Resources/QueueMonitorResource.php | 12 ++++++++++++ 10 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 resources/views/queue-monitor-details.blade.php diff --git a/resources/lang/cs/translations.php b/resources/lang/cs/translations.php index e8dc17a..185f878 100644 --- a/resources/lang/cs/translations.php +++ b/resources/lang/cs/translations.php @@ -16,4 +16,5 @@ 'queue' => 'Fronta', 'progress' => 'Pokrok', 'started_at' => 'Čas spuštění', + 'details' => 'Podrobnosti', ]; diff --git a/resources/lang/de/translations.php b/resources/lang/de/translations.php index 26713de..ebdf76a 100644 --- a/resources/lang/de/translations.php +++ b/resources/lang/de/translations.php @@ -17,4 +17,5 @@ 'queue' => 'Queue', 'progress' => 'Fortschritt', 'started_at' => 'Gestartet am', + 'details' => 'Details', ]; diff --git a/resources/lang/en/translations.php b/resources/lang/en/translations.php index 0638e1e..9450238 100644 --- a/resources/lang/en/translations.php +++ b/resources/lang/en/translations.php @@ -17,4 +17,5 @@ 'queue' => 'Queue', 'progress' => 'Progress', 'started_at' => 'Started at', + 'details' => 'Details', ]; diff --git a/resources/lang/es/translations.php b/resources/lang/es/translations.php index 8be430f..fb6ba37 100644 --- a/resources/lang/es/translations.php +++ b/resources/lang/es/translations.php @@ -17,4 +17,5 @@ 'queue' => 'Cola', 'progress' => 'Progreso', 'started_at' => 'Iniciado a las', + 'details' => 'Detalles', ]; diff --git a/resources/lang/fr/translations.php b/resources/lang/fr/translations.php index e7fde6a..9d2584b 100644 --- a/resources/lang/fr/translations.php +++ b/resources/lang/fr/translations.php @@ -17,4 +17,5 @@ 'queue' => 'File', 'progress' => 'Progression', 'started_at' => 'Débuté à', + 'details' => 'Détails', ]; diff --git a/resources/lang/it/translations.php b/resources/lang/it/translations.php index 9cdf413..c13d356 100755 --- a/resources/lang/it/translations.php +++ b/resources/lang/it/translations.php @@ -15,5 +15,6 @@ "status" => "Stato", "succeeded" => "Riuscito", "title" => "Lavori in coda", - "total_jobs" => "Totale lavori eseguiti" + "total_jobs" => "Totale lavori eseguiti", + "details" => "Dettagli" ]; diff --git a/resources/lang/sk/translations.php b/resources/lang/sk/translations.php index 44004b6..95b78a6 100644 --- a/resources/lang/sk/translations.php +++ b/resources/lang/sk/translations.php @@ -17,4 +17,5 @@ 'queue' => 'Front', 'progress' => 'Progres', 'started_at' => 'Začaté', + 'details' => 'Detaily', ]; diff --git a/resources/views/queue-monitor-details.blade.php b/resources/views/queue-monitor-details.blade.php new file mode 100644 index 0000000..e2fbef3 --- /dev/null +++ b/resources/views/queue-monitor-details.blade.php @@ -0,0 +1,8 @@ +

Attempts

+{{ $attempts }} + +

Failed

+{{ $failed }} + +

Exception

+{{ $exception_message }} \ No newline at end of file diff --git a/src/FilamentJobsMonitorServiceProvider.php b/src/FilamentJobsMonitorServiceProvider.php index 4a9a9b3..9cd5347 100644 --- a/src/FilamentJobsMonitorServiceProvider.php +++ b/src/FilamentJobsMonitorServiceProvider.php @@ -12,6 +12,7 @@ class FilamentJobsMonitorServiceProvider extends PackageServiceProvider public function configurePackage(Package $package): void { $package->name(static::$name) + ->hasViews() ->hasConfigFile() ->hasTranslations() ->hasMigration('create_filament-jobs-monitor_table'); diff --git a/src/Resources/QueueMonitorResource.php b/src/Resources/QueueMonitorResource.php index 2e61f49..c93c1e9 100644 --- a/src/Resources/QueueMonitorResource.php +++ b/src/Resources/QueueMonitorResource.php @@ -18,6 +18,7 @@ use Filament\Tables\Table; use Illuminate\Contracts\Database\Eloquent\Builder; use Illuminate\Support\Str; +use Filament\Tables\Actions\Action as FilamentTableAction; class QueueMonitorResource extends Resource { @@ -74,6 +75,17 @@ public static function table(Table $table): Table ->sortable(), ]) ->defaultSort('started_at', 'desc') + ->actions([ + FilamentTableAction::make('details') + ->label(__('filament-jobs-monitor::translations.details')) + ->icon('heroicon-o-information-circle') + ->modalContent(fn (QueueMonitor $queueMonitor) => view('filament-jobs-monitor::queue-monitor-details',[ + 'exception_message' => $queueMonitor->exception_message, + 'failed' => $queueMonitor->failed, + 'attempts' => $queueMonitor->attempt, + ])) + ->modalSubmitAction(false), + ]) ->bulkActions([ DeleteBulkAction::make(), ])