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!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...