From bcaa6225d430ec835c46f7bf6403c1a72b267cf2 Mon Sep 17 00:00:00 2001 From: mlogclub Date: Sun, 28 Jun 2026 22:32:43 +0800 Subject: [PATCH] feat: add WorkflowEditorStatus component for displaying validation and node counts --- docs | 2 +- .../_components/workflow-editor-status.tsx | 38 +++++++++++++++++++ .../_components/workflow-editor-toolbar.tsx | 26 +------------ .../_components/workflow-editor.tsx | 11 ++++-- 4 files changed, 47 insertions(+), 30 deletions(-) create mode 100644 web/app/dashboard/ai-workflows/_components/workflow-editor-status.tsx diff --git a/docs b/docs index b6d08c0..5b69ec7 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit b6d08c0964853a795979c2a2be941254ac4ab39d +Subproject commit 5b69ec75398e40a5b186f6b66efb652229b7053f diff --git a/web/app/dashboard/ai-workflows/_components/workflow-editor-status.tsx b/web/app/dashboard/ai-workflows/_components/workflow-editor-status.tsx new file mode 100644 index 0000000..49d6bf1 --- /dev/null +++ b/web/app/dashboard/ai-workflows/_components/workflow-editor-status.tsx @@ -0,0 +1,38 @@ +"use client" + +import { AlertTriangleIcon, CheckCircle2Icon } from "lucide-react" + +import { cn } from "@/lib/utils" + +import type { WorkflowDraftValidation } from "./workflow-utils" + +export function WorkflowEditorStatus({ + validation, + nodeCount, + edgeCount, +}: { + validation: WorkflowDraftValidation + nodeCount: number + edgeCount: number +}) { + return ( +
+ + {validation.valid ? ( + + ) : ( + + )} + {validation.valid ? "检查通过" : `${validation.errors.length} 个问题`} + + + {nodeCount} 节点 + {edgeCount} 连线 +
+ ) +} diff --git a/web/app/dashboard/ai-workflows/_components/workflow-editor-toolbar.tsx b/web/app/dashboard/ai-workflows/_components/workflow-editor-toolbar.tsx index bfb05ad..722be5d 100644 --- a/web/app/dashboard/ai-workflows/_components/workflow-editor-toolbar.tsx +++ b/web/app/dashboard/ai-workflows/_components/workflow-editor-toolbar.tsx @@ -2,7 +2,6 @@ import type { ReactNode } from "react" import { - CheckCircle2Icon, RotateCcwIcon, SaveIcon, SendIcon, @@ -10,14 +9,8 @@ import { } from "lucide-react" import { Button } from "@/components/ui/button" -import { cn } from "@/lib/utils" - -import type { WorkflowDraftValidation } from "./workflow-utils" export function WorkflowEditorToolbar({ - validation, - nodeCount, - edgeCount, toolbarExtra, onUndo, undoDisabled = false, @@ -32,9 +25,6 @@ export function WorkflowEditorToolbar({ onPublish, publishDisabled = false, }: { - validation: WorkflowDraftValidation - nodeCount: number - edgeCount: number toolbarExtra?: ReactNode onUndo?: () => void undoDisabled?: boolean @@ -50,21 +40,7 @@ export function WorkflowEditorToolbar({ publishDisabled?: boolean }) { return ( -
-
- - - {validation.valid ? "本地检查通过" : `${validation.errors.length} 个本地问题`} - - - {nodeCount} 个节点 / {edgeCount} 条连线 - -
+
{toolbarExtra}