Plugin - Pin a filter


(Ariel) #1

Hello,
In a Kibana plugin, I would like to pin a filter after I added to the filter bar. Till now with no success. Can someone point me to such an example?

Thanks


(Stacey Gammon) #2

You should be able to use the little thumbtack icon to pin a filter on the filter bar. Does that not work for you?


(Ariel) #3

Hi Stacey,
I was not clear enough. I want to extend this plugin - https://github.com/AnnaGerber/kibana_dropdown - , that adds filters selected from a combo, and after the filter is added automatically pin it.
What I basically trying to use is the pinFilter and pinAll methods in query_filter, but does not seems to work for me,. Not sure that what I do is the right approach.


(Stacey Gammon) #4

Ah, okay. I dug into the code a bit and tried to do something similar (automatically pin a filter when it's created in filter_bar_click_handler). It looks like the filter already has to exist in appState before it can be pinned, otherwise the function will do nothing. So if you call queryFilter.pinFilter(filter) immediately after creating the filter, but before it's attached to appState, it won't do anything. That might be whats going on in your situation.

I'm sure there is a better way to do this, but in my little test I threw the call to pinFilter inside a $timeout and it worked.


(Ariel) #5

Hi Stacey. Thanks! I'll check that direction and update.


(Ariel) #6

Indeed this seems to be the issue I was facing.
Thanks Stacey


(system) #7

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.