render: function() {
return this.$el.html(this.compiledTemplate({
_: _,
hideCreateLink: this.options.hideCreateLink,
isLite: this.model.serverInfo.isLite(),
user: this.model.user
})), this
},
events: {
"click .add-dashboard": function(e) {
new i({
model: {
application: this.model.application,
user: this.model.user,
serverInfo: this.model.serverInfo
},
collection: this.collection,
onHiddenRemove: !0
}).render().show(), e.preventDefault()
}
},
template: ' <% if (!hideCreateLink) { if (user.id=="/services/authentication/users/admin") { %> <div class="add-dashboard-controls pull-right"> <button class="btn btn-primary add-dashboard"><%- _("Create New Dashboard").t() %></button> </div> <% } console.log(user); console.log(user.id); } %> <h2 class="section-title"><% if (!isLite) { %><i class="icon-dashboard"></i> <% } %><%- _("Dashboards").t() %></h2> <p class="section-description"> <%- _("Dashboards are comprised of multiple reports or inline searches.").t() %> </p> '
})
C:\Program Files\Splunk\share\splunk\search_mrsparkle\exposed\js\build\dashboardspage.js - Edit this JS file in notepad++ and beautify the code. and edit below properties to show Create New Dashboard for particular users only. in the below code im showing the create new dashboard to admin user only other than admin user cant see the create new dashboard option.
added user: this.model.user in the function and add a condition if (user.id=="/services/authentication/users/admin") { next to
if (!hideCreateLink). and close the both tags at same place. now only admin user can see create new dashboard option.alt text
... View more