Handle workflow run output null case (#1517)
This commit is contained in:
@@ -11,6 +11,7 @@ import { findBlockSurroundingAction } from "./workflowTimelineUtils";
|
|||||||
import { useWorkflowRunTimelineQuery } from "../hooks/useWorkflowRunTimelineQuery";
|
import { useWorkflowRunTimelineQuery } from "../hooks/useWorkflowRunTimelineQuery";
|
||||||
import { Status } from "@/api/types";
|
import { Status } from "@/api/types";
|
||||||
import { AutoResizingTextarea } from "@/components/AutoResizingTextarea/AutoResizingTextarea";
|
import { AutoResizingTextarea } from "@/components/AutoResizingTextarea/AutoResizingTextarea";
|
||||||
|
import { isTaskVariantBlock } from "../types/workflowTypes";
|
||||||
|
|
||||||
function WorkflowRunOutput() {
|
function WorkflowRunOutput() {
|
||||||
const { data: workflowRunTimeline, isLoading: workflowRunTimelineIsLoading } =
|
const { data: workflowRunTimeline, isLoading: workflowRunTimelineIsLoading } =
|
||||||
@@ -44,16 +45,22 @@ function WorkflowRunOutput() {
|
|||||||
const activeBlock = getActiveBlock();
|
const activeBlock = getActiveBlock();
|
||||||
|
|
||||||
const showExtractedInformation =
|
const showExtractedInformation =
|
||||||
activeBlock && activeBlock.status === Status.Completed;
|
activeBlock &&
|
||||||
|
isTaskVariantBlock(activeBlock) &&
|
||||||
|
activeBlock.status === Status.Completed;
|
||||||
|
|
||||||
const outputs = workflowRun?.outputs;
|
const outputs = workflowRun?.outputs;
|
||||||
const fileUrls = workflowRun?.downloaded_file_urls ?? [];
|
const fileUrls = workflowRun?.downloaded_file_urls ?? [];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-5">
|
<div className="space-y-5">
|
||||||
{activeBlock ? (
|
{activeBlock ? (
|
||||||
<div className="rounded bg-slate-elevation2 p-6">
|
<div className="rounded bg-slate-elevation2 p-6">
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<h1 className="text-lg font-bold">Block Outputs</h1>
|
<h1 className="text-lg font-bold">Block Outputs</h1>
|
||||||
|
{activeBlock.output === null ? (
|
||||||
|
<div>This block has no outputs</div>
|
||||||
|
) : isTaskVariantBlock(activeBlock) ? (
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<h2>
|
<h2>
|
||||||
{showExtractedInformation
|
{showExtractedInformation
|
||||||
@@ -85,6 +92,18 @@ function WorkflowRunOutput() {
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
) : (
|
||||||
|
<div className="space-y-2">
|
||||||
|
<h2>Output</h2>
|
||||||
|
<CodeEditor
|
||||||
|
language="json"
|
||||||
|
value={JSON.stringify(activeBlock.output, null, 2)}
|
||||||
|
minHeight="96px"
|
||||||
|
maxHeight="200px"
|
||||||
|
readOnly
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
|
|||||||
Reference in New Issue
Block a user