Splunk Dashboard: Panel not getting hidden

302 Views Asked by At

so I am trying to hide a panel based on the value of another token in a Splunk Dashboard.

Let the token on whose value the hiding of panel is dependent on is variableValue. variableValue has different Splunk values like abc, def and *. The config for this input token is as below.

</input>
    <input type="multiselect" token="variableValue" searchWhenChanged="true">
      <label>Variable Value</label>
      <choice value="abc">abc</choice>
      <choice value="def">def</choice>
      <choice value="*">ALL</choice>
      <default>*</default>
      <valuePrefix>log.request="</valuePrefix>
      <valueSuffix>"</valueSuffix>
      <delimiter> </delimiter>
    </input>

Now, I need to hide a different panel if the value of variableValue is anything other than *.

To implement this, I have used <panel depends="$panel_show$"> for that panel, and under that, put the following configuration:

<progress>
  <condition match="$variableValue$!=*">
    <set token="panel_show">true</set>
  </condition>
  <condition>
    <unset token="panel_show"></unset>
  </condition>
</progress>

However, this is not working. Can someone please help me understand what I am doing wrong here?

1

There are 1 best solutions below

1
RichG On

I'm not sure a panel can hide itself like that. I was able to get it to work by setting panelShow when variableValue changes. Also, I used the form.variableValue token rather than variableValue.

<form version="1.1" theme="light" script="simple_xml_examples:showtokens.js">
  <fieldset>
    <input type="multiselect" token="variableValue" searchWhenChanged="true">
      <label>Variable Value</label>
      <choice value="abc">abc</choice>
      <choice value="def">def</choice>
      <choice value="*">ALL</choice>
      <default>*</default>
      <valuePrefix>log.request="</valuePrefix>
      <valueSuffix>"</valueSuffix>
      <delimiter> </delimiter>
      <change>
        <condition match="$form.variableValue$!=&quot;*&quot;">
          <set token="panel_show">true</set>
        </condition>
        <condition>
          <unset token="panel_show"></unset>
        </condition>
      </change>
    </input>
  </fieldset>
<row>
  <panel depends="$panel_show$">
    <title>Test</title>
      <search><query>index=_internal earliest=-60m</query>
      <!--<progress>
        <condition match="$form.variableValue$!=&quot;*&quot;">
          <set token="panel_show">true</set>
        </condition>
        <condition>
          <unset token="panel_show"></unset>
        </condition>
      </progress>-->
    </search>
  </panel>
</row>
</form>