From 5a8ad3e9828c67e8ff9cc9dfc05458003f19c985 Mon Sep 17 00:00:00 2001 From: Pavel Vomacka <pvomacka@redhat.com> Date: Sun, 5 Jun 2016 18:03:17 +0200 Subject: [PATCH] Add adapter attribute for choosing record The new attribute of the adapter contains the name of record which will be extracted from API call result. Part of: https://fedorahosted.org/freeipa/ticket/5905 Reviewed-By: Petr Vobornik <pvoborni@redhat.com> --- install/ui/src/freeipa/field.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/install/ui/src/freeipa/field.js b/install/ui/src/freeipa/field.js index fdf925e3d..12ef7f455 100644 --- a/install/ui/src/freeipa/field.js +++ b/install/ui/src/freeipa/field.js @@ -801,6 +801,13 @@ field.Adapter = declare(null, { */ result_index: 0, + /** + * Name of the record which we want to extract from the result. + * Used in dnslocations. + * @type {String} + */ + result_name: 'result', + /** * Extract record from RPC call response * @@ -821,10 +828,10 @@ field.Adapter = declare(null, { var dr = data.result; var record = null; if (dr) { - if (IPA.defined(dr.result)) record = dr.result; + if (IPA.defined(dr[this.result_name])) record = dr[this.result_name]; else if (dr.results) { var result = dr.results[this.result_index]; - if (result) record = result.result; + if (result) record = result[this.result_name]; } } return record;