import { Badge, Button, EmptyState } from '@rozenite/ui'; import { Play, Square } from 'lucide-react'; import { formatPayloadForCommandInput } from '../utils.js'; import type { DevHostFlowEntry, DevHostFlowRunState } from '../types.js'; type FlowListProps = { flows: DevHostFlowEntry[]; flowRuns: DevHostFlowRunState[]; hasRunningFlow: (flowName: string) => boolean; onRunFlow: (flow: DevHostFlowEntry) => void; onStopFlow: (runId: string) => void; }; const getStatusLabel = (status: DevHostFlowRunState['status']) => { switch (status) { case 'running': return 'Running'; case 'succeeded': return 'Completed'; case 'failed': return 'Failed'; case 'aborted': return 'Stopped'; } }; export const FlowList = ({ flows, flowRuns, hasRunningFlow, onRunFlow, onStopFlow, }: FlowListProps) => { if (flows.length === 0) { return ( ); } return (
Available flows
{flows.map((flow) => { const isRunning = hasRunningFlow(flow.name); return ( ); })}
{flowRuns.length > 0 ? (
Flow runs
{flowRuns.map((flowRun) => (
{flowRun.flowDisplayName} {flowRun.autoRun ? ( Auto ) : null} {flowRun.status === 'running' ? ( ) : null}
{getStatusLabel(flowRun.status)} {flowRun.error ? (
{flowRun.error}
) : null} {flowRun.result != null ? (
                    {formatPayloadForCommandInput(flowRun.result)}
                  
) : null}
))}
) : null}
); };