diff --git a/datahub-web-react/src/app/lineage/LineageEntityNode.tsx b/datahub-web-react/src/app/lineage/LineageEntityNode.tsx index 2604998d913248..49d268ccf79fe7 100644 --- a/datahub-web-react/src/app/lineage/LineageEntityNode.tsx +++ b/datahub-web-react/src/app/lineage/LineageEntityNode.tsx @@ -1,4 +1,4 @@ -import React, { useMemo } from 'react'; +import React, { useMemo, useState } from 'react'; import { Group } from '@vx/group'; import { LinkHorizontal } from '@vx/shape'; import styled from 'styled-components'; @@ -76,6 +76,9 @@ export default function LineageEntityNode({ direction: Direction; nodesToRenderByUrn: Record; }) { + const [isExpanding, setIsExpanding] = useState(false); + const [expandHover, setExpandHover] = useState(false); + const entityRegistry = useEntityRegistry(); const unexploredHiddenChildren = node?.data?.countercurrentChildrenUrns?.filter((urn) => !(urn in nodesToRenderByUrn))?.length || 0; @@ -119,28 +122,55 @@ export default function LineageEntityNode({ })} ) : null} - {node.data.unexploredChildren ? ( - { - onExpandClick({ urn: node.data.urn, type: node.data.type, direction }); - }} - > - + {node.data.unexploredChildren && + (!isExpanding ? ( + { + setIsExpanding(true); + onExpandClick({ urn: node.data.urn, type: node.data.type, direction }); + }} + onMouseOver={() => { + setExpandHover(true); + }} + onMouseOut={() => { + setExpandHover(false); + }} + pointerEvents="bounding-box" + > + + + + + + + ) : ( - + - - ) : null} + ))} onEntityCenter({ urn: node.data.urn, type: node.data.type })} onClick={(event) => { diff --git a/datahub-web-react/src/app/lineage/LineageVizInsideZoom.tsx b/datahub-web-react/src/app/lineage/LineageVizInsideZoom.tsx index 90c1b8ee5500d9..ea9f837c93f14d 100644 --- a/datahub-web-react/src/app/lineage/LineageVizInsideZoom.tsx +++ b/datahub-web-react/src/app/lineage/LineageVizInsideZoom.tsx @@ -26,6 +26,19 @@ const ZoomButton = styled(Button)` const RootSvg = styled.svg<{ isDragging: boolean } & SVGProps>` cursor: ${(props) => (props.isDragging ? 'grabbing' : 'grab')}; + @keyframes spin { + 0% { + transform: rotate(0deg); + } + 100% { + transform: rotate(359deg); + } + } + .lineageExpandLoading { + transform-box: fill-box; + transform-origin: 50% 50%; + animation: spin 2s linear infinite; + } `; type Props = { @@ -78,6 +91,12 @@ export default function LineageVizInsideZoom({ // eslint-disable-next-line react-hooks/exhaustive-deps }, [entityAndType?.entity?.urn]); + // we want to clear all the dragged nodes after recentering + useEffect(() => { + setDraggedNodes({}); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [entityAndType?.entity?.urn]); + return (