I've got a pretty basic Kibana plugin that is running on the client side (no server side logic), and I have a Kibana visualization inside of an iframe. In the parent, I have some values that I would like the plugin to be able to access. These values will only be set once on initialization of the iframe.
Is there a way to set some global state in Kibana on load and access it via a client side plugin at some later time?
I came across this thread which seems promising but out of date: Kibana Plugins: Using _g and _a in URL to pass state is there an updated way to do this in Kibana 7+
Thanks in advance!
My understanding is you have Kibana running in an
<iframe> and you would like to pass some data to that
<iframe>. Maybe you could use
Window.postMessage() API to communicate between your parent window and Kibana.
Pretty good idea, I don't know how I didn't stumble on that in my research!
I guess my fear with using that would be how long MessageEvents are persisted on the target windows queue.
Basically the parent frame will load the kibana iframe and most likely end up calling
Window.postMessage() before the Kibana plugin event listener fully instantiated. Do you know if it it still consume the message after the plugin is instantiated?
@gurtgurt I don't think the
.postMessage() messages are queued. What you could do is when your plugin instantiates it would send a message to the parent window. Then parent window would know that the plugin is ready and send the data to the
I think that could work.
As another solution, are you aware if there is an updated to pass global and application state into a kibana plugin via the
_a query parameters in Kibana 7+? The current Kibana iframe we are presenting already passes those in to get things like time filters added. The link I added in the original post discusses accessing those states via an angular service that was supposed to be (maybe already is?) deprecated
_a URL variables still exist in Kibana. But the structure of those objects can change any time and Kibana might even decide to remove those in the future. So, although you can use now
_a, those URL variables are internal implementation detail of Dashboard and Discover apps.
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.