TIPS & TRICKS TIPS & TRICKS

Load 'Em Up and Move 'Em Out: Controlling Dashboard Panel Load Order

The following is a guest post from Clara MerrimanBusiness Intelligence Engineer, Data Technology at SONIFI Solutions.

Okay, you’ve created an amazing dashboard full of wonderful insights. It’s got everything anyone could ever need. But it has too many panels for one user to run at one time. Searches start to lag, or run into errors, and nobody wants that.

You need to implement a solution that allows the user to pick and choose which panels they want to run, in the order of importance to them. Maybe they only need to see two panels out of the whole dashboard, or maybe that revenue panel takes higher priority for Ops than it does for IT.

Let’s look at a few ways to load dashboard panels in any order, based on user input.

Approach A: Set It and Forget It

With this approach, a user can click on a radio button to run the search for any specific panel. If they click on another radio button, a new panel search starts and all other panels are unset, including the one just loaded. This approach truly is only loading one panel at a time. Even if the search is fully completed, when the user opts for a new search to run, it will unset the token and the panel results will disappear.

Here is an example of the simpleXML:

<form>
        <label>Set It and Forget It</label>
        <fieldset submitButton="false" autoRun="false">  
                 <input type="radio" token="panel">
                               <label>Run Panels</label>
                               <choice value="1">Panel 1</choice>
                               <choice value="2">Panel 2</choice>
                               <choice value="3">Panel 3</choice>  
                               <change>
                                      <condition value="1">
                                                 <set token="pan1">&#32;</set>
                                                 <unset token="pan2"></unset>
                                                 <unset token="pan3"></unset>  
                                       </condition>
                                      <condition value="2">
                                                 <set token="pan2">&#32;</set>
                                                 <unset token="pan1"></unset>
                                                 <unset token="pan3"></unset>  
                                       </condition>
                                      <condition value="3">
                                                 <set token="pan3">&#32;</set>
                                                 <unset token="pan1"></unset>
                                                 <unset token="pan2"></unset>  
                                       </condition>      
                                </change>
                 </input>
           </fieldset>
           <row>
                 <panel depends="$pan1$">
                               <title>Panel 1</title>
                               <table>
                                      <search>
                                                 <query>$pan1$ index=_internal|stats count</query>
                                                 <earliest>-7d@d</earliest>
                                                 <latest>now</latest>
                                                 <sampleRatio>1</sampleRatio>
                                      </search>
                                      <option name="count">100</option>
                                      <option name="rowNumbers">false</option>
                                      <option name="wrap">true</option>
                               </table>
                 </panel>
           </row>

This panel uses condition statements for each input value, setting them to whitespace (&#32;) and unsetting all other tokens. Each panel uses the depends argument to show only the active panel. The query looks for the token, so it only runs if the token is set.

Using this method, you’ll see something like this:

Selecting Panel 1 displays Panel 1 and begins the search, but when you select Panel 2, the search replaces Panel 1 as it begins to run.

Approach B: Keep on Keepin’ On

This approach allows for a little more flexibility to keep results and run more than one panel at a time, if a user so chooses. It is similar to the previous approach; however, it is less tedious if you have a lot of tokens to set and unset.

Here is an example of the simpleXML:

<form>
        <init>
                 <unset token="pan1"></unset>
                 <unset token="pan2"></unset>
                 <unset token="pan3"></unset>  
         </init>
        <label>Keep On Keepin' On</label>
        <fieldset submitButton="false" autoRun="false">  
                 <input type="radio" token="panel">
                               <label>Run Panels</label>
                               <choice value="1">Panel 1</choice>
                               <choice value="2">Panel 2</choice>
                               <choice value="3">Panel 3</choice>  
                               <change>
                                      <condition value="1">
                                                 <set token="pan1">&#32;</set>
                                      </condition>
                                      <condition value="2">
                                                 <set token="pan2">&#32;</set>
                                      </condition>
                                      <condition value="3">
                                                 <set token="pan3">&#32;</set>
                                      </condition>      
                                </change>
                 </input>
           </fieldset>
           <row>
                 <panel depends="$pan1$">
                               <title>Panel 1</title>
                               <table>
                                      <search>
                                                 <query>$pan1$ index=_internal|stats count</query>
                                                 <earliest>-7d@d</earliest>
                                                 <latest>now</latest>
                                                 <sampleRatio>1</sampleRatio>
                                      </search>
                                      <option name="count">100</option>
                                      <option name="rowNumbers">false</option>
                                      <option name="wrap">true</option>
                               </table>
                 </panel>
           </row>

As you can see in this example, we use the <init> attribute to unset all the tokens when the dashboard loads. From there, we no longer need to unset each token in our condition statements.

Here is what it might look like in your dashboard:

In this view, I selected Panel 1, followed by Panel 2. You can see that Panel 2 has already finished searching and the results are visible, and Panel 1 is still running. Panel 3 is not visible because of the depends arguments and would only populate if I had selected that radio button.

Which is Better?

Approach A restricts a user to run only one search at a time. When they select another panel, the original panel and results disappear. If the user did not export the results, they need to run the search again to see them.

Approach B allows for a more flexible work environment. It enables users to run more than one search at a time and keep the results even after they select another panel. For the dashboard developer, if you are working with a lot of panels, you only need to write the <unset> attributes for each panel once, instead of for each input choice.

If you can trust your users not to press all of the buttons at the same time, and if the search load is not prohibitive, Approach B provides a better user experience.  

Final Thoughts

I hope these approaches will help you Splunkify your dashboards and impress your users. Happy Splunking! 

Clara Merriman
Business Intelligence Engineer, Data Technology
SONIFI Solutions

guest
Posted by guest

Join the Discussion