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 2019/11/14 09:11:56 UTC

[atlas] branch branch-2.0 updated (7e3990b -> 87e5446)

This is an automated email from the ASF dual-hosted git repository.

nixon pushed a change to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/atlas.git.


    from 7e3990b  ATLAS-3517: Enhance suggestions REST API to have optional 'fieldName' parameter to get suggestions from
     new 33d72f2  ATLAS-3521 : UI: Use existing labels from other entities
     new 87e5446  ATLAS-3513 : Classic UI: Sidebar not rendered on refresh if url has 'from=classification' queryParam

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 dashboardv2/public/js/router/Router.js             |  5 ++-
 dashboardv2/public/js/utils/CommonViewFunction.js  |  2 +-
 dashboardv2/public/js/utils/Enums.js               |  4 +-
 .../js/views/entity/EntityLabelDefineView.js       | 43 ++++++++++++++++++----
 .../public/js/views/site/SideNavLayoutView.js      |  2 +-
 dashboardv3/public/js/router/Router.js             |  9 +++--
 .../js/views/entity/EntityLabelDefineView.js       | 41 +++++++++++++++++----
 7 files changed, 80 insertions(+), 26 deletions(-)


[atlas] 01/02: ATLAS-3521 : UI: Use existing labels from other entities

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nixon pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/atlas.git

commit 33d72f2d29f79aeb25bdd9cfb1ff1a93ee47bbcb
Author: kevalbhatt <kb...@apache.org>
AuthorDate: Tue Nov 12 18:19:35 2019 +0530

    ATLAS-3521 : UI: Use existing labels from other entities
    
    Signed-off-by: nixonrodrigues <ni...@apache.org>
    (cherry picked from commit 72243644900495436975161bf797bc53f4cf0d0e)
---
 .../js/views/entity/EntityLabelDefineView.js       | 43 ++++++++++++++++++----
 .../js/views/entity/EntityLabelDefineView.js       | 41 +++++++++++++++++----
 2 files changed, 69 insertions(+), 15 deletions(-)

diff --git a/dashboardv2/public/js/views/entity/EntityLabelDefineView.js b/dashboardv2/public/js/views/entity/EntityLabelDefineView.js
index 4f971ab..f45660b 100644
--- a/dashboardv2/public/js/views/entity/EntityLabelDefineView.js
+++ b/dashboardv2/public/js/views/entity/EntityLabelDefineView.js
@@ -23,8 +23,9 @@ define(['require',
     'utils/Utils',
     'utils/Messages',
     'utils/Enums',
+    'utils/UrlLinks',
     'utils/CommonViewFunction',
-], function(require, Backbone, EntityLabelDefineView_tmpl, VEntity, Utils, Messages, Enums, CommonViewFunction) {
+], function(require, Backbone, EntityLabelDefineView_tmpl, VEntity, Utils, Messages, Enums, UrlLinks, CommonViewFunction) {
     'use strict';
 
     return Backbone.Marionette.LayoutView.extend({
@@ -72,16 +73,42 @@ define(['require',
                     return "<option selected > " + label + " </option>";
                 });
             this.ui.addLabelOptions.html(str);
+            var getLabelData = function(data, selectedData) {
+                if (data.suggestions) {
+                    return _.map(data.suggestions, function(name, index) {
+                        var findValue = _.find(selectedData, { id: name })
+                        if (findValue) {
+                            return findValue;
+                        } else {
+                            return {
+                                id: name,
+                                text: name
+                            }
+                        }
+                    });
+                } else {
+                    return []
+                }
+            };
             this.ui.addLabelOptions.select2({
                 placeholder: "Select Label",
                 allowClear: false,
                 tags: true,
                 multiple: true,
-                matcher: function(params, data) {
-                    if (params.term === data.text) {
-                        return data;
-                    }
-                    return null;
+                ajax: {
+                    url: UrlLinks.searchApiUrl('suggestions'),
+                    dataType: 'json',
+                    delay: 250,
+                    data: function(params) {
+                        return {
+                            prefixString: _.escape(params.term), // search term
+                            fieldName: '__labels'
+                        };
+                    },
+                    processResults: function(data, params) {
+                        return { results: getLabelData(data, this.$element.select2("data")) };
+                    },
+                    cache: true
                 },
                 templateResult: this.formatResultSearch
             });
@@ -91,7 +118,7 @@ define(['require',
                 return state.text;
             }
             if (!state.element) {
-                return $("<span>Add<strong> '" + state.text + "'</strong></span>");
+                return $("<span>Add<strong> '" + _.escape(state.text) + "'</strong></span>");
             }
         },
         onChangeLabelChange: function() {
@@ -116,7 +143,7 @@ define(['require',
                     type: 'POST',
                     success: function() {
                         var msg = entityJson.labels === undefined ? 'addSuccessMessage' : 'editSuccessMessage',
-                        caption = "One or more label";
+                            caption = "One or more label";
                         if (payload.length === 0) {
                             msg = 'removeSuccessMessage';
                             caption = "One or more existing label";
diff --git a/dashboardv3/public/js/views/entity/EntityLabelDefineView.js b/dashboardv3/public/js/views/entity/EntityLabelDefineView.js
index a003d2c..7dd7555 100644
--- a/dashboardv3/public/js/views/entity/EntityLabelDefineView.js
+++ b/dashboardv3/public/js/views/entity/EntityLabelDefineView.js
@@ -23,8 +23,9 @@ define(['require',
     'utils/Utils',
     'utils/Messages',
     'utils/Enums',
+    'utils/UrlLinks',
     'utils/CommonViewFunction',
-], function(require, Backbone, EntityLabelDefineView_tmpl, VEntity, Utils, Messages, Enums, CommonViewFunction) {
+], function(require, Backbone, EntityLabelDefineView_tmpl, VEntity, Utils, Messages, Enums, UrlLinks, CommonViewFunction) {
     'use strict';
 
     return Backbone.Marionette.LayoutView.extend({
@@ -72,16 +73,42 @@ define(['require',
                     return "<option selected > " + label + " </option>";
                 });
             this.ui.addLabelOptions.html(str);
+            var getLabelData = function(data, selectedData) {
+                if (data.suggestions) {
+                    return _.map(data.suggestions, function(name, index) {
+                        var findValue = _.find(selectedData, { id: name })
+                        if (findValue) {
+                            return findValue;
+                        } else {
+                            return {
+                                id: name,
+                                text: name
+                            }
+                        }
+                    });
+                } else {
+                    return []
+                }
+            };
             this.ui.addLabelOptions.select2({
                 placeholder: "Select Label",
                 allowClear: false,
                 tags: true,
                 multiple: true,
-                matcher: function(params, data) {
-                    if (params.term === data.text) {
-                        return data;
-                    }
-                    return null;
+                ajax: {
+                    url: UrlLinks.searchApiUrl('suggestions'),
+                    dataType: 'json',
+                    delay: 250,
+                    data: function(params) {
+                        return {
+                            prefixString: _.escape(params.term), // search term
+                            fieldName: '__labels'
+                        };
+                    },
+                    processResults: function(data, params) {
+                        return { results: getLabelData(data, this.$element.select2("data")) };
+                    },
+                    cache: true
                 },
                 templateResult: this.formatResultSearch
             });
@@ -91,7 +118,7 @@ define(['require',
                 return state.text;
             }
             if (!state.element) {
-                return $("<span>Add<strong> '" + state.text + "'</strong></span>");
+                return $("<span>Add<strong> '" +  _.escape(state.text) + "'</strong></span>");
             }
         },
         onChangeLabelChange: function() {


[atlas] 02/02: ATLAS-3513 : Classic UI: Sidebar not rendered on refresh if url has 'from=classification' queryParam

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nixon pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/atlas.git

commit 87e544681f334edffa14bdde9605e4572fe06746
Author: kevalbhatt <kb...@apache.org>
AuthorDate: Tue Nov 12 18:02:48 2019 +0530

    ATLAS-3513 : Classic UI: Sidebar not rendered on refresh if url has 'from=classification' queryParam
    
    Signed-off-by: nixonrodrigues <ni...@apache.org>
    (cherry picked from commit a9672da056cfda5bda29fb9589498d652aad46d9)
---
 dashboardv2/public/js/router/Router.js                | 5 +++--
 dashboardv2/public/js/utils/CommonViewFunction.js     | 2 +-
 dashboardv2/public/js/utils/Enums.js                  | 4 +---
 dashboardv2/public/js/views/site/SideNavLayoutView.js | 2 +-
 dashboardv3/public/js/router/Router.js                | 9 +++++----
 5 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/dashboardv2/public/js/router/Router.js b/dashboardv2/public/js/router/Router.js
index 8a0bee0..963d63e 100644
--- a/dashboardv2/public/js/router/Router.js
+++ b/dashboardv2/public/js/router/Router.js
@@ -295,8 +295,9 @@ define([
                         }, that.preFetchedCollectionLists, that.sharedObj)
                     ));
                 } else {
-                    App.rNContent.$el.html("");
-                    App.rNContent.destroy();
+                    if (App.rNContent.currentView) {
+                        App.rNContent.currentView.destroy();
+                    }
                 }
             });
         },
diff --git a/dashboardv2/public/js/utils/CommonViewFunction.js b/dashboardv2/public/js/utils/CommonViewFunction.js
index 6877dfe..6ff40bb 100644
--- a/dashboardv2/public/js/utils/CommonViewFunction.js
+++ b/dashboardv2/public/js/utils/CommonViewFunction.js
@@ -37,7 +37,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
                                 skipDefaultError: true,
                                 success: function(data) {
                                     Utils.notifySuccess({
-                                        content: "Classification " + options.tagName + Messages.getAbbreviationMsg(abbrev, 'removeSuccessMessage')
+                                        content: "Classification " + options.tagName + Messages.getAbbreviationMsg(false, 'removeSuccessMessage')
                                     });
                                     if (options.callback) {
                                         options.callback();
diff --git a/dashboardv2/public/js/utils/Enums.js b/dashboardv2/public/js/utils/Enums.js
index 74a08d9..c7316d5 100644
--- a/dashboardv2/public/js/utils/Enums.js
+++ b/dashboardv2/public/js/utils/Enums.js
@@ -35,9 +35,7 @@ define(['require'], function(require) {
         ENTITY_IMPORT_UPDATE: "Entity Updated by import",
         ENTITY_IMPORT_DELETE: "Entity Deleted by import",
         TERM_ADD: "Term Added",
-        TERM_DELETE: "Term Deleted",
-        LABEL_ADD: "Label Added",
-        LABEL_DELETE: "Label Deleted"
+        TERM_DELETE: "Term Deleted"
     }
 
     Enums.entityStateReadOnly = {
diff --git a/dashboardv2/public/js/views/site/SideNavLayoutView.js b/dashboardv2/public/js/views/site/SideNavLayoutView.js
index 87cf4e8..e5552a5 100644
--- a/dashboardv2/public/js/views/site/SideNavLayoutView.js
+++ b/dashboardv2/public/js/views/site/SideNavLayoutView.js
@@ -127,7 +127,7 @@ define(['require',
                     view = "search";
                 if (queryParams && queryParams.from) {
                     if (queryParams.from == "classification") {
-                        view = "tag";
+                        view = "classification";
                     } else if (queryParams.from == "glossary") {
                         view = "glossary";
                     }
diff --git a/dashboardv3/public/js/router/Router.js b/dashboardv3/public/js/router/Router.js
index d069b96..dc09d29 100644
--- a/dashboardv3/public/js/router/Router.js
+++ b/dashboardv3/public/js/router/Router.js
@@ -268,7 +268,7 @@ define([
             var that = this;
             require(["views/site/Header", "views/search/SearchDefaultLayoutView", "views/site/SideNavLayoutView"], function(Header, SearchDefaultLayoutView, SideNavLayoutView) {
                 var paramObj = Utils.getUrlState.getQueryParams();
-                if (paramObj && (paramObj.type || paramObj.tag || paramObj.term || paramObj.query) === undefined) {
+                if (paramObj && (paramObj.type || paramObj.tag || paramObj.term || paramObj.query || paramObj.udKeys || paramObj.udLabels) === undefined) {
                     Utils.setUrl({
                         url: "#!/search",
                         mergeBrowserUrl: false,
@@ -581,8 +581,9 @@ define([
                         )
                     );
                 } else {
-                    App.rContent.$el.html("");
-                    App.rContent.destroy();
+                    if (App.rNContent.currentView) {
+                        App.rNContent.currentView.destroy();
+                    }
                 }
             });
         },
@@ -599,4 +600,4 @@ define([
         }
     });
     return AppRouter;
-});
+});
\ No newline at end of file