22 lines
931 B
TypeScript
22 lines
931 B
TypeScript
import { computed } from 'vue'
|
|
import { useProjectContext } from '../projects/context'
|
|
import { getOperation } from './operations'
|
|
import { workflowCheckpoints } from './selectors'
|
|
|
|
/** 资产编辑要求剧本正式完成,并沿用项目级互斥,拆解运行期间不修改其下游资产。 */
|
|
export function useProjectMutationGuard() {
|
|
const context = useProjectContext()
|
|
const projectId = computed(() => context.project.value?.id ?? '')
|
|
const operation = computed(() => getOperation(projectId.value))
|
|
const blocked = computed(
|
|
() =>
|
|
!projectId.value ||
|
|
!!context.error.value ||
|
|
operation.value.pending ||
|
|
context.project.value?.status !== 'completed' ||
|
|
workflowCheckpoints(context.checkpoints.value, 'breakdown').at(-1)?.state.workflowExecution?.status ===
|
|
'running'
|
|
)
|
|
return { projectId, operation, blocked }
|
|
}
|