mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-20 06:58:18 +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',
|
status: 'initial',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const getNodeClass = (node: FlowElement) => {
|
||||||
|
return `${
|
||||||
|
node.id.includes(entityLineage.entity.id) && !isEditMode
|
||||||
|
? 'leaf-node core'
|
||||||
|
: 'leaf-node'
|
||||||
|
}`;
|
||||||
|
};
|
||||||
|
|
||||||
const selectedEntityHandler = (entity: EntityReference) => {
|
const selectedEntityHandler = (entity: EntityReference) => {
|
||||||
setSelectedEntity(entity);
|
setSelectedEntity(entity);
|
||||||
};
|
};
|
||||||
@ -232,7 +240,10 @@ const Entitylineage: FunctionComponent<EntityLineageProp> = ({
|
|||||||
setElements((prevElements) => {
|
setElements((prevElements) => {
|
||||||
return prevElements.map((el) => {
|
return prevElements.map((el) => {
|
||||||
if (el.id === selectedNode.id) {
|
if (el.id === selectedNode.id) {
|
||||||
return { ...el, className: 'leaf-node' };
|
return {
|
||||||
|
...el,
|
||||||
|
className: getNodeClass(el),
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
return el;
|
return el;
|
||||||
}
|
}
|
||||||
@ -317,7 +328,10 @@ const Entitylineage: FunctionComponent<EntityLineageProp> = ({
|
|||||||
if (preEl.id === el.id) {
|
if (preEl.id === el.id) {
|
||||||
return { ...preEl, className: `${preEl.className} selected-node` };
|
return { ...preEl, className: `${preEl.className} selected-node` };
|
||||||
} else {
|
} else {
|
||||||
return { ...preEl, className: 'leaf-node' };
|
return {
|
||||||
|
...preEl,
|
||||||
|
className: getNodeClass(preEl),
|
||||||
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -337,7 +351,10 @@ const Entitylineage: FunctionComponent<EntityLineageProp> = ({
|
|||||||
data: { ...preEl.data, columns: tableColumns },
|
data: { ...preEl.data, columns: tableColumns },
|
||||||
};
|
};
|
||||||
} else {
|
} 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];
|
const [xVal, yVal] = [positionX * 2 * depth, y + positionY * posDepth];
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: `node-${node.id}-${depth}`,
|
id: `${node.id}`,
|
||||||
sourcePosition: Position.Right,
|
sourcePosition: Position.Right,
|
||||||
targetPosition: Position.Left,
|
targetPosition: Position.Left,
|
||||||
type: 'default',
|
type: 'default',
|
||||||
@ -174,14 +174,14 @@ export const getLineageData = (
|
|||||||
UPStreamNodes.push(makeNode(node, 'from', depth, upDepth));
|
UPStreamNodes.push(makeNode(node, 'from', depth, upDepth));
|
||||||
lineageEdges.push({
|
lineageEdges.push({
|
||||||
id: `edge-${up.fromEntity}-${id}-${depth}`,
|
id: `edge-${up.fromEntity}-${id}-${depth}`,
|
||||||
source: `node-${node.id}-${depth}`,
|
source: `${node.id}`,
|
||||||
target: edg ? edg.id : `node-${id}-${depth}`,
|
target: edg ? edg.id : `${id}`,
|
||||||
type: isEditMode ? edgeType : 'custom',
|
type: isEditMode ? edgeType : 'custom',
|
||||||
arrowHeadType: ArrowHeadType.ArrowClosed,
|
arrowHeadType: ArrowHeadType.ArrowClosed,
|
||||||
data: {
|
data: {
|
||||||
id: `edge-${up.fromEntity}-${id}-${depth}`,
|
id: `edge-${up.fromEntity}-${id}-${depth}`,
|
||||||
source: `node-${node.id}-${depth}`,
|
source: `${node.id}`,
|
||||||
target: edg ? edg.id : `node-${id}-${depth}`,
|
target: edg ? edg.id : `${id}`,
|
||||||
sourceType: node.type,
|
sourceType: node.type,
|
||||||
targetType: edg?.data?.entityType,
|
targetType: edg?.data?.entityType,
|
||||||
onEdgeClick,
|
onEdgeClick,
|
||||||
@ -216,14 +216,14 @@ export const getLineageData = (
|
|||||||
DOWNStreamNodes.push(makeNode(node, 'to', depth, downDepth));
|
DOWNStreamNodes.push(makeNode(node, 'to', depth, downDepth));
|
||||||
lineageEdges.push({
|
lineageEdges.push({
|
||||||
id: `edge-${id}-${down.toEntity}`,
|
id: `edge-${id}-${down.toEntity}`,
|
||||||
source: edg ? edg.id : `node-${id}-${depth}`,
|
source: edg ? edg.id : `${id}`,
|
||||||
target: `node-${node.id}-${depth}`,
|
target: `${node.id}`,
|
||||||
type: isEditMode ? edgeType : 'custom',
|
type: isEditMode ? edgeType : 'custom',
|
||||||
arrowHeadType: ArrowHeadType.ArrowClosed,
|
arrowHeadType: ArrowHeadType.ArrowClosed,
|
||||||
data: {
|
data: {
|
||||||
id: `edge-${id}-${down.toEntity}`,
|
id: `edge-${id}-${down.toEntity}`,
|
||||||
source: edg ? edg.id : `node-${id}-${depth}`,
|
source: edg ? edg.id : `${id}`,
|
||||||
target: `node-${node.id}-${depth}`,
|
target: `${node.id}`,
|
||||||
sourceType: edg?.data?.entityType,
|
sourceType: edg?.data?.entityType,
|
||||||
targetType: node.type,
|
targetType: node.type,
|
||||||
onEdgeClick,
|
onEdgeClick,
|
||||||
@ -291,7 +291,7 @@ export const getLineageData = (
|
|||||||
|
|
||||||
const lineageData = [
|
const lineageData = [
|
||||||
{
|
{
|
||||||
id: `node-${mainNode.id}-1`,
|
id: `${mainNode.id}`,
|
||||||
sourcePosition: 'right',
|
sourcePosition: 'right',
|
||||||
targetPosition: 'left',
|
targetPosition: 'left',
|
||||||
type:
|
type:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user