mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
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
This commit is contained in:
parent
8cf8870d3d
commit
a2a42c3be8
@ -177,14 +177,17 @@ IPA.association_adder_dialog = function(spec) {
|
|||||||
var other_entity = IPA.get_entity(that.other_entity);
|
var other_entity = IPA.get_entity(that.other_entity);
|
||||||
var pkey_attr = other_entity.metadata.primary_key;
|
var pkey_attr = other_entity.metadata.primary_key;
|
||||||
|
|
||||||
|
var selected = that.get_selected_values();
|
||||||
|
|
||||||
var results = data.result;
|
var results = data.result;
|
||||||
for (var i=0; i<results.count; i++) {
|
for (var i=0; i<results.count; i++) {
|
||||||
var result = results.result[i];
|
var result = results.result[i];
|
||||||
var pkey = result[pkey_attr][0];
|
var pkey = result[pkey_attr][0];
|
||||||
|
|
||||||
if (that.exclude.indexOf(pkey) < 0) {
|
if (that.exclude.indexOf(pkey) >= 0) continue;
|
||||||
that.add_available_value(result);
|
if (selected.indexOf(pkey) >= 0) continue;
|
||||||
}
|
|
||||||
|
that.add_available_value(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,10 +314,13 @@ IPA.adder_dialog = function(spec) {
|
|||||||
|
|
||||||
top_panel.append(' ');
|
top_panel.append(' ');
|
||||||
|
|
||||||
$('<input/>', {
|
that.find_button = IPA.button({
|
||||||
type: 'button',
|
|
||||||
name: 'find',
|
name: 'find',
|
||||||
value: IPA.messages.buttons.find
|
label: IPA.messages.buttons.find,
|
||||||
|
click: function() {
|
||||||
|
that.search();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}).appendTo(top_panel);
|
}).appendTo(top_panel);
|
||||||
|
|
||||||
top_panel.append(IPA.create_network_spinner());
|
top_panel.append(IPA.create_network_spinner());
|
||||||
@ -370,54 +373,26 @@ IPA.adder_dialog = function(spec) {
|
|||||||
}).appendTo(container);
|
}).appendTo(container);
|
||||||
|
|
||||||
var p = $('<p/>').appendTo(buttons_panel);
|
var p = $('<p/>').appendTo(buttons_panel);
|
||||||
$('<input />', {
|
|
||||||
type: 'button',
|
|
||||||
name: 'add',
|
|
||||||
value: '>>'
|
|
||||||
}).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() {
|
|
||||||
that.remove();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
button.replaceWith(that.remove_button);
|
|
||||||
|
|
||||||
button = $('input[name=add]', that.container);
|
|
||||||
that.add_button = IPA.button({
|
that.add_button = IPA.button({
|
||||||
name: 'add',
|
name: 'add',
|
||||||
'label': button.val(),
|
label: '>>',
|
||||||
'click': function() {
|
click: function() {
|
||||||
that.add();
|
that.add();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
}).appendTo(p);
|
||||||
button.replaceWith(that.add_button);
|
|
||||||
|
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) {
|
if (that.external) {
|
||||||
container.addClass('adder-dialog-with-external');
|
container.addClass('adder-dialog-with-external');
|
||||||
@ -440,7 +415,6 @@ IPA.adder_dialog = function(spec) {
|
|||||||
type: 'text',
|
type: 'text',
|
||||||
name: 'external'
|
name: 'external'
|
||||||
}).appendTo(external_content);
|
}).appendTo(external_content);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
that.search();
|
that.search();
|
||||||
|
Loading…
Reference in New Issue
Block a user