Add parallel execution restriction feature to processes (#8477)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov
2025-04-07 14:28:25 +07:00
committed by GitHub
parent b9c6d337d8
commit e2a2011ad8
18 changed files with 114 additions and 13 deletions
+15 -1
View File
@@ -528,10 +528,24 @@ export async function RunSubProcess (
control: TriggerControl
): Promise<ExecuteResult | undefined> {
if (params._id === undefined) return
const processId = params._id as Ref<Process>
const target = control.modelDb.findObject(processId)
if (target === undefined) return
if (target.parallelExecutionForbidden === true) {
const currentExecution = await control.findAll(control.ctx, process.class.Execution, {
process: target._id,
card: execution.card,
done: false
})
if (currentExecution.length > 0) {
// todo, show erro after merge another pr
return
}
}
const res: Tx[] = []
res.push(
control.txFactory.createTxCreateDoc(process.class.Execution, core.space.Workspace, {
process: params._id as Ref<Process>,
process: processId,
currentState: null,
currentToDo: null,
card: execution.card,