diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Entity/EntityLineage/CustomNodeV1.test.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Entity/EntityLineage/CustomNodeV1.test.tsx index acd72f54b4a..74b6e7ea96a 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Entity/EntityLineage/CustomNodeV1.test.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/Entity/EntityLineage/CustomNodeV1.test.tsx @@ -151,7 +151,7 @@ describe('CustomNodeV1', () => { expect(screen.getByTestId('dbt-icon')).toBeInTheDocument(); }); - it('should render children dropdown button', () => { + it('should render footer only when there are children', () => { isColumnLayerActive = true; render( @@ -167,6 +167,65 @@ describe('CustomNodeV1', () => { ).toBeInTheDocument(); }); + it('should not render footer when there are no children', () => { + isColumnLayerActive = true; + + const mockNodeDataPropsNoChildren = { + ...mockNodeDataProps, + data: { + node: { + ...mockNodeDataProps.data.node, + columns: [], + }, + }, + }; + + render( + + + + ); + + expect( + screen.queryByTestId('children-info-dropdown-btn') + ).not.toBeInTheDocument(); + }); + + it('should render NodeChildren when column layer is applied and there are no columns', () => { + isColumnLayerActive = true; + + render( + + + + ); + + expect(screen.getByTestId('column-container')).toBeInTheDocument(); + }); + + it('should not render NodeChildren when column layer is applied but there are no columns', () => { + isColumnLayerActive = true; + + const mockNodeDataPropsNoChildren = { + ...mockNodeDataProps, + data: { + node: { + ...mockNodeDataProps.data.node, + columns: [], + }, + }, + }; + + render( + + + + ); + screen.debug(undefined, Infinity); + + expect(screen.queryByTestId('column-container')).not.toBeInTheDocument(); + }); + it('should toggle columns list when children dropdown button is clicked', () => { render( diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Entity/EntityLineage/LineageNodeLabelV1.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Entity/EntityLineage/LineageNodeLabelV1.tsx index aa987a27342..5f35960f322 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Entity/EntityLineage/LineageNodeLabelV1.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/Entity/EntityLineage/LineageNodeLabelV1.tsx @@ -58,8 +58,18 @@ const EntityLabel = ({ node }: LineageNodeLabelPropsExtended) => { }; }, [node]); + const { children } = useMemo( + () => getEntityChildrenAndLabel(node), + [node.id] + ); + const childrenCount = children.length; + return ( - + 0 ? 'with-footer' : '' + )}>
{getServiceIcon(node)} @@ -182,6 +192,10 @@ const EntityFooter = ({ [toggleColumnsList] ); + if (childrenCount === 0) { + return null; + } + return (