Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
rabol committed Jan 4, 2022
1 parent 8658ccc commit 17f55da
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 86 deletions.
1 change: 1 addition & 0 deletions .php-cs-fixer.cache
Original file line number Diff line number Diff line change
@@ -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}}
29 changes: 1 addition & 28 deletions src/FilamentLogviewerServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@

class FilamentLogviewerServiceProvider extends PluginServiceProvider
{

public static string $name = 'filament-log-viewer';

protected function getPages(): array
{
return [
Expand All @@ -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 [];
}


}
7 changes: 4 additions & 3 deletions src/Models/LogFile.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Rabol\FilamentLogviewer\Models;

use Sushi\Sushi;
Expand All @@ -22,14 +23,14 @@ public function getRows()
{
$logFiles = LogReader::getLogFilenameList();
$i = 1;
foreach($logFiles as $key => $value) {
foreach ($logFiles as $key => $value) {
$rows[] =[
'id' => $i++,
'name' => $key,
'path' => $value,
];
];
}

return $rows;
}
}
}
48 changes: 7 additions & 41 deletions src/Pages/LogViewerPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
Expand All @@ -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 [];
];
}




}
}
8 changes: 4 additions & 4 deletions src/Pages/LogViewerViewDetailsPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
use Rabol\FilamentLogviewer\Models\LogFileEntry;
use stdClass;

class LogViewerViewDetailsPage extends Page
class LogViewerViewDetailsPage extends Page
{
private $recordId;
private $fileName;
Expand All @@ -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';
Expand Down Expand Up @@ -59,12 +59,12 @@ protected function getViewData(): array
'entry' => $this->entry,
];
}

public static function getRoutes(): Closure
{
return function () {
$slug = static::getSlug();
Route::get("{$slug}/{recordId?}/{fileName?}", static::class)->name($slug);
};
}
}
}
15 changes: 5 additions & 10 deletions src/Pages/LogViewerViewLogPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 [
Expand Down Expand Up @@ -56,12 +51,12 @@ protected function getViewData(): array
'filename' => $this->fileName,
];
}

public static function getRoutes(): Closure
{
return function () {
$slug = static::getSlug();
Route::get("{$slug}/{fileName?}", static::class)->name($slug);
};
}
}
}

0 comments on commit 17f55da

Please sign in to comment.