RIFT-15931, RIFT-15924: Leafref for rsp and internal-interface restored 82/1382/1
authorKIRAN KASHALKAR <kiran.kashalkar@riftio.com>
Mon, 27 Mar 2017 23:59:37 +0000 (19:59 -0400)
committerKIRAN KASHALKAR <kiran.kashalkar@riftio.com>
Tue, 28 Mar 2017 00:00:26 +0000 (20:00 -0400)
Signed-off-by: KIRAN KASHALKAR <kiran.kashalkar@riftio.com>
skyquake/plugins/composer/src/src/libraries/utils.js

index ef37a0b..b0fcfc6 100644 (file)
@@ -327,13 +327,21 @@ export default {
                        } else if (fieldKeyArray.length == 2) {
                                for (let key in catalogs) {
                                        for (let subKey in catalogs[key]) {
                        } 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) {
                                                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]) {
                        } 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) {
                                                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;
+                                                                       }
                                                                }
                                                        }
                                                }
                                                                }
                                                        }
                                                }