Skip to content

Conversation

yakoffka
Copy link

  • 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)

#471

- 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
@yakoffka
Copy link
Author

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!

Copy link
Contributor

@arukompas arukompas left a 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,
Copy link
Contributor

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

Copy link
Author

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,
Copy link
Contributor

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.

Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants