in dashboardv2/public/js/utils/Utils.js [365:441]
Utils.extractKeyValueFromEntity = function() {
var collectionJSON = arguments[0],
priorityAttribute = arguments[1];
var returnObj = {
name: '-',
found: true,
key: null
}
if (collectionJSON) {
if (collectionJSON.attributes && collectionJSON.attributes[priorityAttribute]) {
returnObj.name = _.escape(collectionJSON.attributes[priorityAttribute]);
returnObj.key = priorityAttribute;
return returnObj;
}
if (collectionJSON[priorityAttribute]) {
returnObj.name = _.escape(collectionJSON[priorityAttribute]);
returnObj.key = priorityAttribute;
return returnObj;
}
if (collectionJSON.attributes) {
if (collectionJSON.attributes.name) {
returnObj.name = _.escape(collectionJSON.attributes.name);
returnObj.key = 'name';
return returnObj;
}
if (collectionJSON.attributes.qualifiedName) {
returnObj.name = _.escape(collectionJSON.attributes.qualifiedName);
returnObj.key = 'qualifiedName';
return returnObj;
}
if (collectionJSON.attributes.id) {
if (_.isObject(collectionJSON.attributes.id)) {
if (collectionJSON.id.id) {
returnObj.name = _.escape(collectionJSON.attributes.id.id);
}
} else {
returnObj.name = _.escape(collectionJSON.attributes.id);
}
returnObj.key = 'id';
return returnObj;
}
}
if (collectionJSON.name) {
returnObj.name = _.escape(collectionJSON.name);
returnObj.key = 'name';
return returnObj;
}
if (collectionJSON.qualifiedName) {
returnObj.name = _.escape(collectionJSON.qualifiedName);
returnObj.key = 'qualifiedName';
return returnObj;
}
if (collectionJSON.displayText) {
returnObj.name = _.escape(collectionJSON.displayText);
returnObj.key = 'displayText';
return returnObj;
}
if (collectionJSON.guid) {
returnObj.name = _.escape(collectionJSON.guid);
returnObj.key = 'guid';
return returnObj;
}
if (collectionJSON.id) {
if (_.isObject(collectionJSON.id)) {
if (collectionJSON.id.id) {
returnObj.name = _.escape(collectionJSON.id.id);
}
} else {
returnObj.name = _.escape(collectionJSON.id);
}
returnObj.key = 'id';
return returnObj;
}
}
returnObj.found = false;
return returnObj;
}