From 60d6e3e8463fc6532e0132452be01c4bcc83ee14 Mon Sep 17 00:00:00 2001 From: ryan Date: Sun, 19 Jul 2026 12:52:12 +0800 Subject: [PATCH] =?UTF-8?q?fix(waf):=20=E8=B0=83=E6=95=B4=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=99=A8=E8=BF=94=E5=9B=9E=E4=B8=8E=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E5=8C=96=E5=B8=83=E5=B1=80=E6=8C=89=E9=92=AE=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 返回置于标题上方;格式化布局移至保存按钮左侧。 --- .../editor/components/rule-flow-canvas.tsx | 28 +--- frontend/app/(main)/waf/rules/editor/page.tsx | 126 +++++++++++------- 2 files changed, 77 insertions(+), 77 deletions(-) diff --git a/frontend/app/(main)/waf/rules/editor/components/rule-flow-canvas.tsx b/frontend/app/(main)/waf/rules/editor/components/rule-flow-canvas.tsx index fd2e0fd9..07ba89b9 100644 --- a/frontend/app/(main)/waf/rules/editor/components/rule-flow-canvas.tsx +++ b/frontend/app/(main)/waf/rules/editor/components/rule-flow-canvas.tsx @@ -25,10 +25,9 @@ import { type NodeChange, type ReactFlowInstance, } from '@xyflow/react'; -import { AlignHorizontalSpaceAround, Trash2 } from 'lucide-react'; +import { Trash2 } from 'lucide-react'; import '@xyflow/react/dist/style.css'; -import { Button } from '@/components/ui/button'; import type { WAFRuleEdge, WAFRuleGraph } from '@/lib/services/openflare'; import { cn } from '@/lib/utils'; @@ -39,7 +38,6 @@ import { isConnectionAllowed, isPersistentEdgeChange, } from './editor-behavior'; -import { layoutRuleGraph } from './graph-layout'; import { type GraphIssue, removeEdgeFromGraph, @@ -328,18 +326,6 @@ export function RuleFlowCanvas({ [], ); - const formatLayout = useCallback(() => { - const next = layoutRuleGraph(graph); - onGraphChange(next); - setContextMenu(null); - requestAnimationFrame(() => { - void instance.current?.fitView({ - ...initialFitViewOptions, - duration: 280, - }); - }); - }, [graph, onGraphChange]); - const contextNode = contextMenu?.kind === 'node' ? graph.nodes.find((node) => node.id === contextMenu.id) @@ -357,18 +343,8 @@ export function RuleFlowCanvas({ className='relative min-w-0 flex-1 bg-muted/20' onContextMenu={suppressBrowserContextMenu} > -
+
-
{ + if (!graph) return; + changeGraph(layoutRuleGraph(graph)); + }, [changeGraph, graph]); const leave = () => { if (!dirty || window.confirm('存在未保存的更改,确定离开吗?')) router.push('/waf'); @@ -186,58 +196,72 @@ function EditorContent() { return (
-
-
- -

- {ruleQuery.data.name} -

- - {ruleQuery.data.enabled ? '已启用' : '已停用'} - - - {issues.length === 0 ? '图校验通过' : `${issues.length} 个问题`} - - {dirty && 未保存} -
-
-
- 0 || - saveMutation.isPending || - metaMutation.isPending - } - onCheckedChange={(enabled) => metaMutation.mutate(enabled)} - /> - -
- - {conflict && ( +
+
+
+ +

+ {ruleQuery.data.name} +

+ + {ruleQuery.data.enabled ? '已启用' : '已停用'} + + + {issues.length === 0 ? '图校验通过' : `${issues.length} 个问题`} + + {dirty && 未保存} +
+
+
+ 0 || + saveMutation.isPending || + metaMutation.isPending + } + onCheckedChange={(enabled) => metaMutation.mutate(enabled)} + /> + +
+ {conflict && ( + + )} - )} - + +