NOTICKET: Relative refs, 3 levels deep
[osm/UI.git] / skyquake / plugins / composer / src / src / libraries / utils.js
index ee4163c..75afab3 100644 (file)
@@ -237,6 +237,10 @@ export default {
                                        } else {
                                                // contains no predicate
                                                objectCopy = objectCopy[fragment];
+                                               if (!objectCopy) {
+                                                       // contains no value
+                                                       break;
+                                               }
                                        }
                                }
                        }
@@ -314,6 +318,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]});
+                                               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;
+                                                               }
+                                                       }
+                                               }
+                                       }
+                               }
+                       } 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]});