UI: Better load balancer / multi-edit item naming

Currently, the items listed under the load balancer always use .name as
the field to display for the VM name.

Since 'instancename' is now used for the user-friendly name field,
_itemName metadata attribute can be specified in the rule's data
provider to tell which field should be rendered as the name field in the
list.
This commit is contained in:
Brian Federle 2012-03-21 09:51:36 -07:00
parent 5333ee1549
commit a1099e34c2
2 changed files with 5 additions and 7 deletions

View File

@ -2078,15 +2078,12 @@
});
$.extend(item, {
_itemData: $.map(lbInstances, function(instance) {
return $.extend(instance, {
name: instance.instancename
});
}),
_itemName: 'instancename',
_itemData: lbInstances,
_maxLength: {
name: 7
},
sticky: stickyData
sticky: stickyData,
});
});

View File

@ -514,8 +514,9 @@
itemRow: function(item, itemActions, multiRule, $tbody) {
var $tr = $('<tr>');
var itemName = multiRule._itemName ? item[multiRule._itemName] : item.name;
$tr.append($('<td></td>').appendTo($tr).html(_s(item.name)));
$tr.append($('<td></td>').appendTo($tr).html(_s(itemName)));
if (itemActions) {
var $itemActions = $('<td>').addClass('actions item-actions');