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

Search UI overhaul #807

Merged
merged 23 commits into from
Jan 19, 2024
Merged

Search UI overhaul #807

merged 23 commits into from
Jan 19, 2024

Conversation

rdbende
Copy link
Collaborator

@rdbende rdbende commented Dec 3, 2023

Done:

  • Move search into a stack page in the main view instead of the popover
  • Refactor code that should actually belong to the viewmodel

Remaining issue:

  • Since the space key is a global shortcut for play/pause, it can't be inserted into the search bar

@rdbende
Copy link
Collaborator Author

rdbende commented Dec 10, 2023

Remaining issue:

  • Since the space key is a global shortcut for play/pause, it can't be inserted into the search bar

Disabling the action while the search view is open solved the issue.

TODO:

  • Add Ctrl+F as shortcut

@rdbende rdbende mentioned this pull request Dec 14, 2023
@geigi
Copy link
Owner

geigi commented Jan 2, 2024

The new search looks really cool! Thanks for implementing it. It seems like there are two small merge conflicts but other than that it looks good to me :)

@rdbende
Copy link
Collaborator Author

rdbende commented Jan 4, 2024

After the PRs related to UI are merged, I should really do #801. Resolving conflicts in the XML files is such a mess :(

@naglis could you give an approval on my conflict resolution?

Copy link
Contributor

@naglis naglis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not notice any problems in the conflict resolution :)

A few things I have noticed about the search while testing locally:

  1. self._fs_monitor.get_book_online is called twice for each book on each search (IIUC once when SearchViewModel.authors property is called and once for SearchViewModel.readers property).
  2. "Hide unavailable books" setting is not respected for book results - if I have it enabled, I still get book results from storage that is offline (NOTE: AFAIR, this feature did not work at all prior to this PR). IIUC this is because in SearchViewModel.search() the books set is built directly from self._model.books, without checking if the books are online.

I believe both issues could be resolved e.g. if the search was further refactored by first getting the "online" books (if "Hide unavailable books" setting is enabled, all books otherwise) and then using it for both computing the set of books that match the query and building the author/reader results as well. This way self._fs_monitor.get_book_online would be called once per book. Not sure if this should be done in a separate PR.

cozy/ui/search_view.py Outdated Show resolved Hide resolved
cozy/ui/search_view.py Show resolved Hide resolved
cozy/ui/widgets/search_results.py Outdated Show resolved Hide resolved
@rdbende
Copy link
Collaborator Author

rdbende commented Jan 6, 2024

Codeclimate is complaining about non-existent problems again :/

@rdbende rdbende requested a review from naglis January 6, 2024 11:57
@rdbende
Copy link
Collaborator Author

rdbende commented Jan 6, 2024

A few things I have noticed about the search while testing locally:

  1. self._fs_monitor.get_book_online is called twice for each book on each search (IIUC once when SearchViewModel.authors property is called and once for SearchViewModel.readers property).

  2. "Hide unavailable books" setting is not respected for book results - if I have it enabled, I still get book results from storage that is offline (NOTE: AFAIR, this feature did not work at all prior to this PR). IIUC this is because in SearchViewModel.search() the books set is built directly from self._model.books, without checking if the books are online.

Fixd.

cozy/view_model/search_view_model.py Outdated Show resolved Hide resolved
cozy/view_model/search_view_model.py Outdated Show resolved Hide resolved
@rdbende
Copy link
Collaborator Author

rdbende commented Jan 7, 2024

@naglis, could you give a final approval, so that GH allows me to merge this?
It blocks many other things and will cause conflicts with other PRs, so it would be good to have it in master. I can do the rest in separate pull requests if needed.

@rdbende rdbende requested a review from naglis January 7, 2024 10:46
@naglis
Copy link
Contributor

naglis commented Jan 7, 2024

@naglis, could you give a final approval, so that GH allows me to merge this? It blocks many other things and will cause conflicts with other PRs, so it would be good to have it in master. I can do the rest in separate pull requests if needed.

@rdbende I think you need approval from someone with write/admin permissions (not sure how it is configured), as my approvals are gray.

@rdbende
Copy link
Collaborator Author

rdbende commented Jan 7, 2024

Huh, yeah. Never mind. Apparently this approval doesn't work if you don't have write access. I didn't know about it 😕

@rdbende
Copy link
Collaborator Author

rdbende commented Jan 7, 2024

Anyway, your reviews were useful, so thanks for that!

@geigi geigi merged commit 4d5df20 into geigi:master Jan 19, 2024
3 of 4 checks passed
@geigi
Copy link
Owner

geigi commented Jan 19, 2024

Finally merged! Thanks for the additional review @naglis and the fixes @rdbende!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants