You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by kb...@apache.org on 2017/11/01 14:12:50 UTC

atlas git commit: ATLAS-2244 : UI - Basic Search Table not using referredEntities to render entity details

Repository: atlas
Updated Branches:
  refs/heads/branch-0.8 5b3e51e70 -> 9fe9f4e95


ATLAS-2244 : UI - Basic Search Table not using referredEntities to render entity details


Project: http://git-wip-us.apache.org/repos/asf/atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/9fe9f4e9
Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/9fe9f4e9
Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/9fe9f4e9

Branch: refs/heads/branch-0.8
Commit: 9fe9f4e95dfa34e77aa6d78c7e7fcca9a6b67e26
Parents: 5b3e51e
Author: kevalbhatt <kb...@apache.org>
Authored: Wed Nov 1 15:30:40 2017 +0530
Committer: kevalbhatt <kb...@apache.org>
Committed: Wed Nov 1 19:42:12 2017 +0530

----------------------------------------------------------------------
 dashboardv2/public/js/utils/Utils.js             | 13 +++++++++++--
 .../js/views/search/SearchResultLayoutView.js    | 19 ++++++++-----------
 2 files changed, 19 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/atlas/blob/9fe9f4e9/dashboardv2/public/js/utils/Utils.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/utils/Utils.js b/dashboardv2/public/js/utils/Utils.js
index 24d35e2..492eb39 100644
--- a/dashboardv2/public/js/utils/Utils.js
+++ b/dashboardv2/public/js/utils/Utils.js
@@ -510,15 +510,24 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums',
         titleBoxEl.fadeIn();
     }
     Utils.findAndMergeRefEntity = function(attributeObject, referredEntities) {
+        var megeObject = function(obj) {
+            if (obj) {
+                if (obj.attributes) {
+                    Utils.findAndMergeRefEntity(obj.attributes, referredEntities);
+                } else if (referredEntities[obj.guid]) {
+                    _.extend(obj, referredEntities[obj.guid]);
+                }
+            }
+        }
         if (attributeObject && referredEntities) {
             _.each(attributeObject, function(obj, key) {
                 if (_.isObject(obj)) {
                     if (_.isArray(obj)) {
                         _.each(obj, function(value) {
-                            _.extend(value, referredEntities[value.guid]);
+                            megeObject(value);
                         });
                     } else {
-                        _.extend(obj, referredEntities[obj.guid]);
+                        megeObject(obj);
                     }
                 }
             });

http://git-wip-us.apache.org/repos/asf/atlas/blob/9fe9f4e9/dashboardv2/public/js/views/search/SearchResultLayoutView.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/views/search/SearchResultLayoutView.js b/dashboardv2/public/js/views/search/SearchResultLayoutView.js
index 844b0dd..ffca16c 100644
--- a/dashboardv2/public/js/views/search/SearchResultLayoutView.js
+++ b/dashboardv2/public/js/views/search/SearchResultLayoutView.js
@@ -241,7 +241,7 @@ define(['require',
                         }
                         this.triggerUrl();
                         var attributes = this.searchCollection.filterObj.attributes;
-                        if (excludeDefaultColumn && attributes && excludeDefaultColumn.length > attributes.length) {
+                        if ((excludeDefaultColumn && attributes) && (excludeDefaultColumn.length > attributes.length || _.difference(excludeDefaultColumn, attributes).length)) {
                             this.fetchCollection(this.value);
                         }
                     }
@@ -410,10 +410,12 @@ define(['require',
                             return;
                         }
                         if (isPostMethod) {
-                            that.searchCollection.referredEntities = dataOrCollection.rnoRecordFoeferredEntities;
+                            that.searchCollection.referredEntities = dataOrCollection.referredEntities;
+                            Utils.findAndMergeRefEntity(dataOrCollection.entities, dataOrCollection.referredEntities);
                             that.searchCollection.reset(dataOrCollection.entities, { silent: true });
                         }
 
+
                         /*Next button check.
                         It's outside of Previous button else condition 
                         because when user comes from 2 page to 1 page than we need to check next button.*/
@@ -712,17 +714,14 @@ define(['require',
                                     formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
                                         fromRaw: function(rawValue, model) {
                                             var modelObj = model.toJSON();
-
                                             if (modelObj && modelObj.attributes && !_.isUndefined(modelObj.attributes[key])) {
                                                 var tempObj = {
                                                     'scope': that,
                                                     'attributeDefs': [obj],
                                                     'valueObject': {},
                                                     'isTable': false
-                                                }
-
-                                                tempObj.valueObject[key] = modelObj.attributes[key]
-                                                Utils.findAndMergeRefEntity(tempObj.valueObject, that.searchCollection.referredEntities);
+                                                };
+                                                tempObj.valueObject[key] = modelObj.attributes[key];
                                                 return CommonViewFunction.propertyTable(tempObj);
                                             }
                                         }
@@ -770,10 +769,8 @@ define(['require',
                                                 // 'attributeDefs':
                                                 'valueObject': {},
                                                 'isTable': false
-                                            }
-
-                                            tempObj.valueObject[key] = modelObj[key]
-                                            Utils.findAndMergeRefEntity(tempObj.valueObject, that.searchCollection.referredEntities);
+                                            };
+                                            tempObj.valueObject[key] = modelObj[key];
                                             return CommonViewFunction.propertyTable(tempObj);
                                         }
                                     }