From 64a20993813ed0bf862236bd19c06b4948d664a6 Mon Sep 17 00:00:00 2001 From: Edwin Krause Date: Thu, 28 Sep 2023 13:14:46 +0200 Subject: [PATCH 1/6] added method --- .../Resources/ScheduleResource/Pages/ViewSchedule.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Filament/Resources/ScheduleResource/Pages/ViewSchedule.php b/src/Filament/Resources/ScheduleResource/Pages/ViewSchedule.php index 905d5df..33525b1 100644 --- a/src/Filament/Resources/ScheduleResource/Pages/ViewSchedule.php +++ b/src/Filament/Resources/ScheduleResource/Pages/ViewSchedule.php @@ -33,6 +33,13 @@ public function getTabs(): array { return []; } + + public function getCachedTabs(): array + { + return []; + } + + use Forms\Concerns\InteractsWithForms; use Tables\Concerns\InteractsWithTable { makeTable as makeBaseTable; From 27eff5624f544829f41ea20062bb1e2978950355 Mon Sep 17 00:00:00 2001 From: Edwin Krause Date: Thu, 28 Sep 2023 13:43:54 +0200 Subject: [PATCH 2/6] Changes reversed --- .../Resources/ScheduleResource/Pages/ViewSchedule.php | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/Filament/Resources/ScheduleResource/Pages/ViewSchedule.php b/src/Filament/Resources/ScheduleResource/Pages/ViewSchedule.php index 33525b1..905d5df 100644 --- a/src/Filament/Resources/ScheduleResource/Pages/ViewSchedule.php +++ b/src/Filament/Resources/ScheduleResource/Pages/ViewSchedule.php @@ -33,13 +33,6 @@ public function getTabs(): array { return []; } - - public function getCachedTabs(): array - { - return []; - } - - use Forms\Concerns\InteractsWithForms; use Tables\Concerns\InteractsWithTable { makeTable as makeBaseTable; From 3042aed7bcd779454e8e1fc2e1b70e49f3274c12 Mon Sep 17 00:00:00 2001 From: Edwin Krause Date: Thu, 28 Sep 2023 14:04:13 +0200 Subject: [PATCH 3/6] 2nd attempt --- composer.json | 2 +- src/Filament/Resources/ScheduleResource/Pages/ViewSchedule.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 554cab5..5f7650a 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "require": { "php": "^8.0", "awcodes/filament-table-repeater": "^2.0.4", - "filament/filament": "^3.0.5", + "filament/filament": "^3.0.47", "spatie/laravel-package-tools": "^1.13.5", "illuminate/contracts": "^8.0|^9.0|^10.0" }, diff --git a/src/Filament/Resources/ScheduleResource/Pages/ViewSchedule.php b/src/Filament/Resources/ScheduleResource/Pages/ViewSchedule.php index 905d5df..b33bca8 100644 --- a/src/Filament/Resources/ScheduleResource/Pages/ViewSchedule.php +++ b/src/Filament/Resources/ScheduleResource/Pages/ViewSchedule.php @@ -7,6 +7,7 @@ use Filament\Forms; use Filament\Resources\Pages\Page; use Filament\Resources\Pages\Concerns\HasRelationManagers; +use Filament\Resources\Pages\Concerns\HasTabs; use Filament\Resources\Pages\Concerns\InteractsWithRecord; use Livewire\Attributes\Url; @@ -23,6 +24,7 @@ class ViewSchedule extends Page implements HasTable protected static string $view = 'filament-panels::resources.pages.list-records'; use InteractsWithRecord; use HasRelationManagers; + use HasTabs; #[Url] public ?string $activeTab = null; From 2eeb0df1c3b0cc6b9512fec6eea143442fc69727 Mon Sep 17 00:00:00 2001 From: Edwin Krause Date: Thu, 28 Sep 2023 14:07:35 +0200 Subject: [PATCH 4/6] Adjust path to Trait --- src/Filament/Resources/ScheduleResource/Pages/ViewSchedule.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Filament/Resources/ScheduleResource/Pages/ViewSchedule.php b/src/Filament/Resources/ScheduleResource/Pages/ViewSchedule.php index b33bca8..b6d1b6a 100644 --- a/src/Filament/Resources/ScheduleResource/Pages/ViewSchedule.php +++ b/src/Filament/Resources/ScheduleResource/Pages/ViewSchedule.php @@ -7,7 +7,7 @@ use Filament\Forms; use Filament\Resources\Pages\Page; use Filament\Resources\Pages\Concerns\HasRelationManagers; -use Filament\Resources\Pages\Concerns\HasTabs; +use Filament\Resources\Concerns\HasTabs; use Filament\Resources\Pages\Concerns\InteractsWithRecord; use Livewire\Attributes\Url; From 7c7c45b0577cef91d45ec97a2648198310b81a56 Mon Sep 17 00:00:00 2001 From: Edwin Krause Date: Thu, 28 Sep 2023 16:14:37 +0200 Subject: [PATCH 5/6] a working solution --- config/filament-database-schedule.php | 5 +++++ .../views/layouts/schedule-history-layout.blade.php | 6 ++++++ .../ScheduleResource/Pages/ViewSchedule.php | 12 +++--------- 3 files changed, 14 insertions(+), 9 deletions(-) create mode 100644 resources/views/layouts/schedule-history-layout.blade.php diff --git a/config/filament-database-schedule.php b/config/filament-database-schedule.php index 5b2d8c6..7b9d13d 100644 --- a/config/filament-database-schedule.php +++ b/config/filament-database-schedule.php @@ -41,6 +41,11 @@ */ "navigation_icon" => 'heroicon-o-rectangle-stack', + /** + * When opening history, is output collapsed + */ + 'history_collapsed' => env('FILAMENT_SCHEDULE_HISTORY_COLLAPSED', false), + /** * How many jobs do you want to have on each page ? */ diff --git a/resources/views/layouts/schedule-history-layout.blade.php b/resources/views/layouts/schedule-history-layout.blade.php new file mode 100644 index 0000000..0ccf9e9 --- /dev/null +++ b/resources/views/layouts/schedule-history-layout.blade.php @@ -0,0 +1,6 @@ +
+

+ {{ __("filament-database-schedule::schedule.resource.history") }} +

+ {{ $this->table }} +
\ No newline at end of file diff --git a/src/Filament/Resources/ScheduleResource/Pages/ViewSchedule.php b/src/Filament/Resources/ScheduleResource/Pages/ViewSchedule.php index b6d1b6a..2766bb0 100644 --- a/src/Filament/Resources/ScheduleResource/Pages/ViewSchedule.php +++ b/src/Filament/Resources/ScheduleResource/Pages/ViewSchedule.php @@ -28,13 +28,7 @@ class ViewSchedule extends Page implements HasTable #[Url] public ?string $activeTab = null; - /** - * @return array - */ - public function getTabs(): array - { - return []; - } + use Forms\Concerns\InteractsWithForms; use Tables\Concerns\InteractsWithTable { makeTable as makeBaseTable; @@ -78,7 +72,7 @@ protected function getTableColumns(): array return [ Tables\Columns\Layout\Split::make([ Tables\Columns\TextColumn::make('command')->label(__('filament-database-schedule::schedule.fields.command')), - ScheduleArguments::make('params')->withValue(false)->label(__('filament-database-schedule::schedule.fields.arguments'))->separator(',')->badge(), + // ScheduleArguments::make('params')->withValue(false)->label(__('filament-database-schedule::schedule.fields.arguments'))->separator(',')->badge(), Tables\Columns\TextColumn::make('options')->label(__('filament-database-schedule::schedule.fields.options'))->separator(',')->badge(), Tables\Columns\TextColumn::make('created_at')->label(__('filament-database-schedule::schedule.fields.expression')) ->dateTime(), @@ -87,7 +81,7 @@ protected function getTableColumns(): array Tables\Columns\TextColumn::make('output')->extraAttributes(["class"=>"!max-w-max"],true), - ])->collapsible(), + ])->collapsible()->collapsed(config("filament-database-schedule.history_collapsed")), ]; } From 51e5e620bb6c77f5bb54b1c6253d355bbd0fbbf0 Mon Sep 17 00:00:00 2001 From: Edwin Krause Date: Thu, 28 Sep 2023 16:23:21 +0200 Subject: [PATCH 6/6] Fix Problem with ScheduleArguments Column --- src/Filament/Columns/ScheduleArguments.php | 1 - src/Filament/Resources/ScheduleResource/Pages/ViewSchedule.php | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Filament/Columns/ScheduleArguments.php b/src/Filament/Columns/ScheduleArguments.php index 60ded2d..63f9c6b 100644 --- a/src/Filament/Columns/ScheduleArguments.php +++ b/src/Filament/Columns/ScheduleArguments.php @@ -39,7 +39,6 @@ public function getTags(): array if (count($tags) === 1 && blank($tags[0])) { $tags = []; } -dd($tags); return $tags; } } diff --git a/src/Filament/Resources/ScheduleResource/Pages/ViewSchedule.php b/src/Filament/Resources/ScheduleResource/Pages/ViewSchedule.php index 2766bb0..5c8d75d 100644 --- a/src/Filament/Resources/ScheduleResource/Pages/ViewSchedule.php +++ b/src/Filament/Resources/ScheduleResource/Pages/ViewSchedule.php @@ -72,7 +72,7 @@ protected function getTableColumns(): array return [ Tables\Columns\Layout\Split::make([ Tables\Columns\TextColumn::make('command')->label(__('filament-database-schedule::schedule.fields.command')), - // ScheduleArguments::make('params')->withValue(false)->label(__('filament-database-schedule::schedule.fields.arguments'))->separator(',')->badge(), + ScheduleArguments::make('params')->withValue(false)->label(__('filament-database-schedule::schedule.fields.arguments'))->separator(',')->badge(), Tables\Columns\TextColumn::make('options')->label(__('filament-database-schedule::schedule.fields.options'))->separator(',')->badge(), Tables\Columns\TextColumn::make('created_at')->label(__('filament-database-schedule::schedule.fields.expression')) ->dateTime(),