Commit efc8d09c by kevalbhatt

ATLAS-1287 Subtasks: ATLAS-1288/ATLAS-1289 Integrated V2 API for Lineage,Entity…

ATLAS-1287 Subtasks: ATLAS-1288/ATLAS-1289 Integrated V2 API for Lineage,Entity Details,Tag assign to entity,Tags listing,tag create
parent 3bffc0dc
...@@ -20,12 +20,13 @@ define(['require', ...@@ -20,12 +20,13 @@ define(['require',
'utils/Globals', 'utils/Globals',
'collection/BaseCollection', 'collection/BaseCollection',
'models/VCatalog', 'models/VCatalog',
], function(require, Globals, BaseCollection, VCatalog) { 'utils/UrlLinks'
], function(require, Globals, BaseCollection, VCatalog, UrlLinks) {
'use strict'; 'use strict';
var VCatalogList = BaseCollection.extend( var VCatalogList = BaseCollection.extend(
//Prototypal attributes //Prototypal attributes
{ {
url: Globals.baseURL + '/api/atlas/v1/taxonomies', url: UrlLinks.taxonomiesApiUrl(),
model: VCatalog, model: VCatalog,
......
...@@ -20,12 +20,13 @@ define(['require', ...@@ -20,12 +20,13 @@ define(['require',
'utils/Globals', 'utils/Globals',
'collection/BaseCollection', 'collection/BaseCollection',
'models/VCommon', 'models/VCommon',
], function(require, Globals, BaseCollection, VCommon) { 'utils/UrlLinks'
], function(require, Globals, BaseCollection, VCommon, UrlLinks) {
'use strict'; 'use strict';
var VCommonList = BaseCollection.extend( var VCommonList = BaseCollection.extend(
//Prototypal attributes //Prototypal attributes
{ {
url: Globals.baseURL + '', url: UrlLinks.baseURL + '',
model: VCommon, model: VCommon,
......
...@@ -19,20 +19,48 @@ ...@@ -19,20 +19,48 @@
define(['require', define(['require',
'utils/Globals', 'utils/Globals',
'collection/BaseCollection', 'collection/BaseCollection',
'models/VEntity' 'models/VEntity',
], function(require, Globals, BaseCollection, VEntity) { 'utils/UrlLinks'
], function(require, Globals, BaseCollection, VEntity, UrlLinks) {
'use strict'; 'use strict';
var VEntityList = BaseCollection.extend( var VEntityList = BaseCollection.extend(
//Prototypal attributes //Prototypal attributes
{ {
url: Globals.baseURL + '/api/atlas/entities', url: UrlLinks.entitiesApiUrl(),
model: VEntity, model: VEntity,
initialize: function() { initialize: function() {
this.modelName = 'VEntity'; this.modelName = 'VEntity';
this.modelAttrName = 'definition'; this.modelAttrName = '';
this.bindErrorEvents(); this.bindErrorEvents();
},
parseRecords: function(resp, options) {
try {
// if (!this.modelAttrName) {
// throw new Error("this.modelAttrName not defined for " + this);
// }
if (this.modelAttrName && this.modelAttrName.length) {
if (resp[this.modelAttrName]) {
return resp[this.modelAttrName];
} else {
return resp
}
} else {
var arr = [];
arr.push({
attributes: resp.attributes,
classifications: resp.classifications,
guid: resp.guid,
typeName: resp.typeName
});
return arr;
}
} catch (e) {
console.log(e);
}
} }
}, },
//Static Class Members //Static Class Members
......
...@@ -19,13 +19,14 @@ ...@@ -19,13 +19,14 @@
define(['require', define(['require',
'utils/Globals', 'utils/Globals',
'collection/BaseCollection', 'collection/BaseCollection',
'models/VLineage' 'models/VLineage',
], function(require, Globals, BaseCollection, VLineage) { 'utils/UrlLinks'
], function(require, Globals, BaseCollection, VLineage, UrlLinks) {
'use strict'; 'use strict';
var VLineageList = BaseCollection.extend( var VLineageList = BaseCollection.extend(
//Prototypal attributes //Prototypal attributes
{ {
url: Globals.baseURL, url: UrlLinks.baseURL,
model: VLineage, model: VLineage,
...@@ -33,6 +34,16 @@ define(['require', ...@@ -33,6 +34,16 @@ define(['require',
this.modelName = 'VLineage'; this.modelName = 'VLineage';
this.modelAttrName = 'results'; this.modelAttrName = 'results';
this.bindErrorEvents(); this.bindErrorEvents();
},
getLineage: function(id, options) {
var url = UrlLinks.lineageApiUrl(id);
options = _.extend({
contentType: 'application/json',
dataType: 'json'
}, options);
return this.constructor.nonCrudOperation.call(this, url, 'GET', options);
} }
}, },
//Static Class Members //Static Class Members
......
...@@ -19,13 +19,14 @@ ...@@ -19,13 +19,14 @@
define(['require', define(['require',
'utils/Globals', 'utils/Globals',
'collection/BaseCollection', 'collection/BaseCollection',
'models/VSchema' 'models/VSchema',
], function(require, Globals, BaseCollection, VSchema) { 'utils/UrlLinks'
], function(require, Globals, BaseCollection, VSchema, UrlLinks) {
'use strict'; 'use strict';
var VSchemaList = BaseCollection.extend( var VSchemaList = BaseCollection.extend(
//Prototypal attributes //Prototypal attributes
{ {
url: Globals.baseURL, url: UrlLinks.baseURL,
model: VSchema, model: VSchema,
initialize: function() { initialize: function() {
this.modelName = 'VSchema'; this.modelName = 'VSchema';
......
...@@ -19,13 +19,14 @@ ...@@ -19,13 +19,14 @@
define(['require', define(['require',
'utils/Globals', 'utils/Globals',
'collection/BaseCollection', 'collection/BaseCollection',
'models/VSearch' 'models/VSearch',
], function(require, Globals, BaseCollection, VSearch) { 'utils/UrlLinks'
], function(require, Globals, BaseCollection, VSearch, UrlLinks) {
'use strict'; 'use strict';
var VSearchList = BaseCollection.extend( var VSearchList = BaseCollection.extend(
//Prototypal attributes //Prototypal attributes
{ {
url: Globals.baseURL + '/api/atlas/discovery/search', url: UrlLinks.searchApiUrl(),
model: VSearch, model: VSearch,
......
...@@ -19,17 +19,18 @@ ...@@ -19,17 +19,18 @@
define(['require', define(['require',
'utils/Globals', 'utils/Globals',
'collection/BaseCollection', 'collection/BaseCollection',
'models/VTag' 'models/VTag',
], function(require, Globals, BaseCollection, VTag) { 'utils/UrlLinks'
], function(require, Globals, BaseCollection, VTag, UrlLinks) {
'use strict'; 'use strict';
var VTagList = BaseCollection.extend( var VTagList = BaseCollection.extend(
//Prototypal attributes //Prototypal attributes
{ {
url: Globals.baseURL + '/api/atlas/types', url: UrlLinks.typesClassicationApiUrl(),
model: VTag, model: VTag,
initialize: function() { initialize: function() {
this.modelName = 'VTag'; this.modelName = 'VTag';
this.modelAttrName = 'results'; this.modelAttrName = 'list';
this.bindErrorEvents(); this.bindErrorEvents();
}, },
parseRecords: function(resp, options) { parseRecords: function(resp, options) {
...@@ -37,6 +38,14 @@ define(['require', ...@@ -37,6 +38,14 @@ define(['require',
if (!this.modelAttrName) { if (!this.modelAttrName) {
throw new Error("this.modelAttrName not defined for " + this); throw new Error("this.modelAttrName not defined for " + this);
} }
if (this.modelAttrName === "list") {
if (resp[this.modelAttrName]) {
return resp[this.modelAttrName];
} else {
return resp
}
} else {
var arr = []; var arr = [];
resp[this.modelAttrName].forEach(function(d) { resp[this.modelAttrName].forEach(function(d) {
arr.push({ arr.push({
...@@ -44,6 +53,8 @@ define(['require', ...@@ -44,6 +53,8 @@ define(['require',
}); });
}); });
return arr; return arr;
}
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
......
...@@ -152,14 +152,15 @@ require(['App', ...@@ -152,14 +152,15 @@ require(['App',
'router/Router', 'router/Router',
'utils/CommonViewFunction', 'utils/CommonViewFunction',
'utils/Globals', 'utils/Globals',
'utils/UrlLinks',
'utils/Overrides', 'utils/Overrides',
'bootstrap', 'bootstrap',
'd3', 'd3',
'select2' 'select2'
], function(App, Router, CommonViewFunction, Globals) { ], function(App, Router, CommonViewFunction, Globals, UrlLinks) {
App.appRouter = new Router(); App.appRouter = new Router();
CommonViewFunction.userDataFetch({ CommonViewFunction.userDataFetch({
url: Globals.baseURL + "/api/atlas/admin/session", url: UrlLinks.sessionApiUrl(),
callback: function(response) { callback: function(response) {
if (response && response.userName) { if (response && response.userName) {
Globals.userLogedIn.status = true; Globals.userLogedIn.status = true;
......
...@@ -18,11 +18,12 @@ ...@@ -18,11 +18,12 @@
define(['require', define(['require',
'utils/Globals', 'utils/Globals',
'models/BaseModel' 'models/BaseModel',
], function(require, Globals, VBaseModel) { 'utils/UrlLinks'
], function(require, Globals, VBaseModel, UrlLinks) {
'use strict'; 'use strict';
var VCatalog = VBaseModel.extend({ var VCatalog = VBaseModel.extend({
urlRoot: Globals.baseURL + '/api/atlas/v1/taxonomies', urlRoot: UrlLinks.taxonomiesApiUrl(),
defaults: {}, defaults: {},
...@@ -38,7 +39,7 @@ define(['require', ...@@ -38,7 +39,7 @@ define(['require',
return this.get('name'); return this.get('name');
}, },
deleteTerm: function(termURL, options) { deleteTerm: function(termURL, options) {
var url = Globals.baseURL + termURL; var url = UrlLinks.baseURL + termURL;
options = _.extend({ options = _.extend({
contentType: 'application/json', contentType: 'application/json',
dataType: 'json' dataType: 'json'
......
...@@ -18,11 +18,12 @@ ...@@ -18,11 +18,12 @@
define(['require', define(['require',
'utils/Globals', 'utils/Globals',
'models/BaseModel' 'models/BaseModel',
], function(require, Globals, VBaseModel) { 'utils/UrlLinks'
], function(require, Globals, VBaseModel, UrlLinks) {
'use strict'; 'use strict';
var VCommon = VBaseModel.extend({ var VCommon = VBaseModel.extend({
urlRoot: Globals.baseURL + '', urlRoot: UrlLinks.baseUrl + '',
defaults: {}, defaults: {},
...@@ -41,7 +42,7 @@ define(['require', ...@@ -41,7 +42,7 @@ define(['require',
* Non - CRUD operations * Non - CRUD operations
*************************/ *************************/
aboutUs: function(url, options) { aboutUs: function(url, options) {
var url = Globals.baseURL + url; var url = url;
options = _.extend({ options = _.extend({
contentType: 'application/json', contentType: 'application/json',
dataType: 'json' dataType: 'json'
......
...@@ -18,12 +18,13 @@ ...@@ -18,12 +18,13 @@
define(['require', define(['require',
'utils/Globals', 'utils/Globals',
'models/BaseModel' 'models/BaseModel',
], function(require, Globals, VBaseModel) { 'utils/UrlLinks'
], function(require, Globals, VBaseModel, UrlLinks) {
'use strict'; 'use strict';
var VEntity = VBaseModel.extend({ var VEntity = VBaseModel.extend({
urlRoot: Globals.baseURL + '/api/atlas/entities/', urlRoot: UrlLinks.entitiesApiUrl(),
defaults: {}, defaults: {},
...@@ -43,7 +44,7 @@ define(['require', ...@@ -43,7 +44,7 @@ define(['require',
*************************/ *************************/
getEntity: function(token, options) { getEntity: function(token, options) {
var url = Globals.baseURL + '/api/atlas/entities/' + token; var url = UrlLinks.entitiesApiUrl(token);
options = _.extend({ options = _.extend({
contentType: 'application/json', contentType: 'application/json',
...@@ -53,13 +54,23 @@ define(['require', ...@@ -53,13 +54,23 @@ define(['require',
return this.constructor.nonCrudOperation.call(this, url, 'GET', options); return this.constructor.nonCrudOperation.call(this, url, 'GET', options);
}, },
saveEntity: function(token, options) { saveEntity: function(token, options) {
var url = Globals.baseURL + '/api/atlas/entities/' + token + '/traits'; var url = UrlLinks.entitiesTraitsApiUrl(token);
options = _.extend({ options = _.extend({
contentType: 'application/json', contentType: 'application/json',
dataType: 'json' dataType: 'json'
}, options); }, options);
return this.constructor.nonCrudOperation.call(this, url, 'POST', options); return this.constructor.nonCrudOperation.call(this, url, 'POST', options);
}, },
getEntityDef: function(name, options) {
var url = UrlLinks.entitiesDefApiUrl(name);
options = _.extend({
contentType: 'application/json',
dataType: 'json'
}, options);
return this.constructor.nonCrudOperation.call(this, url, 'GET', options);
}
}, {}); }, {});
return VEntity; return VEntity;
......
...@@ -18,12 +18,13 @@ ...@@ -18,12 +18,13 @@
define(['require', define(['require',
'utils/Globals', 'utils/Globals',
'models/BaseModel' 'models/BaseModel',
], function(require, Globals, VBaseModel) { 'utils/UrlLinks'
], function(require, Globals, VBaseModel, UrlLinks) {
'use strict'; 'use strict';
var VLineage = VBaseModel.extend({ var VLineage = VBaseModel.extend({
urlRoot: Globals.baseURL, urlRoot: UrlLinks.baseURL,
defaults: {}, defaults: {},
......
...@@ -18,11 +18,12 @@ ...@@ -18,11 +18,12 @@
define(['require', define(['require',
'utils/Globals', 'utils/Globals',
'models/BaseModel' 'models/BaseModel',
], function(require, Globals, VBaseModel) { 'utils/UrlLinks'
], function(require, Globals, VBaseModel, UrlLinks) {
'use strict'; 'use strict';
var VSchema = VBaseModel.extend({ var VSchema = VBaseModel.extend({
urlRoot: Globals.baseURL, urlRoot: UrlLinks.baseURL,
defaults: {}, defaults: {},
......
...@@ -18,11 +18,12 @@ ...@@ -18,11 +18,12 @@
define(['require', define(['require',
'utils/Globals', 'utils/Globals',
'models/BaseModel' 'models/BaseModel',
], function(require, Globals, VBaseModel) { 'utils/UrlLinks'
], function(require, Globals, VBaseModel, UrlLinks) {
'use strict'; 'use strict';
var VSearch = VBaseModel.extend({ var VSearch = VBaseModel.extend({
urlRoot: Globals.baseURL + '/api/atlas/discovery/search', urlRoot: UrlLinks.searchApiUrl(),
defaults: {}, defaults: {},
...@@ -40,8 +41,8 @@ define(['require', ...@@ -40,8 +41,8 @@ define(['require',
/************************* /*************************
* Non - CRUD operations * Non - CRUD operations
*************************/ *************************/
getEntity: function(token, options) { getEntity: function(id, options) {
var url = Globals.baseURL + '/api/atlas/entities/' + token; var url = UrlLinks.entitiesApiUrl(id);
options = _.extend({ options = _.extend({
contentType: 'application/json', contentType: 'application/json',
......
...@@ -18,11 +18,12 @@ ...@@ -18,11 +18,12 @@
define(['require', define(['require',
'utils/Globals', 'utils/Globals',
'models/BaseModel' 'models/BaseModel',
], function(require, Globals, vBaseModel) { 'utils/UrlLinks'
], function(require, Globals, vBaseModel, UrlLinks) {
'use strict'; 'use strict';
var VTag = vBaseModel.extend({ var VTag = vBaseModel.extend({
urlRoot: Globals.baseURL + '/api/atlas/types', urlRoot: UrlLinks.typesClassicationApiUrl(),
defaults: {}, defaults: {},
...@@ -41,12 +42,20 @@ define(['require', ...@@ -41,12 +42,20 @@ define(['require',
* Non - CRUD operations * Non - CRUD operations
*************************/ *************************/
deleteTag: function(guid, name, options) { deleteTag: function(guid, name, options) {
var url = Globals.baseURL + '/api/atlas/entities/' + guid + '/traits/' + name; var url = UrlLinks.entitiesApiUrl(guid, name);
options = _.extend({ options = _.extend({
contentType: 'application/json', contentType: 'application/json',
dataType: 'json' dataType: 'json'
}, options); }, options);
return this.constructor.nonCrudOperation.call(this, url, 'DELETE', options); return this.constructor.nonCrudOperation.call(this, url, 'DELETE', options);
},
saveTagAttribute: function(name, options) {
var url = UrlLinks.typesClassicationApiUrl(name);
options = _.extend({
contentType: 'application/json',
dataType: 'json'
}, options);
return this.constructor.nonCrudOperation.call(this, url, 'PUT', options);
} }
}, {}); }, {});
return VTag; return VTag;
......
...@@ -22,8 +22,10 @@ define([ ...@@ -22,8 +22,10 @@ define([
'backbone', 'backbone',
'App', 'App',
'utils/Globals', 'utils/Globals',
'utils/Utils' 'utils/Utils',
], function($, _, Backbone, App, Globals, Utils) { 'utils/UrlLinks',
'collection/VTagList'
], function($, _, Backbone, App, Globals, Utils, UrlLinks, VTagList) {
var AppRouter = Backbone.Router.extend({ var AppRouter = Backbone.Router.extend({
routes: { routes: {
// Define some URL routes // Define some URL routes
...@@ -46,6 +48,7 @@ define([ ...@@ -46,6 +48,7 @@ define([
this.globalVent = new Backbone.Wreqr.EventAggregator(); this.globalVent = new Backbone.Wreqr.EventAggregator();
this.catalogVent = new Backbone.Wreqr.EventAggregator(); this.catalogVent = new Backbone.Wreqr.EventAggregator();
this.tagVent = new Backbone.Wreqr.EventAggregator(); this.tagVent = new Backbone.Wreqr.EventAggregator();
this.tagCollection = new VTagList();
}, },
bindCommonEvents: function() { bindCommonEvents: function() {
var that = this; var that = this;
...@@ -110,7 +113,7 @@ define([ ...@@ -110,7 +113,7 @@ define([
this.collection.url = url; this.collection.url = url;
App.rNHeader.show(new BusinessCatalogHeader({ 'globalVent': that.globalVent, 'url': url, 'collection': this.collection })); App.rNHeader.show(new BusinessCatalogHeader({ 'globalVent': that.globalVent, 'url': url, 'collection': this.collection }));
if (!App.rSideNav.currentView) { if (!App.rSideNav.currentView) {
App.rSideNav.show(new SideNavLayoutView({ 'globalVent': that.globalVent, 'url': url })); App.rSideNav.show(new SideNavLayoutView({ 'globalVent': that.globalVent, 'url': url, 'collection': that.tagCollection }));
} else { } else {
App.rSideNav.currentView.RBusinessCatalogLayoutView.currentView.manualRender("/" + url); App.rSideNav.currentView.RBusinessCatalogLayoutView.currentView.manualRender("/" + url);
App.rSideNav.currentView.selectTab(); App.rSideNav.currentView.selectTab();
...@@ -138,17 +141,16 @@ define([ ...@@ -138,17 +141,16 @@ define([
this.entityCollection = new VEntityList([], {}); this.entityCollection = new VEntityList([], {});
App.rNHeader.show(new Header({ 'globalVent': that.globalVent })); App.rNHeader.show(new Header({ 'globalVent': that.globalVent }));
if (!App.rSideNav.currentView) { if (!App.rSideNav.currentView) {
App.rSideNav.show(new SideNavLayoutView({ 'globalVent': that.globalVent })); App.rSideNav.show(new SideNavLayoutView({ 'globalVent': that.globalVent, 'collection': that.tagCollection }));
} else { } else {
App.rSideNav.currentView.selectTab(); App.rSideNav.currentView.selectTab();
} }
App.rNContent.show(new DetailPageLayoutView({ App.rNContent.show(new DetailPageLayoutView({
'globalVent': that.globalVent, 'globalVent': that.globalVent,
'collection': this.entityCollection, 'collection': this.entityCollection,
'id': id, 'id': id,
})); }));
this.entityCollection.url = "/api/atlas/entities/" + id; this.entityCollection.url = UrlLinks.entitiesApiUrl(id);
this.entityCollection.fetch({ reset: true }); this.entityCollection.fetch({ reset: true });
}); });
} }
...@@ -165,7 +167,8 @@ define([ ...@@ -165,7 +167,8 @@ define([
if (!App.rSideNav.currentView) { if (!App.rSideNav.currentView) {
App.rSideNav.show(new SideNavLayoutView({ App.rSideNav.show(new SideNavLayoutView({
'globalVent': that.globalVent, 'globalVent': that.globalVent,
'tag': tagName 'tag': tagName,
'collection': that.tagCollection
})); }));
} else { } else {
...@@ -176,7 +179,8 @@ define([ ...@@ -176,7 +179,8 @@ define([
if (tagName) { if (tagName) {
App.rNContent.show(new TagDetailLayoutView({ App.rNContent.show(new TagDetailLayoutView({
'globalVent': that.globalVent, 'globalVent': that.globalVent,
'tag': tagName 'tag': tagName,
'collection': that.tagCollection
})); }));
} }
}); });
...@@ -191,7 +195,8 @@ define([ ...@@ -191,7 +195,8 @@ define([
App.rNHeader.show(new Header({ 'globalVent': that.globalVent })); App.rNHeader.show(new Header({ 'globalVent': that.globalVent }));
if (!App.rSideNav.currentView) { if (!App.rSideNav.currentView) {
App.rSideNav.show(new SideNavLayoutView({ App.rSideNav.show(new SideNavLayoutView({
'globalVent': that.globalVent 'globalVent': that.globalVent,
'collection': that.tagCollection
})); }));
} else { } else {
App.rSideNav.currentView.selectTab(); App.rSideNav.currentView.selectTab();
...@@ -218,7 +223,8 @@ define([ ...@@ -218,7 +223,8 @@ define([
if (!App.rSideNav.currentView) { if (!App.rSideNav.currentView) {
App.rSideNav.show(new SideNavLayoutView({ App.rSideNav.show(new SideNavLayoutView({
'globalVent': that.globalVent, 'globalVent': that.globalVent,
'value': paramObj 'value': paramObj,
'collection': that.tagCollection
})); }));
} else { } else {
App.rSideNav.currentView.RSearchLayoutView.currentView.manualRender(paramObj); App.rSideNav.currentView.RSearchLayoutView.currentView.manualRender(paramObj);
......
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
define(['require'], function(require) {
'use strict';
var Enums = {};
Enums.auditAction = {
ENTITY_CREATE: "Entity Created",
ENTITY_UPDATE: "Entity Updated",
ENTITY_DELETE: "Entity Deleted",
TAG_ADD: "Tag Added",
TAG_DELETE: "Tag Deleted"
}
Enums.entityStateReadOnly = {
ACTIVE: false,
DELETED: true,
STATUS_ACTIVE: false,
STATUS_DELETED: true
}
Enums.lineageUrlType = {
INPUT: 'inputs',
OUTPUT: 'outputs',
SCHEMA: 'schema'
}
Enums.searchUrlType = {
DSL: 'dsl',
FULLTEXT: 'fulltext'
}
return Enums;
});
...@@ -21,7 +21,7 @@ define(['require'], function(require) { ...@@ -21,7 +21,7 @@ define(['require'], function(require) {
var Globals = {}; var Globals = {};
Globals.baseURL = ''; //Globals.baseURL = '/api/atlas';
Globals.settings = {}; Globals.settings = {};
Globals.settings.PAGE_SIZE = 25; Globals.settings.PAGE_SIZE = 25;
Globals.saveApplicationState = { Globals.saveApplicationState = {
...@@ -34,17 +34,6 @@ define(['require'], function(require) { ...@@ -34,17 +34,6 @@ define(['require'], function(require) {
}, },
detailPageState: {} detailPageState: {}
}; };
Globals.auditAction = {
ENTITY_CREATE: "Entity Created",
ENTITY_UPDATE: "Entity Updated",
ENTITY_DELETE: "Entity Deleted",
TAG_ADD: "Tag Added",
TAG_DELETE: "Tag Deleted"
}
Globals.entityStateReadOnly = {
ACTIVE: false,
DELETED: true
}
Globals.userLogedIn = { Globals.userLogedIn = {
status: false, status: false,
response: {} response: {}
......
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
define(['require', 'utils/Enums'], function(require, Enums) {
'use strict';
var UrlLinks = {
baseUrl: '/api/atlas',
baseUrlV2: '/api/atlas/v2',
taxonomiesApiUrl: function() {
return this.baseUrl + '/v1/taxonomies';
},
taxonomiesTermsApiUrl: function(name) {
return this.baseUrl + '/v1/taxonomies' + '/' + name + '/terms';
},
entitiesApiUrl: function(guid, name) {
var entitiesUrl = this.baseUrlV2 + '/entity/guid';
if (guid && name) {
return entitiesUrl + '/' + guid + '/classification/' + name;
} else if (guid && !name) {
return entitiesUrl + '/' + guid;
} else {
return entitiesUrl;
}
},
entitiesDefApiUrl: function(name) {
var entitieDefUrl = this.baseUrlV2 + '/types/entitydef';
if (name) {
return entitieDefUrl + '/name/' + name;
} else {
return entitieDefUrl;
}
},
entitiesTraitsApiUrl: function(token) {
return this.baseUrlV2 + '/entity/guid/' + token + "/classifications"; //this.entitiesApiUrl();
},
entityCollectionaudit: function(guid) {
return this.baseUrl + '/entities/' + guid + '/audit';
},
typesClassicationApiUrl: function(name) {
var typeUrl = this.baseUrlV2 + '/types/classificationdef'
if (name) {
return typeUrl + '/name/' + name;
} else {
return typeUrl;
}
},
typesApiUrl: function() {
return this.baseUrlV2 + '/types/typedefs/headers'
},
lineageApiUrl: function(guid) {
var lineageUrl = this.baseUrlV2 + '/lineage';
if (guid) {
return lineageUrl + '/' + guid;
} else {
return lineageUrl
}
},
schemaApiUrl: function(guid) {
var lineageUrl = this.baseUrl + '/lineage';
if (guid) {
return lineageUrl + '/' + guid + '/schema'
} else {
return lineageUrl
}
},
searchApiUrl: function(searchtype) {
var searchUrl = this.baseUrl + '/discovery/search';
if (searchtype) {
return searchUrl + '/' + searchtype;
} else {
return searchUrl;
}
},
versionApiUrl: function() {
return this.baseUrl + '/admin/version';
},
sessionApiUrl: function() {
return this.baseUrl + '/admin/session';
}
};
return UrlLinks;
});
...@@ -20,8 +20,9 @@ define(['require', ...@@ -20,8 +20,9 @@ define(['require',
'backbone', 'backbone',
'hbs!tmpl/audit/AuditTableLayoutView_tmpl', 'hbs!tmpl/audit/AuditTableLayoutView_tmpl',
'collection/VEntityList', 'collection/VEntityList',
'utils/Globals' 'utils/Enums',
], function(require, Backbone, AuditTableLayoutView_tmpl, VEntityList, Globals) { 'utils/UrlLinks'
], function(require, Backbone, AuditTableLayoutView_tmpl, VEntityList, Enums, UrlLinks) {
'use strict'; 'use strict';
var AuditTableLayoutView = Backbone.Marionette.LayoutView.extend( var AuditTableLayoutView = Backbone.Marionette.LayoutView.extend(
...@@ -60,7 +61,7 @@ define(['require', ...@@ -60,7 +61,7 @@ define(['require',
_.extend(this, _.pick(options, 'globalVent', 'guid')); _.extend(this, _.pick(options, 'globalVent', 'guid'));
this.entityCollection = new VEntityList(); this.entityCollection = new VEntityList();
this.count = 26; this.count = 26;
this.entityCollection.url = "/api/atlas/entities/" + this.guid + "/audit"; this.entityCollection.url = UrlLinks.entityCollectionaudit(this.guid);
this.entityCollection.modelAttrName = "events"; this.entityCollection.modelAttrName = "events";
this.entityModel = new this.entityCollection.model(); this.entityModel = new this.entityCollection.model();
this.pervOld = []; this.pervOld = [];
...@@ -140,6 +141,7 @@ define(['require', ...@@ -140,6 +141,7 @@ define(['require',
if ((that.entityCollection.models.length < that.count && that.currPage == 1) && that.next == that.entityCollection.last().get('eventKey')) { if ((that.entityCollection.models.length < that.count && that.currPage == 1) && that.next == that.entityCollection.last().get('eventKey')) {
options.next.attr('disabled', true); options.next.attr('disabled', true);
options.previous.removeAttr("disabled"); options.previous.removeAttr("disabled");
//that.renderTableLayoutView();
} else { } else {
if (that.entityCollection.models.length > 0) { if (that.entityCollection.models.length > 0) {
that.next = that.entityCollection.last().get('eventKey'); that.next = that.entityCollection.last().get('eventKey');
...@@ -193,8 +195,8 @@ define(['require', ...@@ -193,8 +195,8 @@ define(['require',
sortable: false, sortable: false,
formatter: _.extend({}, Backgrid.CellFormatter.prototype, { formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
fromRaw: function(rawValue, model) { fromRaw: function(rawValue, model) {
if (Globals.auditAction[rawValue]) { if (Enums.auditAction[rawValue]) {
return Globals.auditAction[rawValue]; return Enums.auditAction[rawValue];
} else { } else {
return rawValue; return rawValue;
} }
...@@ -208,7 +210,7 @@ define(['require', ...@@ -208,7 +210,7 @@ define(['require',
sortable: false, sortable: false,
formatter: _.extend({}, Backgrid.CellFormatter.prototype, { formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
fromRaw: function(rawValue, model) { fromRaw: function(rawValue, model) {
return '<div class="label label-success auditDetailBtn" data-id="auditCreate" data-action="' + Globals.auditAction[model.attributes.action] + '" data-modalId="' + model.get('eventKey') + '">Detail</div>'; return '<div class="label label-success auditDetailBtn" data-id="auditCreate" data-action="' + Enums.auditAction[model.attributes.action] + '" data-modalId="' + model.get('eventKey') + '">Detail</div>';
} }
}) })
}, },
......
...@@ -19,9 +19,9 @@ ...@@ -19,9 +19,9 @@
define(['require', define(['require',
'backbone', 'backbone',
'hbs!tmpl/audit/CreateAuditTableLayoutView_tmpl', 'hbs!tmpl/audit/CreateAuditTableLayoutView_tmpl',
'utils/Globals', 'utils/Enums',
'utils/CommonViewFunction' 'utils/CommonViewFunction'
], function(require, Backbone, CreateAuditTableLayoutViewTmpl, Globals, CommonViewFunction) { ], function(require, Backbone, CreateAuditTableLayoutViewTmpl, Enums, CommonViewFunction) {
'use strict'; 'use strict';
var CreateAuditTableLayoutView = Backbone.Marionette.LayoutView.extend( var CreateAuditTableLayoutView = Backbone.Marionette.LayoutView.extend(
...@@ -68,7 +68,7 @@ define(['require', ...@@ -68,7 +68,7 @@ define(['require',
var detailsObject = JSON.parse(appendedString.replace("{" + auditData + ":", '{"' + auditData + '":'))[auditData]; var detailsObject = JSON.parse(appendedString.replace("{" + auditData + ":", '{"' + auditData + '":'))[auditData];
//Append string for JSON parse //Append string for JSON parse
var valueObject = detailsObject.values; var valueObject = detailsObject.values;
if (this.action == Globals.auditAction.TAG_ADD) { if (this.action == Enums.auditAction.TAG_ADD) {
this.ui.auditHeaderValue.html('<th>Tag</th>'); this.ui.auditHeaderValue.html('<th>Tag</th>');
this.ui.auditValue.html("<tr><td>" + detailsObject.typeName + "</td></tr>"); this.ui.auditValue.html("<tr><td>" + detailsObject.typeName + "</td></tr>");
} else { } else {
...@@ -83,7 +83,7 @@ define(['require', ...@@ -83,7 +83,7 @@ define(['require',
this.ui.tableAudit.hide(); this.ui.tableAudit.hide();
} }
} }
} else if (this.action == Globals.auditAction.TAG_DELETE) { } else if (this.action == Enums.auditAction.TAG_DELETE) {
var appendedString = this.entityModel.get('details').split(':'); var appendedString = this.entityModel.get('details').split(':');
this.ui.auditHeaderValue.html('<th>Tag</th>'); this.ui.auditHeaderValue.html('<th>Tag</th>');
this.ui.auditValue.html("<tr><td>" + appendedString[1] + "</td></tr>"); this.ui.auditValue.html("<tr><td>" + appendedString[1] + "</td></tr>");
......
...@@ -66,7 +66,7 @@ define(['require', ...@@ -66,7 +66,7 @@ define(['require',
return events; return events;
}, },
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'globalVent', 'url', 'value', 'tag', 'selectFirst')); _.extend(this, _.pick(options, 'globalVent', 'url', 'value', 'tag', 'selectFirst','collection'));
if (Globals.taxonomy) { if (Globals.taxonomy) {
this.tabClass = "tab col-sm-4"; this.tabClass = "tab col-sm-4";
} else { } else {
...@@ -98,7 +98,7 @@ define(['require', ...@@ -98,7 +98,7 @@ define(['require',
require(['views/tag/TagLayoutView'], function(TagLayoutView) { require(['views/tag/TagLayoutView'], function(TagLayoutView) {
that.RTagLayoutView.show(new TagLayoutView({ that.RTagLayoutView.show(new TagLayoutView({
globalVent: that.globalVent, globalVent: that.globalVent,
searchCollection: that.searchCollection, collection: that.collection,
tag: that.tag tag: that.tag
})); }));
}); });
......
...@@ -22,8 +22,9 @@ define(['require', ...@@ -22,8 +22,9 @@ define(['require',
'utils/Utils', 'utils/Utils',
'collection/VCatalogList', 'collection/VCatalogList',
'utils/CommonViewFunction', 'utils/CommonViewFunction',
'utils/Messages' 'utils/Messages',
], function(require, Backbone, TreeLayoutView_tmpl, Utils, VCatalogList, CommonViewFunction, Messages) { 'utils/UrlLinks'
], function(require, Backbone, TreeLayoutView_tmpl, Utils, VCatalogList, CommonViewFunction, Messages, UrlLinks) {
'use strict'; 'use strict';
var TreeLayoutView = Backbone.Marionette.LayoutView.extend( var TreeLayoutView = Backbone.Marionette.LayoutView.extend(
...@@ -251,7 +252,7 @@ define(['require', ...@@ -251,7 +252,7 @@ define(['require',
if (parentURL) { if (parentURL) {
this.url = parentURL; this.url = parentURL;
} else { } else {
this.url = "api/atlas/v1/taxonomies"; this.url = UrlLinks.taxonomiesApiUrl();
} }
} }
this.showLoader(); this.showLoader();
...@@ -308,7 +309,7 @@ define(['require', ...@@ -308,7 +309,7 @@ define(['require',
var that = this; var that = this;
_.each(this.taxanomy.models, function(model, key) { _.each(this.taxanomy.models, function(model, key) {
var name = model.get('name'); var name = model.get('name');
that.termCollection.url = "/api/atlas/v1/taxonomies/" + name + "/terms"; that.termCollection.url = UrlLinks.taxonomiesTermsApiUrl(name)
}); });
this.termCollection.fetch({ reset: true }); this.termCollection.fetch({ reset: true });
}, },
...@@ -388,9 +389,9 @@ define(['require', ...@@ -388,9 +389,9 @@ define(['require',
if (name.name) { if (name.name) {
// data-name="<space>'<tagName>'" Space is required for DSL search Input // data-name="<space>'<tagName>'" Space is required for DSL search Input
if (that.viewBased) { if (that.viewBased) {
parentLi = '<div class="tools"><i class="fa fa-refresh fa-spin-custom taxanomyloader"></i><i class="fa fa-ellipsis-h termPopover"></i></div><i class="fa fa-angle-right toggleArrow" data-id="expandArrow" data-href="' + hrefUrl + '"></i><a href="javascript:void(0)" data-href="' + hrefUrl + '" data-name=" `' + model.get('name') + '`">' + name.name + '</a>'; parentLi = '<div class="tools"><i class="fa fa-refresh fa-spin-custom taxanomyloader"></i><i class="fa fa-ellipsis-h termPopover"></i></div><i class="fa fa-angle-right toggleArrow" data-id="expandArrow" data-href="' + hrefUrl + '"></i><a href="javascript:void(0)" data-href="' + hrefUrl + '" data-name="`' + model.get('name') + '`">' + name.name + '</a>';
} else { } else {
parentLi = '<div class="tools"><i class="fa fa-refresh fa-spin-custom taxanomyloader"></i></div><i class="fa fa-angle-right toggleArrow" data-id="expandArrow" data-href="' + hrefUrl + '"></i><a href="javascript:void(0)" data-href="' + hrefUrl + '" data-name=" `' + model.get('name') + '`">' + name.name + '</a>'; parentLi = '<div class="tools"><i class="fa fa-refresh fa-spin-custom taxanomyloader"></i></div><i class="fa fa-angle-right toggleArrow" data-id="expandArrow" data-href="' + hrefUrl + '"></i><a href="javascript:void(0)" data-href="' + hrefUrl + '" data-name="`' + model.get('name') + '`">' + name.name + '</a>';
} }
} }
}); });
...@@ -613,7 +614,7 @@ define(['require', ...@@ -613,7 +614,7 @@ define(['require',
'modules/Modal' 'modules/Modal'
], function(AddTermLayoutView, Modal) { ], function(AddTermLayoutView, Modal) {
var view = new AddTermLayoutView({ var view = new AddTermLayoutView({
url: "/api/atlas/v1/taxonomies", url: UrlLinks.taxonomiesApiUrl(),
model: new that.parentCollection.model(), model: new that.parentCollection.model(),
defaultTerm:true defaultTerm:true
}); });
......
...@@ -19,8 +19,9 @@ ...@@ -19,8 +19,9 @@
define(['require', define(['require',
'backbone', 'backbone',
'hbs!tmpl/common/aboutAtlas_tmpl', 'hbs!tmpl/common/aboutAtlas_tmpl',
'models/VCommon' 'models/VCommon',
], function(require, Backbone, aboutAtlasTmpl, VCommon) { 'utils/UrlLinks'
], function(require, Backbone, aboutAtlasTmpl, VCommon, UrlLinks) {
'use strict'; 'use strict';
var aboutAtlasView = Backbone.Marionette.LayoutView.extend( var aboutAtlasView = Backbone.Marionette.LayoutView.extend(
...@@ -48,7 +49,7 @@ define(['require', ...@@ -48,7 +49,7 @@ define(['require',
}, },
onRender: function() { onRender: function() {
var that = this; var that = this;
var url = "/api/atlas/admin/version"; var url = UrlLinks.versionApiUrl();
var VCommonModel = new VCommon(); var VCommonModel = new VCommon();
VCommonModel.aboutUs(url, { VCommonModel.aboutUs(url, {
success: function(data) { success: function(data) {
......
...@@ -24,8 +24,10 @@ define(['require', ...@@ -24,8 +24,10 @@ define(['require',
'models/VEntity', 'models/VEntity',
'utils/CommonViewFunction', 'utils/CommonViewFunction',
'utils/Globals', 'utils/Globals',
'utils/Messages' 'utils/Enums',
], function(require, Backbone, DetailPageLayoutViewTmpl, Utils, VTagList, VEntity, CommonViewFunction, Globals, Messages) { 'utils/Messages',
'utils/UrlLinks'
], function(require, Backbone, DetailPageLayoutViewTmpl, Utils, VTagList, VEntity, CommonViewFunction, Globals, Enums, Messages, UrlLinks) {
'use strict'; 'use strict';
var DetailPageLayoutView = Backbone.Marionette.LayoutView.extend( var DetailPageLayoutView = Backbone.Marionette.LayoutView.extend(
...@@ -73,15 +75,6 @@ define(['require', ...@@ -73,15 +75,6 @@ define(['require',
/** ui events hash */ /** ui events hash */
events: function() { events: function() {
var events = {}; var events = {};
events["click " + this.ui.editButton] = function() {
this.ui.editButton.hide();
this.ui.description.hide();
this.ui.editBox.show();
this.ui.descriptionTextArea.focus();
if (this.descriptionPresent) {
this.ui.descriptionTextArea.val(this.ui.description.text());
}
};
events["click " + this.ui.tagClick] = function(e) { events["click " + this.ui.tagClick] = function(e) {
if (e.target.nodeName.toLocaleLowerCase() != "i") { if (e.target.nodeName.toLocaleLowerCase() != "i") {
var scope = $(e.currentTarget); var scope = $(e.currentTarget);
...@@ -89,7 +82,7 @@ define(['require', ...@@ -89,7 +82,7 @@ define(['require',
var url = scope.data('href').split(".").join("/terms/"); var url = scope.data('href').split(".").join("/terms/");
Globals.saveApplicationState.tabState.stateChanged = false; Globals.saveApplicationState.tabState.stateChanged = false;
Utils.setUrl({ Utils.setUrl({
url: '#!/taxonomy/detailCatalog/api/atlas/v1/taxonomies/' + url, url: '#!/taxonomy/detailCatalog' + UrlLinks.taxonomiesApiUrl() + '/' + url,
mergeBrowserUrl: false, mergeBrowserUrl: false,
trigger: true trigger: true
}); });
...@@ -124,35 +117,37 @@ define(['require', ...@@ -124,35 +117,37 @@ define(['require',
var that = this; var that = this;
this.listenTo(this.collection, 'reset', function() { this.listenTo(this.collection, 'reset', function() {
var collectionJSON = this.collection.toJSON(); var collectionJSON = this.collection.first().toJSON();
if (collectionJSON[0].id && collectionJSON[0].id.id) { if (collectionJSON && collectionJSON.guid) {
var tagGuid = collectionJSON[0].id.id; var tagGuid = collectionJSON.guid;
this.readOnly = Globals.entityStateReadOnly[collectionJSON[0].id.state]; //this.readOnly = Enums.entityStateReadOnly[collectionJSON[0].id.state];
}
if (this.readOnly) {
this.$el.addClass('readOnly');
} else { } else {
this.$el.removeClass('readOnly'); var tagGuid = this.id;
} }
if (collectionJSON && collectionJSON.length) { // if (this.readOnly) {
if (collectionJSON[0].values) { // this.$el.addClass('readOnly');
if (collectionJSON[0].values.name) { // } else {
this.name = collectionJSON[0].values.name; // this.$el.removeClass('readOnly');
// }
if (collectionJSON) {
if (collectionJSON.attributes) {
if (collectionJSON.attributes.name) {
this.name = collectionJSON.attributes.name
} }
if (!this.name && collectionJSON[0].values.qualifiedName) { if (!this.name && collectionJSON.attributes.qualifiedName) {
this.name = collectionJSON[0].values.qualifiedName; this.name = collectionJSON.attributes.qualifiedName;
} }
if (this.name && collectionJSON[0].typeName) { if (this.name && collectionJSON.typeName) {
this.name = this.name + ' (' + collectionJSON[0].typeName + ')'; this.name = this.name + ' (' + collectionJSON.typeName + ')';
} }
if (!this.name && collectionJSON[0].typeName) { if (!this.name && collectionJSON.typeName) {
this.name = collectionJSON[0].typeName; this.name = collectionJSON.typeName;
} }
if (!this.name && this.id) { if (!this.name && this.id) {
this.name = this.id; this.name = this.id;
} }
this.description = collectionJSON[0].values.description; this.description = collectionJSON.attributes.description;
if (this.name) { if (this.name) {
this.ui.title.show(); this.ui.title.show();
var titleName = '<span>' + this.name + '</span>'; var titleName = '<span>' + this.name + '</span>';
...@@ -170,22 +165,24 @@ define(['require', ...@@ -170,22 +165,24 @@ define(['require',
this.ui.description.hide(); this.ui.description.hide();
} }
} }
if (collectionJSON[0].traits) { if (collectionJSON.classifications) {
this.addTagToTerms(collectionJSON[0].traits); this.addTagToTerms(collectionJSON.classifications);
}else{
this.addTagToTerms([]);
} }
} }
this.renderEntityDetailTableLayoutView(); this.renderEntityDetailTableLayoutView();
this.renderTagTableLayoutView(tagGuid); this.renderTagTableLayoutView(tagGuid);
this.renderLineageLayoutView(tagGuid);
this.renderSchemaLayoutView(tagGuid);
this.renderAuditTableLayoutView(tagGuid);
this.renderTermTableLayoutView(tagGuid); this.renderTermTableLayoutView(tagGuid);
}, this); }, this);
}, },
onRender: function() { onRender: function() {
var that = this; var that = this;
this.ui.editBox.hide(); this.ui.editBox.hide();
this.renderLineageLayoutView(this.id);
this.renderSchemaLayoutView(this.id);
this.renderAuditTableLayoutView(this.id);
}, },
fetchCollection: function() { fetchCollection: function() {
this.collection.fetch({ reset: true }); this.collection.fetch({ reset: true });
......
...@@ -57,12 +57,14 @@ define(['require', ...@@ -57,12 +57,14 @@ define(['require',
}, },
entityTableGenerate: function() { entityTableGenerate: function() {
var that = this, var that = this,
valueObject = this.collectionObject[0].values, attributeObject = this.collection.first().toJSON().attributes;
valueSorted = _.sortBy(valueObject.columns, function(val) { if (attributeObject) {
return val.values.position var valueSorted = _.sortBy(attributeObject.columns, function(val) {
return val.attributes.position
}); });
valueObject.columns = valueSorted; }
var table = CommonViewFunction.propertyTable(valueObject, this); attributeObject.columns = valueSorted;
var table = CommonViewFunction.propertyTable(attributeObject, this);
that.ui.detailValue.append(table); that.ui.detailValue.append(table);
} }
}); });
......
...@@ -23,8 +23,10 @@ define(['require', ...@@ -23,8 +23,10 @@ define(['require',
'utils/Utils', 'utils/Utils',
'utils/CommonViewFunction', 'utils/CommonViewFunction',
'utils/Messages', 'utils/Messages',
'utils/Globals' 'utils/Globals',
], function(require, Backbone, SchemaTableLayoutViewTmpl, VSchemaList, Utils, CommonViewFunction, Messages, Globals) { 'utils/Enums',
'utils/UrlLinks'
], function(require, Backbone, SchemaTableLayoutViewTmpl, VSchemaList, Utils, CommonViewFunction, Messages, Globals, Enums, UrlLinks) {
'use strict'; 'use strict';
var SchemaTableLayoutView = Backbone.Marionette.LayoutView.extend( var SchemaTableLayoutView = Backbone.Marionette.LayoutView.extend(
...@@ -91,7 +93,7 @@ define(['require', ...@@ -91,7 +93,7 @@ define(['require',
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'globalVent', 'guid', 'vent')); _.extend(this, _.pick(options, 'globalVent', 'guid', 'vent'));
this.schemaCollection = new VSchemaList([], {}); this.schemaCollection = new VSchemaList([], {});
this.schemaCollection.url = "/api/atlas/lineage/" + this.guid + "/schema"; this.schemaCollection.url = UrlLinks.schemaApiUrl(this.guid);
this.commonTableOptions = { this.commonTableOptions = {
collection: this.schemaCollection, collection: this.schemaCollection,
includeFilter: false, includeFilter: false,
...@@ -252,7 +254,7 @@ define(['require', ...@@ -252,7 +254,7 @@ define(['require',
} else { } else {
nameHtml = '<a>' + rawValue + '</a>'; nameHtml = '<a>' + rawValue + '</a>';
} }
if (model.get('$id$') && model.get('$id$').state && Globals.entityStateReadOnly[model.get('$id$').state]) { 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>'; 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>'; return '<div class="readOnly readOnlyLink">' + nameHtml + '</div>';
} else { } else {
......
...@@ -21,7 +21,8 @@ define(['require', ...@@ -21,7 +21,8 @@ define(['require',
'hbs!tmpl/search/SearchLayoutView_tmpl', 'hbs!tmpl/search/SearchLayoutView_tmpl',
'collection/VTagList', 'collection/VTagList',
'utils/Utils', 'utils/Utils',
], function(require, Backbone, SearchLayoutViewTmpl, VTagList, Utils) { 'utils/UrlLinks'
], function(require, Backbone, SearchLayoutViewTmpl, VTagList, Utils, UrlLinks) {
'use strict'; 'use strict';
var SearchLayoutView = Backbone.Marionette.LayoutView.extend( var SearchLayoutView = Backbone.Marionette.LayoutView.extend(
...@@ -71,6 +72,7 @@ define(['require', ...@@ -71,6 +72,7 @@ define(['require',
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'globalVent', 'value')); _.extend(this, _.pick(options, 'globalVent', 'value'));
this.typecollection = new VTagList([], {}); this.typecollection = new VTagList([], {});
this.typecollection.url = UrlLinks.typesApiUrl();
this.type = "fulltext"; this.type = "fulltext";
var param = Utils.getUrlState.getQueryParams(); var param = Utils.getUrlState.getQueryParams();
this.query = { this.query = {
...@@ -104,7 +106,6 @@ define(['require', ...@@ -104,7 +106,6 @@ define(['require',
this.ui.searchBtn.attr("disabled", "true"); this.ui.searchBtn.attr("disabled", "true");
}, },
fetchCollection: function(value) { fetchCollection: function(value) {
$.extend(this.typecollection.queryParams, { type: 'CLASS' });
this.typecollection.fetch({ reset: true }); this.typecollection.fetch({ reset: true });
}, },
onRefreshButton: function() { onRefreshButton: function() {
...@@ -118,10 +119,10 @@ define(['require', ...@@ -118,10 +119,10 @@ define(['require',
this.ui.typeLov.empty(); this.ui.typeLov.empty();
var str = '<option></option>'; var str = '<option></option>';
this.typecollection.fullCollection.comparator = function(model) { this.typecollection.fullCollection.comparator = function(model) {
return model.get('tags').toLowerCase(); return model.get('name').toLowerCase();
} }
this.typecollection.fullCollection.sort().each(function(model) { this.typecollection.fullCollection.sort().each(function(model) {
str += '<option>' + model.get("tags") + '</option>'; str += '<option>' + model.get("name") + '</option>';
}); });
that.ui.typeLov.html(str); that.ui.typeLov.html(str);
}, },
......
...@@ -26,8 +26,10 @@ define(['require', ...@@ -26,8 +26,10 @@ define(['require',
'collection/VSearchList', 'collection/VSearchList',
'models/VCommon', 'models/VCommon',
'utils/CommonViewFunction', 'utils/CommonViewFunction',
'utils/Messages' 'utils/Messages',
], function(require, Backbone, SearchResultLayoutViewTmpl, Modal, VEntity, Utils, Globals, VSearchList, VCommon, CommonViewFunction, Messages) { 'utils/Enums',
'utils/UrlLinks'
], function(require, Backbone, SearchResultLayoutViewTmpl, Modal, VEntity, Utils, Globals, VSearchList, VCommon, CommonViewFunction, Messages, Enums, UrlLinks) {
'use strict'; 'use strict';
var SearchResultLayoutView = Backbone.Marionette.LayoutView.extend( var SearchResultLayoutView = Backbone.Marionette.LayoutView.extend(
...@@ -70,7 +72,7 @@ define(['require', ...@@ -70,7 +72,7 @@ define(['require',
var url = scope.data('href').split(".").join("/terms/"); var url = scope.data('href').split(".").join("/terms/");
Globals.saveApplicationState.tabState.stateChanged = false; Globals.saveApplicationState.tabState.stateChanged = false;
Utils.setUrl({ Utils.setUrl({
url: '#!/taxonomy/detailCatalog/api/atlas/v1/taxonomies/' + url, url: '#!/taxonomy/detailCatalog' + UrlLinks.taxonomiesApiUrl() + '/' + url,
mergeBrowserUrl: false, mergeBrowserUrl: false,
trigger: true trigger: true
}); });
...@@ -214,12 +216,12 @@ define(['require', ...@@ -214,12 +216,12 @@ define(['require',
$.extend(this.searchCollection.queryParams, { limit: this.limit }); $.extend(this.searchCollection.queryParams, { limit: this.limit });
if (value) { if (value) {
if (value.searchType) { if (value.searchType) {
this.searchCollection.url = "/api/atlas/discovery/search/" + value.searchType; this.searchCollection.url = UrlLinks.searchApiUrl(value.searchType);
$.extend(this.searchCollection.queryParams, { limit: this.limit }); $.extend(this.searchCollection.queryParams, { limit: this.limit });
this.offset = 0; this.offset = 0;
} }
if (Utils.getUrlState.isTagTab()) { if (Utils.getUrlState.isTagTab()) {
this.searchCollection.url = "/api/atlas/discovery/search/dsl"; this.searchCollection.url = UrlLinks.searchApiUrl(Enums.searchUrlType.DSL);
} }
_.extend(this.searchCollection.queryParams, { 'query': value.query.trim() }); _.extend(this.searchCollection.queryParams, { 'query': value.query.trim() });
} }
...@@ -347,21 +349,19 @@ define(['require', ...@@ -347,21 +349,19 @@ define(['require',
++that.asyncFetchCounter; ++that.asyncFetchCounter;
model.getEntity(guid, { model.getEntity(guid, {
success: function(data) { success: function(data) {
if (data.definition) { if (data.attributes) {
if (data.definition.id && data.definition.values) { if (data.guid && data.attributes) {
var id = ""; var id = "";
if (_.isObject(data.definition.id) && data.definition.id.id) { id = data.guid;
id = data.definition.id.id; if (that.searchCollection.get(id)) {
} else { that.searchCollection.get(id).set(data.attributes);
id = data.definition.id;
}
that.searchCollection.get(id).set(data.definition.values);
that.searchCollection.get(id).set({ that.searchCollection.get(id).set({
'$id$': data.definition.id, '$id$': data.guid,
'$traits$': data.definition.traits '$traits$': data.classifications
}); });
} }
} }
}
}, },
error: function(error, data, status) {}, error: function(error, data, status) {},
complete: function() { complete: function() {
...@@ -441,12 +441,12 @@ define(['require', ...@@ -441,12 +441,12 @@ define(['require',
return ""; return "";
} }
} }
if (model.get('$id$') && model.get('$id$').id) { if (model.get('$id$')) {
nameHtml = '<a href="#!/detailPage/' + model.get('$id$').id + '">' + rawValue + '</a>'; nameHtml = '<a href="#!/detailPage/' + (model.get('$id$').id || model.get('$id$')) + '">' + rawValue + '</a>';
} else { } else {
nameHtml = '<a>' + rawValue + '</a>'; nameHtml = '<a>' + rawValue + '</a>';
} }
if (model.get('$id$') && model.get('$id$').state && Globals.entityStateReadOnly[model.get('$id$').state]) { 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>'; 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>'; return '<div class="readOnly readOnlyLink">' + nameHtml + '</div>';
} else { } else {
...@@ -476,12 +476,12 @@ define(['require', ...@@ -476,12 +476,12 @@ define(['require',
return ""; return "";
} }
} }
if (model.get('$id$') && model.get('$id$').id) { if (model.get('$id$')) {
nameHtml = '<a href="#!/detailPage/' + model.get('$id$').id + '">' + rawValue + '</a>'; nameHtml = '<a href="#!/detailPage/' + (model.get('$id$').id || model.get('$id$')) + '">' + rawValue + '</a>';
} else { } else {
nameHtml = '<a>' + rawValue + '</a>'; nameHtml = '<a>' + rawValue + '</a>';
} }
if (model.get('$id$') && model.get('$id$').state && Globals.entityStateReadOnly[model.get('$id$').state]) { 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>'; 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>'; return '<div class="readOnly readOnlyLink">' + nameHtml + '</div>';
} else { } else {
...@@ -513,7 +513,7 @@ define(['require', ...@@ -513,7 +513,7 @@ define(['require',
className: 'searchTag', className: 'searchTag',
formatter: _.extend({}, Backgrid.CellFormatter.prototype, { formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
fromRaw: function(rawValue, model) { fromRaw: function(rawValue, model) {
if (model.get('$id$') && model.get('$id$').state && Globals.entityStateReadOnly[model.get('$id$').state]) { if (model.get('$id$') && model.get('$id$').state && Enums.entityStateReadOnly[model.get('$id$').state]) {
return '<div class="readOnly">' + CommonViewFunction.tagForTable(model); + '</div>'; return '<div class="readOnly">' + CommonViewFunction.tagForTable(model); + '</div>';
} else { } else {
return CommonViewFunction.tagForTable(model); return CommonViewFunction.tagForTable(model);
...@@ -536,7 +536,7 @@ define(['require', ...@@ -536,7 +536,7 @@ define(['require',
if (returnObject.object) { if (returnObject.object) {
that.bradCrumbList.push(returnObject.object); that.bradCrumbList.push(returnObject.object);
} }
if (model.get('$id$') && model.get('$id$').state && Globals.entityStateReadOnly[model.get('$id$').state]) { if (model.get('$id$') && model.get('$id$').state && Enums.entityStateReadOnly[model.get('$id$').state]) {
return '<div class="readOnly">' + returnObject.html + '</div>'; return '<div class="readOnly">' + returnObject.html + '</div>';
} else { } else {
return returnObject.html; return returnObject.html;
......
/** /**
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
...@@ -58,9 +57,9 @@ define(['require', ...@@ -58,9 +57,9 @@ define(['require',
* @constructs * @constructs
*/ */
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'tagCollection', 'tag', 'termCollection', 'descriptionData')); _.extend(this, _.pick(options, 'tagCollection', 'model', 'tag', 'termCollection', 'descriptionData'));
if (this.tagCollection && this.tagCollection.length > 0 && this.tagCollection.first().get('traitTypes')) { if (this.model) {
this.description = this.tagCollection.first().get('traitTypes')[0].typeDescription; this.description = this.model.get('description');
} else if (this.termCollection) { } else if (this.termCollection) {
this.description = this.descriptionData; this.description = this.descriptionData;
} else { } else {
...@@ -80,7 +79,7 @@ define(['require', ...@@ -80,7 +79,7 @@ define(['require',
that = this; that = this;
this.ui.parentTag.empty(); this.ui.parentTag.empty();
this.tagCollection.fullCollection.each(function(val) { this.tagCollection.fullCollection.each(function(val) {
str += '<option>' + val.get("tags") + '</option>'; str += '<option>' + val.get("name") + '</option>';
}); });
that.ui.parentTag.html(str); that.ui.parentTag.html(str);
console.log(platform); console.log(platform);
......
...@@ -21,10 +21,11 @@ define(['require', ...@@ -21,10 +21,11 @@ define(['require',
'hbs!tmpl/tag/TagAttributeDetailLayoutView_tmpl', 'hbs!tmpl/tag/TagAttributeDetailLayoutView_tmpl',
'utils/Utils', 'utils/Utils',
'views/tag/AddTagAttributeView', 'views/tag/AddTagAttributeView',
'collection/VCommonList', 'collection/VTagList',
'models/VTag', 'models/VTag',
'utils/Messages' 'utils/Messages',
], function(require, Backbone, TagAttributeDetailLayoutViewTmpl, Utils, AddTagAttributeView, VCommonList, VTag, Messages) { 'utils/UrlLinks'
], function(require, Backbone, TagAttributeDetailLayoutViewTmpl, Utils, AddTagAttributeView, VTagList, VTag, Messages, UrlLinks) {
'use strict'; 'use strict';
var TagAttributeDetailLayoutView = Backbone.Marionette.LayoutView.extend( var TagAttributeDetailLayoutView = Backbone.Marionette.LayoutView.extend(
...@@ -63,32 +64,12 @@ define(['require', ...@@ -63,32 +64,12 @@ define(['require',
* @constructs * @constructs
*/ */
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'globalVent', 'tag', 'vent')); _.extend(this, _.pick(options, 'globalVent', 'tag', 'collection'));
this.tagCollection = new VCommonList();
this.tagCollection.url = "/api/atlas/types/" + this.tag;
this.tagCollection.modelAttrName = "definition";
this.tagCollection.fetch({ reset: true });
this.bindEvents();
}, },
bindEvents: function() { bindEvents: function() {
this.listenTo(this.tagCollection, 'reset', function() { this.listenTo(this.collection, 'reset', function() {
var that = this, this.model = this.collection.findWhere({ name: this.tag });
attributeData = ""; this.renderTagDetail();
_.each(this.tagCollection.models, function(attr) {
var traitTypes = attr.get("traitTypes");
if (traitTypes[0].typeDescription != null) {
var descriptionValue = traitTypes[0].typeDescription;
that.ui.description.html(descriptionValue);
}
_.each(traitTypes[0].attributeDefinitions, function(value, key) {
attributeData += '<span class="inputAttribute">' + value.name + '</span>';
});
});
if (attributeData.length) {
that.ui.addTagtext.hide();
that.ui.addTagPlus.show();
}
that.ui.showAttribute.html(attributeData);
}, this); }, this);
this.listenTo(this.tagCollection, 'error', function(error, response) { this.listenTo(this.tagCollection, 'error', function(error, response) {
if (response.responseJSON && response.responseJSON.error) { if (response.responseJSON && response.responseJSON.error) {
...@@ -100,24 +81,47 @@ define(['require', ...@@ -100,24 +81,47 @@ define(['require',
}, this); }, this);
}, },
onRender: function() { onRender: function() {
this.ui.title.html('<span>' + this.tag + '</span>'); if (this.collection.models.length && !this.model) {
this.model = this.collection.findWhere({ name: this.tag });
this.renderTagDetail();
}
this.bindEvents();
this.ui.saveButton.attr("disabled", "true"); this.ui.saveButton.attr("disabled", "true");
this.ui.publishButton.prop('disabled', true); this.ui.publishButton.prop('disabled', true);
}, },
renderTagDetail: function() {
var attributeData = "",
attributeDefs = this.model.get("attributeDefs");
if (this.model.get("name")) {
this.ui.title.html('<span>' + this.model.get("name") + '</span>');
}
if (this.model.get("description")) {
this.ui.description.html(this.model.get("description"));
}
if (this.model.get("attributeDefs")) {
if (!_.isArray(attributeDefs)) {
attributeDefs = [attributeDefs];
}
_.each(attributeDefs, function(value, key) {
attributeData += '<span class="inputAttribute">' + value.name + '</span>';
});
this.ui.showAttribute.html(attributeData);
}
},
onSaveButton: function(saveObject, message) { onSaveButton: function(saveObject, message) {
var that = this, var that = this;
tagModel = new VTag(); this.model.saveTagAttribute(this.model.get('name'), {
tagModel.set(saveObject).save(null, { data: JSON.stringify(saveObject),
type: "PUT",
success: function(model, response) { success: function(model, response) {
that.tagCollection.fetch({ reset: true }); that.model.set(model);
that.renderTagDetail();
Utils.notifySuccess({ Utils.notifySuccess({
content: message content: message
}); });
}, },
error: function(model, response) { error: function(model, response) {
if (response.responseJSON && response.responseJSON.error) { if (response.responseJSON && response.responseJSON.error) {
that.tagCollection.fetch({ reset: true });
Utils.notifyError({ Utils.notifyError({
content: response.responseJSON.error content: response.responseJSON.error
}); });
...@@ -141,16 +145,20 @@ define(['require', ...@@ -141,16 +145,20 @@ define(['require',
}).open(); }).open();
modal.on('ok', function() { modal.on('ok', function() {
var attributeName = $(view.el).find("input").val(); var attributeName = $(view.el).find("input").val();
that.tagCollection.first().get('traitTypes')[0].attributeDefinitions.push({ var attributes = _.clone(that.model.get('attributeDefs'));
if (!_.isArray(attributes)) {
attributes = [attributes];
}
attributes.push({
"name": attributeName, "name": attributeName,
"dataTypeName": "string", "typeName": "string",
"multiplicity": "optional", "cardinality": "SINGLE",
"isComposite": false, "isUnique": false,
"isUniquvar e": false, "indexable": true,
"isIndexable": true, "isOptional":true
"reverseAttributeName": null
}); });
that.onSaveButton(that.tagCollection.first().toJSON(), Messages.addAttributeSuccessMessage); var saveData = _.extend(that.model.toJSON(), { 'attributeDefs': attributes });
that.onSaveButton(saveData, Messages.addAttributeSuccessMessage);
}); });
modal.on('closeModal', function() { modal.on('closeModal', function() {
modal.trigger('cancel'); modal.trigger('cancel');
...@@ -163,15 +171,15 @@ define(['require', ...@@ -163,15 +171,15 @@ define(['require',
this.ui.editBox.hide(); this.ui.editBox.hide();
}, },
textAreaChangeEvent: function(view, modal) { textAreaChangeEvent: function(view, modal) {
if (view.tagCollection.first().get('traitTypes')[0].typeDescription == view.ui.description.val()) { if (this.model.get('description') === view.ui.description.val()) {
modal.$el.find('button.ok').prop('disabled', true); modal.$el.find('button.ok').prop('disabled', true);
} else { } else {
modal.$el.find('button.ok').prop('disabled', false); modal.$el.find('button.ok').prop('disabled', false);
} }
}, },
onPublishClick: function(view) { onPublishClick: function(view) {
view.tagCollection.first().get('traitTypes')[0].typeDescription = view.ui.description.val(); var saveObj = _.extend(this.model.toJSON(), { 'description': view.ui.description.val() });
this.onSaveButton(this.tagCollection.first().toJSON(), Messages.updateTagDescriptionMessage); this.onSaveButton(saveObj, Messages.updateTagDescriptionMessage);
this.ui.description.show(); this.ui.description.show();
}, },
onEditButton: function(e) { onEditButton: function(e) {
...@@ -181,7 +189,7 @@ define(['require', ...@@ -181,7 +189,7 @@ define(['require',
'views/tag/CreateTagLayoutView', 'views/tag/CreateTagLayoutView',
'modules/Modal' 'modules/Modal'
], function(CreateTagLayoutView, Modal) { ], function(CreateTagLayoutView, Modal) {
var view = new CreateTagLayoutView({ 'tagCollection': that.tagCollection, 'tag': that.tag }); var view = new CreateTagLayoutView({ 'tagCollection': that.collection, 'model': that.model, 'tag': that.tag });
var modal = new Modal({ var modal = new Modal({
title: 'Edit Tag', title: 'Edit Tag',
content: view, content: view,
......
...@@ -44,7 +44,7 @@ define(['require', ...@@ -44,7 +44,7 @@ define(['require',
* @constructs * @constructs
*/ */
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'globalVent', 'guid', 'tag')); _.extend(this, _.pick(options, 'globalVent', 'tag', 'collection'));
}, },
bindEvents: function() {}, bindEvents: function() {},
onRender: function() { onRender: function() {
...@@ -68,7 +68,8 @@ define(['require', ...@@ -68,7 +68,8 @@ define(['require',
var that = this; var that = this;
require(['views/tag/TagAttributeDetailLayoutView'], function(TagAttributeDetailLayoutView) { require(['views/tag/TagAttributeDetailLayoutView'], function(TagAttributeDetailLayoutView) {
that.RTagAttributeDetailLayoutView.show(new TagAttributeDetailLayoutView({ that.RTagAttributeDetailLayoutView.show(new TagAttributeDetailLayoutView({
tag: that.tag tag: that.tag,
collection: that.collection
})); }));
}); });
}, },
......
...@@ -61,9 +61,9 @@ define(['require', ...@@ -61,9 +61,9 @@ define(['require',
*/ */
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'globalVent', 'collection', 'guid', 'term', 'assetName')); _.extend(this, _.pick(options, 'globalVent', 'collection', 'guid', 'term', 'assetName'));
this.collectionObject = this.collection.toJSON(); this.collectionObject = this.collection.first().toJSON();
this.tagTermCollection = new VTagList(); this.tagTermCollection = new VTagList();
var tagorterm = _.toArray(this.collectionObject[0].traits), var tagorterm = _.toArray(this.collectionObject.classifications),
tagTermList = [], tagTermList = [],
that = this; that = this;
_.each(tagorterm, function(object) { _.each(tagorterm, function(object) {
...@@ -130,7 +130,7 @@ define(['require', ...@@ -130,7 +130,7 @@ define(['require',
sortable: false, sortable: false,
formatter: _.extend({}, Backgrid.CellFormatter.prototype, { formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
fromRaw: function(rawValue, model) { fromRaw: function(rawValue, model) {
var values = model.get('values'), var values = model.get('attributes'),
tagValue = 'NA'; tagValue = 'NA';
if (!_.isEmpty(values)) { if (!_.isEmpty(values)) {
var stringArr = []; var stringArr = [];
......
...@@ -23,8 +23,9 @@ define(['require', ...@@ -23,8 +23,9 @@ define(['require',
'collection/VEntityList', 'collection/VEntityList',
'utils/Utils', 'utils/Utils',
'utils/Messages', 'utils/Messages',
'utils/Globals' 'utils/Globals',
], function(require, Backbone, TagLayoutViewTmpl, VTagList, VEntityList, Utils, Messages, Globals) { 'utils/UrlLinks'
], function(require, Backbone, TagLayoutViewTmpl, VTagList, VEntityList, Utils, Messages, Globals, UrlLinks) {
'use strict'; 'use strict';
var TagLayoutView = Backbone.Marionette.LayoutView.extend( var TagLayoutView = Backbone.Marionette.LayoutView.extend(
...@@ -45,7 +46,6 @@ define(['require', ...@@ -45,7 +46,6 @@ define(['require',
offLineSearchTag: "[data-id='offlineSearchTag']", offLineSearchTag: "[data-id='offlineSearchTag']",
deleteTerm: "[data-id='deleteTerm']", deleteTerm: "[data-id='deleteTerm']",
refreshTag: '[data-id="refreshTag"]' refreshTag: '[data-id="refreshTag"]'
}, },
/** ui events hash */ /** ui events hash */
events: function() { events: function() {
...@@ -62,20 +62,12 @@ define(['require', ...@@ -62,20 +62,12 @@ define(['require',
* @constructs * @constructs
*/ */
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'globalVent', 'tag')); _.extend(this, _.pick(options, 'globalVent', 'tag', 'collection'));
this.tagCollection = new VTagList();
this.collection = new Backbone.Collection();
this.json = {
"enumTypes": [],
"traitTypes": [],
"structTypes": [],
"classTypes": []
};
}, },
bindEvents: function() { bindEvents: function() {
var that = this; var that = this;
this.listenTo(this.tagCollection, "reset", function() { this.listenTo(this.collection, "reset", function() {
this.tagsAndTypeGenerator('tagCollection'); this.tagsAndTypeGenerator('collection');
}, this); }, this);
this.ui.tagsParent.on('click', 'li.parent-node a', function() { this.ui.tagsParent.on('click', 'li.parent-node a', function() {
that.setUrl(this.getAttribute("href")); that.setUrl(this.getAttribute("href"));
...@@ -98,8 +90,7 @@ define(['require', ...@@ -98,8 +90,7 @@ define(['require',
}); });
}, },
fetchCollections: function() { fetchCollections: function() {
$.extend(this.tagCollection.queryParams, { type: 'TRAIT', notsupertype: 'TaxonomyTerm' }); this.collection.fetch({ reset: true });
this.tagCollection.fetch({ reset: true });
this.ui.offLineSearchTag.val(""); this.ui.offLineSearchTag.val("");
}, },
manualRender: function(tagName) { manualRender: function(tagName) {
...@@ -152,19 +143,19 @@ define(['require', ...@@ -152,19 +143,19 @@ define(['require',
tagsAndTypeGenerator: function(collection, searchString) { tagsAndTypeGenerator: function(collection, searchString) {
var that = this, var that = this,
str = ''; str = '';
that.tagCollection.fullCollection.comparator = function(model) { that.collection.fullCollection.comparator = function(model) {
return model.get('tags').toLowerCase(); return model.get('name').toLowerCase();
}; };
that.tagCollection.fullCollection.sort().each(function(model) { that.collection.fullCollection.sort().each(function(model) {
if (searchString) { if (searchString) {
if (model.get('tags').search(new RegExp(searchString, "i")) != -1) { if (model.get('name').search(new RegExp(searchString, "i")) != -1) {
// data-name="<space>'<tagName>'" Space is required for DSL search Input // data-name="<space>'<tagName>'" Space is required for DSL search Input
str += '<li class="parent-node" data-id="tags"><div class="tools"><i class="fa fa-ellipsis-h tagPopover"></i></div><a href="#!/tag/tagAttribute/' + model.get('tags') + '" data-name=" `' + model.get('tags') + '`" >' + model.get('tags') + '</a></li>'; str += '<li class="parent-node" data-id="tags"><div class="tools"><i class="fa fa-ellipsis-h tagPopover"></i></div><a href="#!/tag/tagAttribute/' + model.get('name') + '" data-name="`' + model.get('name') + '`" >' + model.get('name') + '</a></li>';
} else { } else {
return; return;
} }
} else { } else {
str += '<li class="parent-node" data-id="tags"><div class="tools"><i class="fa fa-ellipsis-h tagPopover"></i></div><a href="#!/tag/tagAttribute/' + model.get('tags') + '" data-name=" `' + model.get('tags') + '`">' + model.get('tags') + '</a></li>'; str += '<li class="parent-node" data-id="tags"><div class="tools"><i class="fa fa-ellipsis-h tagPopover"></i></div><a href="#!/tag/tagAttribute/' + model.get('name') + '" data-name="`' + model.get('name') + '`">' + model.get('name') + '</a></li>';
} }
}); });
this.ui.tagsParent.empty().html(str); this.ui.tagsParent.empty().html(str);
...@@ -175,7 +166,6 @@ define(['require', ...@@ -175,7 +166,6 @@ define(['require',
} }
}, },
onClickCreateTag: function(e) { onClickCreateTag: function(e) {
var that = this; var that = this;
$(e.currentTarget).blur(); $(e.currentTarget).blur();
...@@ -183,7 +173,7 @@ define(['require', ...@@ -183,7 +173,7 @@ define(['require',
'views/tag/CreateTagLayoutView', 'views/tag/CreateTagLayoutView',
'modules/Modal' 'modules/Modal'
], function(CreateTagLayoutView, Modal) { ], function(CreateTagLayoutView, Modal) {
var view = new CreateTagLayoutView({ 'tagCollection': that.tagCollection }); var view = new CreateTagLayoutView({ 'tagCollection': that.collection });
var modal = new Modal({ var modal = new Modal({
title: 'Create a new tag', title: 'Create a new tag',
content: view, content: view,
...@@ -223,22 +213,23 @@ define(['require', ...@@ -223,22 +213,23 @@ define(['require',
if (ref.ui.parentTag.val() && ref.ui.parentTag.val()) { if (ref.ui.parentTag.val() && ref.ui.parentTag.val()) {
superTypes = ref.ui.parentTag.val(); superTypes = ref.ui.parentTag.val();
} }
this.json.traitTypes[0] = { this.json = {
attributeDefinitions: this.collection.toJSON(), 'name': this.name,
typeName: this.name, 'description': this.description,
typeDescription: this.description, "typeVersion": "2",
superTypes: superTypes, "version": "2",
hierarchicalMetaTypeName: "org.apache.atlas.typesystem.types.TraitType" 'superTypes': superTypes.length ? superTypes : [],
}; };
new this.tagCollection.model().set(this.json).save(null, { new this.collection.model().set(this.json).save(null, {
success: function(model, response) { success: function(model, response) {
that.createTag = true; that.createTag = true;
that.fetchCollections(); that.fetchCollections();
that.collection.add(model)
that.setUrl('#!/tag/tagAttribute/' + ref.ui.tagName.val(), true); that.setUrl('#!/tag/tagAttribute/' + ref.ui.tagName.val(), true);
Utils.notifySuccess({ Utils.notifySuccess({
content: "Tag " + that.name + Messages.addSuccessMessage content: "Tag " + that.name + Messages.addSuccessMessage
}); });
that.collection.reset([]);
}, },
error: function(model, response) { error: function(model, response) {
if (response.responseJSON && response.responseJSON.error) { if (response.responseJSON && response.responseJSON.error) {
...@@ -270,7 +261,7 @@ define(['require', ...@@ -270,7 +261,7 @@ define(['require',
}, },
offlineSearchTag: function(e) { offlineSearchTag: function(e) {
var type = $(e.currentTarget).data('type'); var type = $(e.currentTarget).data('type');
this.tagsAndTypeGenerator('tagCollection', $(e.currentTarget).val()); this.tagsAndTypeGenerator('collection', $(e.currentTarget).val());
}, },
createTagAction: function() { createTagAction: function() {
var that = this; var that = this;
......
...@@ -22,8 +22,9 @@ define(['require', ...@@ -22,8 +22,9 @@ define(['require',
'collection/VCommonList', 'collection/VCommonList',
'modules/Modal', 'modules/Modal',
'models/VEntity', 'models/VEntity',
'utils/Utils' 'utils/Utils',
], function(require, AddTagModalViewTmpl, VTagList, VCommonList, Modal, VEntity, Utils) { 'utils/UrlLinks'
], function(require, AddTagModalViewTmpl, VTagList, VCommonList, Modal, VEntity, Utils, UrlLinks) {
'use strict'; 'use strict';
var AddTagModel = Marionette.LayoutView.extend({ var AddTagModel = Marionette.LayoutView.extend({
...@@ -47,7 +48,7 @@ define(['require', ...@@ -47,7 +48,7 @@ define(['require',
var that = this; var that = this;
_.extend(this, _.pick(options, 'vent', 'modalCollection', 'guid', 'callback', 'multiple', 'showLoader')); _.extend(this, _.pick(options, 'vent', 'modalCollection', 'guid', 'callback', 'multiple', 'showLoader'));
this.collection = new VTagList(); this.collection = new VTagList();
this.commonCollection = new VCommonList(); this.commonCollection = new VTagList();
this.asyncAttrFetchCounter = 0; this.asyncAttrFetchCounter = 0;
this.modal = new Modal({ this.modal = new Modal({
title: 'Add Tag', title: 'Add Tag',
...@@ -74,7 +75,7 @@ define(['require', ...@@ -74,7 +75,7 @@ define(['require',
var obj = { var obj = {
tagName: tagName, tagName: tagName,
tagAttributes: tagAttributes, tagAttributes: tagAttributes,
guid: that.multiple[i].id.id guid: (_.isObject(that.multiple[i].id) ? that.multiple[i].id.id : that.multiple[i].id)
} }
that.saveTagData(obj); that.saveTagData(obj);
} }
...@@ -112,12 +113,12 @@ define(['require', ...@@ -112,12 +113,12 @@ define(['require',
}, },
tagsCollection: function() { tagsCollection: function() {
this.collection.fullCollection.comparator = function(model) { this.collection.fullCollection.comparator = function(model) {
return model.get('tags').toLowerCase(); return model.get('name').toLowerCase();
} }
var str = '<option selected="selected" disabled="disabled">-- Select a tag from the dropdown list --</option>'; var str = '<option selected="selected" disabled="disabled">-- Select a tag from the dropdown list --</option>';
this.collection.fullCollection.sort().each(function(obj, key) { this.collection.fullCollection.sort().each(function(obj, key) {
str += '<option>' + obj.get('tags') + '</option>'; str += '<option>' + obj.get('name') + '</option>';
}); });
this.ui.addTagOptions.html(str); this.ui.addTagOptions.html(str);
this.ui.addTagOptions.select2({ this.ui.addTagOptions.select2({
...@@ -134,8 +135,7 @@ define(['require', ...@@ -134,8 +135,7 @@ define(['require',
this.fetchTagSubData(tagname); this.fetchTagSubData(tagname);
}, },
fetchTagSubData: function(tagname) { fetchTagSubData: function(tagname) {
this.commonCollection.url = "/api/atlas/types/" + tagname; this.commonCollection.url = UrlLinks.typesClassicationApiUrl(tagname);
this.commonCollection.modelAttrName = 'definition';
++this.asyncAttrFetchCounter ++this.asyncAttrFetchCounter
this.commonCollection.fetch({ reset: true }); this.commonCollection.fetch({ reset: true });
}, },
...@@ -153,18 +153,28 @@ define(['require', ...@@ -153,18 +153,28 @@ define(['require',
this.$('.attrLoader').show(); this.$('.attrLoader').show();
}, },
subAttributeData: function() { subAttributeData: function() {
if (this.commonCollection.models[0] && this.commonCollection.models[0].attributes && this.commonCollection.models[0].attributes.traitTypes[0].attributeDefinitions) { var that = this;
for (var i = 0; i < this.commonCollection.models[0].attributes.traitTypes[0].attributeDefinitions.length; i++) { if (this.commonCollection.models[0]) {
var attribute = this.commonCollection.models[0].attributes.traitTypes[0].attributeDefinitions; if (this.commonCollection.models[0].get('attributeDefs')) {
var strAttribute = '<div class="form-group"><label>' + attribute[i].name + '</label>' + _.each(this.commonCollection.models[0].get('attributeDefs'), function(obj) {
'<input type="text" class="form-control attributeInputVal attrName" data-key="' + attribute[i].name + '" ></input></div>'; that.ui.tagAttribute.append('<div class="form-group"><label>' + obj.name + '</label>' +
this.ui.tagAttribute.append(strAttribute); '<input type="text" class="form-control attributeInputVal attrName" data-key="' + obj.name + '" ></input></div>');
} });
if (this.commonCollection.models[0].attributes.traitTypes[0].superTypes.length > 0) {
for (var j = 0; j < this.commonCollection.models[0].attributes.traitTypes[0].superTypes.length; j++) {
var superTypeAttr = this.commonCollection.models[0].attributes.traitTypes[0].superTypes[j];
this.fetchTagSubData(superTypeAttr);
} }
if (this.commonCollection.models[0].get('superTypes')) {
var superTypes = this.commonCollection.models[0].get('superTypes');
if (!_.isArray(superTypes)) {
superTypes = [superTypes];
}
if (superTypes.length) {
_.each(superTypes, function(name) {
that.fetchTagSubData(name);
});
} else {
this.showAttributeBox();
}
} else { } else {
this.showAttributeBox(); this.showAttributeBox();
} }
...@@ -178,11 +188,10 @@ define(['require', ...@@ -178,11 +188,10 @@ define(['require',
this.entityModel = new VEntity(); this.entityModel = new VEntity();
var tagName = options.tagName, var tagName = options.tagName,
tagAttributes = options.tagAttributes, tagAttributes = options.tagAttributes,
json = { json = [{
"jsonClass": "org.apache.atlas.typesystem.json.InstanceSerialization$_Struct",
"typeName": tagName, "typeName": tagName,
"values": tagAttributes "attributes": tagAttributes
}; }];
this.entityModel.saveEntity(options.guid, { this.entityModel.saveEntity(options.guid, {
data: JSON.stringify(json), data: JSON.stringify(json),
success: function(data) { success: function(data) {
......
...@@ -9,6 +9,7 @@ ATLAS-1060 Add composite indexes for exact match performance improvements for al ...@@ -9,6 +9,7 @@ ATLAS-1060 Add composite indexes for exact match performance improvements for al
ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai) ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai)
ALL CHANGES: ALL CHANGES:
ATLAS-1287 Subtasks: ATLAS-1288/ATLAS-1289 Integrated V2 API for Lineage,Entity Details,Tag assign to entity,Tags listing,tag create (kevalbhatt)
ATLAS-1303 Update hashCode and equals method to use standard JDK libraries (apoorvnaik via svimal2106) ATLAS-1303 Update hashCode and equals method to use standard JDK libraries (apoorvnaik via svimal2106)
ATLAS-1364 HiveHook : Fix Auth issue with doAs (sumasai) ATLAS-1364 HiveHook : Fix Auth issue with doAs (sumasai)
ATLAS-1340 Credential Provider utility does not work with fully qualified local/HDFS jceks path (vrathor via svimal2106) ATLAS-1340 Credential Provider utility does not work with fully qualified local/HDFS jceks path (vrathor via svimal2106)
......
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