|
|
|
@ -3,15 +3,13 @@ import type { FC } from 'react'
|
|
|
|
import React, { useCallback, useState } from 'react'
|
|
|
|
import React, { useCallback, useState } from 'react'
|
|
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
import {
|
|
|
|
import {
|
|
|
|
|
|
|
|
RiArrowLeftLine,
|
|
|
|
RiArrowRightSLine,
|
|
|
|
RiArrowRightSLine,
|
|
|
|
RiCloseLine,
|
|
|
|
|
|
|
|
RiErrorWarningLine,
|
|
|
|
RiErrorWarningLine,
|
|
|
|
RiLoader2Line,
|
|
|
|
RiLoader2Line,
|
|
|
|
} from '@remixicon/react'
|
|
|
|
} from '@remixicon/react'
|
|
|
|
import { ArrowNarrowLeft } from '@/app/components/base/icons/src/vender/line/arrows'
|
|
|
|
|
|
|
|
import { NodeRunningStatus } from '@/app/components/workflow/types'
|
|
|
|
import { NodeRunningStatus } from '@/app/components/workflow/types'
|
|
|
|
import TracingPanel from '@/app/components/workflow/run/tracing-panel'
|
|
|
|
import TracingPanel from '@/app/components/workflow/run/tracing-panel'
|
|
|
|
import { RetryResultPanel } from '@/app/components/workflow/run/retry-log'
|
|
|
|
|
|
|
|
import { Iteration } from '@/app/components/base/icons/src/vender/workflow'
|
|
|
|
import { Iteration } from '@/app/components/base/icons/src/vender/workflow'
|
|
|
|
import cn from '@/utils/classnames'
|
|
|
|
import cn from '@/utils/classnames'
|
|
|
|
import type { IterationDurationMap, NodeTracing } from '@/types/workflow'
|
|
|
|
import type { IterationDurationMap, NodeTracing } from '@/types/workflow'
|
|
|
|
@ -19,17 +17,13 @@ const i18nPrefix = 'workflow.singleRun'
|
|
|
|
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
type Props = {
|
|
|
|
list: NodeTracing[][]
|
|
|
|
list: NodeTracing[][]
|
|
|
|
onHide: () => void
|
|
|
|
|
|
|
|
onBack: () => void
|
|
|
|
onBack: () => void
|
|
|
|
noWrap?: boolean
|
|
|
|
|
|
|
|
iterDurationMap?: IterationDurationMap
|
|
|
|
iterDurationMap?: IterationDurationMap
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const IterationResultPanel: FC<Props> = ({
|
|
|
|
const IterationResultPanel: FC<Props> = ({
|
|
|
|
list,
|
|
|
|
list,
|
|
|
|
onHide,
|
|
|
|
|
|
|
|
onBack,
|
|
|
|
onBack,
|
|
|
|
noWrap,
|
|
|
|
|
|
|
|
iterDurationMap,
|
|
|
|
iterDurationMap,
|
|
|
|
}) => {
|
|
|
|
}) => {
|
|
|
|
const { t } = useTranslation()
|
|
|
|
const { t } = useTranslation()
|
|
|
|
@ -75,29 +69,22 @@ const IterationResultPanel: FC<Props> = ({
|
|
|
|
</>
|
|
|
|
</>
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const [retryRunResult, setRetryRunResult] = useState<Record<string, NodeTracing[]> | undefined>()
|
|
|
|
|
|
|
|
const handleRetryDetail = (v: number, detail?: NodeTracing[]) => {
|
|
|
|
|
|
|
|
setRetryRunResult({ ...retryRunResult, [v]: detail })
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const main = (
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<div className='bg-components-panel-bg'>
|
|
|
|
<div className={cn(!noWrap && 'shrink-0 ', 'px-4 pt-3')}>
|
|
|
|
<div
|
|
|
|
<div className='shrink-0 flex justify-between items-center h-8'>
|
|
|
|
className='flex items-center px-4 h-8 text-text-accent-secondary cursor-pointer border-b-[0.5px] border-b-divider-regular'
|
|
|
|
<div className='system-xl-semibold text-text-primary truncate'>
|
|
|
|
onClick={(e) => {
|
|
|
|
{t(`${i18nPrefix}.testRunIteration`)}
|
|
|
|
e.stopPropagation()
|
|
|
|
</div>
|
|
|
|
e.nativeEvent.stopImmediatePropagation()
|
|
|
|
<div className='ml-2 shrink-0 p-1 cursor-pointer' onClick={onHide}>
|
|
|
|
onBack()
|
|
|
|
<RiCloseLine className='w-4 h-4 text-text-tertiary' />
|
|
|
|
}}
|
|
|
|
</div>
|
|
|
|
>
|
|
|
|
</div>
|
|
|
|
<RiArrowLeftLine className='mr-1 w-4 h-4' />
|
|
|
|
<div className='flex items-center py-2 space-x-1 text-text-accent-secondary cursor-pointer' onClick={onBack}>
|
|
|
|
|
|
|
|
<ArrowNarrowLeft className='w-4 h-4' />
|
|
|
|
|
|
|
|
<div className='system-sm-medium'>{t(`${i18nPrefix}.back`)}</div>
|
|
|
|
<div className='system-sm-medium'>{t(`${i18nPrefix}.back`)}</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{/* List */}
|
|
|
|
{/* List */}
|
|
|
|
<div className={cn(!noWrap ? 'flex-grow overflow-auto' : 'max-h-full', 'p-2 bg-components-panel-bg')}>
|
|
|
|
<div className='p-2 bg-components-panel-bg'>
|
|
|
|
{list.map((iteration, index) => (
|
|
|
|
{list.map((iteration, index) => (
|
|
|
|
<div key={index} className={cn('mb-1 overflow-hidden rounded-xl bg-background-section-burn border-none')}>
|
|
|
|
<div key={index} className={cn('mb-1 overflow-hidden rounded-xl bg-background-section-burn border-none')}>
|
|
|
|
<div
|
|
|
|
<div
|
|
|
|
@ -121,8 +108,6 @@ const IterationResultPanel: FC<Props> = ({
|
|
|
|
{expandedIterations[index] && <div
|
|
|
|
{expandedIterations[index] && <div
|
|
|
|
className="grow h-px bg-divider-subtle"
|
|
|
|
className="grow h-px bg-divider-subtle"
|
|
|
|
></div>}
|
|
|
|
></div>}
|
|
|
|
{
|
|
|
|
|
|
|
|
!retryRunResult?.[index] && (
|
|
|
|
|
|
|
|
<div className={cn(
|
|
|
|
<div className={cn(
|
|
|
|
'overflow-hidden transition-all duration-200',
|
|
|
|
'overflow-hidden transition-all duration-200',
|
|
|
|
expandedIterations[index] ? 'max-h-[1000px] opacity-100' : 'max-h-0 opacity-0',
|
|
|
|
expandedIterations[index] ? 'max-h-[1000px] opacity-100' : 'max-h-0 opacity-0',
|
|
|
|
@ -130,45 +115,12 @@ const IterationResultPanel: FC<Props> = ({
|
|
|
|
<TracingPanel
|
|
|
|
<TracingPanel
|
|
|
|
list={iteration}
|
|
|
|
list={iteration}
|
|
|
|
className='bg-background-section-burn'
|
|
|
|
className='bg-background-section-burn'
|
|
|
|
onShowRetryDetail={v => handleRetryDetail(index, v)}
|
|
|
|
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
retryRunResult?.[index] && (
|
|
|
|
|
|
|
|
<RetryResultPanel
|
|
|
|
|
|
|
|
list={retryRunResult[index]}
|
|
|
|
|
|
|
|
onBack={() => handleRetryDetail(index, undefined)}
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
))}
|
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</>
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
const handleNotBubble = useCallback((e: React.MouseEvent) => {
|
|
|
|
|
|
|
|
// if not do this, it will trigger the message log modal disappear(useClickAway)
|
|
|
|
|
|
|
|
e.stopPropagation()
|
|
|
|
|
|
|
|
e.nativeEvent.stopImmediatePropagation()
|
|
|
|
|
|
|
|
}, [])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (noWrap)
|
|
|
|
|
|
|
|
return main
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
|
|
<div
|
|
|
|
|
|
|
|
className='absolute inset-0 z-10 rounded-2xl pt-10'
|
|
|
|
|
|
|
|
style={{
|
|
|
|
|
|
|
|
backgroundColor: 'rgba(16, 24, 40, 0.20)',
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
onClick={handleNotBubble}
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<div className='h-full rounded-2xl bg-components-panel-bg flex flex-col'>
|
|
|
|
|
|
|
|
{main}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div >
|
|
|
|
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
export default React.memo(IterationResultPanel)
|
|
|
|
export default React.memo(IterationResultPanel)
|
|
|
|
|