From fd0988369b3a94be01a994e46b7993e2d97b2028 Mon Sep 17 00:00:00 2001 From: Karthikeyan Singaravelan Date: Sun, 3 Dec 2023 06:39:44 +0530 Subject: [PATCH] Use dropdown instead of buttons when there are more than 10 retries in log tab (#36025) * Use dropdown instead of buttons when there are more than 10 retries in log tab. * Update airflow/www/static/js/dag/details/taskInstance/Logs/index.tsx Co-authored-by: Jens Scheffler <95105677+jscheffl@users.noreply.github.com> --------- Co-authored-by: Jens Scheffler <95105677+jscheffl@users.noreply.github.com> --- .../dag/details/taskInstance/Logs/index.tsx | 57 +++++++++++++------ 1 file changed, 41 insertions(+), 16 deletions(-) diff --git a/airflow/www/static/js/dag/details/taskInstance/Logs/index.tsx b/airflow/www/static/js/dag/details/taskInstance/Logs/index.tsx index 16a5e2159f38d..12d64f42388c5 100644 --- a/airflow/www/static/js/dag/details/taskInstance/Logs/index.tsx +++ b/airflow/www/static/js/dag/details/taskInstance/Logs/index.tsx @@ -26,6 +26,7 @@ import { Checkbox, Icon, Spinner, + Select, } from "@chakra-ui/react"; import { MdWarning } from "react-icons/md"; @@ -152,6 +153,9 @@ const Logs = ({ [data, fileSourceFilters, logLevelFilters, timezone] ); + const logAttemptDropdownLimit = 10; + const showDropdown = internalIndexes.length > logAttemptDropdownLimit; + useEffect(() => { // Reset fileSourceFilters and selected attempt when changing to // a task that do not have those filters anymore. @@ -193,24 +197,45 @@ const Logs = ({ {tryNumber !== undefined && ( <> - (by attempts) - - - {internalIndexes.map((index) => ( - - ))} - - + {!showDropdown && ( + + (by attempts) + + + {internalIndexes.map((index) => ( + + ))} + + + + )} + {showDropdown && ( + + + + )}