You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bf...@apache.org on 2014/06/18 23:02:57 UTC

git commit: updated refs/heads/master to bc4be52

Repository: cloudstack
Updated Branches:
  refs/heads/master 318e497e6 -> bc4be5272


Detail view: support per-action filtering

Adds support for adding preFilter on a per-action basis, to assist in
plugin development. If action.preFilter function is passed, and returns
true/false, the action is shown/hidden. If no preFilter is specified,
then the action will be passed through the detail view's standard filter.

Example:

testAction: {
    label: 'Test Action',
    ...
    preFilter: function(args) {
        return false; // Action will be hidden
    },
    ...
}


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/bc4be527
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/bc4be527
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/bc4be527

Branch: refs/heads/master
Commit: bc4be5272b123fd2d38262c3430b8ac06ca0b05d
Parents: 318e497
Author: Brian Federle <br...@citrix.com>
Authored: Wed Jun 18 14:02:16 2014 -0700
Committer: Brian Federle <br...@citrix.com>
Committed: Wed Jun 18 14:02:16 2014 -0700

----------------------------------------------------------------------
 ui/scripts/ui/widgets/detailView.js | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bc4be527/ui/scripts/ui/widgets/detailView.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui/widgets/detailView.js b/ui/scripts/ui/widgets/detailView.js
index 6ff36c4..8824adc 100644
--- a/ui/scripts/ui/widgets/detailView.js
+++ b/ui/scripts/ui/widgets/detailView.js
@@ -835,9 +835,11 @@
                 });
 
             $.each(actions, function(key, value) {
-                if ($.inArray(key, allowedActions) == -1 ||
+                if ((!value.preFilter && $.inArray(key, allowedActions) == -1) ||
+                    (value.preFilter && !value.preFilter({ context: options.context })) ||
                     (options.ignoreAddAction && key == 'add') ||
                     (key == 'edit' && options.compact)) {
+
                     return true;
                 }