ATLAS-2731: UI : attributes on table's detailsPage buffers forever due no access on that entity
Signed-off-by: Madhan Neethiraj <mad...@apache.org> (cherry picked from commit b57420cd0f4af242caed81d8b69c2438794f1fd9) Project: http://git-wip-us.apache.org/repos/asf/atlas/repo Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/1e4b743b Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/1e4b743b Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/1e4b743b Branch: refs/heads/branch-1.0 Commit: 1e4b743b296b569eff513e0aceec9a66375d7585 Parents: 047f31b Author: Abhishek Kadam <abhishek.kada...@gmail.com> Authored: Tue Jun 5 18:42:02 2018 +0530 Committer: Madhan Neethiraj <mad...@apache.org> Committed: Tue Jun 5 07:52:47 2018 -0700 ---------------------------------------------------------------------- .../public/js/utils/CommonViewFunction.js | 27 ++++++++++++++------ .../views/audit/CreateAuditTableLayoutView.js | 2 +- .../views/entity/EntityDetailTableLayoutView.js | 2 +- 3 files changed, 21 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/atlas/blob/1e4b743b/dashboardv2/public/js/utils/CommonViewFunction.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/utils/CommonViewFunction.js b/dashboardv2/public/js/utils/CommonViewFunction.js index b8e023a..3d39eb8 100644 --- a/dashboardv2/public/js/utils/CommonViewFunction.js +++ b/dashboardv2/public/js/utils/CommonViewFunction.js @@ -75,6 +75,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum var scope = options.scope, valueObject = options.valueObject, extractJSON = options.extractJSON, + relationshipAttributes = options.relationshipAttributes, isTable = _.isUndefined(options.isTable) ? true : options.isTable, attributeDefs = options.attributeDefs; @@ -104,11 +105,16 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum scope.$('td div[data-id="' + id + '"]').append(deleteButton); } }, + cust_error: function() { + 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>'); + }, complete: function() {} }); }, - extractObject = function(keyValue) { - var valueOfArray = []; + extractObject = function(opt) { + var valueOfArray = [], + keyValue = opt.keyValue, + key = opt.key; if (!_.isArray(keyValue) && _.isObject(keyValue)) { keyValue = [keyValue]; } @@ -163,10 +169,15 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum if (id && inputOutputField) { var name = Utils.getName(inputOutputField); if ((name === "-" || name === id) && !inputOutputField.attributes) { - var fetch = true; - var fetchId = (_.isObject(id) ? id.id : id); - fetchInputOutputValue(fetchId); - tempLink += '<div data-id="' + fetchId + '"><div class="value-loader"></div></div>'; + var rAttrValue = relationshipAttributes && relationshipAttributes[key]; + if (!rAttrValue) { + var fetch = true; + var fetchId = (_.isObject(id) ? id.id : id); + fetchInputOutputValue(fetchId); + tempLink += '<div data-id="' + fetchId + '"><div class="value-loader"></div></div>'; + } else { + tempLink += '<div data-id="' + rAttrValue.guid + '"><a href="#!/detailPage/' + rAttrValue.guid + '">' + Utils.getName(rAttrValue) + '</a></div>'; + } } else { tempLink += '<a href="#!/detailPage/' + id + '">' + name + '</a>' } @@ -205,11 +216,11 @@ 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 = extractObject({ "keyValue": keyValue, "key": key }); } } else { if (_.isObject(keyValue)) { - keyValue = extractObject(keyValue) + keyValue = extractObject({ "keyValue": keyValue, "key": key }) } } var val = ""; http://git-wip-us.apache.org/repos/asf/atlas/blob/1e4b743b/dashboardv2/public/js/views/audit/CreateAuditTableLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/audit/CreateAuditTableLayoutView.js b/dashboardv2/public/js/views/audit/CreateAuditTableLayoutView.js index aa6f5f4..0d66235 100644 --- a/dashboardv2/public/js/views/audit/CreateAuditTableLayoutView.js +++ b/dashboardv2/public/js/views/audit/CreateAuditTableLayoutView.js @@ -87,7 +87,7 @@ define(['require', this.ui.name.text(name); if (parseDetailsObject) { this.ui.auditHeaderValue.html('<th>Key</th><th>New Value</th>'); - table = CommonViewFunction.propertyTable({ scope: this, valueObject: parseDetailsObject, attributeDefs: this.attributeDefs }); + table = CommonViewFunction.propertyTable({ scope: this, valueObject: parseDetailsObject, relationshipAttributes: parseDetailsObject.relationshipAttributes, attributeDefs: this.attributeDefs }); if (table.length) { this.ui.noData.hide(); this.ui.tableAudit.show(); http://git-wip-us.apache.org/repos/asf/atlas/blob/1e4b743b/dashboardv2/public/js/views/entity/EntityDetailTableLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/entity/EntityDetailTableLayoutView.js b/dashboardv2/public/js/views/entity/EntityDetailTableLayoutView.js index 28eb749..138e2cc 100644 --- a/dashboardv2/public/js/views/entity/EntityDetailTableLayoutView.js +++ b/dashboardv2/public/js/views/entity/EntityDetailTableLayoutView.js @@ -56,7 +56,7 @@ define(['require', this.entityTableGenerate(); }, entityTableGenerate: function() { - var table = CommonViewFunction.propertyTable({ scope: this, valueObject: this.entity.attributes, attributeDefs: this.attributeDefs }); + var table = CommonViewFunction.propertyTable({ scope: this, valueObject: this.entity.attributes, relationshipAttributes: this.entity.relationshipAttributes, attributeDefs: this.attributeDefs }); this.ui.detailValue.append(table); } });