Skip to content

Conversation

robyww
Copy link
Contributor

@robyww robyww commented Aug 19, 2025

Firefly-1815: Upload via a action, usually from firefly_client

  • Also added URL API support

Testing From Python firefly_client

Test loading to the upload panel

import os
from firefly_client import FireflyClient
ffurl= 'https://fireflydev.ipac.caltech.edu/firefly-1815-upload/firefly/'
fc = FireflyClient.make_client(ffurl, channel_override='up')
file= 'path to a fits and/or table file'
key= fc.upload_file(file)
fc.dispatch('app_data.externalUpload', {'fileOnServer':key, 'displayName':os.path.basename(file)})

Test immediate loading, change last line to add 'immediate':True

fc.dispatch('app_data.externalUpload', {'immediate':True, 'fileOnServer':key, 'displayName':os.path.basename(file)})

Test a url

fc.dispatch('app_data.externalUpload', {'url':'http://web.ipac.caltech.edu/staff/roby/data-products-test/1904-66_SFL.fits' })

Testing URL API

@robyww robyww requested a review from jaladh-singhal August 19, 2025 21:42
@robyww robyww self-assigned this Aug 19, 2025
@robyww robyww added this to the 2025.4 milestone Aug 20, 2025
Copy link
Member

@jaladh-singhal jaladh-singhal left a comment

Choose a reason for hiding this comment

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

This is really great!!! ❤️
I tested it out from python and it works well for both immediate and non-immediate case. Now I can easily write a generic function for the python client using this.

Code looks good - error handling needs some polishing (see my comments).


I noticed a bug with menu tabs switching which I remember used to exist but is now more noticeable with subsequent uploads:

  • Do fc.dispatch('app_data.externalUpload', {'fileOnServer':key, 'displayName':os.path.basename(file)}), firefly client will open the "Upload" tab with preloaded file option. Now without changing anything in UI, do fc.dispatch('app_data.externalUpload', {'immediate':True, 'fileOnServer':key, 'displayName':os.path.basename(file)}), firefly client will take you to Results page but the tab remains stuck at "Upload". You can ofc fix it by clicking on "Results" tab but it's odd behavior since the UI now has a tab view (I know results is still a dropdown in our logic).
  • The same bug can be reproduced for other firefly_client functions too: Open firefly client, go to any tab other than results (let's say "Images"), and then do fc.show_fits(plot_id="wise-fullimage", URL='http://irsa.ipac.caltech.edu/ibe/data/wise/allsky/4band_p1bm_frm/6a/02206a/149/02206a149-w1-int-1b.fits'), it will show "Results" page but tab will remain stuck at "Images" until you manually click the "Results"

Can firefly be made globally aware that if any externally dispatched action opens Results page, also change the tab to "Results"? (This can probably be separated in another ticket)

@robyww robyww changed the title Firefly-1815: upload a file via an action, usally firefly_client Firefly-1815: upload a file via an action, usually firefly_client Aug 26, 2025
@robyww
Copy link
Contributor Author

robyww commented Aug 27, 2025

Do fc.dispatch('app_data.externalUpload', {'fileOnServer':key, 'displayName':os.path.basename(file)}), firefly client will open the "Upload" tab with preloaded file option. Now without changing anything in UI, do fc.dispatch('app_data.externalUpload', {'immediate':True, 'fileOnServer':key, 'displayName':os.path.basename(file)}), firefly client will take you to Results page but the tab remains stuck at "Upload". You can ofc fix it by clicking on "Results" tab but it's odd behavior since the UI now has a tab view (I know results is still a dropdown in our logic).

I will see it I can fix it in this ticket. Otherwise I will make a new one.
Update: I will fix it.

@robyww robyww force-pushed the FIREFLY-1815-upload branch 5 times, most recently from 5d022a8 to 50f330f Compare August 28, 2025 18:57
 - includes clean up and response to feedback
@robyww robyww force-pushed the FIREFLY-1815-upload branch from 50f330f to 434abe1 Compare August 28, 2025 19:09
Copy link
Member

@jaladh-singhal jaladh-singhal left a comment

Choose a reason for hiding this comment

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

Error messaging updates look good - the info popup is helpful. I also tested the issue I reported with tabs not switching correctly - it's fixed now.

Also the URL API with load command is a great addition!

@robyww robyww merged commit 3de0bcf into dev Aug 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants