Skip to content

Commit 65149e1

Browse files
authored
Add id patch for data mode entity update (#28393)
1 parent 82430c7 commit 65149e1

1 file changed

Lines changed: 28 additions & 1 deletion

File tree

openmetadata-ui/src/main/resources/ui/src/components/OntologyExplorer/OntologyEntityPanel.tsx

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ import { SlideoutMenu } from '@openmetadata/ui-core-components';
1515
import { ReactNode, useEffect, useLayoutEffect, useState } from 'react';
1616
import { useAlertStore } from '../../hooks/useAlertStore';
1717
import { EntityData } from '../../pages/TasksPage/TasksPage.interface';
18+
import { getGlossaryTermByFQN } from '../../rest/glossaryAPI';
1819
import AlertBar from '../AlertBar/AlertBar';
1920
import EntitySummaryPanel from '../Explore/EntitySummaryPanel/EntitySummaryPanel.component';
2021
import { EntityDetailsObjectInterface } from '../Explore/ExplorePage.interface';
22+
import { isValidUUID } from './utils/graphBuilders';
2123

2224
const PANEL_WIDTH = 576;
2325

@@ -46,6 +48,8 @@ export const OntologyEntityPanel = ({
4648
message: string | JSX.Element;
4749
type: 'success' | 'error';
4850
}>({ message: '', open: false, type: 'success' });
51+
const [resolvedDetails, setResolvedDetails] =
52+
useState<EntityDetailsObjectInterface>(entityDetails);
4953

5054
// Intercept global alerts when the panel is open so they show inside
5155
// the slideout instead of on the background page via PageLayoutV1.
@@ -73,6 +77,29 @@ export const OntologyEntityPanel = ({
7377
return () => clearTimeout(timer);
7478
}, [localToast]);
7579

80+
// Data-mode nodes built by buildGraphFromCounts use the FQN as the graph id
81+
// instead of a real UUID. Fetch the term by FQN to get the actual UUID so
82+
// PATCH operations in EntitySummaryPanel receive a valid id.
83+
useEffect(() => {
84+
const id = entityDetails.details?.id ?? '';
85+
const fqn = entityDetails.details?.fullyQualifiedName ?? '';
86+
87+
if (isValidUUID(id) || !fqn) {
88+
setResolvedDetails(entityDetails);
89+
90+
return;
91+
}
92+
93+
getGlossaryTermByFQN(fqn)
94+
.then((term) => {
95+
setResolvedDetails({
96+
...entityDetails,
97+
details: { ...entityDetails.details, id: term.id ?? id },
98+
});
99+
})
100+
.catch(() => setResolvedDetails(entityDetails));
101+
}, [entityDetails]);
102+
76103
return (
77104
<SlideoutMenu
78105
isDismissable
@@ -100,7 +127,7 @@ export const OntologyEntityPanel = ({
100127
<EntitySummaryPanel
101128
isSideDrawer
102129
afterEntityUpdate={afterEntityUpdate}
103-
entityDetails={entityDetails}
130+
entityDetails={resolvedDetails}
104131
handleClosePanel={onClose}
105132
ontologyExplorerRelationsSlot={ontologyRelationsSlot}
106133
panelPath={panelPath}

0 commit comments

Comments
 (0)