|
|
|
@ -6,6 +6,7 @@ import {
|
|
|
|
cloneElement,
|
|
|
|
cloneElement,
|
|
|
|
memo,
|
|
|
|
memo,
|
|
|
|
useCallback,
|
|
|
|
useCallback,
|
|
|
|
|
|
|
|
useState,
|
|
|
|
} from 'react'
|
|
|
|
} from 'react'
|
|
|
|
import {
|
|
|
|
import {
|
|
|
|
RiCloseLine,
|
|
|
|
RiCloseLine,
|
|
|
|
@ -13,16 +14,16 @@ import {
|
|
|
|
} from '@remixicon/react'
|
|
|
|
} from '@remixicon/react'
|
|
|
|
import { useShallow } from 'zustand/react/shallow'
|
|
|
|
import { useShallow } from 'zustand/react/shallow'
|
|
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
import NextStep from './components/next-step'
|
|
|
|
import NextStep from '../next-step'
|
|
|
|
import PanelOperator from './components/panel-operator'
|
|
|
|
import PanelOperator from '../panel-operator'
|
|
|
|
import HelpLink from './components/help-link'
|
|
|
|
import HelpLink from '../help-link'
|
|
|
|
import {
|
|
|
|
import {
|
|
|
|
DescriptionInput,
|
|
|
|
DescriptionInput,
|
|
|
|
TitleInput,
|
|
|
|
TitleInput,
|
|
|
|
} from './components/title-description-input'
|
|
|
|
} from '../title-description-input'
|
|
|
|
import ErrorHandleOnPanel from './components/error-handle/error-handle-on-panel'
|
|
|
|
import ErrorHandleOnPanel from '../error-handle/error-handle-on-panel'
|
|
|
|
import RetryOnPanel from './components/retry/retry-on-panel'
|
|
|
|
import RetryOnPanel from '../retry/retry-on-panel'
|
|
|
|
import { useResizePanel } from './hooks/use-resize-panel'
|
|
|
|
import { useResizePanel } from '../../hooks/use-resize-panel'
|
|
|
|
import cn from '@/utils/classnames'
|
|
|
|
import cn from '@/utils/classnames'
|
|
|
|
import BlockIcon from '@/app/components/workflow/block-icon'
|
|
|
|
import BlockIcon from '@/app/components/workflow/block-icon'
|
|
|
|
import Split from '@/app/components/workflow/nodes/_base/components/split'
|
|
|
|
import Split from '@/app/components/workflow/nodes/_base/components/split'
|
|
|
|
@ -46,6 +47,7 @@ import Tooltip from '@/app/components/base/tooltip'
|
|
|
|
import type { Node } from '@/app/components/workflow/types'
|
|
|
|
import type { Node } from '@/app/components/workflow/types'
|
|
|
|
import { useStore as useAppStore } from '@/app/components/app/store'
|
|
|
|
import { useStore as useAppStore } from '@/app/components/app/store'
|
|
|
|
import { useStore } from '@/app/components/workflow/store'
|
|
|
|
import { useStore } from '@/app/components/workflow/store'
|
|
|
|
|
|
|
|
import Tab, { TabType } from './tab'
|
|
|
|
|
|
|
|
|
|
|
|
type BasePanelProps = {
|
|
|
|
type BasePanelProps = {
|
|
|
|
children: ReactNode
|
|
|
|
children: ReactNode
|
|
|
|
@ -102,6 +104,7 @@ const BasePanel: FC<BasePanelProps> = ({
|
|
|
|
saveStateToHistory(WorkflowHistoryEvent.NodeDescriptionChange)
|
|
|
|
saveStateToHistory(WorkflowHistoryEvent.NodeDescriptionChange)
|
|
|
|
}, [handleNodeDataUpdateWithSyncDraft, id, saveStateToHistory])
|
|
|
|
}, [handleNodeDataUpdateWithSyncDraft, id, saveStateToHistory])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const [tabType, setTabType] = useState<TabType>(TabType.settings)
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<div className={cn(
|
|
|
|
<div className={cn(
|
|
|
|
'relative mr-2 h-full',
|
|
|
|
'relative mr-2 h-full',
|
|
|
|
@ -167,40 +170,56 @@ const BasePanel: FC<BasePanelProps> = ({
|
|
|
|
onChange={handleDescriptionChange}
|
|
|
|
onChange={handleDescriptionChange}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className='pl-4'>
|
|
|
|
<div>
|
|
|
|
<Tab
|
|
|
|
{cloneElement(children as any, { id, data })}
|
|
|
|
value={tabType}
|
|
|
|
</div>
|
|
|
|
onChange={setTabType}
|
|
|
|
<Split />
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
hasRetryNode(data.type) && (
|
|
|
|
|
|
|
|
<RetryOnPanel
|
|
|
|
|
|
|
|
id={id}
|
|
|
|
|
|
|
|
data={data}
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
hasErrorHandleNode(data.type) && (
|
|
|
|
|
|
|
|
<ErrorHandleOnPanel
|
|
|
|
|
|
|
|
id={id}
|
|
|
|
|
|
|
|
data={data}
|
|
|
|
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
<Split />
|
|
|
|
{
|
|
|
|
</div>
|
|
|
|
!!availableNextBlocks.length && (
|
|
|
|
|
|
|
|
<div className='border-t-[0.5px] border-divider-regular p-4'>
|
|
|
|
{tabType === TabType.settings && (
|
|
|
|
<div className='system-sm-semibold-uppercase mb-1 flex items-center text-text-secondary'>
|
|
|
|
<>
|
|
|
|
{t('workflow.panel.nextStep').toLocaleUpperCase()}
|
|
|
|
<div>
|
|
|
|
</div>
|
|
|
|
{cloneElement(children as any, { id, data })}
|
|
|
|
<div className='system-xs-regular mb-2 text-text-tertiary'>
|
|
|
|
|
|
|
|
{t('workflow.panel.addNextStep')}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<NextStep selectedNode={{ id, data } as Node} />
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
<Split />
|
|
|
|
}
|
|
|
|
{
|
|
|
|
|
|
|
|
hasRetryNode(data.type) && (
|
|
|
|
|
|
|
|
<RetryOnPanel
|
|
|
|
|
|
|
|
id={id}
|
|
|
|
|
|
|
|
data={data}
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
hasErrorHandleNode(data.type) && (
|
|
|
|
|
|
|
|
<ErrorHandleOnPanel
|
|
|
|
|
|
|
|
id={id}
|
|
|
|
|
|
|
|
data={data}
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
!!availableNextBlocks.length && (
|
|
|
|
|
|
|
|
<div className='border-t-[0.5px] border-divider-regular p-4'>
|
|
|
|
|
|
|
|
<div className='system-sm-semibold-uppercase mb-1 flex items-center text-text-secondary'>
|
|
|
|
|
|
|
|
{t('workflow.panel.nextStep').toLocaleUpperCase()}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div className='system-xs-regular mb-2 text-text-tertiary'>
|
|
|
|
|
|
|
|
{t('workflow.panel.addNextStep')}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<NextStep selectedNode={{ id, data } as Node} />
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
</>
|
|
|
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{tabType === TabType.lastRun && (
|
|
|
|
|
|
|
|
<div>last run content</div>
|
|
|
|
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
)
|