You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by su...@apache.org on 2016/08/08 21:02:56 UTC

incubator-atlas git commit: ATLAS-1103 : UI: Search type list is not refreshed

Repository: incubator-atlas
Updated Branches:
  refs/heads/master 4fa10b6ae -> beb5a0997


ATLAS-1103 : UI: Search type list is not refreshed


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

Branch: refs/heads/master
Commit: beb5a09976f943c4a4943f04d8bc58b36dba3771
Parents: 4fa10b6
Author: kalyanikk <ka...@freestoneinfotech.com>
Authored: Mon Aug 8 17:12:58 2016 +0530
Committer: Suma Shivaprasad <su...@gmail.com>
Committed: Mon Aug 8 14:02:00 2016 -0700

----------------------------------------------------------------------
 .../templates/search/SearchLayoutView_tmpl.html |  9 +++++--
 .../public/js/utils/CommonViewFunction.js       | 16 ++++++------
 .../AddTermToEntityLayoutView.js                | 18 ++++---------
 .../public/js/views/graph/LineageLayoutView.js  | 10 ++++----
 .../public/js/views/search/SearchLayoutView.js  | 24 ++++++++++++++---
 .../js/views/search/SearchResultLayoutView.js   | 12 ++++-----
 .../public/js/views/tag/addTagModalView.js      | 27 ++++++++------------
 release-log.txt                                 |  1 +
 8 files changed, 62 insertions(+), 55 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/beb5a099/dashboardv2/public/js/templates/search/SearchLayoutView_tmpl.html
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/templates/search/SearchLayoutView_tmpl.html b/dashboardv2/public/js/templates/search/SearchLayoutView_tmpl.html
index 3596732..de34b58 100644
--- a/dashboardv2/public/js/templates/search/SearchLayoutView_tmpl.html
+++ b/dashboardv2/public/js/templates/search/SearchLayoutView_tmpl.html
@@ -17,7 +17,7 @@
 <div class="row row-margin-bottom">
     <div class="col-sm-12" style="margin:15px 0px;">
         <div class="row">
-            <div class="col-md-12">
+            <div class="col-md-6">
                 <span class="pull-left">Text</span>
                 <label class="switch pull-left">
                     <input type="checkbox" name="queryType" value="text">
@@ -25,6 +25,9 @@
                 </label>
                 <span class="pull-left">DSL</span>
             </div>
+            <div class="col-md-6">
+                <button class="btn btn-atlasAction btn-atlas pull-right typeLOV" title="Refresh" data-id="refreshBtn"><i class="fa fa-refresh"></i></button>
+            </div>
         </div>
     </div>
     <div class="col-sm-12">
@@ -32,7 +35,9 @@
             <div class="typeLOV">
                 <select data-id="typeLOV"></select>
             </div>
-            <input type="text" class="form-control" data-id="searchInput" placeholder="Search using a query string: e.g. sales_fact" style="margin-top: 5px;">
+            <div class="searchInputClick">
+                <input type="text" class="form-control"  data-id="searchInput" placeholder="Search using a query string: e.g. sales_fact" style="margin-top: 5px;">
+            </div>
         </div>
         <div class="clearAdvanceSearch" data-id="clearSearch">Clear</div>
         <button class="btn btn-atlas advanceSearchBtn" data-id="searchBtn" disabled="disabled">Search</button>

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/beb5a099/dashboardv2/public/js/utils/CommonViewFunction.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/utils/CommonViewFunction.js b/dashboardv2/public/js/utils/CommonViewFunction.js
index b8c8dea..ceb10d2 100644
--- a/dashboardv2/public/js/utils/CommonViewFunction.js
+++ b/dashboardv2/public/js/utils/CommonViewFunction.js
@@ -458,21 +458,19 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Glob
         }
         return '<div class="tagList">' + atags + addTag + '<div class="popover popoverTag bottom" style="display:none"><div class="arrow"></div><div class="popover-content popoverContainer">' + popTag + '</div></div></div>';
     }
-    CommonViewFunction.saveTermToAsset = function(options) {
+    CommonViewFunction.saveTermToAsset = function(options, that) {
         require(['models/VCatalog'], function(Vcatalog) {
             var VCatalog = new Vcatalog();
             var name = options.termName;
             VCatalog.url = function() {
                 return "api/atlas/v1/entities/" + options.guid + "/tags/" + name;
             };
+            ++that.asyncFetchCounter;
             VCatalog.save(null, {
                 success: function(data) {
                     Utils.notifySuccess({
                         content: "Term " + name + Messages.addTermToEntitySuccessMessage
                     });
-                    if (options.callback) {
-                        options.callback();
-                    }
                     if (options.collection) {
                         options.collection.fetch({ reset: true });
                     }
@@ -483,12 +481,14 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Glob
                         Utils.notifyError({
                             content: data.message || data.msgDesc
                         });
-                        if (options.callback) {
-                            options.callback();
-                        }
                     }
                 },
-                complete: function() {}
+                complete: function() {
+                    --that.asyncFetchCounter
+                    if (that.callback && that.asyncFetchCounter === 0) {
+                        that.callback(); // It will call to parent of parent Callback i.e callback of searchLayoutView
+                    }
+                }
             });
         })
     }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/beb5a099/dashboardv2/public/js/views/business_catalog/AddTermToEntityLayoutView.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/views/business_catalog/AddTermToEntityLayoutView.js b/dashboardv2/public/js/views/business_catalog/AddTermToEntityLayoutView.js
index e35186c..d977436 100644
--- a/dashboardv2/public/js/views/business_catalog/AddTermToEntityLayoutView.js
+++ b/dashboardv2/public/js/views/business_catalog/AddTermToEntityLayoutView.js
@@ -61,6 +61,7 @@ define(['require',
                     allowCancel: true,
                 }).open();
                 this.on('ok', function() {
+                    that.asyncFetchCounter = 0;
                     if (that.multiple) {
                         for (var i = 0; i < that.multiple.length; i++) {
                             if (i == 0) {
@@ -70,23 +71,14 @@ define(['require',
                                 termName: this.modal.$el.find('.taxonomyTree li.active a').data('name').split("`").join(""),
                                 guid: that.multiple[i].id.id
                             }
-                            if (that.multiple.length - 1 == i) {
-                                obj['callback'] = function() {
-                                    that.callback();
-                                }
-                            }
-                            // if (that.multiple[i].model.get("$traits$") && !that.multiple[i].model.get("$traits$")[obj.termName]) {
-                            CommonViewFunction.saveTermToAsset(obj);
-                            // / }
+                            CommonViewFunction.saveTermToAsset(obj, that);
                         }
                     } else {
+                        that.asyncFetchCounter = 0;
                         CommonViewFunction.saveTermToAsset({
                             termName: this.modal.$el.find('.taxonomyTree li.active a').data('name').split("`").join(""),
-                            guid: this.guid,
-                            callback: function() {
-                                that.callback();
-                            }
-                        });
+                            guid: this.guid
+                        }, that);
                     }
                 });
                 this.on('closeModal', function() {

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/beb5a099/dashboardv2/public/js/views/graph/LineageLayoutView.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/views/graph/LineageLayoutView.js b/dashboardv2/public/js/views/graph/LineageLayoutView.js
index acf0d8e..706848e 100644
--- a/dashboardv2/public/js/views/graph/LineageLayoutView.js
+++ b/dashboardv2/public/js/views/graph/LineageLayoutView.js
@@ -63,7 +63,7 @@ define(['require',
                 this.bindEvents();
                 this.fetchGraphData();
                 this.data = {};
-                this.fetchList = 0;
+                this.asyncFetchCounter = 0;
             },
             bindEvents: function() {
                 this.listenTo(this.inputCollection, 'reset', function() {
@@ -141,8 +141,8 @@ define(['require',
                             }
                         }
                     }
-                    --that.fetchList;
-                    if (that.fetchList <= 0) {
+                    --that.asyncFetchCounter;
+                    if (that.asyncFetchCounter === 0) {
                         if (that.edgesAndvertices) {
                             that.createGraph(that.edgesAndvertices, that.startingPoint);
                         } else if (this.outputState && !that.edgesAndvertices) {
@@ -152,7 +152,7 @@ define(['require',
                 }
 
                 function fetchLoadProcess(id) {
-                    ++that.fetchList;
+                    ++that.asyncFetchCounter;
                     that.entityModel.getEntity(id, {
                         success: function(data) {
                             addValueInObject(data);
@@ -227,7 +227,7 @@ define(['require',
                         }
                     }
                 });
-                if (this.fetchList <= 0) {
+                if (this.asyncFetchCounter <= 0) {
                     if (this.edgesAndvertices) {
                         this.createGraph(that.edgesAndvertices, this.startingPoint);
                     } else if (this.outputState && !this.edgesAndvertices) {

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/beb5a099/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 6469c62..7f5e364 100644
--- a/dashboardv2/public/js/views/search/SearchLayoutView.js
+++ b/dashboardv2/public/js/views/search/SearchLayoutView.js
@@ -40,7 +40,8 @@ define(['require',
                 searchType: 'input[name="queryType"]',
                 searchBtn: '[data-id="searchBtn"]',
                 clearSearch: '[data-id="clearSearch"]',
-                typeLov: '[data-id="typeLOV"]'
+                typeLov: '[data-id="typeLOV"]',
+                refreshBtn: '[data-id="refreshBtn"]'
             },
             /** ui events hash */
             events: function() {
@@ -60,6 +61,7 @@ define(['require',
                 events["click " + this.ui.searchBtn] = 'findSearchResult';
                 events["click " + this.ui.clearSearch] = 'clearSearchData';
                 events["change " + this.ui.typeLov] = 'onChangeTypeList';
+                events["click " + this.ui.refreshBtn] = 'onRefreshButton';
                 return events;
             },
             /**
@@ -105,6 +107,9 @@ define(['require',
                 $.extend(this.typecollection.queryParams, { type: 'CLASS' });
                 this.typecollection.fetch({ reset: true });
             },
+            onRefreshButton: function() {
+                this.fetchCollection();
+            },
             manualRender: function(paramObj) {
                 this.setValues(paramObj);
             },
@@ -121,11 +126,15 @@ define(['require',
                 that.ui.typeLov.html(str);
             },
             onChangeTypeList: function(e) {
+                var that = this;
                 if (this.ui.typeLov.select2('val') !== "") {
                     this.ui.searchBtn.removeAttr("disabled");
                 } else if (this.ui.searchInput.val() === "") {
                     this.ui.searchBtn.attr("disabled", "true");
                 }
+                setTimeout(function() {
+                    that.ui.searchInput.focus();
+                }, 0);
             },
             setValues: function(paramObj) {
                 var arr = [],
@@ -152,14 +161,21 @@ define(['require',
                                 this.ui.typeLov.val(typeList).trigger('change');
                             } else {
                                 this.ui.typeLov.val(typeList);
+                                setTimeout(function() {
+                                    that.ui.searchInput.focus();
+                                }, 0);
                             }
                             this.ui.searchInput.val(query.join(" "));
                         } else {
                             this.ui.searchInput.val(this.value.query);
+                            setTimeout(function() {
+                                that.ui.searchInput.focus();
+                            }, 0);
+                        }
+                        if (this.ui.searchBtn.val() !== "" || this.ui.typeLov.val() !== "") {
+                            this.ui.searchBtn.removeAttr("disabled");
                         }
-                        this.ui.searchBtn.removeAttr("disabled");
                     }
-
                 }
                 this.bindEvents(arr);
             },
@@ -202,7 +218,7 @@ define(['require',
                     this.$('.typeLOV').hide();
                     this.type = "fulltext";
                 }
-                if (this.query[this.type].query !== Utils.getUrlState.getQueryParams().query && this.type == Utils.getUrlState.getQueryParams().searchType) {
+                if (Utils.getUrlState.getQueryParams() && this.query[this.type].query !== Utils.getUrlState.getQueryParams().query && this.type == Utils.getUrlState.getQueryParams().searchType) {
                     this.query[this.type].query = Utils.getUrlState.getQueryParams().query;
                 }
                 Utils.setUrl({

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/beb5a099/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 865167d..970e105 100644
--- a/dashboardv2/public/js/views/search/SearchResultLayoutView.js
+++ b/dashboardv2/public/js/views/search/SearchResultLayoutView.js
@@ -118,7 +118,7 @@ define(['require',
                 this.searchCollection = new VSearchList();
                 this.limit = 25;
                 this.firstFetch = true;
-                this.fetchList = 0;
+                this.asyncFetchCounter = 0;
                 this.offset = 0;
                 this.commonTableOptions = {
                     collection: this.searchCollection,
@@ -202,7 +202,7 @@ define(['require',
             },
             fetchCollection: function(value) {
                 var that = this;
-                if (value && (value.query === undefined || value.query === "")) {
+                if (value && (value.query === undefined || value.query.trim() === "")) {
                     return;
                 }
                 this.$('.fontLoader').show();
@@ -305,7 +305,7 @@ define(['require',
                 });
             },
             checkTableFetch: function() {
-                if (this.fetchList <= 0) {
+                if (this.asyncFetchCounter <= 0) {
                     this.$('div[data-id="r_tableSpinner"]').removeClass('show')
                     this.$('.fontLoader').hide();
                     this.$('.searchTable').show();
@@ -344,7 +344,7 @@ define(['require',
                             });
                             if (guid.length) {
                                 idFound = true;
-                                ++fetchResultCount;
+                                ++that.asyncFetchCounter;
                                 model.getEntity(guid, {
                                     success: function(data) {
                                         if (data.definition) {
@@ -364,8 +364,8 @@ define(['require',
                                     },
                                     error: function(error, data, status) {},
                                     complete: function() {
-                                        --fetchResultCount;
-                                        if (fetchResultCount === 0) {
+                                        --that.asyncFetchCounter;
+                                        if (that.asyncFetchCounter === 0) {
                                             that.renderTableLayoutView(that.getFixedDslColumn())
                                         }
                                     }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/beb5a099/dashboardv2/public/js/views/tag/addTagModalView.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/views/tag/addTagModalView.js b/dashboardv2/public/js/views/tag/addTagModalView.js
index c29ad25..83a7ab0 100644
--- a/dashboardv2/public/js/views/tag/addTagModalView.js
+++ b/dashboardv2/public/js/views/tag/addTagModalView.js
@@ -57,6 +57,7 @@ define(['require',
             }).open();
             this.on('ok', function() {
                 if (that.multiple) {
+                    that.asyncFetchCounter = 0;
                     for (var i = 0; i < that.multiple.length; i++) {
                         if (i == 0) {
                             that.showLoader();
@@ -65,21 +66,13 @@ define(['require',
                             tagName: this.ui.addTagOptions.val(),
                             guid: that.multiple[i].id.id
                         }
-                        if (that.multiple.length - 1 == i) {
-                            obj['callback'] = function() {
-                                that.callback();
-                            }
-                        }
-
                         that.saveTagData(obj);
                     }
                 } else {
+                    that.asyncFetchCounter = 0;
                     that.saveTagData({
                         tagName: that.ui.addTagOptions.val(),
-                        guid: that.guid,
-                        callback: function() {
-                            that.callback();
-                        }
+                        guid: that.guid
                     });
                 }
             });
@@ -146,6 +139,7 @@ define(['require',
         saveTagData: function(options) {
             var that = this,
                 values = {};
+            ++this.asyncFetchCounter;
             this.entityModel = new VEntity();
             var name = options.tagName;
             var tagName = this.ui.addTagOptions.val();
@@ -160,9 +154,6 @@ define(['require',
                     Utils.notifySuccess({
                         content: "Tag " + tagName + " has been added to entity"
                     });
-                    if (options.callback) {
-                        options.callback();
-                    }
                     if (options.modalCollection) {
                         options.modalCollection.fetch({ reset: true });
                     }
@@ -176,11 +167,13 @@ define(['require',
                     Utils.notifyError({
                         content: message
                     });
-                    if (options.callback) {
-                        options.callback();
-                    }
                 },
-                complete: function() {}
+                complete: function() {
+                    --that.asyncFetchCounter;
+                    if (that.callback && that.asyncFetchCounter === 0) {
+                        that.callback();
+                    }
+                }
             });
         },
     });

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/beb5a099/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index 7c8e008..e6b77e1 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -6,6 +6,7 @@ INCOMPATIBLE CHANGES:
 ATLAS-1060 Add composite indexes for exact match performance improvements for all attributes (sumasai via shwethags)
 
 ALL CHANGES:
+ATLAS-1103 : UI: Search type list is not refreshed (Kalyanikashikar via sumasai)
 ATLAS-693 Titan 0.5.4 implementation of the graph db abstraction {jnhagelb via dkantor)
 ATLAS-1099 UI : multiple tag assign button hides wrongly (Kalyanikashikar via sumasai)
 ATLAS-1087 Provide an option to turn off persisting entity definition in audits (sumasai, shwethags)