Skip to content
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

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

Open
SahSantoshh opened this issue Jun 6, 2024 · 6 comments · May be fixed by #3134
Open

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

SahSantoshh opened this issue Jun 6, 2024 · 6 comments · May be fixed by #3134
Assignees
Labels
Enhancement New feature or request Help wanted We could use some help with this High Impact Javascript Pull requests that update Javascript code Refactor

Comments

@SahSantoshh
Copy link

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

@SahSantoshh SahSantoshh changed the title Ability to see the search result in index table Ability to see the search result in index page Jun 6, 2024
@adrianthedev adrianthedev added Enhancement New feature or request Help wanted We could use some help with this Refactor Javascript Pull requests that update Javascript code labels Jun 7, 2024
@adrianthedev
Copy link
Collaborator

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
Copy link
Author

Sure, I would love to.

@adrianthedev
Copy link
Collaborator

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:

  • 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.

@adrianthedev
Copy link
Collaborator

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

@SahSantoshh
Copy link
Author

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

@adrianthedev
Copy link
Collaborator

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

@SahSantoshh SahSantoshh changed the title Ability to see the search result in index page Feature: Ability to see the search result in index page Aug 14, 2024
@SahSantoshh SahSantoshh linked a pull request Aug 14, 2024 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request Help wanted We could use some help with this High Impact Javascript Pull requests that update Javascript code Refactor
Projects
Status: Doing
Development

Successfully merging a pull request may close this issue.

2 participants