mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
webui: do not use dom for getting selected automount keys
Old implementation crawled DOM for gathering data from DOM. Such code is very error prone. Little visual change somewhere else can break it - as happened in main patch for #4217. prerequisite for: https://fedorahosted.org/freeipa/ticket/4217 Reviewed-By: Adam Misnyovszki <amisnyov@redhat.com>
This commit is contained in:
parent
fddb2212bc
commit
ffab72cc79
@ -337,16 +337,20 @@ IPA.automount.key_search_facet = function(spec) {
|
||||
that.get_selected_values = function() {
|
||||
|
||||
var values = [];
|
||||
var keys = that.table.get_selected_values();
|
||||
var records = that.table.records;
|
||||
|
||||
$('input[name="description"]:checked', that.table.tbody).each(function() {
|
||||
var value = {};
|
||||
$('div', $(this).parent().parent()).each(function() {
|
||||
var div = $(this);
|
||||
var name = div.attr('name');
|
||||
value[name] = div.text();
|
||||
});
|
||||
values.push(value);
|
||||
});
|
||||
if (keys.length === 0 || !records) return values;
|
||||
|
||||
for (var i=0,l=records.length; i<l; i++) {
|
||||
var record = records[i];
|
||||
if (keys.indexOf(record.description[0]) > -1) {
|
||||
values.push({
|
||||
automountkey: record.automountkey[0],
|
||||
automountinformation: record.automountinformation[0]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return values;
|
||||
};
|
||||
|
@ -1827,6 +1827,7 @@ exp.table_facet = IPA.table_facet = function(spec, no_init) {
|
||||
*/
|
||||
that.load_records = function(records) {
|
||||
that.table.empty();
|
||||
that.table.records = records;
|
||||
for (var i=0; i<records.length; i++) {
|
||||
that.add_record(records[i]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user