You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ma...@apache.org on 2019/03/18 11:16:50 UTC

[atlas] branch branch-1.0 updated: ATLAS-3076: UI: Relationship Tab improvements - #2

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

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


The following commit(s) were added to refs/heads/branch-1.0 by this push:
     new f9862c2  ATLAS-3076: UI: Relationship Tab improvements - #2
f9862c2 is described below

commit f9862c22ced22e41eb1821c4d81adddcc105b5b0
Author: gutkaBinit <bi...@gmail.com>
AuthorDate: Mon Mar 18 13:07:49 2019 +0530

    ATLAS-3076: UI: Relationship Tab improvements - #2
    
    Signed-off-by: Madhan Neethiraj <ma...@apache.org>
    (cherry picked from commit 8fc70a32303def4d85755cbf6466ab6e4c0e72e6)
---
 dashboardv2/public/js/utils/CommonViewFunction.js   | 21 +++++++++++----------
 dashboardv2/public/js/views/common/Statistics.js    |  7 +++++--
 .../public/js/views/graph/RelationshipLayoutView.js |  2 +-
 3 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/dashboardv2/public/js/utils/CommonViewFunction.js b/dashboardv2/public/js/utils/CommonViewFunction.js
index 2aa825a..4265a09 100644
--- a/dashboardv2/public/js/utils/CommonViewFunction.js
+++ b/dashboardv2/public/js/utils/CommonViewFunction.js
@@ -78,18 +78,20 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Glob
             extractJSON = options.extractJSON,
             isTable = _.isUndefined(options.isTable) ? true : options.isTable,
             attributeDefs = options.attributeDefs,
-            numberFormat = options.numberFormat;
+            formatIntVal = options.formatIntVal,
+            showListCount = options.showListCount || true,
+            numberFormat = options.numberFormat || _.numberFormatWithComa;
 
         var table = "",
             getValue = function(val) {
-                if (val && numberFormat) {
-                    if (_.isNumber(val)) {
-                        return numberFormat(val);
-                    } else if (!_.isNaN(parseInt(val))) {
+                if (val) {
+                    if ((_.isNumber(val) || !_.isNaN(parseInt(val))) && formatIntVal) {
                         return numberFormat(val);
+                    } else {
+                        return val;
                     }
                 } else {
-                    return val || "N/A";
+                    return "N/A";
                 }
             },
             fetchInputOutputValue = function(id, defEntity) {
@@ -226,8 +228,8 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Glob
             if (key == "profileData") {
                 return;
             }
-            var keyValue = valueObject[key];
-            var count = _.isArray(keyValue) ? (keyValue.length) : 0;
+            var keyValue = valueObject[key],
+                listCount = showListCount && _.isArray(keyValue) && keyValue.length > 0 ? ' (' + numberFormat(keyValue.length) + ')' : "";
             var defEntity = _.find(attributeDefs, { name: key });
             if (defEntity && defEntity.typeName) {
                 var defEntityType = defEntity.typeName.toLocaleLowerCase();
@@ -264,8 +266,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Glob
                         htmlTag = '<pre class="shrink code-block ' + (isMatchJSONStringIsSingle ? 'fixed-height' : '') + '">' + expandCollapseButton + '<code>' + val + '</code></pre>';
                     }
                 }
-                var textToDisplay = count > 0 ? ' (' + getValue(count) + ')' : '';
-                table += '<tr><td>' + _.escape(key) + textToDisplay + '</td><td>' + htmlTag + '</td></tr>';
+                table += '<tr><td>' + (_.escape(key) + listCount) + '</td><td>' + htmlTag + '</td></tr>';
             } else {
                 table += '<div>' + val + '</div>';
             }
diff --git a/dashboardv2/public/js/views/common/Statistics.js b/dashboardv2/public/js/views/common/Statistics.js
index 8a44ce6..fc1596a 100644
--- a/dashboardv2/public/js/views/common/Statistics.js
+++ b/dashboardv2/public/js/views/common/Statistics.js
@@ -70,8 +70,8 @@ define(['require',
                     success: function(data) {
                         var data = _.first(data.toJSON()),
                             no_records = '<tr class="empty text-center"><td colspan="2"><span>No records found!</span></td></tr>',
-                            activeEntityTable = _.isEmpty(data.entity.entityActive) ? no_records : CommonViewFunction.propertyTable({ scope: that, valueObject: data.entity.entityActive, numberFormat: _.numberFormatWithComa }),
-                            deleteEntityTable = _.isEmpty(data.entity.entityDeleted) ? no_records : CommonViewFunction.propertyTable({ scope: that, valueObject: data.entity.entityDeleted, numberFormat: _.numberFormatWithComa });
+                            activeEntityTable = _.isEmpty(data.entity.entityActive) ? no_records : that.getTable({ valueObject: data.entity.entityActive }),
+                            deleteEntityTable = _.isEmpty(data.entity.entityDeleted) ? no_records : that.getTable({ valueObject: data.entity.entityDeleted });
                         var totalActive = 0,
                             totalDeleted = 0;
                         if (data.entity && data.general.entityCount) {
@@ -88,6 +88,9 @@ define(['require',
                         that.ui.entityDeletedHeader.html("&nbsp;(" + _.numberFormatWithComa(totalDeleted) + ")");
                     }
                 });
+            },
+            getTable: function(obj) {
+                return CommonViewFunction.propertyTable(_.extend({ scope: this, formatIntVal: true }, obj))
             }
         });
     return StatisticsView;
diff --git a/dashboardv2/public/js/views/graph/RelationshipLayoutView.js b/dashboardv2/public/js/views/graph/RelationshipLayoutView.js
index 8fec580..3b49941 100644
--- a/dashboardv2/public/js/views/graph/RelationshipLayoutView.js
+++ b/dashboardv2/public/js/views/graph/RelationshipLayoutView.js
@@ -460,7 +460,7 @@ define(['require',
             },
             createTable: function() {
                 this.entityModel = new VEntity({});
-                var table = CommonViewFunction.propertyTable({ scope: this, valueObject: this.entity.relationshipAttributes, attributeDefs: this.attributeDefs, numberFormat: _.numberFormatWithComa });
+                var table = CommonViewFunction.propertyTable({ scope: this, valueObject: this.entity.relationshipAttributes, attributeDefs: this.attributeDefs });
                 this.ui.relationshipDetailValue.html(table);
             },
             relationshipViewToggle: function(checked) {