atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kbh...@apache.org
Subject atlas git commit: ATLAS-2188 : UI can trim whitespaces at the beginning or end of search query
Date Wed, 04 Oct 2017 11:53:54 GMT
Repository: atlas
Updated Branches:
  refs/heads/branch-0.8 fda5f9f7e -> 19cd61d02


ATLAS-2188 : UI can trim whitespaces at the beginning or end of search query


Project: http://git-wip-us.apache.org/repos/asf/atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/19cd61d0
Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/19cd61d0
Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/19cd61d0

Branch: refs/heads/branch-0.8
Commit: 19cd61d022b442c99a84ccfa5ea1547f82a4cc31
Parents: fda5f9f
Author: kevalbhatt <kbhatt@apache.org>
Authored: Wed Oct 4 16:08:32 2017 +0530
Committer: kevalbhatt <kbhatt@apache.org>
Committed: Wed Oct 4 17:23:40 2017 +0530

----------------------------------------------------------------------
 dashboardv2/public/js/utils/CommonViewFunction.js            | 8 ++++----
 dashboardv2/public/js/utils/Overrides.js                     | 7 +++++++
 dashboardv2/public/js/views/search/SearchResultLayoutView.js | 2 +-
 3 files changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/atlas/blob/19cd61d0/dashboardv2/public/js/utils/CommonViewFunction.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/utils/CommonViewFunction.js b/dashboardv2/public/js/utils/CommonViewFunction.js
index fc20b02..37f14d5 100644
--- a/dashboardv2/public/js/utils/CommonViewFunction.js
+++ b/dashboardv2/public/js/utils/CommonViewFunction.js
@@ -409,7 +409,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
             queryArray.push(tagKeyValue);
         }
         if (value.query) {
-            queryArray.push('<span class="key">Query:</span>&nbsp<span
class="value">' + _.escape(value.query) + '</span>&nbsp');
+            queryArray.push('<span class="key">Query:</span>&nbsp<span
class="value">' + _.trim(_.escape(value.query)) + '</span>&nbsp');
         }
         if (queryArray.length == 1) {
             return queryArray.join();
@@ -544,7 +544,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
             var attrQuery = [];
             if (attrObj) {
                 _.each(attrObj, function(obj) {
-                    var url = [(obj.id || obj.attributeName), mapApiOperatorToUI(obj.operator),
(obj.value || obj.attributeValue)],
+                    var url = [(obj.id || obj.attributeName), mapApiOperatorToUI(obj.operator),
_.trim(obj.value || obj.attributeValue)],
                         type = (obj.type || obj.attributeType);
                     if (type) {
                         url.push(type);
@@ -588,7 +588,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
             if (urlObj && urlObj.length) {
                 _.each(urlObj.split(","), function(obj) {
                     var temp = obj.split("::");
-                    var finalObj = { id: temp[0], operator: temp[1], value: temp[2] }
+                    var finalObj = { id: temp[0], operator: temp[1], value: _.trim(temp[2])
}
                     if (temp[3]) {
                         finalObj['type'] = temp[3];
                     }
@@ -617,7 +617,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
                     tempObj = {
                         "attributeName": rulObj.id,
                         "operator": mapUiOperatorToAPI(rulObj.operator),
-                        "attributeValue": (rulObj.type === "date" ? Date.parse(rulObj.value)
: rulObj.value)
+                        "attributeValue": _.trim(rulObj.type === "date" ? Date.parse(rulObj.value)
: rulObj.value)
                     }
                     convertObj.push(tempObj);
                 });

http://git-wip-us.apache.org/repos/asf/atlas/blob/19cd61d0/dashboardv2/public/js/utils/Overrides.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/utils/Overrides.js b/dashboardv2/public/js/utils/Overrides.js
index bdc15db..4ffda57 100644
--- a/dashboardv2/public/js/utils/Overrides.js
+++ b/dashboardv2/public/js/utils/Overrides.js
@@ -54,6 +54,13 @@ define(['require', 'utils/Utils', 'marionette', 'backgrid', 'asBreadcrumbs',
'jq
             } else {
                 return false;
             }
+        },
+        trim: function(val) {
+            if (val && val.trim) {
+                return val.trim();
+            } else {
+                return val;
+            }
         }
     });
     var getPopoverEl = function(e) {

http://git-wip-us.apache.org/repos/asf/atlas/blob/19cd61d0/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 0e9838f..dda0f6f 100644
--- a/dashboardv2/public/js/views/search/SearchResultLayoutView.js
+++ b/dashboardv2/public/js/views/search/SearchResultLayoutView.js
@@ -467,7 +467,7 @@ define(['require',
                     if (value.searchType) {
                         this.searchCollection.url = UrlLinks.searchApiUrl(value.searchType);
                     }
-                    _.extend(this.searchCollection.queryParams, { 'limit': this.limit, 'offset':
this.offset, 'query': (value.query ? value.query.trim() : null), 'typeName': value.type ||
null, 'classification': value.tag || null });
+                    _.extend(this.searchCollection.queryParams, { 'limit': this.limit, 'offset':
this.offset, 'query': _.trim(value.query), 'typeName': value.type || null, 'classification':
value.tag || null });
                     if (value.profileDBView && value.guid) {
                         var profileParam = {};
                         profileParam['guid'] = value.guid;


Mime
View raw message