atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mad...@apache.org
Subject incubator-atlas git commit: ATLAS-1812: On browser refresh if, tag is doesn't exist, then URL should update with the first tag.
Date Fri, 19 May 2017 16:48:20 GMT
Repository: incubator-atlas
Updated Branches:
  refs/heads/master f0f7fe2cf -> 138bc6f1b


ATLAS-1812: On browser refresh if, tag is doesn't exist, then URL should update with the first
tag.

Signed-off-by: Madhan Neethiraj <madhan@apache.org>


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

Branch: refs/heads/master
Commit: 138bc6f1bddb1e376277d6544534b4d5419d1fdd
Parents: f0f7fe2
Author: kevalbhatt <kbhatt@apache.org>
Authored: Wed May 17 16:23:22 2017 +0530
Committer: Madhan Neethiraj <madhan@apache.org>
Committed: Fri May 19 09:35:54 2017 -0700

----------------------------------------------------------------------
 dashboardv2/public/js/router/Router.js          | 26 ++++++++++++-
 .../views/business_catalog/SideNavLayoutView.js |  2 -
 .../js/views/entity/CreateEntityLayoutView.js   | 16 +++-----
 .../public/js/views/schema/SchemaLayoutView.js  |  2 +-
 .../js/views/search/SearchResultLayoutView.js   |  2 +-
 .../public/js/views/tag/TagDetailLayoutView.js  | 26 ++++++++-----
 .../public/js/views/tag/TagLayoutView.js        | 40 ++++++++++----------
 7 files changed, 67 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/138bc6f1/dashboardv2/public/js/router/Router.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/router/Router.js b/dashboardv2/public/js/router/Router.js
index 6bec26d..f1250e7 100644
--- a/dashboardv2/public/js/router/Router.js
+++ b/dashboardv2/public/js/router/Router.js
@@ -181,8 +181,19 @@ define([
                 'views/business_catalog/SideNavLayoutView',
                 'views/tag/TagDetailLayoutView',
             ], function(Header, BusinessCatalogLayoutView, SideNavLayoutView, TagDetailLayoutView)
{
+                var paramObj = Utils.getUrlState.getQueryParams(),
+                    url = Utils.getUrlState.getQueryUrl().queyParams[0];
                 App.rNHeader.show(new Header());
                 if (!App.rSideNav.currentView) {
+                    if (paramObj && paramObj.dlttag) {
+                        Utils.setUrl({
+                            url: url,
+                            trigger: false,
+                            updateTabState: function() {
+                                return { tagUrl: this.url, stateChanged: true };
+                            }
+                        });
+                    }
                     App.rSideNav.show(new SideNavLayoutView(
                         _.extend({
                             'tag': tagName,
@@ -190,11 +201,24 @@ define([
                         }, that.preFetchedCollectionLists)
                     ));
                 } else {
+                    if (paramObj && paramObj.dlttag) {
+                        Utils.setUrl({
+                            url: url,
+                            trigger: false,
+                            updateTabState: function() {
+                                return { tagUrl: this.url, stateChanged: true };
+                            }
+                        });
+                    }
                     App.rSideNav.currentView.RTagLayoutView.currentView.manualRender(tagName);
                     App.rSideNav.currentView.selectTab();
                 }
-
                 if (tagName) {
+                    // updating paramObj to check for new queryparam.
+                    paramObj = Utils.getUrlState.getQueryParams();
+                    if (paramObj && paramObj.dlttag) {
+                        return false;
+                    }
                     App.rNContent.show(new TagDetailLayoutView(
                         _.extend({
                             'tag': tagName,

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/138bc6f1/dashboardv2/public/js/views/business_catalog/SideNavLayoutView.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/views/business_catalog/SideNavLayoutView.js b/dashboardv2/public/js/views/business_catalog/SideNavLayoutView.js
index 8c67d11..af18540 100644
--- a/dashboardv2/public/js/views/business_catalog/SideNavLayoutView.js
+++ b/dashboardv2/public/js/views/business_catalog/SideNavLayoutView.js
@@ -74,7 +74,6 @@ define(['require',
             }
         },
         onRender: function() {
-            this.bindEvent();
             this.renderTagLayoutView();
             this.renderSearchLayoutView();
             if (Globals.taxonomy) {
@@ -83,7 +82,6 @@ define(['require',
             this.selectTab();
 
         },
-        bindEvent: function() {},
         rendeBusinessCatalogLayoutView: function() {
             var that = this;
             require(['views/business_catalog/BusinessCatalogLayoutView'], function(BusinessCatalogLayoutView)
{

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/138bc6f1/dashboardv2/public/js/views/entity/CreateEntityLayoutView.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/views/entity/CreateEntityLayoutView.js b/dashboardv2/public/js/views/entity/CreateEntityLayoutView.js
index 44dd898..12edab6 100644
--- a/dashboardv2/public/js/views/entity/CreateEntityLayoutView.js
+++ b/dashboardv2/public/js/views/entity/CreateEntityLayoutView.js
@@ -583,7 +583,11 @@ define(['require',
                                 that.callback();
                             } else {
                                 if (model.mutatedEntities && model.mutatedEntities.CREATE
&& _.isArray(model.mutatedEntities.CREATE) && model.mutatedEntities.CREATE[0]
&& model.mutatedEntities.CREATE[0].guid) {
-                                    that.setUrl('#!/detailPage/' + (model.mutatedEntities.CREATE[0].guid),
true);
+                                    Utils.setUrl({
+                                        url: '#!/detailPage/' + (model.mutatedEntities.CREATE[0].guid),
+                                        mergeBrowserUrl: false,
+                                        trigger: true
+                                    });
                                 }
                             }
                         },
@@ -599,16 +603,6 @@ define(['require',
                     that.hideLoader();
                 }
             },
-            setUrl: function(url, create) {
-                Utils.setUrl({
-                    url: url,
-                    mergeBrowserUrl: false,
-                    trigger: true,
-                    updateTabState: function() {
-                        return { tagUrl: this.url, stateChanged: true };
-                    }
-                });
-            },
             showLoader: function() {
                 this.$('.entityLoader').show();
                 this.$('.entityInputData').hide();

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/138bc6f1/dashboardv2/public/js/views/schema/SchemaLayoutView.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/views/schema/SchemaLayoutView.js b/dashboardv2/public/js/views/schema/SchemaLayoutView.js
index d069c44..6f9b6e3 100644
--- a/dashboardv2/public/js/views/schema/SchemaLayoutView.js
+++ b/dashboardv2/public/js/views/schema/SchemaLayoutView.js
@@ -246,7 +246,7 @@ define(['require',
                     });
                 });
             },
-            getSchemaTableColumns: function(deleteEnity) {
+            getSchemaTableColumns: function() {
                 var that = this,
                     col = {
                         Check: {

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/138bc6f1/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 50e4a54..cf751e8 100644
--- a/dashboardv2/public/js/views/search/SearchResultLayoutView.js
+++ b/dashboardv2/public/js/views/search/SearchResultLayoutView.js
@@ -126,7 +126,7 @@ define(['require',
              * @constructs
              */
             initialize: function(options) {
-                _.extend(this, _.pick(options, 'value', 'initialView', 'entityDefCollection',
'typeHeaders', 'searchVent', 'enumDefCollection'));
+                _.extend(this, _.pick(options, 'value', 'initialView', 'entityDefCollection',
'typeHeaders', 'searchVent', 'enumDefCollection', 'tagCollection'));
                 var pagination = "";
                 this.entityModel = new VEntity();
                 this.searchCollection = new VSearchList();

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/138bc6f1/dashboardv2/public/js/views/tag/TagDetailLayoutView.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/views/tag/TagDetailLayoutView.js b/dashboardv2/public/js/views/tag/TagDetailLayoutView.js
index 5007427..3bb27c3 100644
--- a/dashboardv2/public/js/views/tag/TagDetailLayoutView.js
+++ b/dashboardv2/public/js/views/tag/TagDetailLayoutView.js
@@ -44,7 +44,7 @@ define(['require',
              * @constructs
              */
             initialize: function(options) {
-                _.extend(this, _.pick(options, 'tag', 'collection', 'entityDefCollection',
'typeHeaders'));
+                _.extend(this, _.pick(options, 'tag', 'collection', 'entityDefCollection',
'typeHeaders', 'enumDefCollection'));
             },
             bindEvents: function() {},
             onRender: function() {
@@ -58,20 +58,26 @@ define(['require',
                         'tag': that.tag,
                         'searchType': 'basic'
                     };
-                    that.RSearchResultLayoutView.show(new SearchResultLayoutView({
-                        value: value,
-                        entityDefCollection: that.entityDefCollection,
-                        typeHeaders: that.typeHeaders
-                    }));
+                    if (that.RSearchResultLayoutView) {
+                        that.RSearchResultLayoutView.show(new SearchResultLayoutView({
+                            value: value,
+                            entityDefCollection: that.entityDefCollection,
+                            typeHeaders: that.typeHeaders,
+                            tagCollection: that.collection,
+                            enumDefCollection: that.enumDefCollection
+                        }));
+                    }
                 });
             },
             renderTagAttributeCompositeView: function() {
                 var that = this;
                 require(['views/tag/TagAttributeDetailLayoutView'], function(TagAttributeDetailLayoutView)
{
-                    that.RTagAttributeDetailLayoutView.show(new TagAttributeDetailLayoutView({
-                        tag: that.tag,
-                        collection: that.collection
-                    }));
+                    if (that.RTagAttributeDetailLayoutView) {
+                        that.RTagAttributeDetailLayoutView.show(new TagAttributeDetailLayoutView({
+                            tag: that.tag,
+                            collection: that.collection
+                        }));
+                    }
                 });
             }
         });

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/138bc6f1/dashboardv2/public/js/views/tag/TagLayoutView.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/views/tag/TagLayoutView.js b/dashboardv2/public/js/views/tag/TagLayoutView.js
index ae7c594..a5b5665 100644
--- a/dashboardv2/public/js/views/tag/TagLayoutView.js
+++ b/dashboardv2/public/js/views/tag/TagLayoutView.js
@@ -97,30 +97,40 @@ define(['require',
                 }
             },
             setValues: function(manual) {
+                var $firstEl = this.ui.tagsParent.find('li a') ? this.ui.tagsParent.find('li
a').first() : null;
                 if (Utils.getUrlState.isTagTab()) {
                     if (!this.tag) {
                         this.selectFirst = false;
                         this.ui.tagsParent.find('li').first().addClass('active');
-                        if (this.ui.tagsParent.find('li a').first().length) {
+                        if ($firstEl && $firstEl.length) {
+                            url: $firstEl.attr("href"),
                             Utils.setUrl({
-                                url: this.ui.tagsParent.find('li a').first().attr("href"),
+                                url: $firstEl.attr("href"),
                                 mergeBrowserUrl: false,
-                                trigger: true,
                                 updateTabState: function() {
                                     return { tagUrl: this.url, stateChanged: true };
                                 }
                             });
                         }
                     } else {
+                        var presentTag = this.collection.fullCollection.findWhere({ name:
this.tag }),
+                            url = Utils.getUrlState.getQueryUrl().hash,
+                            tag = this.tag,
+                            query = null;
+                        if (!presentTag) {
+                            tag = $firstEl.data('name');
+                            url = $firstEl && $firstEl.length ? $firstEl.attr("href")
: '#!/tag';
+                            query = $firstEl && $firstEl.length ? { dlttag: true
} : null
+                        }
                         Utils.setUrl({
-                            url: Utils.getUrlState.getQueryUrl().hash,
+                            url: url,
+                            urlParams: query,
                             updateTabState: function() {
                                 return { tagUrl: this.url, stateChanged: true };
                             }
                         });
-                        var tag = Utils.getUrlState.getLastValue();
-                        if (this.tag) {
-                            tag = this.tag;
+                        if (!presentTag) {
+                            return false;
                         }
                         this.ui.tagsParent.find('li').removeClass('active');
                         var target = this.ui.tagsParent.find('li').filter(function() {
@@ -399,26 +409,14 @@ define(['require',
                         Utils.notifySuccess({
                             content: "Tag " + that.tagName + Messages.deleteSuccessMessage
                         });
+                        // if deleted tag is prviously searched then remove that tag url
from save state of tab.
                         var searchUrl = Globals.saveApplicationState.tabState.searchUrl;
                         var urlObj = Utils.getUrlState.getQueryParams(searchUrl);
                         if (urlObj && urlObj.tag && urlObj.tag === that.tagName)
{
                             Globals.saveApplicationState.tabState.searchUrl = "#!/search";
                         }
-                        that.ui.tagsParent.find('li.active').removeClass('active');
-                        if (that.tagDeleteData.prev().length === 0) {
-                            that.tagDeleteData.next().addClass('active');
-                        } else {
-                            that.tagDeleteData.prev().addClass('active');
-                        }
-                        Utils.setUrl({
-                            url: that.ui.tagsParent.find('li.active').find("a").attr("href"),
-                            mergeBrowserUrl: false,
-                            trigger: true,
-                            updateTabState: function() {
-                                return { tagUrl: that.url, stateChanged: true };
-                            }
-                        });
                         that.collection.remove(deleteTagData);
+                        // to update tag list of search tab fetch typeHeaders.
                         that.typeHeaders.fetch({ reset: true });
                     }
                 });


Mime
View raw message