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

bbovenzi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new be6e2cd0d4 Add try_number to extra links query (#35317)
be6e2cd0d4 is described below

commit be6e2cd0d42abc1b3099910c91982f31a98f4c3d
Author: Victor Chiapaikeo <[email protected]>
AuthorDate: Thu Nov 16 10:30:07 2023 -0500

    Add try_number to extra links query (#35317)
    
    * Add try_number to extra links query
    
    Add try_number to extra links query
    
    * Do not include try_number in uri if undefined
---
 airflow/www/static/js/api/useExtraLinks.ts                    | 8 ++++++--
 airflow/www/static/js/dag/details/taskInstance/ExtraLinks.tsx | 3 +++
 airflow/www/static/js/dag/details/taskInstance/index.tsx      | 2 ++
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/airflow/www/static/js/api/useExtraLinks.ts 
b/airflow/www/static/js/api/useExtraLinks.ts
index 3d654e8cbc..e4140d7d4c 100644
--- a/airflow/www/static/js/api/useExtraLinks.ts
+++ b/airflow/www/static/js/api/useExtraLinks.ts
@@ -34,19 +34,23 @@ export default function useExtraLinks({
   executionDate,
   mapIndex,
   extraLinks,
+  tryNumber,
 }: {
   dagId: string;
   taskId: string;
   executionDate: string;
   mapIndex?: number | undefined;
   extraLinks: string[];
+  tryNumber?: number | undefined;
 }) {
   return useQuery(
-    ["extraLinks", dagId, taskId, executionDate, mapIndex],
+    ["extraLinks", dagId, taskId, executionDate, mapIndex, tryNumber],
     async () => {
       const data = await Promise.all(
         extraLinks.map(async (link) => {
           const definedMapIndex = mapIndex ?? -1;
+          const tryNumberParam =
+            tryNumber !== undefined ? `&try_number=${tryNumber}` : "";
           const url = `${extraLinksUrl}?task_id=${encodeURIComponent(
             taskId
           )}&dag_id=${encodeURIComponent(
@@ -55,7 +59,7 @@ export default function useExtraLinks({
             executionDate
           )}&link_name=${encodeURIComponent(
             link
-          )}&map_index=${definedMapIndex}`;
+          )}&map_index=${definedMapIndex}${tryNumberParam}`;
           try {
             const datum = await axios.get<AxiosResponse, LinkData>(url);
             return {
diff --git a/airflow/www/static/js/dag/details/taskInstance/ExtraLinks.tsx 
b/airflow/www/static/js/dag/details/taskInstance/ExtraLinks.tsx
index 1121459b4b..a1f88e9623 100644
--- a/airflow/www/static/js/dag/details/taskInstance/ExtraLinks.tsx
+++ b/airflow/www/static/js/dag/details/taskInstance/ExtraLinks.tsx
@@ -28,6 +28,7 @@ interface Props {
   executionDate: string;
   mapIndex?: number | undefined;
   extraLinks: string[];
+  tryNumber?: number | undefined;
 }
 
 const ExtraLinks = ({
@@ -36,6 +37,7 @@ const ExtraLinks = ({
   executionDate,
   mapIndex,
   extraLinks,
+  tryNumber,
 }: Props) => {
   const { data: links } = useExtraLinks({
     dagId,
@@ -43,6 +45,7 @@ const ExtraLinks = ({
     executionDate,
     mapIndex,
     extraLinks,
+    tryNumber,
   });
 
   if (!links?.length) return null;
diff --git a/airflow/www/static/js/dag/details/taskInstance/index.tsx 
b/airflow/www/static/js/dag/details/taskInstance/index.tsx
index 204e900ea8..bb5f63fb5b 100644
--- a/airflow/www/static/js/dag/details/taskInstance/index.tsx
+++ b/airflow/www/static/js/dag/details/taskInstance/index.tsx
@@ -106,6 +106,7 @@ const TaskInstance = ({ taskId, runId, mapIndex }: Props) 
=> {
           mapIndex={mapIndex}
           executionDate={executionDate}
           extraLinks={group?.extraLinks}
+          tryNumber={instance.tryNumber}
         />
       )}
       {!isMapped && group.extraLinks && (
@@ -114,6 +115,7 @@ const TaskInstance = ({ taskId, runId, mapIndex }: Props) 
=> {
           dagId={dagId}
           executionDate={executionDate}
           extraLinks={group?.extraLinks}
+          tryNumber={instance.tryNumber}
         />
       )}
       <Details instance={instance} group={group} dagId={dagId} />

Reply via email to