Skip to content

Commit

Permalink
don't try to render child rows for closed groups (#24637)
Browse files Browse the repository at this point in the history
  • Loading branch information
bbovenzi authored Jun 28, 2022
1 parent 359700a commit 8f638bb
Showing 1 changed file with 20 additions and 24 deletions.
44 changes: 20 additions & 24 deletions airflow/www/static/js/grid/renderTaskRows.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import {
Td,
Box,
Flex,
Collapse,
useTheme,
} from '@chakra-ui/react';

Expand Down Expand Up @@ -140,13 +139,14 @@ const Row = (props: RowProps) => {
[isGroup, isOpen, task.label, openGroupIds, onToggleGroups],
);

const isFullyOpen = level === openParentCount;
// check if the group's parents are all open, if not, return null
if (level !== openParentCount) return null;

return (
<>
<Tr
bg={isSelected ? 'blue.100' : 'inherit'}
borderBottomWidth={isFullyOpen ? 1 : 0}
borderBottomWidth={1}
borderBottomColor={isGroup && isOpen ? 'gray.400' : 'gray.200'}
role="group"
_hover={!isSelected ? { bg: hoverBlue } : undefined}
Expand All @@ -164,16 +164,14 @@ const Row = (props: RowProps) => {
width="100%"
zIndex={1}
>
<Collapse in={isFullyOpen} unmountOnExit>
<TaskName
onToggle={memoizedToggle}
isGroup={isGroup}
isMapped={task.isMapped}
label={task.label}
isOpen={isOpen}
level={level}
/>
</Collapse>
<TaskName
onToggle={memoizedToggle}
isGroup={isGroup}
isMapped={task.isMapped}
label={task.label}
isOpen={isOpen}
level={level}
/>
</Td>
<Td width={0} p={0} borderBottom={0} />
<Td
Expand All @@ -182,20 +180,18 @@ const Row = (props: RowProps) => {
width={`${dagRunIds.length * columnWidth}px`}
borderBottom={0}
>
<Collapse in={isFullyOpen} unmountOnExit>
<TaskInstances
dagRunIds={dagRunIds}
task={task}
selectedRunId={selected.runId}
onSelect={onSelect}
hoveredTaskState={hoveredTaskState}
/>
</Collapse>
<TaskInstances
dagRunIds={dagRunIds}
task={task}
selectedRunId={selected.runId}
onSelect={onSelect}
hoveredTaskState={hoveredTaskState}
/>
</Td>
</Tr>
{isGroup && (
{isGroup && isOpen && (
renderTaskRows({
...props, level: level + 1, openParentCount: openParentCount + (isOpen ? 1 : 0),
...props, level: level + 1, openParentCount: openParentCount + 1,
})
)}
</>
Expand Down

0 comments on commit 8f638bb

Please sign in to comment.