List view UI: fix blank actions column Fixes issue where blank actions column will show if there are header actions, but no standard actions
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e86f8115 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e86f8115 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e86f8115 Branch: refs/heads/scaleupvm Commit: e86f81152f6be723a1d8d7b486264c8ced8bc1ac Parents: ff6177d Author: Brian Federle <[email protected]> Authored: Fri Mar 22 10:28:09 2013 -0700 Committer: Brian Federle <[email protected]> Committed: Fri Mar 22 10:28:09 2013 -0700 ---------------------------------------------------------------------- ui/scripts/ui/widgets/listView.js | 32 ++++++++++++++++++++++++++++++-- 1 files changed, 30 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e86f8115/ui/scripts/ui/widgets/listView.js ---------------------------------------------------------------------- diff --git a/ui/scripts/ui/widgets/listView.js b/ui/scripts/ui/widgets/listView.js index 76ce526..bb3a424 100644 --- a/ui/scripts/ui/widgets/listView.js +++ b/ui/scripts/ui/widgets/listView.js @@ -648,7 +648,21 @@ } // Actions column - if (actions && renderActionCol(actions)) { + var actionsArray = $.map(actions, function(v, k) { + if (k == 'add') { + v.isAdd = true; + } + + return v; + }); + var headerActionsArray = $.grep( + actionsArray, + function(action) { + return action.isHeader || action.isAdd; + } + ); + + if (actions && renderActionCol(actions) && actionsArray.length != headerActionsArray.length) { $thead.find('tr').append( $('<th></th>') .html(_l('label.actions')) @@ -1014,7 +1028,21 @@ $tr.data('jsonObj', dataItem); $tr.data('list-view-action-filter', options.actionFilter); - if (actions && renderActionCol(actions)) { + var actionsArray = $.map(actions, function(v, k) { + if (k == 'add') { + v.isAdd = true; + } + + return v; + }); + var headerActionsArray = $.grep( + actionsArray, + function(action) { + return action.isHeader || action.isAdd; + } + ); + + if (actions && renderActionCol(actions) && actionsArray.length != headerActionsArray.length) { var allowedActions = $.map(actions, function(value, key) { return key; });
