Repository: atlas Updated Branches: refs/heads/master 3b9ea1dd7 -> 37be53bbb
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/e9b95131 Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/e9b95131 Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/e9b95131 Branch: refs/heads/master Commit: e9b9513143ee489b0521bf58c42b25d6cbc6866e Parents: 3b9ea1d Author: kevalbhatt <kbh...@apache.org> Authored: Wed Nov 1 15:30:40 2017 +0530 Committer: kevalbhatt <kbh...@apache.org> Committed: Wed Nov 1 19:43:20 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/e9b95131/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/e9b95131/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); } }