pref: workflow (#28591)

This commit is contained in:
Joel 2025-11-24 17:02:18 +08:00 committed by GitHub
parent bcbd3de336
commit 15ea27868e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 18 deletions

View File

@ -19,8 +19,6 @@ import {
} from '@/app/components/base/icons/src/vender/line/mediaAndDevices'
import Tooltip from '@/app/components/base/tooltip'
import { useWorkflowStore } from '@/app/components/workflow/store'
import { useWorkflowRunValidation } from '@/app/components/workflow/hooks/use-checklist'
import Toast from '@/app/components/base/toast'
type NodeControlProps = Pick<Node, 'id' | 'data'>
const NodeControl: FC<NodeControlProps> = ({
@ -32,8 +30,6 @@ const NodeControl: FC<NodeControlProps> = ({
const { handleNodeSelect } = useNodesInteractions()
const workflowStore = useWorkflowStore()
const isSingleRunning = data._singleRunningStatus === NodeRunningStatus.Running
const { warningNodes } = useWorkflowRunValidation()
const warningForNode = warningNodes.find(item => item.id === id)
const handleOpenChange = useCallback((newOpen: boolean) => {
setOpen(newOpen)
}, [])
@ -55,14 +51,9 @@ const NodeControl: FC<NodeControlProps> = ({
{
canRunBySingle(data.type, isChildNode) && (
<div
className={`flex h-5 w-5 items-center justify-center rounded-md ${isSingleRunning ? 'cursor-pointer hover:bg-state-base-hover' : warningForNode ? 'cursor-not-allowed text-text-disabled' : 'cursor-pointer hover:bg-state-base-hover'}`}
className={`flex h-5 w-5 items-center justify-center rounded-md ${isSingleRunning && 'cursor-pointer hover:bg-state-base-hover'}`}
onClick={() => {
const action = isSingleRunning ? 'stop' : 'run'
if (!isSingleRunning && warningForNode) {
const message = warningForNode.errorMessage || t('workflow.panel.checklistTip')
Toast.notify({ type: 'error', message })
return
}
const store = workflowStore.getState()
store.setInitShowLastRunTab(true)
@ -78,7 +69,7 @@ const NodeControl: FC<NodeControlProps> = ({
? <Stop className='h-3 w-3' />
: (
<Tooltip
popupContent={warningForNode ? warningForNode.errorMessage || t('workflow.panel.checklistTip') : t('workflow.panel.runThisStep')}
popupContent={t('workflow.panel.runThisStep')}
asChild={false}
>
<RiPlayLargeLine className='h-3 w-3' />

View File

@ -110,13 +110,8 @@ const BasePanel: FC<BasePanelProps> = ({
const nodePanelWidth = useStore(s => s.nodePanelWidth)
const otherPanelWidth = useStore(s => s.otherPanelWidth)
const setNodePanelWidth = useStore(s => s.setNodePanelWidth)
const {
pendingSingleRun,
setPendingSingleRun,
} = useStore(s => ({
pendingSingleRun: s.pendingSingleRun,
setPendingSingleRun: s.setPendingSingleRun,
}))
const pendingSingleRun = useStore(s => s.pendingSingleRun)
const setPendingSingleRun = useStore(s => s.setPendingSingleRun)
const reservedCanvasWidth = 400 // Reserve the minimum visible width for the canvas