All Apps and Add-ons

auto refresh to remember correct tab in Tab Switcher

ma_anand1984
Contributor

My view looks like below



Im using tabswitcher module.

I have 5 tabs.

When i change tabs, i want them to be retained on autorefresh.

Currently, it always points to first tab after refresh.

Nick,

Is there any substitue available in side view?

any help will be appreciated

1 Solution

sideview
SplunkTrust
SplunkTrust

Yes, there is an alternative in Sideview Utils.

TabSwitcher is replaced by the Tabs module and the Switcher module.

Tabs just implements the UI part of the tabs, has a param space almost identical to the Pulldown module, can thus render any combination of static or dynamic tabs, and outputs a simple key downstream, typically something like $selectedTab$.

Switcher then can be configured to read any upstream key, from a Tabs, or from a Pulldown or Checkbox, or whatever, and swaps out different subtrees of config, as defined by group attribute.

Because of the decoupling and because many switcher use cases have nearly-identical config downstream from the Switching, and because Sideview modules offer such widespread $foo$ token support, you often don't need the actual Switcher. I hope this makes sense. Basically the ability to put $selectedTab$ nearly everywhere means you don't need the nuclear option of the Switcher duplicating all your config.

Anyways, to get to the persistence part. Tabs, like the other Sideview Utils modules, works with URLLoader to prepopulate it's state from the URL.

And the URLLoader of course has a param called 'keepUrlUpdated'. When you set this param to True, that basically enables all the generic back button and forward button support.

So with all of this combined -- a URLLoader module, with KeepUrlUpdated set to True, and with a Tabs module below it, basically the tab state will get baked into the URL whenever a user changes it, (and assuming the autorefresh logic is smart enough to reload the URL rather than just reload the /app/viewName), it'll work the way you need. Let me know if it works -- the only part I'm not confident about is whether the core Splunk autorefresh will preserve the full URL.

View solution in original post

sideview
SplunkTrust
SplunkTrust

Yes, there is an alternative in Sideview Utils.

TabSwitcher is replaced by the Tabs module and the Switcher module.

Tabs just implements the UI part of the tabs, has a param space almost identical to the Pulldown module, can thus render any combination of static or dynamic tabs, and outputs a simple key downstream, typically something like $selectedTab$.

Switcher then can be configured to read any upstream key, from a Tabs, or from a Pulldown or Checkbox, or whatever, and swaps out different subtrees of config, as defined by group attribute.

Because of the decoupling and because many switcher use cases have nearly-identical config downstream from the Switching, and because Sideview modules offer such widespread $foo$ token support, you often don't need the actual Switcher. I hope this makes sense. Basically the ability to put $selectedTab$ nearly everywhere means you don't need the nuclear option of the Switcher duplicating all your config.

Anyways, to get to the persistence part. Tabs, like the other Sideview Utils modules, works with URLLoader to prepopulate it's state from the URL.

And the URLLoader of course has a param called 'keepUrlUpdated'. When you set this param to True, that basically enables all the generic back button and forward button support.

So with all of this combined -- a URLLoader module, with KeepUrlUpdated set to True, and with a Tabs module below it, basically the tab state will get baked into the URL whenever a user changes it, (and assuming the autorefresh logic is smart enough to reload the URL rather than just reload the /app/viewName), it'll work the way you need. Let me know if it works -- the only part I'm not confident about is whether the core Splunk autorefresh will preserve the full URL.

BenjaminWyatt
Communicator

Yes, that seems to be the best solution. Thank you!

0 Karma

sideview
SplunkTrust
SplunkTrust

Oh wow. Yes I'm afraid Splunk's autorefresh functionality does NOT actually refresh the current URL, but it sends the page to whatever the current URL was when the page was loaded. This ignores the possibility that something might have changed the hash part of the URL, and this unfortunately means that keepURLUpdated="True" indeed will NOT work with Splunk's autorefresh, which is sad. You could write quite a simple customBehavior to do it properly though.

BenjaminWyatt
Communicator

Thanks for the advice! After some fiddling around/requirements changes, I swapped out the ExtendedFieldSearch for a Sideview Pulldown module; however, when the page autorefreshes it still seems to be removing whatever I select in the Pulldown. I have a URLLoader with KeepUrlUpdated set to "true" immediately above the Pulldown. Thoughts as to why this might be? Is the autorefresh logic just not smart enough to refresh the whole URL?

0 Karma

sideview
SplunkTrust
SplunkTrust

I really don't recommend using ExtendedFieldSearch, for a lot of reasons, and so I really don't test it with URLLoader and you're in a kind of unsupported area. Make life easy on yourself though and replace your ExtendedFieldSearch modules with the Sideview TextField module! trade 15 lines of complex indented XML and intention foo for like 3 lines of flat TextField XML. 😃

BenjaminWyatt
Communicator

Hey Nick, I'm trying a form of the solution implemented above using Sideview's URLLoader and an ExtendedFieldSearch (for a text input box). Here's the behavior I'm observing: if I put text in the input box and search, when the form autorefreshes it will clear the text in the input box.

However, if I enter an input and then manually refresh the page, then the next auto-refresh will preserve the full URL (and along with it, my input to the text box).

Can you advise on what's happening here? Is there a way to force Splunk to honor the new input without a manual refresh?

0 Karma

sideview
SplunkTrust
SplunkTrust

Tabs came out in the 2.0 version, the current version is 2.1.2, and it's available on the Sideview site. http://sideviewapps.com/apps/sideview-utils. What's on Splunkbase is 1.3.5 and that's quite old at this point.

ma_anand1984
Contributor

I dont see tabs module in my sideview. Which version is it available? From where can i get them ?

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 ...