diff options
Diffstat (limited to 'install')
-rw-r--r-- | install/ui/automount.js | 31 | ||||
-rw-r--r-- | install/ui/dns.js | 77 | ||||
-rw-r--r-- | install/ui/search.js | 8 |
3 files changed, 61 insertions, 55 deletions
diff --git a/install/ui/automount.js b/install/ui/automount.js index 3deb66129..13d7bfa2a 100644 --- a/install/ui/automount.js +++ b/install/ui/automount.js @@ -71,12 +71,12 @@ IPA.automount.map_entity = function(spec) { that.builder.containing_entity('automountlocation'). facet_groups([ 'automountkey', 'settings' ]). nested_search_facet({ + factory: IPA.automount.key_search_facet, facet_group: 'automountkey', nested_entity: 'automountkey', pagination: false, label: IPA.metadata.objects.automountkey.label, name: 'keys', - get_values: IPA.get_option_values, columns: [ { factory: IPA.automount_key_column, @@ -301,19 +301,28 @@ IPA.automountmap_adder_dialog = function(spec) { return that; }; -IPA.get_option_values = function(){ +IPA.automount.key_search_facet = function(spec) { - var values = []; - $('input[name="select"]:checked', this.table.tbody).each(function() { - var value = {}; - $('span',$(this).parent().parent()).each(function(){ - var name = this.attributes['name'].value; + var that = IPA.nested_search_facet(spec); - value[name] = $(this).text(); + 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); }); - values.push (value); - }); - return values; + + return values; + }; + + return that; }; IPA.register('automountlocation', IPA.automount.location_entity); diff --git a/install/ui/dns.js b/install/ui/dns.js index 9873c1395..6383d9227 100644 --- a/install/ui/dns.js +++ b/install/ui/dns.js @@ -98,7 +98,6 @@ IPA.dns.zone_entity = function(spec) { pagination: false, title: IPA.metadata.objects.dnszone.label_singular, label: IPA.metadata.objects.dnsrecord.label, - get_values: IPA.dnsrecord_get_delete_values, columns: [ { name: 'idnsname', @@ -485,6 +484,46 @@ IPA.dns.record_search_facet = function(spec) { } }; + that.get_selected_values = function() { + + var values = []; + + var records = {}; + var value; + var record_type; + + $('input[name="idnsname"]:checked', that.table.tbody).each(function() { + $('div', $(this).parent().parent()).each(function() { + var div = $(this); + var name = div.attr('name'); + var text = div.text(); + + if (name === 'idnsname') { + value = records[text]; + if (!value) { + value = { pkey: text }; + records[text] = value; + } + } else if (name === 'type') { + record_type = text.toLowerCase()+'record'; + + } else if (name === 'data') { + if (!value[record_type]) { + value[record_type] = text; + } else { + value[record_type] += ',' + text; + } + } + }); + }); + + for (var key in records) { + values.push(records[key]); + } + + return values; + }; + return that; }; @@ -864,42 +903,6 @@ IPA.widget_factories['force_dnszone_add_checkbox'] = IPA.force_dnszone_add_check IPA.field_factories['force_dnszone_add_checkbox'] = IPA.checkbox_field; -IPA.dnsrecord_get_delete_values = function() { - - var records = {}; - var value; - var record_type; - $('input[name="select"]:checked', this.table.tbody).each(function() { - - $('span',$(this).parent().parent()).each(function(){ - var name = this.attributes['name'].value; - - if (name === 'idnsname'){ - value = records[$(this).text()]; - if (!value){ - value = {pkey:$(this).text()}; - records[$(this).text()] = value; - } - }else if (name === 'type'){ - record_type = $(this).text(); - }else if (name === 'data'){ - if (!value[record_type]){ - value[record_type] = $(this).text(); - }else{ - value[record_type] += "," + $(this).text(); - } - } - }); - }); - - var value_array = []; - for (var key in records){ - value_array.push(records[key]); - } - - return value_array; -}; - IPA.ip_address_validator = function(spec) { spec = spec || {}; diff --git a/install/ui/search.js b/install/ui/search.js index c98e00283..e541833c4 100644 --- a/install/ui/search.js +++ b/install/ui/search.js @@ -38,12 +38,6 @@ IPA.search_facet = function(spec) { var that = IPA.table_facet(spec); - function get_values() { - return that.table.get_selected_values(); - } - - that.get_values = spec.get_values || get_values; - var init = function() { that.init_table(that.managed_entity); @@ -127,7 +121,7 @@ IPA.search_facet = function(spec) { that.show_remove_dialog = function() { - var values = that.get_values(); + var values = that.get_selected_values(); var title; if (!values.length) { |