Skip to content

Commit 307b123

Browse files
graph query fixes
1 parent 8d918a5 commit 307b123

File tree

2 files changed

+25
-27
lines changed

2 files changed

+25
-27
lines changed

frontend/src/components/Graph/GraphViewModal.tsx

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -110,37 +110,38 @@ const GraphViewModal: React.FunctionComponent<GraphViewModalProps> = ({
110110
}, [viewPoint, selectedRows, graphQuery, inspectedName, userCredentials]);
111111

112112
// Api call to get the nodes and relations
113-
const graphApi = () => {
114-
fetchData()
115-
.then((result) => {
116-
if (result && result.data.data.nodes.length > 0) {
117-
const neoNodes = result.data.data.nodes.map((f: Node) => f);
118-
const neoRels = result.data.data.relationships.map((f: Relationship) => f);
119-
const { finalNodes, finalRels, schemeVal } = processGraphData(neoNodes, neoRels);
120-
setAllNodes(finalNodes);
121-
setAllRelationships(finalRels);
122-
setScheme(schemeVal);
123-
setNodes(finalNodes);
124-
setRelationships(finalRels);
125-
setNewScheme(schemeVal);
126-
setLoading(false);
127-
} else {
128-
setLoading(false);
129-
setStatus('danger');
130-
setStatusMessage(`No Nodes and Relations for the ${inspectedName} file`);
131-
}
132-
})
133-
.catch((error: any) => {
113+
const graphApi = async () => {
114+
try {
115+
const result = await fetchData();
116+
if (result && result.data.data.nodes.length > 0) {
117+
const neoNodes = result.data.data.nodes.map((f: Node) => f);
118+
const neoRels = result.data.data.relationships.map((f: Relationship) => f);
119+
const { finalNodes, finalRels, schemeVal } = processGraphData(neoNodes, neoRels);
120+
setAllNodes(finalNodes);
121+
setAllRelationships(finalRels);
122+
setScheme(schemeVal);
123+
setNodes(finalNodes);
124+
setRelationships(finalRels);
125+
setNewScheme(schemeVal);
126+
setLoading(false);
127+
} else {
134128
setLoading(false);
135129
setStatus('danger');
136-
setStatusMessage(error.message);
137-
});
130+
setStatusMessage(`No Nodes and Relations for the ${inspectedName} file`);
131+
}
132+
} catch (error: any) {
133+
setLoading(false);
134+
setStatus('danger');
135+
setStatusMessage(error.message);
136+
}
138137
};
139138

140139
useEffect(() => {
141140
if (open) {
142141
setLoading(true);
143-
if (viewPoint === 'chatInfoView') {
142+
if (viewPoint !== 'chatInfoView') {
143+
graphApi();
144+
} else {
144145
const { finalNodes, finalRels, schemeVal } = processGraphData(nodeValues ?? [], relationshipValues ?? []);
145146
setAllNodes(finalNodes);
146147
setAllRelationships(finalRels);
@@ -149,8 +150,6 @@ const GraphViewModal: React.FunctionComponent<GraphViewModalProps> = ({
149150
setRelationships(finalRels);
150151
setNewScheme(schemeVal);
151152
setLoading(false);
152-
} else {
153-
graphApi();
154153
}
155154
}
156155
}, [open]);

frontend/src/services/ChunkEntitiesInfo.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ const chunkEntitiesAPI = async (userCredentials: UserCredentials, chunk_ids: str
1515
'Content-Type': 'multipart/form-data',
1616
},
1717
});
18-
console.log('response api', response);
1918
return response;
2019
} catch (error) {
2120
console.log('Error uploading file:', error);

0 commit comments

Comments
 (0)