Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
marco76tv committed Feb 26, 2024
1 parent 90f872d commit f325e33
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 19 deletions.
60 changes: 49 additions & 11 deletions Filament/Resources/JobBatchResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Modules\Job\Filament\Resources\JobBatchResource\Pages\ListJobBatches;
use Modules\Job\Models\JobBatch;
use Modules\Xot\Filament\Resources\XotBaseResource;
use Webmozart\Assert\Assert;

class JobBatchResource extends XotBaseResource
{
Expand All @@ -27,19 +28,55 @@ class JobBatchResource extends XotBaseResource

public static function table(Table $table): Table
{
Assert::string($date_format = config('app.date_format'));

return $table
->columns(
[
TextColumn::make('created_at')->dateTime(config('app.date_format'))->sortable()->searchable()->toggleable(),
TextColumn::make('id')->sortable()->searchable()->toggleable(),
TextColumn::make('name')->sortable()->searchable()->toggleable(),
TextColumn::make('cancelled_at')->dateTime(config('app.date_format'))->sortable()->searchable()->toggleable(),
TextColumn::make('failed_at')->dateTime(config('app.date_format'))->sortable()->searchable()->toggleable(),
TextColumn::make('finished_at')->dateTime(config('app.date_format'))->sortable()->searchable()->toggleable(),
TextColumn::make('total_jobs')->sortable()->searchable()->toggleable(),
TextColumn::make('pending_jobs')->sortable()->searchable()->toggleable(),
TextColumn::make('failed_jobs')->sortable()->searchable()->toggleable(),
TextColumn::make('failed_job_ids')->sortable()->searchable()->toggleable(),
TextColumn::make('created_at')
->dateTime($date_format)
->sortable()
->searchable()
->toggleable(),
TextColumn::make('id')
->sortable()
->searchable()
->toggleable(),
TextColumn::make('name')
->sortable()
->searchable()
->toggleable(),
TextColumn::make('cancelled_at')
->dateTime($date_format)
->sortable()
->searchable()
->toggleable(),
TextColumn::make('failed_at')
->dateTime($date_format)
->sortable()
->searchable()
->toggleable(),
TextColumn::make('finished_at')
->dateTime($date_format)
->sortable()
->searchable()
->toggleable(),
TextColumn::make('total_jobs')
->sortable()
->searchable()
->toggleable(),
TextColumn::make('pending_jobs')
->sortable()
->searchable()
->toggleable(),
TextColumn::make('failed_jobs')
->sortable()
->searchable()
->toggleable(),
TextColumn::make('failed_job_ids')
->sortable()
->searchable()
->toggleable(),
]
)
->actions(
Expand All @@ -59,6 +96,7 @@ public static function getPages(): array

public static function getNavigationBadge(): ?string
{
return (string) JobBatch::query()->count();
return (string) JobBatch::query()
->count();
}
}
5 changes: 4 additions & 1 deletion Filament/Resources/ScheduleResource/Pages/ViewSchedule.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Illuminate\Support\HtmlString;
use Livewire\Attributes\Url;
use Modules\Job\Filament\Resources\ScheduleResource;
use Webmozart\Assert\Assert;

class ViewSchedule extends Page implements HasTable
{
Expand Down Expand Up @@ -71,12 +72,14 @@ protected function getTableQuery(): Builder

protected function getTableColumns(): array
{
$date_format = Assert::string(config('app.date_format'));

return [
Tables\Columns\Layout\Split::make([
Tables\Columns\TextColumn::make('command')->label(__('job::schedule.fields.command')),
Tables\Columns\TextColumn::make('created_at')
->label(__('job::schedule.fields.expression'))
->dateTime(config('app.date_format')),
->dateTime($date_format),
Tables\Columns\TextColumn::make('updated_at')
->label(__('job::schedule.fields.expression'))
->formatStateUsing(static function ($state, $record) {
Expand Down
6 changes: 2 additions & 4 deletions Http/Livewire/Broad.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@

class Broad extends Component
{
/**
* @var array<string, string>
*/
/** @var array<string, string> */
protected $listeners = [
'echo:public,PublicEvent' => 'notifyEvent'
'echo:public,PublicEvent' => 'notifyEvent',
];

public function render(): Renderable
Expand Down
4 changes: 1 addition & 3 deletions Models/BaseModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ abstract class BaseModel extends Model
/** @var array<string> */
protected $fillable = ['id'];

/**
* @var array<string, string>
*/
/** @var array<string, string> */
protected $casts = [
'published_at' => 'datetime',
'created_at' => 'datetime',
Expand Down

0 comments on commit f325e33

Please sign in to comment.