From 5a8ad3e9828c67e8ff9cc9dfc05458003f19c985 Mon Sep 17 00:00:00 2001 From: Pavel Vomacka Date: Jun 09 2016 12:20:02 +0000 Subject: 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 --- diff --git a/install/ui/src/freeipa/field.js b/install/ui/src/freeipa/field.js index fdf925e..12ef7f4 100644 --- a/install/ui/src/freeipa/field.js +++ b/install/ui/src/freeipa/field.js @@ -802,6 +802,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 * * Tries to detect if supplied data is RPC call response if so, it @@ -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;