-
-
-
-
-
-
-
How to Implement Drilldowns on Custom Dashboards
This content has been machine translated dynamically.
Dieser Inhalt ist eine maschinelle Übersetzung, die dynamisch erstellt wurde. (Haftungsausschluss)
Cet article a été traduit automatiquement de manière dynamique. (Clause de non responsabilité)
Este artículo lo ha traducido una máquina de forma dinámica. (Aviso legal)
此内容已经过机器动态翻译。 放弃
このコンテンツは動的に機械翻訳されています。免責事項
이 콘텐츠는 동적으로 기계 번역되었습니다. 책임 부인
Este texto foi traduzido automaticamente. (Aviso legal)
Questo contenuto è stato tradotto dinamicamente con traduzione automatica.(Esclusione di responsabilità))
This article has been machine translated.
Dieser Artikel wurde maschinell übersetzt. (Haftungsausschluss)
Ce article a été traduit automatiquement. (Clause de non responsabilité)
Este artículo ha sido traducido automáticamente. (Aviso legal)
この記事は機械翻訳されています.免責事項
이 기사는 기계 번역되었습니다.책임 부인
Este artigo foi traduzido automaticamente.(Aviso legal)
这篇文章已经过机器翻译.放弃
Questo articolo è stato tradotto automaticamente.(Esclusione di responsabilità))
Translation failed!
How to Implement Drilldowns on Custom Dashboards
When you create a custom dashboard, Splunk automatically adds a drilldown to the search page. In many cases, that is not what you want. This article describes an easy way to implement custom drilldowns.
How It Works
- Add a JavaScript file to your dashboard
- Implement click event handlers in JavaScript, in which you set the new URL and optionally pass values to the drilldown page
- Use the passed values in the drilldown page
Let’s explain these steps in more detail.
Add a JavaScript File
To add one or more JavaScript files to your Simple XML dashboard specify the names of the .js
files in the form
tag like this:
JavaScript files reside in the appserver\static
directory of your app.
Click Event Handlers
In your JavaScript file add click event handlers to those dashboard elements (charts, tables, ...) you want to implement a custom drilldown behavior for.
Please note that the dashboard elements need to have unique IDs in Simple XML for this to work, e.g.:
<table id="Table_Panel41"></table>
<!--NeedCopy-->
The JavaScript could look like this:
// RequireJS dependency handling
require (["splunkjs/mvc",
"splunkjs/mvc/simplexml/ready!"], function (mvc)
{
// Set click event handlers
var chart21 = mvc.Components.getInstance ("Chart_Panel21");
chart21.on ("click", drilldown);
var table41 = mvc.Components.getInstance ("Table_Panel41");
table41.on ("click:row", drilldown);
// Define a drilldown function that can be used by multiple click event handlers
function drilldown (event)
{
// Don't do any further event processing
event.preventDefault ();
// Get token values
var earliest = GetToken (mvc, "earliest");
var latest = GetToken (mvc, "latest");
// Build the new URL
var drilldownUrl = "single_machine_detail";
drilldownUrl += "?earliest=" + encodeURIComponent (earliest);
drilldownUrl += "&latest=" + encodeURIComponent (latest);
drilldownUrl += "&FilterHostName=" + encodeURIComponent (event.data["click.value"]);
// Go to the new URL
window.location = drilldownUrl;
}
});
<!--NeedCopy-->
Use the Passed Values on the Drilldown Page
In the example above we are passing the search time range (earliest and latest) to the drilldown page, where it is used automatically.
In addition to time, we pass the variable FilterHostName
. This variable can be used in the Simple XML drilldown page searches by enclosing it in dollar signs, e.g. $FilterHostName$
.
If you want to pass a value to an input field instead, prepend the field token’s name with "form.". Example: your input field on the drilldown page is defined like this:
Specify the field’s value as follows in JavaScript:
drilldownUrl += "&form.FilterField=" + encodeURIComponent ("Some field value");
Examples
The technique described here is used extensively on uberAgent’s dashboards. Poke around our search head app and you will find many real-world examples.
Share
Share
This Preview product documentation is Citrix Confidential.
You agree to hold this documentation confidential pursuant to the terms of your Citrix Beta/Tech Preview Agreement.
The development, release and timing of any features or functionality described in the Preview documentation remains at our sole discretion and are subject to change without notice or consultation.
The documentation is for informational purposes only and is not a commitment, promise or legal obligation to deliver any material, code or functionality and should not be relied upon in making Citrix product purchase decisions.
If you do not agree, select I DO NOT AGREE to exit.