This is an automated email from the ASF dual-hosted git repository.

nixon pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/atlas.git

commit 059ea24049d337df6a947d9e6838664b903b2da4
Author: prasad pawar <prasad.pa...@freestoneinfotech.com>
AuthorDate: Thu Feb 18 19:25:51 2021 +0530

    ATLAS-4167:UI Large no. of calls are getting generated while rendering 
search results fixed
    
    (cherry picked from commit 5aab9b0c6d1379d3751e0d13f06819f143617fe4)
---
 dashboardv2/public/js/views/search/SearchResultLayoutView.js | 11 ++++++++++-
 dashboardv3/public/js/views/search/SearchResultLayoutView.js | 11 ++++++++++-
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/dashboardv2/public/js/views/search/SearchResultLayoutView.js 
b/dashboardv2/public/js/views/search/SearchResultLayoutView.js
index 0401049..9db1b54 100644
--- a/dashboardv2/public/js/views/search/SearchResultLayoutView.js
+++ b/dashboardv2/public/js/views/search/SearchResultLayoutView.js
@@ -246,6 +246,7 @@ define(['require',
             },
             onRender: function() {
                 var that = this;
+                this.checkEntityImage = {};
                 this.commonTableOptions = {
                     collection: this.searchCollection,
                     includePagination: false,
@@ -707,6 +708,7 @@ define(['require',
                             var getImageData = function(options) {
                                 var imagePath = options.imagePath,
                                     returnImgUrl = null;
+                                that.checkEntityImage[model.get('guid')] = 
false;
                                 $.ajax({
                                         "url": imagePath,
                                         "method": "get",
@@ -718,6 +720,7 @@ define(['require',
                                                 "imagePath": 
Utils.getEntityIconPath({ entityData: obj, errorUrl: imagePath })
                                             });
                                         } else if (data) {
+                                            
that.checkEntityImage[model.get('guid')] = imagePath;
                                             returnImgUrl = imagePath;
                                             that.$("img[data-imgGuid='" + 
obj.guid + "']").removeClass("searchTableLogoLoader").attr("src", imagePath);
                                         }
@@ -725,7 +728,13 @@ define(['require',
                             }
                             var img = "";
                             img = "<div><img data-imgGuid='" + obj.guid + "' 
class='searchTableLogoLoader'></div>";
-                            getImageData({ imagePath: 
Utils.getEntityIconPath({ entityData: obj }) });
+                            if (that.checkEntityImage[model.get('guid')] == 
undefined) {
+                                getImageData({ imagePath: 
Utils.getEntityIconPath({ entityData: obj }) });
+                            } else {
+                                if (that.checkEntityImage[model.get('guid')] 
!= false) {
+                                    img = "<div><img data-imgGuid='" + 
obj.guid + "' src='" + that.checkEntityImage[model.get('guid')] + "'></div>";
+                                }
+                            }
                             return (img + nameHtml);
                         }
                     })
diff --git a/dashboardv3/public/js/views/search/SearchResultLayoutView.js 
b/dashboardv3/public/js/views/search/SearchResultLayoutView.js
index 67679bb..d98d6e2 100644
--- a/dashboardv3/public/js/views/search/SearchResultLayoutView.js
+++ b/dashboardv3/public/js/views/search/SearchResultLayoutView.js
@@ -255,6 +255,7 @@ define(['require',
                 if (Utils.getUrlState.isSearchTab()) {
                     this.$(".action-box").hide();
                 }
+                this.checkEntityImage = {};
                 this.commonTableOptions = {
                     collection: this.searchCollection,
                     includePagination: false,
@@ -719,6 +720,7 @@ define(['require',
                             var getImageData = function(options) {
                                 var imagePath = options.imagePath,
                                     returnImgUrl = null;
+                                that.checkEntityImage[model.get('guid')] = 
false;
                                 $.ajax({
                                         "url": imagePath,
                                         "method": "get",
@@ -730,6 +732,7 @@ define(['require',
                                                 "imagePath": 
Utils.getEntityIconPath({ entityData: obj, errorUrl: imagePath })
                                             });
                                         } else if (data) {
+                                            
that.checkEntityImage[model.get('guid')] = imagePath;
                                             returnImgUrl = imagePath;
                                             that.$("img[data-imgGuid='" + 
obj.guid + "']").removeClass("searchTableLogoLoader").attr("src", imagePath);
                                         }
@@ -737,7 +740,13 @@ define(['require',
                             }
                             var img = "";
                             img = "<div><img data-imgGuid='" + obj.guid + "' 
class='searchTableLogoLoader'></div>";
-                            getImageData({ imagePath: 
Utils.getEntityIconPath({ entityData: obj }) });
+                            if (that.checkEntityImage[model.get('guid')] == 
undefined) {
+                                getImageData({ imagePath: 
Utils.getEntityIconPath({ entityData: obj }) });
+                            } else {
+                                if (that.checkEntityImage[model.get('guid')] 
!= false) {
+                                    img = "<div><img data-imgGuid='" + 
obj.guid + "' src='" + that.checkEntityImage[model.get('guid')] + "'></div>";
+                                }
+                            }
                             return (img + nameHtml);
                         }
                     })

Reply via email to