From 2c11dcda258cdbbc0949185f4c7ca5c2854c8352 Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Mon, 30 Apr 2012 15:47:24 +0200 Subject: Batch action for search page control buttons This patch implements a base action which can execute a batch of commands with single pkey as a parameter. https://fedorahosted.org/freeipa/ticket/2707 --- install/ui/search.js | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'install/ui') diff --git a/install/ui/search.js b/install/ui/search.js index 50a5fa0ec..1b6cfab2a 100644 --- a/install/ui/search.js +++ b/install/ui/search.js @@ -391,3 +391,45 @@ IPA.nested_search_facet = function(spec) { return that; }; + +/* + * Calls entity's disable command for each selected item in a batch. + * Usable in table facets. + */ +IPA.batch_items_action = function(spec) { + + spec = spec || {}; + + var that = IPA.action(spec); + + that.method = spec.method || 'disable'; + + that.execute = function(facet, on_success, on_error) { + + var entity = facet.managed_entity; + var pkeys = facet.get_selected_values(); + + var batch = IPA.batch_command({ + name: entity.name + '_batch_'+ that.method, + on_success: function() { + facet.refresh(); + } + }); + + for (var i=0; i