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

View File

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