Commit 93bd535e by Abhishek Kadam Committed by kevalbhatt

ATLAS-2930: UI changes to handle error message based on softReference attribute

Signed-off-by: 's avatarkevalbhatt <kbhatt@apache.org>
parent 46b9b7c8
......@@ -79,7 +79,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
attributeDefs = options.attributeDefs;
var table = "",
fetchInputOutputValue = function(id) {
fetchInputOutputValue = function(id, defEntity) {
var that = this;
scope.entityModel.getEntityHeader(id, {
success: function(serverData) {
......@@ -107,6 +107,8 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
cust_error: function(error, xhr) {
if (xhr.status == 403) {
scope.$('td div[data-id="' + id + '"]').html('<div><span class="text-danger"><i class="fa fa-exclamation-triangle" aria-hidden="true"></i> Not Authorized</span></div>');
} else if (defEntity && defEntity.options && defEntity.options.isSoftReference === "true") {
scope.$('td div[data-id="' + id + '"]').html('<div> ' + id + '</div>');
} else {
scope.$('td div[data-id="' + id + '"]').html('<div><span class="text-danger"><i class="fa fa-exclamation-triangle" aria-hidden="true"></i> ' + Messages.defaultErrorMessage + '</span></div>');
}
......@@ -117,7 +119,8 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
extractObject = function(opt) {
var valueOfArray = [],
keyValue = opt.keyValue,
key = opt.key;
key = opt.key,
defEntity = opt.defEntity;
if (!_.isArray(keyValue) && _.isObject(keyValue)) {
keyValue = [keyValue];
}
......@@ -172,7 +175,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
if ((name === "-" || name === id) && !inputOutputField.attributes) {
var fetch = true;
var fetchId = (_.isObject(id) ? id.id : id);
fetchInputOutputValue(fetchId);
fetchInputOutputValue(fetchId, defEntity);
tempLink += '<div data-id="' + fetchId + '"><div class="value-loader"></div></div>';
} else {
tempLink += '<a href="#!/detailPage/' + id + '">' + name + '</a>'
......@@ -212,7 +215,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
if (defEntityType === 'date') {
keyValue = new Date(keyValue);
} else if (_.isObject(keyValue)) {
keyValue = extractObject({ "keyValue": keyValue, "key": key });
keyValue = extractObject({ "keyValue": keyValue, "key": key, 'defEntity': defEntity });
}
} else {
if (_.isObject(keyValue)) {
......
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