Commit dd744765 by kevalbhatt Committed by Madhan Neethiraj

ATLAS-1521 : Update UI to eliminate REST calls to obtain schema data

parent 808eb1d1
......@@ -39,22 +39,33 @@ define(['require',
// if (!this.modelAttrName) {
// throw new Error("this.modelAttrName not defined for " + this);
// }
if (this.modelAttrName && this.modelAttrName === "createEntity") {
var arr = [];
arr.push({
attributes: resp.attributes,
classifications: resp.classifications,
guid: resp.guid,
typeName: resp.typeName
});
return arr;
} else {
if (resp[this.modelAttrName]) {
return resp[this.modelAttrName];
} else {
return resp
if (resp.entity && resp.referredEntities) {
var obj = {
entity: resp.entity,
referredEntities: resp.referredEntities
}
return obj;
} else if (resp[this.modelAttrName]) {
return resp[this.modelAttrName];
} else {
return resp
}
// if (this.modelAttrName && this.modelAttrName === "createEntity") {
// var arr = [];
// arr.push({
// attributes: resp.attributes,
// classifications: resp.classifications,
// guid: resp.guid,
// typeName: resp.typeName
// });
// return arr;
// } else {
// if (resp[this.modelAttrName]) {
// return resp[this.modelAttrName];
// } else {
// return resp
// }
// }
} catch (e) {
console.log(e);
......
......@@ -160,12 +160,27 @@ require(['App',
'utils/CommonViewFunction',
'utils/Globals',
'utils/UrlLinks',
'collection/VEntityList',
'utils/Overrides',
'bootstrap',
'd3',
'select2'
], function(App, Router, CommonViewFunction, Globals, UrlLinks) {
App.appRouter = new Router();
], function(App, Router, CommonViewFunction, Globals, UrlLinks, VEntityList) {
var that = this;
this.asyncFetchCounter = 2;
this.entityDefCollection = new VEntityList();
that.entityDefCollection.url = UrlLinks.entitiesDefApiUrl()
that.entityDefCollection.modelAttrName = 'list';
App.appRouter = new Router({
entityDefCollection: this.entityDefCollection
});
var startApp = function() {
if (that.asyncFetchCounter === 0) {
App.start();
}
};
CommonViewFunction.userDataFetch({
url: UrlLinks.sessionApiUrl(),
callback: function(response) {
......@@ -192,7 +207,14 @@ require(['App',
}
}
}
App.start();
--that.asyncFetchCounter;
startApp();
}
});
that.entityDefCollection.fetch({
complete: function() {
--that.asyncFetchCounter;
startApp();
}
});
});
......@@ -82,6 +82,7 @@ define(function(require) {
okCloses: true,
cancelText: 'Cancel',
allowCancel: false,
allowBackdrop: true,
showFooter: true,
escape: true,
animate: true,
......@@ -145,7 +146,7 @@ define(function(require) {
//Create it
$el.modal(_.extend({
keyboard: this.options.allowCancel,
backdrop: this.options.allowCancel ? true : 'static'
backdrop: this.options.allowBackdrop ? 'static' : true
}, this.options.modalOptions));
//Focus OK button
......
......@@ -41,13 +41,11 @@ define([
// Default
'*actions': 'defaultAction'
},
initialize: function() {
initialize: function(options) {
_.extend(this, _.pick(options, 'entityDefCollection'));
this.showRegions();
this.bindCommonEvents();
this.listenTo(this, 'route', this.postRouteExecute, this);
this.globalVent = new Backbone.Wreqr.EventAggregator();
this.catalogVent = new Backbone.Wreqr.EventAggregator();
this.tagVent = new Backbone.Wreqr.EventAggregator();
this.tagCollection = new VTagList();
},
bindCommonEvents: function() {
......@@ -111,15 +109,14 @@ define([
var paramObj = Utils.getUrlState.getQueryParams();
this.collection = new VCatalogList();
this.collection.url = url;
App.rNHeader.show(new BusinessCatalogHeader({ 'globalVent': that.globalVent, 'url': url, 'collection': this.collection }));
App.rNHeader.show(new BusinessCatalogHeader({ 'url': url, 'collection': this.collection }));
if (!App.rSideNav.currentView) {
App.rSideNav.show(new SideNavLayoutView({ 'globalVent': that.globalVent, 'url': url, 'collection': that.tagCollection }));
App.rSideNav.show(new SideNavLayoutView({ 'url': url, 'collection': that.tagCollection }));
} else {
App.rSideNav.currentView.RBusinessCatalogLayoutView.currentView.manualRender("/" + url);
App.rSideNav.currentView.selectTab();
}
App.rNContent.show(new BusinessCatalogDetailLayoutView({
'globalVent': that.globalVent,
'url': url,
'collection': this.collection
}));
......@@ -139,16 +136,16 @@ define([
'collection/VEntityList'
], function(Header, DetailPageLayoutView, SideNavLayoutView, VEntityList) {
this.entityCollection = new VEntityList([], {});
App.rNHeader.show(new Header({ 'globalVent': that.globalVent }));
App.rNHeader.show(new Header());
if (!App.rSideNav.currentView) {
App.rSideNav.show(new SideNavLayoutView({ 'globalVent': that.globalVent, 'collection': that.tagCollection }));
App.rSideNav.show(new SideNavLayoutView({ 'collection': that.tagCollection }));
} else {
App.rSideNav.currentView.selectTab();
}
App.rNContent.show(new DetailPageLayoutView({
'globalVent': that.globalVent,
'collection': this.entityCollection,
'id': id,
'entityDefCollection': that.entityDefCollection,
}));
this.entityCollection.url = UrlLinks.entitiesApiUrl(id);
this.entityCollection.fetch({ reset: true });
......@@ -163,10 +160,9 @@ define([
'views/business_catalog/SideNavLayoutView',
'views/tag/TagDetailLayoutView',
], function(Header, BusinessCatalogLayoutView, SideNavLayoutView, TagDetailLayoutView) {
App.rNHeader.show(new Header({ 'globalVent': that.globalVent, 'vent': that.catalogVent }));
App.rNHeader.show(new Header());
if (!App.rSideNav.currentView) {
App.rSideNav.show(new SideNavLayoutView({
'globalVent': that.globalVent,
'tag': tagName,
'collection': that.tagCollection
}));
......@@ -177,7 +173,6 @@ define([
if (tagName) {
App.rNContent.show(new TagDetailLayoutView({
'globalVent': that.globalVent,
'tag': tagName,
'collection': that.tagCollection
}));
......@@ -193,10 +188,9 @@ define([
'views/search/SearchDetailLayoutView',
], function(Header, BusinessCatalogLayoutView, SideNavLayoutView, SearchDetailLayoutView) {
var paramObj = Utils.getUrlState.getQueryParams();
App.rNHeader.show(new Header({ 'globalVent': that.globalVent }));
App.rNHeader.show(new Header());
if (!App.rSideNav.currentView) {
App.rSideNav.show(new SideNavLayoutView({
'globalVent': that.globalVent,
'collection': that.tagCollection
}));
} else {
......@@ -209,8 +203,8 @@ define([
}
if (Globals.entityCreate && Utils.getUrlState.isSearchTab()) {
App.rNContent.show(new SearchDetailLayoutView({
'globalVent': that.globalVent,
'value': paramObj,
'entityDefCollection': that.entityDefCollection,
'initialView': true
}))
} else {
......@@ -228,10 +222,9 @@ define([
'views/search/SearchDetailLayoutView'
], function(Header, BusinessCatalogLayoutView, SideNavLayoutView, SearchDetailLayoutView) {
var paramObj = Utils.getUrlState.getQueryParams();
App.rNHeader.show(new Header({ 'globalVent': that.globalVent, 'vent': that.catalogVent }));
App.rNHeader.show(new Header());
if (!App.rSideNav.currentView) {
App.rSideNav.show(new SideNavLayoutView({
'globalVent': that.globalVent,
'value': paramObj,
'collection': that.tagCollection
}));
......@@ -240,8 +233,8 @@ define([
}
App.rSideNav.currentView.selectTab();
App.rNContent.show(new SearchDetailLayoutView({
'globalVent': that.globalVent,
'value': paramObj,
'entityDefCollection': that.entityDefCollection,
'initialView': paramObj.query.trim().length === 0
}));
});
......
......@@ -36,6 +36,9 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
require(['models/VTag'], function(VTag) {
var tagModel = new VTag();
if (options && options.guid && options.tagName) {
if (options.showLoader) {
options.showLoader();
}
tagModel.deleteTag(options.guid, options.tagName, {
skipDefaultError: true,
success: function(data) {
......@@ -61,6 +64,9 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
if (response && response.responseJSON) {
message = response.responseJSON.errorMessage;
}
if (options.hideLoader) {
options.hideLoader();
}
Utils.notifyError({
content: message
});
......@@ -69,6 +75,19 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
}
});
};
CommonViewFunction.findAndmergeRefEntity = function(attributeObject, referredEntities) {
_.each(attributeObject, function(obj, key) {
if (_.isObject(obj)) {
if (_.isArray(obj)) {
_.each(obj, function(value) {
_.extend(value, referredEntities[value.guid]);
});
} else {
_.extend(obj, referredEntities[obj.guid]);
}
}
});
}
CommonViewFunction.propertyTable = function(valueObject, scope, searchTable) {
var table = "",
fetchInputOutputValue = function(id) {
......@@ -77,9 +96,10 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
++scope.fetchList
}
scope.entityModel.getEntity(id, {
success: function(data) {
success: function(serverData) {
var value = "",
deleteButton = "";
deleteButton = "",
data = serverData.entity;
if (data && data.attributes) {
if (data.attributes.name) {
value = data.attributes.name;
......@@ -118,18 +138,19 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
key = _.escape(key)
var keyValue = valueObject[key],
valueOfArray = [];
if (_.isArray(keyValue) || _.isObject(keyValue)) {
if (_.isObject(keyValue)) {
if (!_.isArray(keyValue) && _.isObject(keyValue)) {
keyValue = [keyValue];
}
var subLink = "";
for (var i = 0; i < keyValue.length; i++) {
var inputOutputField = keyValue[i],
id = inputOutputField.guid || inputOutputField.id,
id = inputOutputField.guid || (_.isObject(inputOutputField.id) ? inputOutputField.id.id : inputOutputField.id),
tempLink = "",
readOnly = false;
if (Enums.entityStateReadOnly[inputOutputField.status]) {
readOnly = inputOutputField.status
status = inputOutputField.status || (_.isObject(inputOutputField.id) ? inputOutputField.id.state : inputOutputField.state),
readOnly = Enums.entityStateReadOnly[status];
if (!inputOutputField.attributes && inputOutputField.values) {
inputOutputField['attributes'] = inputOutputField.values;
}
if (_.isString(inputOutputField) || _.isBoolean(inputOutputField) || _.isNumber(inputOutputField)) {
if (inputOutputField.indexOf("$") == -1) {
......@@ -289,7 +310,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
if (!obj) {
return "";
}
var traits = obj.classificationNames,
var traits = obj.classificationNames || _.pluck(obj.classifications, 'typeName'),
url = "",
deleteHtml = "",
html = "",
......@@ -332,7 +353,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
}
CommonViewFunction.tagForTable = function(obj) {
var traits = obj.classificationNames,
var traits = obj.classificationNames || _.pluck(obj.classifications, 'typeName'),
atags = "",
addTag = "",
popTag = "",
......
......@@ -57,7 +57,7 @@ define(['require',
* @constructs
*/
initialize: function(options) {
_.extend(this, _.pick(options, 'globalVent', 'guid', 'vent', 'entityObject'));
_.extend(this, _.pick(options, 'guid', 'entity'));
this.entityCollection = new VEntityList();
this.count = 26;
this.entityCollection.url = UrlLinks.entityCollectionaudit(this.guid);
......@@ -78,7 +78,6 @@ define(['require',
paginatorOpts: {}
};
this.currPage = 1;
this.bindEvents();
},
onRender: function() {
$.extend(this.entityCollection.queryParams, { count: this.count });
......@@ -89,17 +88,7 @@ define(['require',
});
this.renderTableLayoutView();
},
bindEvents: function() {
var that = this;
this.listenTo(this.vent, "reset:collection", function() {
this.fetchCollection({
next: this.ui.nextAuditData,
nextClick: false,
previous: this.ui.previousAuditData
});
}, this);
},
bindEvents: function() {},
getToOffset: function() {
var toOffset = 0;
if (this.entityCollection.models.length < this.count) {
......@@ -169,7 +158,6 @@ define(['require',
require(['utils/TableLayout'], function(TableLayout) {
var cols = new Backgrid.Columns(that.getAuditTableColumns());
that.RAuditTableLayoutView.show(new TableLayout(_.extend({}, that.commonTableOptions, {
globalVent: that.globalVent,
columns: cols
})));
if (!(that.entityCollection.models.length < that.count)) {
......@@ -236,7 +224,7 @@ define(['require',
that.action = $(e.target).data("action");
var eventModel = that.entityCollection.findWhere({ 'eventKey': $(e.currentTarget).data('modalid') }).toJSON(),
collectionModel = new that.entityCollection.model(eventModel),
view = new CreateAuditTableLayoutView({ guid: that.guid, entityModel: collectionModel, action: that.action, entityObject: that.entityObject });
view = new CreateAuditTableLayoutView({ guid: that.guid, entityModel: collectionModel, action: that.action, entity: that.entity });
var modal = new Modal({
title: that.action,
content: view,
......
......@@ -54,7 +54,7 @@ define(['require',
* @constructs
*/
initialize: function(options) {
_.extend(this, _.pick(options, 'globalVent', 'guid', 'entityModel', 'action', 'entityObject'));
_.extend(this, _.pick(options, 'guid', 'entityModel', 'action', 'entity'));
},
bindEvents: function() {},
onRender: function() {
......@@ -63,24 +63,27 @@ define(['require',
auditTableGenerate: function() {
var that = this,
table = "";
if (this.entityModel.get('details').search('{') >= 0) {
var appendedString = "{" + this.entityModel.get('details') + "}";
var detailObj = this.entityModel.get('details');
if (detailObj && detailObj.search(':') >= 0) {
var parseDetailsObject = detailObj;
var appendedString = "{" + detailObj + "}";
var auditData = appendedString.split('"')[0].split(':')[0].split("{")[1];
try {
var detailsObject = JSON.parse(appendedString.replace("{" + auditData + ":", '{"' + auditData + '":'))[auditData];
parseDetailsObject = JSON.parse(appendedString.replace("{" + auditData + ":", '{"' + auditData + '":'))[auditData];
var name = _.escape(parseDetailsObject.typeName);
} catch (err) {
Utils.serverErrorHandler();
}
//Append string for JSON parse
if (detailsObject) {
var valueObject = detailsObject.values;
if (parseDetailsObject.search(':') >= 0) {
var name = parseDetailsObject.split(":")[1];
}
}
if ((this.action == Enums.auditAction.TAG_ADD || Enums.auditAction.ENTITY_CREATE) && detailsObject) {
this.ui.auditHeaderValue.html('<th>' + (this.action === Enums.auditAction.ENTITY_CREATE ? Enums.auditAction.ENTITY_CREATE : Enums.auditAction.TAG_ADD) + '</th>');
this.ui.auditValue.html("<tr><td>" + _.escape(detailsObject.typeName) + "</td></tr>");
} else {
var values = parseDetailsObject.values;
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.auditValue.html("<tr><td>" + name + "</td></tr>");
} else if (parseDetailsObject && parseDetailsObject.values) {
this.ui.auditHeaderValue.html('<th>Key</th><th>New Value</th>');
table = CommonViewFunction.propertyTable(valueObject, this);
//CommonViewFunction.findAndmergeRefEntity(attributeObject, that.referredEntities);
table = CommonViewFunction.propertyTable(values, this);
if (table.length) {
this.ui.noData.hide();
this.ui.tableAudit.show();
......@@ -90,9 +93,6 @@ define(['require',
this.ui.tableAudit.hide();
}
}
} else if (this.action == Enums.auditAction.TAG_DELETE || Enums.auditAction.ENTITY_DELETE) {
this.ui.auditHeaderValue.html('<th>' + Enums.auditAction.TAG_DELETE || Enums.auditAction.ENTITY_DELETE + '</th>');
this.ui.auditValue.html("<tr><td>" + (this.entityObject.name || this.entityObject.qualifiedName) + "</td></tr>");
}
},
......
......@@ -55,7 +55,7 @@ define(['require',
* @constructs
*/
initialize: function(options) {
_.extend(this, _.pick(options, 'globalVent', 'url', 'collection'));
_.extend(this, _.pick(options, 'url', 'collection'));
this.bindEvents();
},
bindEvents: function() {
......
......@@ -29,7 +29,7 @@ define(['require',
regions: {},
events: {},
initialize: function(options) {
_.extend(this, _.pick(options, 'globalVent', 'url', 'collection'));
_.extend(this, _.pick(options, 'url', 'collection'));
this.value = [];
},
/**
......
......@@ -66,7 +66,7 @@ define(['require',
return events;
},
initialize: function(options) {
_.extend(this, _.pick(options, 'globalVent', 'url', 'value', 'tag', 'selectFirst','collection'));
_.extend(this, _.pick(options, 'url', 'value', 'tag', 'selectFirst', 'collection'));
if (Globals.taxonomy) {
this.tabClass = "tab col-sm-4";
} else {
......@@ -88,7 +88,6 @@ define(['require',
var that = this;
require(['views/business_catalog/BusinessCatalogLayoutView'], function(BusinessCatalogLayoutView) {
that.RBusinessCatalogLayoutView.show(new BusinessCatalogLayoutView({
globalVent: that.globalVent,
url: that.url
}));
});
......@@ -97,7 +96,6 @@ define(['require',
var that = this;
require(['views/tag/TagLayoutView'], function(TagLayoutView) {
that.RTagLayoutView.show(new TagLayoutView({
globalVent: that.globalVent,
collection: that.collection,
tag: that.tag
}));
......@@ -107,8 +105,6 @@ define(['require',
var that = this;
require(['views/search/SearchLayoutView'], function(SearchLayoutView) {
that.RSearchLayoutView.show(new SearchLayoutView({
globalVent: that.globalVent,
vent: that.vent,
value: that.value
}));
});
......
......@@ -92,7 +92,7 @@ define(['require',
* @constructs
*/
initialize: function(options) {
_.extend(this, _.pick(options, 'globalVent', 'url', 'viewBased'));
_.extend(this, _.pick(options, 'url', 'viewBased'));
this.parentCollection = new VCatalogList();
this.childCollection = new VCatalogList();
this.taxanomy = new VCatalogList();
......
......@@ -41,7 +41,7 @@ define(['require',
* @constructs
*/
initialize: function(options) {
_.extend(this, _.pick(options, 'globalVent'));
_.extend(this, options);
},
bindEvents: function() {
......
......@@ -102,14 +102,14 @@ define(['require',
* @constructs
*/
initialize: function(options) {
_.extend(this, _.pick(options, 'globalVent', 'collection', 'vent', 'id'));
_.extend(this, _.pick(options, 'collection', 'id', 'entityDefCollection'));
this.bindEvents();
this.auditVent = new Backbone.Wreqr.EventAggregator();
},
bindEvents: function() {
var that = this;
this.listenTo(this.collection, 'reset', function() {
var collectionJSON = this.collection.first().toJSON();
var entityObject = this.collection.first().toJSON();
var collectionJSON = entityObject.entity;
if (collectionJSON && collectionJSON.guid) {
var tagGuid = collectionJSON.guid;
this.readOnly = Enums.entityStateReadOnly[collectionJSON.status];
......@@ -123,24 +123,13 @@ define(['require',
}
if (collectionJSON) {
if (collectionJSON.attributes) {
if (collectionJSON.attributes.name) {
this.name = collectionJSON.attributes.name
}
if (!this.name && collectionJSON.attributes.qualifiedName) {
this.name = collectionJSON.attributes.qualifiedName;
}
if (!this.name && collectionJSON.displayText) {
this.name = collectionJSON.displayText;
}
this.name = (_.escape(collectionJSON.attributes && collectionJSON.attributes.name ? collectionJSON.attributes.name : null) || _.escape(collectionJSON.displayText) || collectionJSON.guid);
if (this.name && collectionJSON.typeName) {
this.name = this.name + ' (' + collectionJSON.typeName + ')';
}
if (!this.name && collectionJSON.typeName) {
this.name = collectionJSON.typeName;
}
if (!this.name && this.id) {
this.name = this.id;
}
this.description = collectionJSON.attributes.description;
if (this.name) {
this.ui.title.show();
......@@ -173,12 +162,27 @@ define(['require',
}
}
this.hideLoader();
this.renderEntityDetailTableLayoutView();
this.renderAuditTableLayoutView(this.id, collectionJSON.attributes);
this.renderTagTableLayoutView(tagGuid);
this.renderTermTableLayoutView(tagGuid);
this.renderLineageLayoutView(this.id);
this.renderSchemaLayoutView(this.id);
var obj = {
entity: collectionJSON,
referredEntities: entityObject.referredEntities,
guid: this.id,
assetName: this.name,
entityDefCollection: this.entityDefCollection,
fetchCollection: this.fetchCollection.bind(that)
}
this.renderEntityDetailTableLayoutView(obj);
this.renderAuditTableLayoutView(obj);
this.renderTagTableLayoutView(obj);
this.renderTermTableLayoutView(_.extend({}, obj, { term: true }));
this.renderLineageLayoutView(obj);
// To render Schema check attribute "schemaElementsAttribute"
var schemaOptions = this.entityDefCollection.find({ name: collectionJSON.typeName }).get('options');
if (schemaOptions && schemaOptions.hasOwnProperty('schemaElementsAttribute') && schemaOptions.schemaElementsAttribute !== "") {
this.$('.schemaTable').show();
this.renderSchemaLayoutView(_.extend({}, obj, {
attribute: collectionJSON.attributes[schemaOptions.schemaElementsAttribute]
}));
}
}, this);
this.listenTo(this.collection, 'error', function(model, response) {
this.$('.fontLoader').hide();
......@@ -265,7 +269,6 @@ define(['require',
var that = this;
require(['views/tag/addTagModalView'], function(AddTagModalView) {
var view = new AddTagModalView({
vent: that.vent,
guid: that.id,
tagList: _.map(that.collection.first().toJSON().classifications, function(obj) {
return obj.typeName;
......@@ -300,65 +303,40 @@ define(['require',
});
},
renderEntityDetailTableLayoutView: function() {
renderEntityDetailTableLayoutView: function(obj) {
var that = this;
require(['views/entity/EntityDetailTableLayoutView'], function(EntityDetailTableLayoutView) {
that.REntityDetailTableLayoutView.show(new EntityDetailTableLayoutView({
globalVent: that.globalVent,
collection: that.collection
}));
that.REntityDetailTableLayoutView.show(new EntityDetailTableLayoutView(obj));
});
},
renderTagTableLayoutView: function(tagGuid) {
renderTagTableLayoutView: function(obj) {
var that = this;
require(['views/tag/TagDetailTableLayoutView'], function(TagDetailTableLayoutView) {
that.RTagTableLayoutView.show(new TagDetailTableLayoutView({
globalVent: that.globalVent,
collection: that.collection,
guid: tagGuid,
assetName: that.name
}));
that.RTagTableLayoutView.show(new TagDetailTableLayoutView(obj));
});
},
renderLineageLayoutView: function(tagGuid) {
renderTermTableLayoutView: function(obj) {
var that = this;
require(['views/graph/LineageLayoutView'], function(LineageLayoutView) {
that.RLineageLayoutView.show(new LineageLayoutView({
globalVent: that.globalVent,
guid: tagGuid
}));
require(['views/tag/TagDetailTableLayoutView'], function(TagDetailTableLayoutView) {
that.RTermTableLayoutView.show(new TagDetailTableLayoutView(obj));
});
},
renderSchemaLayoutView: function(tagGuid) {
renderLineageLayoutView: function(obj) {
var that = this;
require(['views/schema/SchemaLayoutView'], function(SchemaLayoutView) {
that.RSchemaTableLayoutView.show(new SchemaLayoutView({
globalVent: that.globalVent,
guid: tagGuid
}));
require(['views/graph/LineageLayoutView'], function(LineageLayoutView) {
that.RLineageLayoutView.show(new LineageLayoutView(obj));
});
},
renderAuditTableLayoutView: function(tagGuid, entityObject) {
renderSchemaLayoutView: function(obj) {
var that = this;
require(['views/audit/AuditTableLayoutView'], function(AuditTableLayoutView) {
that.RAuditTableLayoutView.show(new AuditTableLayoutView({
globalVent: that.globalVent,
guid: tagGuid,
vent: that.auditVent,
entityObject: entityObject
}));
require(['views/schema/SchemaLayoutView'], function(SchemaLayoutView) {
that.RSchemaTableLayoutView.show(new SchemaLayoutView(obj));
});
},
renderTermTableLayoutView: function(tagGuid) {
renderAuditTableLayoutView: function(obj) {
var that = this;
require(['views/tag/TagDetailTableLayoutView'], function(TagDetailTableLayoutView) {
that.RTermTableLayoutView.show(new TagDetailTableLayoutView({
globalVent: that.globalVent,
collection: that.collection,
guid: tagGuid,
assetName: that.name,
term: true
}));
require(['views/audit/AuditTableLayoutView'], function(AuditTableLayoutView) {
that.RAuditTableLayoutView.show(new AuditTableLayoutView(obj));
});
},
onClickEditEntity: function(e) {
......
......@@ -19,8 +19,9 @@
define(['require',
'backbone',
'hbs!tmpl/entity/EntityDetailTableLayoutView_tmpl',
'utils/CommonViewFunction'
], function(require, Backbone, EntityDetailTableLayoutView_tmpl, CommonViewFunction) {
'utils/CommonViewFunction',
'models/VEntity',
], function(require, Backbone, EntityDetailTableLayoutView_tmpl, CommonViewFunction, VEntity) {
'use strict';
var EntityDetailTableLayoutView = Backbone.Marionette.LayoutView.extend(
......@@ -47,9 +48,8 @@ define(['require',
* @constructs
*/
initialize: function(options) {
_.extend(this, _.pick(options, 'globalVent', 'collection'));
this.collectionObject = this.collection.toJSON();
this.entityModel = new this.collection.model();
_.extend(this, _.pick(options, 'entity', 'referredEntities'));
this.entityModel = new VEntity({});
},
bindEvents: function() {},
onRender: function() {
......@@ -57,13 +57,14 @@ define(['require',
},
entityTableGenerate: function() {
var that = this,
attributeObject = this.collection.first().toJSON().attributes;
if (attributeObject) {
attributeObject = this.entity.attributes;
CommonViewFunction.findAndmergeRefEntity(attributeObject, that.referredEntities);
if (attributeObject && attributeObject.columns) {
var valueSorted = _.sortBy(attributeObject.columns, function(val) {
return val.attributes.position
});
attributeObject.columns = valueSorted;
}
attributeObject.columns = valueSorted;
var table = CommonViewFunction.propertyTable(attributeObject, this);
that.ui.detailValue.append(table);
}
......
......@@ -56,7 +56,7 @@ define(['require',
* @constructs
*/
initialize: function(options) {
_.extend(this, _.pick(options, 'globalVent', 'guid'));
_.extend(this, _.pick(options, 'guid'));
this.entityModel = new VEntity();
this.collection = new VLineageList();
this.typeMap = {};
......
......@@ -72,7 +72,7 @@ define(['require',
* @constructs
*/
initialize: function(options) {
_.extend(this, _.pick(options, 'globalVent', 'value'));
_.extend(this, _.pick(options, 'value'));
this.typecollection = new VTagList([], {});
this.typecollection.url = UrlLinks.typesApiUrl();
this.type = "fulltext";
......
......@@ -59,7 +59,7 @@ define(['require',
* @constructs
*/
initialize: function(options) {
_.extend(this, _.pick(options, 'globalVent', 'tag', 'collection'));
_.extend(this, _.pick(options, 'tag', 'collection'));
},
bindEvents: function() {
this.listenTo(this.collection, 'reset', function() {
......
......@@ -44,7 +44,7 @@ define(['require',
* @constructs
*/
initialize: function(options) {
_.extend(this, _.pick(options, 'globalVent', 'tag', 'collection'));
_.extend(this, _.pick(options, 'tag', 'collection'));
},
bindEvents: function() {},
onRender: function() {
......
......@@ -60,8 +60,8 @@ define(['require',
* @constructs
*/
initialize: function(options) {
_.extend(this, _.pick(options, 'globalVent', 'collection', 'guid', 'term', 'assetName'));
this.collectionObject = this.collection.first().toJSON();
_.extend(this, _.pick(options, 'entity', 'guid', 'term', 'assetName'));
this.collectionObject = this.entity;
this.tagTermCollection = new VTagList();
var tagorterm = _.toArray(this.collectionObject.classifications),
tagTermList = [],
......@@ -102,7 +102,6 @@ define(['require',
require(['utils/TableLayout'], function(TableLayout) {
var cols = new Backgrid.Columns(that.getSchemaTableColumns());
that.RTagTermTableLayoutView.show(new TableLayout(_.extend({}, that.commonTableOptions, {
globalVent: that.globalVent,
columns: cols
})));
});
......@@ -164,7 +163,6 @@ define(['require',
var that = this;
require(['views/tag/addTagModalView'], function(AddTagModalView) {
var view = new AddTagModalView({
vent: that.vent,
guid: that.guid,
modalCollection: that.collection
});
......
......@@ -58,7 +58,7 @@ define(['require',
* @constructs
*/
initialize: function(options) {
_.extend(this, _.pick(options, 'globalVent', 'tag', 'collection'));
_.extend(this, _.pick(options, 'tag', 'collection'));
},
bindEvents: function() {
var that = this;
......@@ -143,7 +143,10 @@ define(['require',
return model.get('name').toLowerCase();
};
that.collection.fullCollection.sort().each(function(model) {
var name = _.escape(model.get('name'))
var name = _.escape(model.get('name'));
if (name.indexOf(".") > -1) {
return;
}
if (searchString) {
if (name.search(new RegExp(searchString, "i")) != -1) {
// data-name="<space>'<tagName>'" Space is required for DSL search Input
......@@ -165,7 +168,7 @@ define(['require',
},
onClickCreateTag: function(e) {
var that = this;
$(e.currentTarget).blur();
$(e.currentTarget).attr("disabled", "true");
require([
'views/tag/CreateTagLayoutView',
'modules/Modal'
......@@ -184,7 +187,7 @@ define(['require',
modal.$el.find('button.ok').removeAttr("disabled");
});
view.ui.tagName.on('keyup', function(e) {
if ((e.keyCode == 8 || e.keyCode == 32 || e.keyCode == 46) && e.currentTarget.value == "") {
if ((e.keyCode == 8 || e.keyCode == 32 || e.keyCode == 46) && e.currentTarget.value.trim() == "") {
modal.$el.find('button.ok').attr("disabled", "true");
}
});
......@@ -196,10 +199,12 @@ define(['require',
});
});
modal.on('ok', function() {
modal.$el.find('button.ok').attr("disabled", "true");
that.onCreateButton(view, modal);
});
modal.on('closeModal', function() {
modal.trigger('cancel');
that.ui.createTag.removeAttr("disabled");
});
});
},
......@@ -243,6 +248,7 @@ define(['require',
};
new this.collection.model().set(this.json).save(null, {
success: function(model, response) {
that.ui.createTag.removeAttr("disabled");
that.createTag = true;
that.fetchCollections();
that.collection.add(model)
......
......@@ -48,7 +48,7 @@ define(['require',
*/
initialize: function(options) {
var that = this;
_.extend(this, _.pick(options, 'vent', 'modalCollection', 'guid', 'callback', 'multiple', 'showLoader', 'hideLoader', 'tagList'));
_.extend(this, _.pick(options, 'modalCollection', 'guid', 'callback', 'multiple', 'showLoader', 'hideLoader', 'tagList'));
this.collection = new VTagList();
this.commonCollection = new VTagList();
this.asyncAttrFetchCounter = 0;
......@@ -81,7 +81,7 @@ define(['require',
if (Enums.entityStateReadOnly[entity.model.status]) {
obj.deletedEntity.push(name);
} else {
if (_.indexOf(entity.model.classificationNames, tagName) === -1) {
if (_.indexOf((entity.model.classificationNames || _.pluck(entity.model.classifications, 'typeName')), tagName) === -1) {
obj.guid.push(entity.model.guid)
} else {
obj.skipEntity.push(name);
......
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