Some checks failed
CI / Rust Check (push) Has been cancelled
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
style: 统一代码格式和注释风格 docs: 更新多个功能文档的完整度和状态 feat(runtime): 添加路径验证工具支持 fix(pipeline): 改进条件判断和变量解析逻辑 test(types): 为ID类型添加全面测试用例 chore: 更新依赖项和Cargo.lock文件 perf(mcp): 优化MCP协议传输和错误处理
55 lines
1.5 KiB
TypeScript
55 lines
1.5 KiB
TypeScript
/**
|
|
* Input Node Component
|
|
*
|
|
* Node for defining workflow input variables.
|
|
*/
|
|
|
|
import { memo } from 'react';
|
|
import { Handle, Position, NodeProps, Node } from '@xyflow/react';
|
|
import type { InputNodeData } from '../../../lib/workflow-builder/types';
|
|
|
|
export const InputNode = memo(({ data, selected }: NodeProps<Node<InputNodeData>>) => {
|
|
return (
|
|
<div
|
|
className={`
|
|
px-4 py-3 rounded-lg border-2 min-w-[180px]
|
|
bg-emerald-50 border-emerald-300
|
|
${selected ? 'border-emerald-500 shadow-lg shadow-emerald-200' : ''}
|
|
`}
|
|
>
|
|
{/* Output Handle */}
|
|
<Handle
|
|
type="source"
|
|
position={Position.Right}
|
|
className="w-3 h-3 bg-emerald-500 border-2 border-white"
|
|
/>
|
|
|
|
{/* Header */}
|
|
<div className="flex items-center gap-2 mb-2">
|
|
<span className="text-lg">📥</span>
|
|
<span className="font-medium text-emerald-800">{data.label}</span>
|
|
</div>
|
|
|
|
{/* Variable Name */}
|
|
<div className="text-sm text-emerald-600">
|
|
<span className="font-mono bg-emerald-100 px-1.5 py-0.5 rounded">
|
|
{data.variableName}
|
|
</span>
|
|
</div>
|
|
|
|
{/* Default Value Indicator */}
|
|
{data.defaultValue !== undefined && (
|
|
<div className="text-xs text-emerald-500 mt-1">
|
|
default: {typeof data.defaultValue === 'string'
|
|
? `"${data.defaultValue}"`
|
|
: JSON.stringify(data.defaultValue)}
|
|
</div>
|
|
)}
|
|
</div>
|
|
);
|
|
});
|
|
|
|
InputNode.displayName = 'InputNode';
|
|
|
|
export default InputNode;
|