partial opn result

This commit is contained in:
Kaushik Narayan R 2025-03-13 15:15:48 -07:00
parent 70ee8c6b0e
commit 1e46c087d6
2 changed files with 15 additions and 13 deletions

View File

@ -38,15 +38,16 @@ interface deleteLinkDataType extends apiRespBaseType {}
type backfillLinkBodyType = createLinkBodyType; type backfillLinkBodyType = createLinkBodyType;
interface backfillLinkDataType extends apiRespBaseType { interface backfillLinkDataType extends apiRespBaseType {
added?: number; toAddNum: number;
local?: number; addedNum: number;
localNum: number;
} }
type pruneLinkBodyType = createLinkBodyType; type pruneLinkBodyType = createLinkBodyType;
interface pruneLinkDataType extends apiRespBaseType { interface pruneLinkDataType extends apiRespBaseType {
added?: number; toDelNum: number;
local?: number; deletedNum: number;
} }
export const apiFetchGraph = async (): Promise< export const apiFetchGraph = async (): Promise<

View File

@ -96,13 +96,13 @@ const initialInteractive: Interactive = {
elsSel: true, elsSel: true,
}; };
const nodeOptions: Partial<Node> = { const nodeProps: Partial<Node> = {
style: { style: {
backgroundColor: "white", backgroundColor: "white",
}, },
}; };
const selectedNodeOptions: Partial<Node> = { const selectedNodeProps: Partial<Node> = {
style: { style: {
backgroundColor: "white", backgroundColor: "white",
boxShadow: "0px 0px 60px 20px red", boxShadow: "0px 0px 60px 20px red",
@ -169,16 +169,13 @@ const Graph = (): React.ReactNode => {
const onFlowSelectionChange: OnSelectionChangeFunc = useCallback( const onFlowSelectionChange: OnSelectionChangeFunc = useCallback(
({ nodes, edges }) => { ({ nodes, edges }) => {
console.log(nodes);
console.log(edges);
const nodeSelection = nodes[0]?.id ?? ""; const nodeSelection = nodes[0]?.id ?? "";
setSelectedNodeID(nodeSelection); setSelectedNodeID(nodeSelection);
setPlaylistNodes((nds) => setPlaylistNodes((nds) =>
nds.map((nd) => nds.map((nd) =>
nd.id === nodeSelection nd.id === nodeSelection
? { ...nd, ...selectedNodeOptions } ? { ...nd, ...selectedNodeProps }
: { ...nd, ...nodeOptions } : { ...nd, ...nodeProps }
) )
); );
const edgeSelection = edges[0]?.id ?? ""; const edgeSelection = edges[0]?.id ?? "";
@ -275,7 +272,9 @@ const Graph = (): React.ReactNode => {
setLoading(false); setLoading(false);
if (resp?.status === 200) { if (resp?.status === 200) {
showSuccessToastNotification(resp?.data.message); if (resp?.data.addedNum < resp?.data.toAddNum)
showWarnToastNotification(resp?.data.message);
else showSuccessToastNotification(resp?.data.message);
return; return;
} }
return; return;
@ -302,7 +301,9 @@ const Graph = (): React.ReactNode => {
setLoading(false); setLoading(false);
if (resp?.status === 200) { if (resp?.status === 200) {
showSuccessToastNotification(resp?.data.message); if (resp?.data.deletedNum < resp?.data.toDelNum)
showWarnToastNotification(resp?.data.message);
else showSuccessToastNotification(resp?.data.message);
return; return;
} }
return; return;