Skip to content

Commit 17d7b60

Browse files
tirkarthikaxil
authored andcommitted
Switch to the triggered dagrun on manual trigger. (#54336)
(cherry picked from commit 5c8c135)
1 parent 78a981a commit 17d7b60

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

airflow-core/src/airflow/ui/src/queries/useTrigger.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
*/
1919
import { useQueryClient } from "@tanstack/react-query";
2020
import { useState } from "react";
21+
import { useNavigate } from "react-router-dom";
2122

2223
import {
2324
UseDagRunServiceGetDagRunsKeyFn,
@@ -28,14 +29,16 @@ import {
2829
UseTaskInstanceServiceGetTaskInstancesKeyFn,
2930
UseGridServiceGetGridRunsKeyFn,
3031
} from "openapi/queries";
32+
import type { TriggerDagRunResponse } from "openapi/requests/types.gen";
3133
import type { DagRunTriggerParams } from "src/components/TriggerDag/TriggerDAGForm";
3234
import { toaster } from "src/components/ui";
3335

3436
export const useTrigger = ({ dagId, onSuccessConfirm }: { dagId: string; onSuccessConfirm: () => void }) => {
3537
const queryClient = useQueryClient();
3638
const [error, setError] = useState<unknown>(undefined);
39+
const navigate = useNavigate();
3740

38-
const onSuccess = async () => {
41+
const onSuccess = async (dagRun: TriggerDagRunResponse) => {
3942
const queryKeys = [
4043
[useDagServiceGetDagsKey],
4144
[useDagServiceRecentDagRunsKey],
@@ -53,6 +56,8 @@ export const useTrigger = ({ dagId, onSuccessConfirm }: { dagId: string; onSucce
5356
type: "success",
5457
});
5558
onSuccessConfirm();
59+
60+
navigate(`/dags/${dagRun.dag_id}/runs/${dagRun.dag_run_id}`);
5661
};
5762

5863
const onError = (_error: unknown) => {

0 commit comments

Comments
 (0)