mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-05 16:00:39 +08:00
feat: last run no data
This commit is contained in:
parent
62c1c76639
commit
512b6e4b14
@ -167,7 +167,7 @@ const BasePanel: FC<BasePanelProps> = ({
|
||||
setSingleRunParams(childPanelRef.current?.singleRunParams)
|
||||
}, [doSetRunInputData])
|
||||
|
||||
const [tabType, setTabType] = useState<TabType>(TabType.settings)
|
||||
const [tabType, setTabType] = useState<TabType>(TabType.lastRun)
|
||||
const handleRun = async (data: Record<string, any>) => {
|
||||
setTabType(TabType.lastRun)
|
||||
callRunApi(data)
|
||||
@ -177,7 +177,7 @@ const BasePanel: FC<BasePanelProps> = ({
|
||||
|
||||
return (
|
||||
<div className={cn(
|
||||
'relative mr-1 h-full',
|
||||
'relative mr-1 h-full',
|
||||
showMessageLogModal && '!absolute -top-[5px] right-[416px] z-0 !mr-0 w-[384px] overflow-hidden rounded-2xl border-[0.5px] border-components-panel-border shadow-lg transition-all',
|
||||
)}>
|
||||
<div
|
||||
@ -187,12 +187,12 @@ const BasePanel: FC<BasePanelProps> = ({
|
||||
</div>
|
||||
<div
|
||||
ref={containerRef}
|
||||
className={cn('h-full rounded-2xl border-[0.5px] border-components-panel-border bg-components-panel-bg shadow-lg', showSingleRunPanel ? 'overflow-hidden' : 'overflow-y-auto')}
|
||||
className={cn('flex h-full flex-col rounded-2xl border-[0.5px] border-components-panel-border bg-components-panel-bg shadow-lg', showSingleRunPanel ? 'overflow-hidden' : 'overflow-y-auto')}
|
||||
style={{
|
||||
width: `${nodePanelWidth}px`,
|
||||
}}
|
||||
>
|
||||
<div className='sticky top-0 z-10 border-b-[0.5px] border-divider-regular bg-components-panel-bg'>
|
||||
<div className='sticky top-0 z-10 shrink-0 border-b-[0.5px] border-divider-regular bg-components-panel-bg'>
|
||||
<div className='flex items-center px-4 pb-1 pt-4'>
|
||||
<BlockIcon
|
||||
className='mr-1 shrink-0'
|
||||
|
@ -4,6 +4,7 @@ import { useWorkflowStore } from '@/app/components/workflow/store'
|
||||
import { NodeRunningStatus } from '@/app/components/workflow/types'
|
||||
import type { FC } from 'react'
|
||||
import React, { useEffect, useState } from 'react'
|
||||
import NoData from './no-data'
|
||||
|
||||
type Props = {
|
||||
nodeId: string
|
||||
@ -26,12 +27,17 @@ const LastRun: FC<Props> = ({
|
||||
setRunResult(getLastRunNodeInfo(nodeId))
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [runningStatus])
|
||||
|
||||
const handleSingleRun = () => {
|
||||
console.log('run')
|
||||
}
|
||||
|
||||
if (isRunning)
|
||||
return <ResultPanel status='running' showSteps={false} />
|
||||
|
||||
if (!runResult) {
|
||||
return (
|
||||
<div>no data</div>
|
||||
<NoData onSingleRun={handleSingleRun} />
|
||||
)
|
||||
}
|
||||
return (
|
@ -0,0 +1,30 @@
|
||||
'use client'
|
||||
import type { FC } from 'react'
|
||||
import React from 'react'
|
||||
import { ClockPlay } from '@/app/components/base/icons/src/vender/line/time'
|
||||
import Button from '@/app/components/base/button'
|
||||
import { RiPlayLine } from '@remixicon/react'
|
||||
|
||||
type Props = {
|
||||
onSingleRun: () => void
|
||||
}
|
||||
|
||||
const NoData: FC<Props> = ({
|
||||
onSingleRun,
|
||||
}) => {
|
||||
return (
|
||||
<div className='flex h-0 grow flex-col items-center justify-center'>
|
||||
<ClockPlay className='h-8 w-8 text-text-quaternary' />
|
||||
<div className='system-xs-regular my-2 text-text-tertiary'>The results of the last run will be displayed here</div>
|
||||
<Button
|
||||
className='flex'
|
||||
size='small'
|
||||
onClick={onSingleRun}
|
||||
>
|
||||
<RiPlayLine className='mr-1 h-3.5 w-3.5' />
|
||||
<div>Run this node</div>
|
||||
</Button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
export default React.memo(NoData)
|
Loading…
x
Reference in New Issue
Block a user