All files / src/components/WorkflowBuilder/nodes OrchestrationNode.tsx

0% Statements 0/48
0% Branches 0/1
0% Functions 0/1
0% Lines 0/48

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82                                                                                                                                                                   
/**
 * Orchestration Node Component
 *
 * Node for executing skill orchestration graphs (DAGs).
 */
 
import { memo } from 'react';
import { Handle, Position, NodeProps, Node } from '@xyflow/react';
import type { OrchestrationNodeData } from '../../../lib/workflow-builder/types';
 
export const OrchestrationNode = memo(({ data, selected }: NodeProps<Node<OrchestrationNodeData>>) => {
  const hasGraphId = Boolean(data.graphId);
  const hasGraph = Boolean(data.graph);
  const inputCount = Object.keys(data.inputMappings).length;
 
  return (
    <div
      className={`
        px-4 py-3 rounded-lg border-2 min-w-[200px]
        bg-gradient-to-br from-indigo-50 to-purple-50
        border-indigo-300
        ${selected ? 'border-indigo-500 shadow-lg shadow-indigo-200' : ''}
      `}
    >
      {/* Input Handle */}
      <Handle
        type="target"
        position={Position.Left}
        className="w-3 h-3 bg-indigo-400 border-2 border-white"
      />
 
      {/* Output Handle */}
      <Handle
        type="source"
        position={Position.Right}
        className="w-3 h-3 bg-indigo-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-indigo-800">{data.label}</span>
      </div>
 
      {/* Graph Reference */}
      <div className={`text-sm mb-2 ${hasGraphId || hasGraph ? 'text-indigo-600' : 'text-indigo-400 italic'}`}>
        {hasGraphId ? (
          <div className="flex items-center gap-1.5 bg-indigo-100 rounded px-2 py-1">
            <span className="text-xs">📋</span>
            <span className="font-mono text-xs">{data.graphId}</span>
          </div>
        ) : hasGraph ? (
          <div className="flex items-center gap-1.5 bg-indigo-100 rounded px-2 py-1">
            <span className="text-xs">📊</span>
            <span className="text-xs">Inline graph</span>
          </div>
        ) : (
          'No graph configured'
        )}
      </div>
 
      {/* Input Mappings */}
      {inputCount > 0 && (
        <div className="text-xs text-indigo-500 mt-2">
          {inputCount} input mapping(s)
        </div>
      )}
 
      {/* Description */}
      {data.description && (
        <div className="text-xs text-indigo-400 mt-2 line-clamp-2">
          {data.description}
        </div>
      )}
    </div>
  );
});
 
OrchestrationNode.displayName = 'OrchestrationNode';
 
export default OrchestrationNode;