Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
adrolli committed Aug 29, 2023
0 parents commit 1a7ff14
Show file tree
Hide file tree
Showing 24 changed files with 1,757 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
37 changes: 37 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Changelog

All notable changes to `filament-job-manager` will be documented in this file.

## v0.6.1 - 2022-12-08

- focus relevant information in failed jobs index table

## v0.6.0 - 2022-10-06

- introduce https://github.com/invaders-xx/filament-jsoneditor for `payload`

## v0.5.1 - 2022-09-08

- do not show 'options' column in JobBatchesResource

## v0.5.0 - 2022-09-08

- place FailedJobResource and JobBatchesResource in 'jobs' Navigation Group

## v0.4.0 - 2022-08-29

- introduced ability to delete failed jobs or job batches

## v0.3.2 - 2022-08-29

- introduced `job_batches` Resource (if the sql table is present)

## v0.2.0 - 2022-08-09

- introduced 'view' ViewAction to see job details as popup
- introduced Bulk Action for Retry
- introduced 'Retry all failed jobs' Button

## v0.1.0 - 2022-08-09

- initial release
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) thyseus <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
59 changes: 59 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Filament Job Manager

Work in progress. Should become a Filament panel for managing job queues including failed jobs and batches. Currently buggy as hell.

## Installation

You should install the package via Composer:

```bash
composer require adrolli/filament-job-manager
php artisan vendor:publish --tag=filament-job-manager
```

### Authorization

If you would like to prevent certain users from accessing your page, you should register a policy:

```php
use App\Policies\FailedJobPolicy;
use Adrolli\FilamentJobManager\Models\FailedJob;
use Adrolli\FilamentJobManager\Models\JobBatch;

class AuthServiceProvider extends ServiceProvider
{
protected $policies = [
FailedJob::class => FailedJobPolicy::class,
JobBatch::class => JobBatchPolicy::class,
];
}
```

```php
namespace App\Policies;

use App\Models\User;
use Illuminate\Auth\Access\HandlesAuthorization;

class FailedJobPolicy
{
use HandlesAuthorization;

public function viewAny(User $user): bool
{
return $user->can('manage_failed_jobs');
}
}
```

(same for JobPolicy and JobBatchPolicy, if necessary).

This will prevent the navigation item(s) from being registered.

## Changelog

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
51 changes: 51 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"name": "adrolli/filament-job-manager",
"description": "A Filament manager for job queues including failed jobs and batches.",
"keywords": [
"laravel",
"filament",
"jobs",
"queues",
"failed-jobs",
"batches",
"monitor",
"redis"
],
"homepage": "https://github.com/adrolli/filament-job-manager",
"license": "MIT",
"authors": [
{
"name": "Alf Drollinger",
"email": "[email protected]",
"role": "Developer"
}
],
"require": {
"php": "^8.0.2",
"spatie/laravel-package-tools": "^1.9.2",
"invaders-xx/filament-jsoneditor": "^3.0",
"filament/filament": "^3.0"
},
"require-dev": {},
"autoload": {
"psr-4": {
"Adrolli\\FilamentJobManager\\": "src"
}
},
"config": {
"sort-packages": true
},
"extra": {
"laravel": {
"providers": [
"Adrolli\\FilamentJobManager\\FilamentJobManagerServiceProvider",
"Adrolli\\FilamentJobManager\\JobMonitorProvider"
],
"aliases": {
"JobMonitor": "Adrolli\\FilamentJobManager\\QueueMonitorProvider\\Facade"
}
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
40 changes: 40 additions & 0 deletions config/filament-failed-jobs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

return [
'resources' => [
'jobs' => [
'enabled' => true,
'label' => 'Job',
'plural_label' => 'Jobs',
'navigation_group' => 'Job manager',
'navigation_icon' => 'heroicon-o-cpu-chip',
'navigation_sort' => 1,
'navigation_count_badge' => false,
'resource' => Adrolli\FilamentJobManager\Resources\JobsResource::class,
],
'failed_jobs' => [
'enabled' => true,
'label' => 'Failed Job',
'plural_label' => 'Failed Jobs',
'navigation_group' => 'Job manager',
'navigation_icon' => 'heroicon-o-exclamation-circle',
'navigation_sort' => 2,
'navigation_count_badge' => false,
'resource' => Adrolli\FilamentJobManager\Resources\FailedJobsResource::class,
],
'job_batches' => [
'enabled' => true,
'label' => 'Job Batch',
'plural_label' => 'Job Batches',
'navigation_group' => 'Job manager',
'navigation_icon' => 'heroicon-o-inbox-stack',
'navigation_sort' => 3,
'navigation_count_badge' => false,
'resource' => Adrolli\FilamentJobManager\Resources\JobBatchesResource::class,
],
],
'pruning' => [
'enabled' => true,
'retention_days' => 7,
],
];
19 changes: 19 additions & 0 deletions resources/lang/en/translations.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

return [
'breadcrumb' => 'Queued Jobs Monitor',
'title' => 'Queued Jobs',
'navigation_label' => 'Jobs',
'navigation_group' => 'System',
'total_jobs' => 'Total Jobs Executed',
'execution_time' => 'Total Execution Time',
'average_time' => 'Average Execution Time',
'succeeded' => 'Succeeded',
'failed' => 'Failed',
'running' => 'Running',
'status' => 'Status',
'name' => 'Name',
'queue' => 'Queue',
'progress' => 'Progress',
'started_at' => 'Started at',
];
19 changes: 19 additions & 0 deletions resources/lang/es/translations.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

return [
'breadcrumb' => 'Monitor de Trabajos En Cola',
'title' => 'Trabajos En Cola',
'navigation_label' => 'Trabajos',
'navigation_group' => 'Sistema',
'total_jobs' => 'Total Trabajos Ejecutados',
'execution_time' => 'Tiempo Total de Ejecución',
'average_time' => 'Tiempo Promedio de Ejecución',
'succeeded' => 'Exitoso',
'failed' => 'Fallido',
'running' => 'En ejecución',
'status' => 'Estado',
'name' => 'Nombre',
'queue' => 'Cola',
'progress' => 'Progreso',
'started_at' => 'Iniciado a las',
];
19 changes: 19 additions & 0 deletions resources/lang/fr/translations.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

return [
'breadcrumb' => 'Monitor de Jobs En File',
'title' => 'Jobs',
'navigation_label' => 'Jobs',
'navigation_group' => 'Système',
'total_jobs' => 'Total Jobs Executé(s)',
'execution_time' => "Temps Total d'Execution",
'average_time' => "Temps moyen d'Execution",
'succeeded' => 'Succes',
'failed' => 'Echec',
'running' => 'En cours',
'status' => 'Statut',
'name' => 'Nom',
'queue' => 'File',
'progress' => 'Progression',
'started_at' => 'Débuté à',
];
Loading

0 comments on commit 1a7ff14

Please sign in to comment.