Coder Social home page Coder Social logo

hamrak / filament-jobs-monitor Goto Github PK

View Code? Open in Web Editor NEW

This project forked from croustibat/filament-jobs-monitor

0.0 0.0 0.0 99 KB

Queue Monitoring Package for Filament

Home Page: https://filamentphp.com/plugins/jobs-monitor

License: MIT License

JavaScript 2.25% PHP 97.75%

filament-jobs-monitor's Introduction

Background Jobs monitoring like Horizon for all drivers for FilamentPHP

Latest Version on Packagist Total Downloads

This is a package to monitor background jobs for FilamentPHP. It is inspired by Laravel Horizon and is compatible with all drivers.

Screenshot 2023-09-13 at 23 18 44 Screenshot 2023-09-13 at 23 18 23

Installation

Check your filamentPHP version before installing:

Version FilamentPHP PHP
1.* 2.* 8.1.*
2.* 3.* 8.1.* | 8.2.*

Install the package via composer:

composer require croustibat/filament-jobs-monitor

Publish and run the migrations using:

php artisan vendor:publish --tag="filament-jobs-monitor-migrations"
php artisan migrate

Usage

Configuration

The global plugin config can be published using the command below:

php artisan vendor:publish --tag="filament-jobs-monitor-config"

This is the content of the published config file:

return [
    'resources' => [
        'enabled' => true,
        'label' => 'Job',
        'plural_label' => 'Jobs',
        'navigation_group' => 'Settings',
        'navigation_icon' => 'heroicon-o-cpu-chip',
        'navigation_sort' => null,
        'navigation_count_badge' => false,
        'resource' => Croustibat\FilamentJobsMonitor\Resources\QueueMonitorResource::class,
    ],
    'pruning' => [
        'enabled' => true,
        'retention_days' => 7,
    ],
];

Extending Model

Sometimes it's useful to extend the model to add some custom methods. You can do it by extending the model by creating your own model :

$ php artisan make:model MyQueueMonitor

Then you can extend the model by adding your own methods :

    <?php

    namespace App\Models;

    use \Croustibat\FilamentJobsMonitor\Models\QueueMonitor as CroustibatQueueMonitor;

    class MyQueueMonitor extends CroustibatQueueMonitor {}

Using Filament Panels

If you are using Filament Panels, you can register the Plugin to your Panel configuration. This will register the plugin's resources as well as allow you to set configuration using optional chainable methods.

For example in your app/Providers/Filament/AdminPanelProvider.php file:

<?php


use \Croustibat\FilamentJobsMonitor\FilamentJobsMonitorPlugin;

...

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            FilamentJobsMonitorPlugin::make()
        ]);
}

Usage

Just run a Background Job and go to the route /admin/queue-monitors to see the jobs.

Example

Go to example folder to see a Job example file.

Then you can call your Job with the following code:

    public static function table(Table $table): Table
    {
        return $table

        // rest of your code
        ...

        ->bulkActions([
            BulkAction::make('export-jobs')
            ->label('Background Export')
            ->icon('heroicon-o-cog')
            ->action(function (Collection $records) {
                UsersCsvExportJob::dispatch($records, 'users.csv');
                Notification::make()
                    ->title('Export is ready')
                    ->body('Your export is ready. You can download it from the exports page.')
                    ->success()
                    ->seconds(5)
                    ->icon('heroicon-o-inbox-in')
                    ->send();
            })
        ])
    }

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

filament-jobs-monitor's People

Contributors

log1x avatar dependabot[bot] avatar croustibat avatar cntabana avatar bcollins-oxford avatar klham avatar pelmered avatar github-actions[bot] avatar amendozaaguiar avatar acepoblete avatar mvenghaus avatar musilondrej avatar wouterdedroog avatar zereliq avatar kolaente avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.