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

atlas git commit: ATLAS-2282 : Saved favorite search appears only on refresh after creation when there are 25+ favorite searches .

Repository: atlas
Updated Branches:
  refs/heads/master 5ba64a8b3 -> 71a30876d


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/71a30876
Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/71a30876
Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/71a30876

Branch: refs/heads/master
Commit: 71a30876d74b9e286dc207f1b5c1f70d96a782c2
Parents: 5ba64a8
Author: pratik24mac <pr...@gmail.com>
Authored: Tue Dec 12 17:11:22 2017 +0530
Committer: nixonrodrigues <ni...@apache.org>
Committed: Tue Dec 12 19:28:08 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/71a30876/dashboardv2/public/js/utils/CommonViewFunction.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/utils/CommonViewFunction.js b/dashboardv2/public/js/utils/CommonViewFunction.js
index e35e9ee..374bde2 100644
--- a/dashboardv2/public/js/utils/CommonViewFunction.js
+++ b/dashboardv2/public/js/utils/CommonViewFunction.js
@@ -392,8 +392,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);
                     }
@@ -446,7 +447,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/71a30876/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 0b1e9b1..151b2af 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/71a30876/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