Dashboards & Visualizations

Can I edit the "Hide filters" link to a button?

MariaBianca
New Member

I would like to change the "Hide filters" link that appears in the dashboards to a button like the "Submit" button. Can I do that?

0 Karma

niketn
Legend

@MariaBianca, save the following as filters_link_to_button.js under your Splunk App's appserver static folder, which should typically look like $SPLUNK_HOME/etc/apps/<YourAppName>/appserver/static:

require([
    "splunkjs/mvc/simplexml/ready!"
], function() {
    $(".hide-global-filters").addClass("btn");
    $(".hide-global-filters").on("click",function(){
        setTimeout(function() {         
            $(".show-global-filters").addClass("btn");
        }, 100);
    });
});

This JavaScript converts Hide Filters and Show Filters links to buttons by adding class btn using jQuery Selector.

Then include the script in your view form's root node:

<form script="filters_link_to_button.js">

Since this requires JavaScript, you would need to refresh/restart Splunk and may also need to clear internet browser history if the do not reflect.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

vinothn
Path Finder

@niketnilay i have a scenario where i need to show dynamic title based on the previous page selection.
To attain this we cannot use label since it is not accepting token, so i solved this issue by using html and hidetitle in the dashboard.
But i have some input filters if i use it with fieldset the dashboard title will come after the filters row so instead of that i included the inputs inside the row panel and this solves all.
Only issue is in this approach i wont get hide filters option.
since i am not using fieldset i am missing the default option of hidefilters.
can you please guide how to add hide filters externally.

Thanks in advance.

0 Karma

niketn
Legend

@vinothn your question seems to be different from what was originally posted. Hope you had posted your question separately. Also this has been solved before using <html> panel as header title and hiding the default Label/Description of the dashboard.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

rjthibod
Champion

You cannot change the built-in link very easily. You can hide the built-in link and then add your own button.

Trying to do either will require custom JavaScript no matter what.

If you want to go that route, I suggest you check out the work I already did somewhat related to this. In my app Developer Gadgets for Splunk (https://splunkbase.splunk.com/app/3689/), I have a slider on the bottom right of the dashboard that has a custom Submit button and a checkbox that extends the "Hide Filters" function to hide all inputs in all panels, not just the top of the dashboard.

You could take the JS for the checkbox input hiding and the custom button out of that code and adapt it to your needs.

Get Updates on the Splunk Community!

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

Splunk Decoded: Business Transactions vs Business IQ

It’s the morning of Black Friday, and your e-commerce site is handling 10x normal traffic. Orders are flowing, ...

Fastest way to demo Observability

I’ve been having a lot of fun learning about Kubernetes and Observability. I set myself an interesting ...