Commit b57420cd by Abhishek Kadam Committed by Madhan Neethiraj

ATLAS-2731: UI : attributes on table's detailsPage buffers forever due no access on that entity

parent e73a8099
...@@ -75,6 +75,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum ...@@ -75,6 +75,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
var scope = options.scope, var scope = options.scope,
valueObject = options.valueObject, valueObject = options.valueObject,
extractJSON = options.extractJSON, extractJSON = options.extractJSON,
relationshipAttributes = options.relationshipAttributes,
isTable = _.isUndefined(options.isTable) ? true : options.isTable, isTable = _.isUndefined(options.isTable) ? true : options.isTable,
attributeDefs = options.attributeDefs; attributeDefs = options.attributeDefs;
...@@ -104,11 +105,16 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum ...@@ -104,11 +105,16 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
scope.$('td div[data-id="' + id + '"]').append(deleteButton); 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() {} complete: function() {}
}); });
}, },
extractObject = function(keyValue) { extractObject = function(opt) {
var valueOfArray = []; var valueOfArray = [],
keyValue = opt.keyValue,
key = opt.key;
if (!_.isArray(keyValue) && _.isObject(keyValue)) { if (!_.isArray(keyValue) && _.isObject(keyValue)) {
keyValue = [keyValue]; keyValue = [keyValue];
} }
...@@ -163,10 +169,15 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum ...@@ -163,10 +169,15 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
if (id && inputOutputField) { if (id && inputOutputField) {
var name = Utils.getName(inputOutputField); var name = Utils.getName(inputOutputField);
if ((name === "-" || name === id) && !inputOutputField.attributes) { if ((name === "-" || name === id) && !inputOutputField.attributes) {
var fetch = true; var rAttrValue = relationshipAttributes && relationshipAttributes[key];
var fetchId = (_.isObject(id) ? id.id : id); if (!rAttrValue) {
fetchInputOutputValue(fetchId); var fetch = true;
tempLink += '<div data-id="' + fetchId + '"><div class="value-loader"></div></div>'; 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 { } else {
tempLink += '<a href="#!/detailPage/' + id + '">' + name + '</a>' tempLink += '<a href="#!/detailPage/' + id + '">' + name + '</a>'
} }
...@@ -205,11 +216,11 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum ...@@ -205,11 +216,11 @@ 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 = extractObject({ "keyValue": keyValue, "key": key });
} }
} else { } else {
if (_.isObject(keyValue)) { if (_.isObject(keyValue)) {
keyValue = extractObject(keyValue) keyValue = extractObject({ "keyValue": keyValue, "key": key })
} }
} }
var val = ""; var val = "";
......
...@@ -87,7 +87,7 @@ define(['require', ...@@ -87,7 +87,7 @@ define(['require',
this.ui.name.text(name); this.ui.name.text(name);
if (parseDetailsObject) { if (parseDetailsObject) {
this.ui.auditHeaderValue.html('<th>Key</th><th>New Value</th>'); 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) { if (table.length) {
this.ui.noData.hide(); this.ui.noData.hide();
this.ui.tableAudit.show(); this.ui.tableAudit.show();
......
...@@ -56,7 +56,7 @@ define(['require', ...@@ -56,7 +56,7 @@ define(['require',
this.entityTableGenerate(); this.entityTableGenerate();
}, },
entityTableGenerate: function() { 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); this.ui.detailValue.append(table);
} }
}); });
......
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