feat(workflow-header): add conditional logic to disable publish and refresh actions based on workflow node presence

This commit is contained in:
zhsama 2025-11-11 20:00:56 +08:00
parent 0a39e5c092
commit 36ad784251

View File

@ -56,6 +56,7 @@ const FeaturesTrigger = () => {
const lastPublishedHasUserInput = useStore(s => s.lastPublishedHasUserInput)
const nodes = useNodes<CommonNodeType>()
const hasWorkflowNodes = nodes.length > 0
const startNode = nodes.find(node => node.data.type === BlockEnum.Start)
const startVariables = (startNode as Node<StartNodeType>)?.data?.variables
const edges = useEdges<CommonEdgeType>()
@ -185,7 +186,7 @@ const FeaturesTrigger = () => {
{...{
publishedAt,
draftUpdatedAt,
disabled: nodesReadOnly,
disabled: nodesReadOnly || !hasWorkflowNodes,
toolPublished,
inputs: variables,
onRefreshData: handleToolConfigureUpdate,
@ -195,6 +196,7 @@ const FeaturesTrigger = () => {
crossAxisOffset: 4,
missingStartNode: !startNode,
hasTriggerNode,
publishDisabled: !hasWorkflowNodes,
}}
/>
</>