You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2025/08/18 15:12:49 UTC

(airflow) branch v3-0-test updated: Switch to the triggered dagrun on manual trigger. (#54336) (#54616)

This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch v3-0-test
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/v3-0-test by this push:
     new cd5715df7da Switch to the triggered dagrun on manual trigger. (#54336) (#54616)
cd5715df7da is described below

commit cd5715df7daa43e92558e8e35ebc62c773795c23
Author: Pierre Jeambrun <pi...@gmail.com>
AuthorDate: Mon Aug 18 17:12:42 2025 +0200

    Switch to the triggered dagrun on manual trigger. (#54336) (#54616)
    
    (cherry picked from commit 5c8c13523c7fe1fc4a6a3949a18d420eaf918138)
    
    Co-authored-by: Karthikeyan Singaravelan <ti...@gmail.com>
---
 airflow-core/src/airflow/ui/src/queries/useTrigger.ts | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/airflow-core/src/airflow/ui/src/queries/useTrigger.ts b/airflow-core/src/airflow/ui/src/queries/useTrigger.ts
index e033fe31a1d..fe2b1de7f93 100644
--- a/airflow-core/src/airflow/ui/src/queries/useTrigger.ts
+++ b/airflow-core/src/airflow/ui/src/queries/useTrigger.ts
@@ -18,6 +18,7 @@
  */
 import { useQueryClient } from "@tanstack/react-query";
 import { useState } from "react";
+import { useNavigate } from "react-router-dom";
 
 import {
   UseDagRunServiceGetDagRunsKeyFn,
@@ -28,14 +29,16 @@ import {
   UseTaskInstanceServiceGetTaskInstancesKeyFn,
   UseGridServiceGetGridRunsKeyFn,
 } from "openapi/queries";
+import type { TriggerDagRunResponse } from "openapi/requests/types.gen";
 import type { DagRunTriggerParams } from "src/components/TriggerDag/TriggerDAGForm";
 import { toaster } from "src/components/ui";
 
 export const useTrigger = ({ dagId, onSuccessConfirm }: { dagId: string; onSuccessConfirm: () => void }) => {
   const queryClient = useQueryClient();
   const [error, setError] = useState<unknown>(undefined);
+  const navigate = useNavigate();
 
-  const onSuccess = async () => {
+  const onSuccess = async (dagRun: TriggerDagRunResponse) => {
     const queryKeys = [
       [useDagServiceGetDagsKey],
       [useDagServiceRecentDagRunsKey],
@@ -53,6 +56,8 @@ export const useTrigger = ({ dagId, onSuccessConfirm }: { dagId: string; onSucce
       type: "success",
     });
     onSuccessConfirm();
+
+    navigate(`/dags/${dagRun.dag_id}/runs/${dagRun.dag_run_id}`);
   };
 
   const onError = (_error: unknown) => {