track execution progress in vue nodes

This commit is contained in:
bymyself
2025-09-09 20:30:36 -07:00
parent 6b166a9d2f
commit 67c2aa4e0b
6 changed files with 142 additions and 6 deletions

View File

@@ -0,0 +1,35 @@
import { computed, provide } from 'vue'
import {
ExecutingNodeIdsKey,
NodeProgressStatesKey
} from '@/renderer/core/canvas/injectionKeys'
import { useExecutionStore } from '@/stores/executionStore'
/**
* Composable for providing execution state to Vue node children
*
* This composable sets up the execution state providers that can be injected
* by child Vue nodes using useNodeExecutionState.
*
* Should be used in the parent component that manages Vue nodes (e.g., GraphCanvas).
*/
export const useExecutionStateProvider = () => {
const executionStore = useExecutionStore()
// Convert execution store data to the format expected by Vue nodes
const executingNodeIds = computed(
() => new Set(executionStore.executingNodeIds.map(String))
)
const nodeProgressStates = computed(() => executionStore.nodeProgressStates)
// Provide the execution state to all child Vue nodes
provide(ExecutingNodeIdsKey, executingNodeIds)
provide(NodeProgressStatesKey, nodeProgressStates)
return {
executingNodeIds,
nodeProgressStates
}
}