Dashboards & Visualizations

Is there an attribute that that identifies if the dashboard has focus

PBerry7538
New Member

Hi I am fairly new to Splunk and for my project I have a collection of 6 dashboards. I am trying to find out if there is an attribute I can set or check that tells me that the dashboard has been clicked on. The reason being if the dashboard has been selected and is being displayed I want that one and only that one to auto refresh. And if I select another dashboard the newly selected one goes auto refresh and the previous one doesn't. I know how to set the auto-refresh attribute,

I hope that makes sense.

0 Karma
1 Solution

kamlesh_vaghela
SplunkTrust
SplunkTrust

@PBerry7538
you can identify a particular dashboard when dashboard loads by using checking dashboard title OR dashboard page.

It would be good if your details are more by providing the exact use case,

View solution in original post

kamlesh_vaghela
SplunkTrust
SplunkTrust

@PBerry7538
you can identify a particular dashboard when dashboard loads by using checking dashboard title OR dashboard page.

It would be good if your details are more by providing the exact use case,

PBerry7538
New Member

@kamlesh_vaghela
Would you be able to give me an example of how to check the dashboard title or dashboard page has loaded? Or where they are found in the splunk docs ?

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@PBerry7538

Below is the sample javascript you can use for getting dashboard title or dashboard page.

require(["jquery", "splunkjs/mvc", "splunkjs/mvc/simplexml/ready!"], function($, mvc) {

    //GET TITLE
    console.log($(".dashboard-header-title").text());

    // SET TITLE
    $(".dashboard-header-title").text("ANY TITLE");

    // GET Page name
    var path = window.location.pathname;
    var page = path.split("/").pop();
    console.log( page );



});
0 Karma

PBerry7538
New Member

@kamlesh_vaghela Thanks very much indeed 😄

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@PBerry7538

If this answer helps you with your question then please accept to close this question. And if let us know if you require further assistance.

Happy Splunking

0 Karma

niketn
Legend

@kamlesh_vaghela this can done in SimpleXML also using global environment token for current page. $env:page$

https://docs.splunk.com/Documentation/Splunk/7.2.5/Viz/tokens#Use_global_tokens_to_access_environmen...

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

kamlesh_vaghela
SplunkTrust
SplunkTrust

@niketnilay Agree. We can use $env:page$ also.

@PBerry7538 Check above provided link for global tokens to access environment information.

0 Karma

diogofgm
SplunkTrust
SplunkTrust

What do you mean with "dashboard has focus"?

------------
Hope I was able to help you. If so, some karma would be appreciated.
0 Karma

PBerry7538
New Member

So i have six individual dashboards that comprise my App. Each one represents an area of the business. So if i click on one of the dashboards that dashboard displays on the screen. that is what i meant by focus ..

0 Karma

diogofgm
SplunkTrust
SplunkTrust

Only the dashboard on the screen will use the auto-refresh. if the dashboard its not open in the browser it won't refresh. Does this makes sense?

------------
Hope I was able to help you. If so, some karma would be appreciated.
0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

The dashboard will only refresh if it is opened in the browser.

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

Let me clear my self.
You have 6 dashboards and you want to auto-refresh it. RIght? In Splunk, you can refresh the whole dashboard OR particular panel. What you want ot do?

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@PBerry7538
You can use javascript, dashboard.js, and check dashboard title OR dashboard page for your purpose.

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...