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.
@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
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,
@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 ?
@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 );
});
@kamlesh_vaghela Thanks very much indeed 😄
@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
@kamlesh_vaghela this can done in SimpleXML also using global environment token for current page. $env:page$
@niketnilay Agree. We can use $env:page$
also.
@PBerry7538 Check above provided link for global tokens to access environment information.
What do you mean with "dashboard has focus"?
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 ..
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?
The dashboard will only refresh if it is opened in the browser.
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?
@PBerry7538
You can use javascript, dashboard.js
, and check dashboard title OR dashboard page for your purpose.