diff --git a/src/api/operations.ts b/src/api/operations.ts index 686dc37..19ff03a 100644 --- a/src/api/operations.ts +++ b/src/api/operations.ts @@ -38,15 +38,16 @@ interface deleteLinkDataType extends apiRespBaseType {} type backfillLinkBodyType = createLinkBodyType; interface backfillLinkDataType extends apiRespBaseType { - added?: number; - local?: number; + toAddNum: number; + addedNum: number; + localNum: number; } type pruneLinkBodyType = createLinkBodyType; interface pruneLinkDataType extends apiRespBaseType { - added?: number; - local?: number; + toDelNum: number; + deletedNum: number; } export const apiFetchGraph = async (): Promise< diff --git a/src/pages/Graph/index.tsx b/src/pages/Graph/index.tsx index 43bd526..b2cecc4 100644 --- a/src/pages/Graph/index.tsx +++ b/src/pages/Graph/index.tsx @@ -96,13 +96,13 @@ const initialInteractive: Interactive = { elsSel: true, }; -const nodeOptions: Partial = { +const nodeProps: Partial = { style: { backgroundColor: "white", }, }; -const selectedNodeOptions: Partial = { +const selectedNodeProps: Partial = { style: { backgroundColor: "white", boxShadow: "0px 0px 60px 20px red", @@ -169,16 +169,13 @@ const Graph = (): React.ReactNode => { const onFlowSelectionChange: OnSelectionChangeFunc = useCallback( ({ nodes, edges }) => { - console.log(nodes); - console.log(edges); - const nodeSelection = nodes[0]?.id ?? ""; setSelectedNodeID(nodeSelection); setPlaylistNodes((nds) => nds.map((nd) => nd.id === nodeSelection - ? { ...nd, ...selectedNodeOptions } - : { ...nd, ...nodeOptions } + ? { ...nd, ...selectedNodeProps } + : { ...nd, ...nodeProps } ) ); const edgeSelection = edges[0]?.id ?? ""; @@ -275,7 +272,9 @@ const Graph = (): React.ReactNode => { setLoading(false); 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; @@ -302,7 +301,9 @@ const Graph = (): React.ReactNode => { setLoading(false); 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;