You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ma...@apache.org on 2017/02/10 09:32:58 UTC
[2/2] incubator-atlas git commit: ATLAS-1545 : UI updates for recent
changes in TypesREST
ATLAS-1545 : UI updates for recent changes in TypesREST
Signed-off-by: Madhan Neethiraj <ma...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/3b4ccb7f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/3b4ccb7f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/3b4ccb7f
Branch: refs/heads/master
Commit: 3b4ccb7f9bb8f0796c9a7bc71857a56ae615b0a2
Parents: 9e7e5f0
Author: kevalbhatt <kb...@apache.org>
Authored: Fri Feb 10 14:12:35 2017 +0530
Committer: Madhan Neethiraj <ma...@apache.org>
Committed: Fri Feb 10 01:22:23 2017 -0800
----------------------------------------------------------------------
dashboardv2/public/js/collection/VEntityList.js | 18 +---------------
dashboardv2/public/js/collection/VTagList.js | 19 ++++-------------
dashboardv2/public/js/main.js | 3 +--
dashboardv2/public/js/models/VTag.js | 2 +-
dashboardv2/public/js/utils/UrlLinks.js | 22 +++++++++++++-------
.../views/tag/TagAttributeDetailLayoutView.js | 17 +++++++++++----
.../js/views/tag/TagDetailTableLayoutView.js | 7 +++++--
.../public/js/views/tag/TagLayoutView.js | 21 ++++++++++++-------
8 files changed, 52 insertions(+), 57 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/3b4ccb7f/dashboardv2/public/js/collection/VEntityList.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/collection/VEntityList.js b/dashboardv2/public/js/collection/VEntityList.js
index e5ee38e..00f490d 100644
--- a/dashboardv2/public/js/collection/VEntityList.js
+++ b/dashboardv2/public/js/collection/VEntityList.js
@@ -32,7 +32,7 @@ define(['require',
initialize: function() {
this.modelName = 'VEntity';
- this.modelAttrName = '';
+ this.modelAttrName = 'entityDefs';
},
parseRecords: function(resp, options) {
try {
@@ -50,22 +50,6 @@ define(['require',
} else {
return resp
}
- // if (this.modelAttrName && this.modelAttrName === "createEntity") {
- // var arr = [];
- // arr.push({
- // attributes: resp.attributes,
- // classifications: resp.classifications,
- // guid: resp.guid,
- // typeName: resp.typeName
- // });
- // return arr;
- // } else {
- // if (resp[this.modelAttrName]) {
- // return resp[this.modelAttrName];
- // } else {
- // return resp
- // }
- // }
} catch (e) {
console.log(e);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/3b4ccb7f/dashboardv2/public/js/collection/VTagList.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/collection/VTagList.js b/dashboardv2/public/js/collection/VTagList.js
index 0aa74df..9304858 100644
--- a/dashboardv2/public/js/collection/VTagList.js
+++ b/dashboardv2/public/js/collection/VTagList.js
@@ -30,28 +30,17 @@ define(['require',
model: VTag,
initialize: function() {
this.modelName = 'VTag';
- this.modelAttrName = 'list';
+ this.modelAttrName = 'classificationDefs';
},
parseRecords: function(resp, options) {
try {
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
- }
-
+ if (resp[this.modelAttrName]) {
+ return resp[this.modelAttrName];
} else {
- var arr = [];
- resp[this.modelAttrName].forEach(function(d) {
- arr.push({
- tags: d
- });
- });
- return arr;
+ return resp
}
} catch (e) {
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/3b4ccb7f/dashboardv2/public/js/main.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/main.js b/dashboardv2/public/js/main.js
index ae5f6af..ded9e1b 100644
--- a/dashboardv2/public/js/main.js
+++ b/dashboardv2/public/js/main.js
@@ -169,8 +169,7 @@ require(['App',
var that = this;
this.asyncFetchCounter = 2;
this.entityDefCollection = new VEntityList();
- that.entityDefCollection.url = UrlLinks.entitiesDefApiUrl()
- that.entityDefCollection.modelAttrName = 'list';
+ that.entityDefCollection.url = UrlLinks.entitiesDefApiUrl();
App.appRouter = new Router({
entityDefCollection: this.entityDefCollection
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/3b4ccb7f/dashboardv2/public/js/models/VTag.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/models/VTag.js b/dashboardv2/public/js/models/VTag.js
index 064c1f0..51b53d1 100644
--- a/dashboardv2/public/js/models/VTag.js
+++ b/dashboardv2/public/js/models/VTag.js
@@ -49,7 +49,7 @@ define(['require',
return this.constructor.nonCrudOperation.call(this, url, 'DELETE', options);
},
saveTagAttribute: function(guid, options) {
- var url = UrlLinks.typesClassicationApiUrl(null, guid);
+ var url = UrlLinks.typesClassicationApiUrl();
options = _.extend({
contentType: 'application/json',
dataType: 'json'
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/3b4ccb7f/dashboardv2/public/js/utils/UrlLinks.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/utils/UrlLinks.js b/dashboardv2/public/js/utils/UrlLinks.js
index a84ce47..911650b 100644
--- a/dashboardv2/public/js/utils/UrlLinks.js
+++ b/dashboardv2/public/js/utils/UrlLinks.js
@@ -22,6 +22,12 @@ define(['require', 'utils/Enums'], function(require, Enums) {
var UrlLinks = {
baseUrl: '/api/atlas',
baseUrlV2: '/api/atlas/v2',
+ typedefsUrl: function() {
+ return {
+ defs: this.baseUrlV2 + '/types/typedefs',
+ def: this.baseUrlV2 + '/types/typedef'
+ };
+ },
taxonomiesApiUrl: function() {
return this.baseUrl + '/v1/taxonomies';
},
@@ -39,11 +45,11 @@ define(['require', 'utils/Enums'], function(require, Enums) {
}
},
entitiesDefApiUrl: function(name) {
- var entitieDefUrl = this.baseUrlV2 + '/types/entitydef';
+ var entitieDefUrl = this.typedefsUrl();
if (name) {
- return entitieDefUrl + '/name/' + name;
+ return entitieDefUrl.def + '/name/' + name + '?type=entity';
} else {
- return entitieDefUrl;
+ return entitieDefUrl.defs + '?type=entity';
}
},
entitiesTraitsApiUrl: function(token) {
@@ -59,17 +65,17 @@ define(['require', 'utils/Enums'], function(require, Enums) {
return this.baseUrl + '/entities/' + guid + '/audit';
},
typesClassicationApiUrl: function(name, guid) {
- var typeUrl = this.baseUrlV2 + '/types/classificationdef'
+ var typeUrl = this.typedefsUrl();
if (name) {
- return typeUrl + '/name/' + name;
+ return typeUrl.def + '/name/' + name + '?type=classification';
} else if (guid) {
- return typeUrl + '/guid/' + guid;
+ return typeUrl.def + '/guid/' + guid + '?type=classification';
} else {
- return typeUrl;
+ return typeUrl.defs + '?type=classification';
}
},
typesApiUrl: function() {
- return this.baseUrlV2 + '/types/typedefs/headers'
+ return this.typedefsUrl().defs + '/headers'
},
lineageApiUrl: function(guid) {
var lineageUrl = this.baseUrlV2 + '/lineage';
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/3b4ccb7f/dashboardv2/public/js/views/tag/TagAttributeDetailLayoutView.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/views/tag/TagAttributeDetailLayoutView.js b/dashboardv2/public/js/views/tag/TagAttributeDetailLayoutView.js
index fb74e2f..0101646 100644
--- a/dashboardv2/public/js/views/tag/TagAttributeDetailLayoutView.js
+++ b/dashboardv2/public/js/views/tag/TagAttributeDetailLayoutView.js
@@ -70,7 +70,7 @@ define(['require',
} else {
this.$('.fontLoader').hide();
Utils.notifyError({
- content: 'Something went wrong'
+ content: 'Tag Not Found'
});
}
}, this);
@@ -106,7 +106,7 @@ define(['require',
if (this.model.get("description")) {
this.ui.description.text(this.model.get("description"));
}
- if (this.model.get("attributeDefs")) {
+ if (attributeDefs) {
if (!_.isArray(attributeDefs)) {
attributeDefs = [attributeDefs];
}
@@ -138,10 +138,19 @@ define(['require',
});
return;
}
+
this.model.saveTagAttribute(this.model.get('guid'), {
- data: JSON.stringify(saveObject),
+ data: JSON.stringify({
+ classificationDefs: [saveObject],
+ entityDefs: [],
+ enumDefs: [],
+ structDefs: []
+
+ }),
success: function(model, response) {
- that.model.set(model);
+ if (model.classificationDefs) {
+ that.model.set(model.classificationDefs[0], { merge: true });
+ }
that.renderTagDetail();
Utils.notifySuccess({
content: message
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/3b4ccb7f/dashboardv2/public/js/views/tag/TagDetailTableLayoutView.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/views/tag/TagDetailTableLayoutView.js b/dashboardv2/public/js/views/tag/TagDetailTableLayoutView.js
index ecdb1ee..4073310 100644
--- a/dashboardv2/public/js/views/tag/TagDetailTableLayoutView.js
+++ b/dashboardv2/public/js/views/tag/TagDetailTableLayoutView.js
@@ -60,7 +60,7 @@ define(['require',
* @constructs
*/
initialize: function(options) {
- _.extend(this, _.pick(options, 'entity', 'guid', 'term', 'entityName'));
+ _.extend(this, _.pick(options, 'entity', 'guid', 'term', 'entityName', 'fetchCollection'));
this.collectionObject = this.entity;
this.tagTermCollection = new VTagList();
var tagorterm = _.toArray(this.collectionObject.classifications),
@@ -204,7 +204,10 @@ define(['require',
'tagOrTerm': (that.term ? "term" : "tag"),
callback: function() {
that.$('.fontLoader').show();
- that.collection.fetch({ reset: true });
+ if (that.fetchCollection) {
+ that.fetchCollection();
+ }
+
}
});
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/3b4ccb7f/dashboardv2/public/js/views/tag/TagLayoutView.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/views/tag/TagLayoutView.js b/dashboardv2/public/js/views/tag/TagLayoutView.js
index 76dccd7..a1e7ca5 100644
--- a/dashboardv2/public/js/views/tag/TagLayoutView.js
+++ b/dashboardv2/public/js/views/tag/TagLayoutView.js
@@ -239,19 +239,24 @@ define(['require',
attributeObj = [];
}
this.json = {
- 'name': this.name,
- 'description': this.description,
- "typeVersion": "2",
- "version": "2",
- 'superTypes': superTypes.length ? superTypes : [],
- "attributeDefs": attributeObj
+ classificationDefs: [{
+ 'name': this.name.trim(),
+ 'description': this.description.trim(),
+ "typeVersion": "2",
+ "version": "2",
+ 'superTypes': superTypes.length ? superTypes : [],
+ "attributeDefs": attributeObj
+ }],
+ entityDefs: [],
+ enumDefs: [],
+ structDefs: []
+
};
new this.collection.model().set(this.json).save(null, {
success: function(model, response) {
that.ui.createTag.removeAttr("disabled");
that.createTag = true;
- that.fetchCollections();
- that.collection.add(model)
+ that.collection.reset(model.get('classificationDefs'));
that.setUrl('#!/tag/tagAttribute/' + ref.ui.tagName.val(), true);
Utils.notifySuccess({
content: "Tag " + that.name + Messages.addSuccessMessage