diff options
author | Petr Vobornik <pvoborni@redhat.com> | 2014-07-04 13:33:10 +0200 |
---|---|---|
committer | Petr Vobornik <pvoborni@redhat.com> | 2014-07-21 10:47:06 +0200 |
commit | 740d42257fc00235b1cebdc90866fe34bf9464b3 (patch) | |
tree | b2d83bb0a50a8939396e21073bae4b24cf148a05 | |
parent | b68f819de75073285c17c28a30afe5b5dbfe5176 (diff) | |
download | freeipa-740d42257fc00235b1cebdc90866fe34bf9464b3.tar.gz freeipa-740d42257fc00235b1cebdc90866fe34bf9464b3.tar.xz freeipa-740d42257fc00235b1cebdc90866fe34bf9464b3.zip |
webui: add filter to attributes widget
Adds filter field to attribute box in permissions for better user
experience. User can then quickly find the desired attribute.
Initial version of the patch authored by: Adam Misnyovszki
https://fedorahosted.org/freeipa/ticket/4253
Reviewed-By: Endi Sukma Dewata <edewata@redhat.com>
-rw-r--r-- | install/ui/src/freeipa/aci.js | 53 | ||||
-rw-r--r-- | install/ui/test/data/ipa_init.json | 1 | ||||
-rw-r--r-- | ipalib/plugins/internal.py | 1 |
3 files changed, 55 insertions, 0 deletions
diff --git a/install/ui/src/freeipa/aci.js b/install/ui/src/freeipa/aci.js index ce7d42787..929ec92a4 100644 --- a/install/ui/src/freeipa/aci.js +++ b/install/ui/src/freeipa/aci.js @@ -553,6 +553,59 @@ aci.attributes_widget = function(spec) { var id = spec.name; + that.create = function(container) { + that.container = container; + + that.widget_create(container); + that.create_search_filter(container); + that.owb_create(container); + + if (that.undo) { + that.create_undo(container); + } + + that.create_error_link(container); + }; + + that.create_search_filter = function(container) { + var filter_container = $('<div/>', { + 'class': 'search-filter' + }); + + that.filter = $('<input/>', { + type: 'text', + name: 'filter', + 'class': 'form-control', + placeholder: text.get('@i18n:objects.permission.filter') + }).appendTo(filter_container); + + that.filter.keyup(function(e) { + that.filter_options(); + }); + + var find_button = IPA.action_button({ + name: 'find', + icon: 'fa-search', + click: function() { + that.filter_options(); + return false; + } + }).appendTo(filter_container); + + filter_container.appendTo(container); + }; + + that.filter_options = function() { + $("li", that.$node).each(function() { + var item = $(this); + if(item.find('input').val().indexOf(that.filter.val()) === -1) { + item.css('display','none'); + } else { + item.css('display','inline'); + } + }); + }; + that.update = function(values) { that.values = []; diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json index b3d385900..a6a3acd4c 100644 --- a/install/ui/test/data/ipa_init.json +++ b/install/ui/test/data/ipa_init.json @@ -374,6 +374,7 @@ "enable": "Enable token" }, "permission": { + "filter": "Filter", "identity": "Permission settings", "managed": "Attribute breakdown", "target": "Target" diff --git a/ipalib/plugins/internal.py b/ipalib/plugins/internal.py index 53f117f3f..6d925c5c2 100644 --- a/ipalib/plugins/internal.py +++ b/ipalib/plugins/internal.py @@ -518,6 +518,7 @@ class i18n_messages(Command): "enable": "Enable token", }, "permission": { + "filter": _("Filter"), "identity": _("Permission settings"), "managed": _("Attribute breakdown"), "target": _("Target"), |