All Apps and Add-ons

How to use Redirector with SingleValue

imrago
Contributor

I would like to pass on some parameters to the next dashboard when I click on the SingleValue. I have tried to combine Redirector module from SideView app with SingleValue module, but I got this error :

This view has a Splunk.Module.SingleValue module configured to push changes to downstream modules. This module never has any changes to push so this represents a configuration error.

A sample code:

<module name="Search" layoutPanel="panel_row1_col1" group="Successful" autoRun="True">
    <param name="search">index=test Status="Successful" | dedup Server | stats  count |  rangemap field=count  default=low</param>
    <module name="JobProgressIndicator">
        <module name="SingleValue">
            <param name="field">count</param>
            <param name="format">decimal</param>
            <param name="classField">range</param>
            <module name="Redirector">
                       <param name="popup">True</param>
               <param name="url">serverlist</param>
                       <param name="arg.servertype">$servertype$</param>
            </module>
        </module>
    </module>
</module>

Am I doing something not correctly? Is there another method to accomplish the same?

1 Solution

sideview
SplunkTrust
SplunkTrust

You cannot combine SingleValue and Redirector in this way. The error message is correct. Single Value is a dead end for the data and offers only very limited interaction. Really all you can do is set a single 'linkSearch' param that is hardcoded, accepts NO $foo$ tokens, and will run a single static search in a hardcoded view, when the user clicks the link.

Since you're already using Sideview Utils, I would go back to its documentation (the app itself contains 23 views worth of documentation), and navigate to this page:

key techniques > Linking views together > intro

Read that page and click 'next page'. You basically have two main options and that second page will show you an example of both.

1) use an HTML module to render HTML to match what you wanted SingleValue to do, and also to make an actual link that contains $foo$ tokens.

2) you can use a SubmitButton that then contains a Redirector module. When the user clicks the button they'll be redirected.

Some people still use SingleValue because it has that familiar mechanism of changing colors. It's possible to make rangemap do these background-color tricks with the HTML too; in fact once you're used to how this works it's probably a fair bit easier. I'll try and put an example in Sideview Utils soon. You're not the first to ask for one. If you beat me to it, please post. 😃

If you have any familiarity with CSS, it's not hard to cook up the background color stuff yourself. Your HTML module will have something like

<div class="$color$"><a href="serverlist?server_type="$server_type$">$errorCount$ errors</a></div>

One more note: if the values that you're putting into the link's URL may contain tricky characters you'll want to wrap use ValueSetter to make a big 'encodedArgs' field instead of referring to the raw values in the HTML module. That piece would look like this, and hopefully it's clear what it's doing.

<module name="ValueSetter">
  <param name="name">encodedArgs</param>
  <param name="urlEncodeKeys">server_type,host</param>
  <param name="value">server_type=$server_type$&amp;host=$host$</param>

  ... HTML module goes here, that uses $encodedArgs$ inside the href...

</module>

View solution in original post

sideview
SplunkTrust
SplunkTrust

You cannot combine SingleValue and Redirector in this way. The error message is correct. Single Value is a dead end for the data and offers only very limited interaction. Really all you can do is set a single 'linkSearch' param that is hardcoded, accepts NO $foo$ tokens, and will run a single static search in a hardcoded view, when the user clicks the link.

Since you're already using Sideview Utils, I would go back to its documentation (the app itself contains 23 views worth of documentation), and navigate to this page:

key techniques > Linking views together > intro

Read that page and click 'next page'. You basically have two main options and that second page will show you an example of both.

1) use an HTML module to render HTML to match what you wanted SingleValue to do, and also to make an actual link that contains $foo$ tokens.

2) you can use a SubmitButton that then contains a Redirector module. When the user clicks the button they'll be redirected.

Some people still use SingleValue because it has that familiar mechanism of changing colors. It's possible to make rangemap do these background-color tricks with the HTML too; in fact once you're used to how this works it's probably a fair bit easier. I'll try and put an example in Sideview Utils soon. You're not the first to ask for one. If you beat me to it, please post. 😃

If you have any familiarity with CSS, it's not hard to cook up the background color stuff yourself. Your HTML module will have something like

<div class="$color$"><a href="serverlist?server_type="$server_type$">$errorCount$ errors</a></div>

One more note: if the values that you're putting into the link's URL may contain tricky characters you'll want to wrap use ValueSetter to make a big 'encodedArgs' field instead of referring to the raw values in the HTML module. That piece would look like this, and hopefully it's clear what it's doing.

<module name="ValueSetter">
  <param name="name">encodedArgs</param>
  <param name="urlEncodeKeys">server_type,host</param>
  <param name="value">server_type=$server_type$&amp;host=$host$</param>

  ... HTML module goes here, that uses $encodedArgs$ inside the href...

</module>
Get Updates on the Splunk Community!

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...