diff --git a/web/src/pages/data-flow/log-sheet/dataflow-timeline.tsx b/web/src/pages/data-flow/log-sheet/dataflow-timeline.tsx index 5e0410058..442e99903 100644 --- a/web/src/pages/data-flow/log-sheet/dataflow-timeline.tsx +++ b/web/src/pages/data-flow/log-sheet/dataflow-timeline.tsx @@ -1,7 +1,6 @@ import { Timeline, TimelineContent, - TimelineDate, TimelineHeader, TimelineIndicator, TimelineItem, @@ -9,45 +8,10 @@ import { TimelineTitle, } from '@/components/originui/timeline'; import { ITraceData } from '@/interfaces/database/agent'; -import { Aperture } from 'lucide-react'; - -const items = [ - { - id: 1, - date: '15 minutes ago', - title: 'Hannah Kandell', - action: 'opened a new issue', - description: - "I'm having trouble with the new component library. It's not rendering properly.", - image: '/avatar-40-01.jpg', - }, - { - id: 2, - date: '10 minutes ago', - title: 'Chris Tompson', - action: 'commented on', - description: - "Hey Hannah, I'm having trouble with the new component library. It's not rendering properly.", - image: '/avatar-40-02.jpg', - }, - { - id: 3, - date: '5 minutes ago', - title: 'Emma Davis', - action: 'assigned you to', - description: - 'The new component library is not rendering properly. Can you take a look?', - image: '/avatar-40-03.jpg', - }, - { - id: 4, - date: '2 minutes ago', - title: 'Alex Morgan', - action: 'closed the issue', - description: 'The issue has been fixed. Please review the changes.', - image: '/avatar-40-05.jpg', - }, -]; +import { useCallback } from 'react'; +import { Operator } from '../constant'; +import OperatorIcon from '../operator-icon'; +import useGraphStore from '../store'; export type DataflowTimelineProps = { traceList?: ITraceData[]; @@ -61,36 +25,73 @@ interface DataflowTrace { timestamp: number; } export function DataflowTimeline({ traceList }: DataflowTimelineProps) { + const getNode = useGraphStore((state) => state.getNode); + + const getNodeData = useCallback( + (componentId: string) => { + return getNode(componentId)?.data; + }, + [getNode], + ); + + const getNodeLabel = useCallback( + (componentId: string) => { + return getNodeData(componentId)?.label as Operator; + }, + [getNodeData], + ); + return ( - {items.map((item) => ( - - - - - {/* {item.title} - - {item.action} - */} - - {item.description} - {item.date} - - - - - - - {/* - {item.description} - {item.date} - */} - - ))} + {Array.isArray(traceList) && + traceList?.map((item, index) => { + const traces = item.trace as DataflowTrace[]; + const nodeLabel = getNodeLabel(item.component_id); + + return ( + + + + + + + {getNodeData(item.component_id)?.name || 'END'} + + + {traces.map((x, idx) => ( + + + {x.datetime} + {x.progress * 100}% + {x.elapsed_time.toString().slice(0, 6)} + + {item.component_id !== 'END' && ( + {x.message} + )} + + ))} + + + + + {nodeLabel && ( + + )} + + + + ); + })} ); } diff --git a/web/src/pages/data-flow/log-sheet/index.tsx b/web/src/pages/data-flow/log-sheet/index.tsx index 7a51c0dda..526efdc24 100644 --- a/web/src/pages/data-flow/log-sheet/index.tsx +++ b/web/src/pages/data-flow/log-sheet/index.tsx @@ -37,20 +37,20 @@ export function LogSheet({ hideModal, messageId }: LogSheetProps) { - + {t('flow.log')} - - - {t('dataflow.exportJson')} - + + + {t('dataflow.exportJson')} + );
+ {getNodeData(item.component_id)?.name || 'END'} +