fix(frontend): stabilize WAF rule canvas

Use React Flow controlled node state, support deleting nodes and edges, and show node properties only after selection.
This commit is contained in:
ryan
2026-07-13 14:58:57 +08:00
parent 74ddf97b36
commit 85d5c8568c
12 changed files with 245 additions and 38 deletions
@@ -144,3 +144,7 @@ export function wouldCreateCycle(graph: WAFRuleGraph, source: string, target: st
export function removeNodeFromGraph(graph: WAFRuleGraph, nodeId: string): WAFRuleGraph {
return {...graph, nodes: graph.nodes.filter((node) => node.id !== nodeId), edges: graph.edges.filter((edge) => edge.source !== nodeId && edge.target !== nodeId)};
}
export function removeEdgeFromGraph(graph: WAFRuleGraph, edgeId: string): WAFRuleGraph {
return {...graph, edges: graph.edges.filter((edge) => edge.id !== edgeId)};
}