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

feat: Operational OEIS search bar #410

Merged
merged 21 commits into from
Aug 15, 2024
Merged

Conversation

gwhitney
Copy link
Collaborator

By submitting this PR, I am indicating to the Numberscope maintainers that I have read and understood the contributing guidelines and that this PR follows those guidelines to the best of my knowledge. I have also read the pull request checklist and followed the instructions therein.


This commit makes the OEIS search bar operational, and reconfigures it according to group discussions. I don't think we ever discussed the details of the presentation of the returned results themselves, so I am very much open to feedback and suggestions on the workings of the bar.

This is the final planned PR for the sake of cleaning/merging #360, and as such, supersedes that PR.

gwhitney added 12 commits July 24, 2024 11:50
   This PR attempts to resolve numberscope#407. I added a half-dozen OEIS
   sequences as rapidly as I could and didn't get any errors.
   So hopefully this has squashed the problem, but it's hard to
   be certain.
   In order to be sure that parameter values have their "final" values
   in the case of an update (e.g., by calling the Paramable validate()
   method), it is necessary for a cascade of functions to be made async.
   This commit makes those changes and then awaits the validate() in the
   user interface, so that the URL won't be updated until all of the
   consequences of validate() have occurred (which may, for example,
   involve changing the parameter values, perhaps even the one that
   originally had its tentative value modified, necessitating the validate()
   call).

   Resolves numberscope#403.
@katestange
Copy link
Member

First main feedback: The mouse is a "cursor" mouse over the part you need to click on to load the sequence. It turns into a pointer finger only on the link to the OEIS url. So I was confused trying to figure out where I can load the sequence. Is this related to the fact that I get a Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:5173/favicon.ico error in the console?

@katestange
Copy link
Member

Another small observation: There's no way to "back out" of a search except for deleting everything in the search box.... I kind of expected clicking somewhere else or something to back out. I'm not sure if this is what you had in mind or not, and I'm not sure what is the best behaviour, but I thought I would mention that it caused me a little bit of "exploration click time" that didn't result in anything.

@gwhitney
Copy link
Collaborator Author

Is this related to the fact that I get a Failed to load resource: the

No, it's just that I need to add the CSS command to change the cursor. Will do as soon as I have the opportunity.

@gwhitney
Copy link
Collaborator Author

observation: There's no way to "back out" of a search

Happy to implement other "back out" gesture(s) -- but just let me know what would be the intuitive action(s) to back out.

@gwhitney
Copy link
Collaborator Author

No, it's just that I need to add the CSS command to change the cursor. Will do as soon as I have the opportunity.

Yes, that was literally one line, which is now committed.

By the way, I meant to ask: should we bolden or highlight in some other way occurrences of the search string in the displayed names of the search results?

@gwhitney
Copy link
Collaborator Author

gwhitney commented Aug 2, 2024

I don't think I ever mentioned that what's now the second-most-recent commit here is supposed to fix #401. Or rather, #403, but I think/hope it will also fix #401.

@katestange
Copy link
Member

observation: There's no way to "back out" of a search

Happy to implement other "back out" gesture(s) -- but just let me know what would be the intuitive action(s) to back out.

I came back to it and played with it again today and I found myself just trying to click anywhere outside the search box/results area. I think that would be a perfectly fine solution. Then one thing to make sure is that clicking back in the search box, even without further typing, should make the results open again.

Copy link
Member

@katestange katestange left a comment

Choose a reason for hiding this comment

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

It does appear to fix #403 and #401.

src/components/OEISbar.vue Outdated Show resolved Hide resolved
src/components/OEISbar.vue Show resolved Hide resolved
@gwhitney
Copy link
Collaborator Author

I found myself just trying to click anywhere outside the search box/results area. I think that would be a perfectly fine solution. Then one thing to make sure is that clicking back in the search box, even without further typing, should make the results open again.

I was trying to implement this but found I had a question: Right now, when the search results box is popped up, clicking on one of the still-visible sequence preview cards closes the search results and the Change Sequences modal and switches to the clicked sequence (even if that card is only partly visible, but the click is outside the search results. Should that behavior persist, OR while the search results is up, do you want a click outside the search results to close the search results and not do anything else? Thanks for letting me know.

@katestange
Copy link
Member

I was trying to implement this but found I had a question: Right now, when the search results box is popped up, clicking on one of the still-visible sequence preview cards closes the search results and the Change Sequences modal and switches to the clicked sequence (even if that card is only partly visible, but the click is outside the search results. Should that behavior persist, OR while the search results is up, do you want a click outside the search results to close the search results and not do anything else? Thanks for letting me know.

My reaction is that the latter would be less confusing. But you can go with what seems to make sense to you.

@gwhitney
Copy link
Collaborator Author

OR while the search results is up, do you want a click outside the search results to close the search results and not do anything else? Thanks for letting me know.

My reaction is that the latter would be less confusing. But you can go with what seems to make sense to you.

OK, I have committed code intended to result in this latter behavior. You can pull and try it out at your leisure.

  - Return to the OEIS ID being a link but add the Wikipedia
    "external link" icon
  - Highlight the description of each sequence as you mouse over it,
    to provide clue you can click on it (to add as a sequence). The
    color used is a lightened version of the "primary" Numberscope color.
  - Display a message when there are no sequences to show as a result
    of a search. Note this can occur because there are _too many_ matches,
    or _no_ matches, and there is no way to tell which is the case from
    the OEIS api response, unfortunately. The message reflects this.
  - Fixed bug that results were being cached under the wrong search term
    if the searcher typed more while the search was executing.
  - Make sure that enter/clicking on magnifier always fires search
@gwhitney
Copy link
Collaborator Author

gwhitney commented Aug 14, 2024

All right, I think that I've done everything open on this PR. From the latest commit message:

  • Return to the OEIS ID being a link but add the Wikipedia
    "external link" icon
  • Highlight the description of each sequence as you mouse over it,
    to provide clue you can click on it (to add as a sequence). The
    color used is a lightened version of the "primary" Numberscope color.
  • Display a message when there are no sequences to show as a result
    of a search. Note this can occur because there are too many matches,
    or no matches, and there is no way to tell which is the case from
    the OEIS api response, unfortunately. The message reflects this.
  • Fixed bug that results were being cached under the wrong search term
    if the searcher typed more while the search was executing.
  • Make sure that enter/clicking on magnifier always fires search

Of course if you see anything else that needs changing/fixing or if there is anything in the code that needs to be improved, I am happy to develop this PR further. Thanks!

@gwhitney
Copy link
Collaborator Author

P.S. In particular I don't love the phrasing I came up with for an "unsuccessful" search, namely

...... search for foobar gave no/too many results

So if anyone has better/clearer wording for this that is still relatively short, I would be happy to change.

@katestange
Copy link
Member

Two comments:

(1) clicking on magnifier still gives me a tooltip and stops search

(2) for the message, you could try '....... search for foobar failed (OEIS reports no results or too many results)' One advantage of this phrasing is it attempts to pass the blame for the ambiguity ;) But simpler may be '....... search for foobar failed (no results or too many results)'

Everything else works great!

@gwhitney
Copy link
Collaborator Author

gwhitney commented Aug 14, 2024

OK, I think I've taken care of both of those things.

@katestange
Copy link
Member

When the search doesn't come back (axios/network/cors error) currently there's a popup and all interaction is interrupted for the user... but I think in the context of search especially, we should just continue (the same as if the user clicks "ok" on the popup) because it generally resolves itself at that point. At least this is what's happening for me right now. This might be appropriate to this PR or it might be something for post delft todos discussion? Ideas?

@katestange
Copy link
Member

OK, I think I've taken care of both of those things.

I don't think you pushed the commits.

@gwhitney
Copy link
Collaborator Author

I don't think you pushed the commits.

Oops, embarrassing. I have now.

@katestange
Copy link
Member

I don't think you pushed the commits.

Oops, embarrassing. I have now.

Ok, it looks good now. The tooltip pops up mouseover for the magnifier, which is good. Clicking causing search is essentially unverifiable at the moment for me, since my search is returning fast enough on typing (meaning, by the time I move my mouse and click, the search already fired). But that's ok, I don't see any suggested change.

I think the only outstanding issue is the popups on network errors (comment earlier today), which maybe should be disabled during search? Or maybe even entirely. Those popups haven't served a purpose for me other than interrupting things that later fix themselves.

@gwhitney
Copy link
Collaborator Author

but I think in the context of search especially, we should just continue (the same as if the user clicks "ok" on the popup) because it generally resolves itself at that point. At least this is what's happening for me right now. This might be appropriate to this PR or it might be something for post delft todos discussion? Ideas?

OK, I will create and push a commit that catches network errors in the OEIS search and adds a message that the search was temporarily unavailable, please try again, and will not cache that outcome.

@katestange
Copy link
Member

but I think in the context of search especially, we should just continue (the same as if the user clicks "ok" on the popup) because it generally resolves itself at that point. At least this is what's happening for me right now. This might be appropriate to this PR or it might be something for post delft todos discussion? Ideas?

OK, I will create and push a commit that catches network errors in the OEIS search and adds a message that the search was temporarily unavailable, please try again, and will not cache that outcome.

Oh perfect, that sounds like a good solution.

@gwhitney
Copy link
Collaborator Author

OK, I have added such a commit. I will be honest though: I spent a while mashing the keyboard and could not invoke the new error-handling code. Maybe the time of day? (Less load on OEIS server?) So let me know how it works for you when you try it.

@katestange
Copy link
Member

OK, I have added such a commit. I will be honest though: I spent a while mashing the keyboard and could not invoke the new error-handling code. Maybe the time of day? (Less load on OEIS server?) So let me know how it works for you when you try it.

Ok, I just tried it and was able to provoke a server error in the console that was not popped up and not apparent in the browser/user experience. So that's perfect. I don't know why I'm better at making the server mad. :)

@katestange
Copy link
Member

Ok, I believe that everything is in order now with this, shall I squash and merge?

@gwhitney
Copy link
Collaborator Author

You're the reviewer ;-) anyhow, fine by me if you squash and merge -- I don't know of anything else outstanding.

@katestange katestange merged commit c8f3504 into numberscope:ui2 Aug 15, 2024
2 checks passed
@gwhitney gwhitney deleted the oeis_search branch August 15, 2024 22:59
katestange added a commit to katestange/frontscope that referenced this pull request Aug 31, 2024
* refactor: move the OEIS search bar into its own component.

* doc: Basic Modfill -> two OEIS-based Specimens in Gallery

* feat: Dummy search results that pop up on input

* feat: Call a dummy search cmd on input

* feat: list of links and labels for search results

* feat: Clicking on a result adds it

* fix: When you click on link in results don't also add

* feat: Actually search the OEIS.

* feat: Cache search results and reopen search on click.

* ui: Layout and caption changes per design discussions

* fix: Never cache OEIS sequences with infinite indices
   This PR attempts to resolve numberscope#407. I added a half-dozen OEIS
   sequences as rapidly as I could and didn't get any errors.
   So hopefully this has squashed the problem, but it's hard to
   be certain.

* fix: Don't update URL until after parameter values have settled
   In order to be sure that parameter values have their "final" values
   in the case of an update (e.g., by calling the Paramable validate()
   method), it is necessary for a cascade of functions to be made async.
   This commit makes those changes and then awaits the validate() in the
   user interface, so that the URL won't be updated until all of the
   consequences of validate() have occurred (which may, for example,
   involve changing the parameter values, perhaps even the one that
   originally had its tentative value modified, necessitating the validate()
   call).

   Resolves numberscope#403.

* ui: show finger cursor over search results

* make oeis.org link open new tab

* info icon for info in search results

* ui: click off list of OEIS search results closes it

* fix: Restore sequences adding when you click on them in result list.

* fix: Various fixes to OEIS search bar/results per meeting

  - Return to the OEIS ID being a link but add the Wikipedia
    "external link" icon
  - Highlight the description of each sequence as you mouse over it,
    to provide clue you can click on it (to add as a sequence). The
    color used is a lightened version of the "primary" Numberscope color.
  - Display a message when there are no sequences to show as a result
    of a search. Note this can occur because there are _too many_ matches,
    or _no_ matches, and there is no way to tell which is the case from
    the OEIS api response, unfortunately. The message reflects this.
  - Fixed bug that results were being cached under the wrong search term
    if the searcher typed more while the search was executing.
  - Make sure that enter/clicking on magnifier always fires search

* fix: Don't make switcher cards for dummy message IDs

* fix: Really make sure magnifier puts/keeps search results up; reword message

* fix: catch errors in OEIS searching and report a 'soft' failure

---------

Co-authored-by: Kate Stange <[email protected]>
katestange added a commit to katestange/frontscope that referenced this pull request Oct 10, 2024
* refactor: move the OEIS search bar into its own component.

* doc: Basic Modfill -> two OEIS-based Specimens in Gallery

* feat: Dummy search results that pop up on input

* feat: Call a dummy search cmd on input

* feat: list of links and labels for search results

* feat: Clicking on a result adds it

* fix: When you click on link in results don't also add

* feat: Actually search the OEIS.

* feat: Cache search results and reopen search on click.

* ui: Layout and caption changes per design discussions

* fix: Never cache OEIS sequences with infinite indices
   This PR attempts to resolve numberscope#407. I added a half-dozen OEIS
   sequences as rapidly as I could and didn't get any errors.
   So hopefully this has squashed the problem, but it's hard to
   be certain.

* fix: Don't update URL until after parameter values have settled
   In order to be sure that parameter values have their "final" values
   in the case of an update (e.g., by calling the Paramable validate()
   method), it is necessary for a cascade of functions to be made async.
   This commit makes those changes and then awaits the validate() in the
   user interface, so that the URL won't be updated until all of the
   consequences of validate() have occurred (which may, for example,
   involve changing the parameter values, perhaps even the one that
   originally had its tentative value modified, necessitating the validate()
   call).

   Resolves numberscope#403.

* ui: show finger cursor over search results

* make oeis.org link open new tab

* info icon for info in search results

* ui: click off list of OEIS search results closes it

* fix: Restore sequences adding when you click on them in result list.

* fix: Various fixes to OEIS search bar/results per meeting

  - Return to the OEIS ID being a link but add the Wikipedia
    "external link" icon
  - Highlight the description of each sequence as you mouse over it,
    to provide clue you can click on it (to add as a sequence). The
    color used is a lightened version of the "primary" Numberscope color.
  - Display a message when there are no sequences to show as a result
    of a search. Note this can occur because there are _too many_ matches,
    or _no_ matches, and there is no way to tell which is the case from
    the OEIS api response, unfortunately. The message reflects this.
  - Fixed bug that results were being cached under the wrong search term
    if the searcher typed more while the search was executing.
  - Make sure that enter/clicking on magnifier always fires search

* fix: Don't make switcher cards for dummy message IDs

* fix: Really make sure magnifier puts/keeps search results up; reword message

* fix: catch errors in OEIS searching and report a 'soft' failure

---------

Co-authored-by: Kate Stange <[email protected]>
katestange added a commit to katestange/frontscope that referenced this pull request Oct 13, 2024
* refactor: move the OEIS search bar into its own component.

* doc: Basic Modfill -> two OEIS-based Specimens in Gallery

* feat: Dummy search results that pop up on input

* feat: Call a dummy search cmd on input

* feat: list of links and labels for search results

* feat: Clicking on a result adds it

* fix: When you click on link in results don't also add

* feat: Actually search the OEIS.

* feat: Cache search results and reopen search on click.

* ui: Layout and caption changes per design discussions

* fix: Never cache OEIS sequences with infinite indices
   This PR attempts to resolve numberscope#407. I added a half-dozen OEIS
   sequences as rapidly as I could and didn't get any errors.
   So hopefully this has squashed the problem, but it's hard to
   be certain.

* fix: Don't update URL until after parameter values have settled
   In order to be sure that parameter values have their "final" values
   in the case of an update (e.g., by calling the Paramable validate()
   method), it is necessary for a cascade of functions to be made async.
   This commit makes those changes and then awaits the validate() in the
   user interface, so that the URL won't be updated until all of the
   consequences of validate() have occurred (which may, for example,
   involve changing the parameter values, perhaps even the one that
   originally had its tentative value modified, necessitating the validate()
   call).

   Resolves numberscope#403.

* ui: show finger cursor over search results

* make oeis.org link open new tab

* info icon for info in search results

* ui: click off list of OEIS search results closes it

* fix: Restore sequences adding when you click on them in result list.

* fix: Various fixes to OEIS search bar/results per meeting

  - Return to the OEIS ID being a link but add the Wikipedia
    "external link" icon
  - Highlight the description of each sequence as you mouse over it,
    to provide clue you can click on it (to add as a sequence). The
    color used is a lightened version of the "primary" Numberscope color.
  - Display a message when there are no sequences to show as a result
    of a search. Note this can occur because there are _too many_ matches,
    or _no_ matches, and there is no way to tell which is the case from
    the OEIS api response, unfortunately. The message reflects this.
  - Fixed bug that results were being cached under the wrong search term
    if the searcher typed more while the search was executing.
  - Make sure that enter/clicking on magnifier always fires search

* fix: Don't make switcher cards for dummy message IDs

* fix: Really make sure magnifier puts/keeps search results up; reword message

* fix: catch errors in OEIS searching and report a 'soft' failure

---------

Co-authored-by: Kate Stange <[email protected]>
gwhitney added a commit that referenced this pull request Jan 20, 2025
* refactor: move the OEIS search bar into its own component.

* doc: Basic Modfill -> two OEIS-based Specimens in Gallery

* feat: Dummy search results that pop up on input

* feat: Call a dummy search cmd on input

* feat: list of links and labels for search results

* feat: Clicking on a result adds it

* fix: When you click on link in results don't also add

* feat: Actually search the OEIS.

* feat: Cache search results and reopen search on click.

* ui: Layout and caption changes per design discussions

* fix: Never cache OEIS sequences with infinite indices
   This PR attempts to resolve #407. I added a half-dozen OEIS
   sequences as rapidly as I could and didn't get any errors.
   So hopefully this has squashed the problem, but it's hard to
   be certain.

* fix: Don't update URL until after parameter values have settled
   In order to be sure that parameter values have their "final" values
   in the case of an update (e.g., by calling the Paramable validate()
   method), it is necessary for a cascade of functions to be made async.
   This commit makes those changes and then awaits the validate() in the
   user interface, so that the URL won't be updated until all of the
   consequences of validate() have occurred (which may, for example,
   involve changing the parameter values, perhaps even the one that
   originally had its tentative value modified, necessitating the validate()
   call).

   Resolves #403.

* ui: show finger cursor over search results

* make oeis.org link open new tab

* info icon for info in search results

* ui: click off list of OEIS search results closes it

* fix: Restore sequences adding when you click on them in result list.

* fix: Various fixes to OEIS search bar/results per meeting

  - Return to the OEIS ID being a link but add the Wikipedia
    "external link" icon
  - Highlight the description of each sequence as you mouse over it,
    to provide clue you can click on it (to add as a sequence). The
    color used is a lightened version of the "primary" Numberscope color.
  - Display a message when there are no sequences to show as a result
    of a search. Note this can occur because there are _too many_ matches,
    or _no_ matches, and there is no way to tell which is the case from
    the OEIS api response, unfortunately. The message reflects this.
  - Fixed bug that results were being cached under the wrong search term
    if the searcher typed more while the search was executing.
  - Make sure that enter/clicking on magnifier always fires search

* fix: Don't make switcher cards for dummy message IDs

* fix: Really make sure magnifier puts/keeps search results up; reword message

* fix: catch errors in OEIS searching and report a 'soft' failure

---------

Co-authored-by: Kate Stange <[email protected]>
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.

2 participants