-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Allow sorting by column in list panels #384
Comments
But why? Different panel, different context, different action.
|
although my examples above were for the image panel, the goal is to have this functionality for all list panels |
good point about using 'o' to open something though |
Happy to go with 'z' |
@jesseduffield , I would like to work on this issue, can you guide me how and from where I should start with the development, also like the setup in local for dev? |
I recommend using either github codespaces or a dev container in VSCode (to minimise the setup time). I've neglected to add instructions to the lazydocker contributing guide but you can use the lazygit contribute guide as a guide: https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#running-in-a-vscode-dev-container |
Got it @jesseduffield , will look into that guide |
@jesseduffield , what should be the binding struct for this feature in |
Is your feature request related to a problem? Please describe.
When there are a large amount of items in a list panel, it can be convenient to sort by a particular column. For example, you may want to know which images have the greatest size, so you'd want to sort by image size descending and look at what's at the top.
Describe the solution you'd like
As an example, if I'm in the images panel I want to be able to press a key and see a menu with the options:
Both 's' and 'S' are already used in the containers panel for starting and stopping containers, so that's off the cards. 'o' is the next most obvious candidate i.e. 'order', so let's go with that.
Additional context
This issue doesn't care about persisting sorting between different runs of the application, nor does it care about configuring a default sort order. Those can be tackled in separate issues.
In lazygit we have the ability to have keybindings against menu items so that you don't need to navigate through the list to select an item. Once we have that feature, we can apply it here so that for example you can press 'o', 's' for sorting by size ascending, and 'o', 'S' for size descending. But that's out of scope for this issue.
We'll need to maintain the sorting state against each list panel, so we can create a
SortBy
field in each of the list panels'panelStates
struct (which you'll find inpkg/gui/gui.go
). We'll also need aSortDirection
field:The purpose of the default sort is for when e.g. we're in the services panel which has some bespoke sorting logic. If we're not on the default sort, any bespoke sorting logic will be ignored.
We can then apply the sort logic in
pkg/commands/image.go
in theRefreshImages()
function.If you would like to pick this up let me know!
The text was updated successfully, but these errors were encountered: