From e2428306cd39f91bcc0b0e85dffa5b1336cbe2f3 Mon Sep 17 00:00:00 2001 From: Timur Sufiev Date: Mon, 6 Oct 2014 16:54:35 +0400 Subject: [PATCH] Minor change to Mistral schema Name members of Task->requires sequence as 'Task#' instead of 'Element#'. Change-Id: I2e35369fb9341babb8d8507a17812518df3e7d35 --- js/schema.js | 46 +++++++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/js/schema.js b/js/schema.js index 197f6c3..3460d0f 100644 --- a/js/schema.js +++ b/js/schema.js @@ -159,30 +159,34 @@ 'requires': { '@type': Array, '*': { - '@type': String, - '@enum': function() { - var container = this._container, - workflow, task; - while ( container ) { - if ( container.instanceof(types.Mistral.Task) ) { - task = container; + '@class': Barricade.Primitive.extend({ + 'name': 'Action' + }, { + '@type': String, + '@enum': function() { + var container = this._container, + workflow, task; + while ( container ) { + if ( container.instanceof(types.Mistral.Task) ) { + task = container; + } + if ( container.instanceof(types.Mistral.Workflow) ) { + workflow = container; + break; + } + container = container._container; } - if ( container.instanceof(types.Mistral.Workflow) ) { - workflow = container; - break; + if ( workflow && task ) { + return workflow.get('tasks').toArray().filter(function(taskItem) { + return !(taskItem === task) && taskItem.get('name').get(); + }).map(function(taskItem) { + return taskItem.get('name').get(); + }); + } else { + return []; } - container = container._container; } - if ( workflow && task ) { - return workflow.get('tasks').toArray().filter(function(taskItem) { - return !(taskItem === task) && taskItem.get('name').get(); - }).map(function(taskItem) { - return taskItem.get('name').get(); - }); - } else { - return []; - } - } + }) } } };