Skip to content

Commit 7c9e88d

Browse files
aixgeekzxhlyh
andauthoredJun 25, 2024
Fix/single run panel show parent scrollbar (langgenius#5574)
Co-authored-by: StyleZhang <[email protected]>
1 parent 2a0f03a commit 7c9e88d

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed
 

‎web/app/components/workflow/nodes/_base/hooks/use-one-step-run.ts

+7
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { getNodeInfoById, isSystemVar, toNodeOutputVars } from '@/app/components
1212
import type { CommonNodeType, InputVar, ValueSelector, Var, Variable } from '@/app/components/workflow/types'
1313
import { BlockEnum, InputVarType, NodeRunningStatus, VarType } from '@/app/components/workflow/types'
1414
import { useStore as useAppStore } from '@/app/components/app/store'
15+
import { useWorkflowStore } from '@/app/components/workflow/store'
1516
import { getIterationSingleNodeRunUrl, singleNodeRun } from '@/service/workflow'
1617
import Toast from '@/app/components/base/toast'
1718
import LLMDefault from '@/app/components/workflow/nodes/llm/default'
@@ -164,6 +165,12 @@ const useOneStepRun = <T>({
164165
}
165166
// eslint-disable-next-line react-hooks/exhaustive-deps
166167
}, [data._isSingleRun])
168+
169+
const workflowStore = useWorkflowStore()
170+
useEffect(() => {
171+
workflowStore.getState().setShowSingleRunPanel(!!isShowSingleRun)
172+
}, [isShowSingleRun])
173+
167174
const hideSingleRun = () => {
168175
handleNodeDataUpdate({
169176
id,

‎web/app/components/workflow/nodes/_base/panel.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import { canRunBySingle } from '@/app/components/workflow/utils'
3636
import TooltipPlus from '@/app/components/base/tooltip-plus'
3737
import type { Node } from '@/app/components/workflow/types'
3838
import { useStore as useAppStore } from '@/app/components/app/store'
39+
import { useStore } from '@/app/components/workflow/store'
3940

4041
type BasePanelProps = {
4142
children: ReactElement
@@ -50,6 +51,7 @@ const BasePanel: FC<BasePanelProps> = ({
5051
const { showMessageLogModal } = useAppStore(useShallow(state => ({
5152
showMessageLogModal: state.showMessageLogModal,
5253
})))
54+
const showSingleRunPanel = useStore(s => s.showSingleRunPanel)
5355
const panelWidth = localStorage.getItem('workflow-node-panel-width') ? parseFloat(localStorage.getItem('workflow-node-panel-width')!) : 420
5456
const {
5557
setPanelWidth,
@@ -99,7 +101,7 @@ const BasePanel: FC<BasePanelProps> = ({
99101
</div>
100102
<div
101103
ref={containerRef}
102-
className='relative h-full bg-white shadow-lg border-[0.5px] border-gray-200 rounded-2xl overflow-y-auto'
104+
className={cn('relative h-full bg-white shadow-lg border-[0.5px] border-gray-200 rounded-2xl', showSingleRunPanel ? 'overflow-hidden' : 'overflow-y-auto')}
103105
style={{
104106
width: `${panelWidth}px`,
105107
}}

‎web/app/components/workflow/store.ts

+4
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ type PreviewRunningData = WorkflowRunningData & {
2828
type Shape = {
2929
appId: string
3030
panelWidth: number
31+
showSingleRunPanel: boolean
32+
setShowSingleRunPanel: (showSingleRunPanel: boolean) => void
3133
workflowRunningData?: PreviewRunningData
3234
setWorkflowRunningData: (workflowData: PreviewRunningData) => void
3335
historyWorkflowData?: HistoryWorkflowData
@@ -137,6 +139,8 @@ export const createWorkflowStore = () => {
137139
return createStore<Shape>(set => ({
138140
appId: '',
139141
panelWidth: localStorage.getItem('workflow-node-panel-width') ? parseFloat(localStorage.getItem('workflow-node-panel-width')!) : 420,
142+
showSingleRunPanel: false,
143+
setShowSingleRunPanel: showSingleRunPanel => set(() => ({ showSingleRunPanel })),
140144
workflowRunningData: undefined,
141145
setWorkflowRunningData: workflowRunningData => set(() => ({ workflowRunningData })),
142146
historyWorkflowData: undefined,

0 commit comments

Comments
 (0)
Please sign in to comment.