Kibana plugin, hack file

Hi, I have kibana plugin, and I want to listen to specific changes in the store,my question is how can I subscribe to specific selectors in the hack file?
Can you give me example?
Thanks

1 Like

Could you describe what you men by "changes in the store"? Which store are we talking about?

And also could you clarify what you mean by "specific selectors" that you want to subscribe? What selectors? HTML selectors?

Cheers,
Tim

Hi,
I need to know when user click on the expand/collapse button on panel inside dashboard

1 Like

You cannot simply listen to the redux store if that's what you are asking for (in a clean way). So you would just need to listen to the appropriate elements in your hack file on clicks. You should be able to find a selector for the button by inspecting it in the Chrome dev tools. Then by listening on the clicks you can do your action.

I can already warn you, that this plugin will very likely break in every minor version release, since you are working against internals (like how to select the element), also from 6.4.0 onwards, that won't be a button anymore, but a menu instead, since we have more options.

1 Like

OK. Thanks

hi @timroes. thank you for your answer. but how can we select the element and listen to click event if we are using embese kibana iframe.
this why in the first place used kibana plugin. to catch those events.
untill now we simply uset angular $rootscope to see the changes.
but we've encounter a problem in react component like expand button of a panel.

Hi,

you should not be able to do this from outside of Kibana. Browser don't allow for interaction with a page inside an iFrame (with just a very few exceptions, like postMessage).

I think there currently is no clean way to listen to any of those. If think you would need to raise a feature request on GitHub where you should also explain your use-case why you need to hook into these places, so we can evaluate if that will be possible in the future.

Cheers,
Tim

1 Like

We have some use cases, where we had to dig in kibana source code and interver there. we maintain kibana source code with those modification for our needs.
We don't post a feature request like you suggested because we have tilor made solution that is not common with the community needs, I guess. Beside that we want to be able to adjust any changes in kibana on our own.
We already implemented expanded and collapse panel events in kibana version 5.5.3, and it was easy; we simply fire an event to the $rootScope on the expand toggle button, and in the hack.js plugin, we've listen to the $rootScope and sent POST message to the iframe host.
after upgrade to kibana 6.2.4 we have notice that panel implementet in react. so we need the same solution with diffrent implementaion.
We can dig in again in kibana source code and put some where an emit of some event.

sorry for the long explanation, but I have a fiiliing that we are closed to acomolish the upgrade but missing something.

  1. I cannot figure out why if I susbscribe the changes in the store. I get the events of any changes on the dashboard, but they are always undefined.
  2. if I want to susbscribe to selectors Ii need to provide panel Id. but I don't know how.

thank you again @timroes for all your support :slight_smile:

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