Repository: atlas Updated Branches: refs/heads/branch-0.8 95cc62be3 -> 707bcb1cb
ATLAS-2930: UI changes to handle error message based on softReference attribute Signed-off-by: kevalbhatt <kbh...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/atlas/repo Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/707bcb1c Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/707bcb1c Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/707bcb1c Branch: refs/heads/branch-0.8 Commit: 707bcb1cb9dc38b66a3718d13790e1e6beb9b972 Parents: 95cc62b Author: Abhishek Kadam <abhishek.kada...@gmail.com> Authored: Tue Oct 23 12:24:43 2018 +0530 Committer: kevalbhatt <kbh...@apache.org> Committed: Wed Oct 24 18:47:12 2018 +0530 ---------------------------------------------------------------------- dashboardv2/public/js/utils/CommonViewFunction.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/atlas/blob/707bcb1c/dashboardv2/public/js/utils/CommonViewFunction.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/utils/CommonViewFunction.js b/dashboardv2/public/js/utils/CommonViewFunction.js index 9863dca..4511e1a 100644 --- a/dashboardv2/public/js/utils/CommonViewFunction.js +++ b/dashboardv2/public/js/utils/CommonViewFunction.js @@ -83,7 +83,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) { @@ -108,10 +108,19 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum scope.$('td div[data-id="' + id + '"]').append(deleteButton); } }, + 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>'); + } + }, complete: function() {} }); }, - extractObject = function(keyValue) { + extractObject = function(keyValue, defEntity) { var valueOfArray = []; if (!_.isArray(keyValue) && _.isObject(keyValue)) { keyValue = [keyValue]; @@ -168,7 +177,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>' @@ -208,7 +217,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum if (defEntityType === 'date' || defEntityType === 'time') { keyValue = new Date(keyValue); } else if (_.isObject(keyValue)) { - keyValue = extractObject(keyValue); + keyValue = extractObject(keyValue, defEntity); } } else { if (_.isObject(keyValue)) {