ATLAS-1521 : Update UI to eliminate REST calls to obtain schema data Signed-off-by: Madhan Neethiraj <[email protected]>
Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/dd744765 Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/dd744765 Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/dd744765 Branch: refs/heads/master Commit: dd7447658e4d917eb9a25aec6412b0a96016cc5c Parents: 808eb1d Author: kevalbhatt <[email protected]> Authored: Fri Feb 3 19:19:16 2017 +0530 Committer: Madhan Neethiraj <[email protected]> Committed: Tue Feb 7 19:40:09 2017 -0800 ---------------------------------------------------------------------- dashboardv2/public/js/collection/VEntityList.js | 39 ++- dashboardv2/public/js/main.js | 28 +- dashboardv2/public/js/modules/Modal.js | 3 +- dashboardv2/public/js/router/Router.js | 31 +-- .../public/js/utils/CommonViewFunction.js | 39 ++- .../js/views/audit/AuditTableLayoutView.js | 18 +- .../views/audit/CreateAuditTableLayoutView.js | 34 +-- .../BusinessCatalogDetailLayoutView.js | 2 +- .../business_catalog/BusinessCatalogHeader.js | 2 +- .../views/business_catalog/SideNavLayoutView.js | 6 +- .../js/views/business_catalog/TreeLayoutView.js | 2 +- .../public/js/views/common/aboutAtlas.js | 2 +- .../views/detail_page/DetailPageLayoutView.js | 104 +++---- .../views/entity/EntityDetailTableLayoutView.js | 17 +- .../public/js/views/graph/LineageLayoutView.js | 2 +- .../public/js/views/schema/SchemaLayoutView.js | 271 +++++++------------ .../public/js/views/search/SearchLayoutView.js | 2 +- .../views/tag/TagAttributeDetailLayoutView.js | 2 +- .../public/js/views/tag/TagDetailLayoutView.js | 2 +- .../js/views/tag/TagDetailTableLayoutView.js | 6 +- .../public/js/views/tag/TagLayoutView.js | 14 +- .../public/js/views/tag/addTagModalView.js | 4 +- 22 files changed, 292 insertions(+), 338 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/dd744765/dashboardv2/public/js/collection/VEntityList.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/collection/VEntityList.js b/dashboardv2/public/js/collection/VEntityList.js index 642ef93..e5ee38e 100644 --- a/dashboardv2/public/js/collection/VEntityList.js +++ b/dashboardv2/public/js/collection/VEntityList.js @@ -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); http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/dd744765/dashboardv2/public/js/main.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/main.js b/dashboardv2/public/js/main.js index 2ba87a7..ae5f6af 100644 --- a/dashboardv2/public/js/main.js +++ b/dashboardv2/public/js/main.js @@ -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(); } }); }); http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/dd744765/dashboardv2/public/js/modules/Modal.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/modules/Modal.js b/dashboardv2/public/js/modules/Modal.js index 7889fea..1f64f40 100644 --- a/dashboardv2/public/js/modules/Modal.js +++ b/dashboardv2/public/js/modules/Modal.js @@ -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 http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/dd744765/dashboardv2/public/js/router/Router.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/router/Router.js b/dashboardv2/public/js/router/Router.js index 7394946..5fbd656 100644 --- a/dashboardv2/public/js/router/Router.js +++ b/dashboardv2/public/js/router/Router.js @@ -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 })); }); http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/dd744765/dashboardv2/public/js/utils/CommonViewFunction.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/utils/CommonViewFunction.js b/dashboardv2/public/js/utils/CommonViewFunction.js index e15759a..318067b 100644 --- a/dashboardv2/public/js/utils/CommonViewFunction.js +++ b/dashboardv2/public/js/utils/CommonViewFunction.js @@ -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 = "", http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/dd744765/dashboardv2/public/js/views/audit/AuditTableLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/audit/AuditTableLayoutView.js b/dashboardv2/public/js/views/audit/AuditTableLayoutView.js index 2c0bc8c..da8cfda 100644 --- a/dashboardv2/public/js/views/audit/AuditTableLayoutView.js +++ b/dashboardv2/public/js/views/audit/AuditTableLayoutView.js @@ -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, http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/dd744765/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 330809f..0abff47 100644 --- a/dashboardv2/public/js/views/audit/CreateAuditTableLayoutView.js +++ b/dashboardv2/public/js/views/audit/CreateAuditTableLayoutView.js @@ -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>"); } }, http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/dd744765/dashboardv2/public/js/views/business_catalog/BusinessCatalogDetailLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/business_catalog/BusinessCatalogDetailLayoutView.js b/dashboardv2/public/js/views/business_catalog/BusinessCatalogDetailLayoutView.js index 6971a3a..c7fcfa1 100644 --- a/dashboardv2/public/js/views/business_catalog/BusinessCatalogDetailLayoutView.js +++ b/dashboardv2/public/js/views/business_catalog/BusinessCatalogDetailLayoutView.js @@ -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() { http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/dd744765/dashboardv2/public/js/views/business_catalog/BusinessCatalogHeader.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/business_catalog/BusinessCatalogHeader.js b/dashboardv2/public/js/views/business_catalog/BusinessCatalogHeader.js index 7247ac0..4994372 100644 --- a/dashboardv2/public/js/views/business_catalog/BusinessCatalogHeader.js +++ b/dashboardv2/public/js/views/business_catalog/BusinessCatalogHeader.js @@ -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 = []; }, /** http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/dd744765/dashboardv2/public/js/views/business_catalog/SideNavLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/business_catalog/SideNavLayoutView.js b/dashboardv2/public/js/views/business_catalog/SideNavLayoutView.js index 43bdaeb..9254213 100644 --- a/dashboardv2/public/js/views/business_catalog/SideNavLayoutView.js +++ b/dashboardv2/public/js/views/business_catalog/SideNavLayoutView.js @@ -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 })); }); http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/dd744765/dashboardv2/public/js/views/business_catalog/TreeLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/business_catalog/TreeLayoutView.js b/dashboardv2/public/js/views/business_catalog/TreeLayoutView.js index b872e50..7c8eb23 100644 --- a/dashboardv2/public/js/views/business_catalog/TreeLayoutView.js +++ b/dashboardv2/public/js/views/business_catalog/TreeLayoutView.js @@ -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(); http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/dd744765/dashboardv2/public/js/views/common/aboutAtlas.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/common/aboutAtlas.js b/dashboardv2/public/js/views/common/aboutAtlas.js index 8fff13c..9561b83 100644 --- a/dashboardv2/public/js/views/common/aboutAtlas.js +++ b/dashboardv2/public/js/views/common/aboutAtlas.js @@ -41,7 +41,7 @@ define(['require', * @constructs */ initialize: function(options) { - _.extend(this, _.pick(options, 'globalVent')); + _.extend(this, options); }, bindEvents: function() { http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/dd744765/dashboardv2/public/js/views/detail_page/DetailPageLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/detail_page/DetailPageLayoutView.js b/dashboardv2/public/js/views/detail_page/DetailPageLayoutView.js index d778e3e..83918e7 100644 --- a/dashboardv2/public/js/views/detail_page/DetailPageLayoutView.js +++ b/dashboardv2/public/js/views/detail_page/DetailPageLayoutView.js @@ -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) { http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/dd744765/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 4facf53..a9f7e29 100644 --- a/dashboardv2/public/js/views/entity/EntityDetailTableLayoutView.js +++ b/dashboardv2/public/js/views/entity/EntityDetailTableLayoutView.js @@ -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); } http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/dd744765/dashboardv2/public/js/views/graph/LineageLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/graph/LineageLayoutView.js b/dashboardv2/public/js/views/graph/LineageLayoutView.js index 853b0bd..32766c3 100644 --- a/dashboardv2/public/js/views/graph/LineageLayoutView.js +++ b/dashboardv2/public/js/views/graph/LineageLayoutView.js @@ -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 = {}; http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/dd744765/dashboardv2/public/js/views/schema/SchemaLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/schema/SchemaLayoutView.js b/dashboardv2/public/js/views/schema/SchemaLayoutView.js index 483b36c..b15d206 100644 --- a/dashboardv2/public/js/views/schema/SchemaLayoutView.js +++ b/dashboardv2/public/js/views/schema/SchemaLayoutView.js @@ -91,9 +91,8 @@ define(['require', * @constructs */ initialize: function(options) { - _.extend(this, _.pick(options, 'globalVent', 'guid', 'vent')); + _.extend(this, _.pick(options, 'guid', 'entityDefCollection', 'attribute', 'referredEntities', 'fetchCollection')); this.schemaCollection = new VSchemaList([], {}); - this.schemaCollection.url = UrlLinks.schemaApiUrl(this.guid); this.commonTableOptions = { collection: this.schemaCollection, includeFilter: false, @@ -121,15 +120,10 @@ define(['require', this.arr = []; var that = this; this.schemaCollection.find(function(item) { + var obj = item.toJSON(); if (item.get('isEnable')) { - var term = []; - var obj = {} - obj['displayText'] = item.get("name") || item.get("qualifiedName") - obj['status'] = item.get("$id$").state; - obj['classificationNames'] = _.keys(item.get('$traits$')); - obj['guid'] = item.get("$id$").id || item.get("$id$"); that.arr.push({ - id: item.get("$id$").id || item.get("$id$"), + id: obj.guid, model: obj }); } @@ -146,15 +140,24 @@ define(['require', this.$('.multiSelectTag').hide(); } }); - this.listenTo(this.schemaCollection, "error", function(value) { - $('.schemaTable').hide(); - this.$('.fontLoader').hide(); - }, this); }, onRender: function() { var that = this; - this.fetchCollection(); - this.renderTableLayoutView(); + _.each(this.attribute, function(obj) { + var defObj = that.entityDefCollection.find({ name: obj.typeName }); + if (defObj && defObj.get('options') && defObj.get('options').schemaAttributes) { + try { + var mapObj = JSON.parse(defObj.get('options').schemaAttributes); + var newModel = that.referredEntities[obj.guid]; + newModel.schemaTableAttribute = _.pick(newModel.attributes, mapObj); + if (newModel.attributes['position']) { + newModel['position'] = newModel.attributes['position']; + } + + that.schemaCollection.push(newModel); + } catch (e) {} + } + }); $('body').click(function(e) { var iconEvnt = e.target.nodeName; if (that.$('.popoverContainer').length) { @@ -164,53 +167,41 @@ define(['require', that.$('.popover.popoverTag').hide(); } }); + this.renderTableLayoutView(); }, - fetchCollection: function() { - var that = this; + showLoader: function() { this.$('.fontLoader').show(); - this.schemaCollection.fetch({ - skipDefaultError: true, - success: function() { - that.schemaCollection.sortByKey('position'); - that.renderTableLayoutView(); - $('.schemaTable').show(); - that.$('.fontLoader').hide(); - }, - silent: true - }); }, hideLoader: function(argument) { this.$('.fontLoader').hide(); }, renderTableLayoutView: function() { - var that = this, - count = 5; + var that = this; require(['utils/TableLayout'], function(TableLayout) { var columnCollection = Backgrid.Columns.extend({ - sortKey: "position", - comparator: function(item) { - return item.get(this.sortKey) || 999; - }, - setPositions: function() { - _.each(this.models, function(model, index) { - if (model.get('name') == "name") { - model.set("position", 2, { silent: true }); - model.set("label", "Name"); - } else if (model.get('name') == "description") { - model.set("position", 3, { silent: true }); - model.set("label", "Description"); - } else if (model.get('name') == "owner") { - model.set("position", 4, { silent: true }); - model.set("label", "Owner"); - } - }); - return this; - } + // sortKey: "position", + // comparator: function(item) { + // return item.get(this.sortKey) || 999; + // }, + // setPositions: function() { + // _.each(this.models, function(model, index) { + // if (model.get('name') == "name") { + // model.set("position", 2, { silent: true }); + // model.set("label", "Name"); + // } else if (model.get('name') == "description") { + // model.set("position", 3, { silent: true }); + // model.set("label", "Description"); + // } else if (model.get('name') == "owner") { + // model.set("position", 4, { silent: true }); + // model.set("label", "Owner"); + // } + // }); + // return this; + // } }); var columns = new columnCollection(that.getSchemaTableColumns()); - columns.setPositions().sort(); + //columns.setPositions().sort(); that.RTagLayoutView.show(new TableLayout(_.extend({}, that.commonTableOptions, { - globalVent: that.globalVent, columns: columns, includeOrderAbleColumns: true }))); @@ -230,137 +221,88 @@ define(['require', }, getSchemaTableColumns: function() { var that = this, - col = {}, - nameCheck = false, - modelJSON = this.schemaCollection.toJSON()[0]; - for (var i = 0; i < this.schemaCollection.models.length; i++) { - var model = this.schemaCollection.models[i]; - if (model && (model.get('name') || model.get('qualifiedName'))) { - nameCheck = true; + schemaFirstmodel = this.schemaCollection.first(), + col = { + Check: { + name: "selected", + label: "", + cell: "select-row", + headerCell: "select-all" + } } - } - if (nameCheck === true) { - col['name'] = { - label: "Name", - cell: "html", - editable: false, - sortable: false, - className: "searchTableName", - formatter: _.extend({}, Backgrid.CellFormatter.prototype, { - fromRaw: function(rawValue, model) { - var nameHtml = ""; - if (rawValue === undefined) { - if (model.get('qualifiedName')) { - rawValue = model.get('qualifiedName'); - } else if (model.get('$id$') && model.get('$id$').qualifiedName) { - rawValue = model.get('$id$').qualifiedName; - } else { - return ""; - } - } - if (model.get('$id$') && model.get('$id$').id) { - nameHtml = '<a href="#!/detailPage/' + model.get('$id$').id + '">' + rawValue + '</a>'; - } else { - nameHtml = '<a>' + rawValue + '</a>'; - } - if (model.get('$id$') && model.get('$id$').state && Enums.entityStateReadOnly[model.get('$id$').state]) { - nameHtml += '<button type="button" title="Deleted" class="btn btn-atlasAction btn-atlas deleteBtn"><i class="fa fa-trash"></i></button>'; - return '<div class="readOnly readOnlyLink">' + nameHtml + '</div>'; - } else { - return nameHtml; - } - } - }) - }; - }; - _.keys(modelJSON).map(function(key) { - if (key.indexOf("$") == -1) { - if (!(key === "qualifiedName" || key === "name" || key === "position")) { + if (schemaFirstmodel) { + _.each(_.keys(schemaFirstmodel.get('schemaTableAttribute')), function(key) { + if (key !== "position") { col[key] = { - cell: "Html", + label: key, + cell: "html", editable: false, sortable: false, - orderable: true, + className: "searchTableName", formatter: _.extend({}, Backgrid.CellFormatter.prototype, { fromRaw: function(rawValue, model) { - if (model) { - if (!_.isArray(rawValue) && _.isObject(rawValue)) { - if (rawValue.id) { - return '<div><a href="#!/detailPage/' + rawValue.id + '">' + rawValue.$typeName$ + '</a></div>'; - } else { - return rawValue.$typeName$; - } - } else if (_.isArray(rawValue)) { - var links = ""; - _.each(rawValue, function(val, key) { - if (val.id) { - links += '<div><a href="#!/detailPage/' + val.id + '">' + val.$typeName$ + '</a></div>'; - } else { - links += '<div>' + val.$typeName$ + '</div>'; - } - }); - return links; + var value = model.get('schemaTableAttribute')[key]; + if (key === "name" && model.get('guid')) { + var nameHtml = '<a href="#!/detailPage/' + model.get('guid') + '">' + value + '</a>'; + if (model.get('status') && Enums.entityStateReadOnly[model.get('status')]) { + nameHtml += '<button type="button" title="Deleted" class="btn btn-atlasAction btn-atlas deleteBtn"><i class="fa fa-trash"></i></button>'; + return '<div class="readOnly readOnlyLink">' + nameHtml + '</div>'; } else { - return rawValue; + return nameHtml; } } else { - return rawValue; + return value } } }) }; } - } - }); - col['Check'] = { - name: "selected", - label: "", - cell: "select-row", - headerCell: "select-all", - position: 1 - }; - col['tag'] = { - label: "Tags", - cell: "Html", - editable: false, - sortable: false, - className: 'searchTag', - formatter: _.extend({}, Backgrid.CellFormatter.prototype, { - fromRaw: function(rawValue, model) { - return CommonViewFunction.tagForTable({ - classificationNames: _.keys(model.get('$traits$')), - guid: model.get('$id$').id || model.get('$id$') || model.get('guid'), - displayText: model.get('name'), - status: model.get('$id$').state - }); - } - }) - }; - if (Globals.taxonomy) { - col['terms'] = { - label: "Terms", + }); + col['tag'] = { + label: "Tags", cell: "Html", editable: false, sortable: false, - orderable: true, - className: 'searchTerm', + className: 'searchTag', formatter: _.extend({}, Backgrid.CellFormatter.prototype, { fromRaw: function(rawValue, model) { - var returnObject = CommonViewFunction.termTableBreadcrumbMaker({ - classificationNames: _.keys(model.get('$traits$')), - guid: model.get('$id$').id || model.get('$id$') || model.get('guid'), - displayText: model.get('name'), - status: model.get('$id$').state - }); - if (returnObject.object) { - that.bradCrumbList.push(returnObject.object); + var obj = model.toJSON(); + if (obj.status && Enums.entityStateReadOnly[obj.status]) { + return '<div class="readOnly">' + CommonViewFunction.tagForTable(obj); + '</div>'; + } else { + return CommonViewFunction.tagForTable(obj); } - return returnObject.html; } }) }; + if (Globals.taxonomy) { + col['terms'] = { + label: "Terms", + cell: "Html", + editable: false, + sortable: false, + orderable: true, + className: 'searchTerm', + formatter: _.extend({}, Backgrid.CellFormatter.prototype, { + fromRaw: function(rawValue, model) { + var obj = model.toJSON(); + var returnObject = CommonViewFunction.termTableBreadcrumbMaker(obj); + if (returnObject.object) { + that.bradCrumbList.push(returnObject.object); + } + if (obj.status && Enums.entityStateReadOnly[obj.status]) { + return '<div class="readOnly">' + returnObject.html + '</div>'; + } else { + return returnObject.html; + } + + } + }) + }; + } + return this.schemaCollection.constructor.getTableCols(col, this.schemaCollection); } - return this.schemaCollection.constructor.getTableCols(col, this.schemaCollection); + }, checkedValue: function(e) { if (e) { @@ -395,11 +337,8 @@ define(['require', that.fetchCollection(); that.arr = []; }, - showLoader: function() { - that.$('.fontLoader').show(); - that.$('.searchTable').hide(); - }, - hideLoader: that.hideLoader.bind(that) + hideLoader: that.hideLoader.bind(that), + showLoader: that.showLoader.bind(that) }); // view.saveTagData = function() { //override saveTagData function @@ -419,10 +358,8 @@ define(['require', that.fetchCollection(); that.arr = []; }, - showLoader: function() { - that.$('.fontLoader').show(); - that.$('.searchTable').hide(); - } + hideLoader: that.hideLoader.bind(that), + showLoader: that.showLoader.bind(that) }); }); }, @@ -462,6 +399,8 @@ define(['require', 'tagName': tagName, 'guid': guid, 'tagOrTerm': tagOrTerm, + showLoader: that.showLoader.bind(that), + hideLoader: that.hideLoader.bind(that), callback: function() { that.fetchCollection(); } http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/dd744765/dashboardv2/public/js/views/search/SearchLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/search/SearchLayoutView.js b/dashboardv2/public/js/views/search/SearchLayoutView.js index 958b23b..d1f0591 100644 --- a/dashboardv2/public/js/views/search/SearchLayoutView.js +++ b/dashboardv2/public/js/views/search/SearchLayoutView.js @@ -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"; http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/dd744765/dashboardv2/public/js/views/tag/TagAttributeDetailLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/tag/TagAttributeDetailLayoutView.js b/dashboardv2/public/js/views/tag/TagAttributeDetailLayoutView.js index 3cba566..fb74e2f 100644 --- a/dashboardv2/public/js/views/tag/TagAttributeDetailLayoutView.js +++ b/dashboardv2/public/js/views/tag/TagAttributeDetailLayoutView.js @@ -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() { http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/dd744765/dashboardv2/public/js/views/tag/TagDetailLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/tag/TagDetailLayoutView.js b/dashboardv2/public/js/views/tag/TagDetailLayoutView.js index 3e98755..6bdaf39 100644 --- a/dashboardv2/public/js/views/tag/TagDetailLayoutView.js +++ b/dashboardv2/public/js/views/tag/TagDetailLayoutView.js @@ -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() { http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/dd744765/dashboardv2/public/js/views/tag/TagDetailTableLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/tag/TagDetailTableLayoutView.js b/dashboardv2/public/js/views/tag/TagDetailTableLayoutView.js index c02600e..db6f338 100644 --- a/dashboardv2/public/js/views/tag/TagDetailTableLayoutView.js +++ b/dashboardv2/public/js/views/tag/TagDetailTableLayoutView.js @@ -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 }); http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/dd744765/dashboardv2/public/js/views/tag/TagLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/tag/TagLayoutView.js b/dashboardv2/public/js/views/tag/TagLayoutView.js index 450866c..76dccd7 100644 --- a/dashboardv2/public/js/views/tag/TagLayoutView.js +++ b/dashboardv2/public/js/views/tag/TagLayoutView.js @@ -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) http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/dd744765/dashboardv2/public/js/views/tag/addTagModalView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/tag/addTagModalView.js b/dashboardv2/public/js/views/tag/addTagModalView.js index 3d00caf..f2e19fe 100644 --- a/dashboardv2/public/js/views/tag/addTagModalView.js +++ b/dashboardv2/public/js/views/tag/addTagModalView.js @@ -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);
