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

Allow Browse Table Contents to be downloaded #640

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

acoffman
Copy link
Member

@acoffman acoffman commented Oct 5, 2022

This is a proof of concept of adding a "download" button to browse tables. There are a couple of tricky parts here:

  • We want to respect any filtering the user has done in the downloaded file.
  • We can't do this client side super easily as we want all the data, not just the currently displayed, and the client displays things as tags and overflows which aren't really "downloadable" as a TSV
  • As we have "infinite scroll" rather than traditional pagination, we want to stream the response so we don't have every single row in memory at once.
  • The GQL runtime returns JSON only

What I've done here is add a different non-graphql route to the server. This route will accept requests that look like GraphQL but return TSV instead. This is done utilizing the fact that the SearchObject plugin we use for the browse tables can be used outside the graphql context.

The new controller will grab the variables from the query, pass them into the specified SearchObject and then stream the result back out as a TSV. It basically just requires that you map a table_name to the correct resolver in the hash in the controller, and then you implement table_headers and to_row in the resolver so it knows how to represent a table entry in TSV.

You can see how its pretty straightforward to hook up on the frontend as well.

closes #389 (if/when we implement it on all tables).

@acoffman acoffman added the new-feature PR Label for newly added features. Will appear in release notes. label Oct 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-feature PR Label for newly added features. Will appear in release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add download capability to various browse tables
1 participant