avo
avo copied to clipboard
Feature: Ability to see the search result in index page
Feature
When a user enters a search query related to resources, the search results only appears in a dialog list upon clicking the search box. This can be limiting as users may not be aware of the hover functionality or might prefer to see all relevant resources listed directly.
Current workarounds
The search is shown in dialog and then we have to find the result from the dialog and navigate to the record details page.
Additional context
Yes, I agree! This should be a feature of Avo and have that search be done in-line. That's a better experience.
I don't think it should be super difficult to implement using turbo streams and replace the table results.
Would you be open to try and implement this feature? I could help with setting an approach and help you with navigating the codebase.
Sure, I would love to.
I'm laying down the approach for this refactor.
Approach
- remove the JS search input here
- add a regular text input
- connect a Stimulus controller to that input which will listen for input changes and send a request to the server with the query using https://github.com/rails/request.js. the
responseKindshould beturbo-streamin order to be interpreted by Turbo - the request should not be aimed at the
search_controller, but at theBaseController#indexwith theqparam populated with the value in the field - the
BaseController#indexshould see that and add it to the query using a new method we create around here - this new method will apply the search query the user has configured on the resource
- because we already have a turbo-frame wrapping the table here the content should be automatically updated
- there might be some issues around the pagination, but I think we can fix that by wrapping it in another turbo-frame as well
I believe this to be the "meat" of the feature. There are other things we need to consider but after we do these above.
Other considerations:
- the request that is made to the server should forward all query params such as
filters,encoded_filters, and others - the pagination should be updated
Thank you for taking this on! This is a feature we wanted to bring to our users a while back.
Hey @SahSantoshh, how does progress go with this? Can we help with anything?
It's been hectic days with quater-end. Planned to on it this weekend.
Awesome! LMK if I can help with anything. Thank you!