Dashboards & Visualizations

How to set dashboard attributes from Javascript?

andrewpagans
Path Finder

Hi Splunkers,
is it possible to set dashboard attributes : hideEdit, hideFooter, hideAppBar from Javascript?
I would like to pilot these attributes based on users/roles.

I tried to use the command below, but I need to set the dashboard where I am, and not to create new Layout.

new LayoutView({"hideFooter": true, "hideSplunkBar": true, "hideAppBar": true, "hideChrome":true})
.render()
.getContainerElement()
.appendChild($('.dashboard-body')[0]);  

Thanks a lot

0 Karma
1 Solution

niketn
Legend

@andrewpagans you can use CSS to hide these elements, which means you can do the same using JavaScript. Refer to one of my previous answers: https://answers.splunk.com/answers/636485/how-can-i-use-a-token-to-set-hidesplunkbar.html

The Layout view is meant for HTML Dashboards not Simple XML JS Extensions. Refer to documentation: http://docs.splunk.com/DocumentationStatic/WebFramework/1.4/compref_layout.html

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

View solution in original post

0 Karma

niketn
Legend

@andrewpagans you can use CSS to hide these elements, which means you can do the same using JavaScript. Refer to one of my previous answers: https://answers.splunk.com/answers/636485/how-can-i-use-a-token-to-set-hidesplunkbar.html

The Layout view is meant for HTML Dashboards not Simple XML JS Extensions. Refer to documentation: http://docs.splunk.com/DocumentationStatic/WebFramework/1.4/compref_layout.html

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma
Get Updates on the Splunk Community!

Cultivate Your Career Growth with Fresh Splunk Training

Growth doesn’t just happen—it’s nurtured. Like tending a garden, developing your Splunk skills takes the right ...

Introducing a Smarter Way to Discover Apps on Splunkbase

We’re excited to announce the launch of a foundational enhancement to Splunkbase: App Tiering.  Because we’ve ...

How to Send Splunk Observability Alerts to Webex teams in Minutes

As a Developer Evangelist at Splunk, my team and I are constantly tinkering with technology to explore its ...