mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-06 17:57:42 +02:00
Add parallel execution restriction feature to processes (#8477)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user