This is an automated email from the ASF dual-hosted git repository. kbhatt pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/atlas.git
commit f5ffd06486f6ef3c28236c6c70e74561542d30c1 Author: kevalbhatt <[email protected]> AuthorDate: Tue Oct 6 19:56:49 2020 +0530 ATLAS-3981: UI: Create Entity button is shown for a user without create entity permission in ranger --- dashboardv2/public/js/router/Router.js | 2 +- .../public/js/templates/search/SearchResultLayoutView_tmpl.html | 7 ++++--- dashboardv2/public/js/views/glossary/GlossaryLayoutView.js | 6 ++++-- dashboardv2/public/js/views/search/SearchResultLayoutView.js | 4 ++-- .../public/js/templates/search/SearchDefaultLayoutView_tmpl.html | 4 ++-- .../public/js/templates/search/SearchResultLayoutView_tmpl.html | 2 ++ dashboardv3/public/js/views/search/SearchResultLayoutView.js | 4 ++-- 7 files changed, 17 insertions(+), 12 deletions(-) diff --git a/dashboardv2/public/js/router/Router.js b/dashboardv2/public/js/router/Router.js index 8e3afa0..97635b9 100644 --- a/dashboardv2/public/js/router/Router.js +++ b/dashboardv2/public/js/router/Router.js @@ -384,7 +384,7 @@ define([ } }); - if (Globals.entityCreate && Utils.getUrlState.isSearchTab()) { + if (Utils.getUrlState.isSearchTab()) { App.rNContent.show(new SearchDetailLayoutView(_.extend({ 'value': paramObj, 'initialView': true }, options))); } else { if (App.rNContent.currentView) { diff --git a/dashboardv2/public/js/templates/search/SearchResultLayoutView_tmpl.html b/dashboardv2/public/js/templates/search/SearchResultLayoutView_tmpl.html index fc780d8..9b71d28 100644 --- a/dashboardv2/public/js/templates/search/SearchResultLayoutView_tmpl.html +++ b/dashboardv2/public/js/templates/search/SearchResultLayoutView_tmpl.html @@ -69,13 +69,14 @@ </div> <div id="r_searchResultTableLayoutView"> {{#if isSearchTab}}<h1><b>{{searchType}}</b></h1>{{/if}} - {{#if entityCreate}} <div class="entityLink" style="display:none"> - <p class="entityLink">Search Atlas for existing entities or + <p class="entityLink">Search Atlas for existing entities + {{#if entityCreate}} + or <a href="javascript:void(0)" data-id='createEntity'> create new entity </a> + {{/if}} </p> </div> - {{/if}} </div> <div class="pagination-box searach-result-pagination row" style="display: none"> <div class="col-sm-4"> diff --git a/dashboardv2/public/js/views/glossary/GlossaryLayoutView.js b/dashboardv2/public/js/views/glossary/GlossaryLayoutView.js index 1ed8d76..a5d0e70 100644 --- a/dashboardv2/public/js/views/glossary/GlossaryLayoutView.js +++ b/dashboardv2/public/js/views/glossary/GlossaryLayoutView.js @@ -221,8 +221,10 @@ define(['require', $tree.jstree('activate_node', obj.guid); } } else { - setDefaultSelector(); - $tree.jstree('activate_node', that.glossary.selectedItem.guid); + if (that.glossaryCollection.fullCollection.length) { + setDefaultSelector(); + $tree.jstree('activate_node', that.glossary.selectedItem.guid); + } } this.query[this.viewType] = _.extend(obj, _.pick(this.glossary.selectedItem, 'model', 'guid', 'gType', 'type'), { "viewType": this.viewType, "isNodeNotFoundAtLoad": this.query[this.viewType].isNodeNotFoundAtLoad }); var url = _.isEmpty(this.glossary.selectedItem) ? '#!/glossary' : '#!/glossary/' + this.glossary.selectedItem.guid; diff --git a/dashboardv2/public/js/views/search/SearchResultLayoutView.js b/dashboardv2/public/js/views/search/SearchResultLayoutView.js index 8fb100f..08d8781 100644 --- a/dashboardv2/public/js/views/search/SearchResultLayoutView.js +++ b/dashboardv2/public/js/views/search/SearchResultLayoutView.js @@ -668,7 +668,7 @@ define(['require', var obj = model.toJSON(), nameHtml = "", name = Utils.getName(obj); - if (obj.attributes.serviceType === undefined) { + if (!obj.attributes || obj.attributes.serviceType === undefined) { if (Globals.serviceTypeMap[obj.typeName] === undefined && that.entityDefCollection) { var defObj = that.entityDefCollection.fullCollection.find({ name: obj.typeName }); if (defObj) { @@ -676,7 +676,7 @@ define(['require', } } } else if (Globals.serviceTypeMap[obj.typeName] === undefined) { - Globals.serviceTypeMap[obj.typeName] = obj.attributes.serviceType; + Globals.serviceTypeMap[obj.typeName] = obj.attributes ? obj.attributes.serviceType : null; } obj.serviceType = Globals.serviceTypeMap[obj.typeName]; if (obj.guid) { diff --git a/dashboardv3/public/js/templates/search/SearchDefaultLayoutView_tmpl.html b/dashboardv3/public/js/templates/search/SearchDefaultLayoutView_tmpl.html index 1ce1218..cbac4eb 100644 --- a/dashboardv3/public/js/templates/search/SearchDefaultLayoutView_tmpl.html +++ b/dashboardv3/public/js/templates/search/SearchDefaultLayoutView_tmpl.html @@ -16,11 +16,11 @@ --> <div class="f-right clearfix" data-id="resizable" style="transition: width ease 0.2s;padding-bottom: 41px;"> <div class="search-container center"> + {{#if entityCreate}} <div class="create-entity"> - {{#if entityCreate}} <div class="inline"><button style="margin-top: 10px" class="btn btn-action btn-sm" data-id="createNewEntity"><i class="fa fa-plus"></i> Create Entity</button></div> - {{/if}} </div> + {{/if}} <div class="default-global-search row group-box"> <div id="r_globalSearchLayoutView" class="global-search-container col-sm-12"></div> </div> diff --git a/dashboardv3/public/js/templates/search/SearchResultLayoutView_tmpl.html b/dashboardv3/public/js/templates/search/SearchResultLayoutView_tmpl.html index fc57e37..b16a4d2 100644 --- a/dashboardv3/public/js/templates/search/SearchResultLayoutView_tmpl.html +++ b/dashboardv3/public/js/templates/search/SearchResultLayoutView_tmpl.html @@ -40,7 +40,9 @@ <div class="pull-right inline-content-fr no-padding-left"> {{#if isSearchTab}} <div class="inline" data-id="colManager"></div> + {{#if entityCreate}} <div class="inline"><button class="btn btn-action btn-sm" data-id="createEntity"><i class="fa fa-plus"></i> Create Entity</button></div> + {{/if}} <div class="inline"><button title="Save as custom filter" class="btn btn-action btn-sm" data-id="saveFilter"><i class="fa fa-save"></i> Save Filter</button></div> {{/if}} <div class="inline"> diff --git a/dashboardv3/public/js/views/search/SearchResultLayoutView.js b/dashboardv3/public/js/views/search/SearchResultLayoutView.js index 1a47727..02d63aa 100644 --- a/dashboardv3/public/js/views/search/SearchResultLayoutView.js +++ b/dashboardv3/public/js/views/search/SearchResultLayoutView.js @@ -680,7 +680,7 @@ define(['require', var obj = model.toJSON(), nameHtml = "", name = Utils.getName(obj); - if (obj.attributes.serviceType === undefined) { + if (!obj.attributes || obj.attributes.serviceType === undefined) { if (Globals.serviceTypeMap[obj.typeName] === undefined && that.entityDefCollection) { var defObj = that.entityDefCollection.fullCollection.find({ name: obj.typeName }); if (defObj) { @@ -688,7 +688,7 @@ define(['require', } } } else if (Globals.serviceTypeMap[obj.typeName] === undefined) { - Globals.serviceTypeMap[obj.typeName] = obj.attributes.serviceType; + Globals.serviceTypeMap[obj.typeName] = obj.attributes ? obj.attributes.serviceType : null; } obj.serviceType = Globals.serviceTypeMap[obj.typeName]; if (obj.guid) {
