diff --git a/resources/css/dist/filament-logviewer.css b/resources/css/dist/filament-logviewer.css index a9e64a4..18e964a 100644 --- a/resources/css/dist/filament-logviewer.css +++ b/resources/css/dist/filament-logviewer.css @@ -532,6 +532,31 @@ Ensure the default browser behavior of the `hidden` attribute. background-color: rgb(251 191 36 / var(--tw-bg-opacity)); } +.bg-danger-600 { + --tw-bg-opacity: 1; + background-color: rgb(225 29 72 / var(--tw-bg-opacity)); +} + +.bg-warning-600 { + --tw-bg-opacity: 1; + background-color: rgb(217 119 6 / var(--tw-bg-opacity)); +} + +.bg-primary-600 { + --tw-bg-opacity: 1; + background-color: rgb(202 138 4 / var(--tw-bg-opacity)); +} + +.bg-success-400 { + --tw-bg-opacity: 1; + background-color: rgb(74 222 128 / var(--tw-bg-opacity)); +} + +.bg-success-600 { + --tw-bg-opacity: 1; + background-color: rgb(22 163 74 / var(--tw-bg-opacity)); +} + .p-2 { padding: 0.5rem; } @@ -594,6 +619,21 @@ Ensure the default browser behavior of the `hidden` attribute. color: rgb(255 255 255 / var(--tw-text-opacity)); } +.text-gray-700 { + --tw-text-opacity: 1; + color: rgb(68 64 60 / var(--tw-text-opacity)); +} + +.text-gray-400 { + --tw-text-opacity: 1; + color: rgb(168 162 158 / var(--tw-text-opacity)); +} + +.text-black { + --tw-text-opacity: 1; + color: rgb(0 0 0 / var(--tw-text-opacity)); +} + .hover\:shadow-lg:hover { --tw-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); --tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color); diff --git a/resources/views/log-viewer-view-details.blade.php b/resources/views/log-viewer-view-details.blade.php index 22164ba..4785f9c 100644 --- a/resources/views/log-viewer-view-details.blade.php +++ b/resources/views/log-viewer-view-details.blade.php @@ -2,54 +2,60 @@

- Log Files - view + {{ $header }}

- - - - - - - {{----}} - - - - - - - - @if($logEntries) - @foreach ($logEntries as $logEntry) - - - - - {{----}} - - - + + + + + + + + + + + + + + + + + + + + + + + @if ($footer) diff --git a/resources/views/log-viewer-view.blade.php b/resources/views/log-viewer-view.blade.php index 936fe17..e29cfb3 100644 --- a/resources/views/log-viewer-view.blade.php +++ b/resources/views/log-viewer-view.blade.php @@ -30,18 +30,18 @@ {{----}} diff --git a/src/Pages/LogViewerPage.php b/src/Pages/LogViewerPage.php index ed2e8e1..3b39b31 100644 --- a/src/Pages/LogViewerPage.php +++ b/src/Pages/LogViewerPage.php @@ -21,7 +21,8 @@ class LogViewerPage extends Page implements Tables\Contracts\HasTable protected static ?string $navigationIcon = 'heroicon-o-document-text'; protected static string $view = 'filament-log-viewer::log-viewer'; - + protected static ?string $title = 'Log viewer'; + protected static ?string $navigationLabel = 'Log viewer'; protected function getActions(): array { @@ -59,7 +60,7 @@ protected function getTableActions(): array Tables\Actions\LinkAction::make('viewlogfile') ->label('View') ->url(function (LogFile $record) { - return LogViewerViewLogPage::getUrl(['record' => $record]); + return LogViewerViewLogPage::getUrl(['fileName' => $record->name]); }) diff --git a/src/Pages/LogViewerViewDetailsPage.php b/src/Pages/LogViewerViewDetailsPage.php index 7473ba4..47eefe1 100644 --- a/src/Pages/LogViewerViewDetailsPage.php +++ b/src/Pages/LogViewerViewDetailsPage.php @@ -14,12 +14,13 @@ use Rabol\FilamentLogviewer\Models\LogFile; use Filament\Tables\Concerns\InteractsWithTable; use Rabol\FilamentLogviewer\Models\LogFileEntry; - +use stdClass; class LogViewerViewDetailsPage extends Page { - private $logEntries; - private $log; + private $recordId; + private $fileName; + private $entry; protected static ?string $navigationIcon = 'heroicon-o-document-text'; @@ -27,33 +28,35 @@ class LogViewerViewDetailsPage extends Page protected static bool $shouldRegisterNavigation = false; - protected static ?string $title = 'test'; + protected static ?string $title = 'Log details'; protected function getActions(): array { return [ ButtonAction::make('back') ->label('Back') - ->url(LogViewerViewLogPage::getUrl()), + ->url(LogViewerViewLogPage::getUrl(['fileName' => $this->fileName])), ]; } - public function mount(string $record): void + public function mount(string $recordId, string $fileName): void { - debug($record); - /* - $this->log = LogReader::filename($record->name); - $this->logEntries = $this->log->get(); // we need to paginate... - self::$title = 'Log file: ' . $record->name; - */ + $this->recordId = $recordId; + $this->fileName = $fileName; + + $this->entry = LogReader::find($recordId); + debug($this->entry); + debug($recordId); + debug($fileName); } protected function getViewData(): array { return [ - 'header' => null, + 'header' => null, //'Log details: ' . $this->recordId . ' / ' . $this->fileName, 'footer' => null, - 'logEntries' => $this->logEntries, - 'log' => $this->log, + 'recordid' => $this->recordId, + 'filename' => $this->fileName, + 'entry' => $this->entry, ]; } @@ -61,7 +64,7 @@ public static function getRoutes(): Closure { return function () { $slug = static::getSlug(); - Route::get("{$slug}/{record?}", static::class)->name($slug); + 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 e45d64a..b9c2a35 100644 --- a/src/Pages/LogViewerViewLogPage.php +++ b/src/Pages/LogViewerViewLogPage.php @@ -20,6 +20,7 @@ class LogViewerViewLogPage extends Page { private $logEntries; private $log; + private $fileName; protected static ?string $navigationIcon = 'heroicon-o-document-text'; @@ -27,7 +28,7 @@ class LogViewerViewLogPage extends Page protected static bool $shouldRegisterNavigation = false; - protected static ?string $title = 'test'; + protected static ?string $title = 'View log file'; protected function getActions(): array { return [ @@ -37,11 +38,12 @@ protected function getActions(): array ]; } - public function mount(LogFile $record): void + public function mount(string $fileName): void { - $this->log = LogReader::filename($record->name); + $this->log = LogReader::filename($fileName); $this->logEntries = $this->log->get(); // we need to paginate... - self::$title = 'Log file: ' . $record->name; + self::$title = 'Log file: ' . $fileName; + $this->fileName = $fileName; } protected function getViewData(): array @@ -51,6 +53,7 @@ protected function getViewData(): array 'footer' => null, 'logEntries' => $this->logEntries, 'log' => $this->log, + 'filename' => $this->fileName, ]; } @@ -58,7 +61,7 @@ public static function getRoutes(): Closure { return function () { $slug = static::getSlug(); - Route::get("{$slug}/{record?}", static::class)->name($slug); + Route::get("{$slug}/{fileName?}", static::class)->name($slug); }; } } \ No newline at end of file
DateEnvironmentLevelFile pathContextStack trace
{{$logEntry->date}}{{$logEntry->environment}} - @if($logEntry->level == 'error') - {{$logEntry->level}} - @elseif($logEntry->level == 'debug') - {{$logEntry->level}} - @else - {{$logEntry->level}} - @endif - {{$logEntry->file_path}}{{ \Illuminate\Support\Str::limit($logEntry->context, 40, ' (...)')}} - @if($logEntry->stack_traces && $logEntry->stack_traces->count()) - Show stack trace - @else - No stacktrace - @endif -
Date:{{$entry->date}}
Environment:{{$entry->environment}}
Level:{{$entry->level}}
Context:{{$entry->context}}
Stack trace: + @if($entry->stack_traces && $entry->stack_traces->count()) + + @foreach ($entry->stack_traces as $st) + + + + + + + + + + + + + + + + + +
Caught at{{$st->caught_at}}
In{{$st->in}}
Line{{$st->line}}
content{{$st->__toString()}}
@endforeach + @endif -
{{$logEntry->environment}} @if($logEntry->level == 'error') - {{$logEntry->level}} + {{$logEntry->level}} @elseif($logEntry->level == 'debug') - {{$logEntry->level}} + {{$logEntry->level}} @else - {{$logEntry->level}} + {{$logEntry->level}} @endif {{$logEntry->file_path}}{{ \Illuminate\Support\Str::limit($logEntry->context, 40, ' (...)')}} - details + details