diff options
author | Endi S. Dewata <edewata@redhat.com> | 2010-11-19 11:38:35 -0600 |
---|---|---|
committer | Adam Young <ayoung@redhat.com> | 2010-11-22 15:28:42 -0500 |
commit | 27d8529a840bb1f54e520ccd70bf7c2113d03069 (patch) | |
tree | 7f798d63d259f2b85039212917123999ad8555c3 /install/static/search.js | |
parent | 861a0fdba9c07d612d6a220b6ec5cf5eb3c24e46 (diff) | |
download | freeipa-27d8529a840bb1f54e520ccd70bf7c2113d03069.tar.gz freeipa-27d8529a840bb1f54e520ccd70bf7c2113d03069.tar.xz freeipa-27d8529a840bb1f54e520ccd70bf7c2113d03069.zip |
Fixed action panel queries
Previously the queries for action panel were done globally. Since each
entity container has its own action panel, the queries will return multiple
results. This is fixed by qualifying the query to run within the entity
container.
The query has also been moved into ipa_facet.get_action_panel(). Entities
that do not have their own entity container (e.g. HBAC services and service
groups) will need to override this method to get the action panel from the
right entity container (e.g. HBAC rules).
The facet.setup_views() has been renamed to facet.create_action_panel().
New test data for SUDO rules have been added.
Diffstat (limited to 'install/static/search.js')
-rw-r--r-- | install/static/search.js | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/install/static/search.js b/install/static/search.js index 91c6641bb..03d4cac5a 100644 --- a/install/static/search.js +++ b/install/static/search.js @@ -28,7 +28,7 @@ function ipa_search_widget(spec) { var that = ipa_table_widget(spec); - that.superior_create = that.superior('create'); + that.facet = spec.facet; that.create = function(container) { @@ -52,8 +52,7 @@ function ipa_search_widget(spec) { 'value': 'Find' }).appendTo(search_filter); - var entity_container = $('#' + that.entity_name); - var action_panel = $('.action-panel', entity_container); + var action_panel = that.facet.get_action_panel(); var ul = $('ul', action_panel); var li = $('<li/>').prependTo(ul); @@ -78,7 +77,7 @@ function ipa_search_widget(spec) { 'class': 'search-results' }).appendTo(container); - that.superior_create(container); + that.table_create(container); }; that.setup = function(container) { @@ -95,8 +94,7 @@ function ipa_search_widget(spec) { }); button.replaceWith(that.find_button); - var entity_container = $('#' + that.entity_name); - var action_panel = $('.action-panel', entity_container); + var action_panel = that.facet.get_action_panel(); var search_buttons = $('.search-buttons', action_panel); button = $('input[name=remove]', search_buttons); @@ -143,19 +141,21 @@ function ipa_search_widget(spec) { count += 1; pkey = $(this).val(); }); + + var action_panel = that.facet.get_action_panel(); if(count == 1){ - $('.action-panel li.entity-facet'). + $('li.entity-facet', action_panel). removeClass('entity-facet-disabled'); var state = {}; - $('.action-panel input[id=pkey]').val(pkey); + $('input[id=pkey]', action_panel).val(pkey); }else{ - $('.action-panel li.entity-facet'). + $('li.entity-facet', action_panel). addClass('entity-facet-disabled'); - $('.action-panel input').val(null); + $('input', action_panel).val(null); } return false; - } + }; that.remove = function(container) { @@ -262,7 +262,7 @@ function ipa_search_facet(spec) { var that = ipa_facet(spec); that.init = spec.init || init; - that.create = spec.create || ipa_search_facet_create; + that.create = spec.create || create; that.setup = spec.setup || setup; that.refresh = spec.refresh || refresh; @@ -306,7 +306,8 @@ function ipa_search_facet(spec) { that.table = ipa_search_widget({ 'id': that.entity_name+'-search', 'name': 'search', 'label': IPA.metadata[that.entity_name].label, - 'entity_name': that.entity_name + 'entity_name': that.entity_name, + 'facet': that }); for (var i=0; i<that.columns.length; i++) { @@ -327,7 +328,7 @@ function ipa_search_facet(spec) { return filter != that.filter; }; - function ipa_search_facet_create(container) { + function create(container) { container.attr('title', that.entity_name); @@ -357,6 +358,7 @@ function ipa_search_facet(spec) { that.search_facet_init = that.init; that.search_facet_create = that.create; + that.search_facet_setup = that.setup; return that; } |