mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-19 01:15:53 +08:00
feat: last run new loading
This commit is contained in:
parent
6caf6714cd
commit
53f2a12cf7
@ -316,6 +316,7 @@ const BasePanel: FC<BasePanelProps> = ({
|
|||||||
<LastRun
|
<LastRun
|
||||||
appId={appDetail?.id || ''}
|
appId={appDetail?.id || ''}
|
||||||
nodeId={id}
|
nodeId={id}
|
||||||
|
canSingleRun={isSupportSingleRun}
|
||||||
runningStatus={runningStatus}
|
runningStatus={runningStatus}
|
||||||
onSingleRunClicked={handleSingleRun}
|
onSingleRunClicked={handleSingleRun}
|
||||||
/>
|
/>
|
||||||
|
@ -5,11 +5,12 @@ import type { FC } from 'react'
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import NoData from './no-data'
|
import NoData from './no-data'
|
||||||
import { useLastRun } from '@/service/use-workflow'
|
import { useLastRun } from '@/service/use-workflow'
|
||||||
import Loading from '@/app/components/base/loading'
|
import { RiLoader2Line } from '@remixicon/react'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
appId: string
|
appId: string
|
||||||
nodeId: string
|
nodeId: string
|
||||||
|
canSingleRun: boolean
|
||||||
runningStatus?: NodeRunningStatus
|
runningStatus?: NodeRunningStatus
|
||||||
onSingleRunClicked: () => void
|
onSingleRunClicked: () => void
|
||||||
}
|
}
|
||||||
@ -17,21 +18,26 @@ type Props = {
|
|||||||
const LastRun: FC<Props> = ({
|
const LastRun: FC<Props> = ({
|
||||||
appId,
|
appId,
|
||||||
nodeId,
|
nodeId,
|
||||||
|
canSingleRun,
|
||||||
runningStatus,
|
runningStatus,
|
||||||
onSingleRunClicked,
|
onSingleRunClicked,
|
||||||
}) => {
|
}) => {
|
||||||
const isRunning = runningStatus === NodeRunningStatus.Running
|
const isRunning = runningStatus === NodeRunningStatus.Running
|
||||||
const { data: runResult, isFetching } = useLastRun(appId, nodeId, !isRunning)
|
const { data: runResult, isFetching } = useLastRun(appId, nodeId, !isRunning)
|
||||||
|
|
||||||
if (isFetching)
|
if (isFetching) {
|
||||||
return <Loading />
|
return (
|
||||||
|
<div className='flex h-0 grow flex-col items-center justify-center'>
|
||||||
|
<RiLoader2Line className='size-4 animate-spin text-text-tertiary' />
|
||||||
|
</div>)
|
||||||
|
}
|
||||||
|
|
||||||
if (isRunning)
|
if (isRunning)
|
||||||
return <ResultPanel status='running' showSteps={false} />
|
return <ResultPanel status='running' showSteps={false} />
|
||||||
|
|
||||||
if (!runResult) {
|
if (!runResult) {
|
||||||
return (
|
return (
|
||||||
<NoData onSingleRun={onSingleRunClicked} />
|
<NoData canSingleRun={canSingleRun} onSingleRun={onSingleRunClicked} />
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
|
@ -7,10 +7,12 @@ import { RiPlayLine } from '@remixicon/react'
|
|||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
canSingleRun: boolean
|
||||||
onSingleRun: () => void
|
onSingleRun: () => void
|
||||||
}
|
}
|
||||||
|
|
||||||
const NoData: FC<Props> = ({
|
const NoData: FC<Props> = ({
|
||||||
|
canSingleRun,
|
||||||
onSingleRun,
|
onSingleRun,
|
||||||
}) => {
|
}) => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
@ -18,6 +20,7 @@ const NoData: FC<Props> = ({
|
|||||||
<div className='flex h-0 grow flex-col items-center justify-center'>
|
<div className='flex h-0 grow flex-col items-center justify-center'>
|
||||||
<ClockPlay className='h-8 w-8 text-text-quaternary' />
|
<ClockPlay className='h-8 w-8 text-text-quaternary' />
|
||||||
<div className='system-xs-regular my-2 text-text-tertiary'>{t('workflow.debug.noData.description')}</div>
|
<div className='system-xs-regular my-2 text-text-tertiary'>{t('workflow.debug.noData.description')}</div>
|
||||||
|
{canSingleRun && (
|
||||||
<Button
|
<Button
|
||||||
className='flex'
|
className='flex'
|
||||||
size='small'
|
size='small'
|
||||||
@ -26,6 +29,7 @@ const NoData: FC<Props> = ({
|
|||||||
<RiPlayLine className='mr-1 h-3.5 w-3.5' />
|
<RiPlayLine className='mr-1 h-3.5 w-3.5' />
|
||||||
<div>{t('workflow.debug.noData.runThisNode')}</div>
|
<div>{t('workflow.debug.noData.runThisNode')}</div>
|
||||||
</Button>
|
</Button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user