Skip to content
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

feat: support sorting by field #17

Open
hedhyw opened this issue Jul 25, 2023 · 7 comments
Open

feat: support sorting by field #17

hedhyw opened this issue Jul 25, 2023 · 7 comments
Assignees
Labels
enhancement New feature or request

Comments

@hedhyw
Copy link
Owner

hedhyw commented Jul 25, 2023

Add an ability to sort by field:

  • Descending
  • Ascending
@hedhyw hedhyw added the enhancement New feature or request label Jul 25, 2023
@hedhyw hedhyw assigned hedhyw and unassigned hedhyw Jul 25, 2023
@arsalankone
Copy link

Hi I want to work on it. Can you please explain what do you mean by Show the list of fields to sort by ?

@hedhyw
Copy link
Owner Author

hedhyw commented Nov 29, 2023

Hi I want to work on it.

Hi! Thank you.

Can you please explain what do you mean by Show the list of fields to sort by ?

The idea was to show a list of fields from which we can select a field to sort by, but of course, it's not a requirement.
Feel free to describe how you see it at its best.

@SpoonBuoy
Copy link

He @hedhyw assign it to me on this account, @arsalankone is my work account and I had mistakenly commented from that account.

I might need some help also in understanding the flow of code properly. Also like in sorting by fields, what criterion should be used for sorting mechanism. Sorting by value in case of timestamps and lexicographical sorting in message makes sense, but for level fields, what should be an appropriate parameter?

@hedhyw hedhyw assigned SpoonBuoy and unassigned arsalankone Dec 3, 2023
@hedhyw
Copy link
Owner Author

hedhyw commented Dec 3, 2023

I might need some help also in understanding the flow of code properly.

  • Clicking hotkeys ("O"/"F6") on StateLoaded, StateFiltered should open a dialogue to select a field to sort by:
  • Possible sorting fields can be taken from the config:
    Fields []Field `json:"fields" validate:"min=1"`
  • The current sorting order can be stored in the persistent application state (available in all models, note: each local state clones it). StateLoaded and StateFiltered will sort considering sorting configuration from the persistent state:
    type Application struct {

Sorting by value in case of timestamps and lexicographical sorting in message makes sense, but for level fields, what should be an appropriate parameter?

  • Numbers/Timestamps -> by value.
  • Any other value -> lexicographical.

@SpoonBuoy
Copy link

Can you take a look at it and see if I am following the right approach?
https://github.com/SpoonBuoy/json-log-viewer/tree/spoon

@hedhyw
Copy link
Owner Author

hedhyw commented Dec 11, 2023

Can you take a look at it and see if I am following the right approach? https://github.com/SpoonBuoy/json-log-viewer/tree/spoon

looks right, but I'm not sure we need StateSorted, we can save the order in the application state, and use it in StateLoaded/StateFiltered

@hedhyw
Copy link
Owner Author

hedhyw commented May 27, 2024

@SpoonBuoy do you still need this feature?

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

No branches or pull requests

3 participants