I have a requirement, where i need to provide the Kibana dashboard URL to the user.
i have created a control in the dashboard labeled Instance which has list of values example, aa, bb cc etc
i need to format url dynamically i have the dashboard name(my-dashboard), control label name(instance) and control label value(aa)
something like this
https://localhost:5601/app/dashboards#/view/my-dashboard?instance=aa
and when the page opens the control should have value aa preselected
Hi @Arun_Kumar_V Welcome to the Elastic community.
You can embed kibana dashboard in your application and give to your end user. You can check this detail blog.
1 Like
@Arun_Kumar_V It is technically possible to do this, but it unfortunately isn't the easiest process ATM. Here's the steps you should follow:
-
Create your dashboard with your desired controls and save your dashboard.
-
Make a single selection in the control you wish to manipulate via the URL
-
Click Share > Get links > Snapshot > Copy URL (ensure that "Short URL" is not toggled)
This should generate a link that ends with a long serialized control group, like so:
.../app/dashboards#/view/e1dc8186-8ab9-4fd4-ab0a-420f19679aad?_g=(refreshInterval:(pause:!t,value:60000),time:(from:now-15m,to:now))&_a=(controlGroupInput:(chainingSystem:HIERARCHICAL,controlStyle:oneLine,id:control_group_e041035a-db86-4492-8384-ca6fa6728a9e,ignoreParentSettings:(ignoreFilters:!f,ignoreQuery:!f,ignoreTimerange:!f,ignoreValidations:!f),panels:('72f3fae4-e6ba-40b6-9d79-cfa476029817':(explicitInput:(dataViewId:'90943e30-9a47-11e8-b64d-95841ca0b247',fieldName:machine.os.keyword,grow:!t,id:'72f3fae4-e6ba-40b6-9d79-cfa476029817',searchTechnique:prefix,selectedOptions:!('win%20xp'),title:machine.os.keyword,width:medium),grow:!t,order:0,type:optionsListControl,width:medium))))
-
At the end of the URL, you'll notice the "app state" has been serialized under the _a
URL parameter - the part you need to care about is the selectedOptions
key:
_a=(controlGroupInput:(...,selectedOptions:!('win%20xp'),...))
This is where you could change the value to dynamically generate the URL. So, in your example, you could have something like:
_a=(controlGroupInput:(...,selectedOptions:!('aa'),...))
which, when combined with the entire URL, would look something like:
https://localhost:5601/app/dashboards#/view/my-dashboard?_a=(controlGroupInput:(chainingSystem:HIERARCHICAL,controlStyle:oneLine,id:control_group_e041035a-db86-4492-8384-ca6fa6728a9e,ignoreParentSettings:(ignoreFilters:!f,ignoreQuery:!f,ignoreTimerange:!f,ignoreValidations:!f),panels:('72f3fae4-e6ba-40b6-9d79-cfa476029817':(explicitInput:(dataViewId:'90943e30-9a47-11e8-b64d-95841ca0b247',fieldName:instance.keyword,grow:!t,id:'72f3fae4-e6ba-40b6-9d79-cfa476029817',searchTechnique:prefix,selectedOptions:!('aa'),title:instance,width:medium),grow:!t,order:0,type:optionsListControl,width:medium))))
Hopefully that helps!