Repository: atlas Updated Branches: refs/heads/branch-0.8 43b862788 -> 18c6bed42
ATLAS-2282 : Saved favorite search appears only on refresh after creation when there are 25+ favorite searches . Signed-off-by: nixonrodrigues <ni...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/atlas/repo Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/18c6bed4 Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/18c6bed4 Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/18c6bed4 Branch: refs/heads/branch-0.8 Commit: 18c6bed42ecc30ea73d108ab6e53e76912a32f10 Parents: 43b8627 Author: pratik24mac <pratik2...@gmail.com> Authored: Tue Dec 12 17:11:22 2017 +0530 Committer: nixonrodrigues <ni...@apache.org> Committed: Tue Dec 12 19:31:44 2017 +0530 ---------------------------------------------------------------------- dashboardv2/public/js/utils/CommonViewFunction.js | 7 ++++--- .../public/js/views/search/SearchLayoutView.js | 14 ++++++++++---- .../public/js/views/search/save/SaveSearchView.js | 4 ++-- 3 files changed, 16 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/atlas/blob/18c6bed4/dashboardv2/public/js/utils/CommonViewFunction.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/utils/CommonViewFunction.js b/dashboardv2/public/js/utils/CommonViewFunction.js index a9e022f..9558a55 100644 --- a/dashboardv2/public/js/utils/CommonViewFunction.js +++ b/dashboardv2/public/js/utils/CommonViewFunction.js @@ -543,8 +543,9 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum if (attrObj) { _.each(attrObj, function(obj) { var type = (obj.type || obj.attributeType), - value = _.trim(obj.value || obj.attributeValue), - url = [(obj.id || obj.attributeName), mapApiOperatorToUI(obj.operator), (type === 'date' && formatedDateToLong ? Date.parse(value) : value)]; + //obj.value will come as an object when selected type is Date and operator is isNull or not_null; + value = (_.isObject(obj.value) ? "" : _.trim(obj.value || obj.attributeValue)), + url = [(obj.id || obj.attributeName), mapApiOperatorToUI(obj.operator), (type === 'date' && formatedDateToLong && value.length ? Date.parse(value) : value)]; if (type) { url.push(type); } @@ -597,7 +598,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum if (temp[3]) { finalObj['type'] = temp[3]; } - finalObj.value = finalObj.type === 'date' && formatDate ? moment(parseInt(finalObj.value)).format('MM/DD/YYYY h:mm A') : finalObj.value; + finalObj.value = finalObj.type === 'date' && formatDate && finalObj.value.length ? moment(parseInt(finalObj.value)).format('MM/DD/YYYY h:mm A') : finalObj.value; attrObj.push(finalObj); }); return attrObj; http://git-wip-us.apache.org/repos/asf/atlas/blob/18c6bed4/dashboardv2/public/js/views/search/SearchLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/search/SearchLayoutView.js b/dashboardv2/public/js/views/search/SearchLayoutView.js index f7a1bf3..255480c 100644 --- a/dashboardv2/public/js/views/search/SearchLayoutView.js +++ b/dashboardv2/public/js/views/search/SearchLayoutView.js @@ -125,6 +125,12 @@ define(['require', saveSearchAdvanceCollection = new VSearchList(), saveSearchCollection = new VSearchList(); saveSearchCollection.url = UrlLinks.saveSearchApiUrl(); + saveSearchBaiscCollection.fullCollection.comparator = function(model) { + return model.get('name').toLowerCase(); + } + saveSearchAdvanceCollection.fullCollection.comparator = function(model) { + return model.get('name').toLowerCase(); + } var obj = { value: that.value, searchVent: that.searchVent, @@ -163,18 +169,18 @@ define(['require', } that.RSaveSearchBasic.show(new SaveSearchView(_.extend(obj, { isBasic: true, - collection: saveSearchBaiscCollection + collection: saveSearchBaiscCollection.fullCollection }))); that.RSaveSearchAdvance.show(new SaveSearchView(_.extend(obj, { isBasic: false, - collection: saveSearchAdvanceCollection + collection: saveSearchAdvanceCollection.fullCollection }))); function fetchSaveSearchCollection() { saveSearchCollection.fetch({ success: function(collection, data) { - saveSearchAdvanceCollection.reset(_.where(data, { "searchType": "ADVANCED" })); - saveSearchBaiscCollection.reset(_.where(data, { "searchType": "BASIC" })); + saveSearchAdvanceCollection.fullCollection.reset(_.where(data, { "searchType": "ADVANCED" })); + saveSearchBaiscCollection.fullCollection.reset(_.where(data, { "searchType": "BASIC" })); }, silent: true }); http://git-wip-us.apache.org/repos/asf/atlas/blob/18c6bed4/dashboardv2/public/js/views/search/save/SaveSearchView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/search/save/SaveSearchView.js b/dashboardv2/public/js/views/search/save/SaveSearchView.js index e8db33e..ec0c81f 100644 --- a/dashboardv2/public/js/views/search/save/SaveSearchView.js +++ b/dashboardv2/public/js/views/search/save/SaveSearchView.js @@ -78,7 +78,7 @@ define(['require', }, bindEvents: function() { var that = this; - this.listenTo(this.collection, "add reset error", function(model, collection) { + this.listenTo(this.collection, "add reset error remove", function(model, collection) { this.$('.fontLoader-relative').hide(); if (this.collection && this.collection.length) { this.$(".noFavoriteSearch").hide(); @@ -192,7 +192,7 @@ define(['require', wait: true, success: function(model, data) { if (that.collection) { - that.collection.remove(data); + that.collection.remove(model); } Utils.notifySuccess({ content: options.model.get('name') + Messages.deleteSuccessMessage