VincentBean / horizon-extended-dashboard

An extended dashboard for Laravel Horizon written using Livewire
MIT License
20 stars 6 forks source link

Broken on install? #20

Closed anhofmann closed 7 months ago

anhofmann commented 7 months ago

I installed this package and I get two errors.

The first one occurs on this route: horizon-dashboard/jobs/pending, this is the top of the stack trace:

Spatie\LaravelIgnition\Exceptions\ViewException: Expected null, string, DateTime or DateTimeInterface, double given in file /var/www/html/vendor/nesbot/carbon/src/Carbon/Traits/Date.php on line 732

#0 /var/www/html/vendor/nesbot/carbon/src/Carbon/Traits/Date.php(757): Carbon\Carbon::expectDateTime()
#1 /var/www/html/vendor/nesbot/carbon/src/Carbon/Traits/Comparison.php(271): Carbon\Carbon->resolveCarbon()
#2 /var/www/html/vendor/vincentbean/horizon-extended-dashboard/src/Data/Job.php(61): Carbon\Carbon->lessThan()
#3 /var/www/html/vendor/vincentbean/horizon-extended-dashboard/src/Data/Job.php(111): VincentBean\HorizonDashboard\Data\Job->isDelayed()
#4 /var/www/html/vendor/laravel/framework/src/Illuminate/Collections/Traits/EnumeratesValues.php(919): VincentBean\HorizonDashboard\Data\Job->toArray()
#5 [internal function]: Illuminate\Support\Collection->Illuminate\Support\Traits\{closure}()
#6 /var/www/html/vendor/laravel/framework/src/Illuminate/Collections/Arr.php(600): array_map()

When I change vendor/vincentbean/horizon-extended-dashboard/src/Data/Job.php(61) to return $command->delay > 0; and line 72 to return now()->addSeconds(round($command->delay))->toDateTimeString(); the route works.

But is this the right solution?

The other error happens on horizon-dashboard/batches and this is the top of the stack trace:

Spatie\LaravelIgnition\Exceptions\ViewException: The attribute [cancelled] either does not exist or was not retrieved for model [VincentBean\HorizonDashboard\Models\Batch]. in file /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php on line 475

#0 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php(455): Illuminate\Database\Eloquent\Model->throwMissingAttributeExceptionIfApplicable()
#1 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(2233): Illuminate\Database\Eloquent\Model->getAttribute()
#2 /var/www/html/vendor/vincentbean/horizon-extended-dashboard/resources/views/livewire/batch-list.blade.php(16): Illuminate\Database\Eloquent\Model->__get()
#3 /var/www/html/vendor/livewire/livewire/src/Mechanisms/ExtendBlade/ExtendedCompilerEngine.php(37): include('...')
#4 /var/www/html/vendor/livewire/livewire/src/Mechanisms/ExtendBlade/ExtendedCompilerEngine.php(38): VincentBean\HorizonDashboard\Http\Livewire\BatchList->Livewire\Mechanisms\ExtendBlade\{closure}()
#5 /var/www/html/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(72): Livewire\Mechanisms\ExtendBlade\ExtendedCompilerEngine->evaluatePath()

And indeed, my job_batches table doesn't have a cancelled field, so this can't work.

I'm using Laravel 10. Any advice to get this tool working?

anhofmann commented 7 months ago

Also in the statistics tab it tries to read a job_failed_count, but in the migration this field is named job_fail_count. What is going on?

VincentBean commented 7 months ago

Hi, feel free to make a PR with your fixes :)