mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-18 05:57:17 +00:00
Fixed #2238 #2241 Lineage: In view mode, the main node is not highlighted and Two nodes for same table in lineage. (#2258)
* Fixed #2238 Lineage: In view mode, the main node is not highlighted. * Fixed #2241 Two nodes for same table in lineage
This commit is contained in:
parent
91cb1fafa7
commit
d4e66ecd7c
@ -118,6 +118,14 @@ const Entitylineage: FunctionComponent<EntityLineageProp> = ({
|
||||
status: 'initial',
|
||||
});
|
||||
|
||||
const getNodeClass = (node: FlowElement) => {
|
||||
return `${
|
||||
node.id.includes(entityLineage.entity.id) && !isEditMode
|
||||
? 'leaf-node core'
|
||||
: 'leaf-node'
|
||||
}`;
|
||||
};
|
||||
|
||||
const selectedEntityHandler = (entity: EntityReference) => {
|
||||
setSelectedEntity(entity);
|
||||
};
|
||||
@ -232,7 +240,10 @@ const Entitylineage: FunctionComponent<EntityLineageProp> = ({
|
||||
setElements((prevElements) => {
|
||||
return prevElements.map((el) => {
|
||||
if (el.id === selectedNode.id) {
|
||||
return { ...el, className: 'leaf-node' };
|
||||
return {
|
||||
...el,
|
||||
className: getNodeClass(el),
|
||||
};
|
||||
} else {
|
||||
return el;
|
||||
}
|
||||
@ -317,7 +328,10 @@ const Entitylineage: FunctionComponent<EntityLineageProp> = ({
|
||||
if (preEl.id === el.id) {
|
||||
return { ...preEl, className: `${preEl.className} selected-node` };
|
||||
} else {
|
||||
return { ...preEl, className: 'leaf-node' };
|
||||
return {
|
||||
...preEl,
|
||||
className: getNodeClass(preEl),
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -337,7 +351,10 @@ const Entitylineage: FunctionComponent<EntityLineageProp> = ({
|
||||
data: { ...preEl.data, columns: tableColumns },
|
||||
};
|
||||
} else {
|
||||
return { ...preEl, className: 'leaf-node' };
|
||||
return {
|
||||
...preEl,
|
||||
className: getNodeClass(preEl),
|
||||
};
|
||||
}
|
||||
})
|
||||
);
|
||||
|
@ -140,7 +140,7 @@ export const getLineageData = (
|
||||
const [xVal, yVal] = [positionX * 2 * depth, y + positionY * posDepth];
|
||||
|
||||
return {
|
||||
id: `node-${node.id}-${depth}`,
|
||||
id: `${node.id}`,
|
||||
sourcePosition: Position.Right,
|
||||
targetPosition: Position.Left,
|
||||
type: 'default',
|
||||
@ -174,14 +174,14 @@ export const getLineageData = (
|
||||
UPStreamNodes.push(makeNode(node, 'from', depth, upDepth));
|
||||
lineageEdges.push({
|
||||
id: `edge-${up.fromEntity}-${id}-${depth}`,
|
||||
source: `node-${node.id}-${depth}`,
|
||||
target: edg ? edg.id : `node-${id}-${depth}`,
|
||||
source: `${node.id}`,
|
||||
target: edg ? edg.id : `${id}`,
|
||||
type: isEditMode ? edgeType : 'custom',
|
||||
arrowHeadType: ArrowHeadType.ArrowClosed,
|
||||
data: {
|
||||
id: `edge-${up.fromEntity}-${id}-${depth}`,
|
||||
source: `node-${node.id}-${depth}`,
|
||||
target: edg ? edg.id : `node-${id}-${depth}`,
|
||||
source: `${node.id}`,
|
||||
target: edg ? edg.id : `${id}`,
|
||||
sourceType: node.type,
|
||||
targetType: edg?.data?.entityType,
|
||||
onEdgeClick,
|
||||
@ -216,14 +216,14 @@ export const getLineageData = (
|
||||
DOWNStreamNodes.push(makeNode(node, 'to', depth, downDepth));
|
||||
lineageEdges.push({
|
||||
id: `edge-${id}-${down.toEntity}`,
|
||||
source: edg ? edg.id : `node-${id}-${depth}`,
|
||||
target: `node-${node.id}-${depth}`,
|
||||
source: edg ? edg.id : `${id}`,
|
||||
target: `${node.id}`,
|
||||
type: isEditMode ? edgeType : 'custom',
|
||||
arrowHeadType: ArrowHeadType.ArrowClosed,
|
||||
data: {
|
||||
id: `edge-${id}-${down.toEntity}`,
|
||||
source: edg ? edg.id : `node-${id}-${depth}`,
|
||||
target: `node-${node.id}-${depth}`,
|
||||
source: edg ? edg.id : `${id}`,
|
||||
target: `${node.id}`,
|
||||
sourceType: edg?.data?.entityType,
|
||||
targetType: node.type,
|
||||
onEdgeClick,
|
||||
@ -291,7 +291,7 @@ export const getLineageData = (
|
||||
|
||||
const lineageData = [
|
||||
{
|
||||
id: `node-${mainNode.id}-1`,
|
||||
id: `${mainNode.id}`,
|
||||
sourcePosition: 'right',
|
||||
targetPosition: 'left',
|
||||
type:
|
||||
|
Loading…
x
Reference in New Issue
Block a user