diff --git a/src/App.tsx b/src/App.tsx index c330ada3..a9ebbee9 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -6,6 +6,7 @@ import { getFirebaseRecipe, jsonToString } from "./utils/recipeLoader"; import { getSubmitPackingUrl, JOB_STATUS } from "./constants/aws"; import { FIRESTORE_FIELDS } from "./constants/firebase"; import { + useCurrentRecipeData, useJobId, useJobLogs, useOutputsDirectory, @@ -33,6 +34,7 @@ function App() { const setPackingResults = useSetPackingResults(); const runTime = useRunTime(); const outputDir = useOutputsDirectory(); + const edits = useCurrentRecipeData()?.edits || {}; let start = 0; @@ -144,6 +146,7 @@ function App() { resultUrl: localJobStatus.result_path, runTime: range, outputDir: localJobStatus.outputs_directory, + edits: edits, }); } else if (localJobStatus.status == JOB_STATUS.FAILED) { setPackingResults({ @@ -152,6 +155,7 @@ function App() { resultUrl: "", runTime: range, outputDir: "", + edits: {} }); } }; diff --git a/src/components/PackingInput/index.tsx b/src/components/PackingInput/index.tsx index a2de51da..6ed61bd6 100644 --- a/src/components/PackingInput/index.tsx +++ b/src/components/PackingInput/index.tsx @@ -9,6 +9,7 @@ import { useCurrentRecipeObject, useInputOptions, useLoadInputOptions, + useIsLoading, } from "../../state/store"; import Dropdown from "../Dropdown"; import JSONViewer from "../JSONViewer"; @@ -36,6 +37,7 @@ const PackingInput = (props: PackingInputProps): JSX.Element => { const selectedRecipeId = useSelectedRecipeId(); const recipeObj = useCurrentRecipeObject(); const inputOptions = useInputOptions(); + const isLoading = useIsLoading(); const loadInputOptions = useLoadInputOptions(); const loadAllRecipes = useLoadAllRecipes(); @@ -73,7 +75,7 @@ const PackingInput = (props: PackingInputProps): JSX.Element => { const loadingText =
Loading...
; // No recipe or dropdown options to load - if (!recipeObj && !inputOptions[selectedRecipeId]) { + if (isLoading) { return loadingText; } diff --git a/src/components/Viewer/index.tsx b/src/components/Viewer/index.tsx index 8a2dc79d..1a36e48e 100644 --- a/src/components/Viewer/index.tsx +++ b/src/components/Viewer/index.tsx @@ -1,15 +1,43 @@ +import { LoadingOutlined } from "@ant-design/icons"; import { SIMULARIUM_EMBED_URL } from "../../constants/urls"; -import { useResultUrl } from "../../state/store"; +import { useIsLoading, useIsModified, useIsPacking, useResultUrl } from "../../state/store"; import "./style.css"; const Viewer = (): JSX.Element => { const resultUrl = useResultUrl(); + const isLoading = useIsLoading(); + const isPacking = useIsPacking(); + const isModified = useIsModified(); + + const overlayText = isPacking + ? "Running..." + : isLoading + ? "Loading..." + : isModified + ? "Re-run packing to view result" + : ""; + + const activeState = isLoading || isPacking; + const showOverlay = activeState || isModified; + return (