|
|
|
|
@ -1,8 +1,6 @@
|
|
|
|
|
import {
|
|
|
|
|
memo,
|
|
|
|
|
useCallback,
|
|
|
|
|
useEffect,
|
|
|
|
|
// useRef,
|
|
|
|
|
useState,
|
|
|
|
|
} from 'react'
|
|
|
|
|
import {
|
|
|
|
|
@ -11,7 +9,6 @@ import {
|
|
|
|
|
} from '@remixicon/react'
|
|
|
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
|
import copy from 'copy-to-clipboard'
|
|
|
|
|
import { useBoolean } from 'ahooks'
|
|
|
|
|
import ResultText from '../run/result-text'
|
|
|
|
|
import ResultPanel from '../run/result-panel'
|
|
|
|
|
import TracingPanel from '../run/tracing-panel'
|
|
|
|
|
@ -24,12 +21,9 @@ import {
|
|
|
|
|
} from '../types'
|
|
|
|
|
import { SimpleBtn } from '../../app/text-generate/item'
|
|
|
|
|
import Toast from '../../base/toast'
|
|
|
|
|
import { IterationResultPanel } from '../run/iteration-log'
|
|
|
|
|
import { RetryResultPanel } from '../run/retry-log'
|
|
|
|
|
import InputsPanel from './inputs-panel'
|
|
|
|
|
import cn from '@/utils/classnames'
|
|
|
|
|
import Loading from '@/app/components/base/loading'
|
|
|
|
|
import type { IterationDurationMap, NodeTracing } from '@/types/workflow'
|
|
|
|
|
|
|
|
|
|
const WorkflowPreview = () => {
|
|
|
|
|
const { t } = useTranslation()
|
|
|
|
|
@ -53,44 +47,6 @@ const WorkflowPreview = () => {
|
|
|
|
|
switchTab('DETAIL')
|
|
|
|
|
}, [workflowRunningData])
|
|
|
|
|
|
|
|
|
|
const [iterationRunResult, setIterationRunResult] = useState<NodeTracing[][]>([])
|
|
|
|
|
const [retryRunResult, setRetryRunResult] = useState<NodeTracing[]>([])
|
|
|
|
|
const [iterDurationMap, setIterDurationMap] = useState<IterationDurationMap>({})
|
|
|
|
|
const [isShowIterationDetail, {
|
|
|
|
|
setTrue: doShowIterationDetail,
|
|
|
|
|
setFalse: doHideIterationDetail,
|
|
|
|
|
}] = useBoolean(false)
|
|
|
|
|
const [isShowRetryDetail, {
|
|
|
|
|
setTrue: doShowRetryDetail,
|
|
|
|
|
setFalse: doHideRetryDetail,
|
|
|
|
|
}] = useBoolean(false)
|
|
|
|
|
|
|
|
|
|
const handleShowIterationDetail = useCallback((detail: NodeTracing[][], iterationDurationMap: IterationDurationMap) => {
|
|
|
|
|
setIterDurationMap(iterationDurationMap)
|
|
|
|
|
setIterationRunResult(detail)
|
|
|
|
|
doShowIterationDetail()
|
|
|
|
|
}, [doShowIterationDetail])
|
|
|
|
|
|
|
|
|
|
const handleRetryDetail = useCallback((detail: NodeTracing[]) => {
|
|
|
|
|
setRetryRunResult(detail)
|
|
|
|
|
doShowRetryDetail()
|
|
|
|
|
}, [doShowRetryDetail])
|
|
|
|
|
|
|
|
|
|
if (isShowIterationDetail) {
|
|
|
|
|
return (
|
|
|
|
|
<div className={`
|
|
|
|
|
flex flex-col w-[420px] h-full rounded-l-2xl border-[0.5px] border-gray-200 shadow-xl bg-white
|
|
|
|
|
`}>
|
|
|
|
|
<IterationResultPanel
|
|
|
|
|
list={iterationRunResult}
|
|
|
|
|
onHide={doHideIterationDetail}
|
|
|
|
|
onBack={doHideIterationDetail}
|
|
|
|
|
iterDurationMap={iterDurationMap}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className={`
|
|
|
|
|
flex flex-col w-[420px] h-full rounded-l-2xl border-[0.5px] border-gray-200 shadow-xl bg-white
|
|
|
|
|
@ -102,17 +58,6 @@ const WorkflowPreview = () => {
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div className='grow relative flex flex-col'>
|
|
|
|
|
{isShowIterationDetail
|
|
|
|
|
? (
|
|
|
|
|
<IterationResultPanel
|
|
|
|
|
list={iterationRunResult}
|
|
|
|
|
onHide={doHideIterationDetail}
|
|
|
|
|
onBack={doHideIterationDetail}
|
|
|
|
|
iterDurationMap={iterDurationMap}
|
|
|
|
|
/>
|
|
|
|
|
)
|
|
|
|
|
: (
|
|
|
|
|
<>
|
|
|
|
|
<div className='shrink-0 flex items-center px-4 border-b-[0.5px] border-[rgba(0,0,0,0.05)]'>
|
|
|
|
|
{showInputsPanel && (
|
|
|
|
|
<div
|
|
|
|
|
@ -212,12 +157,10 @@ const WorkflowPreview = () => {
|
|
|
|
|
<Loading />
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
{currentTab === 'TRACING' && !isShowRetryDetail && (
|
|
|
|
|
{currentTab === 'TRACING' && (
|
|
|
|
|
<TracingPanel
|
|
|
|
|
className='bg-background-section-burn'
|
|
|
|
|
list={workflowRunningData?.tracing || []}
|
|
|
|
|
onShowIterationDetail={handleShowIterationDetail}
|
|
|
|
|
onShowRetryDetail={handleRetryDetail}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
{currentTab === 'TRACING' && !workflowRunningData?.tracing?.length && (
|
|
|
|
|
@ -225,18 +168,7 @@ const WorkflowPreview = () => {
|
|
|
|
|
<Loading />
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
{
|
|
|
|
|
currentTab === 'TRACING' && isShowRetryDetail && (
|
|
|
|
|
<RetryResultPanel
|
|
|
|
|
list={retryRunResult}
|
|
|
|
|
onBack={doHideRetryDetail}
|
|
|
|
|
/>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
|