-
-
Notifications
You must be signed in to change notification settings - Fork 297
Adding alphabetical file sorting #472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Adding alphabetical file sorting #472
Conversation
- added configuration parameter 'log_sorting_method' - Method for sorting logs into directories - added dependence of sorting options on the parameter 'log_sorting_method': - with the value ModifiedTime - ['Newest first', 'Oldest first'] - with the value Alphabetical - ['From A to Z', 'From Z to A'] - supplemented sorting of files in routes 'log-viewer.folders' and 'log-viewer.files' - supplemented tests (Failed tests did not pass before the changes) docker compose run --rm php composer test Tests: 4 failed, 248 passed (815 assertions) Duration: 2.78s Random Order Seed: 1757604409 FAIL Tests\Unit\LogIndex\LogIndexTest ⨯ it compresses chunk if gzip is available 0.01s ⨯ it can save to the cache after building up the index FAIL Tests\Feature\LogFoldersControllerTest ⨯ it folders are sorted alphabetically descending when configured 0.03s ⨯ it can get the log files 0.02s
Hey @arukompas! How are you? I'd love to hear your thoughts on this pull request. If you need any changes, let me know so I can get them in. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for taking so long! Been sick for a few weeks, needed time to rest :)
PR looks great, thanks for the included tests as well! The only small request is to rename the variables to make it explicitly clear we're sorting files, not logs.
'folder_sorting_order' => SortingOrder::Descending, | ||
|
||
// Method for sorting logs into directories. Other options: `Alphabetical`, `ModifiedTime` | ||
'log_sorting_method' => FolderSortingMethod::ModifiedTime, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's an important distinction between a "log" and a "file". Logs are individual log entries within a file, and here we want to sort files, not logs.
Call it file_sorting_method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, I'll correct that
'path' => config('log-viewer.route_path'), | ||
'back_to_system_url' => config('log-viewer.back_to_system_url'), | ||
'back_to_system_label' => config('log-viewer.back_to_system_label'), | ||
'log_sort_by_time' => $log_sort_by_time, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here, call it files_sort_by_time
instead of logs
, as we're sorting files, not log entries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try to get it done as quickly as possible
#471