atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mad...@apache.org
Subject [10/50] [abbrv] incubator-atlas git commit: ATLAS-1103 : UI: Search type list is not refreshed
Date Fri, 23 Dec 2016 01:46:39 GMT
ATLAS-1103 : UI: Search type list is not refreshed

(cherry picked from commit beb5a09976f943c4a4943f04d8bc58b36dba3771)


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

Branch: refs/heads/0.7-incubating
Commit: 1340bfc5be16f6324a26da01b2a569ec936173d0
Parents: cb28bb4
Author: kalyanikk <kalyani.kashikar@freestoneinfotech.com>
Authored: Mon Aug 8 17:12:58 2016 +0530
Committer: Madhan Neethiraj <madhan@apache.org>
Committed: Thu Dec 22 15:04:18 2016 -0800

----------------------------------------------------------------------
 .../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/1340bfc5/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/1340bfc5/dashboardv2/public/js/utils/CommonViewFunction.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/utils/CommonViewFunction.js b/dashboardv2/public/js/utils/CommonViewFunction.js
index 1b9cd43..a709823 100644
--- a/dashboardv2/public/js/utils/CommonViewFunction.js
+++ b/dashboardv2/public/js/utils/CommonViewFunction.js
@@ -455,21 +455,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 });
                     }
@@ -480,12 +478,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/1340bfc5/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/1340bfc5/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/1340bfc5/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/1340bfc5/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/1340bfc5/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/1340bfc5/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index efd00c6..d61da6d 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -28,6 +28,7 @@ ATLAS-409 Atlas will not import avro tables with schema read from a file
(dosset
 ATLAS-379 Create sqoop and falcon metadata addons (venkatnrangan,bvellanki,sowmyaramesh via
shwethags)
 
 ALL CHANGES:
+ATLAS-1103 : UI: Search type list is not refreshed (Kalyanikashikar via sumasai)
 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)
 ATLAS-1097 Fix a potential NPE issue flagged by Coverity scan (mneethiraj via shwethags)


Mime
View raw message