ATLAS-4167:UI Large no. of calls are getting generated while rendering search results fixed
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 @@
},
onRender: function() {
var that = this;
+ this.checkEntityImage = {};
this.commonTableOptions = {
collection: this.searchCollection,
includePagination: false,
@@ -707,6 +708,7 @@
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 @@
"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 @@
}
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 @@
if (Utils.getUrlState.isSearchTab()) {
this.$(".action-box").hide();
}
+ this.checkEntityImage = {};
this.commonTableOptions = {
collection: this.searchCollection,
includePagination: false,
@@ -719,6 +720,7 @@
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 @@
"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 @@
}
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);
}
})