simularium / simularium-website

Front end website for the Simularium project, includes the Simularium viewer
https://simularium.allencell.org
Apache License 2.0
6 stars 3 forks source link

change check for if a file is shareable #439

Closed meganrm closed 11 months ago

meganrm commented 11 months ago

Problem

Closes #436

Solution

The binary between "networked file" and "local file" is not exactly what we needed for if a file is sharable. "networked" means it is hosted on our server, "local" means it's been loaded into local memory. When you load a file that is hosted on dropbox or other cloud storage, it's technically "local" because it's stored in local memory, but it is still shareable. So I made a new utility function that just checks that there is url param for either a networked file or a cloud storage file.

One additional change: I was checking other places we are differentiating between the two just to make sure there wasn't the same problem elsewhere and I saw that we were using a type guard to check if a file is networked, but we had a more extensive check as a selector, so I swapped those.

Type of change

Please delete options that are not relevant.

Steps to Verify:

  1. npm start
  2. load Simularium file from your computer, hit share, should get can't share message
  3. load http://localhost:9001/viewer?trajUrl=https://www.dropbox.com/scl/fi/2srfuliyjnu3sr1tlfgwf/cells_2023-10-04.simularium?rlkey=hg35vs9cwrla19eq2m0al81t4
  4. hit share, should be able to share it.

Screenshots (optional):

Screenshot 2023-10-05 at 11 53 54 AM
github-actions[bot] commented 11 months ago

Coverage report

St.:grey_question:
Category Percentage Covered / Total
🟑 Statements
74.94% (+0.1% πŸ”Ό)
589/786
🟑 Branches
70.18% (+0.53% πŸ”Ό)
80/114
πŸ”΄ Functions
42.16% (+0.31% πŸ”Ό)
78/185
🟑 Lines
73.5% (+0.07% πŸ”Ό)
527/717

Test suite run success

99 tests passing in 7 suites.

Report generated by πŸ§ͺjest coverage report action from 4d0ee6734b22d702415b9621c502e68953eb1a00