diff --git a/.php-cs-fixer.cache b/.php-cs-fixer.cache new file mode 100644 index 0000000..2dd2648 --- /dev/null +++ b/.php-cs-fixer.cache @@ -0,0 +1 @@ +{"php":"8.0.14","version":"3.3.2:v3.3.2#06bdbdfcd619183dd7a1a6948360f8af73b9ecec","indent":" ","lineEnding":"\n","rules":{"blank_line_after_opening_tag":true,"braces":{"allow_single_line_anonymous_class_with_empty_body":true},"class_definition":{"space_before_parenthesis":true},"compact_nullable_typehint":true,"declare_equal_normalize":true,"lowercase_cast":true,"lowercase_static_reference":true,"new_with_braces":true,"no_blank_lines_after_class_opening":true,"no_leading_import_slash":true,"no_whitespace_in_blank_line":true,"ordered_class_elements":{"order":["use_trait"]},"ordered_imports":{"imports_order":["class","function","const"],"sort_algorithm":"none"},"return_type_declaration":true,"short_scalar_cast":true,"single_blank_line_before_namespace":true,"single_trait_insert_per_statement":true,"ternary_operator_spaces":true,"visibility_required":true,"blank_line_after_namespace":true,"constant_case":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":{"on_multiline":"ensure_fully_multiline"},"no_break_comment":true,"no_closing_tag":true,"no_space_around_double_colon":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"encoding":true,"full_opening_tag":true},"hashes":{"src\/Models\/LogFile.php":1005765856,"src\/FilamentLogviewerServiceProvider.php":14098395,"src\/Facades\/FilamentLogviewer.php":1440322966,"src\/Commands\/FilamentLogviewerCommand.php":766770148,"src\/Pages\/LogViewerPage.php":210481265,"src\/Pages\/LogViewerViewLogPage.php":2001178652,"src\/Pages\/LogViewerViewDetailsPage.php":1954402214,"src\/FilamentLogviewer.php":922212892}} \ No newline at end of file diff --git a/src/FilamentLogviewerServiceProvider.php b/src/FilamentLogviewerServiceProvider.php index fe89a05..53e534f 100644 --- a/src/FilamentLogviewerServiceProvider.php +++ b/src/FilamentLogviewerServiceProvider.php @@ -10,9 +10,8 @@ class FilamentLogviewerServiceProvider extends PluginServiceProvider { - public static string $name = 'filament-log-viewer'; - + protected function getPages(): array { return [ @@ -22,36 +21,10 @@ protected function getPages(): array ]; } - protected function getWidgets(): array - { - return [ - //LogViewerWidget::class, - ]; - } - protected function getStyles(): array { return [ 'filament-log-viewer-styles' => __DIR__ . '/../resources/css/dist/filament-logviewer.css', ]; } - - protected function getScripts(): array - { - return [ - ]; - } - - protected function getScriptData(): array - { - return [ - ]; - } - - protected function getCommands(): array - { - return []; - } - - } diff --git a/src/Models/LogFile.php b/src/Models/LogFile.php index 82893ca..eea38a3 100644 --- a/src/Models/LogFile.php +++ b/src/Models/LogFile.php @@ -1,4 +1,5 @@ $value) { + foreach ($logFiles as $key => $value) { $rows[] =[ 'id' => $i++, 'name' => $key, 'path' => $value, - ]; + ]; } return $rows; } -} \ No newline at end of file +} diff --git a/src/Pages/LogViewerPage.php b/src/Pages/LogViewerPage.php index 3b39b31..1ece9d4 100644 --- a/src/Pages/LogViewerPage.php +++ b/src/Pages/LogViewerPage.php @@ -24,36 +24,19 @@ class LogViewerPage extends Page implements Tables\Contracts\HasTable protected static ?string $title = 'Log viewer'; protected static ?string $navigationLabel = 'Log viewer'; - protected function getActions(): array + protected function getTableQuery(): Builder { - return [ - - ]; - } - - public function viewLogFile($logFile) - { - dd($logFile); + return LogFile::query(); } - protected function getTableQuery(): Builder - { - return LogFile::query(); - } - - protected function getTableColumns(): array + protected function getTableColumns(): array { return [ Tables\Columns\TextColumn::make('name') - ->searchable() + ->searchable() ]; } - - protected function getTableFilters(): array - { - return []; - } - + protected function getTableActions(): array { return [ @@ -62,24 +45,7 @@ protected function getTableActions(): array ->url(function (LogFile $record) { return LogViewerViewLogPage::getUrl(['fileName' => $record->name]); }) - - - - ]; - } - - protected function getTableBulkActions(): array - { - return []; - } - - protected function getViewData(): array - { - return []; + ]; } - - - - -} \ No newline at end of file +} diff --git a/src/Pages/LogViewerViewDetailsPage.php b/src/Pages/LogViewerViewDetailsPage.php index 47eefe1..4e4f2a7 100644 --- a/src/Pages/LogViewerViewDetailsPage.php +++ b/src/Pages/LogViewerViewDetailsPage.php @@ -16,7 +16,7 @@ use Rabol\FilamentLogviewer\Models\LogFileEntry; use stdClass; -class LogViewerViewDetailsPage extends Page +class LogViewerViewDetailsPage extends Page { private $recordId; private $fileName; @@ -25,7 +25,7 @@ class LogViewerViewDetailsPage extends Page protected static ?string $navigationIcon = 'heroicon-o-document-text'; protected static string $view = 'filament-log-viewer::log-viewer-view-details'; - + protected static bool $shouldRegisterNavigation = false; protected static ?string $title = 'Log details'; @@ -59,7 +59,7 @@ protected function getViewData(): array 'entry' => $this->entry, ]; } - + public static function getRoutes(): Closure { return function () { @@ -67,4 +67,4 @@ public static function getRoutes(): Closure Route::get("{$slug}/{recordId?}/{fileName?}", static::class)->name($slug); }; } -} \ No newline at end of file +} diff --git a/src/Pages/LogViewerViewLogPage.php b/src/Pages/LogViewerViewLogPage.php index b9c2a35..81ae801 100644 --- a/src/Pages/LogViewerViewLogPage.php +++ b/src/Pages/LogViewerViewLogPage.php @@ -7,16 +7,10 @@ use Filament\Tables; use Filament\Pages\Page; use Illuminate\Support\Facades\Route; -use Filament\Tables\Actions\LinkAction; use Filament\Pages\Actions\ButtonAction; -use Illuminate\Database\Eloquent\Builder; use Jackiedo\LogReader\Facades\LogReader; -use Rabol\FilamentLogviewer\Models\LogFile; -use Filament\Tables\Concerns\InteractsWithTable; -use Rabol\FilamentLogviewer\Models\LogFileEntry; - -class LogViewerViewLogPage extends Page +class LogViewerViewLogPage extends Page { private $logEntries; private $log; @@ -25,10 +19,11 @@ class LogViewerViewLogPage extends Page protected static ?string $navigationIcon = 'heroicon-o-document-text'; protected static string $view = 'filament-log-viewer::log-viewer-view'; - + protected static bool $shouldRegisterNavigation = false; protected static ?string $title = 'View log file'; + protected function getActions(): array { return [ @@ -56,7 +51,7 @@ protected function getViewData(): array 'filename' => $this->fileName, ]; } - + public static function getRoutes(): Closure { return function () { @@ -64,4 +59,4 @@ public static function getRoutes(): Closure Route::get("{$slug}/{fileName?}", static::class)->name($slug); }; } -} \ No newline at end of file +}