Dashboards & Visualizations
Highlighted

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

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
Highlighted

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

Motivator

What do you mean with "dashboard has focus"?

------------
Hope I was able to help you. If so, an upvote would be appreciated.
0 Karma
Highlighted

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

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
Highlighted

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

SplunkTrust
SplunkTrust

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

0 Karma
Highlighted

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

Motivator

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, an upvote would be appreciated.
0 Karma
Highlighted

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

SplunkTrust
SplunkTrust

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

0 Karma
Highlighted

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

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
Highlighted

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

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

Highlighted

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

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
Highlighted

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

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