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

fetch query from url parameter #8

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rprimet
Copy link
Collaborator

@rprimet rprimet commented Sep 18, 2020

This change allows the sharing of links pointing directly to a query, which is an important feature in the main neuroquery website.

For instance, try https://notebooks.gesis.org/binder/v2/gh/rprimet/neuroquery_apps/query_string?urlpath=%2Fvoila%2Frender%2Fminimal_dashboard.py%3Fquery%3Dadhd

A further refinement would be to allow creating these sharing links from within the voilà dashboard itself, but this may require some introspection (see if we are running from within a binderhub service, obtain the hostname etc.)

@jeromedockes
Copy link
Member

Awesome! thanks @rprimet , indeed this is an important feature. I will try it out and merge this afternoon

@jeromedockes
Copy link
Member

When I run it locally (with the command in the README), the QUERY_STRING env variable does not seem to be set -- so the example query is always used. Do you observe this too?
Also, should we redirect to a URL including the query when the user enters text in the box and hits the "run query" button?

@rprimet
Copy link
Collaborator Author

rprimet commented Sep 19, 2020

Did you run voilà >= 0.2.2 (the query string feature is fairly recent) ?
It seems to run locally in my case (see screenshot)
qs

Regarding the URL redirection, that's an excellent idea but it would cause the whole page execution to restart IIUC (including loading the model...) which would be fairly slow I guess. A possible hacky workaround might be to edit the URL in-place (that might require some JS?) but I guess a "share query" link in the UI itself would be a good first step and generally more useful, given that, for instance, when running the dashboard in a binderhub setting, copying URLs from the navbar would be ineffective (these point to a temporary single-user jupyter server that gets destroyed after a period of inactivity)

Thoughts?

@jeromedockes
Copy link
Member

I seem to be using voila 0.2.2, but the default query seems to be used:
Screenshot from 2020-09-21 13-53-05

@jeromedockes
Copy link
Member

Regarding the URL redirection, that's an excellent idea but it would cause the whole page execution to restart IIUC (including loading the model...) which would be fairly slow I guess. A possible hacky workaround might be to edit the URL in-place (that might require some JS?)

that's true! let's forget about changing the URL

but I guess a "share query" link in the UI itself would be a good first step and generally more useful, given that, for instance, when running the dashboard in a binderhub setting, copying URLs from the navbar would be ineffective (these point to a temporary single-user jupyter server that gets destroyed after a period of inactivity)

that's a much better idea! I guess we could even have a "copy to clipboard"
button. I may have some time to look into it this weekend but I'm not sure

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