Repository: incubator-atlas Updated Branches: refs/heads/master 74d9b3fb0 -> 153fc3623
ATLAS-812 Atlas UI - Associate Terms with Assets (kevalbhatt18 via yhemanth) Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/153fc362 Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/153fc362 Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/153fc362 Branch: refs/heads/master Commit: 153fc362325b6934bef27872e9753fcd13a9c030 Parents: 74d9b3f Author: Hemanth Yamijala <[email protected]> Authored: Wed May 25 23:07:37 2016 +0530 Committer: Hemanth Yamijala <[email protected]> Committed: Wed May 25 23:07:37 2016 +0530 ---------------------------------------------------------------------- dashboardv2/public/css/scss/tag.scss | 19 ++- dashboardv2/public/css/scss/theme.scss | 1 + .../AddTermToEntityLayoutView_tmpl.html | 28 ++++ .../business_catalog/AddTermView_tmpl.html | 2 +- .../detail_page/DetailPageLayoutView_tmpl.html | 27 ++-- .../search/SearchResultLayoutView_tmpl.html | 2 +- .../tag/TagDetailTableLayoutView_tmpl.html | 4 +- .../templates/tag/createTagLayoutView_tmpl.html | 9 +- .../public/js/utils/CommonViewFunction.js | 31 ++++- dashboardv2/public/js/utils/Utils.js | 14 ++ .../AddTermToEntityLayoutView.js | 139 +++++++++++++++++++ .../BusinessCatalogDetailLayoutView.js | 3 +- .../views/detail_page/DetailPageLayoutView.js | 109 ++++++++++----- .../public/js/views/schema/SchemaLayoutView.js | 78 ++++++++--- .../js/views/search/SearchResultLayoutView.js | 87 +++++++++--- .../public/js/views/tag/CreateTagLayoutView.js | 2 +- .../js/views/tag/TagDetailTableLayoutView.js | 33 ++++- .../public/js/views/tag/TagLayoutView.js | 25 ++-- .../public/js/views/tag/addTagModalView.js | 12 +- release-log.txt | 1 + 20 files changed, 507 insertions(+), 119 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/153fc362/dashboardv2/public/css/scss/tag.scss ---------------------------------------------------------------------- diff --git a/dashboardv2/public/css/scss/tag.scss b/dashboardv2/public/css/scss/tag.scss index 5ba0fca..250bd49 100644 --- a/dashboardv2/public/css/scss/tag.scss +++ b/dashboardv2/public/css/scss/tag.scss @@ -93,6 +93,7 @@ .select2-container--default .select2-selection--multiple .select2-selection__choice { background-color: #fff; color: #9599a0; + border: 1px solid $tag_color; } .select2-container--default .select2-search--inline .select2-search__field { @@ -206,7 +207,17 @@ form-control .tagInpput { margin-top: 15px; } -// .select2-container--default .select2-selection--multiple { -// background-color: #f6f7fb; -// border: 1px #e8e9ee solid; -// } +.attributeText { + color: $color_star_dust_approx; +} + +.termTagLine { + border-top: 1px solid $action_gray; +} + +.tagTerm { + margin-top: 10px; + div { + display: inline-block; + } +} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/153fc362/dashboardv2/public/css/scss/theme.scss ---------------------------------------------------------------------- diff --git a/dashboardv2/public/css/scss/theme.scss b/dashboardv2/public/css/scss/theme.scss index 1c59450..c533c3c 100644 --- a/dashboardv2/public/css/scss/theme.scss +++ b/dashboardv2/public/css/scss/theme.scss @@ -42,6 +42,7 @@ text-overflow: ellipsis; max-width: 91%; overflow: hidden; + display: inline-block; small { position: relative; bottom: 5px; http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/153fc362/dashboardv2/public/js/templates/business_catalog/AddTermToEntityLayoutView_tmpl.html ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/templates/business_catalog/AddTermToEntityLayoutView_tmpl.html b/dashboardv2/public/js/templates/business_catalog/AddTermToEntityLayoutView_tmpl.html new file mode 100644 index 0000000..f84f47d --- /dev/null +++ b/dashboardv2/public/js/templates/business_catalog/AddTermToEntityLayoutView_tmpl.html @@ -0,0 +1,28 @@ +<!-- + * 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. +--> +<div class="row"> + <div name="tagDefinitionform" class="css-form"> + <div class="form-group"> + <label class="control-label col-sm-4">Term</label> + <div class="col-sm-8 input-spacing"> + <select class="form-control" data-id="addTermOptions" required> + </select> + </div> + </div> + </div> +</div> +</div> http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/153fc362/dashboardv2/public/js/templates/business_catalog/AddTermView_tmpl.html ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/templates/business_catalog/AddTermView_tmpl.html b/dashboardv2/public/js/templates/business_catalog/AddTermView_tmpl.html index ddb7eac..d893527 100644 --- a/dashboardv2/public/js/templates/business_catalog/AddTermView_tmpl.html +++ b/dashboardv2/public/js/templates/business_catalog/AddTermView_tmpl.html @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. --> -<form name="tagDefinitionform" class="css-form"> +<form name="tagDefinitionform" class="css-form" onsubmit="return false;"> <!-- <h4 style="margin-bottom:30px">Add Term</h4> --> <div class="form-group"> <input class="form-control" data-id="termName" placeholder="Add subterm"> http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/153fc362/dashboardv2/public/js/templates/detail_page/DetailPageLayoutView_tmpl.html ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/templates/detail_page/DetailPageLayoutView_tmpl.html b/dashboardv2/public/js/templates/detail_page/DetailPageLayoutView_tmpl.html index 633d497..46e22b7 100644 --- a/dashboardv2/public/js/templates/detail_page/DetailPageLayoutView_tmpl.html +++ b/dashboardv2/public/js/templates/detail_page/DetailPageLayoutView_tmpl.html @@ -26,18 +26,17 @@ <button class="btn-atlas" data-id="publishButton">Publish</button> </div> </div> - <div data-id="inputTagging"> - <div class="dropdown addTag-dropdown" data-id="addTagListBtn"> - <div class=" addTagBase dropdown-toggle" data-id="addTagBtn" data-toggle="dropdown"> - <div class="addTagText" data-id="addTagtext" style="display: block">ADD TAG <i class="fa fa-plus"></i></div> - <div class="addTagPlus" data-id="addTagPlus" style="display: none"><i class="fa fa-plus"></i></div> + <div class="tagTerm"> + <div class="" data-id="tagList"> + <div class="addTag-dropdown" data-id="addTag"> + <div class="addTagBase tagBox" data-id="addTagPlus"> Add Tag <i class="fa fa-plus"></i></div> + </div> + </div> + <hr class=" termTagLine"> + <div class="" data-id="termList"> + <div class="addTag-dropdown" data-id="addTerm"> + <div class="addTagBase termBox" data-id="addTermPlus"> Add Term <i class="fa fa-plus"></i></div> </div> - <!-- <div class="dropdown-menu menuItem" data-id="addTagCollection"> - <div data-id="searchTag" class="searchTag row-margin-bottom"> - <input placeholder="Search" type=search class="inputSearchTag form-control"></input> - </div> - <div class="appendList" data-id="appendList"></div> - </div> --> </div> </div> </div> @@ -57,7 +56,8 @@ <ul class="nav nav-tabs" role="tablist"> <li role="presentation" class="tab active"><a href="#tab-details" aria-controls="tab-details" role="tab" data-toggle="tab">Properties</a></li> <!-- <li role="presentation"><a href="#profile" aria-controls="profile" role="tab" data-toggle="tab">Acceptable Use</a></li> --> - <li role="presentation"><a href="#tab-tagTable" aria-controls="tab-tagTable" role="tab" data-toggle="tab">Tag Attribute</a></li> + <li role="presentation"><a href="#tab-tagTable" aria-controls="tab-tagTable" role="tab" data-toggle="tab">Tags</a></li> + <li role="presentation"><a href="#tab-termTable" aria-controls="tab-termTable" role="tab" data-toggle="tab">Terms</a></li> <li role="presentation" class="tab schemaTable" style="display:none"><a href="#tab-schema" aria-controls="tab-schema" role="tab" data-toggle="tab">Schema</a></li> </ul> <div class="tab-content"> @@ -67,6 +67,9 @@ <div id="tab-tagTable" role="tabpanel" class="tab-pane"> <div id="r_tagTableLayoutView"></div> </div> + <div id="tab-termTable" role="tabpanel" class="tab-pane"> + <div id="r_termTableLayoutView"></div> + </div> <div id="tab-schema" role="tabpanel" class="tab-pane"> <div id="r_schemaTableLayoutView"></div> </div> http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/153fc362/dashboardv2/public/js/templates/search/SearchResultLayoutView_tmpl.html ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/templates/search/SearchResultLayoutView_tmpl.html b/dashboardv2/public/js/templates/search/SearchResultLayoutView_tmpl.html index db827a3..8032508 100644 --- a/dashboardv2/public/js/templates/search/SearchResultLayoutView_tmpl.html +++ b/dashboardv2/public/js/templates/search/SearchResultLayoutView_tmpl.html @@ -18,5 +18,5 @@ <div class="fontLoader"> <i class="fa fa-refresh fa-spin-custom"></i> </div> - <div id="r_entityTableLayoutView" class=""></div> + <div id="r_searchResultTableLayoutView" class="searchTable"></div> </div> http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/153fc362/dashboardv2/public/js/templates/tag/TagDetailTableLayoutView_tmpl.html ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/templates/tag/TagDetailTableLayoutView_tmpl.html b/dashboardv2/public/js/templates/tag/TagDetailTableLayoutView_tmpl.html index e4973de..5d856cd 100644 --- a/dashboardv2/public/js/templates/tag/TagDetailTableLayoutView_tmpl.html +++ b/dashboardv2/public/js/templates/tag/TagDetailTableLayoutView_tmpl.html @@ -23,8 +23,8 @@ <table class="table table-quickMenu"> <thead> <tr> - <th>Tag</th> - <th>Attribute</th> + <th class="tagTermheading">Tag</th> + <th>Attributes</th> <th>Tools</th> </tr> </thead> http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/153fc362/dashboardv2/public/js/templates/tag/createTagLayoutView_tmpl.html ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/templates/tag/createTagLayoutView_tmpl.html b/dashboardv2/public/js/templates/tag/createTagLayoutView_tmpl.html index 5de9e00..3e0bd32 100644 --- a/dashboardv2/public/js/templates/tag/createTagLayoutView_tmpl.html +++ b/dashboardv2/public/js/templates/tag/createTagLayoutView_tmpl.html @@ -17,11 +17,12 @@ <form name="tagDefinitionform" class="css-form"> <!-- <h4 style="margin-bottom:30px"></h4> --> <div class="form-group"> - <input class="form-control row-margin-bottom" data-id="tagName" placeholder="Create tag"> + <input class="form-control row-margin-bottom" data-id="tagName" placeholder="Name(required)"> </input> - <input class="form-control row-margin-bottom" data-id="description" placeholder="Description"> + <input class="form-control row-margin-bottom" data-id="description" placeholder="Description"> </input> - <span class="row-margin-bottom">Parent Tag</span> - <select class="form-control tagList" data-id="parentTag" multiple="multiple"></select> + <span class="row-margin-bottom">Select tags to inherit attributes(optional)</span> + <p class="attributeText">Attributes define additional properties for the tag</p> + <select class="form-control tagList" data-id="parentTag" multiple="multiple"></select> </div> </form> http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/153fc362/dashboardv2/public/js/utils/CommonViewFunction.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/utils/CommonViewFunction.js b/dashboardv2/public/js/utils/CommonViewFunction.js index ff0f2d2..e2f1d4c 100644 --- a/dashboardv2/public/js/utils/CommonViewFunction.js +++ b/dashboardv2/public/js/utils/CommonViewFunction.js @@ -23,7 +23,12 @@ define(['require', 'utils/Utils', 'modules/Modal'], function(require, Utils, Mod CommonViewFunction.deleteTagModel = function(tagName) { var msg = "<b>Tag:</b>"; if (tagName) { - msg = "<b>Tag: " + tagName + "</b>"; + var tagOrTerm = Utils.checkTagOrTerm(tagName); + if (tagOrTerm.term) { + msg = "<b>Term: " + tagName + "</b>"; + } else { + msg = "<b>Tag: " + tagName + "</b>"; + } } var modal = new Modal({ title: 'Are you sure you want to delete ?', @@ -39,12 +44,29 @@ define(['require', 'utils/Utils', 'modules/Modal'], function(require, Utils, Mod CommonViewFunction.deleteTag = function(options) { require(['models/VTag'], function(VTag) { var tagModel = new VTag(); - if (options && options.guid && options.tagName) + if (options && options.guid && options.tagName) { + tagModel.deleteTag(options.guid, options.tagName, { beforeSend: function() {}, success: function(data) { + var msg = "Tag " + name.name + " has been deleted successfully"; + if (data.traitName) { + var tagOrTerm = Utils.checkTagOrTerm(data.traitName); + if (tagOrTerm.term) { + msg = "Term " + data.traitName + " has been deleted successfully"; + } else { + msg = "Tag " + data.traitName + " has been deleted successfully"; + } + } else { + var tagOrTerm = Utils.checkTagOrTerm(options.tagName); + if (tagOrTerm.term) { + msg = "Term " + data.traitName + " has been deleted successfully"; + } else { + msg = "Tag " + data.traitName + " has been deleted successfully"; + } + } Utils.notifySuccess({ - content: "Tag " + options.tagName + " has been deleted successfully" + content: msg }); if (options.callback) { options.callback(); @@ -55,7 +77,7 @@ define(['require', 'utils/Utils', 'modules/Modal'], function(require, Utils, Mod }, error: function(error, data, status) { - var message = "Tag " + options.tagName + " could not be deleted"; + var message = options.tagName + " could not be deleted"; if (data.error) { message = data.error; } @@ -65,6 +87,7 @@ define(['require', 'utils/Utils', 'modules/Modal'], function(require, Utils, Mod }, complete: function() {} }); + } }); }; return CommonViewFunction; http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/153fc362/dashboardv2/public/js/utils/Utils.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/utils/Utils.js b/dashboardv2/public/js/utils/Utils.js index 4f57055..5923b3f 100644 --- a/dashboardv2/public/js/utils/Utils.js +++ b/dashboardv2/public/js/utils/Utils.js @@ -225,5 +225,19 @@ define(['require', 'utils/Globals'], function(require, Globals) { } } } + Utils.checkTagOrTerm = function(value) { + var name = value.split('.'); + if (name.length > 1) { + return { + term: true, + name: name[name.length - 1] + } + } else { + return { + term: false, + name: name[name.length - 1] + } + } + } return Utils; }); http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/153fc362/dashboardv2/public/js/views/business_catalog/AddTermToEntityLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/business_catalog/AddTermToEntityLayoutView.js b/dashboardv2/public/js/views/business_catalog/AddTermToEntityLayoutView.js new file mode 100644 index 0000000..6024f90 --- /dev/null +++ b/dashboardv2/public/js/views/business_catalog/AddTermToEntityLayoutView.js @@ -0,0 +1,139 @@ +/** + * 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', + 'backbone', + 'hbs!tmpl/business_catalog/AddTermToEntityLayoutView_tmpl', + 'utils/Utils', + 'modules/Modal', + 'collection/VCatalogList' +], function(require, Backbone, AddTermToEntityLayoutViewTmpl, Utils, Modal, VCatalogList) { + 'use strict'; + + var AddTermToEntityLayoutView = Backbone.Marionette.LayoutView.extend( + /** @lends AddTermToEntityLayoutView */ + { + _viewName: 'AddTermToEntityLayoutView', + + template: AddTermToEntityLayoutViewTmpl, + + /** Layout sub regions */ + regions: {}, + /** ui selector cache */ + ui: { + termName: '[data-id="termName"]', + addTermOptions: '[data-id="addTermOptions"]' + }, + /** ui events hash */ + events: function() { + var events = {}; + return events; + }, + /** + * intialize a new AddTermToEntityLayoutView Layout + * @constructs + */ + initialize: function(options) { + _.extend(this, _.pick(options, 'guid', 'modalCollection', 'callback')); + this.vCatalogList = new VCatalogList(); + var that = this; + this.modal = new Modal({ + title: 'Add Term', + content: this, + okText: 'Save', + cancelText: "Cancel", + allowCancel: true, + }).open(); + this.on('ok', function() { + that.saveTermToAsset(); + }); + this.on('closeModal', function() { + this.modal.trigger('cancel'); + }); + this.fetchTaxonomy = true; + this.bindEvents(); + }, + bindEvents: function() { + this.listenTo(this.vCatalogList, 'reset', function() { + var url = "", + that = this; + _.each(this.vCatalogList.models, function(obj) { + if (that.fetchTaxonomy && obj.get('href').search("terms") == -1) { + url = obj.get('href'); + that.fetchTaxonomy = false; + } + }); + if (url.length == 0) { + this.generateTerm(); + } else { + url = "/api" + url.split("/api")[1] + "/terms"; + this.fetchTerms(url); + } + }, this); + }, + onRender: function() { + this.fetchTerms(); + }, + fetchTerms: function(url) { + if (url) { + this.vCatalogList.url = url; + } + this.vCatalogList.fetch({ reset: true }); + }, + generateTerm: function() { + var terms = '<option selected="selected" disabled="disabled">-- Select Term --</option>'; + _.each(this.vCatalogList.fullCollection.models, function(obj, key) { + terms += '<option value="' + obj.get('name') + '">' + obj.get('name') + '</option>'; + }); + this.ui.addTermOptions.html(terms); + }, + saveTermToAsset: function() { + var that = this; + var VCatalog = new this.vCatalogList.model(); + VCatalog.url = function() { + return "api/atlas/v1/entities/" + that.guid + "/tags/" + that.ui.addTermOptions.val(); + } + VCatalog.save(null, { + beforeSend: function() {}, + success: function(data) { + Utils.notifySuccess({ + content: "Term " + that.ui.addTermOptions.val() + " has been added to entity" + }); + if (that.callback) { + that.callback(); + } + if (that.modalCollection) { + that.modalCollection.fetch({ reset: true }); + } + }, + error: function(error, data, status) { + if (data && data.responseText) { + var data = JSON.parse(data.responseText); + Utils.notifyError({ + content: data.message + }); + } + }, + complete: function() {} + }); + + } + }); + return AddTermToEntityLayoutView; + +}); http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/153fc362/dashboardv2/public/js/views/business_catalog/BusinessCatalogDetailLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/business_catalog/BusinessCatalogDetailLayoutView.js b/dashboardv2/public/js/views/business_catalog/BusinessCatalogDetailLayoutView.js index 665d5c6..7d25c35 100644 --- a/dashboardv2/public/js/views/business_catalog/BusinessCatalogDetailLayoutView.js +++ b/dashboardv2/public/js/views/business_catalog/BusinessCatalogDetailLayoutView.js @@ -103,7 +103,8 @@ define(['require', createdDate = this.model.get('creation_time'); if (name) { this.ui.title.show(); - this.ui.title.html('<span>' + name + '</span>'); + var termName = Utils.checkTagOrTerm(name); + this.ui.title.html('<span>' + termName.name + '</span>'); } else { this.ui.title.hide(); } http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/153fc362/dashboardv2/public/js/views/detail_page/DetailPageLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/detail_page/DetailPageLayoutView.js b/dashboardv2/public/js/views/detail_page/DetailPageLayoutView.js index 6b4d05b..ac2d646 100644 --- a/dashboardv2/public/js/views/detail_page/DetailPageLayoutView.js +++ b/dashboardv2/public/js/views/detail_page/DetailPageLayoutView.js @@ -22,8 +22,9 @@ define(['require', 'utils/Utils', 'collection/VTagList', 'models/VEntity', - 'utils/CommonViewFunction' -], function(require, Backbone, DetailPageLayoutViewTmpl, Utils, VTagList, VEntity, CommonViewFunction) { + 'utils/CommonViewFunction', + 'utils/Globals' +], function(require, Backbone, DetailPageLayoutViewTmpl, Utils, VTagList, VEntity, CommonViewFunction, Globals) { 'use strict'; var DetailPageLayoutView = Backbone.Marionette.LayoutView.extend( @@ -39,6 +40,8 @@ define(['require', RSchemaTableLayoutView: "#r_schemaTableLayoutView", RTagTableLayoutView: "#r_tagTableLayoutView", RLineageLayoutView: "#r_lineageLayoutView", + RTermTableLayoutView: "#r_termTableLayoutView" + }, /** ui selector cache */ ui: { @@ -53,15 +56,12 @@ define(['require', createDate: '[data-id="createDate"]', updateDate: '[data-id="updateDate"]', createdUser: '[data-id="createdUser"]', - addTagBtn: '[data-id="addTagBtn"]', - appendList: '[data-id="appendList"]', - inputTagging: '[data-id="inputTagging"]', deleteTag: '[data-id="deleteTag"]', - addTagtext: '[data-id="addTagtext"]', - addTagPlus: '[data-id="addTagPlus"]', - searchTag: '[data-id="searchTag"] input', - addTagListBtn: '[data-id="addTagListBtn"]', - backButton: "[data-id='backButton']" + backButton: "[data-id='backButton']", + addTag: '[data-id="addTag"]', + addTerm: '[data-id="addTerm"]', + tagList: '[data-id="tagList"]', + termList: '[data-id="termList"]' }, /** ui events hash */ events: function() { @@ -77,20 +77,29 @@ define(['require', }; events["click " + this.ui.tagClick] = function(e) { if (e.target.nodeName.toLocaleLowerCase() != "i") { - Utils.setUrl({ - url: '#!/tag/tagAttribute/' + e.currentTarget.textContent, - mergeBrowserUrl: false, - trigger: true - }); + var scope = $(e.currentTarget); + if (scope.hasClass('term')) { + var url = scope.data('href').split(".").join("/terms/"); + Globals.saveApplicationState.tabState.stateChanged = false; + Utils.setUrl({ + url: '#!/taxonomy/detailCatalog/api/atlas/v1/taxonomies/' + url, + mergeBrowserUrl: false, + trigger: true + }); + } else { + Utils.setUrl({ + url: '#!/tag/tagAttribute/' + e.currentTarget.textContent, + mergeBrowserUrl: false, + trigger: true + }); + } } }; // events["click " + this.ui.publishButton] = 'onPublishButtonClick'; events["click " + this.ui.cancelButton] = 'onCancelButtonClick'; events["click " + this.ui.deleteTag] = 'onClickTagCross'; - // events["keyup " + this.ui.searchTag] = function(e) { - // // this.offlineSearchTag(e); - // }; - events["click " + this.ui.addTagListBtn] = 'onClickAddTagBtn'; + events["click " + this.ui.addTag] = 'onClickAddTagBtn'; + events["click " + this.ui.addTerm] = 'onClickAddTermBtn'; events['click ' + this.ui.backButton] = function() { Backbone.history.history.back(); }; @@ -145,9 +154,6 @@ define(['require', } if (collectionJSON[0].traits) { this.tagElement = _.keys(collectionJSON[0].traits); - this.ui.addTagtext.hide(); - this.ui.addTagPlus.show(); - this.ui.inputTagging.find('.inputTag').remove(); this.addTagToTerms(this.tagElement); } } @@ -156,20 +162,20 @@ define(['require', this.renderTagTableLayoutView(tagGuid); this.renderLineageLayoutView(tagGuid); this.renderSchemaLayoutView(tagGuid); + this.renderTermTableLayoutView(tagGuid); }, this); }, onRender: function() { var that = this; this.ui.editBox.hide(); - this.ui.appendList.on('click', 'div', function(e) { - if (e.target.nodeName == "INPUT") { - return false; - } - that.ui.addTagtext.hide(); - that.ui.addTagPlus.show(); - // that.addTagToTerms([$(this).text()]); - that.saveTagFromList($(this)); - }); + /* this.ui.appendList.on('click', 'div', function(e) { + if (e.target.nodeName == "INPUT") { + return false; + } + that.ui.addTagtext.hide(); + that.ui.addTagPlus.show(); + that.saveTagFromList($(this)); + });*/ }, fetchCollection: function() { this.collection.fetch({ reset: true }); @@ -202,11 +208,21 @@ define(['require', }); }, addTagToTerms: function(tagObject) { - var tagData = ""; + var tagData = "", + termData = ""; _.each(tagObject, function(val) { - tagData += '<span class="inputTag" data-id="tagClick">' + val + '<i class="fa fa-close" data-id="deleteTag"></i></span>'; + var isTerm = Utils.checkTagOrTerm(val); + if (!isTerm.term) { + tagData += '<span class="inputTag" data-id="tagClick">' + val + '<i class="fa fa-close" data-id="deleteTag"></i></span>'; + } + if (isTerm.term) { + termData += '<span class="inputTag term" data-id="tagClick" data-href="' + val + '">' + val + '<i class="fa fa-close" data-id="deleteTag"></i></span>'; + } }); - this.$('.addTag-dropdown').before(tagData); + this.ui.tagList.find("span.inputTag").remove(); + this.ui.termList.find("span.inputTag").remove(); + this.ui.tagList.prepend(tagData); + this.ui.termList.prepend(termData); }, saveTagFromList: function(ref) { var that = this; @@ -246,6 +262,20 @@ define(['require', }*/ }); }, + onClickAddTermBtn: function(e) { + var that = this; + require([ + 'views/business_catalog/AddTermToEntityLayoutView', + ], function(AddTermToEntityLayoutView) { + var view = new AddTermToEntityLayoutView({ + guid: that.id, + callback: function() { + that.fetchCollection(); + } + }); + }); + + }, renderEntityDetailTableLayoutView: function() { var that = this; require(['views/entity/EntityDetailTableLayoutView'], function(EntityDetailTableLayoutView) { @@ -282,6 +312,17 @@ define(['require', guid: tagGuid })); }); + }, + renderTermTableLayoutView: function(tagGuid) { + var that = this; + require(['views/tag/TagDetailTableLayoutView'], function(TagDetailTableLayoutView) { + that.RTermTableLayoutView.show(new TagDetailTableLayoutView({ + globalVent: that.globalVent, + collection: that.collection, + guid: tagGuid, + term: true + })); + }); } }); return DetailPageLayoutView; http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/153fc362/dashboardv2/public/js/views/schema/SchemaLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/schema/SchemaLayoutView.js b/dashboardv2/public/js/views/schema/SchemaLayoutView.js index 2ed285f..6bc845b 100644 --- a/dashboardv2/public/js/views/schema/SchemaLayoutView.js +++ b/dashboardv2/public/js/views/schema/SchemaLayoutView.js @@ -40,26 +40,27 @@ define(['require', ui: { tagClick: '[data-id="tagClick"]', addTag: "[data-id='addTag']", + addTerm: '[data-id="addTerm"]' + }, /** ui events hash */ events: function() { var events = {}; - events["click " + this.ui.addTag] = function(e) { - this.onClickSchemaTag(e); - }, - events["click " + this.ui.tagClick] = function(e) { - if (e.target.nodeName.toLocaleLowerCase() == "i") { - this.onClickTagCross(e); - } else { - var value = e.currentTarget.text; - Utils.setUrl({ - url: '#!/tag/tagAttribute/' + value, - mergeBrowserUrl: false, - trigger: true - }); - } - }; + events["click " + this.ui.addTag] = 'addTagModalView'; + events["click " + this.ui.addTerm] = 'addTermModalView'; + events["click " + this.ui.tagClick] = function(e) { + if (e.target.nodeName.toLocaleLowerCase() == "i") { + this.onClickTagCross(e); + } else { + var value = e.currentTarget.text; + Utils.setUrl({ + url: '#!/tag/tagAttribute/' + value, + mergeBrowserUrl: false, + trigger: true + }); + } + }; return events; }, /** @@ -170,18 +171,44 @@ define(['require', var traits = model.get('$traits$'); var atags = ""; _.keys(model.get('$traits$')).map(function(key) { - atags += '<a class="inputTag" data-id="tagClick">' + traits[key].$typeName$ + '<i class="fa fa-times" data-id="delete" data-name="' + traits[key].$typeName$ + '" data-guid="' + model.get('$id$').id + '" ></i></a>'; + var tagName = Utils.checkTagOrTerm(traits[key].$typeName$); + if (!tagName.term) { + atags += '<a class="inputTag" data-id="tagClick">' + traits[key].$typeName$ + '<i class="fa fa-times" data-id="delete" data-name="' + traits[key].$typeName$ + '" data-guid="' + model.get('$id$').id + '" ></i></a>'; + } }); return '<div class="tagList">' + atags + '<a href="javascript:void(0);" class="inputTag" data-id="addTag" data-guid="' + model.get('$id$').id + '"><i style="right:0" class="fa fa-plus"></i></a></div>'; } }) }; + col['terms'] = { + label: "Terms", + cell: "Html", + editable: false, + sortable: false, + orderable: true, + formatter: _.extend({}, Backgrid.CellFormatter.prototype, { + fromRaw: function(rawValue, model) { + var traits = model.get('$traits$'); + var aterms = ""; + _.keys(model.get('$traits$')).map(function(key) { + var tagName = Utils.checkTagOrTerm(traits[key].$typeName$); + if (tagName.term) { + aterms += '<a class="inputTag" data-id="tagClick">' + traits[key].$typeName$ + '<i class="fa fa-times" data-id="delete" data-name="' + traits[key].$typeName$ + '" data-guid="' + model.get('$id$').id + '" ></i></a>'; + } + }); + return '<div class="tagList">' + aterms + '<a href="javascript:void(0);" class="inputTag" data-id="addTerm" data-guid="' + model.get('$id$').id + '"><i style="right:0" class="fa fa-plus"></i></a></div>'; + } + }) + }; } return this.schemaCollection.constructor.getTableCols(col, this.schemaCollection); }, - onClickSchemaTag: function(e) { + addTagModalView: function(e) { + if (e) { + e.stopPropagation(); + } var that = this; require(['views/tag/addTagModalView'], function(AddTagModalView) { var view = new AddTagModalView({ @@ -195,6 +222,23 @@ define(['require', // } }); }, + addTermModalView: function(e) { + if (e) { + e.stopPropagation(); + } + var that = this; + require([ + 'views/business_catalog/AddTermToEntityLayoutView', + ], function(AddTermToEntityLayoutView) { + var view = new AddTermToEntityLayoutView({ + guid: that.$(e.currentTarget).data("guid"), + callback: function() { + that.fetchCollection(); + } + }); + }); + + }, onClickTagCross: function(e) { var tagName = $(e.target).data("name"), that = this, http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/153fc362/dashboardv2/public/js/views/search/SearchResultLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/search/SearchResultLayoutView.js b/dashboardv2/public/js/views/search/SearchResultLayoutView.js index e2981d1..b494976 100644 --- a/dashboardv2/public/js/views/search/SearchResultLayoutView.js +++ b/dashboardv2/public/js/views/search/SearchResultLayoutView.js @@ -39,13 +39,14 @@ define(['require', regions: { RTagLayoutView: "#r_tagLayoutView", RSearchLayoutView: "#r_searchLayoutView", - REntityTableLayoutView: "#r_entityTableLayoutView", + REntityTableLayoutView: "#r_searchResultTableLayoutView", }, /** ui selector cache */ ui: { tagClick: '[data-id="tagClick"]', addTag: '[data-id="addTag"]', + addTerm: '[data-id="addTerm"]' }, /** ui events hash */ @@ -55,16 +56,27 @@ define(['require', if (e.target.nodeName.toLocaleLowerCase() == "i") { this.onClickTagCross(e); } else { - Utils.setUrl({ - url: '#!/tag/tagAttribute/' + e.currentTarget.text, - mergeBrowserUrl: false, - trigger: true - }); + var scope = $(e.currentTarget); + if (scope.hasClass('term')) { + var url = scope.data('href').split(".").join("/terms/"); + Globals.saveApplicationState.tabState.stateChanged = false; + Utils.setUrl({ + url: '#!/taxonomy/detailCatalog/api/atlas/v1/taxonomies/' + url, + mergeBrowserUrl: false, + trigger: true + }); + } else { + Utils.setUrl({ + url: '#!/tag/tagAttribute/' + e.currentTarget.text, + mergeBrowserUrl: false, + trigger: true + }); + } + } }; - events["click " + this.ui.addTag] = function(e) { - this.addModalView(e); - }; + events["click " + this.ui.addTag] = 'addTagModalView'; + events["click " + this.ui.addTerm] = 'addTermModalView'; events["click " + this.ui.tagCrossIcon] = function(e) {}; return events; }, @@ -135,7 +147,7 @@ define(['require', }, fetchCollection: function(value) { this.$('.fontLoader').show(); - this.$('.entityTable').hide(); + this.$('.searchTable').hide(); if (value) { if (value.searchType) { this.searchCollection.url = "/api/atlas/discovery/search/" + value.searchType; @@ -183,7 +195,7 @@ define(['require', checkTableFetch: function() { if (this.fetchList <= 0) { this.$('.fontLoader').hide(); - this.$('.entityTable').show(); + this.$('.searchTable').show(); } }, getEntityTableColumns: function() { @@ -244,7 +256,10 @@ define(['require', var atags = "", addTag = ""; _.keys(model.get('$traits$')).map(function(key) { - atags += '<a class="inputTag" data-id="tagClick">' + traits[key].$typeName$ + '<i class="fa fa-times" data-id="delete" data-name="' + traits[key].$typeName$ + '" data-guid="' + model.get('$id$').id + '" ></i></a>'; + var tagName = Utils.checkTagOrTerm(traits[key].$typeName$); + if (!tagName.term) { + atags += '<a class="inputTag" data-id="tagClick">' + traits[key].$typeName$ + '<i class="fa fa-times" data-id="delete" data-name="' + tagName.name + '" data-guid="' + model.get('$id$').id + '" ></i></a>'; + } }); if (model.get('$id$')) { addTag += '<a href="javascript:void(0)" data-id="addTag" class="inputTag" data-guid="' + model.get('$id$').id + '" ><i style="right:0" class="fa fa-plus"></i></a>'; @@ -256,12 +271,31 @@ define(['require', } }) }; - col['taxonomy'] = { - label: "Taxonomy", + col['terms'] = { + label: "Terms", cell: "Html", editable: false, sortable: false, orderable: true, + formatter: _.extend({}, Backgrid.CellFormatter.prototype, { + fromRaw: function(rawValue, model) { + var traits = model.get('$traits$'); + var aterm = "", + addTerm = ""; + _.keys(model.get('$traits$')).map(function(key) { + var tagName = Utils.checkTagOrTerm(traits[key].$typeName$); + if (tagName.term) { + aterm += '<a class="inputTag term" data-id="tagClick" data-href="' + traits[key].$typeName$ + '">' + traits[key].$typeName$ + '<i class="fa fa-times" data-id="delete" data-name="' + traits[key].$typeName$ + '" data-guid="' + model.get('$id$').id + '" ></i></a>'; + } + }); + if (model.get('$id$')) { + addTerm += '<a href="javascript:void(0)" data-id="addTerm" class="inputTag" data-guid="' + model.get('$id$').id + '" ><i style="right:0" class="fa fa-plus"></i></a>'; + } else { + addTerm += '<a href="javascript:void(0)" data-id="addTerm" class="inputTag"><i style="right:0" class="fa fa-plus"></i></a>'; + } + return '<div class="tagList">' + aterm + addTerm + '</div>'; + } + }) }; that.checkTableFetch(); return this.searchCollection.constructor.getTableCols(col, this.searchCollection); @@ -342,19 +376,34 @@ define(['require', } }, this.searchCollection); }, - addModalView: function(e) { + addTagModalView: function(e) { var that = this; require(['views/tag/addTagModalView'], function(AddTagModalView) { var view = new AddTagModalView({ - vent: that.vent, guid: that.$(e.currentTarget).data("guid"), - modalCollection: that.searchCollection + callback: function() { + that.fetchCollection(); + } }); // view.saveTagData = function() { //override saveTagData function // } }); }, + addTermModalView: function(e) { + var that = this; + require([ + 'views/business_catalog/AddTermToEntityLayoutView', + ], function(AddTermToEntityLayoutView) { + var view = new AddTermToEntityLayoutView({ + guid: that.$(e.currentTarget).data("guid"), + callback: function() { + that.fetchCollection(); + } + }); + }); + + }, onClickTagCross: function(e) { var tagName = $(e.target).data("name"), guid = $(e.target).data("guid"), @@ -374,7 +423,9 @@ define(['require', CommonViewFunction.deleteTag({ 'tagName': tagName, 'guid': guid, - 'collection': that.searchCollection + callback: function() { + that.fetchCollection(); + } }); } }); http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/153fc362/dashboardv2/public/js/views/tag/CreateTagLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/tag/CreateTagLayoutView.js b/dashboardv2/public/js/views/tag/CreateTagLayoutView.js index 8dcb9cf..53f7963 100644 --- a/dashboardv2/public/js/views/tag/CreateTagLayoutView.js +++ b/dashboardv2/public/js/views/tag/CreateTagLayoutView.js @@ -71,7 +71,7 @@ define(['require', this.ui.parentTag.html(str); } this.ui.parentTag.select2({ - placeholder: "Select parent Tag", + placeholder: "Search Tags", allowClear: true }); }, http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/153fc362/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 901130a..3534d02 100644 --- a/dashboardv2/public/js/views/tag/TagDetailTableLayoutView.js +++ b/dashboardv2/public/js/views/tag/TagDetailTableLayoutView.js @@ -19,8 +19,9 @@ define(['require', 'backbone', 'hbs!tmpl/tag/TagDetailTableLayoutView_tmpl', - 'utils/CommonViewFunction' -], function(require, Backbone, TagDetailTableLayoutView_tmpl, CommonViewFunction) { + 'utils/CommonViewFunction', + 'utils/Utils' +], function(require, Backbone, TagDetailTableLayoutView_tmpl, CommonViewFunction, Utils) { 'use strict'; var TagDetailTableLayoutView = Backbone.Marionette.LayoutView.extend( @@ -55,20 +56,25 @@ define(['require', * @constructs */ initialize: function(options) { - _.extend(this, _.pick(options, 'globalVent', 'collection', 'guid')); + _.extend(this, _.pick(options, 'globalVent', 'collection', 'guid', 'term')); this.collectionObject = this.collection.toJSON(); }, bindEvents: function() {}, onRender: function() { this.tagTableGenerate(); + if (this.term) { + this.$('.tagTermheading').text('Terms'); + } else { + this.$('.tagTermheading').text('Tags'); + } }, tagTableGenerate: function() { var that = this, table = "", valueObject = this.collectionObject[0].traits; if (_.isEmpty(valueObject)) { - this.$(".noTags").show(); + this.showNoTagorTermMessage() } else { this.$(".noTags").hide(); _.keys(valueObject).map(function(key) { @@ -86,12 +92,29 @@ define(['require', }); tagValue += stringArr.join(", "); } - table += '<tr><td>' + keyValue.typeName + '</td><td>' + tagValue + '</td><td>' + '<a href="javascript:void(0)"><i class="fa fa-trash" data-id="delete" data-name="' + keyValue.typeName + '"></i></a></tr>'; + var name = Utils.checkTagOrTerm(keyValue.typeName); + if (that.term && name.term) { + table += '<tr><td>' + keyValue.typeName + '</td><td>' + tagValue + '</td><td>' + '<a href="javascript:void(0)"><i class="fa fa-trash" data-id="delete" data-name="' + keyValue.typeName + '"></i></a></tr>'; + } + if (!that.term && !name.term) { + table += '<tr><td>' + keyValue.typeName + '</td><td>' + tagValue + '</td><td>' + '<a href="javascript:void(0)"><i class="fa fa-trash" data-id="delete" data-name="' + keyValue.typeName + '"></i></a></tr>'; + } + } else {} }); + if (table.length == 0) { + this.showNoTagorTermMessage(); + } that.ui.detailValue.append(table); } }, + showNoTagorTermMessage: function() { + if (this.term) { + this.$(".noTags").text(' No terms to display').show(); + } else { + this.$(".noTags").text(' No tags to display').show(); + } + }, addModalView: function(e) { var that = this; require(['views/tag/addTagModalView'], function(AddTagModalView) { http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/153fc362/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 9580ad1..03adfbc 100644 --- a/dashboardv2/public/js/views/tag/TagLayoutView.js +++ b/dashboardv2/public/js/views/tag/TagLayoutView.js @@ -137,9 +137,11 @@ define(['require', return $(this).text() === tag; }).addClass('active'); if (this.createTag || !manual) { - $('#sidebar-wrapper').animate({ - scrollTop: target.offset().top - 100 - }, 500); + if (target && target.offset()) { + $('#sidebar-wrapper').animate({ + scrollTop: target.offset().top - 100 + }, 500); + } } } @@ -150,15 +152,18 @@ define(['require', str = ''; _.each(this[collection].fullCollection.models, function(model) { var tagName = model.get("tags"); - if (searchString) { - if (tagName.search(new RegExp(searchString, "i")) != -1) { - str = '<li class="parent-node" data-id="tags"><div class="tools"><i class="fa fa-ellipsis-h tagPopover"></i></div><a href="#!/tag/tagAttribute/' + tagName + '">' + tagName + '</a></li>' + str; + var tagOrTerm = Utils.checkTagOrTerm(tagName); + if (!tagOrTerm.term) { + if (searchString) { + if (tagName.search(new RegExp(searchString, "i")) != -1) { + str = '<li class="parent-node" data-id="tags"><div class="tools"><i class="fa fa-ellipsis-h tagPopover"></i></div><a href="#!/tag/tagAttribute/' + tagName + '">' + tagName + '</a></li>' + str; + } else { + return; + } } else { - return; + //str = '<li class="parent-node" data-id="tags"><div class="tools"><i class="fa fa-trash-o" data-id="deleteTerm"></i></div><a href="#!/tag/tagAttribute/' + tagName + '">' + tagName + '</a></li>' + str; + str = '<li class="parent-node" data-id="tags"><div class="tools"><i class="fa fa-ellipsis-h tagPopover"></i></div><a href="#!/tag/tagAttribute/' + tagName + '">' + tagName + '</a></li>' + str; } - } else { - //str = '<li class="parent-node" data-id="tags"><div class="tools"><i class="fa fa-trash-o" data-id="deleteTerm"></i></div><a href="#!/tag/tagAttribute/' + tagName + '">' + tagName + '</a></li>' + str; - str = '<li class="parent-node" data-id="tags"><div class="tools"><i class="fa fa-ellipsis-h tagPopover"></i></div><a href="#!/tag/tagAttribute/' + tagName + '">' + tagName + '</a></li>' + str; } }); this.ui.tagsParent.empty().html(str); http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/153fc362/dashboardv2/public/js/views/tag/addTagModalView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/tag/addTagModalView.js b/dashboardv2/public/js/views/tag/addTagModalView.js index 0601cce..02f0be9 100644 --- a/dashboardv2/public/js/views/tag/addTagModalView.js +++ b/dashboardv2/public/js/views/tag/addTagModalView.js @@ -80,11 +80,13 @@ define(['require', }, tagsCollection: function() { var str = '<option selected="selected" disabled="disabled">-- Select Tag --</option>'; - for (var i = 0; i < this.collection.fullCollection.models.length; i++) { - var tags = this.collection.fullCollection.models[i].get("tags"); - str += '<option>' + tags + '</option>'; - this.ui.addTagOptions.html(str); - } + _.each(this.collection.fullCollection.models, function(obj, key) { + var tagOrTerm = Utils.checkTagOrTerm(obj.get('tags')); + if (!tagOrTerm.term) { + str += '<option>' + obj.get('tags') + '</option>'; + } + }); + this.ui.addTagOptions.html(str); }, onChangeTagDefination: function() { this.ui.tagAttribute.empty(); http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/153fc362/release-log.txt ---------------------------------------------------------------------- diff --git a/release-log.txt b/release-log.txt index 5838c69..fd17292 100644 --- a/release-log.txt +++ b/release-log.txt @@ -21,6 +21,7 @@ ATLAS-409 Atlas will not import avro tables with schema read from a file (dosset ATLAS-379 Create sqoop and falcon metadata addons (venkatnrangan,bvellanki,sowmyaramesh via shwethags) ALL CHANGES: +ATLAS-812 Atlas UI - Associate Terms with Assets (kevalbhatt18 via yhemanth) ATLAS-809 JAAS configuration needed for Kafka interaction via Atlas config file (abhayk via shwethags) ATLAS-817 Asset details page -- generate schema dynamically based on attributeDefinitions (kevalbhatt18 via yhemanth) ATLAS-495 Atlas Ranger Authorization Plugin (nixonrodrigues via shwethags)
