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,6 +38,14 @@ define(['require',
if (!this.modelAttrName) {
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 = [];
resp[this.modelAttrName].forEach(function(d) {
arr.push({
......@@ -44,6 +53,8 @@ define(['require',
});
});
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) {
], 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);
......
......@@ -16,7 +16,7 @@
* limitations under the License.
*/
define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Globals'], function(require, Utils, Modal, Messages, Globals) {
define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enums'], function(require, Utils, Modal, Messages, Enums) {
'use strict';
var CommonViewFunction = {};
......@@ -80,23 +80,23 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Glob
success: function(data) {
var value = "",
deleteButton = "";
if (data.definition.values.name) {
value = data.definition.values.name;
} else if (data.definition.values.qualifiedName) {
value = data.definition.values.qualifiedName;
} else if (data.definition.typeName) {
value = data.definition.typeName;
if (data && data.attributes) {
if (data.attributes.name) {
value = data.attributes.name;
} else if (data.attributes.qualifiedName) {
value = data.attributes.qualifiedName;
} else if (data.typeName) {
value = data.typeName;
}
}
var id = "";
if (data.definition.id) {
if (_.isObject(data.definition.id) && data.definition.id.id) {
id = data.definition.id.id;
if (Globals.entityStateReadOnly[data.definition.id.state]) {
if (data.guid) {
if (Enums.entityStateReadOnly[data.attributes.state]) {
deleteButton += '<button title="Deleted" class="btn btn-atlasAction btn-atlas deleteBtn"><i class="fa fa-trash"></i></button>';
}
} else {
id = data.definition.id;
}
id = data.guid;
}
if (value.length > 1) {
scope.$('td div[data-id="' + id + '"]').html('<a href="#!/detailPage/' + id + '">' + value + '</a>');
......@@ -120,29 +120,21 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Glob
_.keys(valueObject).map(function(key) {
var keyValue = valueObject[key],
valueOfArray = [];
if (_.isArray(keyValue)) {
if (_.isArray(keyValue) || _.isObject(keyValue)) {
if (!_.isArray(keyValue) && _.isObject(keyValue)) {
keyValue = [keyValue];
}
var subLink = "";
for (var i = 0; i < keyValue.length; i++) {
var inputOutputField = keyValue[i],
id = undefined,
id = inputOutputField.guid,
tempLink = "",
readOnly = false;
if (inputOutputField['$id$']) {
inputOutputField.id = inputOutputField['$id$'];
}
if (inputOutputField) {
if (_.isObject(inputOutputField.id)) {
id = inputOutputField.id.id;
if (Globals.entityStateReadOnly[inputOutputField.id.state]) {
readOnly = inputOutputField.id.state
}
} else if (inputOutputField.id) {
id = inputOutputField.id;
} else if (_.isString(inputOutputField) || _.isBoolean(inputOutputField) || _.isNumber(inputOutputField)) {
if (_.isString(inputOutputField) || _.isBoolean(inputOutputField) || _.isNumber(inputOutputField)) {
if (inputOutputField.indexOf("$") == -1) {
valueOfArray.push('<span>' + inputOutputField + '</span>');
}
} else if (_.isObject(inputOutputField)) {
} else if (_.isObject(inputOutputField) && !inputOutputField.attributes && !id) {
_.each(inputOutputField, function(objValue, objKey) {
var value = objValue;
if (objKey.indexOf("$") == -1) {
......@@ -153,14 +145,13 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Glob
}
});
}
}
if (id) {
if (inputOutputField.values) {
if (inputOutputField.values.name) {
tempLink += '<a href="#!/detailPage/' + id + '">' + inputOutputField.values.name + '</a>'
} else if (inputOutputField.values.qualifiedName) {
tempLink += '<a href="#!/detailPage/' + id + '">' + inputOutputField.values.qualifiedName + '</a>'
if (id && inputOutputField) {
if (inputOutputField.attributes) {
if (inputOutputField.attributes.name) {
tempLink += '<a href="#!/detailPage/' + id + '">' + inputOutputField.attributes.name + '</a>'
} else if (inputOutputField.attributes.qualifiedName) {
tempLink += '<a href="#!/detailPage/' + id + '">' + inputOutputField.attributes.qualifiedName + '</a>'
} else if (inputOutputField.typeName) {
tempLink += '<a href="#!/detailPage/' + id + '">' + inputOutputField.typeName + '</a>'
} else {
......@@ -176,6 +167,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Glob
tempLink += '<div data-id="' + id + '"></div>';
}
}
if (readOnly) {
if (!fetch) {
tempLink += '<button title="Deleted" class="btn btn-atlasAction btn-atlas deleteBtn"><i class="fa fa-trash"></i></button>';
......@@ -201,98 +193,6 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Glob
} else {
table += '<tr><td>' + key + '</td><td>' + subLink + '</td></tr>';
}
} else if (_.isObject(keyValue)) {
var id = undefined,
tempLink = "",
readOnly = false;
if (keyValue['$id$']) {
keyValue.id = keyValue['$id$'];
}
if (_.isObject(keyValue.id)) {
id = keyValue.id.id;
if (Globals.entityStateReadOnly[keyValue.id.state]) {
readOnly = keyValue.id.state
}
} else {
id = keyValue.id;
}
if (id) {
if (keyValue.values) {
if (keyValue.values.name) {
tempLink += '<a href="#!/detailPage/' + id + '">' + keyValue.values.name + '</a>';
} else if (keyValue.values.qualifiedName) {
tempLink += '<a href="#!/detailPage/' + id + '">' + keyValue.values.qualifiedName + '</a>'
} else if (keyValue.typeName) {
tempLink += '<a href="#!/detailPage/' + id + '">' + keyValue.typeName + '</a>'
} else {
tempLink += '<a href="#!/detailPage/' + id + '">' + id + '</a>';
}
} else if (keyValue.name) {
tempLink += '<a href="#!/detailPage/' + id + '">' + keyValue.name + '</a>';
} else if (keyValue.qualifiedName) {
tempLink += '<a href="#!/detailPage/' + id + '">' + keyValue.qualifiedName + '</a>'
} else {
var fetch = true;
fetchInputOutputValue(id);
tempLink += '<div data-id="' + id + '"></div>';
}
if (readOnly) {
if (!fetch) {
tempLink += '<button title="Deleted" class="btn btn-atlasAction btn-atlas deleteBtn"><i class="fa fa-trash"></i></button>';
}
if (searchTable) {
if (!fetch) {
table = '<div class="block readOnlyLink">' + tempLink + '</div>';
} else {
table = tempLink;
}
} else {
if (!fetch) {
table += '<tr><td>' + key + '</td><td><div class="block readOnlyLink">' + tempLink + '</div></td></tr>';
} else {
table += '<tr><td>' + key + '</td><td>' + tempLink + '</td></tr>';
}
}
} else {
if (searchTable) {
table = tempLink;
} else {
table += '<tr><td>' + key + '</td><td>' + tempLink + '</td></tr>';
}
}
} else {
var stringArr = [];
_.each(keyValue, function(val, key) {
var value = "";
if (_.isObject(val)) {
value = JSON.stringify(val);
} else {
value = val;
}
var attrName = "<span>" + key + " : " + value + "</span>";
stringArr.push(attrName);
});
var jointValues = stringArr.join(", ");
if (jointValues.length) {
tempLink += '<div>' + jointValues + '</div>';
}
if (readOnly) {
tempLink += '<button title="Deleted" class="btn btn-atlasAction btn-atlas deleteBtn"><i class="fa fa-trash"></i></button>';
if (searchTable) {
table = '<div class="block readOnlyLink">' + tempLink + '</div>';
} else {
table += '<tr><td>' + key + '</td><td><div class="block readOnlyLink">' + tempLink + '</div></td></tr>';
}
} else {
if (searchTable) {
table = tempLink;
} else {
table += '<tr><td>' + key + '</td><td>' + tempLink + '</td></tr>';
}
}
}
} else {
if (key.indexOf("Time") !== -1 || key == "retention") {
if (searchTable) {
......@@ -368,7 +268,6 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Glob
dropdown: function(classes) {
var dropdownClass = 'dropdown';
var dropdownMenuClass = 'dropdown-menu popover popoverTerm bottom arrowPosition';
if (this.options.overflow === 'right') {
dropdownMenuClass += ' dropdown-menu-right';
}
......@@ -386,11 +285,14 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Glob
}
}
CommonViewFunction.termTableBreadcrumbMaker = function(model) {
if (!model) {
return "";
}
var traits = model.get('$traits$'),
url = "",
deleteHtml = "",
html = "",
id = model.get('$id$').id,
id = model.get('$id$').id || model.get('$id$'),
terms = [];
_.keys(traits).map(function(key) {
if (traits[key]) {
......@@ -398,7 +300,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Glob
}
if (tagName.term) {
terms.push({
deleteHtml: '<a class="pull-left" title="Remove Term"><i class="fa fa-trash" data-id="tagClick" data-type="term" data-assetname="' + model.get("name") + '" data-name="' + tagName.fullName + '" data-guid="' + model.get('$id$').id + '" ></i></a>',
deleteHtml: '<a class="pull-left" title="Remove Term"><i class="fa fa-trash" data-id="tagClick" data-type="term" data-assetname="' + model.get("name") + '" data-name="' + tagName.fullName + '" data-guid="' + (model.get('$id$').id || model.get('$id$')) + '" ></i></a>',
url: tagName.fullName.split(".").join("/"),
name: tagName.fullName
});
......@@ -416,7 +318,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Glob
html += '<div><a href="javascript:void(0)" data-id="showMoreLessTerm" class="inputTag inputTagGreen"><span>Show More </span><i class="fa fa-angle-right"></i></a></div>'
}
if (model.get('$id$')) {
html += '<div><a href="javascript:void(0)" class="inputAssignTag" data-id="addTerm" data-guid="' + model.get('$id$').id + '"><i class="fa fa-folder-o"></i>' + " " + 'Assign Term</a></div>'
html += '<div><a href="javascript:void(0)" class="inputAssignTag" data-id="addTerm" data-guid="' + (model.get('$id$').id || model.get('$id$')) + '"><i class="fa fa-folder-o"></i>' + " " + 'Assign Term</a></div>'
} else {
html += '<div><a href="javascript:void(0)" class="inputAssignTag" data-id="addTerm"><i class="fa fa-folder-o"></i>' + " " + 'Assign Term</a></div>'
}
......@@ -439,15 +341,15 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Glob
var className = "inputTag";
if (tagName.tag) {
if (count >= 1) {
popTag += '<a class="' + className + '" data-id="tagClick"><span class="inputValue">' + tagName.fullName + '</span><i class="fa fa-times" data-id="delete" data-assetname="' + model.get("name") + '"data-name="' + tagName.fullName + '" data-type="tag" data-guid="' + model.get('$id$').id + '" ></i></a>';
popTag += '<a class="' + className + '" data-id="tagClick"><span class="inputValue">' + tagName.fullName + '</span><i class="fa fa-times" data-id="delete" data-assetname="' + model.get("name") + '"data-name="' + tagName.fullName + '" data-type="tag" data-guid="' + (model.get('$id$').id || model.get('$id$')) + '" ></i></a>';
} else {
atags += '<a class="' + className + '" data-id="tagClick"><span class="inputValue">' + tagName.fullName + '</span><i class="fa fa-times" data-id="delete" data-assetname="' + model.get("name") + '" data-name="' + tagName.fullName + '" data-type="tag" data-guid="' + model.get('$id$').id + '" ></i></a>';
atags += '<a class="' + className + '" data-id="tagClick"><span class="inputValue">' + tagName.fullName + '</span><i class="fa fa-times" data-id="delete" data-assetname="' + model.get("name") + '" data-name="' + tagName.fullName + '" data-type="tag" data-guid="' + (model.get('$id$').id || model.get('$id$')) + '" ></i></a>';
}
++count;
}
});
if (model.get('$id$')) {
addTag += '<a href="javascript:void(0)" data-id="addTag" class="inputTagAdd assignTag" data-guid="' + model.get('$id$').id + '" ><i class="fa fa-plus"></i></a>';
addTag += '<a href="javascript:void(0)" data-id="addTag" class="inputTagAdd assignTag" data-guid="' + (model.get('$id$').id || model.get('$id$')) + '" ><i class="fa fa-plus"></i></a>';
} else {
addTag += '<a href="javascript:void(0)" data-id="addTag" class="inputTagAdd assignTag"><i style="right:0" class="fa fa-plus"></i></a>';
}
......
/**
* 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);
}
});
......
......@@ -24,9 +24,10 @@ define(['require',
'utils/Utils',
'dagreD3',
'd3-tip',
'utils/Globals',
'utils/Enums',
'utils/UrlLinks',
'jquery-ui'
], function(require, Backbone, LineageLayoutViewtmpl, VLineageList, VEntity, Utils, dagreD3, d3Tip, Globals) {
], function(require, Backbone, LineageLayoutViewtmpl, VLineageList, VEntity, Utils, dagreD3, d3Tip, Enums, UrlLinks) {
'use strict';
var LineageLayoutView = Backbone.Marionette.LayoutView.extend(
......@@ -56,32 +57,11 @@ define(['require',
*/
initialize: function(options) {
_.extend(this, _.pick(options, 'globalVent', 'guid'));
this.inputCollection = new VLineageList();
this.outputCollection = new VLineageList();
this.entityModel = new VEntity();
this.inputCollection.url = "/api/atlas/lineage/" + this.guid + "/inputs/graph";
this.outputCollection.url = "/api/atlas/lineage/" + this.guid + "/outputs/graph";
this.bindEvents();
this.fetchGraphData();
this.data = {};
this.collection = new VLineageList();
this.typeMap = {};
this.asyncFetchCounter = 0;
},
bindEvents: function() {
this.listenTo(this.inputCollection, 'reset', function() {
this.generateData(this.inputCollection, 'input');
this.outputCollection.fetch({ reset: true });
}, this);
this.listenTo(this.outputCollection, 'reset', function() {
this.generateData(this.outputCollection, 'output');
this.outputState = true;
}, this);
this.listenTo(this.outputCollection, 'error', function() {
this.addNoDataMessage();
}, this);
this.listenTo(this.inputCollection, 'error', function() {
this.addNoDataMessage();
}, this);
this.fetchGraphData();
},
onRender: function() {
var that = this;
......@@ -109,179 +89,94 @@ define(['require',
});
},
fetchGraphData: function() {
this.inputCollection.fetch({ reset: true });
var that = this;
this.fromToObj = {};
this.collection.getLineage(this.guid, {
success: function(data) {
if (data.relations.length) {
that.generateData(data.relations, data.guidEntityMap);
} else {
that.noLineage();
}
},
addNoDataMessage: function() {
//this.$('svg').height('100');
this.$('svg').html('<text x="' + (this.$('svg').width() - 150) / 2 + '" y="' + this.$('svg').height() / 2 + '" fill="black">No lineage data found</text>');
error: function(error, data, status) {
that.noLineage();
},
complete: function() {}
})
},
noLineage: function() {
this.$('.fontLoader').hide();
this.$('svg').height('100');
this.$('svg').html('<text x="' + (this.$('svg').width() - 150) / 2 + '" y="' + this.$('svg').height() / 2 + '" fill="black">No lineage data found</text>');
},
generateData: function(collection, type) {
generateData: function(relations, guidEntityMap) {
var that = this;
function addValueInObject(data) {
var obj = {};
if (data && data.definition) {
if (data.definition.values) {
var values = data.definition.values;
obj['label'] = values.name;
obj['toolTiplabel'] = values.name;
if (data.definition.typeName) {
var temp = obj['label'] + ' (' + data.definition.typeName + ')'
obj['label'] = temp;
obj['toolTiplabel'] = temp;
}
obj['label'] = obj['label'].trunc(18);
obj['id'] = data.GUID;
if (values.queryText) {
obj['queryText'] = values.queryText;
}
if (data.definition.id && data.definition.id.state) {
obj['state'] = data.definition.id.state;
}
}
} else {
obj['label'] = ""
obj['toolTiplabel'] = "";
}
obj['shape'] = "img";
obj['class'] = "type-TOP";
if (data.GUID) {
that.g.setNode(data.GUID, obj);
} else {
if (data && data.definition) {
if (_.isString(data.definition.id)) {
that.g.setNode(data.definition.id, obj);
} else if (_.isString(data.definition.id.id)) {
that.g.setNode(data.definition.id.id, obj);
}
function fetchEntity(name) {
++that.asyncFetchCounter;
that.entityModel.getEntityDef(name, {
success: function(data) {
if (that.typeMap[data.name]) {
_.keys(that.fromToObj).map(function(key) {
var obj = that.fromToObj[key];
if (obj.typeName === data.name) {
that.fromToObj[key]['isProcess'] = _.contains(data.superTypes, "Process") ? true : false;
}
});
}
that.typeMap[data.name] = data.superTypes;
},
complete: function() {
--that.asyncFetchCounter;
if (that.asyncFetchCounter === 0) {
if (that.edgesAndvertices) {
that.createGraph(that.edgesAndvertices, that.startingPoint);
} else if (this.outputState && !that.edgesAndvertices) {
that.addNoDataMessage();
if (that.asyncFetchCounter == 0) {
that.createGraph();
}
}
}
function fetchLoadProcess(id) {
++that.asyncFetchCounter;
that.entityModel.getEntity(id, {
success: function(data) {
addValueInObject(data);
},
error: function(error, data, status) {},
complete: function() {}
});
}
function makeNode(c) {
var edges = c.edges,
vertices = c.vertices,
allKeys = [];
_.each(c.edges, function(val, key, obj) {
allKeys.push(key);
_.each(val, function(val1, key1, obj1) {
allKeys.push(val1);
});
});
var uniquNode = _.uniq(allKeys);
_.each(uniquNode, function(val, key) {
function makeNodeObj(relationObj) {
var obj = {};
if (vertices[val] && vertices[val].values) {
obj['label'] = vertices[val].values.name;
obj['toolTiplabel'] = vertices[val].values.name;
if (vertices[val].values.vertexId && vertices[val].values.vertexId.values && vertices[val].values.vertexId.values.typeName) {
var temp = obj['label'] + ' (' + vertices[val].values.vertexId.values.typeName + ')';
obj['label'] = temp;
obj['toolTiplabel'] = temp;
}
obj['label'] = obj['label'].trunc(18);
obj['id'] = val;
obj['class'] = "type-TOP";
obj['shape'] = "img";
obj['typeName'] = vertices[val].values.vertexId.values.typeName;
if (vertices[val].values.state) {
obj['state'] = vertices[val].values.state;
} else if (vertices[val].values.vertexId.values.state) {
obj['state'] = vertices[val].values.vertexId.values.state;
}
if (val && obj) {
that.g.setNode(val, obj);
}
obj['typeName'] = relationObj.typeName
obj['label'] = relationObj.displayText.trunc(18);
obj['toolTiplabel'] = relationObj.displayText;
if (obj.typeName) {
var temp = obj['label'] + ' (' + relationObj.typeName + ')';
obj['toolTiplabel'] = temp
obj['label'] = temp.trunc(18);
}
obj['id'] = relationObj.guid;
if (relationObj.status) {
obj['status'] = relationObj.status;
}
if (that.typeMap && that.typeMap[relationObj.typeName]) {
obj['isProcess'] = _.contains(that.typeMap[relationObj.typeName], "Process") ? true : false;
} else {
fetchLoadProcess(val);
}
});
}
_.each(collection.models, function(values) {
var valuObj = values.get('values');
that.startingPoint = [];
if (!_.isEmpty(valuObj.edges)) {
if (type == "input") {
that.edgesAndvertices = {
edges: {},
vertices: valuObj.vertices
};
_.each(valuObj.edges, function(val, key, obj) {
_.each(val, function(val1, key1, obj1) {
if (!obj[val1]) {
that.startingPoint.push(val1);
that.typeMap[relationObj.typeName] = { fetch: true }
fetchEntity(relationObj.typeName);
}
if (that.edgesAndvertices.edges[val1]) {
that.edgesAndvertices.edges[val1].push(key);
} else {
that.edgesAndvertices.edges[val1] = [key];
return obj;
}
});
});
} else {
that.edgesAndvertices = valuObj;
that.startingPoint = [that.guid];
}
makeNode(that.edgesAndvertices);
} else {
if (type == 'output') {
that.outputState = true;
_.each(relations, function(obj, index) {
if (!that.fromToObj[obj.fromEntityId]) {
that.fromToObj[obj.fromEntityId] = makeNodeObj(guidEntityMap[obj.fromEntityId]);
that.g.setNode(obj.fromEntityId, that.fromToObj[obj.fromEntityId]);
}
if (!that.fromToObj[obj.toEntityId]) {
that.fromToObj[obj.toEntityId] = makeNodeObj(guidEntityMap[obj.toEntityId]);
that.g.setNode(obj.toEntityId, that.fromToObj[obj.toEntityId]);
}
that.g.setEdge(obj.fromEntityId, obj.toEntityId, { 'arrowhead': "arrowPoint", lineInterpolate: 'basis' });
});
if (this.asyncFetchCounter <= 0) {
if (this.edgesAndvertices) {
this.createGraph(that.edgesAndvertices, this.startingPoint);
} else if (this.outputState && !this.edgesAndvertices) {
this.$('.fontLoader').hide();
that.$('svg').height('100');
that.$('svg').html('<text x="' + (that.$('svg').width() - 150) / 2 + '" y="' + that.$('svg').height() / 2 + '" fill="black">No lineage data found</text>');
}
if (this.asyncFetchCounter == 0) {
this.createGraph();
}
},
createGraph: function(edgesAndvertices, startingPoint) {
var that = this,
lastVal = "";
_.each(startingPoint, function(val, key, obj) {
_.each(edgesAndvertices.edges[val], function(val1) {
if (val && val1) {
that.g.setEdge(val, val1, { 'arrowhead': "arrowPoint", lineInterpolate: 'basis' });
}
createRemaningEdge(edgesAndvertices.edges, val1);
});
});
function createRemaningEdge(obj, starting) {
if (obj[starting] && obj[starting].length) {
_.each(obj[starting], function(val, key) {
if (starting && val) {
that.g.setEdge(starting, val, { 'arrowhead': "arrowPoint", lineInterpolate: 'basis' });
}
createRemaningEdge(obj, val);
});
}
}
createGraph: function() {
var that = this
this.g.nodes().forEach(function(v) {
var node = that.g.node(v);
......@@ -290,7 +185,6 @@ define(['require',
node.rx = node.ry = 5;
}
});
if (this.outputState) {
// Create the renderer
var render = new dagreD3.render();
// Add our custom arrow (a hollow-point)
......@@ -319,21 +213,21 @@ define(['require',
.attr("class", "nodeImage")
.attr("xlink:href", function(d) {
if (node) {
if (node.typeName) {
if (Globals.entityStateReadOnly[node.state]) {
return '../img/icon-table-delete.png';
if (node.isProcess) {
if (Enums.entityStateReadOnly[node.status]) {
return '../img/icon-gear-delete.png';
} else if (node.id == that.guid) {
return '../img/icon-table-active.png';
return '../img/icon-gear-active.png';
} else {
return '../img/icon-table.png';
return '../img/icon-gear.png';
}
} else {
if (Globals.entityStateReadOnly[node.state]) {
return '../img/icon-gear-delete.png';
if (Enums.entityStateReadOnly[node.status]) {
return '../img/icon-table-delete.png';
} else if (node.id == that.guid) {
return '../img/icon-gear-active.png';
return '../img/icon-table-active.png';
} else {
return '../img/icon-gear.png';
return '../img/icon-table.png';
}
}
}
......@@ -341,10 +235,6 @@ define(['require',
.attr("y", "-12px")
.attr("width", "24px")
.attr("height", "24px");
/*shapeSvg = parent.insert("circle", ":first-child")
.attr("x", 35)
.attr("y", 35)
.attr("r", 20);*/
node.intersect = function(point) {
//return dagreD3.intersect.circle(node, points, point);
return dagreD3.intersect.circle(node, 13, point);
......@@ -452,7 +342,7 @@ define(['require',
.scale(initialScale)
.event(svg);
//svg.attr('height', this.g.graph().height * initialScale + 40);
}
}
});
return LineageLayoutView;
......
......@@ -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,21 +349,19 @@ 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;
}
that.searchCollection.get(id).set(data.definition.values);
id = data.guid;
if (that.searchCollection.get(id)) {
that.searchCollection.get(id).set(data.attributes);
that.searchCollection.get(id).set({
'$id$': data.definition.id,
'$traits$': data.definition.traits
'$id$': data.guid,
'$traits$': data.classifications
});
}
}
}
},
error: function(error, data, status) {},
complete: function() {
......@@ -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);
}
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);
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].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