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