Commit f5ffd064 by kevalbhatt

ATLAS-3981: UI: Create Entity button is shown for a user without create entity permission in ranger

parent 8098bc56
...@@ -384,7 +384,7 @@ define([ ...@@ -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))); App.rNContent.show(new SearchDetailLayoutView(_.extend({ 'value': paramObj, 'initialView': true }, options)));
} else { } else {
if (App.rNContent.currentView) { if (App.rNContent.currentView) {
......
...@@ -69,13 +69,14 @@ ...@@ -69,13 +69,14 @@
</div> </div>
<div id="r_searchResultTableLayoutView"> <div id="r_searchResultTableLayoutView">
{{#if isSearchTab}}<h1><b>{{searchType}}</b></h1>{{/if}} {{#if isSearchTab}}<h1><b>{{searchType}}</b></h1>{{/if}}
{{#if entityCreate}}
<div class="entityLink" style="display:none"> <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> <a href="javascript:void(0)" data-id='createEntity'> create new entity </a>
{{/if}}
</p> </p>
</div> </div>
{{/if}}
</div> </div>
<div class="pagination-box searach-result-pagination row" style="display: none"> <div class="pagination-box searach-result-pagination row" style="display: none">
<div class="col-sm-4"> <div class="col-sm-4">
......
...@@ -221,9 +221,11 @@ define(['require', ...@@ -221,9 +221,11 @@ define(['require',
$tree.jstree('activate_node', obj.guid); $tree.jstree('activate_node', obj.guid);
} }
} else { } else {
if (that.glossaryCollection.fullCollection.length) {
setDefaultSelector(); setDefaultSelector();
$tree.jstree('activate_node', that.glossary.selectedItem.guid); $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 }); 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; var url = _.isEmpty(this.glossary.selectedItem) ? '#!/glossary' : '#!/glossary/' + this.glossary.selectedItem.guid;
Utils.setUrl({ Utils.setUrl({
......
...@@ -668,7 +668,7 @@ define(['require', ...@@ -668,7 +668,7 @@ define(['require',
var obj = model.toJSON(), var obj = model.toJSON(),
nameHtml = "", nameHtml = "",
name = Utils.getName(obj); name = Utils.getName(obj);
if (obj.attributes.serviceType === undefined) { if (!obj.attributes || obj.attributes.serviceType === undefined) {
if (Globals.serviceTypeMap[obj.typeName] === undefined && that.entityDefCollection) { if (Globals.serviceTypeMap[obj.typeName] === undefined && that.entityDefCollection) {
var defObj = that.entityDefCollection.fullCollection.find({ name: obj.typeName }); var defObj = that.entityDefCollection.fullCollection.find({ name: obj.typeName });
if (defObj) { if (defObj) {
...@@ -676,7 +676,7 @@ define(['require', ...@@ -676,7 +676,7 @@ define(['require',
} }
} }
} else if (Globals.serviceTypeMap[obj.typeName] === undefined) { } 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]; obj.serviceType = Globals.serviceTypeMap[obj.typeName];
if (obj.guid) { if (obj.guid) {
......
...@@ -16,11 +16,11 @@ ...@@ -16,11 +16,11 @@
--> -->
<div class="f-right clearfix" data-id="resizable" style="transition: width ease 0.2s;padding-bottom: 41px;"> <div class="f-right clearfix" data-id="resizable" style="transition: width ease 0.2s;padding-bottom: 41px;">
<div class="search-container center"> <div class="search-container center">
<div class="create-entity">
{{#if entityCreate}} {{#if entityCreate}}
<div class="create-entity">
<div class="inline"><button style="margin-top: 10px" class="btn btn-action btn-sm" data-id="createNewEntity"><i class="fa fa-plus"></i>&nbsp;Create Entity</button></div> <div class="inline"><button style="margin-top: 10px" class="btn btn-action btn-sm" data-id="createNewEntity"><i class="fa fa-plus"></i>&nbsp;Create Entity</button></div>
{{/if}}
</div> </div>
{{/if}}
<div class="default-global-search row group-box"> <div class="default-global-search row group-box">
<div id="r_globalSearchLayoutView" class="global-search-container col-sm-12"></div> <div id="r_globalSearchLayoutView" class="global-search-container col-sm-12"></div>
</div> </div>
......
...@@ -40,7 +40,9 @@ ...@@ -40,7 +40,9 @@
<div class="pull-right inline-content-fr no-padding-left"> <div class="pull-right inline-content-fr no-padding-left">
{{#if isSearchTab}} {{#if isSearchTab}}
<div class="inline" data-id="colManager"></div> <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>&nbsp;Create Entity</button></div> <div class="inline"><button class="btn btn-action btn-sm" data-id="createEntity"><i class="fa fa-plus"></i>&nbsp;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>&nbsp;Save Filter</button></div> <div class="inline"><button title="Save as custom filter" class="btn btn-action btn-sm" data-id="saveFilter"><i class="fa fa-save"></i>&nbsp;Save Filter</button></div>
{{/if}} {{/if}}
<div class="inline"> <div class="inline">
......
...@@ -680,7 +680,7 @@ define(['require', ...@@ -680,7 +680,7 @@ define(['require',
var obj = model.toJSON(), var obj = model.toJSON(),
nameHtml = "", nameHtml = "",
name = Utils.getName(obj); name = Utils.getName(obj);
if (obj.attributes.serviceType === undefined) { if (!obj.attributes || obj.attributes.serviceType === undefined) {
if (Globals.serviceTypeMap[obj.typeName] === undefined && that.entityDefCollection) { if (Globals.serviceTypeMap[obj.typeName] === undefined && that.entityDefCollection) {
var defObj = that.entityDefCollection.fullCollection.find({ name: obj.typeName }); var defObj = that.entityDefCollection.fullCollection.find({ name: obj.typeName });
if (defObj) { if (defObj) {
...@@ -688,7 +688,7 @@ define(['require', ...@@ -688,7 +688,7 @@ define(['require',
} }
} }
} else if (Globals.serviceTypeMap[obj.typeName] === undefined) { } 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]; obj.serviceType = Globals.serviceTypeMap[obj.typeName];
if (obj.guid) { if (obj.guid) {
......
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