This is an automated email from the ASF dual-hosted git repository. bbovenzi pushed a commit to branch fix-mapped-tooltip in repository https://gitbox.apache.org/repos/asf/airflow.git
commit fef800a34f3afb09f580e63549201b750b0757ec Author: Brent Bovenzi <[email protected]> AuthorDate: Wed Apr 13 13:21:47 2022 -0400 Fix tooltip for mapped tasks --- airflow/www/static/js/tree/InstanceTooltip.jsx | 59 ++++++++++++-------------- 1 file changed, 26 insertions(+), 33 deletions(-) diff --git a/airflow/www/static/js/tree/InstanceTooltip.jsx b/airflow/www/static/js/tree/InstanceTooltip.jsx index 80f2dbce76..11ef97ae8e 100644 --- a/airflow/www/static/js/tree/InstanceTooltip.jsx +++ b/airflow/www/static/js/tree/InstanceTooltip.jsx @@ -31,11 +31,11 @@ const InstanceTooltip = ({ }, }) => { const isGroup = !!group.children; - const groupSummary = []; - const mapSummary = []; + const { isMapped } = group; + const summary = []; + const numMap = finalStatesMap(); if (isGroup) { - const numMap = finalStatesMap(); group.children.forEach((child) => { const taskInstance = child.instances.find((ti) => ti.runId === runId); if (taskInstance) { @@ -43,52 +43,45 @@ const InstanceTooltip = ({ if (numMap.has(stateKey)) numMap.set(stateKey, numMap.get(stateKey) + 1); } }); - numMap.forEach((key, val) => { - if (key > 0) { - groupSummary.push( - // eslint-disable-next-line react/no-array-index-key - <Text key={val} ml="10px"> - {val} - {': '} - {key} - </Text>, - ); - } - }); - } - - if (group.isMapped && mappedStates) { - const numMap = finalStatesMap(); + } else if (isMapped && mappedStates) { mappedStates.forEach((s) => { const stateKey = s || 'no_status'; if (numMap.has(stateKey)) numMap.set(stateKey, numMap.get(stateKey) + 1); }); - numMap.forEach((key, val) => { - if (key > 0) { - mapSummary.push( - // eslint-disable-next-line react/no-array-index-key - <Text key={val} ml="10px"> - {val} - {': '} - {key} - </Text>, - ); - } - }); } + numMap.forEach((key, val) => { + if (key > 0) { + summary.push( + // eslint-disable-next-line react/no-array-index-key + <Text key={val} ml="10px"> + {val} + {': '} + {key} + </Text>, + ); + } + }); + return ( <Box py="2px"> {group.tooltip && ( <Text>{group.tooltip}</Text> )} + {isMapped && ( + <Text> + {mappedStates.length} + {' '} + mapped tasks + </Text> + )} <Text> - {isGroup ? 'Overall ' : ''} + {(isGroup || isMapped) ? 'Overall ' : ''} Status: {' '} {state || 'no status'} </Text> - {isGroup && groupSummary} + {(isGroup || isMapped) && summary} <Text> Started: {' '}
