console icon indicating copy to clipboard operation
console copied to clipboard

console: filter tasks list

Open hawkw opened this issue 4 years ago • 4 comments

It would be nice to be able to filter which tasks are displayed in the tasks list.

Some ways we might want to filter the tasks list:

  • By name (with a regex?)
  • By target (with a regex?)
  • By fields:
    • by the presence of a field with a given name
    • by the value of a field with a given name (regex?)

Since we would want to allow filtering on different columns in the task list, we would need some UI for selecting which column is being filtered on, as well as for writing the actual filter. Here's a simple proposal:

  • When the user presses a particular key, a text entry box is opened to type in a filter pattern
  • Using the arrow keys in the filter entry mode selects which column is filtered on, rather than which column sorts the task list
  • pressing some other key (enter?) adds the filter, and returns the user to the mode where the arrow keys select the column to sort by

Questions:

  • Do we want to support multiple filters? We probably do, but that complicates the UI
    • Opening the filter entry box again would then create a new filter, rather than editing the current filter
    • There would need to be some way to edit an existing filter as well
    • Perhaps we should add a UI box that lists all the current filters?
    • Some kind of command for clearing all filters
  • How to combine patterns in filters? e.g. users might want to have OR filters or AND filters...

Most of these questions are things we can punt on for an MVP implementation, especially if we only allow a single filter at a time. But, we'll want to figure them out eventually.

UI inspiration:

  • htop (which only allows filtering on one column, the process's name): image
  • atuin history search: image

hawkw avatar Sep 10 '21 16:09 hawkw

I marked this as E-hard because a complete, full-featured filtering implementation is going to be a big pile of work (see the "questions" section above). However, an initial MVP where there's only one active filter at a time is probably relatively easy...

hawkw avatar Sep 10 '21 16:09 hawkw

There's also other things we'd probably want to be able to "enter" dynamically, like rewinding to a certain spot, or changing a config value, etc.

seanmonstar avatar Sep 10 '21 16:09 seanmonstar

There's also other things we'd probably want to be able to "enter" dynamically, like rewinding to a certain spot, or changing a config value, etc.

Yeah, it would make sense to have stuff like text boxes and other UI components eventually be general-purpose...

hawkw avatar Sep 10 '21 17:09 hawkw

Would it make sense to split the task up a bit and start with an implementation of a filter query box that we can bring up with some kind of a key combination and just fiture out a filtering syntax that incorporates the column(s) that we are filtering by. Someting like: polls > 1;target=="tokio::task". When that works, we can think of a way to make it easier to populate the columns we filter on by using the UI.

zaharidichev avatar Sep 20 '21 12:09 zaharidichev