feat: enhance NodeConfigPanel and WorkflowConfigPanel with improved title and description handling
This commit is contained in:
@@ -130,16 +130,6 @@ export function NodeConfigPanel({
|
|||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
<div className="min-h-0 flex-1 space-y-5 overflow-y-auto p-4">
|
<div className="min-h-0 flex-1 space-y-5 overflow-y-auto p-4">
|
||||||
<div className="space-y-2">
|
|
||||||
<Label htmlFor={`node-type-${node.id}`}>节点类型</Label>
|
|
||||||
<Input
|
|
||||||
id={`node-type-${node.id}`}
|
|
||||||
value={node.type}
|
|
||||||
readOnly
|
|
||||||
className="font-mono text-xs text-muted-foreground"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<Label htmlFor={`node-title-${node.id}`}>标题</Label>
|
<Label htmlFor={`node-title-${node.id}`}>标题</Label>
|
||||||
<Input
|
<Input
|
||||||
@@ -150,15 +140,6 @@ export function NodeConfigPanel({
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{nodeSpec?.description ? (
|
|
||||||
<div className="space-y-2">
|
|
||||||
<Label>节点说明</Label>
|
|
||||||
<div className="rounded-md border bg-muted/30 px-3 py-2 text-xs leading-5 text-muted-foreground">
|
|
||||||
{nodeSpec.description}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
|
|
||||||
{inputSchema.length > 0 ? (
|
{inputSchema.length > 0 ? (
|
||||||
<div className="space-y-3">
|
<div className="space-y-3">
|
||||||
<div className="text-sm font-medium">输入</div>
|
<div className="text-sm font-medium">输入</div>
|
||||||
|
|||||||
@@ -42,6 +42,13 @@ export function WorkflowConfigPanel({
|
|||||||
const selectedBranchItem = selectedNode && selectedBranch?.nodeId === selectedNode.id
|
const selectedBranchItem = selectedNode && selectedBranch?.nodeId === selectedNode.id
|
||||||
? normalizeNodeConfig(selectedNode.data?.config).branches?.find((branch) => branch.id === selectedBranch.branchId) ?? null
|
? normalizeNodeConfig(selectedNode.data?.config).branches?.find((branch) => branch.id === selectedBranch.branchId) ?? null
|
||||||
: null
|
: null
|
||||||
|
const panelTitle = selectedBranchItem
|
||||||
|
? selectedBranchItem.name || selectedBranchItem.id
|
||||||
|
: selectedNode?.data?.title || selectedNodeSpec?.title || selectedNode?.type || ""
|
||||||
|
const panelMeta = selectedBranchItem ? "条件分支" : selectedNode?.type || ""
|
||||||
|
const panelDescription = selectedBranchItem
|
||||||
|
? "配置该条件分支的匹配规则和目标节点。"
|
||||||
|
: selectedNodeSpec?.description || ""
|
||||||
|
|
||||||
if (!selectedNode) {
|
if (!selectedNode) {
|
||||||
return null
|
return null
|
||||||
@@ -64,12 +71,15 @@ export function WorkflowConfigPanel({
|
|||||||
<section className="pointer-events-auto flex min-h-0 w-full flex-col overflow-hidden rounded-md border bg-background/95 shadow-sm backdrop-blur">
|
<section className="pointer-events-auto flex min-h-0 w-full flex-col overflow-hidden rounded-md border bg-background/95 shadow-sm backdrop-blur">
|
||||||
<div className="flex shrink-0 items-start justify-between gap-3 border-b px-4 py-3">
|
<div className="flex shrink-0 items-start justify-between gap-3 border-b px-4 py-3">
|
||||||
<div className="min-w-0">
|
<div className="min-w-0">
|
||||||
<div className="text-sm font-medium">{selectedBranchItem ? "条件属性" : "属性"}</div>
|
<div className="truncate text-sm font-medium">{panelTitle}</div>
|
||||||
<div className="mt-0.5 truncate text-xs text-muted-foreground">
|
{panelMeta ? (
|
||||||
{selectedBranchItem
|
<div className="mt-1 truncate font-mono text-xs text-muted-foreground">{panelMeta}</div>
|
||||||
? selectedBranchItem.name || selectedBranchItem.id
|
) : null}
|
||||||
: selectedNode.data?.title || selectedNodeSpec?.title || selectedNode.type}
|
{panelDescription ? (
|
||||||
</div>
|
<div className="mt-2 line-clamp-3 text-xs leading-5 text-muted-foreground">
|
||||||
|
{panelDescription}
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
|
|||||||
Reference in New Issue
Block a user