X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FUI.git;a=blobdiff_plain;f=skyquake%2Fplugins%2Fcomposer%2Fsrc%2Fsrc%2Flibraries%2Futils.js;h=b0fcfc6eb0a5dd72334b79f73f5f4ca526194ba2;hp=ef37a0bdc2377b31864037290354c5b5c054659b;hb=6f88e279fe92f07bd29ac5d4dfa5a91287cec793;hpb=4ef8c40c2c013c21f5487330daeab2561ba25fb3 diff --git a/skyquake/plugins/composer/src/src/libraries/utils.js b/skyquake/plugins/composer/src/src/libraries/utils.js index ef37a0bdc..b0fcfc6eb 100644 --- a/skyquake/plugins/composer/src/src/libraries/utils.js +++ b/skyquake/plugins/composer/src/src/libraries/utils.js @@ -327,13 +327,21 @@ export default { } else if (fieldKeyArray.length == 2) { for (let key in catalogs) { for (let subKey in catalogs[key]) { - let found = _find(catalogs[key][subKey], {id: fieldKeyArray[0]}); + console.log(key, subKey); + var found = _find(catalogs[key][subKey], {id: fieldKeyArray[0]}); if (found) { for (let foundKey in found) { - // let topLevel = _find(found[foundKey], {id: fieldKeyArray[1]}); - if (foundKey == fieldKeyArray[1]) { - results = this.getAbsoluteResults(found[foundKey], pathArray.splice(-i, i)); - return results; + if (_isArray(found[foundKey])) { + let topLevel = _find(found[foundKey], {id: fieldKeyArray[1]}); + if (topLevel) { + results = this.getAbsoluteResults(topLevel, pathArray.splice(-i, i)); + return results; + } + } else { + if (foundKey == fieldKeyArray[1]) { + results = this.getAbsoluteResults(found[foundKey], pathArray.splice(-i, i)); + return results; + } } } } @@ -342,13 +350,20 @@ export default { } else if (fieldKeyArray.length == 3) { for (let key in catalogs) { for (let subKey in catalogs[key]) { - let found = _.find(catalogs[key][subKey], {id: fieldKeyArray[0]}); + let found = _find(catalogs[key][subKey], {id: fieldKeyArray[0]}); if (found) { for (let foundKey in found) { - let topLevel = _.find(found[foundKey], {id: fieldKeyArray[1]}); - if (topLevel) { - results = this.getAbsoluteResults(topLevel, pathArray.splice(-i, i)); - return results; + if (_isArray(found[foundKey])) { + let topLevel = _find(found[foundKey], {id: fieldKeyArray[1]}); + if (topLevel) { + results = this.getAbsoluteResults(topLevel, pathArray.splice(-i, i)); + return results; + } + } else { + if (foundKey == fieldKeyArray[1]) { + results = this.getAbsoluteResults(found[foundKey], pathArray.splice(-i, i)); + return results; + } } } }