You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by kb...@apache.org on 2019/01/14 09:07:22 UTC

[atlas] branch branch-1.0 updated: ATLAS-2994 UI - If Hide deleted entity filter is applied then to UI displays deleted entity in lineage

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

kbhatt 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 8f65a33  ATLAS-2994 UI - If Hide deleted entity filter is applied then to UI displays deleted entity in lineage
8f65a33 is described below

commit 8f65a33c9b65204c043c7612b9ba0ade669ab136
Author: Abhishek Kadam <ab...@gmail.com>
AuthorDate: Fri Jan 11 14:40:31 2019 +0530

    ATLAS-2994 UI - If Hide deleted entity filter is applied then to UI displays deleted entity in lineage
    
    (cherry picked from commit 90b0e20aa310da9398a8a3e978ab97782a811a0a)
    Signed-off-by: kevalbhatt <kb...@apache.org>
---
 .../public/js/views/graph/LineageLayoutView.js     | 45 +++++++++++++++-------
 1 file changed, 32 insertions(+), 13 deletions(-)

diff --git a/dashboardv2/public/js/views/graph/LineageLayoutView.js b/dashboardv2/public/js/views/graph/LineageLayoutView.js
index 804dbe7..66b20ba 100644
--- a/dashboardv2/public/js/views/graph/LineageLayoutView.js
+++ b/dashboardv2/public/js/views/graph/LineageLayoutView.js
@@ -203,24 +203,31 @@ define(['require',
             generateData: function(relations, guidEntityMap) {
                 var that = this;
 
-                function isProcess(typeName) {
-                    if (typeName == "Process") {
+                function isProcess(node) {
+                    if (_.isUndefined(node) || node.typeName == "Process") {
                         return true;
                     }
-                    var entityDef = that.entityDefCollection.fullCollection.find({ name: typeName });
+                    var entityDef = that.entityDefCollection.fullCollection.find({ name: node.typeName });
                     return _.contains(Utils.getNestedSuperTypes({ data: entityDef.toJSON(), collection: that.entityDefCollection }), "Process")
                 }
 
-                function isDeleted(status) {
-                    return Enums.entityStateReadOnly[status];
+                function isDeleted(node) {
+                    if (_.isUndefined(node)) {
+                        return
+                    }
+                    return Enums.entityStateReadOnly[node.status];
                 }
 
                 function isNodeToBeUpdated(node) {
-                    if (that.filterObj.isProcessHideCheck) {
-                        return isProcess(node.typeName);
-                    } else if (that.filterObj.isDeletedEntityHideCheck) {
-                        return isDeleted(node.status);
-                    }
+                    var isProcessHideCheck = that.filterObj.isProcessHideCheck,
+                        isDeletedEntityHideCheck = that.filterObj.isDeletedEntityHideCheck
+                    var returnObj = {
+                        isProcess: (isProcessHideCheck && isProcess(node)),
+                        isDeleted: (isDeletedEntityHideCheck && isDeleted(node))
+
+                    };
+                    returnObj["update"] = returnObj.isProcess || returnObj.isDeleted;
+                    return returnObj;
                 }
 
                 function getServiceType(typeName) {
@@ -250,7 +257,7 @@ define(['require',
                     if (that.filterObj.isProcessHideCheck) {
                         obj['isProcess'] = relationObj.isProcess;
                     } else {
-                        obj['isProcess'] = isProcess(relationObj.typeName);
+                        obj['isProcess'] = isProcess(relationObj);
                     }
 
                     return obj;
@@ -263,26 +270,32 @@ define(['require',
                     _.each(relations, function(obj, index, relationArr) {
                         var toNodeToBeUpdated = isNodeToBeUpdated(guidEntityMap[obj.toEntityId]);
                         var fromNodeToBeUpdated = isNodeToBeUpdated(guidEntityMap[obj.fromEntityId]);
-                        if (toNodeToBeUpdated) {
+                        if (toNodeToBeUpdated.update) {
                             if (that.filterObj.isProcessHideCheck) {
                                 //We have already checked entity is process or not inside isNodeToBeUpdated();
                                 guidEntityMap[obj.toEntityId]["isProcess"] = true;
                             }
                             _.filter(relationArr, function(flrObj) {
                                 if (flrObj.fromEntityId === obj.toEntityId) {
+                                    if (that.filterObj.isDeletedEntityHideCheck && isDeleted(guidEntityMap[flrObj.toEntityId])) {
+                                        return;
+                                    }
                                     newRelations.push({
                                         fromEntityId: obj.fromEntityId,
                                         toEntityId: flrObj.toEntityId
                                     });
                                 }
                             })
-                        } else if (fromNodeToBeUpdated) {
+                        } else if (fromNodeToBeUpdated.update) {
                             if (that.filterObj.isProcessHideCheck) {
                                 //We have already checked entity is process or not inside isNodeToBeUpdated();
                                 guidEntityMap[obj.fromEntityId]["isProcess"] = true;
                             }
 
                             _.filter(relationArr, function(flrObj) {
+                                if (that.filterObj.isDeletedEntityHideCheck && isDeleted(guidEntityMap[flrObj.fromEntityId])) {
+                                    return;
+                                }
                                 if (flrObj.toEntityId === obj.fromEntityId) {
                                     newRelations.push({
                                         fromEntityId: flrObj.fromEntityId,
@@ -313,6 +326,12 @@ define(['require',
                     }
                     that.g.setEdge(obj.fromEntityId, obj.toEntityId, { 'arrowhead': "arrowPoint", lineInterpolate: 'basis', "style": "fill:" + styleObj.fill + ";stroke:" + styleObj.stroke + ";stroke-width:" + styleObj.width + "", 'styleObj': styleObj });
                 });
+                //if no relations found
+                if (!finalRelations.length) {
+                    this.$('svg').html('<text x="50%" y="50%" alignment-baseline="middle" text-anchor="middle">No relations to display</text>');
+                } else {
+                    this.$('svg').html('<text></text>');
+                }
 
                 if (this.fromToObj[this.guid]) {
                     this.fromToObj[this.guid]['isLineage'] = false;