Skip to content

FIREFLY-1964: Alert Viewer UI Updates and add URL API support#1934

Open
kpuriIpac wants to merge 5 commits intodevfrom
FIREFLY-1964-alert-viewer
Open

FIREFLY-1964: Alert Viewer UI Updates and add URL API support#1934
kpuriIpac wants to merge 5 commits intodevfrom
FIREFLY-1964-alert-viewer

Conversation

@kpuriIpac
Copy link
Copy Markdown
Contributor

@kpuriIpac kpuriIpac commented Apr 9, 2026

Ticket: https://jira.ipac.caltech.edu/browse/FIREFLY-1964

  • UI changes according to ticket
  • Added support for URL API
  • Call Rubin Service (set it up via AppProperties so Rubin can configure it, relying on default fallback to work for firefly testing)
    • URL uploads no longer supported, only Alert IDs (I can add back URL support as well - if we'd want that. In that case, server side code will bypass checking AppProperties for base URL and just rely on user entered URL to retrieve a FITs file)

Testing:
Firefly's AlertViewer: https://fireflydev.ipac.caltech.edu/firefly-1964-alert-viewer/firefly

  • Test out these Alert IDs:
    • 170059278837088375, 170112073844916273
    • They will fail on the above test build with Unable to retrieve the FITS file: 401 Unauthorized
    • But you can checkout my branch and test the UI changes locally

@kpuriIpac kpuriIpac added this to the 2026.1 milestone Apr 9, 2026
@kpuriIpac kpuriIpac self-assigned this Apr 9, 2026
@kpuriIpac kpuriIpac force-pushed the FIREFLY-1964-alert-viewer branch from 6d155d4 to a208732 Compare April 10, 2026 01:25
@kpuriIpac kpuriIpac requested a review from robyww April 10, 2026 01:36
@kpuriIpac kpuriIpac marked this pull request as ready for review April 10, 2026 01:36
@robyww
Copy link
Copy Markdown
Contributor

robyww commented Apr 10, 2026

Some initial feedback:

  • The title is just the FITS file, It should look nice, at the very least it should be: Alert: 170059278837088375.
  • The FITS images are not named: Science, Template, Difference
  • The primary purpose of the URL api is to take an alert id.
    such as
http://localhost:8080/firefly/alertviewer?api=alert&id=170059278837088375
Screenshot 2026-04-10 at 10 39 43 AM

Copy link
Copy Markdown
Contributor

@robyww robyww left a comment

Choose a reason for hiding this comment

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

The code mostly looks fine. There are still several things to do the the UI and url api.

@@ -176,6 +193,10 @@ function loadFromEntries(result) {

dispatchPlotImage({plotId, wpRequest, viewerId: ALERT.IMG_VIEWER, setNewPlotAsActive: i === 0});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

put the title in the wpRequest


const {hasMainTable, hasDetailTable, hasImages} = useStoreConnector(getAlertData);
const {source, fileName} = useStoreConnector(() => getComponentState(ALERT.STATE_ID));
const alertTitle = fileName || source || 'Alert Viewer';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

modify to have a better title.

],
parameters: {
source: {desc: 'FITS URL or alert id to populate into Alert Viewer', isRequired: true},
execute: 'true or false - if true execute the alert load immediately'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

you don't need execute, it should just always execute.

there should just be an id parameter and it should load the alert.

@kpuriIpac kpuriIpac force-pushed the FIREFLY-1964-alert-viewer branch from a208732 to 52b1291 Compare April 13, 2026 15:48
@kpuriIpac
Copy link
Copy Markdown
Contributor Author

kpuriIpac commented Apr 13, 2026

@robyww I addressed the feedback. Can you take a look at the UI again? Didn't do a test build as we need to test this locally anyway.
(I kept the title as Alert ID: 170059278837088375 but formatted it to look a little better. Still thinking about better title text options).

@robyww
Copy link
Copy Markdown
Contributor

robyww commented Apr 13, 2026

This url is correct but it does not execute the search. It should.

http://localhost:8080/firefly/alertviewer?api=alert&id=170059278837088375

It only goes to the alert panel and shows an empty panel. It need to show an result.

Copy link
Copy Markdown
Contributor

@robyww robyww left a comment

Choose a reason for hiding this comment

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

I think this is almost done. The overall layout looks good.

Two big things:

  • The title
  • the URL Api showing results.

Comment on lines +92 to +94
<Typography level='title-md' sx={{fontFamily: 'monospace'}} color='neutral'>
Alert ID: {id}
</Typography>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

you don't need to change the font here. This is a title it should look very clean.

I the text should be 'title-md' and value (id) should be body-md

return makeError(source, "Unable to retrieve the FITS file for alert ID: " + source);
}
final int responseCode = fileInfo.getResponseCode();
if (responseCode > 305 || responseCode < 200) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

make sure you response code align the the document response codes of the service.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point. This is too generic. I looked at the repsonse codes and messages for GET /api/alerts?ID={alert_id} at https://sqr-114.lsst.io/v/DM-54197/index.html and added the relevant messages for those exact response codes. For any other codes, I'll keep the existing generic message.

Comment on lines +172 to +174
return baseUrl + joiner +
ALERT_ID + "=" + URLEncoder.encode(alertId, StandardCharsets.UTF_8) + "&" +
RESPONSEFORMAT + "=" + FITS_RESPONSE_FORMAT;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You could you String.format here.

Comment on lines +32 to +39
return [
{
cmd: 'alert',
validate: validateAlertViewer,
execute: showAlertViewer,
...alertViewerOverview,
examples: makeExamples('alert', alertViewerExamples),
},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is all good but it is not showing an alert result.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed! Took me too long to figure this out - but routed apps don't receive initArgs the same way as the rest of firefly. Just needed to use useContext(InitArgsCtx). We already do this for Euclid & Spherex.

@kpuriIpac kpuriIpac force-pushed the FIREFLY-1964-alert-viewer branch 2 times, most recently from 4282437 to f80d656 Compare April 14, 2026 00:17
@kpuriIpac
Copy link
Copy Markdown
Contributor Author

@robyww addressed the last few changes and fixed URL API. Can you test once more and let me know if it all looks good?

@kpuriIpac kpuriIpac force-pushed the FIREFLY-1964-alert-viewer branch from f80d656 to 69b483f Compare April 14, 2026 00:30
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