diff --git a/install/ui/src/freeipa/field.js b/install/ui/src/freeipa/field.js index 3c027bc43..ea548c033 100644 --- a/install/ui/src/freeipa/field.js +++ b/install/ui/src/freeipa/field.js @@ -818,6 +818,15 @@ field.Adapter = declare(null, { */ result_index: 0, + /** + * When result of API call is an array of object this object index + * allows to specify exact object in array according to its position. + * Default value is null which means do not use object_index. + * + * @type {Number|null} + */ + object_index: null, + /** * Name of the record which we want to extract from the result. * Used in dnslocations. @@ -849,6 +858,10 @@ field.Adapter = declare(null, { else if (dr.results) { var result = dr.results[this.result_index]; if (result) record = result[this.result_name]; + var res_type = typeof record; + var obj_in_type = typeof this.object_index; + if (res_type === 'object' && obj_in_type === 'number') + record = record[this.object_index]; } } return record;