The IPA.association_adder_dialog has been modified not to show search results that are already selected to prevent duplicates.
Ticket #1859 -- Endi S. Dewata
From 5eb76a60683d86d0e9baa682cb5be855b1b162fd Mon Sep 17 00:00:00 2001 From: Endi S. Dewata <edew...@redhat.com> Date: Mon, 26 Sep 2011 13:44:22 -0500 Subject: [PATCH] Fixed duplicate entries in enrollment dialog. The IPA.association_adder_dialog has been modified not to show search results that are already selected to prevent duplicates. Ticket #1859 --- install/ui/association.js | 9 ++++-- install/ui/dialog.js | 58 ++++++++++++-------------------------------- 2 files changed, 22 insertions(+), 45 deletions(-) diff --git a/install/ui/association.js b/install/ui/association.js index 3d75072ae3d14b0c3cfe46d020df6c9659c2a55d..47d8db1739a78fcc385efbb753cec72ad501a672 100644 --- a/install/ui/association.js +++ b/install/ui/association.js @@ -177,14 +177,17 @@ IPA.association_adder_dialog = function(spec) { var other_entity = IPA.get_entity(that.other_entity); var pkey_attr = other_entity.metadata.primary_key; + var selected = that.get_selected_values(); + var results = data.result; for (var i=0; i<results.count; i++) { var result = results.result[i]; var pkey = result[pkey_attr][0]; - if (that.exclude.indexOf(pkey) < 0) { - that.add_available_value(result); - } + if (that.exclude.indexOf(pkey) >= 0) continue; + if (selected.indexOf(pkey) >= 0) continue; + + that.add_available_value(result); } } diff --git a/install/ui/dialog.js b/install/ui/dialog.js index b8d3afc7f47a5682ed30f9ca641fc7cce1ada148..f594a6c27fdce960de8d5f5a478d65f9d16e76a5 100644 --- a/install/ui/dialog.js +++ b/install/ui/dialog.js @@ -314,10 +314,13 @@ IPA.adder_dialog = function(spec) { top_panel.append(' '); - $('<input/>', { - type: 'button', + that.find_button = IPA.button({ name: 'find', - value: IPA.messages.buttons.find + label: IPA.messages.buttons.find, + click: function() { + that.search(); + return false; + } }).appendTo(top_panel); top_panel.append(IPA.create_network_spinner()); @@ -370,54 +373,26 @@ IPA.adder_dialog = function(spec) { }).appendTo(container); var p = $('<p/>').appendTo(buttons_panel); - $('<input />', { - type: 'button', + that.add_button = IPA.button({ name: 'add', - value: '>>' + label: '>>', + click: function() { + that.add(); + return false; + } }).appendTo(p); p = $('<p/>').appendTo(buttons_panel); - $('<input />', { - type: 'button', - name: 'remove', - value: '<<' - }).appendTo(p); - - - that.filter_field = $('input[name=filter]', that.container); - - var button = $('input[name=find]', that.container); - that.find_button = IPA.button({ - name: 'find', - 'label': button.val(), - 'click': function() { - that.search(); - return false; - } - }); - button.replaceWith(that.find_button); - - button = $('input[name=remove]', that.container); that.remove_button = IPA.button({ name: 'remove', - 'label': button.val(), - 'click': function() { + label: '<<', + click: function() { that.remove(); return false; } - }); - button.replaceWith(that.remove_button); + }).appendTo(p); - button = $('input[name=add]', that.container); - that.add_button = IPA.button({ - name: 'add', - 'label': button.val(), - 'click': function() { - that.add(); - return false; - } - }); - button.replaceWith(that.add_button); + that.filter_field = $('input[name=filter]', that.container); if (that.external) { container.addClass('adder-dialog-with-external'); @@ -440,7 +415,6 @@ IPA.adder_dialog = function(spec) { type: 'text', name: 'external' }).appendTo(external_content); - } that.search(); -- 1.7.5.1
_______________________________________________ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel