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

Add support for running the ANISE GUI in the browser #143

Merged
merged 8 commits into from
Dec 11, 2023

Conversation

thomasantony
Copy link
Contributor

@thomasantony thomasantony commented Dec 6, 2023

Summary

This PR makes some changes that enable running the ANISE GUI in the browser. This could be deployed to a static HTML page and hosted on Github Pages for ease-of-access.

Running the web version locally is best done using Trunk. Install it by running cargo install --locked trunk (or follow instructions in the linked page above). The ANISE GUI can then be built and launched by running

trunk serve --features gui

This will start up a web server (only used for local testing), at http://127.0.0.1:8080/.

Trunk can also be used for building the WASM binary and associated index.html and JS file by running:

trunk build --release --features gui

The files generated in dist/ can be published to Github pages or any other static web-host.

Architectural Changes

  • An updated version of hifitime is required. See this PR: Adds support for using hifitime in WASM targets hifitime#262 . Currently, Cargo.toml points to my branch of hifitime. Once that PR is merged, I can update it to point to the new version on crates.io.

  • Almanac::load() has been split up into two methods: Almanac::load() and Almanac::load_from_bytes(). The latter is used when loading files from the GUI running in the browser.

  • Additional logic in ui.rs for loading the file using a browser-based file picker instead of the native file picker. This required some additional async stuff in the code. However, all of these new things are only built if compiled for the wasm32-unknown-unknown target

  • The browser does not have an implementation of memory-mapped IO. So loading large files might use up a bunch of memory.

New Features

This PR enables running the ANISE GUI from a web browser.

Testing and validation

Manually tested the GUI.

image

@ChristopherRabotin
Copy link
Member

Sweet, thanks! I'll need to test this.

Copy link

codecov bot commented Dec 6, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (7206d6a) 76.93% compared to head (fa9bdd7) 76.94%.

❗ Current head fa9bdd7 differs from pull request most recent head 1281857. Consider uploading reports for the commit 1281857 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #143   +/-   ##
=======================================
  Coverage   76.93%   76.94%           
=======================================
  Files          67       67           
  Lines        7595     7602    +7     
=======================================
+ Hits         5843     5849    +6     
- Misses       1752     1753    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ChristopherRabotin
Copy link
Member

ChristopherRabotin commented Dec 8, 2023

I was trying to see if I could run this without the javascript time but it doesn't work. I'll need to make a new release of hifitime first, and I don't quite want to add the instant crate into hifitime for the reasons outlines in the other PR.

Updating hifitime isn't my highest priority at the moment, it's after both Nyx and ANISE Python support. Specifically, nyx-space/nyx#260, then #136, and then nyx-space/nyx#86.

Hence I'm afraid I'll keep this PR open for a while, likely until late January. Sorry about that.

Copy link
Member

@ChristopherRabotin ChristopherRabotin left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

src/bin/anise-gui/main.rs Show resolved Hide resolved
@thomasantony
Copy link
Contributor Author

I will update this PR once you create a new release for hifitime

@ChristopherRabotin ChristopherRabotin merged commit 7acdf5c into nyx-space:master Dec 11, 2023
8 checks passed
@thomasantony thomasantony deleted the web-support branch December 12, 2023 03:35
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