Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id D8B34200C17 for ; Fri, 10 Feb 2017 10:33:02 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id D759A160B5C; Fri, 10 Feb 2017 09:33:02 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id D1BCD160B5B for ; Fri, 10 Feb 2017 10:33:01 +0100 (CET) Received: (qmail 36420 invoked by uid 500); 10 Feb 2017 09:33:01 -0000 Mailing-List: contact commits-help@atlas.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@atlas.incubator.apache.org Delivered-To: mailing list commits@atlas.incubator.apache.org Received: (qmail 36410 invoked by uid 99); 10 Feb 2017 09:33:01 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Feb 2017 09:33:01 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 858CFC1178 for ; Fri, 10 Feb 2017 09:33:00 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -6.219 X-Spam-Level: X-Spam-Status: No, score=-6.219 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id awx7Siy5Kn99 for ; Fri, 10 Feb 2017 09:32:59 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id 20FC35FAC9 for ; Fri, 10 Feb 2017 09:32:57 +0000 (UTC) Received: (qmail 36355 invoked by uid 99); 10 Feb 2017 09:32:57 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Feb 2017 09:32:57 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 3C556DFCFB; Fri, 10 Feb 2017 09:32:57 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: madhan@apache.org To: commits@atlas.incubator.apache.org Date: Fri, 10 Feb 2017 09:32:58 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [2/2] incubator-atlas git commit: ATLAS-1545 : UI updates for recent changes in TypesREST archived-at: Fri, 10 Feb 2017 09:33:03 -0000 ATLAS-1545 : UI updates for recent changes in TypesREST Signed-off-by: Madhan Neethiraj 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 Authored: Fri Feb 10 14:12:35 2017 +0530 Committer: Madhan Neethiraj 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