Skip to content

Commit 4282437

Browse files
committed
fix url api broken
1 parent 0ae5871 commit 4282437

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/firefly/js/apps/alertviewer/AlertUploadPanel.jsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, {useEffect, useState} from 'react';
1+
import React, {useContext, useEffect, useState} from 'react';
22
import PropTypes from 'prop-types';
33
import {showInfoPopup} from 'firefly/ui/PopupUtil';
44
import {Button, IconButton, Input, Stack, Typography} from '@mui/joy';
@@ -17,16 +17,18 @@ import {getJsonData} from 'firefly/rpc/SearchServicesJson';
1717
import {ServerRequest} from 'firefly/data/ServerRequest';
1818
import {dispatchChartRemove} from 'firefly/charts/ChartsCntlr';
1919
import {dispatchHideDropDown} from 'firefly/core/LayoutCntlr';
20-
import {dispatchFormSubmit} from 'firefly/core/AppDataCntlr';
2120
import {TitleOptions} from 'firefly/visualize/WebPlotRequest';
21+
import {ROUTER} from 'firefly/templates/router/RouteHelper';
22+
import {InitArgsCtx} from 'firefly/templates/common/InitArgsCtx';
2223

2324
const ALERT_LOAD_REQUEST = 'AlertViewerSearchProcessor';
2425
const 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

Comments
 (0)