Skip to content
This repository has been archived by the owner on Jan 10, 2021. It is now read-only.

Yew frontend #1

Merged
merged 18 commits into from
Jan 10, 2021
Merged

Yew frontend #1

merged 18 commits into from
Jan 10, 2021

Conversation

luizirber
Copy link
Owner

@luizirber luizirber commented Nov 18, 2020

This PR rewrites the frontend in Yew, a "modern Rust framework for creating multi-threaded front-end web apps with WebAssembly". Main benefit compared to https://github.com/luizirber/wort-dnd (which is the base for https://blog.luizirber.org/2018/08/27/sourmash-wasm/) are:

  • the use of web workers to offload signature calculation (and avoid blocking the main thread)
  • I can actually understand what's happening, and avoid a lot of bad JS decisions I took in wort-dnd 😬
  • no dependency on webpack to bundle it all up for usage (it was getting hard to transition from v4 to v5 and keep wasm working)
  • I can actually use Rust crates in the frontend (niffler, needletail)
  • even better, I can use the same GatherResult struct in the backend and the frontend!

Other things happening in this PR:

Still left to consider:

  • the frontend has to read the full dataset in the main thread, and send it to the worker. It would be great to send the File to the worker, and let it read the data by chunks. It seems to be doable with JS web workers, but I didn't figure out how to do it with Yew/wasm yet.
  • the old UI was based on drag-and-drop, but that's annoying in general and actually using an input and selecting a file is easier (especially in mobile). But it would be nice to bring back DnD too.
  • The progress bar and download buttons are not working yet.
  • Send a compressed sig to /gather (and save some bandwidth?)

@taylorreiter
Copy link

Would be nice if it threw and error message when e.g. amino acid sequences were uploaded

@taylorreiter
Copy link

I would really love to be able to use this on signatures I have laying around already, instead of only on fastq/fasta

@taylorreiter
Copy link

Progress bar would make it more intuitive that it is running, but it's so fast that it might slow the thing down

@taylorreiter
Copy link

I just saw that firefox gives a lock with a red slash through it in the URL. Because I trust you/greyhound and know what it's doing, I'm fine with that, but for users who don't more description could be nice

@luizirber
Copy link
Owner Author

This is all amazing feedback, thanks @taylorreiter!

Would be nice if it threw and error message when e.g. amino acid sequences were uploaded

Yup, error handling is still VERY lacking along all of greyhound. This includes properly reporting errors when calling /gather on the server too.

I would really love to be able to use this on signatures I have laying around already, instead of only on fastq/fasta

That is also doable, I can check if the file is a signature or FASTA/Q and react appropriately.

Progress bar would make it more intuitive that it is running, but it's so fast that it might slow the thing down

I had this working before doing this wasm frontend, I'll need to emit some signals to update the progress bar, but also pretty doable.

I just saw that firefox gives a lock with a red slash through it in the URL. Because I trust you/greyhound and know what it's doing, I'm fine with that, but for users who don't more description could be nice

Good catch, I need to setup nginx (or caddy?) properly to serve the pages, and so add HTTPS (and run on ports 80 and 443 too, and avoid the silliness of running on :8080.

@luizirber
Copy link
Owner Author

I just saw that firefox gives a lock with a red slash through it in the URL. Because I trust you/greyhound and know what it's doing, I'm fine with that, but for users who don't more description could be nice

OK, this is fixed (now using caddy to serve via HTTPS, and also running on regular ports). The old :8080 URL still works too =] (redirecting to HTTPS)

@luizirber
Copy link
Owner Author

Another TODO:

  • Add a button to load some demo data, in case the user doesn't have some sequencing data around to test it.

@luizirber luizirber merged commit 0953d7b into latest Jan 10, 2021
@luizirber luizirber deleted the frontend branch January 10, 2021 00:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants