From df16d4aff73f95d3cdac4f0d3504e4c73e936789 Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" 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 | 68 ++++++++++++--------------------------- 2 files changed, 27 insertions(+), 50 deletions(-) diff --git a/install/ui/association.js b/install/ui/association.js index 3d75072ae..47d8db173 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= 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 b8d3afc7f..f594a6c27 100644 --- a/install/ui/dialog.js +++ b/install/ui/dialog.js @@ -314,10 +314,13 @@ IPA.adder_dialog = function(spec) { top_panel.append(' '); - $('', { - 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 = $('

').appendTo(buttons_panel); - $('', { - type: 'button', - name: 'add', - value: '>>' - }).appendTo(p); - - p = $('

').appendTo(buttons_panel); - $('', { - 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() { - that.remove(); - return false; - } - }); - button.replaceWith(that.remove_button); - - button = $('input[name=add]', that.container); that.add_button = IPA.button({ name: 'add', - 'label': button.val(), - 'click': function() { + label: '>>', + click: function() { that.add(); return false; } - }); - button.replaceWith(that.add_button); + }).appendTo(p); + + p = $('

').appendTo(buttons_panel); + that.remove_button = IPA.button({ + name: 'remove', + label: '<<', + click: function() { + that.remove(); + return false; + } + }).appendTo(p); + + 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();