Commit 96bdc802 by Abhishek Kadam Committed by kevalbhatt

ATLAS-2994 UI - If Hide deleted entity filter is applied then to UI displays…

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: 's avatarkevalbhatt <kbhatt@apache.org>
parent b7d113dc
...@@ -203,24 +203,31 @@ define(['require', ...@@ -203,24 +203,31 @@ define(['require',
generateData: function(relations, guidEntityMap) { generateData: function(relations, guidEntityMap) {
var that = this; var that = this;
function isProcess(typeName) { function isProcess(node) {
if (typeName == "Process") { if (_.isUndefined(node) || node.typeName == "Process") {
return true; 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") return _.contains(Utils.getNestedSuperTypes({ data: entityDef.toJSON(), collection: that.entityDefCollection }), "Process")
} }
function isDeleted(status) { function isDeleted(node) {
return Enums.entityStateReadOnly[status]; if (_.isUndefined(node)) {
return
}
return Enums.entityStateReadOnly[node.status];
} }
function isNodeToBeUpdated(node) { function isNodeToBeUpdated(node) {
if (that.filterObj.isProcessHideCheck) { var isProcessHideCheck = that.filterObj.isProcessHideCheck,
return isProcess(node.typeName); isDeletedEntityHideCheck = that.filterObj.isDeletedEntityHideCheck
} else if (that.filterObj.isDeletedEntityHideCheck) { var returnObj = {
return isDeleted(node.status); isProcess: (isProcessHideCheck && isProcess(node)),
} isDeleted: (isDeletedEntityHideCheck && isDeleted(node))
};
returnObj["update"] = returnObj.isProcess || returnObj.isDeleted;
return returnObj;
} }
function getServiceType(typeName) { function getServiceType(typeName) {
...@@ -250,7 +257,7 @@ define(['require', ...@@ -250,7 +257,7 @@ define(['require',
if (that.filterObj.isProcessHideCheck) { if (that.filterObj.isProcessHideCheck) {
obj['isProcess'] = relationObj.isProcess; obj['isProcess'] = relationObj.isProcess;
} else { } else {
obj['isProcess'] = isProcess(relationObj.typeName); obj['isProcess'] = isProcess(relationObj);
} }
return obj; return obj;
...@@ -263,26 +270,32 @@ define(['require', ...@@ -263,26 +270,32 @@ define(['require',
_.each(relations, function(obj, index, relationArr) { _.each(relations, function(obj, index, relationArr) {
var toNodeToBeUpdated = isNodeToBeUpdated(guidEntityMap[obj.toEntityId]); var toNodeToBeUpdated = isNodeToBeUpdated(guidEntityMap[obj.toEntityId]);
var fromNodeToBeUpdated = isNodeToBeUpdated(guidEntityMap[obj.fromEntityId]); var fromNodeToBeUpdated = isNodeToBeUpdated(guidEntityMap[obj.fromEntityId]);
if (toNodeToBeUpdated) { if (toNodeToBeUpdated.update) {
if (that.filterObj.isProcessHideCheck) { if (that.filterObj.isProcessHideCheck) {
//We have already checked entity is process or not inside isNodeToBeUpdated(); //We have already checked entity is process or not inside isNodeToBeUpdated();
guidEntityMap[obj.toEntityId]["isProcess"] = true; guidEntityMap[obj.toEntityId]["isProcess"] = true;
} }
_.filter(relationArr, function(flrObj) { _.filter(relationArr, function(flrObj) {
if (flrObj.fromEntityId === obj.toEntityId) { if (flrObj.fromEntityId === obj.toEntityId) {
if (that.filterObj.isDeletedEntityHideCheck && isDeleted(guidEntityMap[flrObj.toEntityId])) {
return;
}
newRelations.push({ newRelations.push({
fromEntityId: obj.fromEntityId, fromEntityId: obj.fromEntityId,
toEntityId: flrObj.toEntityId toEntityId: flrObj.toEntityId
}); });
} }
}) })
} else if (fromNodeToBeUpdated) { } else if (fromNodeToBeUpdated.update) {
if (that.filterObj.isProcessHideCheck) { if (that.filterObj.isProcessHideCheck) {
//We have already checked entity is process or not inside isNodeToBeUpdated(); //We have already checked entity is process or not inside isNodeToBeUpdated();
guidEntityMap[obj.fromEntityId]["isProcess"] = true; guidEntityMap[obj.fromEntityId]["isProcess"] = true;
} }
_.filter(relationArr, function(flrObj) { _.filter(relationArr, function(flrObj) {
if (that.filterObj.isDeletedEntityHideCheck && isDeleted(guidEntityMap[flrObj.fromEntityId])) {
return;
}
if (flrObj.toEntityId === obj.fromEntityId) { if (flrObj.toEntityId === obj.fromEntityId) {
newRelations.push({ newRelations.push({
fromEntityId: flrObj.fromEntityId, fromEntityId: flrObj.fromEntityId,
...@@ -313,6 +326,12 @@ define(['require', ...@@ -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 }); 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]) { if (this.fromToObj[this.guid]) {
this.fromToObj[this.guid]['isLineage'] = false; this.fromToObj[this.guid]['isLineage'] = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment