Commit 15baa4da by kevalbhatt Committed by Madhan Neethiraj

ATLAS-1521 : Update UI to eliminate REST calls to obtain schema data (#2)

parent dd744765
...@@ -57,7 +57,7 @@ define(['require', ...@@ -57,7 +57,7 @@ define(['require',
* @constructs * @constructs
*/ */
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'guid', 'entity')); _.extend(this, _.pick(options, 'guid', 'entity', 'entityName'));
this.entityCollection = new VEntityList(); this.entityCollection = new VEntityList();
this.count = 26; this.count = 26;
this.entityCollection.url = UrlLinks.entityCollectionaudit(this.guid); this.entityCollection.url = UrlLinks.entityCollectionaudit(this.guid);
...@@ -224,7 +224,7 @@ define(['require', ...@@ -224,7 +224,7 @@ define(['require',
that.action = $(e.target).data("action"); that.action = $(e.target).data("action");
var eventModel = that.entityCollection.findWhere({ 'eventKey': $(e.currentTarget).data('modalid') }).toJSON(), var eventModel = that.entityCollection.findWhere({ 'eventKey': $(e.currentTarget).data('modalid') }).toJSON(),
collectionModel = new that.entityCollection.model(eventModel), collectionModel = new that.entityCollection.model(eventModel),
view = new CreateAuditTableLayoutView({ guid: that.guid, entityModel: collectionModel, action: that.action, entity: that.entity }); view = new CreateAuditTableLayoutView({ guid: that.guid, entityModel: collectionModel, action: that.action, entity: that.entity, entityName: that.entityName });
var modal = new Modal({ var modal = new Modal({
title: that.action, title: that.action,
content: view, content: view,
......
...@@ -54,7 +54,7 @@ define(['require', ...@@ -54,7 +54,7 @@ define(['require',
* @constructs * @constructs
*/ */
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'guid', 'entityModel', 'action', 'entity')); _.extend(this, _.pick(options, 'guid', 'entityModel', 'action', 'entity', 'entityName'));
}, },
bindEvents: function() {}, bindEvents: function() {},
onRender: function() { onRender: function() {
...@@ -79,7 +79,7 @@ define(['require', ...@@ -79,7 +79,7 @@ define(['require',
var values = parseDetailsObject.values; var values = parseDetailsObject.values;
if (this.action && (Enums.auditAction.ENTITY_CREATE !== this.action && Enums.auditAction.ENTITY_UPDATE !== this.action) && name) { if (this.action && (Enums.auditAction.ENTITY_CREATE !== this.action && Enums.auditAction.ENTITY_UPDATE !== this.action) && name) {
this.ui.auditHeaderValue.html('<th>' + this.action + '</th>'); this.ui.auditHeaderValue.html('<th>' + this.action + '</th>');
this.ui.auditValue.html("<tr><td>" + name + "</td></tr>"); this.ui.auditValue.html("<tr><td>" + (name ? name : this.entityName) + "</td></tr>");
} else if (parseDetailsObject && parseDetailsObject.values) { } else if (parseDetailsObject && parseDetailsObject.values) {
this.ui.auditHeaderValue.html('<th>Key</th><th>New Value</th>'); this.ui.auditHeaderValue.html('<th>Key</th><th>New Value</th>');
//CommonViewFunction.findAndmergeRefEntity(attributeObject, that.referredEntities); //CommonViewFunction.findAndmergeRefEntity(attributeObject, that.referredEntities);
...@@ -93,6 +93,11 @@ define(['require', ...@@ -93,6 +93,11 @@ define(['require',
this.ui.tableAudit.hide(); this.ui.tableAudit.hide();
} }
} }
} else {
if (Enums.auditAction.ENTITY_DELETE === this.action) {
this.ui.auditHeaderValue.html('<th>' + this.action + '</th>');
this.ui.auditValue.html("<tr><td>" + (name ? name : this.entityName) + "</td></tr>");
}
} }
}, },
......
...@@ -166,7 +166,7 @@ define(['require', ...@@ -166,7 +166,7 @@ define(['require',
entity: collectionJSON, entity: collectionJSON,
referredEntities: entityObject.referredEntities, referredEntities: entityObject.referredEntities,
guid: this.id, guid: this.id,
assetName: this.name, entityName: this.name,
entityDefCollection: this.entityDefCollection, entityDefCollection: this.entityDefCollection,
fetchCollection: this.fetchCollection.bind(that) fetchCollection: this.fetchCollection.bind(that)
} }
...@@ -176,7 +176,7 @@ define(['require', ...@@ -176,7 +176,7 @@ define(['require',
this.renderTermTableLayoutView(_.extend({}, obj, { term: true })); this.renderTermTableLayoutView(_.extend({}, obj, { term: true }));
this.renderLineageLayoutView(obj); this.renderLineageLayoutView(obj);
// To render Schema check attribute "schemaElementsAttribute" // To render Schema check attribute "schemaElementsAttribute"
var schemaOptions = this.entityDefCollection.find({ name: collectionJSON.typeName }).get('options'); var schemaOptions = this.entityDefCollection.fullCollection.find({ name: collectionJSON.typeName }).get('options');
if (schemaOptions && schemaOptions.hasOwnProperty('schemaElementsAttribute') && schemaOptions.schemaElementsAttribute !== "") { if (schemaOptions && schemaOptions.hasOwnProperty('schemaElementsAttribute') && schemaOptions.schemaElementsAttribute !== "") {
this.$('.schemaTable').show(); this.$('.schemaTable').show();
this.renderSchemaLayoutView(_.extend({}, obj, { this.renderSchemaLayoutView(_.extend({}, obj, {
......
...@@ -144,7 +144,7 @@ define(['require', ...@@ -144,7 +144,7 @@ define(['require',
onRender: function() { onRender: function() {
var that = this; var that = this;
_.each(this.attribute, function(obj) { _.each(this.attribute, function(obj) {
var defObj = that.entityDefCollection.find({ name: obj.typeName }); var defObj = that.entityDefCollection.fullCollection.find({ name: obj.typeName });
if (defObj && defObj.get('options') && defObj.get('options').schemaAttributes) { if (defObj && defObj.get('options') && defObj.get('options').schemaAttributes) {
try { try {
var mapObj = JSON.parse(defObj.get('options').schemaAttributes); var mapObj = JSON.parse(defObj.get('options').schemaAttributes);
......
...@@ -60,7 +60,7 @@ define(['require', ...@@ -60,7 +60,7 @@ define(['require',
* @constructs * @constructs
*/ */
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'entity', 'guid', 'term', 'assetName')); _.extend(this, _.pick(options, 'entity', 'guid', 'term', 'entityName'));
this.collectionObject = this.entity; this.collectionObject = this.entity;
this.tagTermCollection = new VTagList(); this.tagTermCollection = new VTagList();
var tagorterm = _.toArray(this.collectionObject.classifications), var tagorterm = _.toArray(this.collectionObject.classifications),
...@@ -176,13 +176,13 @@ define(['require', ...@@ -176,13 +176,13 @@ define(['require',
that = this; that = this;
if (that.term) { if (that.term) {
var modal = CommonViewFunction.deleteTagModel({ var modal = CommonViewFunction.deleteTagModel({
msg: "<div class='ellipsis'>Remove: " + "<b>" + _.escape(tagName) + "</b> assignment from" + " " + "<b>" + this.assetName + "?</b></div>", msg: "<div class='ellipsis'>Remove: " + "<b>" + _.escape(tagName) + "</b> assignment from" + " " + "<b>" + this.entityName + "?</b></div>",
titleMessage: Messages.removeTerm, titleMessage: Messages.removeTerm,
buttonText: "Remove", buttonText: "Remove",
}); });
} else { } else {
var modal = CommonViewFunction.deleteTagModel({ var modal = CommonViewFunction.deleteTagModel({
msg: "<div class='ellipsis'>Remove: " + "<b>" + _.escape(tagName) + "</b> assignment from" + " " + "<b>" + this.assetName + "?</b></div>", msg: "<div class='ellipsis'>Remove: " + "<b>" + _.escape(tagName) + "</b> assignment from" + " " + "<b>" + this.entityName + "?</b></div>",
titleMessage: Messages.removeTag, titleMessage: Messages.removeTag,
buttonText: "Remove", buttonText: "Remove",
}); });
......
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