Two Human Interaction Block Fixes (#3940)
This commit is contained in:
@@ -51,3 +51,7 @@ export function statusIsRunningOrQueued({
|
||||
}): boolean {
|
||||
return status === Status.Queued || status === Status.Running;
|
||||
}
|
||||
|
||||
export function statusIsCancellable({ status }: { status: Status }): boolean {
|
||||
return statusIsNotFinalized({ status });
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ import {
|
||||
} from "@radix-ui/react-icons";
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import { Link, Outlet, useSearchParams } from "react-router-dom";
|
||||
import { statusIsFinalized, statusIsRunningOrQueued } from "../tasks/types";
|
||||
import { statusIsCancellable, statusIsFinalized } from "../tasks/types";
|
||||
import { useWorkflowRunWithWorkflowQuery } from "./hooks/useWorkflowRunWithWorkflowQuery";
|
||||
import { WorkflowRunTimeline } from "./workflowRun/WorkflowRunTimeline";
|
||||
import { useWorkflowRunTimelineQuery } from "./hooks/useWorkflowRunTimelineQuery";
|
||||
@@ -142,8 +142,8 @@ function WorkflowRun() {
|
||||
},
|
||||
});
|
||||
|
||||
const workflowRunIsRunningOrQueued =
|
||||
workflowRun && statusIsRunningOrQueued(workflowRun);
|
||||
const workflowRunIsCancellable =
|
||||
workflowRun && statusIsCancellable(workflowRun);
|
||||
|
||||
const workflowRunIsFinalized = workflowRun && statusIsFinalized(workflowRun);
|
||||
const selection = findActiveItem(
|
||||
@@ -362,7 +362,7 @@ function WorkflowRun() {
|
||||
Edit
|
||||
</Link>
|
||||
</Button>
|
||||
{workflowRunIsRunningOrQueued && (
|
||||
{workflowRunIsCancellable && (
|
||||
<Dialog>
|
||||
<DialogTrigger asChild>
|
||||
<Button variant="destructive">Cancel</Button>
|
||||
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
DialogTitle,
|
||||
} from "@/components/ui/dialog";
|
||||
import { toast } from "@/components/ui/use-toast";
|
||||
import { useWorkflowRunQuery } from "../hooks/useWorkflowRunQuery";
|
||||
import { useWorkflowRunWithWorkflowQuery } from "../hooks/useWorkflowRunWithWorkflowQuery";
|
||||
import { WorkflowRunBlock } from "../types/workflowRunTypes";
|
||||
|
||||
interface Props {
|
||||
@@ -26,7 +26,7 @@ interface Props {
|
||||
export function WorkflowRunHumanInteraction({ workflowRunBlock }: Props) {
|
||||
const credentialGetter = useCredentialGetter();
|
||||
const queryClient = useQueryClient();
|
||||
const { data: workflowRun } = useWorkflowRunQuery();
|
||||
const { data: workflowRun } = useWorkflowRunWithWorkflowQuery();
|
||||
const isPaused =
|
||||
workflowRun && workflowRun.status === WorkflowRunStatus.Paused;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user