record.tsx 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. import { memo, useCallback } from 'react'
  2. import type { WorkflowDataUpdater } from '../types'
  3. import Run from '../run'
  4. import { useStore } from '../store'
  5. import { useWorkflowUpdate } from '../hooks'
  6. const Record = () => {
  7. const historyWorkflowData = useStore(s => s.historyWorkflowData)
  8. const { handleUpdateWorkflowCanvas } = useWorkflowUpdate()
  9. const handleResultCallback = useCallback((res: any) => {
  10. const graph: WorkflowDataUpdater = res.graph
  11. handleUpdateWorkflowCanvas({
  12. nodes: graph.nodes,
  13. edges: graph.edges,
  14. viewport: graph.viewport,
  15. })
  16. }, [handleUpdateWorkflowCanvas])
  17. return (
  18. <div className='flex flex-col w-[400px] h-full rounded-l-2xl border-[0.5px] border-components-panel-border shadow-xl bg-components-panel-bg'>
  19. <div className='flex items-center justify-between p-4 pb-0 text-text-primary system-xl-semibold'>
  20. {`Test Run#${historyWorkflowData?.sequence_number}`}
  21. </div>
  22. <Run
  23. runID={historyWorkflowData?.id || ''}
  24. getResultCallback={handleResultCallback}
  25. />
  26. </div>
  27. )
  28. }
  29. export default memo(Record)