summaryrefslogtreecommitdiffstats
path: root/install/static/associate.js
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2010-11-19 11:38:35 -0600
committerAdam Young <ayoung@redhat.com>2010-11-22 15:28:42 -0500
commit27d8529a840bb1f54e520ccd70bf7c2113d03069 (patch)
tree7f798d63d259f2b85039212917123999ad8555c3 /install/static/associate.js
parent861a0fdba9c07d612d6a220b6ec5cf5eb3c24e46 (diff)
downloadfreeipa-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/associate.js')
-rw-r--r--install/static/associate.js26
1 files changed, 10 insertions, 16 deletions
diff --git a/install/static/associate.js b/install/static/associate.js
index f0239a44e..01f7551a2 100644
--- a/install/static/associate.js
+++ b/install/static/associate.js
@@ -241,6 +241,7 @@ function ipa_association_widget(spec) {
var that = ipa_table_widget(spec);
+ that.facet = spec.facet;
that.other_entity = spec.other_entity;
that.superior_create = that.superior('create');
@@ -257,11 +258,10 @@ function ipa_association_widget(spec) {
that.superior_create(container);
- 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/>').appendTo(ul);
+ var li = $('<li/>').prependTo(ul);
// creating generic buttons for layout
$('<input/>', {
@@ -282,7 +282,8 @@ function ipa_association_widget(spec) {
that.table_setup(container);
// replacing generic buttons with ipa_button and setting click handler
- var action_panel = $('.action-panel');
+ var action_panel = that.facet.get_action_panel();
+
var button = $('input[name=remove]', action_panel);
button.replaceWith(ipa_button({
'label': button.val(),
@@ -428,19 +429,10 @@ function ipa_association_facet(spec) {
that.create = function(container) {
that.pkey = $.bbq.getState(that.entity_name + '-pkey', true) || '';
- that.other_entity =
- $.bbq.getState(that.entity_name + '-enroll', true) || '';
+ that.other_entity = $.bbq.getState(that.entity_name + '-enroll', true) || '';
var label = IPA.metadata[that.other_entity] ? IPA.metadata[that.other_entity].label : that.other_entity;
- that.table = ipa_association_widget({
- 'id': that.entity_name+'-'+that.other_entity,
- 'name': 'association',
- 'label': label,
- 'entity_name': that.entity_name,
- 'other_entity': that.other_entity
- });
-
//TODO I18N
var header_message = that.other_entity + '(s) enrolled in ' +
that.entity_name + ' ' + that.pkey;
@@ -449,12 +441,14 @@ function ipa_association_facet(spec) {
'id': that.entity_name+'-'+that.other_entity,
html: $('<h2/>',{ html: header_message })
}).appendTo(container);
+
that.table = ipa_association_widget({
'id': that.entity_name+'-'+that.other_entity,
'name': that.other_entity,
- 'label': IPA.metadata[that.other_entity].label,
+ 'label': label,
'entity_name': that.entity_name,
- 'other_entity': that.other_entity
+ 'other_entity': that.other_entity,
+ 'facet': that
});
var span = $('<span/>', { 'name': 'association' }).appendTo(container);