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',
'utils/Globals',
'collection/BaseCollection',
'models/VCatalog',
], function(require, Globals, BaseCollection, VCatalog) {
'utils/UrlLinks'
], function(require, Globals, BaseCollection, VCatalog, UrlLinks) {
'use strict';
var VCatalogList = BaseCollection.extend(
//Prototypal attributes
{
url: Globals.baseURL + '/api/atlas/v1/taxonomies',
url: UrlLinks.taxonomiesApiUrl(),
model: VCatalog,
......
......@@ -20,12 +20,13 @@ define(['require',
'utils/Globals',
'collection/BaseCollection',
'models/VCommon',
], function(require, Globals, BaseCollection, VCommon) {
'utils/UrlLinks'
], function(require, Globals, BaseCollection, VCommon, UrlLinks) {
'use strict';
var VCommonList = BaseCollection.extend(
//Prototypal attributes
{
url: Globals.baseURL + '',
url: UrlLinks.baseURL + '',
model: VCommon,
......
......@@ -19,20 +19,48 @@
define(['require',
'utils/Globals',
'collection/BaseCollection',
'models/VEntity'
], function(require, Globals, BaseCollection, VEntity) {
'models/VEntity',
'utils/UrlLinks'
], function(require, Globals, BaseCollection, VEntity, UrlLinks) {
'use strict';
var VEntityList = BaseCollection.extend(
//Prototypal attributes
{
url: Globals.baseURL + '/api/atlas/entities',
url: UrlLinks.entitiesApiUrl(),
model: VEntity,
initialize: function() {
this.modelName = 'VEntity';
this.modelAttrName = 'definition';
this.modelAttrName = '';
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
......
......@@ -19,13 +19,14 @@
define(['require',
'utils/Globals',
'collection/BaseCollection',
'models/VLineage'
], function(require, Globals, BaseCollection, VLineage) {
'models/VLineage',
'utils/UrlLinks'
], function(require, Globals, BaseCollection, VLineage, UrlLinks) {
'use strict';
var VLineageList = BaseCollection.extend(
//Prototypal attributes
{
url: Globals.baseURL,
url: UrlLinks.baseURL,
model: VLineage,
......@@ -33,6 +34,16 @@ define(['require',
this.modelName = 'VLineage';
this.modelAttrName = 'results';
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
......
......@@ -19,13 +19,14 @@
define(['require',
'utils/Globals',
'collection/BaseCollection',
'models/VSchema'
], function(require, Globals, BaseCollection, VSchema) {
'models/VSchema',
'utils/UrlLinks'
], function(require, Globals, BaseCollection, VSchema, UrlLinks) {
'use strict';
var VSchemaList = BaseCollection.extend(
//Prototypal attributes
{
url: Globals.baseURL,
url: UrlLinks.baseURL,
model: VSchema,
initialize: function() {
this.modelName = 'VSchema';
......
......@@ -19,13 +19,14 @@
define(['require',
'utils/Globals',
'collection/BaseCollection',
'models/VSearch'
], function(require, Globals, BaseCollection, VSearch) {
'models/VSearch',
'utils/UrlLinks'
], function(require, Globals, BaseCollection, VSearch, UrlLinks) {
'use strict';
var VSearchList = BaseCollection.extend(
//Prototypal attributes
{
url: Globals.baseURL + '/api/atlas/discovery/search',
url: UrlLinks.searchApiUrl(),
model: VSearch,
......
......@@ -19,17 +19,18 @@
define(['require',
'utils/Globals',
'collection/BaseCollection',
'models/VTag'
], function(require, Globals, BaseCollection, VTag) {
'models/VTag',
'utils/UrlLinks'
], function(require, Globals, BaseCollection, VTag, UrlLinks) {
'use strict';
var VTagList = BaseCollection.extend(
//Prototypal attributes
{
url: Globals.baseURL + '/api/atlas/types',
url: UrlLinks.typesClassicationApiUrl(),
model: VTag,
initialize: function() {
this.modelName = 'VTag';
this.modelAttrName = 'results';
this.modelAttrName = 'list';
this.bindErrorEvents();
},
parseRecords: function(resp, options) {
......@@ -37,13 +38,23 @@ define(['require',
if (!this.modelAttrName) {
throw new Error("this.modelAttrName not defined for " + this);
}
var arr = [];
resp[this.modelAttrName].forEach(function(d) {
arr.push({
tags: d
if (this.modelAttrName === "list") {
if (resp[this.modelAttrName]) {
return resp[this.modelAttrName];
} else {
return resp
}
} else {
var arr = [];
resp[this.modelAttrName].forEach(function(d) {
arr.push({
tags: d
});
});
});
return arr;
return arr;
}
} catch (e) {
console.log(e);
}
......
......@@ -152,14 +152,15 @@ require(['App',
'router/Router',
'utils/CommonViewFunction',
'utils/Globals',
'utils/UrlLinks',
'utils/Overrides',
'bootstrap',
'd3',
'select2'
], function(App, Router, CommonViewFunction, Globals) {
'select2'
], function(App, Router, CommonViewFunction, Globals, UrlLinks) {
App.appRouter = new Router();
CommonViewFunction.userDataFetch({
url: Globals.baseURL + "/api/atlas/admin/session",
url: UrlLinks.sessionApiUrl(),
callback: function(response) {
if (response && response.userName) {
Globals.userLogedIn.status = true;
......
......@@ -18,11 +18,12 @@
define(['require',
'utils/Globals',
'models/BaseModel'
], function(require, Globals, VBaseModel) {
'models/BaseModel',
'utils/UrlLinks'
], function(require, Globals, VBaseModel, UrlLinks) {
'use strict';
var VCatalog = VBaseModel.extend({
urlRoot: Globals.baseURL + '/api/atlas/v1/taxonomies',
urlRoot: UrlLinks.taxonomiesApiUrl(),
defaults: {},
......@@ -38,7 +39,7 @@ define(['require',
return this.get('name');
},
deleteTerm: function(termURL, options) {
var url = Globals.baseURL + termURL;
var url = UrlLinks.baseURL + termURL;
options = _.extend({
contentType: 'application/json',
dataType: 'json'
......
......@@ -18,11 +18,12 @@
define(['require',
'utils/Globals',
'models/BaseModel'
], function(require, Globals, VBaseModel) {
'models/BaseModel',
'utils/UrlLinks'
], function(require, Globals, VBaseModel, UrlLinks) {
'use strict';
var VCommon = VBaseModel.extend({
urlRoot: Globals.baseURL + '',
urlRoot: UrlLinks.baseUrl + '',
defaults: {},
......@@ -41,7 +42,7 @@ define(['require',
* Non - CRUD operations
*************************/
aboutUs: function(url, options) {
var url = Globals.baseURL + url;
var url = url;
options = _.extend({
contentType: 'application/json',
dataType: 'json'
......
......@@ -18,12 +18,13 @@
define(['require',
'utils/Globals',
'models/BaseModel'
], function(require, Globals, VBaseModel) {
'models/BaseModel',
'utils/UrlLinks'
], function(require, Globals, VBaseModel, UrlLinks) {
'use strict';
var VEntity = VBaseModel.extend({
urlRoot: Globals.baseURL + '/api/atlas/entities/',
urlRoot: UrlLinks.entitiesApiUrl(),
defaults: {},
......@@ -43,7 +44,7 @@ define(['require',
*************************/
getEntity: function(token, options) {
var url = Globals.baseURL + '/api/atlas/entities/' + token;
var url = UrlLinks.entitiesApiUrl(token);
options = _.extend({
contentType: 'application/json',
......@@ -53,13 +54,23 @@ define(['require',
return this.constructor.nonCrudOperation.call(this, url, 'GET', options);
},
saveEntity: function(token, options) {
var url = Globals.baseURL + '/api/atlas/entities/' + token + '/traits';
var url = UrlLinks.entitiesTraitsApiUrl(token);
options = _.extend({
contentType: 'application/json',
dataType: 'json'
}, 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;
......
......@@ -18,12 +18,13 @@
define(['require',
'utils/Globals',
'models/BaseModel'
], function(require, Globals, VBaseModel) {
'models/BaseModel',
'utils/UrlLinks'
], function(require, Globals, VBaseModel, UrlLinks) {
'use strict';
var VLineage = VBaseModel.extend({
urlRoot: Globals.baseURL,
urlRoot: UrlLinks.baseURL,
defaults: {},
......
......@@ -18,11 +18,12 @@
define(['require',
'utils/Globals',
'models/BaseModel'
], function(require, Globals, VBaseModel) {
'models/BaseModel',
'utils/UrlLinks'
], function(require, Globals, VBaseModel, UrlLinks) {
'use strict';
var VSchema = VBaseModel.extend({
urlRoot: Globals.baseURL,
urlRoot: UrlLinks.baseURL,
defaults: {},
......
......@@ -18,11 +18,12 @@
define(['require',
'utils/Globals',
'models/BaseModel'
], function(require, Globals, VBaseModel) {
'models/BaseModel',
'utils/UrlLinks'
], function(require, Globals, VBaseModel, UrlLinks) {
'use strict';
var VSearch = VBaseModel.extend({
urlRoot: Globals.baseURL + '/api/atlas/discovery/search',
urlRoot: UrlLinks.searchApiUrl(),
defaults: {},
......@@ -40,8 +41,8 @@ define(['require',
/*************************
* Non - CRUD operations
*************************/
getEntity: function(token, options) {
var url = Globals.baseURL + '/api/atlas/entities/' + token;
getEntity: function(id, options) {
var url = UrlLinks.entitiesApiUrl(id);
options = _.extend({
contentType: 'application/json',
......
......@@ -18,11 +18,12 @@
define(['require',
'utils/Globals',
'models/BaseModel'
], function(require, Globals, vBaseModel) {
'models/BaseModel',
'utils/UrlLinks'
], function(require, Globals, vBaseModel, UrlLinks) {
'use strict';
var VTag = vBaseModel.extend({
urlRoot: Globals.baseURL + '/api/atlas/types',
urlRoot: UrlLinks.typesClassicationApiUrl(),
defaults: {},
......@@ -41,12 +42,20 @@ define(['require',
* Non - CRUD operations
*************************/
deleteTag: function(guid, name, options) {
var url = Globals.baseURL + '/api/atlas/entities/' + guid + '/traits/' + name;
var url = UrlLinks.entitiesApiUrl(guid, name);
options = _.extend({
contentType: 'application/json',
dataType: 'json'
}, 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;
......
......@@ -22,8 +22,10 @@ define([
'backbone',
'App',
'utils/Globals',
'utils/Utils'
], function($, _, Backbone, App, Globals, Utils) {
'utils/Utils',
'utils/UrlLinks',
'collection/VTagList'
], function($, _, Backbone, App, Globals, Utils, UrlLinks, VTagList) {
var AppRouter = Backbone.Router.extend({
routes: {
// Define some URL routes
......@@ -46,6 +48,7 @@ define([
this.globalVent = new Backbone.Wreqr.EventAggregator();
this.catalogVent = new Backbone.Wreqr.EventAggregator();
this.tagVent = new Backbone.Wreqr.EventAggregator();
this.tagCollection = new VTagList();
},
bindCommonEvents: function() {
var that = this;
......@@ -110,7 +113,7 @@ define([
this.collection.url = url;
App.rNHeader.show(new BusinessCatalogHeader({ 'globalVent': that.globalVent, 'url': url, 'collection': this.collection }));
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 {
App.rSideNav.currentView.RBusinessCatalogLayoutView.currentView.manualRender("/" + url);
App.rSideNav.currentView.selectTab();
......@@ -138,17 +141,16 @@ define([
this.entityCollection = new VEntityList([], {});
App.rNHeader.show(new Header({ 'globalVent': that.globalVent }));
if (!App.rSideNav.currentView) {
App.rSideNav.show(new SideNavLayoutView({ 'globalVent': that.globalVent }));
App.rSideNav.show(new SideNavLayoutView({ 'globalVent': that.globalVent, 'collection': that.tagCollection }));
} else {
App.rSideNav.currentView.selectTab();
}
App.rNContent.show(new DetailPageLayoutView({
'globalVent': that.globalVent,
'collection': this.entityCollection,
'id': id,
}));
this.entityCollection.url = "/api/atlas/entities/" + id;
this.entityCollection.url = UrlLinks.entitiesApiUrl(id);
this.entityCollection.fetch({ reset: true });
});
}
......@@ -165,7 +167,8 @@ define([
if (!App.rSideNav.currentView) {
App.rSideNav.show(new SideNavLayoutView({
'globalVent': that.globalVent,
'tag': tagName
'tag': tagName,
'collection': that.tagCollection
}));
} else {
......@@ -176,7 +179,8 @@ define([
if (tagName) {
App.rNContent.show(new TagDetailLayoutView({
'globalVent': that.globalVent,
'tag': tagName
'tag': tagName,
'collection': that.tagCollection
}));
}
});
......@@ -191,7 +195,8 @@ define([
App.rNHeader.show(new Header({ 'globalVent': that.globalVent }));
if (!App.rSideNav.currentView) {
App.rSideNav.show(new SideNavLayoutView({
'globalVent': that.globalVent
'globalVent': that.globalVent,
'collection': that.tagCollection
}));
} else {
App.rSideNav.currentView.selectTab();
......@@ -218,7 +223,8 @@ define([
if (!App.rSideNav.currentView) {
App.rSideNav.show(new SideNavLayoutView({
'globalVent': that.globalVent,
'value': paramObj
'value': paramObj,
'collection': that.tagCollection
}));
} else {
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) {
var Globals = {};
Globals.baseURL = '';
//Globals.baseURL = '/api/atlas';
Globals.settings = {};
Globals.settings.PAGE_SIZE = 25;
Globals.saveApplicationState = {
......@@ -34,17 +34,6 @@ define(['require'], function(require) {
},
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 = {
status: false,
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',
'backbone',
'hbs!tmpl/audit/AuditTableLayoutView_tmpl',
'collection/VEntityList',
'utils/Globals'
], function(require, Backbone, AuditTableLayoutView_tmpl, VEntityList, Globals) {
'utils/Enums',
'utils/UrlLinks'
], function(require, Backbone, AuditTableLayoutView_tmpl, VEntityList, Enums, UrlLinks) {
'use strict';
var AuditTableLayoutView = Backbone.Marionette.LayoutView.extend(
......@@ -60,7 +61,7 @@ define(['require',
_.extend(this, _.pick(options, 'globalVent', 'guid'));
this.entityCollection = new VEntityList();
this.count = 26;
this.entityCollection.url = "/api/atlas/entities/" + this.guid + "/audit";
this.entityCollection.url = UrlLinks.entityCollectionaudit(this.guid);
this.entityCollection.modelAttrName = "events";
this.entityModel = new this.entityCollection.model();
this.pervOld = [];
......@@ -140,6 +141,7 @@ define(['require',
if ((that.entityCollection.models.length < that.count && that.currPage == 1) && that.next == that.entityCollection.last().get('eventKey')) {
options.next.attr('disabled', true);
options.previous.removeAttr("disabled");
//that.renderTableLayoutView();
} else {
if (that.entityCollection.models.length > 0) {
that.next = that.entityCollection.last().get('eventKey');
......@@ -193,8 +195,8 @@ define(['require',
sortable: false,
formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
fromRaw: function(rawValue, model) {
if (Globals.auditAction[rawValue]) {
return Globals.auditAction[rawValue];
if (Enums.auditAction[rawValue]) {
return Enums.auditAction[rawValue];
} else {
return rawValue;
}
......@@ -208,7 +210,7 @@ define(['require',
sortable: false,
formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
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 @@
define(['require',
'backbone',
'hbs!tmpl/audit/CreateAuditTableLayoutView_tmpl',
'utils/Globals',
'utils/Enums',
'utils/CommonViewFunction'
], function(require, Backbone, CreateAuditTableLayoutViewTmpl, Globals, CommonViewFunction) {
], function(require, Backbone, CreateAuditTableLayoutViewTmpl, Enums, CommonViewFunction) {
'use strict';
var CreateAuditTableLayoutView = Backbone.Marionette.LayoutView.extend(
......@@ -68,7 +68,7 @@ define(['require',
var detailsObject = JSON.parse(appendedString.replace("{" + auditData + ":", '{"' + auditData + '":'))[auditData];
//Append string for JSON parse
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.auditValue.html("<tr><td>" + detailsObject.typeName + "</td></tr>");
} else {
......@@ -83,7 +83,7 @@ define(['require',
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(':');
this.ui.auditHeaderValue.html('<th>Tag</th>');
this.ui.auditValue.html("<tr><td>" + appendedString[1] + "</td></tr>");
......
......@@ -66,7 +66,7 @@ define(['require',
return events;
},
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) {
this.tabClass = "tab col-sm-4";
} else {
......@@ -98,7 +98,7 @@ define(['require',
require(['views/tag/TagLayoutView'], function(TagLayoutView) {
that.RTagLayoutView.show(new TagLayoutView({
globalVent: that.globalVent,
searchCollection: that.searchCollection,
collection: that.collection,
tag: that.tag
}));
});
......
......@@ -22,8 +22,9 @@ define(['require',
'utils/Utils',
'collection/VCatalogList',
'utils/CommonViewFunction',
'utils/Messages'
], function(require, Backbone, TreeLayoutView_tmpl, Utils, VCatalogList, CommonViewFunction, Messages) {
'utils/Messages',
'utils/UrlLinks'
], function(require, Backbone, TreeLayoutView_tmpl, Utils, VCatalogList, CommonViewFunction, Messages, UrlLinks) {
'use strict';
var TreeLayoutView = Backbone.Marionette.LayoutView.extend(
......@@ -251,7 +252,7 @@ define(['require',
if (parentURL) {
this.url = parentURL;
} else {
this.url = "api/atlas/v1/taxonomies";
this.url = UrlLinks.taxonomiesApiUrl();
}
}
this.showLoader();
......@@ -308,7 +309,7 @@ define(['require',
var that = this;
_.each(this.taxanomy.models, function(model, key) {
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 });
},
......@@ -388,9 +389,9 @@ define(['require',
if (name.name) {
// data-name="<space>'<tagName>'" Space is required for DSL search Input
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 {
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',
'modules/Modal'
], function(AddTermLayoutView, Modal) {
var view = new AddTermLayoutView({
url: "/api/atlas/v1/taxonomies",
url: UrlLinks.taxonomiesApiUrl(),
model: new that.parentCollection.model(),
defaultTerm:true
});
......
......@@ -19,8 +19,9 @@
define(['require',
'backbone',
'hbs!tmpl/common/aboutAtlas_tmpl',
'models/VCommon'
], function(require, Backbone, aboutAtlasTmpl, VCommon) {
'models/VCommon',
'utils/UrlLinks'
], function(require, Backbone, aboutAtlasTmpl, VCommon, UrlLinks) {
'use strict';
var aboutAtlasView = Backbone.Marionette.LayoutView.extend(
......@@ -48,7 +49,7 @@ define(['require',
},
onRender: function() {
var that = this;
var url = "/api/atlas/admin/version";
var url = UrlLinks.versionApiUrl();
var VCommonModel = new VCommon();
VCommonModel.aboutUs(url, {
success: function(data) {
......
......@@ -24,8 +24,10 @@ define(['require',
'models/VEntity',
'utils/CommonViewFunction',
'utils/Globals',
'utils/Messages'
], function(require, Backbone, DetailPageLayoutViewTmpl, Utils, VTagList, VEntity, CommonViewFunction, Globals, Messages) {
'utils/Enums',
'utils/Messages',
'utils/UrlLinks'
], function(require, Backbone, DetailPageLayoutViewTmpl, Utils, VTagList, VEntity, CommonViewFunction, Globals, Enums, Messages, UrlLinks) {
'use strict';
var DetailPageLayoutView = Backbone.Marionette.LayoutView.extend(
......@@ -73,15 +75,6 @@ define(['require',
/** ui events hash */
events: function() {
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) {
if (e.target.nodeName.toLocaleLowerCase() != "i") {
var scope = $(e.currentTarget);
......@@ -89,7 +82,7 @@ define(['require',
var url = scope.data('href').split(".").join("/terms/");
Globals.saveApplicationState.tabState.stateChanged = false;
Utils.setUrl({
url: '#!/taxonomy/detailCatalog/api/atlas/v1/taxonomies/' + url,
url: '#!/taxonomy/detailCatalog' + UrlLinks.taxonomiesApiUrl() + '/' + url,
mergeBrowserUrl: false,
trigger: true
});
......@@ -124,35 +117,37 @@ define(['require',
var that = this;
this.listenTo(this.collection, 'reset', function() {
var collectionJSON = this.collection.toJSON();
if (collectionJSON[0].id && collectionJSON[0].id.id) {
var tagGuid = collectionJSON[0].id.id;
this.readOnly = Globals.entityStateReadOnly[collectionJSON[0].id.state];
}
if (this.readOnly) {
this.$el.addClass('readOnly');
var collectionJSON = this.collection.first().toJSON();
if (collectionJSON && collectionJSON.guid) {
var tagGuid = collectionJSON.guid;
//this.readOnly = Enums.entityStateReadOnly[collectionJSON[0].id.state];
} else {
this.$el.removeClass('readOnly');
var tagGuid = this.id;
}
if (collectionJSON && collectionJSON.length) {
if (collectionJSON[0].values) {
if (collectionJSON[0].values.name) {
this.name = collectionJSON[0].values.name;
// if (this.readOnly) {
// this.$el.addClass('readOnly');
// } else {
// 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) {
this.name = collectionJSON[0].values.qualifiedName;
if (!this.name && collectionJSON.attributes.qualifiedName) {
this.name = collectionJSON.attributes.qualifiedName;
}
if (this.name && collectionJSON[0].typeName) {
this.name = this.name + ' (' + collectionJSON[0].typeName + ')';
if (this.name && collectionJSON.typeName) {
this.name = this.name + ' (' + collectionJSON.typeName + ')';
}
if (!this.name && collectionJSON[0].typeName) {
this.name = collectionJSON[0].typeName;
if (!this.name && collectionJSON.typeName) {
this.name = collectionJSON.typeName;
}
if (!this.name && this.id) {
this.name = this.id;
}
this.description = collectionJSON[0].values.description;
this.description = collectionJSON.attributes.description;
if (this.name) {
this.ui.title.show();
var titleName = '<span>' + this.name + '</span>';
......@@ -170,22 +165,24 @@ define(['require',
this.ui.description.hide();
}
}
if (collectionJSON[0].traits) {
this.addTagToTerms(collectionJSON[0].traits);
if (collectionJSON.classifications) {
this.addTagToTerms(collectionJSON.classifications);
}else{
this.addTagToTerms([]);
}
}
this.renderEntityDetailTableLayoutView();
this.renderTagTableLayoutView(tagGuid);
this.renderLineageLayoutView(tagGuid);
this.renderSchemaLayoutView(tagGuid);
this.renderAuditTableLayoutView(tagGuid);
this.renderTermTableLayoutView(tagGuid);
}, this);
},
onRender: function() {
var that = this;
this.ui.editBox.hide();
this.renderLineageLayoutView(this.id);
this.renderSchemaLayoutView(this.id);
this.renderAuditTableLayoutView(this.id);
},
fetchCollection: function() {
this.collection.fetch({ reset: true });
......
......@@ -57,12 +57,14 @@ define(['require',
},
entityTableGenerate: function() {
var that = this,
valueObject = this.collectionObject[0].values,
valueSorted = _.sortBy(valueObject.columns, function(val) {
return val.values.position
attributeObject = this.collection.first().toJSON().attributes;
if (attributeObject) {
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);
}
});
......
......@@ -23,8 +23,10 @@ define(['require',
'utils/Utils',
'utils/CommonViewFunction',
'utils/Messages',
'utils/Globals'
], function(require, Backbone, SchemaTableLayoutViewTmpl, VSchemaList, Utils, CommonViewFunction, Messages, Globals) {
'utils/Globals',
'utils/Enums',
'utils/UrlLinks'
], function(require, Backbone, SchemaTableLayoutViewTmpl, VSchemaList, Utils, CommonViewFunction, Messages, Globals, Enums, UrlLinks) {
'use strict';
var SchemaTableLayoutView = Backbone.Marionette.LayoutView.extend(
......@@ -91,7 +93,7 @@ define(['require',
initialize: function(options) {
_.extend(this, _.pick(options, 'globalVent', 'guid', 'vent'));
this.schemaCollection = new VSchemaList([], {});
this.schemaCollection.url = "/api/atlas/lineage/" + this.guid + "/schema";
this.schemaCollection.url = UrlLinks.schemaApiUrl(this.guid);
this.commonTableOptions = {
collection: this.schemaCollection,
includeFilter: false,
......@@ -252,7 +254,7 @@ define(['require',
} else {
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>';
return '<div class="readOnly readOnlyLink">' + nameHtml + '</div>';
} else {
......
......@@ -21,7 +21,8 @@ define(['require',
'hbs!tmpl/search/SearchLayoutView_tmpl',
'collection/VTagList',
'utils/Utils',
], function(require, Backbone, SearchLayoutViewTmpl, VTagList, Utils) {
'utils/UrlLinks'
], function(require, Backbone, SearchLayoutViewTmpl, VTagList, Utils, UrlLinks) {
'use strict';
var SearchLayoutView = Backbone.Marionette.LayoutView.extend(
......@@ -71,6 +72,7 @@ define(['require',
initialize: function(options) {
_.extend(this, _.pick(options, 'globalVent', 'value'));
this.typecollection = new VTagList([], {});
this.typecollection.url = UrlLinks.typesApiUrl();
this.type = "fulltext";
var param = Utils.getUrlState.getQueryParams();
this.query = {
......@@ -104,7 +106,6 @@ define(['require',
this.ui.searchBtn.attr("disabled", "true");
},
fetchCollection: function(value) {
$.extend(this.typecollection.queryParams, { type: 'CLASS' });
this.typecollection.fetch({ reset: true });
},
onRefreshButton: function() {
......@@ -118,10 +119,10 @@ define(['require',
this.ui.typeLov.empty();
var str = '<option></option>';
this.typecollection.fullCollection.comparator = function(model) {
return model.get('tags').toLowerCase();
return model.get('name').toLowerCase();
}
this.typecollection.fullCollection.sort().each(function(model) {
str += '<option>' + model.get("tags") + '</option>';
str += '<option>' + model.get("name") + '</option>';
});
that.ui.typeLov.html(str);
},
......
......@@ -26,8 +26,10 @@ define(['require',
'collection/VSearchList',
'models/VCommon',
'utils/CommonViewFunction',
'utils/Messages'
], function(require, Backbone, SearchResultLayoutViewTmpl, Modal, VEntity, Utils, Globals, VSearchList, VCommon, CommonViewFunction, Messages) {
'utils/Messages',
'utils/Enums',
'utils/UrlLinks'
], function(require, Backbone, SearchResultLayoutViewTmpl, Modal, VEntity, Utils, Globals, VSearchList, VCommon, CommonViewFunction, Messages, Enums, UrlLinks) {
'use strict';
var SearchResultLayoutView = Backbone.Marionette.LayoutView.extend(
......@@ -70,7 +72,7 @@ define(['require',
var url = scope.data('href').split(".").join("/terms/");
Globals.saveApplicationState.tabState.stateChanged = false;
Utils.setUrl({
url: '#!/taxonomy/detailCatalog/api/atlas/v1/taxonomies/' + url,
url: '#!/taxonomy/detailCatalog' + UrlLinks.taxonomiesApiUrl() + '/' + url,
mergeBrowserUrl: false,
trigger: true
});
......@@ -214,12 +216,12 @@ define(['require',
$.extend(this.searchCollection.queryParams, { limit: this.limit });
if (value) {
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 });
this.offset = 0;
}
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() });
}
......@@ -347,19 +349,17 @@ define(['require',
++that.asyncFetchCounter;
model.getEntity(guid, {
success: function(data) {
if (data.definition) {
if (data.definition.id && data.definition.values) {
if (data.attributes) {
if (data.guid && data.attributes) {
var id = "";
if (_.isObject(data.definition.id) && data.definition.id.id) {
id = data.definition.id.id;
} else {
id = data.definition.id;
id = data.guid;
if (that.searchCollection.get(id)) {
that.searchCollection.get(id).set(data.attributes);
that.searchCollection.get(id).set({
'$id$': data.guid,
'$traits$': data.classifications
});
}
that.searchCollection.get(id).set(data.definition.values);
that.searchCollection.get(id).set({
'$id$': data.definition.id,
'$traits$': data.definition.traits
});
}
}
},
......@@ -441,12 +441,12 @@ define(['require',
return "";
}
}
if (model.get('$id$') && model.get('$id$').id) {
nameHtml = '<a href="#!/detailPage/' + model.get('$id$').id + '">' + rawValue + '</a>';
if (model.get('$id$')) {
nameHtml = '<a href="#!/detailPage/' + (model.get('$id$').id || model.get('$id$')) + '">' + rawValue + '</a>';
} else {
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>';
return '<div class="readOnly readOnlyLink">' + nameHtml + '</div>';
} else {
......@@ -476,12 +476,12 @@ define(['require',
return "";
}
}
if (model.get('$id$') && model.get('$id$').id) {
nameHtml = '<a href="#!/detailPage/' + model.get('$id$').id + '">' + rawValue + '</a>';
if (model.get('$id$')) {
nameHtml = '<a href="#!/detailPage/' + (model.get('$id$').id || model.get('$id$')) + '">' + rawValue + '</a>';
} else {
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>';
return '<div class="readOnly readOnlyLink">' + nameHtml + '</div>';
} else {
......@@ -513,7 +513,7 @@ define(['require',
className: 'searchTag',
formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
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>';
} else {
return CommonViewFunction.tagForTable(model);
......@@ -536,7 +536,7 @@ define(['require',
if (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>';
} else {
return returnObject.html;
......
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
......@@ -58,9 +57,9 @@ define(['require',
* @constructs
*/
initialize: function(options) {
_.extend(this, _.pick(options, 'tagCollection', 'tag', 'termCollection', 'descriptionData'));
if (this.tagCollection && this.tagCollection.length > 0 && this.tagCollection.first().get('traitTypes')) {
this.description = this.tagCollection.first().get('traitTypes')[0].typeDescription;
_.extend(this, _.pick(options, 'tagCollection', 'model', 'tag', 'termCollection', 'descriptionData'));
if (this.model) {
this.description = this.model.get('description');
} else if (this.termCollection) {
this.description = this.descriptionData;
} else {
......@@ -80,7 +79,7 @@ define(['require',
that = this;
this.ui.parentTag.empty();
this.tagCollection.fullCollection.each(function(val) {
str += '<option>' + val.get("tags") + '</option>';
str += '<option>' + val.get("name") + '</option>';
});
that.ui.parentTag.html(str);
console.log(platform);
......
......@@ -21,10 +21,11 @@ define(['require',
'hbs!tmpl/tag/TagAttributeDetailLayoutView_tmpl',
'utils/Utils',
'views/tag/AddTagAttributeView',
'collection/VCommonList',
'collection/VTagList',
'models/VTag',
'utils/Messages'
], function(require, Backbone, TagAttributeDetailLayoutViewTmpl, Utils, AddTagAttributeView, VCommonList, VTag, Messages) {
'utils/Messages',
'utils/UrlLinks'
], function(require, Backbone, TagAttributeDetailLayoutViewTmpl, Utils, AddTagAttributeView, VTagList, VTag, Messages, UrlLinks) {
'use strict';
var TagAttributeDetailLayoutView = Backbone.Marionette.LayoutView.extend(
......@@ -63,32 +64,12 @@ define(['require',
* @constructs
*/
initialize: function(options) {
_.extend(this, _.pick(options, 'globalVent', 'tag', 'vent'));
this.tagCollection = new VCommonList();
this.tagCollection.url = "/api/atlas/types/" + this.tag;
this.tagCollection.modelAttrName = "definition";
this.tagCollection.fetch({ reset: true });
this.bindEvents();
_.extend(this, _.pick(options, 'globalVent', 'tag', 'collection'));
},
bindEvents: function() {
this.listenTo(this.tagCollection, 'reset', function() {
var that = this,
attributeData = "";
_.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.listenTo(this.collection, 'reset', function() {
this.model = this.collection.findWhere({ name: this.tag });
this.renderTagDetail();
}, this);
this.listenTo(this.tagCollection, 'error', function(error, response) {
if (response.responseJSON && response.responseJSON.error) {
......@@ -100,24 +81,47 @@ define(['require',
}, this);
},
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.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) {
var that = this,
tagModel = new VTag();
tagModel.set(saveObject).save(null, {
type: "PUT",
var that = this;
this.model.saveTagAttribute(this.model.get('name'), {
data: JSON.stringify(saveObject),
success: function(model, response) {
that.tagCollection.fetch({ reset: true });
that.model.set(model);
that.renderTagDetail();
Utils.notifySuccess({
content: message
});
},
error: function(model, response) {
if (response.responseJSON && response.responseJSON.error) {
that.tagCollection.fetch({ reset: true });
Utils.notifyError({
content: response.responseJSON.error
});
......@@ -141,16 +145,20 @@ define(['require',
}).open();
modal.on('ok', function() {
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,
"dataTypeName": "string",
"multiplicity": "optional",
"isComposite": false,
"isUniquvar e": false,
"isIndexable": true,
"reverseAttributeName": null
"typeName": "string",
"cardinality": "SINGLE",
"isUnique": false,
"indexable": true,
"isOptional":true
});
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.trigger('cancel');
......@@ -163,15 +171,15 @@ define(['require',
this.ui.editBox.hide();
},
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);
} else {
modal.$el.find('button.ok').prop('disabled', false);
}
},
onPublishClick: function(view) {
view.tagCollection.first().get('traitTypes')[0].typeDescription = view.ui.description.val();
this.onSaveButton(this.tagCollection.first().toJSON(), Messages.updateTagDescriptionMessage);
var saveObj = _.extend(this.model.toJSON(), { 'description': view.ui.description.val() });
this.onSaveButton(saveObj, Messages.updateTagDescriptionMessage);
this.ui.description.show();
},
onEditButton: function(e) {
......@@ -181,7 +189,7 @@ define(['require',
'views/tag/CreateTagLayoutView',
'modules/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({
title: 'Edit Tag',
content: view,
......
......@@ -44,7 +44,7 @@ define(['require',
* @constructs
*/
initialize: function(options) {
_.extend(this, _.pick(options, 'globalVent', 'guid', 'tag'));
_.extend(this, _.pick(options, 'globalVent', 'tag', 'collection'));
},
bindEvents: function() {},
onRender: function() {
......@@ -68,7 +68,8 @@ define(['require',
var that = this;
require(['views/tag/TagAttributeDetailLayoutView'], function(TagAttributeDetailLayoutView) {
that.RTagAttributeDetailLayoutView.show(new TagAttributeDetailLayoutView({
tag: that.tag
tag: that.tag,
collection: that.collection
}));
});
},
......
......@@ -61,9 +61,9 @@ define(['require',
*/
initialize: function(options) {
_.extend(this, _.pick(options, 'globalVent', 'collection', 'guid', 'term', 'assetName'));
this.collectionObject = this.collection.toJSON();
this.collectionObject = this.collection.first().toJSON();
this.tagTermCollection = new VTagList();
var tagorterm = _.toArray(this.collectionObject[0].traits),
var tagorterm = _.toArray(this.collectionObject.classifications),
tagTermList = [],
that = this;
_.each(tagorterm, function(object) {
......@@ -130,7 +130,7 @@ define(['require',
sortable: false,
formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
fromRaw: function(rawValue, model) {
var values = model.get('values'),
var values = model.get('attributes'),
tagValue = 'NA';
if (!_.isEmpty(values)) {
var stringArr = [];
......
......@@ -23,8 +23,9 @@ define(['require',
'collection/VEntityList',
'utils/Utils',
'utils/Messages',
'utils/Globals'
], function(require, Backbone, TagLayoutViewTmpl, VTagList, VEntityList, Utils, Messages, Globals) {
'utils/Globals',
'utils/UrlLinks'
], function(require, Backbone, TagLayoutViewTmpl, VTagList, VEntityList, Utils, Messages, Globals, UrlLinks) {
'use strict';
var TagLayoutView = Backbone.Marionette.LayoutView.extend(
......@@ -45,7 +46,6 @@ define(['require',
offLineSearchTag: "[data-id='offlineSearchTag']",
deleteTerm: "[data-id='deleteTerm']",
refreshTag: '[data-id="refreshTag"]'
},
/** ui events hash */
events: function() {
......@@ -62,20 +62,12 @@ define(['require',
* @constructs
*/
initialize: function(options) {
_.extend(this, _.pick(options, 'globalVent', 'tag'));
this.tagCollection = new VTagList();
this.collection = new Backbone.Collection();
this.json = {
"enumTypes": [],
"traitTypes": [],
"structTypes": [],
"classTypes": []
};
_.extend(this, _.pick(options, 'globalVent', 'tag', 'collection'));
},
bindEvents: function() {
var that = this;
this.listenTo(this.tagCollection, "reset", function() {
this.tagsAndTypeGenerator('tagCollection');
this.listenTo(this.collection, "reset", function() {
this.tagsAndTypeGenerator('collection');
}, this);
this.ui.tagsParent.on('click', 'li.parent-node a', function() {
that.setUrl(this.getAttribute("href"));
......@@ -98,8 +90,7 @@ define(['require',
});
},
fetchCollections: function() {
$.extend(this.tagCollection.queryParams, { type: 'TRAIT', notsupertype: 'TaxonomyTerm' });
this.tagCollection.fetch({ reset: true });
this.collection.fetch({ reset: true });
this.ui.offLineSearchTag.val("");
},
manualRender: function(tagName) {
......@@ -152,19 +143,19 @@ define(['require',
tagsAndTypeGenerator: function(collection, searchString) {
var that = this,
str = '';
that.tagCollection.fullCollection.comparator = function(model) {
return model.get('tags').toLowerCase();
that.collection.fullCollection.comparator = function(model) {
return model.get('name').toLowerCase();
};
that.tagCollection.fullCollection.sort().each(function(model) {
that.collection.fullCollection.sort().each(function(model) {
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
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 {
return;
}
} 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);
......@@ -175,7 +166,6 @@ define(['require',
}
},
onClickCreateTag: function(e) {
var that = this;
$(e.currentTarget).blur();
......@@ -183,7 +173,7 @@ define(['require',
'views/tag/CreateTagLayoutView',
'modules/Modal'
], function(CreateTagLayoutView, Modal) {
var view = new CreateTagLayoutView({ 'tagCollection': that.tagCollection });
var view = new CreateTagLayoutView({ 'tagCollection': that.collection });
var modal = new Modal({
title: 'Create a new tag',
content: view,
......@@ -223,22 +213,23 @@ define(['require',
if (ref.ui.parentTag.val() && ref.ui.parentTag.val()) {
superTypes = ref.ui.parentTag.val();
}
this.json.traitTypes[0] = {
attributeDefinitions: this.collection.toJSON(),
typeName: this.name,
typeDescription: this.description,
superTypes: superTypes,
hierarchicalMetaTypeName: "org.apache.atlas.typesystem.types.TraitType"
this.json = {
'name': this.name,
'description': this.description,
"typeVersion": "2",
"version": "2",
'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) {
that.createTag = true;
that.fetchCollections();
that.collection.add(model)
that.setUrl('#!/tag/tagAttribute/' + ref.ui.tagName.val(), true);
Utils.notifySuccess({
content: "Tag " + that.name + Messages.addSuccessMessage
});
that.collection.reset([]);
},
error: function(model, response) {
if (response.responseJSON && response.responseJSON.error) {
......@@ -270,7 +261,7 @@ define(['require',
},
offlineSearchTag: function(e) {
var type = $(e.currentTarget).data('type');
this.tagsAndTypeGenerator('tagCollection', $(e.currentTarget).val());
this.tagsAndTypeGenerator('collection', $(e.currentTarget).val());
},
createTagAction: function() {
var that = this;
......
......@@ -22,8 +22,9 @@ define(['require',
'collection/VCommonList',
'modules/Modal',
'models/VEntity',
'utils/Utils'
], function(require, AddTagModalViewTmpl, VTagList, VCommonList, Modal, VEntity, Utils) {
'utils/Utils',
'utils/UrlLinks'
], function(require, AddTagModalViewTmpl, VTagList, VCommonList, Modal, VEntity, Utils, UrlLinks) {
'use strict';
var AddTagModel = Marionette.LayoutView.extend({
......@@ -47,7 +48,7 @@ define(['require',
var that = this;
_.extend(this, _.pick(options, 'vent', 'modalCollection', 'guid', 'callback', 'multiple', 'showLoader'));
this.collection = new VTagList();
this.commonCollection = new VCommonList();
this.commonCollection = new VTagList();
this.asyncAttrFetchCounter = 0;
this.modal = new Modal({
title: 'Add Tag',
......@@ -74,7 +75,7 @@ define(['require',
var obj = {
tagName: tagName,
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);
}
......@@ -112,12 +113,12 @@ define(['require',
},
tagsCollection: function() {
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>';
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.select2({
......@@ -134,8 +135,7 @@ define(['require',
this.fetchTagSubData(tagname);
},
fetchTagSubData: function(tagname) {
this.commonCollection.url = "/api/atlas/types/" + tagname;
this.commonCollection.modelAttrName = 'definition';
this.commonCollection.url = UrlLinks.typesClassicationApiUrl(tagname);
++this.asyncAttrFetchCounter
this.commonCollection.fetch({ reset: true });
},
......@@ -153,18 +153,28 @@ define(['require',
this.$('.attrLoader').show();
},
subAttributeData: function() {
if (this.commonCollection.models[0] && this.commonCollection.models[0].attributes && this.commonCollection.models[0].attributes.traitTypes[0].attributeDefinitions) {
for (var i = 0; i < this.commonCollection.models[0].attributes.traitTypes[0].attributeDefinitions.length; i++) {
var attribute = this.commonCollection.models[0].attributes.traitTypes[0].attributeDefinitions;
var strAttribute = '<div class="form-group"><label>' + attribute[i].name + '</label>' +
'<input type="text" class="form-control attributeInputVal attrName" data-key="' + attribute[i].name + '" ></input></div>';
this.ui.tagAttribute.append(strAttribute);
var that = this;
if (this.commonCollection.models[0]) {
if (this.commonCollection.models[0].get('attributeDefs')) {
_.each(this.commonCollection.models[0].get('attributeDefs'), function(obj) {
that.ui.tagAttribute.append('<div class="form-group"><label>' + obj.name + '</label>' +
'<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 {
this.showAttributeBox();
}
......@@ -178,11 +188,10 @@ define(['require',
this.entityModel = new VEntity();
var tagName = options.tagName,
tagAttributes = options.tagAttributes,
json = {
"jsonClass": "org.apache.atlas.typesystem.json.InstanceSerialization$_Struct",
json = [{
"typeName": tagName,
"values": tagAttributes
};
"attributes": tagAttributes
}];
this.entityModel.saveEntity(options.guid, {
data: JSON.stringify(json),
success: function(data) {
......
......@@ -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)
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-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)
......
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