Give meaningful names to elements of Arrays

Also make some changes to Mistral schema.

Change-Id: Id9efcd9b7d12697c68226fa104545cf737d62679
This commit is contained in:
Timur Sufiev 2014-10-01 17:47:25 +04:00
parent 0b57e9f29f
commit 27cc3b4525
2 changed files with 26 additions and 10 deletions

View File

@ -106,7 +106,7 @@ $(function() {
var length = item.length(), var length = item.length(),
subItem = item.get(length-1), subItem = item.get(length-1),
nameEntity = extractNameSubItem(subItem), nameEntity = extractNameSubItem(subItem),
label = 'Element #'+length, label = extractBaseName(subItem, 'Element') + '#' + length,
$childLabel = createNewLabel(label).append($removeAction); $childLabel = createNewLabel(label).append($removeAction);
if ( nameEntity ) { if ( nameEntity ) {
@ -156,6 +156,11 @@ $(function() {
return item.instanceof(Barricade.Container) && item.get('name'); return item.instanceof(Barricade.Container) && item.get('name');
} }
function extractBaseName(item, defaultBaseName) {
defaultBaseName = defaultBaseName || 'Element';
return item.name || defaultBaseName;
}
function drawFluidContainerNode($label, item) { function drawFluidContainerNode($label, item) {
var $item = $('<div class="inner-node"></div>'), var $item = $('<div class="inner-node"></div>'),
labelId = $label.attr('id'), labelId = $label.attr('id'),

View File

@ -105,9 +105,14 @@
'name': {'@type': String}, 'name': {'@type': String},
'parameters': { 'parameters': {
'@type': Object, '@type': Array,
'@required': false, '*': {
'?': {'@type': String} '@class': Barricade.Primitive.extend({
'name': 'Parameter'
}, {
'@type': String
})
}
}, },
'publish': { 'publish': {
'@type': String, '@type': String,
@ -235,9 +240,15 @@
'@default': 'direct' '@default': 'direct'
}, },
'parameters': { 'parameters': {
'@type': Object, '@type': Array,
'@required': false, '@required': false,
'?': {'@type': String} '*': {
'@class': Barricade.Primitive.extend({
'name': 'Primitive'
}, {
'@type': String
})
}
}, },
'output': { 'output': {
'@type': String, '@type': String,
@ -260,15 +271,15 @@
'@required': false '@required': false
}, },
'actions': { 'actions': {
'@type': Array, '@type': Object,
'@required': false, '@required': false,
'*': { '?': {
'@class': types.Mistral.Action '@class': types.Mistral.Action
} }
}, },
'workflows': { 'workflows': {
'@type': Array, '@type': Object,
'*': { '?': {
'@class': types.Mistral.Workflow '@class': types.Mistral.Workflow
} }
} }