fix: column level lineage rendering (#11250)

* fix: column level lineage rendering

* fix: show drawer for selected node
This commit is contained in:
karanh37 2023-04-25 15:06:25 +05:30 committed by GitHub
parent 1cec768993
commit 20b6dbb8b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 16 deletions

View File

@ -197,6 +197,7 @@ const EntityLineageComponent: FunctionComponent<EntityLineageProp> = ({
const [nodes, setNodes, onNodesChange] = useNodesState([]);
const [edges, setEdges, onEdgesChange] = useEdgesState([]);
const edgesRef = useRef<Edge[]>([]);
const [paginationData, setPaginationData] = useState({});
const [entityLineage, setEntityLineage] = useState<EntityLineage>();
const [updatedLineageData, setUpdatedLineageData] = useState<EntityLineage>();
@ -368,11 +369,7 @@ const EntityLineageComponent: FunctionComponent<EntityLineageProp> = ({
if (node.type === EntityLineageNodeType.LOAD_MORE) {
selectLoadMoreNode(node);
} else {
const selectedNode = [
...(updatedLineageData?.nodes || []),
updatedLineageData?.entity,
].find((n) => n && node.id.includes(n.id));
const selectedNode = node.data.node;
if (!expandButton.current) {
selectNodeHandler(true, {
name: selectedNode?.name as string,
@ -697,7 +694,10 @@ const EntityLineageComponent: FunctionComponent<EntityLineageProp> = ({
...col,
type: isEditMode
? EntityLineageNodeType.DEFAULT
: getColumnType(edges, col.fullyQualifiedName || col.name),
: getColumnType(
edgesRef.current,
col.fullyQualifiedName || col.name
),
};
});
prevNode.data.columns = cols;
@ -1213,7 +1213,10 @@ const EntityLineageComponent: FunctionComponent<EntityLineageProp> = ({
...col,
type: isEditMode
? 'default'
: getColumnType(edges, col.fullyQualifiedName || col.name),
: getColumnType(
edgesRef.current,
col.fullyQualifiedName || col.name
),
};
});
node.data.columns = cols;
@ -1640,6 +1643,10 @@ const EntityLineageComponent: FunctionComponent<EntityLineageProp> = ({
}
}, [pipelineSearchValue]);
useEffect(() => {
edgesRef.current = edges;
}, [edges]);
if (isLineageLoading || (nodes.length === 0 && !deleted)) {
return <Loader />;
}

View File

@ -257,16 +257,7 @@ export const getLineageData = (
edge.lineageDetails.columnsLineage?.forEach((e) => {
const toColumn = e.toColumn || '';
if (toColumn && e.fromColumns && e.fromColumns.length > 0) {
const targetCol = nodes.find((n) => toColumn === n.id);
if (!targetCol) {
return;
}
e.fromColumns.forEach((fromColumn) => {
const sourceCol = nodes.find((n) => fromColumn === n.id);
if (!sourceCol) {
return;
}
lineageEdgesV1.push({
id: `column-${fromColumn}-${toColumn}-edge-${edge.fromEntity}-${edge.toEntity}`,
source: edge.fromEntity,