dify
This commit is contained in:
2
dify/web/app/components/workflow/run/retry-log/index.tsx
Normal file
2
dify/web/app/components/workflow/run/retry-log/index.tsx
Normal file
@@ -0,0 +1,2 @@
|
||||
export { default as RetryLogTrigger } from './retry-log-trigger'
|
||||
export { default as RetryResultPanel } from './retry-result-panel'
|
||||
@@ -0,0 +1,41 @@
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import {
|
||||
RiArrowRightSLine,
|
||||
RiRestartFill,
|
||||
} from '@remixicon/react'
|
||||
import Button from '@/app/components/base/button'
|
||||
import type { NodeTracing } from '@/types/workflow'
|
||||
|
||||
type RetryLogTriggerProps = {
|
||||
nodeInfo: NodeTracing
|
||||
onShowRetryResultList: (detail: NodeTracing[]) => void
|
||||
}
|
||||
const RetryLogTrigger = ({
|
||||
nodeInfo,
|
||||
onShowRetryResultList,
|
||||
}: RetryLogTriggerProps) => {
|
||||
const { t } = useTranslation()
|
||||
const { retryDetail } = nodeInfo
|
||||
|
||||
const handleShowRetryResultList = (e: React.MouseEvent<HTMLButtonElement>) => {
|
||||
e.stopPropagation()
|
||||
e.nativeEvent.stopImmediatePropagation()
|
||||
onShowRetryResultList(retryDetail || [])
|
||||
}
|
||||
|
||||
return (
|
||||
<Button
|
||||
className='mb-1 flex w-full items-center justify-between'
|
||||
variant='tertiary'
|
||||
onClick={handleShowRetryResultList}
|
||||
>
|
||||
<div className='flex items-center'>
|
||||
<RiRestartFill className='mr-0.5 h-4 w-4 shrink-0 text-components-button-tertiary-text' />
|
||||
{t('workflow.nodes.common.retry.retries', { num: retryDetail?.length })}
|
||||
</div>
|
||||
<RiArrowRightSLine className='h-4 w-4 shrink-0 text-components-button-tertiary-text' />
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
|
||||
export default RetryLogTrigger
|
||||
@@ -0,0 +1,46 @@
|
||||
'use client'
|
||||
|
||||
import type { FC } from 'react'
|
||||
import { memo } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import {
|
||||
RiArrowLeftLine,
|
||||
} from '@remixicon/react'
|
||||
import TracingPanel from '../tracing-panel'
|
||||
import type { NodeTracing } from '@/types/workflow'
|
||||
|
||||
type Props = {
|
||||
list: NodeTracing[]
|
||||
onBack: () => void
|
||||
}
|
||||
|
||||
const RetryResultPanel: FC<Props> = ({
|
||||
list,
|
||||
onBack,
|
||||
}) => {
|
||||
const { t } = useTranslation()
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div
|
||||
className='system-sm-medium flex h-8 cursor-pointer items-center bg-components-panel-bg px-4 text-text-accent-secondary'
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
e.nativeEvent.stopImmediatePropagation()
|
||||
onBack()
|
||||
}}
|
||||
>
|
||||
<RiArrowLeftLine className='mr-1 h-4 w-4' />
|
||||
{t('workflow.singleRun.back')}
|
||||
</div>
|
||||
<TracingPanel
|
||||
list={list.map((item, index) => ({
|
||||
...item,
|
||||
title: `${t('workflow.nodes.common.retry.retry')} ${index + 1}`,
|
||||
}))}
|
||||
className='bg-background-section-burn'
|
||||
/>
|
||||
</div >
|
||||
)
|
||||
}
|
||||
export default memo(RetryResultPanel)
|
||||
Reference in New Issue
Block a user