@ -1,7 +1,7 @@
'use client'
'use client'
import { useTranslation } from 'react-i18next'
import { useTranslation } from 'react-i18next'
import type { FC } from 'react'
import type { FC } from 'react'
import { useCallback , use Effect, useMemo , useState } from 'react'
import { useCallback , use Context, use Effect, useMemo , useState } from 'react'
import {
import {
RiAlertFill ,
RiAlertFill ,
RiArrowRightSLine ,
RiArrowRightSLine ,
@ -30,6 +30,9 @@ import ErrorHandleTip from '@/app/components/workflow/nodes/_base/components/err
import { hasRetryNode } from '@/app/components/workflow/utils'
import { hasRetryNode } from '@/app/components/workflow/utils'
import { useDocLink } from '@/context/i18n'
import { useDocLink } from '@/context/i18n'
import Tooltip from '@/app/components/base/tooltip'
import Tooltip from '@/app/components/base/tooltip'
import NodePosition from '@/app/components/workflow/nodes/_base/components/node-position'
import type { XYPosition } from 'reactflow'
import { WorkflowHistoryStoreContext } from '@/app/components/workflow/workflow-history-store'
type Props = {
type Props = {
className? : string
className? : string
@ -60,6 +63,24 @@ const NodePanel: FC<Props> = ({
notShowIterationNav ,
notShowIterationNav ,
notShowLoopNav ,
notShowLoopNav ,
} ) = > {
} ) = > {
const { store } = useContext ( WorkflowHistoryStoreContext )
let inPublishMode = true
let hasNode = false
let nodePosition : XYPosition = { x : 0 , y : 0 }
let nodeWidth = 0
let nodeHeight = 0
if ( store ) {
inPublishMode = false
const nodes = store . getState ( ) . nodes
const currentNodeIndex = nodes . findIndex ( node = > node . id === nodeInfo . node_id )
const currentNode = nodes [ currentNodeIndex ]
nodePosition = currentNode ? . position ? ? { x : - 1 , y : - 1 }
nodeWidth = currentNode ? . width ? ? - 1
nodeHeight = currentNode ? . height ? ? - 1
hasNode = ! ! currentNode
}
const [ collapseState , doSetCollapseState ] = useState < boolean > ( true )
const [ collapseState , doSetCollapseState ] = useState < boolean > ( true )
const setCollapseState = useCallback ( ( state : boolean ) = > {
const setCollapseState = useCallback ( ( state : boolean ) = > {
if ( hideProcessDetail )
if ( hideProcessDetail )
@ -161,6 +182,11 @@ const NodePanel: FC<Props> = ({
< RiLoader2Line className = 'h-3.5 w-3.5 animate-spin' / >
< RiLoader2Line className = 'h-3.5 w-3.5 animate-spin' / >
< / div >
< / div >
) }
) }
{ ! inPublishMode && (
< div className = 'ml-1' style = { { pointerEvents : hasNode ? 'auto' : 'none' , opacity : hasNode ? 1 : 0.5 } } >
< NodePosition nodePosition = { nodePosition } nodeWidth = { nodeWidth } nodeHeight = { nodeHeight } > < / NodePosition >
< / div >
) }
< / div >
< / div >
{ ! collapseState && ! hideProcessDetail && (
{ ! collapseState && ! hideProcessDetail && (
< div className = 'px-1 pb-1' >
< div className = 'px-1 pb-1' >