mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-24 08:58:06 +00:00
lineage export improvement around selector (#20669)
This commit is contained in:
parent
b7d43e7ee2
commit
e154dbbcc7
@ -131,6 +131,7 @@ const Lineage = ({
|
|||||||
<div
|
<div
|
||||||
className="h-full relative lineage-container"
|
className="h-full relative lineage-container"
|
||||||
data-testid="lineage-container"
|
data-testid="lineage-container"
|
||||||
|
id="lineage-container" // ID is required for export PNG functionality
|
||||||
ref={reactFlowWrapper}>
|
ref={reactFlowWrapper}>
|
||||||
{entityLineage && (
|
{entityLineage && (
|
||||||
<>
|
<>
|
||||||
|
@ -15,3 +15,6 @@ export enum ExportTypes {
|
|||||||
PNG = 'PNG',
|
PNG = 'PNG',
|
||||||
PDF = 'PDF',
|
PDF = 'PDF',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const LINEAGE_EXPORT_SELECTOR =
|
||||||
|
'#lineage-container .react-flow__viewport';
|
||||||
|
@ -56,7 +56,10 @@ import {
|
|||||||
import LineageNodeRemoveButton from '../../components/Lineage/LineageNodeRemoveButton';
|
import LineageNodeRemoveButton from '../../components/Lineage/LineageNodeRemoveButton';
|
||||||
import { SourceType } from '../../components/SearchedData/SearchedData.interface';
|
import { SourceType } from '../../components/SearchedData/SearchedData.interface';
|
||||||
import { ROUTES } from '../../constants/constants';
|
import { ROUTES } from '../../constants/constants';
|
||||||
import { ExportTypes } from '../../constants/Export.constants';
|
import {
|
||||||
|
ExportTypes,
|
||||||
|
LINEAGE_EXPORT_SELECTOR,
|
||||||
|
} from '../../constants/Export.constants';
|
||||||
import {
|
import {
|
||||||
ELEMENT_DELETE_STATE,
|
ELEMENT_DELETE_STATE,
|
||||||
ZOOM_VALUE,
|
ZOOM_VALUE,
|
||||||
@ -460,8 +463,8 @@ const LineageProvider = ({ children }: LineageProviderProps) => {
|
|||||||
name: decodedFqn,
|
name: decodedFqn,
|
||||||
exportTypes: [ExportTypes.CSV, ExportTypes.PNG],
|
exportTypes: [ExportTypes.CSV, ExportTypes.PNG],
|
||||||
}),
|
}),
|
||||||
documentSelector: '.react-flow__viewport',
|
documentSelector: LINEAGE_EXPORT_SELECTOR,
|
||||||
viewport: getViewportForLineageExport(nodes),
|
viewport: getViewportForLineageExport(nodes, LINEAGE_EXPORT_SELECTOR),
|
||||||
onExport: exportLineageData,
|
onExport: exportLineageData,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1717,10 +1717,11 @@ export const getViewportForBoundsReactFlow = (
|
|||||||
return { x: translateX, y: translateY, zoom: scale };
|
return { x: translateX, y: translateY, zoom: scale };
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getViewportForLineageExport = (nodes: Node[]): ExportViewport => {
|
export const getViewportForLineageExport = (
|
||||||
const exportElement = document.querySelector(
|
nodes: Node[],
|
||||||
'.react-flow__viewport'
|
documentSelector: string
|
||||||
) as HTMLElement;
|
): ExportViewport => {
|
||||||
|
const exportElement = document.querySelector(documentSelector) as HTMLElement;
|
||||||
|
|
||||||
const imageWidth = exportElement.scrollWidth;
|
const imageWidth = exportElement.scrollWidth;
|
||||||
const imageHeight = exportElement.scrollHeight;
|
const imageHeight = exportElement.scrollHeight;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user