From 379a9cc41f04d36538aee11839c1222d408b4f99 Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Thu, 18 Nov 2010 20:17:14 -0600 Subject: SUDO Rule Search and Details Pages The search and details pages for SUDO Rule have been added. Codes that are shared with HBAC have been moved to rule.js. The following methods were renamed for consistency: - ipa_details_load() -> ipa_details_refresh() - ipa_details_display() -> ipa_details_load() The ipa_details_cache has been removed because the cache is now stored in each widget. The index.xhtml has been removed. All references to it has been changed to index.html. The Unselect All checkbox has been fixed. Unnecessary parameter 'container' has been removed. The unit test has been updated and new test data has been added. --- install/static/search.js | 95 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 66 insertions(+), 29 deletions(-) (limited to 'install/static/search.js') diff --git a/install/static/search.js b/install/static/search.js index 8d0fc55c..91c6641b 100644 --- a/install/static/search.js +++ b/install/static/search.js @@ -37,7 +37,8 @@ function ipa_search_widget(spec) { }).appendTo(container); var search_filter = $('', { - 'class': 'search-filter' + 'class': 'search-filter', + 'name': 'search-filter' }).appendTo(search_controls); this.filter = $('', { @@ -45,28 +46,33 @@ function ipa_search_widget(spec) { 'name': 'search-' + that.entity_name + '-filter' }).appendTo(search_filter); - ipa_button({ - 'label': IPA.messages.button.find, - 'icon': 'ui-icon-search', - 'click': function() { that.find(container); } + $('', { + 'type': 'button', + 'name': 'find', + 'value': 'Find' }).appendTo(search_filter); - var li = $('
  • ', { - html: ipa_button({ - 'label': IPA.messages.button.remove, - 'icon': 'ui-icon-trash', - 'click': function() { that.remove(container); } - })}); - li.append( - ipa_button({ - 'label': IPA.messages.button.add, - 'icon': 'ui-icon-plus', - 'click': function() { that.add(container); } - }) - ); - li.prependTo($('.action-panel ul')); + var entity_container = $('#' + that.entity_name); + var action_panel = $('.action-panel', entity_container); + + var ul = $('ul', action_panel); + var li = $('
  • ').prependTo(ul); - search_controls.append(''); + var search_buttons = $('', { + 'class': 'search-buttons' + }).appendTo(li); + + $('', { + 'type': 'button', + 'name': 'remove', + 'value': 'Remove' + }).appendTo(search_buttons); + + $('', { + 'type': 'button', + 'name': 'add', + 'value': 'Add' + }).appendTo(search_buttons); $('
    ', { 'class': 'search-results' @@ -79,6 +85,36 @@ function ipa_search_widget(spec) { that.table_setup(container); + var search_filter = $('span[name=search-filter]', that.container); + + var button = $('input[name=find]', search_filter); + that.find_button = ipa_button({ + 'label': IPA.messages.button.find, + 'icon': 'ui-icon-search', + 'click': function() { that.find(that.container); } + }); + button.replaceWith(that.find_button); + + var entity_container = $('#' + that.entity_name); + var action_panel = $('.action-panel', entity_container); + var search_buttons = $('.search-buttons', action_panel); + + button = $('input[name=remove]', search_buttons); + that.remove_button = ipa_button({ + 'label': IPA.messages.button.remove, + 'icon': 'ui-icon-trash', + 'click': function() { that.remove(that.container); } + }); + button.replaceWith(that.remove_button); + + button = $('input[name=add]', search_buttons); + that.add_button = ipa_button({ + 'label': IPA.messages.button.add, + 'icon': 'ui-icon-plus', + 'click': function() { that.add(that.container); } + }); + button.replaceWith(that.add_button); + var filter = $.bbq.getState(that.entity_name + '-filter', true) || ''; this.filter.val(filter); }; @@ -143,11 +179,11 @@ function ipa_search_widget(spec) { var batch = ipa_batch_command({ 'on_success': function() { - that.refresh(that.container); + that.refresh(); dialog.close(); }, 'on_error': function() { - that.refresh(that.container); + that.refresh(); dialog.close(); } }); @@ -168,7 +204,7 @@ function ipa_search_widget(spec) { dialog.open(that.container); }; - that.refresh = function(container) { + that.refresh = function() { function on_success(data, text_status, xhr) { @@ -177,7 +213,7 @@ function ipa_search_widget(spec) { var result = data.result.result; for (var i = 0; i