Skip to content

Commit

Permalink
fix: result download, error message for failed result download
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgrittner committed Nov 8, 2024
1 parent 9f54b3b commit bd69025
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
3 changes: 0 additions & 3 deletions admyral/server/endpoints/workflow_run_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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 (
<IconButton
Expand Down

0 comments on commit bd69025

Please sign in to comment.