Fix/single run panel show parent scrollbar (#5574)
Co-authored-by: StyleZhang <jasonapring2015@outlook.com>
This commit is contained in:
@@ -12,6 +12,7 @@ import { getNodeInfoById, isSystemVar, toNodeOutputVars } from '@/app/components
|
|||||||
import type { CommonNodeType, InputVar, ValueSelector, Var, Variable } from '@/app/components/workflow/types'
|
import type { CommonNodeType, InputVar, ValueSelector, Var, Variable } from '@/app/components/workflow/types'
|
||||||
import { BlockEnum, InputVarType, NodeRunningStatus, VarType } from '@/app/components/workflow/types'
|
import { BlockEnum, InputVarType, NodeRunningStatus, VarType } from '@/app/components/workflow/types'
|
||||||
import { useStore as useAppStore } from '@/app/components/app/store'
|
import { useStore as useAppStore } from '@/app/components/app/store'
|
||||||
|
import { useWorkflowStore } from '@/app/components/workflow/store'
|
||||||
import { getIterationSingleNodeRunUrl, singleNodeRun } from '@/service/workflow'
|
import { getIterationSingleNodeRunUrl, singleNodeRun } from '@/service/workflow'
|
||||||
import Toast from '@/app/components/base/toast'
|
import Toast from '@/app/components/base/toast'
|
||||||
import LLMDefault from '@/app/components/workflow/nodes/llm/default'
|
import LLMDefault from '@/app/components/workflow/nodes/llm/default'
|
||||||
@@ -164,6 +165,12 @@ const useOneStepRun = <T>({
|
|||||||
}
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [data._isSingleRun])
|
}, [data._isSingleRun])
|
||||||
|
|
||||||
|
const workflowStore = useWorkflowStore()
|
||||||
|
useEffect(() => {
|
||||||
|
workflowStore.getState().setShowSingleRunPanel(!!isShowSingleRun)
|
||||||
|
}, [isShowSingleRun])
|
||||||
|
|
||||||
const hideSingleRun = () => {
|
const hideSingleRun = () => {
|
||||||
handleNodeDataUpdate({
|
handleNodeDataUpdate({
|
||||||
id,
|
id,
|
||||||
|
@@ -36,6 +36,7 @@ import { canRunBySingle } from '@/app/components/workflow/utils'
|
|||||||
import TooltipPlus from '@/app/components/base/tooltip-plus'
|
import TooltipPlus from '@/app/components/base/tooltip-plus'
|
||||||
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'
|
||||||
|
|
||||||
type BasePanelProps = {
|
type BasePanelProps = {
|
||||||
children: ReactElement
|
children: ReactElement
|
||||||
@@ -50,6 +51,7 @@ const BasePanel: FC<BasePanelProps> = ({
|
|||||||
const { showMessageLogModal } = useAppStore(useShallow(state => ({
|
const { showMessageLogModal } = useAppStore(useShallow(state => ({
|
||||||
showMessageLogModal: state.showMessageLogModal,
|
showMessageLogModal: state.showMessageLogModal,
|
||||||
})))
|
})))
|
||||||
|
const showSingleRunPanel = useStore(s => s.showSingleRunPanel)
|
||||||
const panelWidth = localStorage.getItem('workflow-node-panel-width') ? parseFloat(localStorage.getItem('workflow-node-panel-width')!) : 420
|
const panelWidth = localStorage.getItem('workflow-node-panel-width') ? parseFloat(localStorage.getItem('workflow-node-panel-width')!) : 420
|
||||||
const {
|
const {
|
||||||
setPanelWidth,
|
setPanelWidth,
|
||||||
@@ -99,7 +101,7 @@ const BasePanel: FC<BasePanelProps> = ({
|
|||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
ref={containerRef}
|
ref={containerRef}
|
||||||
className='relative h-full bg-white shadow-lg border-[0.5px] border-gray-200 rounded-2xl overflow-y-auto'
|
className={cn('relative h-full bg-white shadow-lg border-[0.5px] border-gray-200 rounded-2xl', showSingleRunPanel ? 'overflow-hidden' : 'overflow-y-auto')}
|
||||||
style={{
|
style={{
|
||||||
width: `${panelWidth}px`,
|
width: `${panelWidth}px`,
|
||||||
}}
|
}}
|
||||||
|
@@ -28,6 +28,8 @@ type PreviewRunningData = WorkflowRunningData & {
|
|||||||
type Shape = {
|
type Shape = {
|
||||||
appId: string
|
appId: string
|
||||||
panelWidth: number
|
panelWidth: number
|
||||||
|
showSingleRunPanel: boolean
|
||||||
|
setShowSingleRunPanel: (showSingleRunPanel: boolean) => void
|
||||||
workflowRunningData?: PreviewRunningData
|
workflowRunningData?: PreviewRunningData
|
||||||
setWorkflowRunningData: (workflowData: PreviewRunningData) => void
|
setWorkflowRunningData: (workflowData: PreviewRunningData) => void
|
||||||
historyWorkflowData?: HistoryWorkflowData
|
historyWorkflowData?: HistoryWorkflowData
|
||||||
@@ -137,6 +139,8 @@ export const createWorkflowStore = () => {
|
|||||||
return createStore<Shape>(set => ({
|
return createStore<Shape>(set => ({
|
||||||
appId: '',
|
appId: '',
|
||||||
panelWidth: localStorage.getItem('workflow-node-panel-width') ? parseFloat(localStorage.getItem('workflow-node-panel-width')!) : 420,
|
panelWidth: localStorage.getItem('workflow-node-panel-width') ? parseFloat(localStorage.getItem('workflow-node-panel-width')!) : 420,
|
||||||
|
showSingleRunPanel: false,
|
||||||
|
setShowSingleRunPanel: showSingleRunPanel => set(() => ({ showSingleRunPanel })),
|
||||||
workflowRunningData: undefined,
|
workflowRunningData: undefined,
|
||||||
setWorkflowRunningData: workflowRunningData => set(() => ({ workflowRunningData })),
|
setWorkflowRunningData: workflowRunningData => set(() => ({ workflowRunningData })),
|
||||||
historyWorkflowData: undefined,
|
historyWorkflowData: undefined,
|
||||||
|
Reference in New Issue
Block a user