Commit 97e131a5 by kevalbhatt Committed by Madhan Neethiraj

ATLAS-2976: UI - Show entity specific icon for the lineage node (folder changes)

parent a5e5cec6
...@@ -77,44 +77,51 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums', ...@@ -77,44 +77,51 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums',
return url.replace(/\/[\w-]+.(jsp|html)|\/+$/ig, ''); return url.replace(/\/[\w-]+.(jsp|html)|\/+$/ig, '');
}; };
Utils.getEntityIconPath = function(options) { Utils.getEntityIconPath = function(options) {
var entityData = null, var entityData = options && options.entityData,
serviceType = null, serviceType,
status = null, status,
typeName,
iconBasePath = Utils.getBaseUrl(window.location.pathname) + Globals.entityImgPath; iconBasePath = Utils.getBaseUrl(window.location.pathname) + Globals.entityImgPath;
if (options) { if (entityData) {
entityData = options.entityData; typeName = entityData.typeName;
serviceType = entityData && entityData.serviceType; serviceType = entityData && entityData.serviceType;
status = entityData && entityData.status; status = entityData && entityData.status;
} }
function getImgPath(imageName) {
return iconBasePath + (Enums.entityStateReadOnly[status] ? "disabled/" + imageName : imageName);
}
function getDefaultImgPath() {
if (entityData.isProcess) {
if (Enums.entityStateReadOnly[status]) {
return iconBasePath + 'disabled/process.png';
} else {
return iconBasePath + 'process.png';
}
} else {
if (Enums.entityStateReadOnly[status]) {
return iconBasePath + 'disabled/table.png';
} else {
return iconBasePath + 'table.png';
}
}
}
if (entityData) { if (entityData) {
if (options.errorUrl) { if (options.errorUrl) {
var isErrorInDefaultServiceType = (serviceType && options.errorUrl && options.errorUrl.match("/" + serviceType + "/" + serviceType + ".png|/" + serviceType + "/disabled/" + serviceType + ".png") ? true : false); var isErrorInTypeName = (options.errorUrl && options.errorUrl.match("entity-icon/" + typeName + ".png|disabled/" + typeName + ".png") ? true : false);
if (serviceType && !isErrorInDefaultServiceType) { if (serviceType && isErrorInTypeName) {
var imageName = serviceType + ".png"; var imageName = serviceType + ".png";
return iconBasePath + serviceType + (Enums.entityStateReadOnly[status] ? "/disabled/" + imageName : "/" + imageName); return getImgPath(imageName);
} else { } else {
if (entityData.isProcess) { return getDefaultImgPath();
if (Enums.entityStateReadOnly[status]) {
return iconBasePath + 'default/disabled/process.png';
} else {
return iconBasePath + 'default/process.png';
}
} else {
if (Enums.entityStateReadOnly[status]) {
return iconBasePath + 'default/disabled/table.png';
} else {
return iconBasePath + 'default/table.png';
}
}
} }
} else { } else if (entityData.typeName) {
var imageName = entityData.typeName + ".png"; var imageName = entityData.typeName + ".png";
if (serviceType) { return getImgPath(imageName);
return iconBasePath + serviceType + (Enums.entityStateReadOnly[status] ? "/disabled/" + imageName : "/" + imageName); } else {
} else { return getDefaultImgPath();
return iconBasePath + (Enums.entityStateReadOnly[status] ? "default/disabled/" + imageName : "default/" + imageName);
}
} }
} }
} }
......
...@@ -135,6 +135,18 @@ define(['require', ...@@ -135,6 +135,18 @@ define(['require',
// MergerRefEntity. // MergerRefEntity.
Utils.findAndMergeRefEntity(collectionJSON.attributes, this.entityObject.referredEntities); Utils.findAndMergeRefEntity(collectionJSON.attributes, this.entityObject.referredEntities);
// check if entity is process
var isProcess = false,
superTypes = Utils.getNestedSuperTypes({ data: this.activeEntityDef.toJSON(), collection: this.entityDefCollection }),
isLineageRender = _.find(superTypes, function(type) {
if (type === "DataSet" || type === "Process") {
if (type === "Process") {
isProcess = true;
}
return true;
}
});
if (collectionJSON && collectionJSON.guid) { if (collectionJSON && collectionJSON.guid) {
var tagGuid = collectionJSON.guid; var tagGuid = collectionJSON.guid;
this.readOnly = Enums.entityStateReadOnly[collectionJSON.status]; this.readOnly = Enums.entityStateReadOnly[collectionJSON.status];
...@@ -163,7 +175,7 @@ define(['require', ...@@ -163,7 +175,7 @@ define(['require',
titleName += '<button title="Deleted" class="btn btn-action btn-md deleteBtn"><i class="fa fa-trash"></i> Deleted</button>'; titleName += '<button title="Deleted" class="btn btn-action btn-md deleteBtn"><i class="fa fa-trash"></i> Deleted</button>';
} }
this.ui.title.html(titleName); this.ui.title.html(titleName);
var entityData = _.extend({ serviceType: this.activeEntityDef && this.activeEntityDef.get('serviceType') }, collectionJSON); var entityData = _.extend({ "serviceType": this.activeEntityDef && this.activeEntityDef.get('serviceType'), "isProcess": isProcess }, collectionJSON);
if (this.readOnly) { if (this.readOnly) {
this.ui.entityIcon.addClass('disabled'); this.ui.entityIcon.addClass('disabled');
} else { } else {
...@@ -261,22 +273,10 @@ define(['require', ...@@ -261,22 +273,10 @@ define(['require',
}); });
} }
if (isLineageRender) {
var processCheck = false,
containsList = Utils.getNestedSuperTypes({ data: this.activeEntityDef.toJSON(), collection: this.entityDefCollection }),
superType = _.find(containsList, function(type) {
if (type === "DataSet" || type === "Process") {
if (type === "Process") {
processCheck = true;
}
return true;
}
});
if (superType) {
this.$('.lineageGraph').show(); this.$('.lineageGraph').show();
this.renderLineageLayoutView({ this.renderLineageLayoutView({
processCheck: processCheck, processCheck: isProcess,
guid: this.id, guid: this.id,
entityDefCollection: this.entityDefCollection, entityDefCollection: this.entityDefCollection,
fetchCollection: this.fetchCollection.bind(this), fetchCollection: this.fetchCollection.bind(this),
......
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