1- import React , { useEffect , useState } from 'react' ;
1+ import React , { useContext , useEffect , useState } from 'react' ;
22import PropTypes from 'prop-types' ;
33import { showInfoPopup } from 'firefly/ui/PopupUtil' ;
44import { Button , IconButton , Input , Stack , Typography } from '@mui/joy' ;
@@ -17,16 +17,18 @@ import {getJsonData} from 'firefly/rpc/SearchServicesJson';
1717import { ServerRequest } from 'firefly/data/ServerRequest' ;
1818import { dispatchChartRemove } from 'firefly/charts/ChartsCntlr' ;
1919import { dispatchHideDropDown } from 'firefly/core/LayoutCntlr' ;
20- import { dispatchFormSubmit } from 'firefly/core/AppDataCntlr' ;
2120import { TitleOptions } from 'firefly/visualize/WebPlotRequest' ;
21+ import { ROUTER } from 'firefly/templates/router/RouteHelper' ;
22+ import { InitArgsCtx } from 'firefly/templates/common/InitArgsCtx' ;
2223
2324const ALERT_LOAD_REQUEST = 'AlertViewerSearchProcessor' ;
2425const IMAGE_TITLES = [ 'Science' , 'Template' , 'Difference' ] ;
2526
26- export const UploadPanel = ( { initArgs } ) => {
27+ export const UploadPanel = ( { } ) => {
2728 const instruction = 'Enter an Alert ID to load in the Alert Viewer:' ;
2829 const [ isLoading , setIsLoading ] = useState ( false ) ;
2930 const [ alertId , setAlertId ] = useState ( '' ) ;
31+ const { initArgs} = useContext ( InitArgsCtx ) ;
3032
3133 const doLoad = async ( loadId = alertId ) => {
3234 const trimmedId = loadId . trim ( ) ;
@@ -45,7 +47,6 @@ export const UploadPanel = ({initArgs}) => {
4547 showInfoPopup ( result ?. message || 'Unable to load alert data.' , 'Load Error' ) ;
4648 return ;
4749 }
48-
4950 addToRecentAlertIDs ( trimmedId ) ;
5051 clearAlertProducts ( ) ; //todo: keep this?
5152 loadFromEntries ( result , trimmedId ) ;
@@ -193,7 +194,7 @@ function loadFromEntries(result, alertId) {
193194 source : result ?. source ,
194195 fileName : result ?. fileName ,
195196 } ) ;
196- dispatchFormSubmit ( { submitTo : '/results' } ) ;
197+ dispatchComponentStateChange ( ROUTER , { RESULTS : '/results' } ) ;
197198 dispatchHideDropDown ( ) ;
198199 } catch ( error ) {
199200 console . error ( 'Error loading file:' , error ) ;
0 commit comments