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([
}
});
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) {
......
......@@ -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">
......
......@@ -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;
......
......@@ -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) {
......
......@@ -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>&nbsp;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>
......
......@@ -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>&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>
{{/if}}
<div class="inline">
......
......@@ -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) {
......
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