mirror of https://github.com/apache/cloudstack.git
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
},
...
}
This commit is contained in:
parent
318e497e60
commit
bc4be5272b
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue