From 5dcc2ada1bd753b7a4b183062d3f5954af076a97 Mon Sep 17 00:00:00 2001 From: Brent Bovenzi Date: Wed, 14 Aug 2024 11:50:48 -0400 Subject: [PATCH] Fix try selector refresh --- .../dag/details/taskInstance/TrySelector.tsx | 92 ++++++++----------- 1 file changed, 37 insertions(+), 55 deletions(-) diff --git a/airflow/www/static/js/dag/details/taskInstance/TrySelector.tsx b/airflow/www/static/js/dag/details/taskInstance/TrySelector.tsx index 5fc96803c85de..31d894fcaaa42 100644 --- a/airflow/www/static/js/dag/details/taskInstance/TrySelector.tsx +++ b/airflow/www/static/js/dag/details/taskInstance/TrySelector.tsx @@ -61,63 +61,10 @@ const TrySelector = ({ const logAttemptDropdownLimit = 10; const showDropdown = finalTryNumber > logAttemptDropdownLimit; - const tries = (tiHistory?.taskInstances || []).filter( - (t) => t?.startDate !== taskInstance?.startDate - ); - tries?.push(taskInstance); - return ( Task Tries - {!showDropdown && ( - - {/* Even without try history showing up we should still show all try numbers */} - {Array.from({ length: finalTryNumber }, (_, i) => i + 1).map( - (tryNumber, i) => { - let attempt; - if (tries.length) { - attempt = tries[i]; - } - return ( - - Status: {attempt.state} - - Duration:{" "} - {formatDuration( - getDuration(attempt.startDate, attempt.endDate) - )} - - - ) - } - hasArrow - portalProps={{ containerRef }} - placement="top" - isDisabled={!attempt} - > - - - ); - } - )} - - )} - {showDropdown && ( + {showDropdown ? ( + ) : ( + + {tiHistory?.taskInstances?.map((ti) => ( + + Status: {ti.state} + + Duration:{" "} + {formatDuration(getDuration(ti.startDate, ti.endDate))} + + + } + hasArrow + portalProps={{ containerRef }} + placement="top" + isDisabled={!ti} + > + + + ))} + )} );