77 FileX ,
88 Folder as FolderIcon ,
99 Library ,
10- RefreshCw ,
1110 Square ,
1211 SquareArrowUpRight ,
1312 Workflow as WorkflowIcon ,
@@ -363,16 +362,8 @@ export function EmbeddedWorkflowActions({ workspaceId, workflowId }: EmbeddedWor
363362 const { data : session } = useSession ( )
364363 const hostContext = useWorkspaceHostContext ( )
365364 const { userPermissions : effectivePermissions } = useWorkspacePermissionsContext ( )
366- const {
367- data : workflowMap ,
368- isLoading : isWorkflowMapLoading ,
369- refetch : refetchWorkflowMap ,
370- } = useWorkflowMap ( workspaceId )
371- const {
372- data : folderMap ,
373- isLoading : isFolderMapLoading ,
374- refetch : refetchFolderMap ,
375- } = useFolderMap ( workspaceId )
365+ const { data : workflowMap = { } } = useWorkflowMap ( workspaceId )
366+ const { data : folderMap = { } } = useFolderMap ( workspaceId )
376367 const setActiveWorkflow = useWorkflowRegistry ( ( state ) => state . setActiveWorkflow )
377368 const { handleRunWorkflow, handleCancelExecution } = useWorkflowExecution ( )
378369 const isExecuting = useExecutionStore (
@@ -392,14 +383,7 @@ export function EmbeddedWorkflowActions({ workspaceId, workflowId }: EmbeddedWor
392383 const isRunButtonDisabled =
393384 ! isExecuting &&
394385 ( isUsageGateLoading || ( ! effectivePermissions . canRead && ! effectivePermissions . isLoading ) )
395- const isWorkflowLockDataLoading = isWorkflowMapLoading || isFolderMapLoading
396- const isWorkflowLockDataUnavailable = ! workflowMap || ! folderMap
397- const isWorkflowLocked = isWorkflowEffectivelyLocked ( workflowMap ?. [ workflowId ] , folderMap ?? { } )
398-
399- const handleRetryWorkflowLockData = ( ) => {
400- if ( ! workflowMap ) void refetchWorkflowMap ( )
401- if ( ! folderMap ) void refetchFolderMap ( )
402- }
386+ const isWorkflowLocked = isWorkflowEffectivelyLocked ( workflowMap [ workflowId ] , folderMap )
403387
404388 const handleRun = async ( ) => {
405389 setActiveWorkflow ( workflowId )
@@ -471,34 +455,13 @@ export function EmbeddedWorkflowActions({ workspaceId, workflowId }: EmbeddedWor
471455 < p > { isExecuting ? 'Stop' : 'Run workflow' } </ p >
472456 </ Tooltip . Content >
473457 </ Tooltip . Root >
474- { isWorkflowLockDataUnavailable && ! isWorkflowLockDataLoading ? (
475- < Tooltip . Root >
476- < Tooltip . Trigger asChild >
477- < Button
478- variant = 'subtle'
479- onClick = { handleRetryWorkflowLockData }
480- className = { RESOURCE_TAB_ICON_BUTTON_CLASS }
481- aria-label = 'Retry loading workflow lock status'
482- >
483- < RefreshCw className = { RESOURCE_TAB_ICON_CLASS } />
484- </ Button >
485- </ Tooltip . Trigger >
486- < Tooltip . Content side = 'bottom' >
487- < p > Retry loading workflow lock status</ p >
488- </ Tooltip . Content >
489- </ Tooltip . Root >
490- ) : (
491- < Deploy
492- activeWorkflowId = { workflowId }
493- userPermissions = { effectivePermissions }
494- className = { RESOURCE_TAB_ICON_BUTTON_CLASS }
495- compact
496- disabled = { isWorkflowLockDataLoading || isWorkflowLocked }
497- disabledTooltip = {
498- isWorkflowLockDataLoading ? 'Loading workflow lock status...' : undefined
499- }
500- />
501- ) }
458+ < Deploy
459+ activeWorkflowId = { workflowId }
460+ userPermissions = { effectivePermissions }
461+ className = { RESOURCE_TAB_ICON_BUTTON_CLASS }
462+ compact
463+ disabled = { isWorkflowLocked }
464+ />
502465 </ >
503466 )
504467}
0 commit comments