httptoolkit / httptoolkit-ui

The UI of HTTP Toolkit
https://httptoolkit.com
GNU Affero General Public License v3.0
282 stars 106 forks source link

Feat: Initial multi-select support for events #95

Open mitchcapper opened 10 months ago

mitchcapper commented 10 months ago

Pin/Delete/Export/Create Rules all work as expected Closes https://github.com/httptoolkit/httptoolkit/issues/76

This adds a draft/sample for multi-select for rows, not sure if this is the direction one wants to go so certainly is not polished.

It implements:

Things that should be done:

mitchcapper commented 10 months ago

crap of course I selected create PR and not create draft, not sure anyone would be confused and merge this as is in though so :)

pimterry commented 10 months ago

Nice stuff @mitchcapper! This is definitely a change I'm interested in and there's been lots of demand for this for a while, thanks for looking into it.

I think there's a few things here that will need work to make this mergable though:

Does that all make sense?

mitchcapper commented 10 months ago

Agree with your points. Feedback on a few things:

pimterry commented 10 months ago

the global MULTI_SELECT bool was more showing a way the entire feature could be turned on and off but similar can just be done in the select handler if you decide to give users a choice.

Nope - if we do this right then I don't think any choice is required (if you don't want it, don't just select multiple requests and nothing will change) and I'm generally keen to avoid too much configuration possibilities, to keep both UX and the code simpler. Any users who really want to do funky things have full freedom to mess with the code themselves.

I think selected and focused should be distinct as you mention.

I think we're using slightly different definitions. The focus state I'm talking about is purely the raw web focus state, i.e. the focus that changes if you press tab, so that either a row is focused, or one of the buttons elsewhere on the page, or an input field, etc. It's totally independent of selection, and doesn't directly control the right pane. For rows, focus is currently shown as little red dotted outline. That moves if you click elsewhere (e.g. expand/collapse a section on the right) and moves with tab/shift-tab. When you click to multi-select, the last row clicked will end up focused, in that sense, but I wasn't suggesting that it would be shown on the right at all.

if you do go the route of focus / select being distinct I assume we modify event data to transmit both rather than just saying the last item on the list (or what have you) is the focused item. this also solved the url question leaving it to point to the focused item

Given the above, this isn't quite right. I'm not sure what 'event data' is, but I think the only state we need is:

If I am trying to export several queries I may need to see a request to know if I want to add it.

Regardless of the 'focus' terminology, this is a good suggestion (ditto for the equivalent deletion point).

I think we can handle this within a multi-select right pane view though: for example, we could show "5 events selected" and then quick summaries of 5 rows there, which you could expand on mouseover with a little more detail. There are interesting UX options here we can certainly play with.

So yes, that's a feature that totally makes sense to me, but I don't think it's strictly required for a usable first version, and most other software I've used that allows multi-selection doesn't have a solution to this. I think we should plan to improve later and keep this first iteration simple: if you have more than one item selected, the right pane always shows "N items selected" and buttons for bulk actions, nothing else.

We can explore expansions and more complex behaviour in future, once we see get something working, see how it feels in practice, and get real feedback.

CLAassistant commented 4 months ago

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.