Skip to content

Commit b85f807

Browse files
authored
Merge pull request #3 from Sirajunnasihin/feature/SlowJobFeature
Feature/slow job feature
2 parents da92ea5 + 2ad1fb4 commit b85f807

File tree

6 files changed

+70
-1
lines changed

6 files changed

+70
-1
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ yarn-error.log
1414
/.fleet
1515
/.idea
1616
/.vscode
17-
/packages
17+
/packages
18+
.DS_Store

README.md

+19
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,25 @@ After installing the package, publish the configuration file using Artisan:
4545
php artisan vendor:publish --provider="Dotswan\FilamentLaravelPulse\FilamentLaravelPulseServiceProvider"
4646
```
4747

48+
**Extra Configuration:**
49+
Since Laravel Pulse uses Tailwind CSS custom stylesheets, it is necessary to register the CSS files to resolve display issues. So, don't forget to add the CSS file to the content array. To do this, you need to add this directory into the `content` array of `tailwind.config.js` file :
50+
```
51+
export default {
52+
content: [
53+
// ...
54+
'./vendor/laravel/pulse/resources/views/**/*.blade.php', // Add this line
55+
],
56+
// ...
57+
}
58+
```
59+
60+
after update `tailwind.config.js` run this command:
61+
62+
```bash
63+
npm install
64+
npm run build
65+
```
66+
4867
## Basic Usage
4968

5069
To start using Filament Laravel Pulse, follow these steps:

config/filament-laravel-pulse.php

+14
Original file line numberDiff line numberDiff line change
@@ -115,5 +115,19 @@
115115
'canView' => true,
116116
'columnStart' => [],
117117
],
118+
119+
'slow-jobs' => [
120+
'columnSpan' => [
121+
'md' => 5,
122+
'xl' => 5,
123+
],
124+
'cols' => 'full',
125+
'ignoreAfter' => '1 day',
126+
'isDiscovered' => true,
127+
'isLazy' => true,
128+
'sort' => null,
129+
'canView' => true,
130+
'columnStart' => [],
131+
],
118132
],
119133
];
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<x-filament-widgets::widget>
2+
<livewire:pulse.slow-jobs cols="{{$this->cols}}" rows="{{$this->rows}}" ignore-after="{{$this->ignoreAfter}}"/>
3+
</x-filament-widgets::widget>

src/FilamentLaravelPulseServiceProvider.php

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Dotswan\FilamentLaravelPulse\Widgets\PulseSlowQueries;
1313
use Dotswan\FilamentLaravelPulse\Widgets\PulseSlowRequests;
1414
use Dotswan\FilamentLaravelPulse\Widgets\PulseUsage;
15+
use Dotswan\FilamentLaravelPulse\Widgets\PulseSlowJobs;
1516
use Filament\Support\Assets\Asset;
1617
use Filament\Support\Assets\Js;
1718
use Filament\Support\Facades\FilamentAsset;
@@ -128,5 +129,6 @@ protected function registerLivewireComponents(): void
128129
Livewire::component('dotswan.filament-laravel-pulse.widgets.pulse-slow-queries', PulseSlowQueries::class);
129130
Livewire::component('dotswan.filament-laravel-pulse.widgets.pulse-slow-requests', PulseSlowRequests::class);
130131
Livewire::component('dotswan.filament-laravel-pulse.widgets.pulse-usage', PulseUsage::class);
132+
Livewire::component('dotswan.filament-laravel-pulse.widgets.pulse-slow-jobs', PulseSlowJobs::class);
131133
}
132134
}

src/Widgets/PulseSlowJobs.php

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Dotswan\FilamentLaravelPulse\Widgets;
6+
7+
use Filament\Widgets\Widget;
8+
9+
class PulseSlowJobs extends Widget
10+
{
11+
protected static string $view = 'filament-laravel-pulse::widgets.pulse-slow-jobs';
12+
13+
protected string|int|array $cols;
14+
15+
protected string $ignoreAfter;
16+
17+
public function __construct()
18+
{
19+
$config = config('filament-laravel-pulse.components.slow-jobs');
20+
$this->columnSpan = $config['columnSpan'] ?? [
21+
'md' => 5,
22+
'xl' => 5,
23+
];
24+
$this->cols = $config['cols'] ?? 'full';
25+
$this->ignoreAfter = $config['ignoreAfter'] ?? '1 hour';
26+
self::$isDiscovered = $config['isDiscovered'] ?? true;
27+
self::$isLazy = $config['isLazy'] ?? true;
28+
self::$sort = $config['sort'] ?? null;
29+
}
30+
}

0 commit comments

Comments
 (0)