trigger state binding

This commit is contained in:
jZonG 2025-04-28 13:31:21 +08:00
parent cc85e53ffc
commit f126f98514
3 changed files with 14 additions and 6 deletions

View File

@ -26,7 +26,7 @@ const Left = ({ handleMenuClick }: Props) => {
// const bottomPanelWidth = useStore(s => s.bottomPanelWidth) // const bottomPanelWidth = useStore(s => s.bottomPanelWidth)
// const setShowVariableInspectPanel = useStore(s => s.setShowVariableInspectPanel) // const setShowVariableInspectPanel = useStore(s => s.setShowVariableInspectPanel)
const { const {
clearCurrentVars, deleteAllInspectorVars,
} = useCurrentVars() } = useCurrentVars()
// TODO node selection // TODO node selection
@ -37,7 +37,7 @@ const Left = ({ handleMenuClick }: Props) => {
{/* header */} {/* header */}
<div className='flex shrink-0 items-center justify-between gap-1 pl-4 pr-1 pt-2'> <div className='flex shrink-0 items-center justify-between gap-1 pl-4 pr-1 pt-2'>
<div className='system-sm-semibold-uppercase truncate text-text-primary'>{t('workflow.debug.variableInspect.title')}</div> <div className='system-sm-semibold-uppercase truncate text-text-primary'>{t('workflow.debug.variableInspect.title')}</div>
<Button variant='ghost' size='small' className='shrink-0' onClick={clearCurrentVars}>{t('workflow.debug.variableInspect.clearAll')}</Button> <Button variant='ghost' size='small' className='shrink-0' onClick={deleteAllInspectorVars}>{t('workflow.debug.variableInspect.clearAll')}</Button>
</div> </div>
{/* content */} {/* content */}
<div className='grow overflow-y-auto py-1'> <div className='grow overflow-y-auto py-1'>

View File

@ -21,13 +21,21 @@ const VariableInspectTrigger: FC = () => {
return false return false
if (workflowRunningData.result.status === WorkflowRunningStatus.Running) if (workflowRunningData.result.status === WorkflowRunningStatus.Running)
return true return true
// TODO: step running state use data in inspector
return (workflowRunningData.tracing || []).some(tracingData => tracingData.status === NodeRunningStatus.Running) return (workflowRunningData.tracing || []).some(tracingData => tracingData.status === NodeRunningStatus.Running)
}, [workflowRunningData]) }, [workflowRunningData])
const environmentVariables = useStore(s => s.environmentVariables)
const { const {
nodesWithInspectVars: currentVars, conversationVars,
clearCurrentVars, systemVars,
nodesWithInspectVars,
deleteAllInspectorVars,
} = useCurrentVars() } = useCurrentVars()
const currentVars = useMemo(() => {
const allVars = [...environmentVariables, ...conversationVars, ...systemVars, ...nodesWithInspectVars]
return allVars
}, [conversationVars, systemVars, nodesWithInspectVars])
// ##TODD stop handle // ##TODD stop handle
@ -54,7 +62,7 @@ const VariableInspectTrigger: FC = () => {
</div> </div>
<div <div
className='system-xs-medium flex h-6 cursor-pointer items-center rounded-md border-[0.5px] border-effects-highlight bg-components-actionbar-bg px-1 text-text-tertiary shadow-lg backdrop-blur-sm hover:bg-components-actionbar-bg-accent hover:text-text-accent' className='system-xs-medium flex h-6 cursor-pointer items-center rounded-md border-[0.5px] border-effects-highlight bg-components-actionbar-bg px-1 text-text-tertiary shadow-lg backdrop-blur-sm hover:bg-components-actionbar-bg-accent hover:text-text-accent'
onClick={clearCurrentVars} onClick={deleteAllInspectorVars}
> >
{t('workflow.debug.variableInspect.trigger.clear')} {t('workflow.debug.variableInspect.trigger.clear')}
</div> </div>

View File

@ -198,7 +198,7 @@ const ValueContent = () => {
...FILE_EXTS[SupportUploadFileTypes.video], ...FILE_EXTS[SupportUploadFileTypes.video],
], ],
allowed_file_upload_methods: [TransferMethod.local_file, TransferMethod.remote_url], allowed_file_upload_methods: [TransferMethod.local_file, TransferMethod.remote_url],
number_limits: current.var_type === 'file' ? 1 : (fileFeature as any).fileUploadConfig.workflow_file_upload_limit, number_limits: current.var_type === 'file' ? 1 : (fileFeature as any).fileUploadConfig?.workflow_file_upload_limit || 5,
fileUploadConfig: (fileFeature as any).fileUploadConfig, fileUploadConfig: (fileFeature as any).fileUploadConfig,
}} }}
/> />