Start workflow runs instantly instead of showing a notification which… (#1687)
This commit is contained in:
@@ -17,11 +17,10 @@ import { useCredentialGetter } from "@/hooks/useCredentialGetter";
|
|||||||
import { copyText } from "@/util/copyText";
|
import { copyText } from "@/util/copyText";
|
||||||
import { apiBaseUrl } from "@/util/env";
|
import { apiBaseUrl } from "@/util/env";
|
||||||
import { CopyIcon, PlayIcon, ReloadIcon } from "@radix-ui/react-icons";
|
import { CopyIcon, PlayIcon, ReloadIcon } from "@radix-ui/react-icons";
|
||||||
import { ToastAction } from "@radix-ui/react-toast";
|
|
||||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||||
import fetchToCurl from "fetch-to-curl";
|
import fetchToCurl from "fetch-to-curl";
|
||||||
import { useForm } from "react-hook-form";
|
import { useForm } from "react-hook-form";
|
||||||
import { Link, useParams } from "react-router-dom";
|
import { useNavigate, useParams } from "react-router-dom";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { WorkflowParameter } from "./types/workflowTypes";
|
import { WorkflowParameter } from "./types/workflowTypes";
|
||||||
import { WorkflowParameterInput } from "./WorkflowParameterInput";
|
import { WorkflowParameterInput } from "./WorkflowParameterInput";
|
||||||
@@ -107,6 +106,7 @@ function RunWorkflowForm({
|
|||||||
}: Props) {
|
}: Props) {
|
||||||
const { workflowPermanentId } = useParams();
|
const { workflowPermanentId } = useParams();
|
||||||
const credentialGetter = useCredentialGetter();
|
const credentialGetter = useCredentialGetter();
|
||||||
|
const navigate = useNavigate();
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
const form = useForm<RunWorkflowFormType>({
|
const form = useForm<RunWorkflowFormType>({
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
@@ -131,21 +131,13 @@ function RunWorkflowForm({
|
|||||||
variant: "success",
|
variant: "success",
|
||||||
title: "Workflow run started",
|
title: "Workflow run started",
|
||||||
description: "The workflow run has been started successfully",
|
description: "The workflow run has been started successfully",
|
||||||
action: (
|
|
||||||
<ToastAction altText="View">
|
|
||||||
<Button asChild>
|
|
||||||
<Link
|
|
||||||
to={`/workflows/${workflowPermanentId}/${response.data.workflow_run_id}/overview`}
|
|
||||||
>
|
|
||||||
View
|
|
||||||
</Link>
|
|
||||||
</Button>
|
|
||||||
</ToastAction>
|
|
||||||
),
|
|
||||||
});
|
});
|
||||||
queryClient.invalidateQueries({
|
queryClient.invalidateQueries({
|
||||||
queryKey: ["workflowRuns"],
|
queryKey: ["workflowRuns"],
|
||||||
});
|
});
|
||||||
|
navigate(
|
||||||
|
`/workflows/${workflowPermanentId}/${response.data.workflow_run_id}/overview`,
|
||||||
|
);
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (error) => {
|
||||||
toast({
|
toast({
|
||||||
|
|||||||
Reference in New Issue
Block a user