admin-config
Advanced tools
Comparing version 0.2.18 to 0.2.19
import ReferenceField from "./ReferenceField"; | ||
import ReferenceExtractor from '../Utils/ReferenceExtractor'; | ||
@@ -56,4 +57,16 @@ class ReferencedListField extends ReferenceField { | ||
} | ||
getReferences(withRemoteComplete) { | ||
return ReferenceExtractor.getReferences(this._targetFields, withRemoteComplete); | ||
} | ||
getNonOptimizedReferences(withRemoteComplete) { | ||
return ReferenceExtractor.getNonOptimizedReferences(this._targetFields, withRemoteComplete); | ||
} | ||
getOptimizedReferences(withRemoteComplete) { | ||
return ReferenceExtractor.getOptimizedReferences(this._targetFields, withRemoteComplete); | ||
} | ||
} | ||
export default ReferencedListField; |
import Entry from "../Entry"; | ||
import {clone, cloneAndFlatten, cloneAndNest} from '../Utils/objectProperties'; | ||
import ReferenceExtractor from '../Utils/ReferenceExtractor'; | ||
@@ -165,41 +166,15 @@ class View { | ||
getReferences(withRemoteComplete) { | ||
let result = {}; | ||
let lists = this._fields.filter(f => f.type() === 'reference' || f.type() === 'reference_many'); | ||
var filterFunction = null; | ||
if (withRemoteComplete === true) { | ||
filterFunction = f => f.remoteComplete(); | ||
} else if (withRemoteComplete === false) { | ||
filterFunction = f => !f.remoteComplete(); | ||
} | ||
if (filterFunction !== null) { | ||
lists = lists.filter(filterFunction); | ||
} | ||
for (let i = 0, c = lists.length ; i < c ; i++) { | ||
let list = lists[i]; | ||
result[list.name()] = list; | ||
} | ||
return result; | ||
return ReferenceExtractor.getReferences(this._fields, withRemoteComplete); | ||
} | ||
getNonOptimizedReferences(withRemoteComplete) { | ||
return this._getReferencesByOptimizationType(false, withRemoteComplete); | ||
return ReferenceExtractor.getNonOptimizedReferences(this._fields, withRemoteComplete); | ||
} | ||
getOptimizedReferences(withRemoteComplete) { | ||
return this._getReferencesByOptimizationType(true, withRemoteComplete); | ||
return ReferenceExtractor.getOptimizedReferences(this._fields, withRemoteComplete); | ||
} | ||
getReferencedLists() { | ||
let result = {}; | ||
let lists = this._fields.filter(f => f.type() === 'referenced_list'); | ||
for (let i = 0, c = lists.length ; i < c ; i++) { | ||
let list = lists[i]; | ||
result[list.name()] = list; | ||
} | ||
return result; | ||
return ReferenceExtractor.getReferencedLists(this._fields); | ||
} | ||
@@ -282,25 +257,4 @@ | ||
} | ||
/** | ||
* @param {Boolean} optimized | ||
* @param {Boolean} withRemoteComplete | ||
* @returns {[Reference]} | ||
* @private | ||
*/ | ||
_getReferencesByOptimizationType(optimized=true, withRemoteComplete=null) { | ||
let result = {}, | ||
references = this.getReferences(withRemoteComplete); | ||
for (let i in references) { | ||
let reference = references[i]; | ||
if (!!reference.getSingleApiCall() === optimized) { | ||
result[i] = reference; | ||
} | ||
} | ||
return result; | ||
} | ||
} | ||
export default View; |
{ | ||
"name": "admin-config", | ||
"version": "0.2.18", | ||
"version": "0.2.19", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "repository": { |
164149
72
4191