summaryrefslogtreecommitdiffstats
path: root/install/ui/src/freeipa/automount.js
diff options
context:
space:
mode:
authorPetr Vobornik <pvoborni@redhat.com>2014-03-13 17:34:42 +0100
committerPetr Vobornik <pvoborni@redhat.com>2014-03-20 08:57:43 +0100
commitffab72cc79d31c59d49d40b4f66852e767821fa6 (patch)
tree777504733025df82654edee091320f6982cf7086 /install/ui/src/freeipa/automount.js
parentfddb2212bc3394068ba0cd6aebbfcf2e77cb6def (diff)
downloadfreeipa-ffab72cc79d31c59d49d40b4f66852e767821fa6.tar.gz
freeipa-ffab72cc79d31c59d49d40b4f66852e767821fa6.tar.xz
freeipa-ffab72cc79d31c59d49d40b4f66852e767821fa6.zip
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>
Diffstat (limited to 'install/ui/src/freeipa/automount.js')
-rw-r--r--install/ui/src/freeipa/automount.js24
1 files changed, 14 insertions, 10 deletions
diff --git a/install/ui/src/freeipa/automount.js b/install/ui/src/freeipa/automount.js
index b010a52d4..ca0729beb 100644
--- a/install/ui/src/freeipa/automount.js
+++ b/install/ui/src/freeipa/automount.js
@@ -337,16 +337,20 @@ IPA.automount.key_search_facet = function(spec) {
that.get_selected_values = function() {
var values = [];
-
- $('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);
- });
+ var keys = that.table.get_selected_values();
+ var records = that.table.records;
+
+ 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;
};