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',
return url.replace(/\/[\w-]+.(jsp|html)|\/+$/ig, '');
};
Utils.getEntityIconPath = function(options) {
var entityData = null,
serviceType = null,
status = null,
var entityData = options && options.entityData,
serviceType,
status,
typeName,
iconBasePath = Utils.getBaseUrl(window.location.pathname) + Globals.entityImgPath;
if (options) {
entityData = options.entityData;
if (entityData) {
typeName = entityData.typeName;
serviceType = entityData && entityData.serviceType;
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 (options.errorUrl) {
var isErrorInDefaultServiceType = (serviceType && options.errorUrl && options.errorUrl.match("/" + serviceType + "/" + serviceType + ".png|/" + serviceType + "/disabled/" + serviceType + ".png") ? true : false);
if (serviceType && !isErrorInDefaultServiceType) {
var isErrorInTypeName = (options.errorUrl && options.errorUrl.match("entity-icon/" + typeName + ".png|disabled/" + typeName + ".png") ? true : false);
if (serviceType && isErrorInTypeName) {
var imageName = serviceType + ".png";
return iconBasePath + serviceType + (Enums.entityStateReadOnly[status] ? "/disabled/" + imageName : "/" + imageName);
return getImgPath(imageName);
} else {
if (entityData.isProcess) {
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';
}
}
return getDefaultImgPath();
}
} else {
} else if (entityData.typeName) {
var imageName = entityData.typeName + ".png";
if (serviceType) {
return iconBasePath + serviceType + (Enums.entityStateReadOnly[status] ? "/disabled/" + imageName : "/" + imageName);
} else {
return iconBasePath + (Enums.entityStateReadOnly[status] ? "default/disabled/" + imageName : "default/" + imageName);
}
return getImgPath(imageName);
} else {
return getDefaultImgPath();
}
}
}
......
......@@ -135,6 +135,18 @@ define(['require',
// MergerRefEntity.
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) {
var tagGuid = collectionJSON.guid;
this.readOnly = Enums.entityStateReadOnly[collectionJSON.status];
......@@ -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>';
}
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) {
this.ui.entityIcon.addClass('disabled');
} else {
......@@ -261,22 +273,10 @@ define(['require',
});
}
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) {
if (isLineageRender) {
this.$('.lineageGraph').show();
this.renderLineageLayoutView({
processCheck: processCheck,
processCheck: isProcess,
guid: this.id,
entityDefCollection: this.entityDefCollection,
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