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

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

commit e5895ddfab09060b6e4b603d8462faafae532bf1
Author: kevalbhatt <[email protected]>
AuthorDate: Wed Jun 10 13:04:39 2020 +0530

    ATLAS-3829:- UI: Clicking on meanings from relationship tab should redirect 
to terms details page.
    
    (cherry picked from commit f4e1e6b0ec58febac3d72d20d4a40a8f218d74e1)
---
 dashboardv2/public/js/utils/CommonViewFunction.js  | 23 ++++++++++++++--------
 .../js/views/graph/RelationshipLayoutView.js       | 12 ++++++++---
 dashboardv3/public/js/utils/CommonViewFunction.js  | 23 ++++++++++++++--------
 .../js/views/graph/RelationshipLayoutView.js       | 13 ++++++++----
 4 files changed, 48 insertions(+), 23 deletions(-)

diff --git a/dashboardv2/public/js/utils/CommonViewFunction.js 
b/dashboardv2/public/js/utils/CommonViewFunction.js
index b4ee73f..36837f1 100644
--- a/dashboardv2/public/js/utils/CommonViewFunction.js
+++ b/dashboardv2/public/js/utils/CommonViewFunction.js
@@ -109,13 +109,13 @@ define(['require', 'utils/Utils', 'modules/Modal', 
'utils/Messages', 'utils/Enum
                         var newVal = val;
                         if (formatStringVal) {
                             newVal = parseInt(val);
-                            if (newVal === NaN) {
+                            if (_.isNaN(newVal)) {
                                 newVal = val;
                             } else {
                                 newVal = numberFormat(newVal);
                             }
                         }
-                        return getHighlightedString(newVal);
+                        return getHighlightedString(_.escape(newVal));
                     }
                 } else {
                     return "N/A";
@@ -179,7 +179,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 
'utils/Messages', 'utils/Enum
                     if (_.isString(inputOutputField) || 
_.isBoolean(inputOutputField) || _.isNumber(inputOutputField)) {
                         var tempVarfor$check = inputOutputField.toString();
                         if (tempVarfor$check.indexOf("$") == -1) {
-                            valueOfArray.push('<span class="json-string">' + 
getValue(_.escape(inputOutputField)) + '</span>');
+                            valueOfArray.push('<span class="json-string">' + 
getValue(inputOutputField) + '</span>');
                         }
                     } else if (_.isObject(inputOutputField) && !id) {
                         var attributesList = inputOutputField;
@@ -220,7 +220,11 @@ define(['require', 'utils/Utils', 'modules/Modal', 
'utils/Messages', 'utils/Enum
                             fetchInputOutputValue(fetchId, defEntity);
                             tempLink += '<div data-id="' + fetchId + '"><div 
class="value-loader"></div></div>';
                         } else {
-                            tempLink += '<a href="#!/detailPage/' + id + '">' 
+ getValue(name) + '</a>'
+                            if (inputOutputField.typeName == 
"AtlasGlossaryTerm") {
+                                tempLink += '<a href="#!/glossary/' + id + 
'?guid=' + id + '&gType=term&viewType=term&fromView=entity">' + getValue(name) 
+ '</a>'
+                            } else {
+                                tempLink += '<a href="#!/detailPage/' + id + 
'">' + getValue(name) + '</a>'
+                            }
                         }
                     }
                     if (readOnly) {
@@ -250,7 +254,6 @@ define(['require', 'utils/Utils', 'modules/Modal', 
'utils/Messages', 'utils/Enum
             valueObjectKeysList = _.sortBy(valueObjectKeysList);
         }
         valueObjectKeysList.map(function(key) {
-
             key = _.escape(key);
             if (key == "profileData") {
                 return;
@@ -274,11 +277,15 @@ define(['require', 'utils/Utils', 'modules/Modal', 
'utils/Messages', 'utils/Enum
             if (_.isObject(valueObject[key])) {
                 val = keyValue
             } else if (Utils.isUrl(keyValue)) {
-                val = '<a target="_blank" class="blue-link" href="' + keyValue 
+ '">' + getValue(keyValue) + '</a>';
+                val = '<a target="_blank" class="blue-link" href="' + 
_.escape(keyValue) + '">' + getValue(keyValue) + '</a>';
             } else if (key === 'guid' || key === "__guid") {
-                val = '<a title="' + key + '" href="#!/detailPage/' + keyValue 
+ '">' + getValue(keyValue) + '</a>';
+                if (options.fromAdminAudit) {
+                    val = getValue(keyValue);
+                } else {
+                    val = '<a title="' + key + '" href="#!/detailPage/' + 
_.escape(keyValue) + '">' + getValue(keyValue) + '</a>';
+                }
             } else {
-                val = getValue(_.escape(keyValue));
+                val = getValue(keyValue);
             }
             if (isTable) {
                 var value = val,
diff --git a/dashboardv2/public/js/views/graph/RelationshipLayoutView.js 
b/dashboardv2/public/js/views/graph/RelationshipLayoutView.js
index c378716..3379a66 100644
--- a/dashboardv2/public/js/views/graph/RelationshipLayoutView.js
+++ b/dashboardv2/public/js/views/graph/RelationshipLayoutView.js
@@ -156,9 +156,15 @@ define(['require',
                                     name = obj.name,
                                     typeName = options.typeName;
 
-                                return "<li class=" + status + ">" +
-                                    "<a style='color:" + entityColor + "' 
href=#!/detailPage/" + guid + "?tabActive=relationship>" + name + " (" + 
typeName + ")</a>" +
-                                    "</li>";
+                                if (typeName === "AtlasGlossaryTerm") {
+                                    return '<li class=' + status + '>' +
+                                        '<a style="color:' + entityColor + '" 
href="#!/glossary/' + guid + '?guid=' + guid + 
'&gType=term&viewType=term&fromView=entity">' + name + ' (' + typeName + 
')</a>' +
+                                        '</li>';
+                                } else {
+                                    return "<li class=" + status + ">" +
+                                        "<a style='color:" + entityColor + "' 
href=#!/detailPage/" + guid + "?tabActive=relationship>" + name + " (" + 
typeName + ")</a>" +
+                                        "</li>";
+                                }
                             },
                             getWithButton = function(obj) {
                                 var options = obj.options,
diff --git a/dashboardv3/public/js/utils/CommonViewFunction.js 
b/dashboardv3/public/js/utils/CommonViewFunction.js
index 06438f3..77b5b10 100644
--- a/dashboardv3/public/js/utils/CommonViewFunction.js
+++ b/dashboardv3/public/js/utils/CommonViewFunction.js
@@ -109,13 +109,13 @@ define(['require', 'utils/Utils', 'modules/Modal', 
'utils/Messages', 'utils/Enum
                         var newVal = val;
                         if (formatStringVal) {
                             newVal = parseInt(val);
-                            if (newVal === NaN) {
+                            if (_.isNaN(newVal)) {
                                 newVal = val;
                             } else {
                                 newVal = numberFormat(newVal);
                             }
                         }
-                        return getHighlightedString(newVal);
+                        return getHighlightedString(_.escape(newVal));
                     }
                 } else {
                     return "N/A";
@@ -179,7 +179,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 
'utils/Messages', 'utils/Enum
                     if (_.isString(inputOutputField) || 
_.isBoolean(inputOutputField) || _.isNumber(inputOutputField)) {
                         var tempVarfor$check = inputOutputField.toString();
                         if (tempVarfor$check.indexOf("$") == -1) {
-                            valueOfArray.push('<span class="json-string">' + 
getValue(_.escape(inputOutputField)) + '</span>');
+                            valueOfArray.push('<span class="json-string">' + 
getValue(inputOutputField) + '</span>');
                         }
                     } else if (_.isObject(inputOutputField) && !id) {
                         var attributesList = inputOutputField;
@@ -220,7 +220,11 @@ define(['require', 'utils/Utils', 'modules/Modal', 
'utils/Messages', 'utils/Enum
                             fetchInputOutputValue(fetchId, defEntity);
                             tempLink += '<div data-id="' + fetchId + '"><div 
class="value-loader"></div></div>';
                         } else {
-                            tempLink += '<a href="#!/detailPage/' + id + '">' 
+ getValue(name) + '</a>'
+                            if (inputOutputField.typeName == 
"AtlasGlossaryTerm") {
+                                tempLink += '<a href="#!/glossary/' + id + 
'?guid=' + id + '&gType=term&viewType=term">' + getValue(name) + '</a>'
+                            } else {
+                                tempLink += '<a href="#!/detailPage/' + id + 
'">' + getValue(name) + '</a>'
+                            }
                         }
                     }
                     if (readOnly) {
@@ -250,7 +254,6 @@ define(['require', 'utils/Utils', 'modules/Modal', 
'utils/Messages', 'utils/Enum
             valueObjectKeysList = _.sortBy(valueObjectKeysList);
         }
         valueObjectKeysList.map(function(key) {
-
             key = _.escape(key);
             if (key == "profileData") {
                 return;
@@ -274,11 +277,15 @@ define(['require', 'utils/Utils', 'modules/Modal', 
'utils/Messages', 'utils/Enum
             if (_.isObject(valueObject[key])) {
                 val = keyValue
             } else if (Utils.isUrl(keyValue)) {
-                val = '<a target="_blank" class="blue-link" href="' + keyValue 
+ '">' + getValue(keyValue) + '</a>';
+                val = '<a target="_blank" class="blue-link" href="' + 
_.escape(keyValue) + '">' + getValue(keyValue) + '</a>';
             } else if (key === 'guid' || key === "__guid") {
-                val = '<a title="' + key + '" href="#!/detailPage/' + keyValue 
+ '">' + getValue(keyValue) + '</a>';
+                if (options.fromAdminAudit) {
+                    val = getValue(keyValue);
+                } else {
+                    val = '<a title="' + key + '" href="#!/detailPage/' + 
_.escape(keyValue) + '">' + getValue(keyValue) + '</a>';
+                }
             } else {
-                val = getValue(_.escape(keyValue));
+                val = getValue(keyValue);
             }
             if (isTable) {
                 var value = val,
diff --git a/dashboardv3/public/js/views/graph/RelationshipLayoutView.js 
b/dashboardv3/public/js/views/graph/RelationshipLayoutView.js
index f44f72b..8c58faf 100644
--- a/dashboardv3/public/js/views/graph/RelationshipLayoutView.js
+++ b/dashboardv3/public/js/views/graph/RelationshipLayoutView.js
@@ -159,10 +159,15 @@ define(['require',
                                     entityColor = obj.color,
                                     name = obj.name,
                                     typeName = options.typeName;
-
-                                return "<li class=" + status + ">" +
-                                    "<a style='color:" + entityColor + "' 
href=#!/detailPage/" + guid + "?tabActive=relationship>" + name + " (" + 
typeName + ")</a>" +
-                                    "</li>";
+                                if (typeName === "AtlasGlossaryTerm") {
+                                    return '<li class=' + status + '>' +
+                                        '<a style="color:' + entityColor + '" 
href="#!/glossary/' + guid + '?guid=' + guid + '&gType=term&viewType=term">' + 
name + ' (' + typeName + ')</a>' +
+                                        '</li>';
+                                } else {
+                                    return "<li class=" + status + ">" +
+                                        "<a style='color:" + entityColor + "' 
href=#!/detailPage/" + guid + "?tabActive=relationship>" + name + " (" + 
typeName + ")</a>" +
+                                        "</li>";
+                                }
                             },
                             getWithButton = function(obj) {
                                 var options = obj.options,

Reply via email to