mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-31 04:14:34 +00:00
create export data on every click (#16344)
This commit is contained in:
parent
034877b1c3
commit
25b9576114
@ -175,7 +175,6 @@ const LineageProvider = ({ children }: LineageProviderProps) => {
|
|||||||
const [childMap, setChildMap] = useState<EntityReferenceChild>();
|
const [childMap, setChildMap] = useState<EntityReferenceChild>();
|
||||||
const [paginationData, setPaginationData] = useState({});
|
const [paginationData, setPaginationData] = useState({});
|
||||||
const { showModal } = useEntityExportModalProvider();
|
const { showModal } = useEntityExportModalProvider();
|
||||||
const [exportResult, setExportResult] = useState<string>('');
|
|
||||||
|
|
||||||
const initLineageChildMaps = useCallback(
|
const initLineageChildMaps = useCallback(
|
||||||
(
|
(
|
||||||
@ -228,11 +227,10 @@ const LineageProvider = ({ children }: LineageProviderProps) => {
|
|||||||
entityType !== EntityType.PIPELINE &&
|
entityType !== EntityType.PIPELINE &&
|
||||||
entityType !== EntityType.STORED_PROCEDURE
|
entityType !== EntityType.STORED_PROCEDURE
|
||||||
) {
|
) {
|
||||||
const { map: childMapObj, exportResult } = getChildMap(
|
const { map: childMapObj } = getChildMap(
|
||||||
{ ...res, nodes: allNodes },
|
{ ...res, nodes: allNodes },
|
||||||
decodedFqn
|
decodedFqn
|
||||||
);
|
);
|
||||||
setExportResult(exportResult);
|
|
||||||
setChildMap(childMapObj);
|
setChildMap(childMapObj);
|
||||||
const { nodes: newNodes, edges: newEdges } = getPaginatedChildMap(
|
const { nodes: newNodes, edges: newEdges } = getPaginatedChildMap(
|
||||||
{
|
{
|
||||||
@ -250,8 +248,6 @@ const LineageProvider = ({ children }: LineageProviderProps) => {
|
|||||||
edges: [...(res.edges ?? []), ...newEdges],
|
edges: [...(res.edges ?? []), ...newEdges],
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
const csv = getExportData(allNodes);
|
|
||||||
setExportResult(csv);
|
|
||||||
setEntityLineage({
|
setEntityLineage({
|
||||||
...res,
|
...res,
|
||||||
nodes: allNodes,
|
nodes: allNodes,
|
||||||
@ -281,9 +277,20 @@ const LineageProvider = ({ children }: LineageProviderProps) => {
|
|||||||
|
|
||||||
const exportLineageData = useCallback(
|
const exportLineageData = useCallback(
|
||||||
async (_: string) => {
|
async (_: string) => {
|
||||||
|
if (
|
||||||
|
entityType === EntityType.PIPELINE ||
|
||||||
|
entityType === EntityType.STORED_PROCEDURE
|
||||||
|
) {
|
||||||
|
// Since pipeline is an edge, we cannot create a tree, hence we take the nodes from the lineage response
|
||||||
|
// to get the export data.
|
||||||
|
return getExportData(entityLineage.nodes ?? []);
|
||||||
|
}
|
||||||
|
|
||||||
|
const { exportResult } = getChildMap(entityLineage, decodedFqn);
|
||||||
|
|
||||||
return exportResult;
|
return exportResult;
|
||||||
},
|
},
|
||||||
[exportResult]
|
[entityType, decodedFqn, entityLineage]
|
||||||
);
|
);
|
||||||
|
|
||||||
const onExportClick = useCallback(() => {
|
const onExportClick = useCallback(() => {
|
||||||
@ -293,7 +300,7 @@ const LineageProvider = ({ children }: LineageProviderProps) => {
|
|||||||
onExport: exportLineageData,
|
onExport: exportLineageData,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [decodedFqn, exportResult]);
|
}, [entityType, decodedFqn, entityLineage]);
|
||||||
|
|
||||||
const loadChildNodesHandler = useCallback(
|
const loadChildNodesHandler = useCallback(
|
||||||
async (node: SourceType, direction: EdgeTypeEnum) => {
|
async (node: SourceType, direction: EdgeTypeEnum) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user