avo-hq / avo

Build Ruby on Rails apps 10x faster
https://avohq.io
Other
1.51k stars 242 forks source link

Feature: Ability to see the search result in index page #2842

Open SahSantoshh opened 4 months ago

SahSantoshh commented 4 months ago

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

adrianthedev commented 4 months ago

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.

SahSantoshh commented 4 months ago

Sure, I would love to.

adrianthedev commented 3 months ago

I'm laying down the approach for this refactor.

Approach

  1. remove the JS search input here
  2. add a regular text input
  3. 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 responseKind should be turbo-stream in order to be interpreted by Turbo
  4. the request should not be aimed at the search_controller, but at the BaseController#index with the q param populated with the value in the field
  5. the BaseController#index should see that and add it to the query using a new method we create around here
  6. this new method will apply the search query the user has configured on the resource
  7. because we already have a turbo-frame wrapping the table here the content should be automatically updated
  8. 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:

Thank you for taking this on! This is a feature we wanted to bring to our users a while back.

adrianthedev commented 3 months ago

Hey @SahSantoshh, how does progress go with this? Can we help with anything?

SahSantoshh commented 3 months ago

It's been hectic days with quater-end. Planned to on it this weekend.

adrianthedev commented 3 months ago

Awesome! LMK if I can help with anything. Thank you!