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 ...@@ -79,7 +79,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
attributeDefs = options.attributeDefs; attributeDefs = options.attributeDefs;
var table = "", var table = "",
fetchInputOutputValue = function(id) { fetchInputOutputValue = function(id, defEntity) {
var that = this; var that = this;
scope.entityModel.getEntityHeader(id, { scope.entityModel.getEntityHeader(id, {
success: function(serverData) { success: function(serverData) {
...@@ -107,6 +107,8 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum ...@@ -107,6 +107,8 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
cust_error: function(error, xhr) { cust_error: function(error, xhr) {
if (xhr.status == 403) { 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>'); 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 { } 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>'); 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 ...@@ -117,7 +119,8 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
extractObject = function(opt) { extractObject = function(opt) {
var valueOfArray = [], var valueOfArray = [],
keyValue = opt.keyValue, keyValue = opt.keyValue,
key = opt.key; key = opt.key,
defEntity = opt.defEntity;
if (!_.isArray(keyValue) && _.isObject(keyValue)) { if (!_.isArray(keyValue) && _.isObject(keyValue)) {
keyValue = [keyValue]; keyValue = [keyValue];
} }
...@@ -172,7 +175,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum ...@@ -172,7 +175,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
if ((name === "-" || name === id) && !inputOutputField.attributes) { if ((name === "-" || name === id) && !inputOutputField.attributes) {
var fetch = true; var fetch = true;
var fetchId = (_.isObject(id) ? id.id : id); var fetchId = (_.isObject(id) ? id.id : id);
fetchInputOutputValue(fetchId); fetchInputOutputValue(fetchId, defEntity);
tempLink += '<div data-id="' + fetchId + '"><div class="value-loader"></div></div>'; tempLink += '<div data-id="' + fetchId + '"><div class="value-loader"></div></div>';
} else { } else {
tempLink += '<a href="#!/detailPage/' + id + '">' + name + '</a>' tempLink += '<a href="#!/detailPage/' + id + '">' + name + '</a>'
...@@ -212,7 +215,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum ...@@ -212,7 +215,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
if (defEntityType === 'date') { if (defEntityType === 'date') {
keyValue = new Date(keyValue); keyValue = new Date(keyValue);
} else if (_.isObject(keyValue)) { } else if (_.isObject(keyValue)) {
keyValue = extractObject({ "keyValue": keyValue, "key": key }); keyValue = extractObject({ "keyValue": keyValue, "key": key, 'defEntity': defEntity });
} }
} else { } else {
if (_.isObject(keyValue)) { 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