diff --git a/admyral/server/endpoints/workflow_run_endpoints.py b/admyral/server/endpoints/workflow_run_endpoints.py index c39f8230..b0d09f4c 100644 --- a/admyral/server/endpoints/workflow_run_endpoints.py +++ b/admyral/server/endpoints/workflow_run_endpoints.py @@ -126,9 +126,6 @@ async def download_workflow_run_step_result( if not step: raise HTTPException(status_code=404, detail="Step not found") - if not step.result: - raise HTTPException(status_code=404, detail="No result available") - # Convert to JSON and create a string buffer json_str = json.dumps(step.result, indent=4) json_bytes = json_str.encode("utf-8") diff --git a/web/src/components/download-button/download-workflow-step-result-button.tsx b/web/src/components/download-button/download-workflow-step-result-button.tsx index 9c61101d..1735399f 100644 --- a/web/src/components/download-button/download-workflow-step-result-button.tsx +++ b/web/src/components/download-button/download-workflow-step-result-button.tsx @@ -1,6 +1,10 @@ +"use client"; + import { useDownloadWorkflowRunStepResult } from "@/hooks/use-download-workflow-run-step-result"; +import { useToast } from "@/providers/toast"; import { DownloadIcon } from "@radix-ui/react-icons"; import { IconButton } from "@radix-ui/themes"; +import { useEffect } from "react"; interface DownloadWorkflowStepResultButtonProps { workflowId: string; @@ -13,8 +17,20 @@ export function DownloadWorkflowStepResultButton({ runId, stepId, }: DownloadWorkflowStepResultButtonProps) { - const { mutate: downloadResult, isPending } = - useDownloadWorkflowRunStepResult(); + const { + mutate: downloadResult, + isPending, + error, + } = useDownloadWorkflowRunStepResult(); + const { errorToast } = useToast(); + + useEffect(() => { + if (error) { + errorToast( + "Failed to download workflow step result. Please try again.", + ); + } + }, [error]); return (