All Apps and Add-ons

pulldown selection reset to default upon dashboard refresh

sansay
Contributor

I just created a dashboard using sideview pulldown.
Seems very nice to use, but, I was very disappointed to discover that upon auto-refresh my selections were reset to the default values. The version we have here is 2.4.10. and no, sadly enough, it's not going to be easy to get it updated.
Anyone know how to prevent this?


Here is the code I tried after reading Nick's answer.
Keep in mind that this is a test version with only one chart.
The complete version shows 9 charts.


<view autoCancelInterval="90" isVisible="true" objectMode="SimpleDashboard" onunloadCancelJobs="true" refresh="90" template="dashboard.html">
<label>Line Resources Overview</label>
<module name="SideviewUtils" layoutPanel="appHeader" />
<module name="AppBar" layoutPanel="navigationHeader"/>
<module name="TitleBar" layoutPanel="viewHeader">
<param name="showActionsMenu">False</param>
</module>
<module name="Message" layoutPanel="navigationHeader">
<param name="filter">splunk.search.job</param>
<param name="clearOnJobDispatch">True</param>
<param name="maxSize">1</param>
<param name="level">warn</param>
</module>
<module name="URLLoader" layoutPanel="appHeader" autoRun="True">
<param name="keepURLUpdated" >True</param>
<module name="Pulldown" layoutPanel="viewHeader">
<param name="name">selectedLine</param>
<param name="label">Line</param>
<param name="float">left</param>
<param name="staticOptions">
<list>
<param name="label">E1</param>
<param name="value">e1</param>
</list>
<list>
<param name="label">D1</param>
<param name="value">d1</param>
</list>
<list>
<param name="label">D2</param>
<param name="value">d2</param>
</list>
</param>
<module name="Pulldown" layoutPanel="viewHeader">
<param name="name">selectedType</param>
<param name="label">Type</param>
<param name="float">left</param>
<param name="staticOptions">
<list>
<param name="label">Apache</param>
<param name="value">w</param>
</list>
<list>
<param name="label">Tomcat</param>
<param name="value">t</param>
</list>
<list>
<param name="label">SysEng</param>
<param name="value">sys</param>
</list>
</param>
<module name="Search" layoutPanel="panel_row1_col1" group="Load Average (1m)" autoRun="True">
<param name="search">'
LRO_load_average($selectedLine$,$selectedType$)'</param>
<module name="HiddenFieldPicker">
<param name="strictMode">True</param>
<module name="HiddenChartFormatter">
<param name="charting.chart">line</param>
<param name="charting.legend.placement">right</param>
<param name="charting.axisTitleX">none</param>
<param name="charting.axisTitleY">none</param>
<param name="charting.chart.nullValueMode">connect</param>
<param name="charting.layout.splitSeries">false</param>
<module name="FlashChart">
<param name="width">100%</param>
<!--<param name="height">260px</param>-->
<module name="Gimp"/>
<module name="ConvertToDrilldownSearch">
<module name="ViewRedirector">
<param name="viewTarget">flashtimeline</param>
</module>
</module>
</module>
<module name="ViewRedirectorLink">
<param name="viewTarget">flashtimeline</param>
</module>
</module>
</module>
</module>
</module>
</module>
</module>
</view>

1 Solution

sideview
SplunkTrust
SplunkTrust

There's a few kinds of autorefresh, but you can address this particular problem no matter which one you're using.

1) If you're using refresh=300 or the like, up in the <view> tag at the top of the page, well this will simply refresh the whole page every N seconds. So the page will return to its initial state and any selections will be removed.

However, if at the top of the xml hierarchy you have a Sideview URLLoader module, and furthermore if you have set <param name="keepURLUpdated">True</param> then whenever the Pulldown's selection (or any other sideview form element module) is changed, the URL will update to reflect that selection. Then when refresh=300 comes along, those explicit selection states will be reloaded. There is a page of docs dedicated to this param in URLLoader and you'll find it at "Key Techniques > Enabling the Back Button".

2) If you're using the Sideview AutoRefresh module instead, then you aren't really subject to this problem in the first place. By default the AutoRefresh module works by just refreshing the modules downstream from it, every N seconds. But by doing this without reloading the page, selection states in all those downstream modules are preserved. I recommend using the AutoRefresh module, just because it's a more precise tool and reduces a lot of unwanted flashing that comes from reloading the entire page.

UPDATE.

I took the liberty of taking your posted XML from your update and updating it below. The biggest problem with the XML was that you had nested an autoRun="True" module inside another autoRun="True" module, and that often results in a buggy UI. When you see "AutoRun" read it as "start pushing data downstream from this point when the page loads", and it'll be more clear why you never want one such point downstream from another.

Other minor things in the edited XML below - Gimp module does nothing in advanced xml so I removed it. Likewise HiddenFieldPicker wasn't doing anything so I removed it. Also since the ValueSetter module can set any key rather than just "charting.*" keys, I recommend using ValueSetter over HiddenChartFormatter. And lastly the value of "autoCancelInterval" was the default value so I removed it.

<view isVisible="true" onunloadCancelJobs="true" refresh="90" template="dashboard.html">
  <label>Line Resources Overview</label>
  <module name="SideviewUtils" layoutPanel="appHeader" />
  <module name="AppBar" layoutPanel="navigationHeader"/>
  <module name="TitleBar" layoutPanel="viewHeader"> 
    <param name="showActionsMenu">False</param>
  </module>
  <module name="Message" layoutPanel="navigationHeader">
    <param name="filter">splunk.search.job</param>
    <param name="clearOnJobDispatch">True</param>
    <param name="maxSize">1</param>
    <param name="level">warn</param>
  </module>

  <module name="URLLoader" layoutPanel="appHeader" autoRun="True">
    <param name="keepURLUpdated" >True</param>

    <module name="Pulldown" layoutPanel="viewHeader">
      <param name="name">selectedLine</param>
      <param name="label">Line</param>
      <param name="float">left</param>
      <param name="staticOptions">
        <list>
          <param name="label">E1</param>
          <param name="value">e1</param>
        </list>
        <list>
          <param name="label">D1</param>
          <param name="value">d1</param>
        </list>
        <list>
          <param name="label">D2</param>
          <param name="value">d2</param>
        </list>
      </param>

      <module name="Pulldown" layoutPanel="viewHeader">
        <param name="name">selectedType</param>
        <param name="label">Type</param>
        <param name="float">left</param>
        <param name="staticOptions">
          <list>
            <param name="label">Apache</param>
            <param name="value">w</param>
          </list>
          <list>
            <param name="label">Tomcat</param>
            <param name="value">t</param>
          </list>
          <list>
            <param name="label">SysEng</param>
            <param name="value">sys</param>
          </list>
        </param>

        <module name="Search" layoutPanel="panel_row1_col1" group="Load Average (1m)">
          <param name="search">'LRO_load_average($selectedLine$,$selectedType$)'</param>

          <module name="ValueSetter">
            <param name="arg.charting.chart">line</param>
            <param name="arg.charting.legend.placement">right</param>
            <param name="arg.charting.axisTitleX">none</param>
            <param name="arg.charting.axisTitleY">none</param>
            <param name="arg.charting.chart.nullValueMode">connect</param>
            <param name="arg.charting.layout.splitSeries">false</param>
            <module name="FlashChart">
              <param name="width">100%</param>
              <module name="ConvertToDrilldownSearch">
                <module name="ViewRedirector">
                  <param name="viewTarget">flashtimeline</param>
                </module>
              </module>
            </module>
            <module name="ViewRedirectorLink">
              <param name="viewTarget">flashtimeline</param>
            </module>
          </module>
        </module>
      </module>
    </module>
  </module>
</view>

View solution in original post

sideview
SplunkTrust
SplunkTrust

There's a few kinds of autorefresh, but you can address this particular problem no matter which one you're using.

1) If you're using refresh=300 or the like, up in the <view> tag at the top of the page, well this will simply refresh the whole page every N seconds. So the page will return to its initial state and any selections will be removed.

However, if at the top of the xml hierarchy you have a Sideview URLLoader module, and furthermore if you have set <param name="keepURLUpdated">True</param> then whenever the Pulldown's selection (or any other sideview form element module) is changed, the URL will update to reflect that selection. Then when refresh=300 comes along, those explicit selection states will be reloaded. There is a page of docs dedicated to this param in URLLoader and you'll find it at "Key Techniques > Enabling the Back Button".

2) If you're using the Sideview AutoRefresh module instead, then you aren't really subject to this problem in the first place. By default the AutoRefresh module works by just refreshing the modules downstream from it, every N seconds. But by doing this without reloading the page, selection states in all those downstream modules are preserved. I recommend using the AutoRefresh module, just because it's a more precise tool and reduces a lot of unwanted flashing that comes from reloading the entire page.

UPDATE.

I took the liberty of taking your posted XML from your update and updating it below. The biggest problem with the XML was that you had nested an autoRun="True" module inside another autoRun="True" module, and that often results in a buggy UI. When you see "AutoRun" read it as "start pushing data downstream from this point when the page loads", and it'll be more clear why you never want one such point downstream from another.

Other minor things in the edited XML below - Gimp module does nothing in advanced xml so I removed it. Likewise HiddenFieldPicker wasn't doing anything so I removed it. Also since the ValueSetter module can set any key rather than just "charting.*" keys, I recommend using ValueSetter over HiddenChartFormatter. And lastly the value of "autoCancelInterval" was the default value so I removed it.

<view isVisible="true" onunloadCancelJobs="true" refresh="90" template="dashboard.html">
  <label>Line Resources Overview</label>
  <module name="SideviewUtils" layoutPanel="appHeader" />
  <module name="AppBar" layoutPanel="navigationHeader"/>
  <module name="TitleBar" layoutPanel="viewHeader"> 
    <param name="showActionsMenu">False</param>
  </module>
  <module name="Message" layoutPanel="navigationHeader">
    <param name="filter">splunk.search.job</param>
    <param name="clearOnJobDispatch">True</param>
    <param name="maxSize">1</param>
    <param name="level">warn</param>
  </module>

  <module name="URLLoader" layoutPanel="appHeader" autoRun="True">
    <param name="keepURLUpdated" >True</param>

    <module name="Pulldown" layoutPanel="viewHeader">
      <param name="name">selectedLine</param>
      <param name="label">Line</param>
      <param name="float">left</param>
      <param name="staticOptions">
        <list>
          <param name="label">E1</param>
          <param name="value">e1</param>
        </list>
        <list>
          <param name="label">D1</param>
          <param name="value">d1</param>
        </list>
        <list>
          <param name="label">D2</param>
          <param name="value">d2</param>
        </list>
      </param>

      <module name="Pulldown" layoutPanel="viewHeader">
        <param name="name">selectedType</param>
        <param name="label">Type</param>
        <param name="float">left</param>
        <param name="staticOptions">
          <list>
            <param name="label">Apache</param>
            <param name="value">w</param>
          </list>
          <list>
            <param name="label">Tomcat</param>
            <param name="value">t</param>
          </list>
          <list>
            <param name="label">SysEng</param>
            <param name="value">sys</param>
          </list>
        </param>

        <module name="Search" layoutPanel="panel_row1_col1" group="Load Average (1m)">
          <param name="search">'LRO_load_average($selectedLine$,$selectedType$)'</param>

          <module name="ValueSetter">
            <param name="arg.charting.chart">line</param>
            <param name="arg.charting.legend.placement">right</param>
            <param name="arg.charting.axisTitleX">none</param>
            <param name="arg.charting.axisTitleY">none</param>
            <param name="arg.charting.chart.nullValueMode">connect</param>
            <param name="arg.charting.layout.splitSeries">false</param>
            <module name="FlashChart">
              <param name="width">100%</param>
              <module name="ConvertToDrilldownSearch">
                <module name="ViewRedirector">
                  <param name="viewTarget">flashtimeline</param>
                </module>
              </module>
            </module>
            <module name="ViewRedirectorLink">
              <param name="viewTarget">flashtimeline</param>
            </module>
          </module>
        </module>
      </module>
    </module>
  </module>
</view>

sideview
SplunkTrust
SplunkTrust

Excellent. I'm glad to hear it. yvw.

0 Karma

sansay
Contributor

Alright, we have now the latest version, 3.2.8, so I changed the code to add the AutoRefresh module and put back the ValueSetter module, and all works as expected.
Nick, I thank you very much for all your help, this includes all the little suggestions for cleaner code.

0 Karma

sideview
SplunkTrust
SplunkTrust

Weird - ok yea I guess back in 2.4.X there was some kind of problem around pulldown prepopulation here. Likewise that long ago ValueSetter didn't have the arg.* syntax. My apologies. Update as soon as you can. I'm happy to peek over a quick webex if that doesn't fix it.

0 Karma

sansay
Contributor

I tried your version, but it didn't work. The settings reverted to the default values just as in my version.
Also, when I first saved your version I got 3 errors such as:
Unknown parameter 'arg.charting.chart.nullValueMode' is defined for module ValueSetter. Make sure the parameter is specified in ValueSetter.conf.

So, I had to revert the code to using the HiddentChartFormatter module. Otherwise everything else was just the code you posted. I tried with both Chrome and Firefox.
Unless you can think of something else, I will just wait until we get SideView updated and use AutoRefresh module

0 Karma

sideview
SplunkTrust
SplunkTrust

Great. I took a look and posted an edited version with some comments as an update on my answer above.

0 Karma

sansay
Contributor

Hello Nick,
Yesterday I added the code I used with your second suggestion. Could you please take a look and let me know if you can see anything wrong with it?

0 Karma

sansay
Contributor

Thank you very much for the prompt answer.
Unfortunately I couldn't try the AutoRefresh module since that was added in version 3.0. However I got the right people to agree to update Sideview on Monday.
In the meantime I decided to try the URLLoader approach, and I am sorry to report that it didn't work: the PullDown value reset, and in fact the URL reverts to the original call. I tried this with both Firefox and Chrome.

I will add the code I tried in my question.

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...