Dashboards & Visualizations

Custom HTML App URL Parameter

mfritsch
New Member

Hello,

I like to build a custom app in splunk. This app is using an HTML view. From my HTML view I like to navigate to a dynamic sub view.
How can I access an URL parameter in my sub html view.

URL Example: app//mydynamic_sub_view?param1=helloWorld

Is it possible to get the param1 by using jQuery?

thanks for your help.

Tags (3)
0 Karma

alacercogitatus
SplunkTrust
SplunkTrust

Oh, so in this case, you don't want to load the subview INSIDE the main view, you want to drill down to another view.

In your app/myapp/details, use the form features of SimpleXML.

<form>
   <fieldset>
   <input type="text" token="id">
  </fieldset>
 ....
 </form>

See the complete reference here: http://docs.splunk.com/Documentation/Splunk/latest/Viz/PanelreferenceforSimplifiedXML#form

Then, you can pass items through the URL, just like you would like: app/myapp/details?form.id=49.

0 Karma

alacercogitatus
SplunkTrust
SplunkTrust

You need to explain "Dynamic Sub View". If I am understanding correctly, you will have 2 views defined. You want to load (via iframe perhaps) the sub view with a query passed in from the main view.

Short answer: Yes and No. It all depends on the definition of your sub view.

IMHO, you are already using an HTML view. Leverage the JS on a single view, and dynamically build panels and views withing the master view. Don't try to load a second view, instead build it dynamically within the master view.

0 Karma

mfritsch
New Member

I like to have two views.

1. Overview - URL: app/myapp/overview
...

<ul>
<li><a href="app/myapp/details?id=1">Item1</a></li>
<li><a href="app/myapp/details?id=2">Item2</a></li>
<li><a href="app/myapp/details?id=3">Item3</a></li>
</ul>

</body>
...

2. Details View - URL app/myapp/details?id=2

When I click on a link I like to navigate to the details view. Inside of the details view I like to evaluate the url paramter (id) to load additional data from a REST Service from outside of Splunk.

0 Karma
Get Updates on the Splunk Community!

Pro Tips for First-Time .conf Attendees: Advice from SplunkTrust

Heading to your first .Conf? You’re in for an unforgettable ride — learning, networking, swag collecting, ...

Raise Your Skills at the .conf25 Builder Bar: Your Splunk Developer Destination

Calling all Splunk developers, custom SPL builders, dashboarders, and Splunkbase app creators – the Builder ...

Hunt Smarter, Not Harder: Discover New SPL “Recipes” in Our Threat Hunting Webinar

Are you ready to take your threat hunting skills to the next level? As Splunk community members, you know the ...