Skip to content

Commit 9e4b6c7

Browse files
committed
Update node internals on hover
1 parent bec2a8e commit 9e4b6c7

File tree

3 files changed

+44
-12
lines changed

3 files changed

+44
-12
lines changed

openmetadata-ui/src/main/resources/ui/src/components/Entity/EntityLineage/CustomEdge.component.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,15 @@ export const CustomEdge = ({
161161

162162
const isStrokeNeeded = isColumnLineage ? isColumnHighlighted : isNodeTraced;
163163
let display = 'block';
164-
let opacity = 1;
164+
165165
if (isColumnLineage) {
166166
display = isColumnHighlighted ? 'block' : 'none';
167-
opacity = isColumnHighlighted ? 1 : 0;
168167
} else {
169168
display = tracedNodes.length === 0 || isStrokeNeeded ? 'block' : 'none';
170-
opacity = tracedNodes.length === 0 ? 1 : isStrokeNeeded ? 1 : 0;
169+
}
170+
171+
if (isEditMode) {
172+
display = 'block';
171173
}
172174

173175
let stroke = isStrokeNeeded
@@ -183,7 +185,7 @@ export const CustomEdge = ({
183185
return {
184186
...style,
185187
stroke,
186-
opacity,
188+
display,
187189
};
188190
}, [
189191
style,
@@ -194,6 +196,7 @@ export const CustomEdge = ({
194196
isColumnLineage,
195197
tracedColumns.length,
196198
showDqTracing,
199+
isEditMode,
197200
theme.primaryColor,
198201
]);
199202

openmetadata-ui/src/main/resources/ui/src/components/Entity/EntityLineage/CustomNode.utils.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,13 @@ import { Dataflow01, Plus } from '@untitledui/icons';
1414
import { Button, Col, Row, Skeleton, Typography } from 'antd';
1515
import classNames from 'classnames';
1616
import { Fragment, useCallback, useState } from 'react';
17-
import { Handle, HandleProps, HandleType, Position } from 'reactflow';
17+
import {
18+
Handle,
19+
HandleProps,
20+
HandleType,
21+
Position,
22+
UpdateNodeInternals,
23+
} from 'reactflow';
1824
import { ReactComponent as MinusIcon } from '../../../assets/svg/control-minus.svg';
1925
import { EntityLineageNodeType } from '../../../enums/entity.enum';
2026
import { LineageDirection } from '../../../generated/api/lineage/lineageDirection';
@@ -203,7 +209,9 @@ export const getColumnContent = (
203209
onColumnMouseOut: () => void,
204210
showDataObservabilitySummary: boolean,
205211
isLoading: boolean,
206-
summary?: ColumnTestSummaryDefinition
212+
summary?: ColumnTestSummaryDefinition,
213+
nodeId?: string,
214+
updateNodeInternals?: UpdateNodeInternals
207215
) => {
208216
const { fullyQualifiedName } = column;
209217
const columnNameContentRender = getColumnNameContent(column, isLoading);
@@ -212,6 +220,11 @@ export const getColumnContent = (
212220
if (selectedColumn) {
213221
return;
214222
}
223+
224+
if (nodeId) {
225+
updateNodeInternals?.(nodeId);
226+
}
227+
215228
onColumnMouseOver(fullyQualifiedName ?? '');
216229
};
217230

openmetadata-ui/src/main/resources/ui/src/components/Entity/EntityLineage/NodeChildren/NodeChildren.component.tsx

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,20 @@ import { EntityChildren, NodeChildrenProps } from './NodeChildren.interface';
3838
import ChevronLeftIcon from '@mui/icons-material/ChevronLeft';
3939
import ChevronRightIcon from '@mui/icons-material/ChevronRight';
4040
import { IconButton, Pagination, Stack, Typography } from '@mui/material';
41-
import React from 'react';
4241
import classNames from 'classnames';
42+
import React from 'react';
43+
import { useUpdateNodeInternals } from 'reactflow';
4344

4445
interface CustomPaginatedListProps {
4546
items: React.ReactNode[];
47+
node: NodeChildrenProps['node'];
4648
}
4749

48-
const CustomPaginatedList = ({ items }: CustomPaginatedListProps) => {
50+
const CustomPaginatedList = ({ items, node }: CustomPaginatedListProps) => {
4951
const ITEMS_PER_PAGE = 5;
5052
const [page, setPage] = useState(1);
5153
const { t } = useTranslation();
54+
const updateNodeInternals = useUpdateNodeInternals();
5255

5356
const count = Math.ceil(items.length / ITEMS_PER_PAGE);
5457
const start = (page - 1) * ITEMS_PER_PAGE;
@@ -75,10 +78,16 @@ const CustomPaginatedList = ({ items }: CustomPaginatedListProps) => {
7578
const handlePrev = (e: React.MouseEvent<HTMLButtonElement>) => {
7679
e.stopPropagation();
7780
setPage((p) => Math.max(p - 1, 1));
81+
if (node.id) {
82+
updateNodeInternals(node.id);
83+
}
7884
};
7985
const handleNext = (e: React.MouseEvent<HTMLButtonElement>) => {
8086
e.stopPropagation();
8187
setPage((p) => Math.min(p + 1, count));
88+
if (node.id) {
89+
updateNodeInternals(node.id);
90+
}
8291
};
8392

8493
return (
@@ -254,6 +263,7 @@ const NodeChildren = ({
254263
setIsLoading(false);
255264
}
256265
};
266+
const updateNodeInternals = useUpdateNodeInternals();
257267

258268
useEffect(() => {
259269
const testSuite = (node as Table)?.testSuite;
@@ -282,7 +292,9 @@ const NodeChildren = ({
282292
onColumnMouseOut,
283293
showDataObservabilitySummary,
284294
isLoading,
285-
columnSummary
295+
columnSummary,
296+
node.id,
297+
updateNodeInternals
286298
);
287299

288300
if (!record.children || record.children.length === 0) {
@@ -319,7 +331,9 @@ const NodeChildren = ({
319331
onColumnMouseOut,
320332
showDataObservabilitySummary,
321333
isLoading,
322-
columnSummary
334+
columnSummary,
335+
node.id,
336+
updateNodeInternals
323337
);
324338
}
325339
});
@@ -378,7 +392,9 @@ const NodeChildren = ({
378392
onColumnMouseOut,
379393
showDataObservabilitySummary,
380394
isLoading,
381-
columnSummary
395+
columnSummary,
396+
node.id,
397+
updateNodeInternals
382398
);
383399
}
384400
},
@@ -428,7 +444,7 @@ const NodeChildren = ({
428444
{isChildrenListExpanded && !isEmpty(renderedColumns) && (
429445
<section className="m-t-md" id="table-columns">
430446
<div className="rounded-4 overflow-hidden">
431-
<CustomPaginatedList items={renderedColumns} />
447+
<CustomPaginatedList items={renderedColumns} node={node} />
432448
</div>
433449
</section>
434450
)}

0 commit comments

Comments
 (0)